use of android.database.sqlite.SQLiteDatabase in project Launcher3 by chislon.
the class LauncherProvider method update.
@Override
public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
SqlArguments args = new SqlArguments(uri, selection, selectionArgs);
addModifiedTime(values);
SQLiteDatabase db = mOpenHelper.getWritableDatabase();
int count = db.update(args.table, values, args.where, args.args);
if (count > 0)
sendNotify(uri);
return count;
}
use of android.database.sqlite.SQLiteDatabase in project Launcher3 by chislon.
the class LauncherProvider method bulkInsert.
@Override
public int bulkInsert(Uri uri, ContentValues[] values) {
SqlArguments args = new SqlArguments(uri);
SQLiteDatabase db = mOpenHelper.getWritableDatabase();
db.beginTransaction();
try {
int numValues = values.length;
for (int i = 0; i < numValues; i++) {
addModifiedTime(values[i]);
if (dbInsertAndCheck(mOpenHelper, db, args.table, null, values[i]) < 0) {
return 0;
}
}
db.setTransactionSuccessful();
} finally {
db.endTransaction();
}
sendNotify(uri);
return values.length;
}
use of android.database.sqlite.SQLiteDatabase in project cw-omnibus by commonsguy.
the class DatabaseHelper method insertQuestions.
void insertQuestions(Context app, List<Item> items) {
SQLiteDatabase db = getDb(app);
db.beginTransaction();
db.delete("questions", null, null);
try {
for (Item item : items) {
Object[] args = { item.id, item.title, item.link, item.owner.profileImage, item.creationDate };
db.execSQL("INSERT INTO questions (_id, title, " + "link, profileImage, creationDate) " + "VALUES (?, ?, ?, ?, ?)", args);
}
db.setTransactionSuccessful();
} finally {
db.endTransaction();
}
}
use of android.database.sqlite.SQLiteDatabase in project philm by chrisbanes.
the class PhilmSQLiteOpenHelper method delete.
@Override
public void delete(Collection<PhilmMovie> movies) {
assetNotClosed();
SQLiteDatabase db = null;
try {
db = getWritableDatabase();
db.beginTransaction();
final DatabaseCompartment dbc = cupboard().withDatabase(db);
for (PhilmMovie movie : movies) {
dbc.delete(movie);
}
db.setTransactionSuccessful();
} catch (Exception e) {
// Crashlytics.logException(e);
} finally {
if (db != null) {
db.endTransaction();
}
}
}
use of android.database.sqlite.SQLiteDatabase in project clutchandroid by clutchio.
the class ClutchStats method getCachedChoice.
public int getCachedChoice(String name) {
int resp = -1;
SQLiteDatabase db = getReadableDatabase();
String[] args = { name };
Cursor cur = db.rawQuery("SELECT choice FROM abcache WHERE name = ?", args);
cur.moveToFirst();
while (!cur.isAfterLast()) {
resp = cur.getInt(0);
cur.moveToNext();
}
db.close();
return resp;
}
Aggregations