Home | History | Annotate | Download | only in launcher2

Lines Matching refs:db

67     private static final String DATABASE_NAME = "launcher.db";
118 SQLiteDatabase db = mOpenHelper.getWritableDatabase();
119 Cursor result = qb.query(db, projection, args.where, args.args, null, null, sortOrder);
126 SQLiteDatabase db, String table, String nullColumnHack, ContentValues values) {
130 return db.insert(table, nullColumnHack, values);
133 private static void deleteId(SQLiteDatabase db, long id) {
136 db.delete(args.table, args.where, args.args);
143 SQLiteDatabase db = mOpenHelper.getWritableDatabase();
144 final long rowId = dbInsertAndCheck(mOpenHelper, db, args.table, null, initialValues);
157 SQLiteDatabase db = mOpenHelper.getWritableDatabase();
158 db.beginTransaction();
162 if (dbInsertAndCheck(mOpenHelper, db, args.table, null, values[i]) < 0) {
166 db.setTransactionSuccessful();
168 db.endTransaction();
179 SQLiteDatabase db = mOpenHelper.getWritableDatabase();
180 int count = db.delete(args.table, args.where, args.args);
190 SQLiteDatabase db = mOpenHelper.getWritableDatabase();
191 int count = db.update(args.table, values, args.where, args.args);
253 // the DB here
271 public void onCreate(SQLiteDatabase db) {
276 db.execSQL("CREATE TABLE favorites (" +
303 if (!convertDatabase(db)) {
317 private boolean convertDatabase(SQLiteDatabase db) {
335 converted = copyFromCursor(db, cursor) > 0;
348 convertWidgets(db);
354 private int copyFromCursor(SQLiteDatabase db, Cursor c) {
392 db.beginTransaction();
397 if (dbInsertAndCheck(this, db, TABLE_FAVORITES, null, rows[i]) < 0) {
403 db.setTransactionSuccessful();
405 db.endTransaction();
412 public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
418 db.beginTransaction();
421 db.execSQL("ALTER TABLE favorites " +
423 db.setTransactionSuccessful();
429 db.endTransaction();
434 convertWidgets(db);
452 db.beginTransaction();
454 db.execSQL("UPDATE favorites SET screen=(screen + 1);");
455 db.setTransactionSuccessful();
460 db.endTransaction();
464 if (updateContactsShortcuts(db)) {
471 convertWidgets(db);
479 normalizeIcons(db);
487 mMaxId = initializeMaxId(db);
491 loadFavorites(db, R.xml.update_workspace);
502 updateContactsShortcuts(db);
508 db.execSQL("DROP TABLE IF EXISTS " + TABLE_FAVORITES);
509 onCreate(db);
513 private boolean updateContactsShortcuts(SQLiteDatabase db) {
519 db.beginTransaction();
522 c = db.query(TABLE_FAVORITES,
568 db.update(TABLE_FAVORITES, values, updateWhere, null);
579 db.setTransactionSuccessful();
584 db.endTransaction();
593 private void normalizeIcons(SQLiteDatabase db) {
596 db.beginTransaction();
601 update = db.compileStatement("UPDATE favorites "
604 c = db.rawQuery("SELECT _id, icon FROM favorites WHERE iconType=" +
635 db.setTransactionSuccessful();
639 db.endTransaction();
662 private long initializeMaxId(SQLiteDatabase db) {
663 Cursor c = db.rawQuery("SELECT MAX(_id) FROM favorites", null);
686 private void convertWidgets(SQLiteDatabase db) {
698 db.beginTransaction();
701 c = db.query(TABLE_FAVORITES, new String[] { Favorites._ID, Favorites.ITEM_TYPE },
733 db.update(TABLE_FAVORITES, values, updateWhere, null);
755 db
759 db.endTransaction();
787 * @param db The database to write the values into
790 private int loadFavorites(SQLiteDatabase db, int workspaceResourceId) {
843 long id = addAppShortcut(db, values, a, packageManager, intent);
846 added = addSearchWidget(db, values);
848 added = addClockWidget(db, values);
850 added = addAppWidget(parser, attrs, type, db, values, a, packageManager);
852 long id = addUriShortcut(db, values, a);
863 long folderId = addFolder(db, values);
883 addAppShortcut(db, values, ar, packageManager, intent);
888 long id = addUriShortcut(db, values, ar);
903 deleteId(db, folderId);
905 deleteId(db, folderItems.get(0));
924 private long addAppShortcut(SQLiteDatabase db, ContentValues values, TypedArray a,
951 if (dbInsertAndCheck(this, db, TABLE_FAVORITES, null, values) < 0) {
961 private long addFolder(SQLiteDatabase db, ContentValues values) {
967 if (dbInsertAndCheck(this, db, TABLE_FAVORITES, null, values) <= 0) {
1000 private boolean addSearchWidget(SQLiteDatabase db, ContentValues values) {
1002 return addAppWidget(db, values, cn, 4, 1, null);
1005 private boolean addClockWidget(SQLiteDatabase db, ContentValues values) {
1008 return addAppWidget(db, values, cn, 2, 2, null);
1012 SQLiteDatabase db, ContentValues values, TypedArray a,
1065 return addAppWidget(db, values, cn, spanX, spanY, extras);
1071 private boolean addAppWidget(SQLiteDatabase db, ContentValues values, ComponentName cn,
1084 dbInsertAndCheck(this, db, TABLE_FAVORITES, null, values);
1106 private long addUriShortcut(SQLiteDatabase db, ContentValues values,
1140 if (dbInsertAndCheck(this, db, TABLE_FAVORITES, null, values) < 0) {