react-native-sqlite-2
react-native-sqlite-2 copied to clipboard
Error: Queries can be performed using SQLiteDatabase query or rawQuery methods only.
I am trying to get column names from table with following code:
db.transaction(txn => {
txn.executeSql("PRAGMA table_info('table')", [], (txn, res) => {
console.log(txn, res);
resolve(res.rows);
}, (txn, err) => {reject(err)});
});
But I get an exception: Error: Queries can be performed using SQLiteDatabase query or rawQuery methods only.
Getting the same error with query WITH one AS ( SELECT 1 ) SELECT * FROM one; (my real query is more complex but this example is enough to trigger an error). Works on iOS, errors out on Android. Both on SQLite 3.29.0, react-native-sqlite-2 version 3.0.1.
@NeliHarbuzava Did you end up finding a workaround?
SQLiteDatabase db = getWritableDatabase();
db.execSQL("SELECT * FROM " + TABLE_PRODUCTS);
Cursor c = db.rawQuery("SELECT * FROM " + TABLE_PRODUCTS, null);
c.moveToFirst();
I'm getting the same unknown error (code 0 SQLITE_OK): Queries can be performed using SQLiteDatabase query or rawQuery methods only.
I'm working on it.
Getting the same error with query
WITH one AS ( SELECT 1 ) SELECT * FROM one;(my real query is more complex but this example is enough to trigger an error). Works on iOS, errors out on Android. Both on SQLite 3.29.0, react-native-sqlite-2 version 3.0.1.@NeliHarbuzava Did you end up finding a workaround?
This is the exact issue I am running into now, with the WITH clause. Did you ever find a solution to this? I am on Expo-Sqlite 11.0.0