storesafe/cordova-sqlite-storage

Safer Android defaults

brodybits opened this issue · 2 comments

This plugin uses Android-sqlite-connector together with Android-sqlite-native-driver by default. There is a risk that an app developer may run into http://ericsink.com/entries/multiple_sqlite_problem.html when accessing the same database from custom plugin classes as well (#626).

It would be safer if the plugin would use the builtin android.database.sqlite classes instead and require a setting such as androidDatabaseImplementation: 1 to use the more efficient Android-sqlite-connector together with Android-sqlite-native-driver.

In addition there is a androidLockWorkaround: 1 setting to enable a workaround for a data loss issue reported for certain versions of Android in 2014/2015 (#193). While this is not the fault of the plugin an optional workaround solution (close and reopen after every COMMIT) was needed. It would be safer to enable this workaround by default and add an "optimization" option to turn it off if desired.

This was partially triggered by the discussion in storesafe/cordova-sqlite-storage-help#18.

Hi Chris, small doubt... do you suggest to use

androidDatabaseImplementation: 1 

or

androidDatabaseImplementation: 2

In this message I understand 1 but from the other I understood 2...

Also, would you post a short example line with both parameters indicated?

Thanks

It is safest to use androidDatabaseImplementation: 2 and androidLockWorkaround: 1. My idea is that this should be done by default ref: #687.

The idea to use androidDatabaseImplementation: 1 for the more efficient Android-sqlite-connector implementation was just an idea. I am thinking to use a different option key such as opt or optimization to specify the use of the more efficient Android implementation.