当前位置: 首页>>代码示例>>Java>>正文


Java DeleteBuilder类代码示例

本文整理汇总了Java中com.j256.ormlite.stmt.DeleteBuilder的典型用法代码示例。如果您正苦于以下问题:Java DeleteBuilder类的具体用法?Java DeleteBuilder怎么用?Java DeleteBuilder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DeleteBuilder类属于com.j256.ormlite.stmt包,在下文中一共展示了DeleteBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: deleteByIds

import com.j256.ormlite.stmt.DeleteBuilder; //导入依赖的package包/类
public static void deleteByIds(final List<Long> ids, final DatabaseCallback<Void> callback) {
    DatabaseHelper.getInstance().execute(new Runnable() {
        @Override
        public void run() {
            final RuntimeExceptionDao<MyFace, Long> dao = DatabaseHelper.getInstance().getCachedRuntimeExceptionDao(MyFace.class);

            DeleteBuilder<MyFace, Long> db = dao.deleteBuilder();
            try {
                db.where().in("id", ids);
                db.delete();
                callback.onCompleted(0, null);
            } catch (Exception e) {
                e.printStackTrace();
                callback.onCompleted(1, null);
            }
        }
    });
}
 
开发者ID:aliyun,项目名称:aliyun-cloudphotos-android-demo,代码行数:19,代码来源:MyFace.java

示例2: deleteByPhotosSync

import com.j256.ormlite.stmt.DeleteBuilder; //导入依赖的package包/类
private static void deleteByPhotosSync(final List<Long> photoIds) {
    final RuntimeExceptionDao<MyFacePhoto, Long> dao = DatabaseHelper.getInstance().getCachedRuntimeExceptionDao(MyFacePhoto.class);
    dao.callBatchTasks(new Callable() {
        @Override
        public Object call() throws Exception {
            try {
                DeleteBuilder<MyFacePhoto, Long> builder = dao.deleteBuilder();
                builder.where().in("photo_id", photoIds);
                builder.delete();
            } catch (Exception e) {
                Log.w(TAG, e.getMessage());
            }
            return null;
        }
    });
}
 
开发者ID:aliyun,项目名称:aliyun-cloudphotos-android-demo,代码行数:17,代码来源:MyFacePhoto.java

示例3: deleteByPhotosSync

import com.j256.ormlite.stmt.DeleteBuilder; //导入依赖的package包/类
private static void deleteByPhotosSync(final List<Long> photoIds) {
    final RuntimeExceptionDao<MyMomentPhoto, Long> dao = DatabaseHelper.getInstance().getCachedRuntimeExceptionDao(MyMomentPhoto.class);
    dao.callBatchTasks(new Callable() {
        @Override
        public Object call() throws Exception {
            try {
                DeleteBuilder<MyMomentPhoto, Long> builder = dao.deleteBuilder();
                builder.where().in("photoId", photoIds);
                builder.delete();
            } catch (Exception e) {
                Log.w(TAG, e.getMessage());
            }
            return null;
        }
    });
}
 
开发者ID:aliyun,项目名称:aliyun-cloudphotos-android-demo,代码行数:17,代码来源:MyMomentPhoto.java

示例4: deleteByPhotosSync

import com.j256.ormlite.stmt.DeleteBuilder; //导入依赖的package包/类
private static void deleteByPhotosSync(final List<Long> photoIds) {
    final RuntimeExceptionDao<MyTagPhoto, Long> dao = DatabaseHelper.getInstance().getCachedRuntimeExceptionDao(MyTagPhoto.class);
    dao.callBatchTasks(new Callable() {
        @Override
        public Object call() throws Exception {
            try {
                DeleteBuilder<MyTagPhoto, Long> builder = dao.deleteBuilder();
                builder.where().in("photo_id", photoIds);
                builder.delete();
            } catch (Exception e) {
                Log.w(TAG, e.getMessage());
            }
            return null;
        }
    });
}
 
开发者ID:aliyun,项目名称:aliyun-cloudphotos-android-demo,代码行数:17,代码来源:MyTagPhoto.java

示例5: deleteByIds

import com.j256.ormlite.stmt.DeleteBuilder; //导入依赖的package包/类
public static void deleteByIds(final List<Long> ids, final DatabaseCallback<Void> callback) {
    DatabaseHelper.getInstance().execute(new Runnable() {
        @Override
        public void run() {
            final RuntimeExceptionDao<MyAlbum, Long> dao = DatabaseHelper.getInstance().getCachedRuntimeExceptionDao(MyAlbum.class);

            DeleteBuilder<MyAlbum, Long> db = dao.deleteBuilder();
            try {
                db.where().in("id", ids);
                db.delete();
                callback.onCompleted(0, null);
            } catch (Exception e) {
                e.printStackTrace();
                callback.onCompleted(1, null);
            }
        }
    });
}
 
