Skip to content

Commit

Permalink
use cordova-sqlite-ext-deps 4.0.0 (...)
Browse files Browse the repository at this point in the history
(cordova-sqlite-ext-common 5.1.0)
  • Loading branch information
Christopher J. Brody committed Oct 14, 2021
1 parent d99b49e commit ab7c40e
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 14 deletions.
1 change: 1 addition & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

- Extracted from DroidGap by @brodybits (Chris Brody)
- Transaction batch processing of Android version by @marcucio
- NDK response type enhancements to android-sqlite-native-ndk-connector & android-sqlite-ndk-native-driver by Luis Silva of OutSystems
- Maintained by @brodybits (Chris Brody)
- Fixes to support old Android versions by @nolanlawson
- Thanks to Mark Oppenheim <[email protected]> for fixes to open/close callbacks and repeated open/close/delete operations
Expand Down
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changes

### cordova-sqlite-ext-common 5.1.0

- use cordova-sqlite-ext-deps 4.0.0 with Android JARs built from android-sqlite-native-ndk-connector and android-sqlite-ndk-native-driver, with enhancements by Luis Silva of OutSystems needed for some Android 11 devices

### cordova-sqlite-ext-common 5.0.1

- fix: use cordova-sqlite-ext-deps 3.0.1 - with quick workaround update needed for BLOBFROMBASE64 on Android ARM target CPUs
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ This plugin version uses a `before_plugin_install` hook to install sqlite3 libra

