本文整理匯總了Java中com.j256.ormlite.stmt.DeleteBuilder.where方法的典型用法代碼示例。如果您正苦於以下問題:Java DeleteBuilder.where方法的具體用法?Java DeleteBuilder.where怎麽用?Java DeleteBuilder.where使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.j256.ormlite.stmt.DeleteBuilder
的用法示例。
在下文中一共展示了DeleteBuilder.where方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: deleteByColumnName
import com.j256.ormlite.stmt.DeleteBuilder; //導入方法依賴的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: deleteTempMessages
import com.j256.ormlite.stmt.DeleteBuilder; //導入方法依賴的package包/類
public void deleteTempMessages(List<Long> dialogOccupantsIdsList) {
try {
DeleteBuilder<Message, Long> deleteBuilder = dao.deleteBuilder();
Where<Message, Long> where = deleteBuilder.where();
where.and(
where.in(DialogOccupant.Column.ID, dialogOccupantsIdsList),
where.or(
where.eq(Message.Column.STATE, State.TEMP_LOCAL),
where.eq(Message.Column.STATE, State.TEMP_LOCAL_UNREAD)
)
);
if (deleteBuilder.delete() > 0) {
//TODO VT need to think how to send IDs to observers
notifyObserversDeletedById(dialogOccupantsIdsList);
}
} catch (SQLException e) {
ErrorUtils.logError(e);
}
}
示例3: deleteMarkReadAndUnread
import com.j256.ormlite.stmt.DeleteBuilder; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
public int deleteMarkReadAndUnread(Article article) {
try {
DeleteBuilder<ArticleSyncAction, Integer> deleteBuilder = deleteBuilder();
Where<ArticleSyncAction, Integer> where = deleteBuilder.where();
where.and(where.eq(COLUMN_ARTICLEID, article.getId()),
where.eq(COLUMN_ACTION, ArticleSyncAction.Action.MarkRead)
.or().eq(COLUMN_ACTION, ArticleSyncAction.Action.MarkUnread));
return deleteBuilder.delete();
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
示例4: deleteMarkStarredAndUnStarred
import com.j256.ormlite.stmt.DeleteBuilder; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
public int deleteMarkStarredAndUnStarred(Article article) {
try {
DeleteBuilder<ArticleSyncAction, Integer> deleteBuilder = deleteBuilder();
Where<ArticleSyncAction, Integer> where = deleteBuilder.where();
where.and(where.eq(COLUMN_ARTICLEID, article.getId()),
where.eq(COLUMN_ACTION, ArticleSyncAction.Action.MarkStarred)
.or().eq(COLUMN_ACTION, ArticleSyncAction.Action.MarkUnstarred));
return deleteBuilder.delete();
} catch (SQLException e) {
throw new RuntimeException(e);
}
}