question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Expo SQLite 'PRAGMA user_version' not working

See original GitHub issue

Environment

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

https://snack.expo.io/ryZiXt5df

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
jichu4ncommented, Jun 3, 2018

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:

  • Pixel 2 (8.1.0)
  • HTC 10 (8.0.0)
  • Moto RAZR M (4.4.2)

Using Expo SDK version 27.0.2 and Expo client version 2.5.2 on all 3 devices.

0reactions
cruzachcommented, Oct 9, 2019

Fixed in 1988

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found