I have a mobile app where I can download a SQLite DB file from our servers, if it’s not already in the phone, and then open it.
I works fine, but I also want the ability to delete that DB, redownload it and reopen it.
It doesn’t work because there is no SQLite.close() method. I need that in order to be able to safely close the DB, delete the file, and then reopen the DB with same credentials.
This new method is already available in Expo 29, however, it isn’t ‘public’: Expo.SQLite.openDatabase() returns a WebSQLDatabase object that has Expo’s SQLiteDatabase in the _db property. As a result, to close the database you need to do something like this:
// Open the database
const db = Expo.SQLite.openDatabase("db_name");
// Close the database
db._db.close();
To fix this, a new public close method would need to be added to WebSQLDatabase in Expo’s fork of node-websql.
I added this explanation to @jankammerath’s feature request so that everyone is aware of the current status.