### 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: [xpbrew/cordova-sqlite-storage#626](https://github.com/xpbrew/cordova-sqlite-storage/issues/626)) as described in <http://ericsink.com/entries/multiple_sqlite_problem.html> and <https://www.sqlite.org/howtocorrupt.html>.
This plugin uses non-standard [`android-sqlite-native-ndk-connector`](https://github.com/brodybits/android-sqlite-native-ndk-connector) implementation with [`android-sqlite-ndk-native-driver`](https://github.com/brodybits/android-sqlite-ndk-native-driver) on Android. In case an application access the **same** database using multiple plugins there is a risk of data corruption ref: [`storesafe/cordova-sqlite-storage#626`](https://github.com/storesafe/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 `androidDatabaseProvider: 'system'` setting as described in the [Android database provider](#android-database-provider) section below:

Expand Down Expand Up @@ -231,7 +231,7 @@ See the [Sample section](#sample) for a sample with a more detailed explanation
- <https://www.sqlite.org/releaselog/3_26_0.html>
- The iOS database location is now mandatory, as documented below.
- This version branch supports the use of two (2) possible Android sqlite database implementations:
- default: lightweight [Android-sqlite-connector](https://github.com/liteglue/Android-sqlite-connector), using _the SQLite3 NDK component built from [brodybits / Android-sqlite-ext-native-driver](https://github.com/brodybits/Android-sqlite-ext-native-driver)_
- default: _lightweight [`android-sqlite-native-ndk-connector`](https://github.com/brodybits/android-sqlite-native-ndk-connector), using SQLite3 NDK component built from [`android-sqlite-ndk-native-driver`](https://github.com/brodybits/android-sqlite-ndk-native-driver)_
- optional: Android system database implementation, using the `androidDatabaseProvider: 'system'` setting in `sqlitePlugin.openDatabase()` call as described in the [Android database provider](#android-database-provider) section below.
- Support for WP8 along with Windows 8.1/Windows Phone 8.1/Windows 10 using Visual Studio 2015 is available in: [brodybits / cordova-sqlite-legacy-build-support](https://github.com/brodybits/cordova-sqlite-legacy-build-support)
- The following features are available in [`brodybits/cordova-sqlite-ext`](https://github.com/brodybits/cordova-sqlite-ext):
Expand Down Expand Up @@ -291,7 +291,7 @@ and window functions
- macOS ("osx" platform) is now supported
- New [litehelpers / Cordova-sqlite-evcore-extbuild-free](https://github.com/litehelpers/Cordova-sqlite-evcore-extbuild-free) plugin version with Android JSON and SQL statement handling implemented in C, as well as support for PhoneGap Build, Intel XDK, etc. (GPL or commercial license terms). Handles large SQL batches in less than half the time as this plugin version. Also supports arbitrary database location on Android.
- Published [brodybits / Cordova-quick-start-checklist](https://github.com/brodybits/Cordova-quick-start-checklist) and [brodybits / Avoiding-some-Cordova-pitfalls](https://github.com/brodybits/Avoiding-some-Cordova-pitfalls).
- Android platform version currently uses the lightweight [Android-sqlite-connector](https://github.com/liteglue/Android-sqlite-connector) by default configuration (may be changed as described below).
- Android platform version currently uses lightweight <https://github.com/brodybits/android-sqlite-native-ndk-connector> by default configuration (may be changed as described below).
- Self-test functions to verify proper installation and operation of this plugin
- More explicit `openDatabase` and `deleteDatabase` `iosDatabaseLocation` option
- Added straightforward sql batch function
Expand Down Expand Up @@ -627,8 +627,8 @@ Some additional issues are tracked in [open cordova-sqlite-storage bug-general i
- SELECT BLOB column value type is not supported consistently across all platforms (not supported on Windows). It is recommended to use the built-in HEX function to SELECT BLOB column data in hexadecimal format, working consistently across all platforms. As an alternative: SELECT BLOB in Base64 format is supported by this plugin version, _[`brodybits/cordova-sqlite-ext`](https://github.com/brodybits/cordova-sqlite-ext) (permissive license terms) and [litehelpers / Cordova-sqlite-evcore-extbuild-free](https://github.com/litehelpers/Cordova-sqlite-evcore-extbuild-free) (GPL or commercial license options)_.
- Database files with certain multi-byte UTF-8 characters are not tested and not expected to work consistently across all platform implementations.
- Issues with UNICODE `\u0000` character (same as `\0`):
- Encoding issue reproduced on Android (default [Android-sqlite-connector](https://github.com/liteglue/Android-sqlite-connector) implementation with [Android-sqlite-ext-native-driver](https://github.com/brodybits/Android-sqlite-ext-native-driver), using Android NDK)
- Truncation in case of argument value with UNICODE `\u0000` character reproduced on (WebKit) Web SQL as well as plugin on Android (default [Android-sqlite-connector](https://github.com/liteglue/Android-sqlite-connector) implementation with [Android-sqlite-ext-native-driver](https://github.com/brodybits/Android-sqlite-ext-native-driver), using Android NDK) and Windows
- Encoding issue reproduced on Android (default [`android-sqlite-native-ndk-connector`](https://github.com/brodybits/android-sqlite-native-ndk-connector) implementation with [`android-sqlite-ndk-native-driver`](https://github.com/brodybits/android-sqlite-ndk-native-driver), using Android NDK)
- Truncation in case of argument value with UNICODE `\u0000` character reproduced on (WebKit) Web SQL as well as plugin on Android (default [`android-sqlite-native-ndk-connector`](https://github.com/brodybits/android-sqlite-native-ndk-connector) implementation with [`android-sqlite-ndk-native-driver`](https://github.com/brodybits/android-sqlite-ndk-native-driver), using Android NDK), browser, and Windows
- SQL error reported in case of inline value string with with UNICODE `\u0000` character on (WebKit) Web SQL, plugin on Android with use of the `androidDatabaseProvider: 'system'` setting, and plugin on _some_ other platforms
- Case-insensitive matching and other string manipulations on Unicode characters, which is provided by optional ICU integration in the sqlite source and working with recent versions of Android, is not supported for any target platforms.
- The iOS/macOS platform version uses a thread pool but with only one thread working at a time due to "synchronized" database access.
Expand Down Expand Up @@ -852,7 +852,7 @@ var db = window.sqlitePlugin.openDatabase({name: 'my.db', location: 'default'},

**WARNING:** The new "default" location value is different from the old default location used until March 2016 and would break an upgrade for an app that was using the old default setting (`location: 0`, same as using `iosDatabaseLocation: 'Documents'`) on iOS. The recommended solution is to continue to open the database from the same location, using `iosDatabaseLocation: 'Documents'`.

**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: [xpbrew/cordova-sqlite-storage#626](https://github.com/xpbrew/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 `androidDatabaseProvider: 'system'` setting as described in the **Android sqlite implementation** section below.
**WARNING 2:** As described above: by default this plugin uses a non-standard <https://github.com/brodybits/android-sqlite-native-ndk-connector> implementation on Android. In case an application access the **same** database using multiple plugins there is a risk of data corruption ref: [`storesafe/cordova-sqlite-storage#626`](https://github.com/storesafe/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 `androidDatabaseProvider: 'system'` setting as described in the **Android sqlite implementation** section below.

To specify a different location (affects iOS/macOS *only*):

Expand Down Expand Up @@ -960,7 +960,7 @@ Use the `location` or `iosDatabaseLocation` option in `sqlitePlugin.openDatabase

### Android database provider

By default, this plugin uses [Android-sqlite-connector](https://github.com/liteglue/Android-sqlite-connector), which is lightweight and should be more efficient than the Android system database provider. To use the built-in Android system database provider implementation instead:
By default, this plugin uses <https://github.com/brodybits/android-sqlite-native-ndk-connector>, which is lightweight and should be more efficient than the Android system database provider. To use the built-in Android system database provider implementation instead:

```js
var db = window.sqlitePlugin.openDatabase({
Expand All @@ -973,7 +973,7 @@ var db = window.sqlitePlugin.openDatabase({
(Use of the `androidDatabaseImplementation: 2` setting which is now replaced by `androidDatabaseProvider: 'system'` is now deprecated and may be removed in the near future.)

**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: [xpbrew/cordova-sqlite-storage#626](https://github.com/xpbrew/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 `androidDatabaseProvider: 'system'` setting as described here.
- As described above: by default this plugin uses a non-standard `android-sqlite-native-ndk-connector` implementation on Android. In case an application access the **same** database using multiple plugins there is a risk of data corruption ref: [xpbrew/cordova-sqlite-storage#626](https://github.com/xpbrew/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 `androidDatabaseProvider: 'system'` setting as described here.
- In case of the `androidDatabaseProvider: 'system'` setting, [xpbrew/cordova-sqlite-storage#193](https://github.com/xpbrew/cordova-sqlite-storage/issues/193) reported (as observed by a number of app developers in the past) 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.

<!-- END Android database provider -->
Expand All @@ -986,7 +986,7 @@ var db = window.sqlitePlugin.openDatabase({

The cause of this issue remains unknown. Of interest: [android / platform_external_sqlite commit d4f30d0d15](https://github.com/android/platform_external_sqlite/commit/d4f30d0d1544f8967ee5763c4a1680cb0553039f) which references and includes the sqlite commit at: http://www.sqlite.org/src/info/6c4c2b7dba

This is *not* an issue when the default [Android-sqlite-connector](https://github.com/liteglue/Android-sqlite-connector) database implementation is used, which is the case when no `androidDatabaseProvider` or `androidDatabaseImplementation` setting is used.
This is *not* an issue when the default `android-sqlite-native-ndk-connector` database implementation is used, which is the case when no `androidDatabaseProvider` or `androidDatabaseImplementation` setting is used.

There is an optional workaround that simply closes and reopens the database file at the end of every transaction that is committed. The workaround is enabled by opening the database with options as follows:

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cordova-sqlite-ext-common",
"version": "5.0.1",
"version": "5.1.0",
"description": "Native interface to SQLite for PhoneGap/Cordova - cordova-sqlite-ext-common version branch",
"cordova": {
"id": "cordova-sqlite-ext-common",
Expand Down Expand Up @@ -30,7 +30,7 @@
},
"homepage": "https://github.com/brodybits/cordova-sqlite-ext",
"dependencies": {
"cordova-sqlite-ext-deps": "3.0.1"
"cordova-sqlite-ext-deps": "4.0.0"
},
"scripts": {
"clean-spec": "rm -rf spec/[mnp]* && git cl spec/config.xml spec/package.json && git status --ignored",
Expand Down
6 changes: 3 additions & 3 deletions plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="cordova-sqlite-ext-common"
version="5.0.1">
version="5.1.0">

<name>Cordova sqlite storage plugin - cordova-sqlite-ext-common (...)</name>

Expand Down Expand Up @@ -34,9 +34,9 @@
<source-file src="src/android/io/sqlc/SQLiteConnectorDatabase.java" target-dir="src/io/sqlc"/>

<!-- Android-sqlite-connector [jar]: -->
<lib-file src="node_modules/cordova-sqlite-ext-deps/libs/sqlite-connector.jar" />
<lib-file src="node_modules/cordova-sqlite-ext-deps/libs/sqlite-native-ndk-connector.jar" />
<!-- Android-sqlite-connector native driver [native libs in jar]: -->
<lib-file src="node_modules/cordova-sqlite-ext-deps/libs/sqlite-native-driver.jar" />
<lib-file src="node_modules/cordova-sqlite-ext-deps/libs/sqlite-ndk-native-driver.jar" />
</platform>

<!-- iOS -->
Expand Down

0 comments on commit ab7c40e

Please sign in to comment.