本文整理匯總了Java中com.j256.ormlite.stmt.DeleteBuilder.delete方法的典型用法代碼示例。如果您正苦於以下問題:Java DeleteBuilder.delete方法的具體用法?Java DeleteBuilder.delete怎麽用?Java DeleteBuilder.delete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.j256.ormlite.stmt.DeleteBuilder
的用法示例。
在下文中一共展示了DeleteBuilder.delete方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: deleteAll
import com.j256.ormlite.stmt.DeleteBuilder; //導入方法依賴的package包/類
@Override
public int deleteAll()
{
try
{
DeleteBuilder<FocusItemInfo, Long> deleteBuilder = mFocusItemInfoDao.deleteBuilder();
deleteBuilder.where().isNotNull("id");
return deleteBuilder.delete();
}
catch (SQLException e)
{
e.printStackTrace();
}
return super.deleteAll();
}
示例2: deleteAll
import com.j256.ormlite.stmt.DeleteBuilder; //導入方法依賴的package包/類
@Override
public int deleteAll()
{
try
{
DeleteBuilder<MyFavorites, Long> deleteBuilder = mMyFavoritesDao.deleteBuilder();
deleteBuilder.where().isNotNull("albumid");
return deleteBuilder.delete();
}
catch (SQLException e)
{
e.printStackTrace();
}
return super.deleteAll();
}
示例3: deleteByAlbumid
import com.j256.ormlite.stmt.DeleteBuilder; //導入方法依賴的package包/類
/**
*
* @param albumid
* @return
*/
public int deleteByAlbumid(String albumid)
{
try
{
DeleteBuilder<PhotoInfo, Long> deleteBuilder = mPhotoDao.deleteBuilder();
deleteBuilder.where().eq("albumid", albumid);
return deleteBuilder.delete();
}
catch (SQLException e)
{
e.printStackTrace();
}
return super.deleteAll();
}
示例4: deleteAll
import com.j256.ormlite.stmt.DeleteBuilder; //導入方法依賴的package包/類
@Override
public int deleteAll()
{
try
{
DeleteBuilder<AlbumInfo, Long> deleteBuilder = mAlbumDao.deleteBuilder();
deleteBuilder.where().isNotNull("albumid");
return deleteBuilder.delete();
}
catch (SQLException e)
{
e.printStackTrace();
}
return super.deleteAll();
}
示例5: onUpgrade
import com.j256.ormlite.stmt.DeleteBuilder; //導入方法依賴的package包/類
/**
* This is called when your application is upgraded and it has a higher version number. This allows you to adjust
* the various data to match the new version number.
*/
@Override
public void onUpgrade(SQLiteDatabase db, ConnectionSource connectionSource, int oldVersion, int newVersion) {
try {
Log.i(TAG, "onUpgrade");
TableUtils.dropTable(connectionSource, SuspectedApp.class, true);
Log.d(TAG, String.format("Dropped suspected app table!"));
Dao<WhiteEntry, Integer> whiteListDao = getWhiteListDao();
DeleteBuilder<WhiteEntry, Integer> deleteBuilder = whiteListDao.deleteBuilder();
deleteBuilder.where().eq("systemEntry", Boolean.TRUE);
int deleted = deleteBuilder.delete();
Log.d(TAG, String.format("Delete %d old system whitelist entries", deleted));
onCreate(db, connectionSource);
} catch (SQLException e) {
Log.e(TAG, "Can't drop databases", e);
throw new RuntimeException(e);
}
}
示例6: saveEventGuestOutfitsToDb
import com.j256.ormlite.stmt.DeleteBuilder; //導入方法依賴的package包/類
private void saveEventGuestOutfitsToDb(Set<EventGuestOutfit> eventGuestOutfits, Set<EventGuestOutfitItem> eventGuestOutfitItems) throws SQLException {
for(EventGuestOutfit eventGuestOutfit : eventGuestOutfits) {
Log.i(TAG, "Saving " + eventGuestOutfit.getClass().getSimpleName() + " uuid: " + eventGuestOutfit.getUuid());
// Save outfit
mHelper.getEventGuestOutfitDao().createOrUpdate(eventGuestOutfit);
// Delete existing outfit items
DeleteBuilder<EventGuestOutfitItem, String> deleteBuilder = mHelper.getEventGuestOutfitItemDao().deleteBuilder();
deleteBuilder.where().eq("event_guest_outfit_uuid", eventGuestOutfit.getUuid());
deleteBuilder.delete();
// Create new outfit items
for(EventGuestOutfitItem eventGuestOutfitItem : eventGuestOutfitItems) {
if(eventGuestOutfit.getUuid().equals(eventGuestOutfitItem.getEventGuestOutfit().getUuid())) {
mHelper.getItemDao().createIfNotExists(eventGuestOutfitItem.getItem());
mHelper.getEventGuestOutfitItemDao().create(eventGuestOutfitItem);
}
}
}
}
示例7: storeFeed
import com.j256.ormlite.stmt.DeleteBuilder; //導入方法依賴的package包/類
private void storeFeed(FeedUserRequest request, TopicsListResponse response,
int feedType, String query) throws SQLException {
DebugTimer.startInterval("saving topic feed");
if (TextUtils.isEmpty(request.getCursor())) {
DeleteBuilder<TopicFeedRelation, Integer> deleteBuilder = feedDao.deleteBuilder();
String userHandleQuery = (query != null) ? query : TopicFeedRelation.DEFAULT_QUERY;
deleteBuilder.where()
.eq(DbSchemas.TopicFeedRelation.FEED_TYPE, feedType)
.and().eq(DbSchemas.TopicFeedRelation.QUERY, userHandleQuery);
deleteBuilder.delete();
}
DbTransaction.performTransaction(
topicDao,
() -> insertTopicFeedContents(response.getData(), feedType, query)
);
DebugTimer.endInterval();
DebugLog.i("stored " + response.getData().size() + " topics for " + request);
}
示例8: removeComment
import com.j256.ormlite.stmt.DeleteBuilder; //導入方法依賴的package包/類
/**
* Removes a comment.
* @param commentHandle comment handle
*/
public void removeComment(String commentHandle) {
DeleteBuilder<CommentFeedRelation, Integer> deleteBuilder = commentFeedDao.deleteBuilder();
try {
String topicHandle = getCommentParentHandle(commentHandle);
deleteBuilder.where().eq(DbSchemas.CommentFeedRelation.COMMENT_HANDLE, commentHandle);
deleteBuilder.delete();
if (!TextUtils.isEmpty(topicHandle)) {
UpdateBuilder<TopicView, String> updateBuilder = topicDao.updateBuilder();
updateBuilder.where()
.eq(DbSchemas.Topics.TOPIC_HANDLE, topicHandle)
.and().gt(DbSchemas.Topics.TOTAL_COMMENTS, 0);
updateBuilder.updateColumnExpression(
DbSchemas.Topics.TOTAL_COMMENTS,
DbSchemas.Topics.TOTAL_COMMENTS + " - 1");
updateBuilder.update();
}
} catch (SQLException e) {
DebugLog.logException(e);
}
}
示例9: 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;
}
示例10: 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);
}
}
示例11: addOrUpdateRace
import com.j256.ormlite.stmt.DeleteBuilder; //導入方法依賴的package包/類
public boolean addOrUpdateRace(Race race) {
try {
CreateOrUpdateStatus status = mHelper.getRaceDao().createOrUpdate(race);
for (Rule rule : race.getRules()) {
rule.setRace(race);
// Rules could have been added or removed, so remove persisted
// rules and add current rules
if (status.isUpdated()) {
DeleteBuilder<Rule, Long> deleteBuilder = mHelper.getRuleDao().deleteBuilder();
deleteBuilder.where().eq("ruleId", rule.getRuleId()).and().eq("race_id", race.getRaceId());
deleteBuilder.delete();
}
mHelper.getRuleDao().createOrUpdate(rule);
}
return true;
} catch (SQLException e) {
Log.e(TAG, "Failed to cache a race", e);
return false;
}
}
示例12: deleteAllEsami
import com.j256.ormlite.stmt.DeleteBuilder; //導入方法依賴的package包/類
@Override
public void deleteAllEsami() throws SQLException {
boolean result = false;
if (this.databaseHelper != null && this.databaseHelper.isOpen()) {
DeleteBuilder<EsameEntity, Integer> deleteBuilder = databaseHelper.getEsameEntityDao().deleteBuilder();
deleteBuilder.delete();
result = true;
}
if (result == true) {
Log.v(TAG, "Database is now empty");
}
}
示例13: delete
import com.j256.ormlite.stmt.DeleteBuilder; //導入方法依賴的package包/類
@Override
public int delete(OMRegionInteraction relation) throws SQLException {
DeleteBuilder<OMRegionInteraction, String> deleteBuilder = this.deleteBuilder();
deleteBuilder.where().eq("region_id", relation.getRegion().getID()).and().eq("interaction_id", relation.getInteraction().getID());
deleteBuilder.delete();
return 1;
}
示例14: delete
import com.j256.ormlite.stmt.DeleteBuilder; //導入方法依賴的package包/類
@Override
public int delete(MMTemplateEvent relation) throws SQLException {
DeleteBuilder<MMTemplateEvent, String> deleteBuilder = this.deleteBuilder();
deleteBuilder.where().eq("template_id", relation.getTemplate().getID()).and().eq("event_id", relation.getEvent().getID());
deleteBuilder.delete();
return 1;
}
示例15: delete
import com.j256.ormlite.stmt.DeleteBuilder; //導入方法依賴的package包/類
@Override
public int delete(MMTemplateRegion relation) throws SQLException {
DeleteBuilder<MMTemplateRegion, String> deleteBuilder = this.deleteBuilder();
deleteBuilder.where().eq("template_id", relation.getTemplate().getID()).and().eq("region_id", relation.getRegion().getID());
deleteBuilder.delete();
return 1;
}