當前位置: 首頁>>代碼示例>>Java>>正文


Java Dao.deleteBuilder方法代碼示例

本文整理匯總了Java中com.j256.ormlite.dao.Dao.deleteBuilder方法的典型用法代碼示例。如果您正苦於以下問題:Java Dao.deleteBuilder方法的具體用法?Java Dao.deleteBuilder怎麽用?Java Dao.deleteBuilder使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.j256.ormlite.dao.Dao的用法示例。


在下文中一共展示了Dao.deleteBuilder方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onUpgrade

import com.j256.ormlite.dao.Dao; //導入方法依賴的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

示例2: clearHistory

import com.j256.ormlite.dao.Dao; //導入方法依賴的package包/類
private void clearHistory() {
    try {
        Dao<DetectedOverlay, Integer> detectedOverlayDao = DatabaseHelper.getHelper(getActivity()).getDetectedOverlayDao();
        DeleteBuilder<DetectedOverlay, Integer> deleteBuilder = detectedOverlayDao.deleteBuilder();
        deleteBuilder.where().gt("id", 0);
        int deleted = deleteBuilder.delete();
        Log.i(getTag(), "Deleted " + deleted + " entries from DetectedOverlay");
    } catch (SQLException e) {
        Log.e(getTag(), "Failed to deleted entries", e);
    }
    mAdapter.clear();
}
 
開發者ID:geeksonsecurity,項目名稱:android-overlay-protection,代碼行數:13,代碼來源:DetectedOverlayFragment.java


注:本文中的com.j256.ormlite.dao.Dao.deleteBuilder方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。