本文整理汇总了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);
}
}