标签:settingsprovider databasehelper
转载请注明出处:http://blog.csdn.net/droyon/article/details/35558375
// Only create the global table for the singleton 'owner' user //只为所有者创建global table。 if (mUserHandle == UserHandle.USER_OWNER) { createGlobalTable(db); }
if (!onlyCore) { loadBookmarks(db); }
private void movePrefixedSettingsToNewTable( SQLiteDatabase db, String sourceTable, String destTable, String[] prefixesToMove) { SQLiteStatement insertStmt = null; SQLiteStatement deleteStmt = null; db.beginTransaction(); try { insertStmt = db.compileStatement("INSERT INTO " + destTable + " (name,value) SELECT name,value FROM " + sourceTable + " WHERE substr(name,0,?)=?"); deleteStmt = db.compileStatement( "DELETE FROM " + sourceTable + " WHERE substr(name,0,?)=?"); for (String prefix : prefixesToMove) { insertStmt.bindLong(1, prefix.length() + 1); insertStmt.bindString(2, prefix); insertStmt.execute(); deleteStmt.bindLong(1, prefix.length() + 1); deleteStmt.bindString(2, prefix); deleteStmt.execute(); } db.setTransactionSuccessful(); } finally { db.endTransaction(); if (insertStmt != null) { insertStmt.close(); } if (deleteStmt != null) { deleteStmt.close(); } } }
SettingsProvider 之 DatabaseHelper,布布扣,bubuko.com
SettingsProvider 之 DatabaseHelper
标签:settingsprovider databasehelper
原文地址:http://blog.csdn.net/droyon/article/details/35558375