开发者ID:aliyun,项目名称:aliyun-cloudphotos-android-demo,代码行数:19,代码来源:MyAlbum.java

示例6: deleteByIds

import com.j256.ormlite.stmt.DeleteBuilder; //导入依赖的package包/类
public static void deleteByIds(final List<Long> ids, final DatabaseCallback<Void> callback) {
    DatabaseHelper.getInstance().execute(new Runnable() {
        @Override
        public void run() {
            final RuntimeExceptionDao<MyPhoto, Long> dao = DatabaseHelper.getInstance().getCachedRuntimeExceptionDao(MyPhoto.class);

            DeleteBuilder<MyPhoto, Long> db = dao.deleteBuilder();
            try {
                db.where().in("id", ids);
                db.delete();
                callback.onCompleted(0, null);
            } catch (Exception e) {
                e.printStackTrace();
                callback.onCompleted(1, null);
            }
        }
    });
}
 
开发者ID:aliyun,项目名称:aliyun-cloudphotos-android-demo,代码行数:19,代码来源:MyPhoto.java

示例7: deleteByPhotosSync

import com.j256.ormlite.stmt.DeleteBuilder; //导入依赖的package包/类
private static void deleteByPhotosSync(final List<Long> photoIds) {
    final RuntimeExceptionDao<MyAlbumPhoto, Long> dao = DatabaseHelper.getInstance().getCachedRuntimeExceptionDao(MyAlbumPhoto.class);
    dao.callBatchTasks(new Callable() {
        @Override
        public Object call() throws Exception {
            try {
                DeleteBuilder<MyAlbumPhoto, Long> builder = dao.deleteBuilder();
                builder.where().in("photoId", photoIds);
                builder.delete();
            } catch (Exception e) {
                Log.w(TAG, e.getMessage());
            }
            return null;
        }
    });
}
 
开发者ID:aliyun,项目名称:aliyun-cloudphotos-android-demo,代码行数:17,代码来源:MyAlbumPhoto.java

示例8: updateWeather

import com.j256.ormlite.stmt.DeleteBuilder; //导入依赖的package包/类
private void updateWeather(Weather weather) throws SQLException {

        weatherDaoOperation.update(weather);
        apiDaoOperation.update(weather.getAirQualityLive());

        //先删除旧数据
        DeleteBuilder<WeatherForecast, Long> forecastDeleteBuilder = forecastDaoOperation.deleteBuilder();
        forecastDeleteBuilder.where().eq(WeatherForecast.CITY_ID_FIELD_NAME, weather.getCityId());
        PreparedDelete<WeatherForecast> forecastPrepared = forecastDeleteBuilder.prepare();
        forecastDaoOperation.delete(forecastPrepared);
        //再插入新数据
        for (WeatherForecast weatherForecast : weather.getWeatherForecasts()) {
            forecastDaoOperation.create(weatherForecast);
        }

        //先删除旧数据
        DeleteBuilder<LifeIndex, Long> lifeIndexDeleteBuilder = lifeIndexesDaoOperation.deleteBuilder();
        lifeIndexDeleteBuilder.where().eq(LifeIndex.CITY_ID_FIELD_NAME, weather.getCityId());
        PreparedDelete<LifeIndex> lifeIndexPrepared = lifeIndexDeleteBuilder.prepare();
        lifeIndexesDaoOperation.delete(lifeIndexPrepared);
        //再插入新数据
        for (LifeIndex index : weather.getLifeIndexes()) {
            lifeIndexesDaoOperation.create(index);
        }
        realTimeDaoOperation.update(weather.getWeatherLive());
    }
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:27,代码来源:WeatherDao.java

示例9: 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();
}
 
开发者ID:benniaobuguai,项目名称:android-project-gallery,代码行数:17,代码来源:LocalAlbumBiz.java

示例10: 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();
}
 
开发者ID:benniaobuguai,项目名称:android-project-gallery,代码行数:18,代码来源:MyFavoritesBiz.java

示例11: 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();
}
 
开发者ID:benniaobuguai,项目名称:android-project-gallery,代码行数:21,代码来源:PhotoBiz.java

示例12: 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();
}
 
开发者ID:benniaobuguai,项目名称:android-project-gallery,代码行数:17,代码来源:AlbumBiz.java

示例13: 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);
    }
}
 
开发者ID:geeksonsecurity,项目名称:android-overlay-protection,代码行数:22,代码来源:DatabaseHelper.java

示例14: 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);
            }
        }
    }
}
 
开发者ID:joeydeluca,项目名称:apparel,代码行数:22,代码来源:ApparelSyncAdapter.java

示例15: 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);
}
 
开发者ID:Microsoft,项目名称:EmbeddedSocial-Android-SDK,代码行数:20,代码来源:ContentCache.java


注:本文中的com.j256.ormlite.stmt.DeleteBuilder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。