Fix SQL generated by updateWithOnConflict()
Before, SQLiteDatabase.updateWithOnConflict() method generated
syntactically invalid SQL if the ConflictAlgorithm was non-null.
For example, it would generate
"UPDATE OR REPLACEshortcuts SET ...",
when it should be "UPDATE OR REPLACE shortcuts SET ...".
Fixes http://b/issue?id=1995470
diff --git a/core/java/android/database/sqlite/SQLiteDatabase.java b/core/java/android/database/sqlite/SQLiteDatabase.java
index 7d331dc..184d6dc 100644
--- a/core/java/android/database/sqlite/SQLiteDatabase.java
+++ b/core/java/android/database/sqlite/SQLiteDatabase.java
@@ -1412,8 +1412,9 @@
StringBuilder sql = new StringBuilder(120);
sql.append("UPDATE ");
if (algorithm != null) {
- sql.append(" OR ");
+ sql.append("OR ");
sql.append(algorithm.value());
+ sql.append(" ");
}
sql.append(table);