Skip to content

Commit b772869

Browse files
author
Christopher J. Brody
committed
README.md document multiple sqlite problem
ref: storesafe#626
1 parent d4ec3c9 commit b772869

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

README.md

+17-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,16 @@ _XXX TBD ???:_
2020

2121
<!-- END About this version branch -->
2222

23+
## WARNING: Multiple SQLite problem on Android
24+
25+
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 <http://ericsink.com/entries/multiple_sqlite_problem.html> and <https://www.sqlite.org/howtocorrupt.html>.
26+
27+
The workaround is to use the `androidDatabaseImplementation: 2` setting as described in the **Android sqlite implementation** section below:
28+
29+
```js
30+
var db = window.sqlitePlugin.openDatabase({name: "my.db", androidDatabaseImplementation: 2});
31+
```
32+
2333
## BREAKING CHANGE: Database location parameter is now mandatory
2434

2535
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'},
362372

363373
**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.
364374

375+
**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 <http://ericsink.com/entries/multiple_sqlite_problem.html> and <https://www.sqlite.org/howtocorrupt.html>. The workaround is to use the `androidDatabaseImplementation: 2` setting as described in the **Android sqlite implementation** section below.
376+
365377
To specify a different location (affects iOS/macOS *only*):
366378

367379
```js
@@ -442,9 +454,13 @@ By default, this plugin uses [Android-sqlite-connector](https://github.com/liteg
442454
var db = window.sqlitePlugin.openDatabase({name: "my.db", androidDatabaseImplementation: 2});
443455
```
444456

457+
**IMPORTANT:**
458+
- 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 <http://ericsink.com/entries/multiple_sqlite_problem.html> and <https://www.sqlite.org/howtocorrupt.html>. The workaround is to use the `androidDatabaseImplementation: 2` setting as described here.
459+
- 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.
460+
445461
### Workaround for Android db locking issue
446462

447-
[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:
463+
[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:
448464
- (sometimes) there is an unexpected database lock
449465
- the data that was inserted is lost.
450466

0 commit comments

Comments
 (0)