Expo SQLite 'PRAGMA user_version' not working
See original GitHub issueEnvironment
Environment: OS: Windows 10 Node: 6.10.2 Yarn: 1.3.2 npm: 5.6.0
Packages: (wanted => installed) expo: ^25.0.0 => 25.0.0 react: 16.2.0 => 16.2.0 react-native: 0.52.0 => 0.52.0
Steps to Reproduce
Execute command tx.executeSql(‘pragma user_version’).
Expected Behavior
It should return database’s user_version
pragma value.
Actual Behavior
It works with iOS device/simulator, but does not work with Android device/emulator and throws the following error: [Error: unknown error (code 0): Queries can be performed using SQLiteDatabase query or rawQuery methods only.]
Changing pragma’s value, e.g. tx.executeSql(‘pragma user_version=1’) works both on iOS and Android.
Code to reproduce the issue
Issue Analytics
- State:
- Created 6 years ago
- Comments:11 (6 by maintainers)
Top Results From Across the Web
Trying to update 'PRAGMA user_version;' but not updating
I am trying to implement a database versioning system so that I can add/remove things to the various table schemas in the future....
Read more >How to actually set PRAGMA FOREIGN_KEYS = ON; in expo ...
Through researching I've found that you have to set PRAGMA FOREIGN_KEYS = ON before every DB transaction. The tools that are available in...
Read more >SQLite - Expo Documentation
expo -sqlite gives your app access to a database that can be queried through a WebSQL-like API. The database is persisted across restarts...
Read more >SQLCipher API - Zetetic LLC
When opening an existing database, PRAGMA key will not immediately throw an error if the key provided is incorrect. To test that the...
Read more >SQLite - PRAGMA - Tutorialspoint
SQLite PRAGMA command is a special command to be used to control various ... By default, this pragma is false and these statements...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Running into similar error. I’m trying to make the app add a column to an existing table if it doesn’t already exist, and the relevant PRAGMA query works correctly on iOS, but fails on Android.
Query:
PRAGMA table_info(my_table);
(SQLite docs) Error:Error: unknown error (code 0): Queries can be performed using SQLiteDatabase query or rawQuery methods only.
Tested failing on Android devices:
Using Expo SDK version 27.0.2 and Expo client version 2.5.2 on all 3 devices.
Fixed in 1988