From ce3f8ee47b4e152d11e35c192c59bcd0f6c406dd Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Tue, 13 Jul 2021 22:14:15 -0400 Subject: [PATCH 1/4] feat(cordova-sqlite-ext-common): add BLOBFROMBASE64 using cordova-sqlite-ext-deps 3.0.0 (cordova-sqlite-ext-common 5.0.0) BREAKING CHANGE due to removed Android pre-5.1 support --- CHANGES.md | 4 + README.md | 16 ++- package.json | 4 +- plugin.xml | 14 +- spec/www/index.html | 1 + spec/www/spec/blobfrombase64-test.js | 121 ++++++++++++++++++ .../SQLite3/SQLite3.Shared.vcxitems | 10 +- 7 files changed, 157 insertions(+), 13 deletions(-) create mode 100755 spec/www/spec/blobfrombase64-test.js diff --git a/CHANGES.md b/CHANGES.md index ee814480..b44ad664 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,9 @@ # Changes +### cordova-sqlite-ext-common 5.0.0 + +- feat: add BLOBFROMBASE64 using cordova-sqlite-ext-deps 3.0.0 - BREAKING CHANGE due to removed Android pre-5.1 support + ### cordova-sqlite-ext-common 4.0.0 ### cordova-sqlite-storage-commoncore 2.0.0 diff --git a/README.md b/README.md index a477aa08..a53a2178 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,6 @@ in an upcoming major release - see [`xpbrew/cordova-sqlite-storage#922`](https:/ some highlights: -- drop support for Android pre-5.1, which will also be dropped by `cordova-android`, including deprecated `armeabi` target (superseded by `armeabi-v7a`, seems to be not supported by Android 5.0) - more info in [`xpbrew/cordova-sqlite-storage#922`](https://github.com/xpbrew/cordova-sqlite-storage/issues/922) - error `code` will always be `0` (which is already the case on Windows); actual SQLite3 error code will be part of the error `message` member whenever possible (see [`xpbrew/cordova-sqlite-storage#821`](https://github.com/xpbrew/cordova-sqlite-storage/issues/821)) - drop support for location: 0-2 values in openDatabase call (please use `location: 'default'` or `iosDatabaseLocation` setting in openDatabase as documented below) - throw an exception in case of `androidDatabaseImplementation: 2` setting which is now superseded by `androidDatabaseProvider: 'system'` setting @@ -49,7 +48,7 @@ under consideration: ## About this plugin version -This is a common plugin version branch with the following extra (non-standard) features: REGEXP, BASE64 +This is a common plugin version branch with the following extra (non-standard) features: REGEXP, BASE64, BLOBFROMBASE64 This plugin version uses a `before_plugin_install` hook to install sqlite3 library dependencies from `cordova-sqlite-ext-deps` via npm. @@ -204,7 +203,7 @@ See the [Sample section](#sample) for a sample with a more detailed explanation - This plugin version uses a `before_plugin_install` hook to install sqlite3 library dependencies from `cordova-sqlite-storage-dependencies` via npm. - Use of other systems such as Cordova Plugman, PhoneGap CLI, PhoneGap Build, and Intel XDK is no longer supported by this plugin version since they do not honor the `before_plugin_install` hook. The supported solution is to use [litehelpers / Cordova-sqlite-evcore-extbuild-free](https://github.com/litehelpers/Cordova-sqlite-evcore-extbuild-free) (GPL or commercial license terms); deprecated alternative with permissive license terms is available at: [brodybits / cordova-sqlite-legacy-build-support](https://github.com/brodybits/cordova-sqlite-legacy-build-support) (very limited testing, very limited updates). - This plugin version includes the following extra (non-standard) features: - - BASE64 integrated from [brodybits / sqlite3-base64](https://github.com/brodybits/sqlite3-base64), using [brodybits / libb64-encode](https://github.com/brodybits/libb64-encode) (based on by Chris Venter, public domain) + - BASE64 and BLOBFROMBASE64 integrated from [brodybits / sqlite3-base64](https://github.com/brodybits/sqlite3-base64), using [brodybits / libb64-core](https://github.com/brodybits/libb64-core) (based on by Chris Venter, public domain) - REGEXP for Android (default Android-sqlite-connector database implementation), iOS, and macOS using [brodybits / sqlite3-regexp-cached](https://github.com/brodybits/sqlite3-regexp-cached) (based on by Alexey Tourbin, public domain) - SQLite `3.32.3` included when building (all platforms), with the following compile-time definitions: - `SQLITE_THREADSAFE=1` @@ -1221,6 +1220,17 @@ db.readTransaction(function(tx) { }); ``` +### INSERT BLOB data from BASE64 string value + +```Javascript +db.transaction(function(tx) { + tx.executeSql("INSERT INTO MyTable (data) VALUES (BLOBFROMBASE64(?))", ["AQID"], function(tx, resultSet) { + console.log("insertId: " + resultSet.insertId + " -- probably 1"); + console.log("rowsAffected: " + resultSet.rowsAffected + " -- should be 1"); + }); +}); +``` + ## Background processing The threading model depends on which platform version is used: diff --git a/package.json b/package.json index 4bdfef10..74706683 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cordova-sqlite-ext-common", - "version": "4.0.0", + "version": "5.0.0", "description": "Native interface to SQLite for PhoneGap/Cordova - cordova-sqlite-ext-common version branch", "cordova": { "id": "cordova-sqlite-ext-common", @@ -30,7 +30,7 @@ }, "homepage": "https://github.com/brodybits/cordova-sqlite-ext", "dependencies": { - "cordova-sqlite-ext-deps": "2.1.1" + "cordova-sqlite-ext-deps": "3.0.0" }, "scripts": { "clean-spec": "rm -rf spec/[mnp]* && git cl spec/config.xml spec/package.json && git status --ignored", diff --git a/plugin.xml b/plugin.xml index 9d3fa77a..d146968d 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="5.0.0"> Cordova sqlite storage plugin - cordova-sqlite-ext-common (...) @@ -60,8 +60,10 @@ - - + + + + - - + + + + + diff --git a/spec/www/spec/blobfrombase64-test.js b/spec/www/spec/blobfrombase64-test.js new file mode 100755 index 00000000..3af353df --- /dev/null +++ b/spec/www/spec/blobfrombase64-test.js @@ -0,0 +1,121 @@ +/* 'use strict'; */ + +var MYTIMEOUT = 12000; + +var DEFAULT_SIZE = 5000000; // max to avoid popup in safari/ios + +var isWindows = /Windows /.test(navigator.userAgent); // Windows (...) +var isAndroid = !isWindows && /Android/.test(navigator.userAgent); + +var scenarioList = [ + isAndroid ? 'Plugin-implementation-default' : 'Plugin', + 'HTML5', + 'Plugin-implementation-2' +]; + +var scenarioCount = (!!window.hasWebKitBrowser) ? (isAndroid ? 3 : 2) : 1; + +var mytests = function() { + + for (var i=0; i - %(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory);$(MSBuildThisFileDirectory)..\..\..\..\node_modules\cordova-sqlite-ext-deps;$(MSBuildThisFileDirectory)..\..\..\..\node_modules\cordova-sqlite-ext-deps\sqlite3-base64;$(MSBuildThisFileDirectory)..\..\..\..\node_modules\cordova-sqlite-ext-deps\libb64-encode + %(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory);$(MSBuildThisFileDirectory)..\..\..\..\node_modules\cordova-sqlite-ext-deps;$(MSBuildThisFileDirectory)..\..\..\..\node_modules\cordova-sqlite-ext-deps\sqlite3-base64;$(MSBuildThisFileDirectory)..\..\..\..\node_modules\cordova-sqlite-ext-deps\libb64-core /DSQLITE_THREADSAFE=1 /DSQLITE_DEFAULT_SYNCHRONOUS=3 /DSQLITE_DEFAULT_MEMSTATUS=0 /DSQLITE_OMIT_DECLTYPE /DSQLITE_OMIT_DEPRECATED /DSQLITE_OMIT_PROGRESS_CALLBACK /DSQLITE_OMIT_SHARED_CACHE /DSQLITE_TEMP_STORE=2 /DSQLITE_OMIT_LOAD_EXTENSION /DSQLITE_ENABLE_FTS3 /DSQLITE_ENABLE_FTS3_PARENTHESIS /DSQLITE_ENABLE_FTS4 /DSQLITE_ENABLE_FTS5 /DSQLITE_ENABLE_RTREE /DSQLITE_ENABLE_JSON1 /DSQLITE_DEFAULT_PAGE_SIZE=4096 /DSQLITE_DEFAULT_CACHE_SIZE=-2000 /DSQLITE_OS_WINRT %(AdditionalOptions) - + + @@ -33,7 +34,10 @@ false - + + false + + false From ef76bb45ddaedbbeafa2c6916613655ecdc2d724 Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Thu, 15 Jul 2021 18:44:35 -0400 Subject: [PATCH 2/4] fix: use cordova-sqlite-ext-deps 3.0.1 with quick workaround update needed for BLOBFROMBASE64 on Android ARM target CPUs (cordova-sqlite-ext-common 5.0.1) --- CHANGES.md | 4 ++++ package.json | 4 ++-- plugin.xml | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index b44ad664..52c6cb52 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,9 @@ # Changes +### 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 + ### cordova-sqlite-ext-common 5.0.0 - feat: add BLOBFROMBASE64 using cordova-sqlite-ext-deps 3.0.0 - BREAKING CHANGE due to removed Android pre-5.1 support diff --git a/package.json b/package.json index 74706683..a9709eb6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cordova-sqlite-ext-common", - "version": "5.0.0", + "version": "5.0.1", "description": "Native interface to SQLite for PhoneGap/Cordova - cordova-sqlite-ext-common version branch", "cordova": { "id": "cordova-sqlite-ext-common", @@ -30,7 +30,7 @@ }, "homepage": "https://github.com/brodybits/cordova-sqlite-ext", "dependencies": { - "cordova-sqlite-ext-deps": "3.0.0" + "cordova-sqlite-ext-deps": "3.0.1" }, "scripts": { "clean-spec": "rm -rf spec/[mnp]* && git cl spec/config.xml spec/package.json && git status --ignored", diff --git a/plugin.xml b/plugin.xml index d146968d..cf822c4d 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="5.0.1"> Cordova sqlite storage plugin - cordova-sqlite-ext-common (...) From d99b49e355be3037ce790b2a7a1f2cf305477cbd Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Thu, 15 Jul 2021 19:20:26 -0400 Subject: [PATCH 3/4] test: further testing of BLOBFROMBASE64 - SELECT HEX of BLOBFROMBASE64 with 'AQID' [X'010203'] parameter - SELECT HEX of BLOBFROMBASE64 with 'AQID AQIE AQIF' parameter - update test labels - update a test database name --- spec/www/spec/blobfrombase64-test.js | 44 ++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/spec/www/spec/blobfrombase64-test.js b/spec/www/spec/blobfrombase64-test.js index 3af353df..a2b05ab3 100755 --- a/spec/www/spec/blobfrombase64-test.js +++ b/spec/www/spec/blobfrombase64-test.js @@ -45,11 +45,11 @@ var mytests = function() { describe(suiteName + 'SELECT BLOBFROMBASE64 value test(s)', function() { - it(suiteName + "SELECT HEX(BLOBFROMBASE64('AQID')) [X'010203']", function(done) { + it(suiteName + "SELECT HEX(BLOBFROMBASE64('AQID')) [X'010203'] INLINE", function(done) { if (isWebSql) pending('SKIP: BLOBFROMBASE64 not supported by Web SQL'); if (!isWebSql && isAndroid && isImpl2) pending("SKIP: BLOBFROMBASE64 not supported with androidDatabaseProvider: 'system'"); - var db = openDatabase('SELECT-BLOBFROMBASE64-AQID-AS-HEX-VALUE.db'); + var db = openDatabase('SELECT-BLOBFROMBASE64-AQID-AS-HEX-VALUE-INLINE.db'); db.transaction(function(tx) { tx.executeSql("SELECT HEX(BLOBFROMBASE64('AQID')) AS hex_value", [], function(ignored, rs) { @@ -64,9 +64,47 @@ var mytests = function() { }); }, MYTIMEOUT); + it(suiteName + "SELECT HEX of BLOBFROMBASE64 with 'AQID' [X'010203'] parameter", function(done) { + if (isWebSql) pending('SKIP: BLOBFROMBASE64 not supported by Web SQL'); + if (!isWebSql && isAndroid && isImpl2) pending("SKIP: BLOBFROMBASE64 not supported with androidDatabaseProvider: 'system'"); + + var db = openDatabase('SELECT-HEX-of-BLOBFROMBASE64-AQID-AS-HEX-VALUE.db'); + + db.transaction(function(tx) { + tx.executeSql("SELECT HEX(BLOBFROMBASE64(?)) AS hex_value", ['AQID'], function(ignored, rs) { + expect(rs).toBeDefined(); + expect(rs.rows).toBeDefined(); + expect(rs.rows.length).toBe(1); + expect(rs.rows.item(0).hex_value).toBe('010203'); + + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); + }); + }); + }, MYTIMEOUT); + + it(suiteName + "SELECT HEX of BLOBFROMBASE64 with 'AQID AQIE AQIF' [X'010203010204010205' - spaces ignored] parameter", function(done) { + if (isWebSql) pending('SKIP: BLOBFROMBASE64 not supported by Web SQL'); + if (!isWebSql && isAndroid && isImpl2) pending("SKIP: BLOBFROMBASE64 not supported with androidDatabaseProvider: 'system'"); + + var db = openDatabase('SELECT-HEX-of-BLOBFROMBASE64-AQID-AS-HEX-VALUE.db'); + + db.transaction(function(tx) { + tx.executeSql("SELECT HEX(BLOBFROMBASE64(?)) AS hex_value", ['AQID AQIE AQIF'], function(ignored, rs) { + expect(rs).toBeDefined(); + expect(rs.rows).toBeDefined(); + expect(rs.rows.length).toBe(1); + expect(rs.rows.item(0).hex_value).toBe('010203010204010205'); + + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); + }); + }); + }, MYTIMEOUT); + }); - describe(suiteName + 'INSERT inline BLOB data & SELECT as BASE64', function() { + describe(suiteName + 'INSERT BLOB data from BLOBFROMBASE64 & check stored data', function() { it(suiteName + "INSERT BLOBFROMBASE64 from 'AQID AQIE AQIF' [X'010203010204010205' - spaces ignored], SELECT as BASE64, and check type", function(done) { if (isWebSql) pending('SKIP: BLOBFROMBASE64 not supported by Web SQL'); From ab7c40e63729b7e8ca64ea3de843863b35a5873b Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Thu, 14 Oct 2021 03:27:58 -0400 Subject: [PATCH 4/4] use cordova-sqlite-ext-deps 4.0.0 (...) (cordova-sqlite-ext-common 5.1.0) --- AUTHORS.md | 1 + CHANGES.md | 4 ++++ README.md | 18 +++++++++--------- package.json | 4 ++-- plugin.xml | 6 +++--- 5 files changed, 19 insertions(+), 14 deletions(-) diff --git a/AUTHORS.md b/AUTHORS.md index f7d48286..87cdb8d3 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -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 for fixes to open/close callbacks and repeated open/close/delete operations diff --git a/CHANGES.md b/CHANGES.md index 52c6cb52..f07d8b04 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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 diff --git a/README.md b/README.md index a53a2178..4a0ed1f4 100644 --- a/README.md +++ b/README.md @@ -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 and . +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 and . The workaround is to use the `androidDatabaseProvider: 'system'` setting as described in the [Android database provider](#android-database-provider) section below: @@ -231,7 +231,7 @@ See the [Sample section](#sample) for a sample with a more detailed explanation - - 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): @@ -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 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 @@ -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. @@ -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 and . 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 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 and . 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*): @@ -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 , 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({ @@ -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 and . 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 and . 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. @@ -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: diff --git a/package.json b/package.json index a9709eb6..a2841e73 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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", diff --git a/plugin.xml b/plugin.xml index cf822c4d..06dfeb7c 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="5.1.0"> Cordova sqlite storage plugin - cordova-sqlite-ext-common (...) @@ -34,9 +34,9 @@ - + - +