Code example for android.database.sqlite.SQLiteDatabase

Codota analyzed 5,741,259 android code samples to find the most common, credible and clear examples
		} 
	} 
	 
	public static long updateOrInsert(SQLiteDatabase db, String table, ContentValues values, String selection, String[] selectionArgs) {
		long retval = -1;
		db.beginTransaction();
		try { 
			retval = db.update(table, values, selection, selectionArgs);
			if(retval == 0){
				retval = db.insert(table, null, values);
			} 
			db.setTransactionSuccessful();
		} finally { 
			db.endTransaction();
		} 
		return retval;
	} 
	 
	/* 
	public static long updateOrReplaceRow(SQLiteDatabase db, ContentValues values, String table, String selection, String[] selectionArgs) { 
		String query = "UPDATE OR REPLACE %s SET "; 
Show full source