Revert SQLiteQueryBuilder for now.
We've encountered subtle bugs in how apps are using this public
API, so revert it back to exactly what shipped in the last
release, and move functionality to new SQLiteStatementBuilder
class, since we already have several customers using it.
Test: atest cts/tests/tests/provider/src/android/provider/cts/MediaStore*
Test: atest cts/tests/tests/database/src/android/database/sqlite/cts/SQLiteQueryBuilderTest.java
Bug: 111486645
diff --git a/tests/tests/database/src/android/database/sqlite/cts/SQLiteQueryBuilderTest.java b/tests/tests/database/src/android/database/sqlite/cts/SQLiteQueryBuilderTest.java
index 42b9a3b..97b0b8f 100644
--- a/tests/tests/database/src/android/database/sqlite/cts/SQLiteQueryBuilderTest.java
+++ b/tests/tests/database/src/android/database/sqlite/cts/SQLiteQueryBuilderTest.java
@@ -16,6 +16,7 @@
package android.database.sqlite.cts;
+
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteCursor;
@@ -459,39 +460,6 @@
fail("Could not prove that the query actually canceled midway during execution.");
}
- public void testStrict() throws Exception {
- createEmployeeTable();
-
- final SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
- qb.setTables("employee");
- qb.setStrict(true);
- qb.appendWhere("month=2");
-
- // Should normally only be able to see one row
- try (Cursor c = qb.query(mDatabase, null, null, null, null, null)) {
- assertEquals(1, c.getCount());
- }
-
- // Trying sneaky queries should fail; even if they somehow succeed, we
- // shouldn't get to see any other data.
- try (Cursor c = qb.query(mDatabase, null, "1=1", null, null, null)) {
- assertEquals(1, c.getCount());
- } catch (Exception tolerated) {
- }
- try (Cursor c = qb.query(mDatabase, null, "1=1 --", null, null, null)) {
- assertEquals(1, c.getCount());
- } catch (Exception tolerated) {
- }
- try (Cursor c = qb.query(mDatabase, null, "1=1) OR (1=1", null, null, null)) {
- assertEquals(1, c.getCount());
- } catch (Exception tolerated) {
- }
- try (Cursor c = qb.query(mDatabase, null, "1=1)) OR ((1=1", null, null, null)) {
- assertEquals(1, c.getCount());
- } catch (Exception tolerated) {
- }
- }
-
private void createEmployeeTable() {
mDatabase.execSQL("CREATE TABLE employee (_id INTEGER PRIMARY KEY, " +
"name TEXT, month INTEGER, salary INTEGER);");