Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Queries can be performed using SQLiteDatabase query or rawQuery methods only. #65

Open
ghost opened this issue Sep 10, 2019 · 3 comments
Labels

Comments

@ghost
Copy link

ghost commented Sep 10, 2019

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.

@bbalan
Copy link

bbalan commented Apr 27, 2020

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?

@antosoa
Copy link

antosoa commented May 17, 2020

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.

beeks pushed a commit to beeks/react-native-sqlite-2 that referenced this issue Mar 8, 2021
craftzdog pushed a commit that referenced this issue Mar 17, 2021
Issue #65

Co-authored-by: Dev Null <dev@null.com>
Enzuo added a commit to Enzuo/blue-log that referenced this issue Aug 25, 2021
See craftzdog/react-native-sqlite-2#65

expo sqlite on android as an isSelect method to call a special query api, queries starting with WITH aren't considered select
@Jacksonishere
Copy link

Jacksonishere commented Nov 1, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants