本文整理匯總了Java中com.j256.ormlite.stmt.Where.isNotNull方法的典型用法代碼示例。如果您正苦於以下問題:Java Where.isNotNull方法的具體用法?Java Where.isNotNull怎麽用?Java Where.isNotNull使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.j256.ormlite.stmt.Where
的用法示例。
在下文中一共展示了Where.isNotNull方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: deleteByColumnName
import com.j256.ormlite.stmt.Where; //導入方法依賴的package包/類
/**
* 通過表列名來刪除
*
* @param map key是列名,value是列對應的值
* @return
*/
public boolean deleteByColumnName(Map<String, Object> map) {
int result = 0;
DeleteBuilder deleteBuilder = ormLiteDao.deleteBuilder();
Where where = deleteBuilder.where();
try {
where.isNotNull("id");
for (Map.Entry<String, Object> entry : map.entrySet()) {
where.and().eq(entry.getKey(), entry.getValue());
}
result = deleteBuilder.delete();
} catch (SQLException e) {
LogUtils.e("delete error,delete line:" + result, e);
return false;
}
return result > 0;
}
示例2: getCount
import com.j256.ormlite.stmt.Where; //導入方法依賴的package包/類
/**
* 獲取滿足指定條件的記錄數
*
* @param map 查詢條件鍵值組合
* @return
*/
public long getCount(Map<String, Object> map) {
long count = 0;
QueryBuilder queryBuilder = ormLiteDao.queryBuilder();
queryBuilder.setCountOf(true);
Where where = queryBuilder.where();
try {
where.isNotNull("id");
for (Map.Entry<String, Object> entry : map.entrySet()) {
where.and().eq(entry.getKey(), entry.getValue());
}
PreparedQuery<T> preparedQuery = queryBuilder.prepare();
count = ormLiteDao.countOf(preparedQuery);
} catch (SQLException e) {
LogUtils.e(e);
}
return count;
}
示例3: queryForPagesByOrder
import com.j256.ormlite.stmt.Where; //導入方法依賴的package包/類
/**
* 分頁查詢,並按列排序
*
* @param orderColumn 排序列名
* @param ascending true為升序,false為降序
* @param offset 搜索下標
* @param count 搜索條數
* @return 分頁查詢後的數據集
*/
public List<T> queryForPagesByOrder(String orderColumn, boolean ascending, Long offset, Long count) {
List<T> list = null;
QueryBuilder queryBuilder = ormLiteDao.queryBuilder();
Where where = queryBuilder.where();
try {
where.isNotNull(orderColumn);
queryBuilder.orderBy(orderColumn, ascending);
queryBuilder.offset(offset);
queryBuilder.limit(count);
list = queryBuilder.query();
} catch (SQLException e) {
LogUtils.e(e);
}
return list;
}
示例4: queryForFirst
import com.j256.ormlite.stmt.Where; //導入方法依賴的package包/類
/**
* 通過表列名查詢第一條記錄
*
* @param map
* @return
*/
public T queryForFirst(Map<String, Object> map) {
T t = null;
QueryBuilder<T, Integer> queryBuilder = ormLiteDao.queryBuilder();
Where where = queryBuilder.where();
try {
where.isNotNull("id");
for (Map.Entry<String, Object> entry : map.entrySet()) {
where.and().eq(entry.getKey(), entry.getValue());
}
t = queryBuilder.queryForFirst();
} catch (SQLException e) {
LogUtils.e(e);
}
return t;
}
示例5: queryForFirstByOrder
import com.j256.ormlite.stmt.Where; //導入方法依賴的package包/類
/**
* 排序查詢
*
* @param map 查詢條件鍵值組合
* @param orderColumn 排序的列
* @param ascending 是否升序
* @return
*/
public T queryForFirstByOrder(Map<String, Object> map, String orderColumn, boolean ascending) {
T t = null;
QueryBuilder<T, Integer> queryBuilder = ormLiteDao.queryBuilder();
Where where = queryBuilder.where();
try {
queryBuilder.orderBy(orderColumn, ascending);
where.isNotNull("id");
for (Map.Entry<String, Object> entry : map.entrySet()) {
where.and().eq(entry.getKey(), entry.getValue());
}
t = queryBuilder.queryForFirst();
} catch (SQLException e) {
LogUtils.e(e);
}
return t;
}
示例6: queryAllByOrder
import com.j256.ormlite.stmt.Where; //導入方法依賴的package包/類
/**
* 排序查詢
*
* @param orderColumn 排序的列
* @param ascending true為升序,false為降序
* @return
*/
public List<T> queryAllByOrder(String orderColumn, boolean ascending) {
List<T> list = null;
QueryBuilder queryBuilder = ormLiteDao.queryBuilder();
Where where = queryBuilder.where();
try {
where.isNotNull(orderColumn);
queryBuilder.orderBy(orderColumn, ascending);
list = queryBuilder.query();
} catch (SQLException e) {
LogUtils.e(e);
}
return list;
}