I get db.execAsync error even though I am using expo sqlite latest version
I am developing a project with Expo. I am using Expo Sqlite . I created a database . I am using the new version of Expo but I get the following error:
ERROR Failed to initialize database: [TypeError: db.execAsync is not a function (it is undefined)].
Expo sqlite database rejection
i have been working on an app with expo for two months now testing with IOS only. My app runs multiple database async functions at an instance, i never had issues testing it on IOS but as soon as i started testing it on android, everthing works fine for a moment then i get this error even when im trying to perform only one databse function [Error: Call to function ‘NativeDatabase.prepareAsync’ has been rejected.
→ Caused by: java.lang.NullPointerException: java.lang.NullPointerException]. has anyone experienced this or have a solution to it
Expo-Sqlite: strange behaviour on unique constraint violation
I have a database schema that uses a lot of Unique constraints in non pk/fk fields, i want to use it in my expo app using the Expo-SQLite library, before that i’m making some tests with the library.
The issue is when i try to insert a row in a simple test table which violates the Unique constraint over the ‘Name’ field app freezes (console.log doesn’t work after that, even refreshing the app), have wrapped the query in a try/catch but nothing is thrown, the Expo-SQlite methods can return a ResultErrorSet object but in this case this kind of object is not returned (works in other cases, like using select on a non-existing table).
Besides after this bug when i try to insert another row which doesn’t violate the constraint the console prints a ‘database locked’ error, i have to restart the development server to make it work properly again.
This only happens in this case, other queries like select, insert (with no violation), and delete works properly… im completely stuck on this…
How to handle errors in transactionAsync function of expo-sqlite properly?
I noticed that some errors are not being thrown.
Specifically errors caused by UNIQUE constraint, and duplicate primary keys.