List of usage examples for android.database.sqlite SQLiteDatabase CONFLICT_IGNORE
int CONFLICT_IGNORE
To view the source code for android.database.sqlite SQLiteDatabase CONFLICT_IGNORE.
Click Source Link
From source file:com.parse.OfflineStore.java
/** * Stores a single object in the local database. If the object is a pointer, isn't dirty, and has * an objectId already, it may not be saved, since it would provide no useful data. * * @param object//from www. java 2s. co m * The object to save. * @param db * A database connection to use. */ private Task<Void> saveLocallyAsync(final String key, final ParseObject object, final ParseSQLiteDatabase db) { // If this is just a clean, unfetched pointer known to Parse, then there is nothing to save. if (object.getObjectId() != null && !object.isDataAvailable() && !object.hasChanges() && !object.hasOutstandingOperations()) { return Task.forResult(null); } final Capture<String> uuidCapture = new Capture<>(); // Make sure we have a UUID for the object to be saved. return getOrCreateUUIDAsync(object, db).onSuccessTask(new Continuation<String, Task<Void>>() { @Override public Task<Void> then(Task<String> task) throws Exception { String uuid = task.getResult(); uuidCapture.set(uuid); return updateDataForObjectAsync(uuid, object, db); } }).onSuccessTask(new Continuation<Void, Task<Void>>() { @Override public Task<Void> then(Task<Void> task) throws Exception { final ContentValues values = new ContentValues(); values.put(OfflineSQLiteOpenHelper.KEY_KEY, key); values.put(OfflineSQLiteOpenHelper.KEY_UUID, uuidCapture.get()); return db.insertWithOnConflict(OfflineSQLiteOpenHelper.TABLE_DEPENDENCIES, values, SQLiteDatabase.CONFLICT_IGNORE); } }); }
From source file:net.potterpcs.recipebook.RecipeData.java
public void updateIngredients(long rid, ContentValues values) { synchronized (DB_LOCK) { SQLiteDatabase db = dbHelper.getWritableDatabase(); try {//from w w w. j av a 2 s.co m db.updateWithOnConflict(INGREDIENTS_TABLE, values, IT_RECIPE_ID + " = ?", new String[] { Long.toString(rid) }, SQLiteDatabase.CONFLICT_IGNORE); } finally { db.close(); } } }
From source file:net.potterpcs.recipebook.RecipeData.java
public void updateDirections(long rid, ContentValues values) { synchronized (DB_LOCK) { SQLiteDatabase db = dbHelper.getWritableDatabase(); try {/*from w ww . j av a 2s . c o m*/ db.updateWithOnConflict(DIRECTIONS_TABLE, values, DT_RECIPE_ID + " = ?", new String[] { Long.toString(rid) }, SQLiteDatabase.CONFLICT_IGNORE); } finally { db.close(); } } }
From source file:net.potterpcs.recipebook.RecipeData.java
public void updateTags(long rid, ContentValues values) { synchronized (DB_LOCK) { SQLiteDatabase db = dbHelper.getWritableDatabase(); try {/*w ww.j a va2 s. com*/ db.updateWithOnConflict(TAGS_TABLE, values, TT_RECIPE_ID + " = ?", new String[] { Long.toString(rid) }, SQLiteDatabase.CONFLICT_IGNORE); } finally { db.close(); } } }