Skip to content

Commit 2332543

Browse files
Allow Support/Room API queries to bind parameters without losing their type.
1 parent 0a1f089 commit 2332543

File tree

2 files changed

+7
-91
lines changed

2 files changed

+7
-91
lines changed

android-database-sqlcipher/src/main/java/net/sqlcipher/database/BindingsRecorder.java

Lines changed: 0 additions & 86 deletions
This file was deleted.

android-database-sqlcipher/src/main/java/net/sqlcipher/database/SQLiteDatabase.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2951,11 +2951,13 @@ public android.database.Cursor query(SupportSQLiteQuery query) {
29512951
@Override
29522952
public android.database.Cursor query(final SupportSQLiteQuery supportQuery,
29532953
CancellationSignal cancellationSignal) {
2954-
BindingsRecorder hack=new BindingsRecorder();
2955-
2956-
supportQuery.bindTo(hack);
2957-
2958-
return rawQuery(supportQuery.getSql(), hack.getBindings());
2954+
String sql = supportQuery.getSql();
2955+
int argumentCount = supportQuery.getArgCount();
2956+
Object[] args = new Object[argumentCount];
2957+
SQLiteDirectCursorDriver driver = new SQLiteDirectCursorDriver(this, sql, null);
2958+
SQLiteQuery query = new SQLiteQuery(this, sql, 0, args);
2959+
supportQuery.bindTo(query);
2960+
return new CrossProcessCursorWrapper(new SQLiteCursor(this, driver, null, query));
29592961
}
29602962

29612963
@Override

0 commit comments

Comments
 (0)