diff --git a/README.md b/README.md index 0ec47a4b6..0de4046d1 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,16 @@ _XXX TBD ???:_ +## WARNING: Multiple SQLite problem on Android + +This plugin uses a non-standard [Android-sqlite-connector](https://github.com/liteglue/Android-sqlite-connector) implementation on Android. In case an application access the **same** database using multiple plugins there is a risk of data corruption ref: [litehelpers/Cordova-sqlite-storage#626](https://github.com/litehelpers/Cordova-sqlite-storage/issues/626)) as described in and . + +The workaround is to use the `androidDatabaseImplementation: 2` setting as described in the **Android sqlite implementation** section below: + +```js +var db = window.sqlitePlugin.openDatabase({name: "my.db", androidDatabaseImplementation: 2}); +``` + ## BREAKING CHANGE: Database location parameter is now mandatory The `location` or `iosDatabaseLocation` *must* be specified in the `openDatabase` and `deleteDatabase` calls, as documented below. @@ -362,6 +372,8 @@ var db = window.sqlitePlugin.openDatabase({name: 'my.db', location: 'default'}, **WARNING:** The new "default" location value is *NOT* the same as the old default location and would break an upgrade for an app that was using the old default value (0) on iOS. +**WARNING 2:** As described above: by default this plugin uses a non-standard [Android-sqlite-connector](https://github.com/liteglue/Android-sqlite-connector) implementation on Android. In case an application access the **same** database using multiple plugins there is a risk of data corruption ref: [litehelpers/Cordova-sqlite-storage#626](https://github.com/litehelpers/Cordova-sqlite-storage/issues/626)) as described in and . The workaround is to use the `androidDatabaseImplementation: 2` setting as described in the **Android sqlite implementation** section below. + To specify a different location (affects iOS/macOS *only*): ```js @@ -442,9 +454,13 @@ By default, this plugin uses [Android-sqlite-connector](https://github.com/liteg var db = window.sqlitePlugin.openDatabase({name: "my.db", androidDatabaseImplementation: 2}); ``` +**IMPORTANT:** +- As described above: by default this plugin uses a non-standard [Android-sqlite-connector](https://github.com/liteglue/Android-sqlite-connector) implementation on Android. In case an application access the **same** database using multiple plugins there is a risk of data corruption ref: [litehelpers/Cordova-sqlite-storage#626](https://github.com/litehelpers/Cordova-sqlite-storage/issues/626)) as described in and . The workaround is to use the `androidDatabaseImplementation: 2` setting as described here. +- In case of the `androidDatabaseImplementation: 2` setting, [litehelpers/Cordova-sqlite-storage#193](https://github.com/litehelpers/Cordova-sqlite-storage/issues/193) reported that in certain Android versions, if the app is stopped or aborted without closing the database then there is an unexpected database lock and the data that was inserted is lost. The workaround is described below. + ### Workaround for Android db locking issue -[litehelpers/Cordova-sqlite-storage#193](https://github.com/litehelpers/Cordova-sqlite-storage/issues/193) was reported (as observed by several app developers) that certain versions of the Android database classes, if the app is stopped or aborted without closing the database then: +[litehelpers/Cordova-sqlite-storage#193](https://github.com/litehelpers/Cordova-sqlite-storage/issues/193) reported (as observed by several app developers) that certain versions of the Android database classes, if the app is stopped or aborted without closing the database then: - (sometimes) there is an unexpected database lock - the data that was inserted is lost.