From 4fa3f8a4148b6369349d0ff500f1c5b6eedda55d Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Mon, 1 Jan 2018 15:28:11 -0500 Subject: [PATCH 01/12] Update src copyright year to 2018 --- CHANGES.md | 4 ++++ package.json | 2 +- plugin.xml | 2 +- src/android/io/sqlc/SQLiteAndroidDatabase.java | 2 +- src/android/io/sqlc/SQLitePlugin.java | 2 +- src/ios/SQLitePlugin.h | 2 +- src/ios/SQLitePlugin.m | 2 +- 7 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index eec631683..06d200f3e 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,9 @@ # Changes +###### cordova-sqlite-legacy-express-core 1.0.5-pre01 + +TBD + ###### cordova-sqlite-legacy-express-core 1.0.4 - Cleaned up workaround solution to BUG 666: close db before opening (ignore close error) diff --git a/package.json b/package.json index 6e3a1b0eb..b8807e4cb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cordova-sqlite-legacy-express-core", - "version": "1.0.4", + "version": "1.0.5-pre01", "description": "Native interface to SQLite for PhoneGap/Cordova (legacy express core version)", "cordova": { "id": "cordova-sqlite-legacy-express-core", diff --git a/plugin.xml b/plugin.xml index e76aae76d..f73a90842 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="1.0.5-pre01"> Cordova sqlite storage plugin - legacy express core version diff --git a/src/android/io/sqlc/SQLiteAndroidDatabase.java b/src/android/io/sqlc/SQLiteAndroidDatabase.java index a18871841..578b1908e 100644 --- a/src/android/io/sqlc/SQLiteAndroidDatabase.java +++ b/src/android/io/sqlc/SQLiteAndroidDatabase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2017: Christopher J. Brody (aka Chris Brody) + * Copyright (c) 2012-2018: Christopher J. Brody (aka Chris Brody) * Copyright (c) 2005-2010, Nitobi Software Inc. * Copyright (c) 2010, IBM Corporation */ diff --git a/src/android/io/sqlc/SQLitePlugin.java b/src/android/io/sqlc/SQLitePlugin.java index f4fb74cf8..ca6a907fd 100755 --- a/src/android/io/sqlc/SQLitePlugin.java +++ b/src/android/io/sqlc/SQLitePlugin.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2017: Christopher J. Brody (aka Chris Brody) + * Copyright (c) 2012-2018: Christopher J. Brody (aka Chris Brody) * Copyright (c) 2005-2010, Nitobi Software Inc. * Copyright (c) 2010, IBM Corporation */ diff --git a/src/ios/SQLitePlugin.h b/src/ios/SQLitePlugin.h index 107ef6b1f..c459606e6 100755 --- a/src/ios/SQLitePlugin.h +++ b/src/ios/SQLitePlugin.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2017: Christopher J. Brody (aka Chris Brody) + * Copyright (c) 2012-2018: Christopher J. Brody (aka Chris Brody) * Copyright (C) 2011 Davide Bertola * * This library is available under the terms of the MIT License (2008). diff --git a/src/ios/SQLitePlugin.m b/src/ios/SQLitePlugin.m index a56bf5ad2..43a704c53 100755 --- a/src/ios/SQLitePlugin.m +++ b/src/ios/SQLitePlugin.m @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2017: Christopher J. Brody (aka Chris Brody) + * Copyright (c) 2012-2018: Christopher J. Brody (aka Chris Brody) * Copyright (C) 2011 Davide Bertola * * This library is available under the terms of the MIT License (2008). From 0614fd056f5e4226487008e18e600f5d4f1a8653 Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Mon, 1 Jan 2018 17:00:54 -0500 Subject: [PATCH 02/12] cordova-sqlite-legacy-express-core doc fixes --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index fd4de49ba..5feb5e5a5 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ License terms for iOS/macOS platform version: MIT only ## About this version branch -This version branch contains the source code for the Android/iOS/macOS platforms (legacy express core version branch). This version does not contain any libraries or source code from www.sqlite.org. This version branch uses the built-in sqlite libraries on Android, iOS, and macOS. +This plugin version branch contains the source code for the Android/iOS/macOS platforms (legacy express core version branch). This version does not contain any libraries or source code from www.sqlite.org. This version branch uses the built-in sqlite libraries on Android, iOS, and macOS. This version branch is now used to develop Android platform version without dependency on JAR or NDK library artifacts for testing on `cordova-android@7`. @@ -49,7 +49,7 @@ Use the `location` or `iosDatabaseLocation` option in `sqlitePlugin.openDatabase ## Status -- A recent version of the Cordova CLI (such as `6.5.0`) is recommended. Cordova versions older than `6.0.0` are missing the `cordova-ios@4.0.0` security fixes. In addition it is *required* to use `cordova prepare` in case of cordova-ios older than `4.3.0` (Cordova CLI `6.4.0`). +- A recent version of the Cordova CLI (such as `6.5.0` / `7.1.0` / `8.0.0`) is recommended. Cordova versions older than `6.0.0` are missing the `cordova-ios@4.0.0` security fixes. In addition it may be necessary to use `cordova prepare` in case of cordova-ios older than `4.3.0` (Cordova CLI `6.4.0`). - The iOS database location is now mandatory, as documented below. - Android platform version in this version branch is now using the built-in Android SQLite database classes. Integration with the lightweight [Android-sqlite-connector](https://github.com/liteglue/Android-sqlite-connector) is available in the default [litehelpers / Cordova-sqlite-storage](https://github.com/litehelpers/Cordova-sqlite-storage) version branch as well as other versions such as [litehelpers / cordova-sqlite-ext](https://github.com/litehelpers/cordova-sqlite-ext) and [litehelpers / Cordova-sqlite-legacy](https://github.com/litehelpers/Cordova-sqlite-legacy). - iOS/macOS platform version in this version branch uses builtin `libsqlite3.dylib` framework library. Other versions such as the default [litehelpers / Cordova-sqlite-storage](https://github.com/litehelpers/Cordova-sqlite-storage) version branch, [litehelpers / cordova-sqlite-ext](https://github.com/litehelpers/cordova-sqlite-ext), and [litehelpers / Cordova-sqlite-legacy](https://github.com/litehelpers/Cordova-sqlite-legacy) include a build of a recent sqlite3 amalgamation. @@ -66,7 +66,7 @@ Use the `location` or `iosDatabaseLocation` option in `sqlitePlugin.openDatabase - Android versions supported: 2.3.3 - 7.1.1 (API level 10 - 25), depending on Cordova version ref: - iOS versions supported: 8.x / 9.x / 10.x / 11.x - Default `PRAGMA journal_mode` setting (*tested*): - - Android (builtin android.database implementation): `persist` + - Android pre-8.0 (builtin android.database implementation): `persist` - otherwise: `delete` - AUTO-VACUUM is not enabled by default. If no form of `VACUUM` or `PRAGMA auto_vacuum` is used then sqlite will automatically reuse deleted data space for new data but the database file will never shrink. For reference: and [litehelpers/Cordova-sqlite-storage#646](https://github.com/litehelpers/Cordova-sqlite-storage/issues/646) - In case of memory issues please use smaller transactions or use the plugin version at [litehelpers / Cordova-sqlite-evcore-extbuild-free](https://github.com/litehelpers/Cordova-sqlite-evcore-extbuild-free) (GPL or commercial license terms). @@ -999,7 +999,7 @@ To run from a windows powershell (here is a sample for android target): - `SQLitePlugin.coffee.md`: platform-independent (Literate CoffeeScript, can be compiled with a recent CoffeeScript (1.x) compiler) - `www`: platform-independent Javascript as generated from `SQLitePlugin.coffee.md` using `coffeescript@1` (and committed!) - `src`: platform-specific source code -- `spec`: test suite using Jasmine +- `spec`: test suite using Jasmine (`2.2.0`) - `tests`: very simple Jasmine test suite that is run on Circle CI (Android platform) and Travis CI (iOS platform) (used as a placeholder) From ef1875550854098edeaacdf0617f9243858a9e12 Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Mon, 1 Jan 2018 17:00:54 -0500 Subject: [PATCH 03/12] general doc updates --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 5feb5e5a5..5f194852e 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ License terms for Android platform version: MIT or Apache 2.0 License terms for iOS/macOS platform version: MIT only -## About this version branch +## About this plugin version branch This plugin version branch contains the source code for the Android/iOS/macOS platforms (legacy express core version branch). This version does not contain any libraries or source code from www.sqlite.org. This version branch uses the built-in sqlite libraries on Android, iOS, and macOS. @@ -14,7 +14,7 @@ This version branch is now used to develop Android platform version without depe NOTE: This version branch has some additional known [issues fixed in newer version branches](#issues-fixed-in-newer-version-branches). - + ## BREAKING CHANGE: Database location parameter is now mandatory @@ -75,7 +75,7 @@ Use the `location` or `iosDatabaseLocation` option in `sqlitePlugin.openDatabase ## Announcements -- Nice overview of this and other alternatives for storing local data at: +- Nice overview of alternatives for storing local data in Cordova apps at: - New alternative solution for small data storage: [TheCocoaProject/ cordova-plugin-nativestorage](https://github.com/TheCocoaProject/cordova-plugin-nativestorage) - simpler "native storage of variables" for Android/iOS/Windows - Resolved Java 6/7/8 concurrent map compatibility issue reported in [litehelpers/Cordova-sqlite-storage#726](https://github.com/litehelpers/Cordova-sqlite-storage/issues/726), THANKS to pointer by [@NeoLSN (Jason Yang/楊朝傑)](https://github.com/NeoLSN) in [litehelpers/Cordova-sqlite-storage#727](https://github.com/litehelpers/Cordova-sqlite-storage/issues/727). - Updated workaround solution to [BUG 666 (litehelpers/Cordova-sqlite-storage#666)](https://github.com/litehelpers/Cordova-sqlite-storage/issues/666) (possible transaction issue after window.location change with possible data loss): close database if already open before opening again @@ -292,7 +292,8 @@ Documented in: [brodybits / Avoiding-some-Cordova-pitfalls](https://github.com/b - [litehelpers / Cordova-sqlite-storage](https://github.com/litehelpers/Cordova-sqlite-storage) - core plugin version for Android/iOS/macOS/Windows (permissive license terms) - [litehelpers / cordova-sqlite-ext](https://github.com/litehelpers/cordova-sqlite-ext) - plugin version with REGEXP (Android/iOS/macOS), SELECT BLOB in Base64 format (all platforms Android/iOS/macOS/Windows), and pre-populated databases (all platforms Android/iOS/macOS/Windows). Permissive license terms. -- [litehelpers / Cordova-sqlite-legacy-build-support](https://github.com/litehelpers/Cordova-sqlite-legacy-build-support) - maintenance of WP8 platform version along with Windows 8.1/Windows Phone 8.1 and the other supported platforms Android/iOS/macOS/Windows 10; limited support for PhoneGap CLI/PhoneGap Build/plugman/Intel XDK; limited testing; limited updates. Permissive license terms. +- [litehelpers / cordova-sqlite-legacy](https://github.com/litehelpers/cordova-sqlite-legacy) - support for Windows 8.1/Windows Phone 8.1 along with Android/iOS/macOS/Windows 10, with support for REGEXP (Android/iOS/macOS), SELECT BLOB in Base64 format (all platforms Android/iOS/macOS/Windows), and pre-populated databases (all platforms Android/iOS/macOS/Windows). Limited updates. Permissive license terms. +- [brodybits / cordova-sqlite-legacy-build-support](https://github.com/brodybits/cordova-sqlite-legacy-build-support) - maintenance of WP8 platform version along with Windows 8.1/Windows Phone 8.1 and the other supported platforms Android/iOS/macOS/Windows 10; limited support for PhoneGap CLI/PhoneGap Build/plugman/Intel XDK; limited testing; limited updates. Permissive license terms. - [litehelpers / Cordova-sqlcipher-adapter](https://github.com/litehelpers/Cordova-sqlcipher-adapter) - supports [SQLCipher](https://www.zetetic.net/sqlcipher/) for Android/iOS/macOS/Windows - [litehelpers / Cordova-sqlite-evcore-extbuild-free](https://github.com/litehelpers/Cordova-sqlite-evcore-extbuild-free) - Enhancements for Android: JSON and SQL statement handling implemented in C, supports larger transactions and handles large SQL batches in less than half the time as this plugin version. Supports arbitrary database location on Android. Support for build environments such as PhoneGap Build and Intel XDK. Also includes REGEXP (Android/iOS/macOS) and SELECT BLOB in Base64 format (all platforms Android/iOS/macOS/Windows). GPL or commercial license terms. - [litehelpers / cordova-sqlite-evplus-ext-legacy-build-free](https://github.com/litehelpers/cordova-sqlite-evplus-ext-legacy-build-free) - internal memory improvements to support larger transactions (Android/iOS) and fix to support all Unicode characters (iOS). (GPL or special commercial license terms). From 9cc042f9a280acd5c3e5060fbb596a31274d2cff Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Mon, 1 Jan 2018 17:17:09 -0500 Subject: [PATCH 04/12] Signal INTERNAL ERROR in case of attempt to reuse db (Android/iOS) Should never happen due to workaround solution to litehelpers/Cordova-sqlite-storage#666 --- CHANGES.md | 4 ++-- package.json | 2 +- plugin.xml | 2 +- src/android/io/sqlc/SQLitePlugin.java | 9 ++------- src/ios/SQLitePlugin.m | 6 ++++-- 5 files changed, 10 insertions(+), 13 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 06d200f3e..cf9773f67 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,8 +1,8 @@ # Changes -###### cordova-sqlite-legacy-express-core 1.0.5-pre01 +###### cordova-sqlite-legacy-express-core 1.0.5-pre02 -TBD +- Signal INTERNAL ERROR in case of attempt to reuse db (Android/iOS) (should never happen due to workaround solution to BUG 666) ###### cordova-sqlite-legacy-express-core 1.0.4 diff --git a/package.json b/package.json index b8807e4cb..9c4a2b47e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cordova-sqlite-legacy-express-core", - "version": "1.0.5-pre01", + "version": "1.0.5-pre02", "description": "Native interface to SQLite for PhoneGap/Cordova (legacy express core version)", "cordova": { "id": "cordova-sqlite-legacy-express-core", diff --git a/plugin.xml b/plugin.xml index f73a90842..aecd531ad 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="1.0.5-pre02"> Cordova sqlite storage plugin - legacy express core version diff --git a/src/android/io/sqlc/SQLitePlugin.java b/src/android/io/sqlc/SQLitePlugin.java index ca6a907fd..6b49e3376 100755 --- a/src/android/io/sqlc/SQLitePlugin.java +++ b/src/android/io/sqlc/SQLitePlugin.java @@ -196,16 +196,11 @@ public void onDestroy() { // -------------------------------------------------------------------------- private void startDatabase(String dbname, JSONObject options, CallbackContext cbc) { - // TODO: is it an issue that we can orphan an existing thread? What should we do here? - // If we re-use the existing DBRunner it might be in the process of closing... DBRunner r = dbrmap.get(dbname); - // Brody TODO: It may be better to terminate the existing db thread here & start a new one, instead. if (r != null) { - // don't orphan the existing thread; just re-open the existing database. - // In the worst case it might be in the process of closing, but even that's less serious - // than orphaning the old DBRunner. - cbc.success(); + // NO LONGER EXPECTED due to BUG 666 workaround solution: + cbc.error("INTERNAL ERROR: database already open for db name: " + dbname); } else { r = new DBRunner(dbname, options, cbc); dbrmap.put(dbname, r); diff --git a/src/ios/SQLitePlugin.m b/src/ios/SQLitePlugin.m index 43a704c53..6575b4902 100755 --- a/src/ios/SQLitePlugin.m +++ b/src/ios/SQLitePlugin.m @@ -117,6 +117,7 @@ -(void)openNow: (CDVInvokedUrlCommand*)command NSString *dbname = [self getDBPath:dbfilename at:dblocation]; if (dbname == NULL) { + // XXX NOT EXPECTED (INTERNAL ERROR): NSLog(@"No db name specified for open"); pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:@"You must specify database name"]; } @@ -124,8 +125,9 @@ -(void)openNow: (CDVInvokedUrlCommand*)command NSValue *dbPointer = [openDBs objectForKey:dbfilename]; if (dbPointer != NULL) { - NSLog(@"Reusing existing database connection for db name %@", dbfilename); - pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:@"Database opened"]; + // NO LONGER EXPECTED due to BUG 666 workaround solution: + NSLog(@"INTERNAL ERROR: database already open for db name: %@ (db file name: %@)", dbname, dbfilename); + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString: @"INTERNAL ERROR: database already open"]; } else { const char *name = [dbname UTF8String]; sqlite3 *db; From 7572e388b0ac8aa2dca373128f242f5f335b01e4 Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Mon, 1 Jan 2018 17:31:05 -0500 Subject: [PATCH 05/12] iOS/macOS @synchronized guard for sqlite3_open operation --- CHANGES.md | 3 ++- package.json | 2 +- plugin.xml | 2 +- src/ios/SQLitePlugin.m | 6 +++++- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index cf9773f67..d8deede04 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,7 +1,8 @@ # Changes -###### cordova-sqlite-legacy-express-core 1.0.5-pre02 +###### cordova-sqlite-legacy-express-core 1.0.5 +- iOS/macOS @synchronized guard for sqlite3_open operation - Signal INTERNAL ERROR in case of attempt to reuse db (Android/iOS) (should never happen due to workaround solution to BUG 666) ###### cordova-sqlite-legacy-express-core 1.0.4 diff --git a/package.json b/package.json index 9c4a2b47e..1b3fb1861 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cordova-sqlite-legacy-express-core", - "version": "1.0.5-pre02", + "version": "1.0.5", "description": "Native interface to SQLite for PhoneGap/Cordova (legacy express core version)", "cordova": { "id": "cordova-sqlite-legacy-express-core", diff --git a/plugin.xml b/plugin.xml index aecd531ad..c18d3557a 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="1.0.5"> Cordova sqlite storage plugin - legacy express core version diff --git a/src/ios/SQLitePlugin.m b/src/ios/SQLitePlugin.m index 6575b4902..50a98b264 100755 --- a/src/ios/SQLitePlugin.m +++ b/src/ios/SQLitePlugin.m @@ -128,7 +128,11 @@ -(void)openNow: (CDVInvokedUrlCommand*)command // NO LONGER EXPECTED due to BUG 666 workaround solution: NSLog(@"INTERNAL ERROR: database already open for db name: %@ (db file name: %@)", dbname, dbfilename); pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString: @"INTERNAL ERROR: database already open"]; - } else { + [self.commandDelegate sendPluginResult:pluginResult callbackId: command.callbackId]; + return; + } + + @synchronized(self) { const char *name = [dbname UTF8String]; sqlite3 *db; From 3de42583f95af0425e1613b423a774fa17b2d295 Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Mon, 1 Jan 2018 17:55:38 -0500 Subject: [PATCH 06/12] SQLiteConnectorDatabase.java (Android) update copyright (2018) --- CHANGES.md | 2 +- package.json | 2 +- plugin.xml | 2 +- src/android/io/sqlc/SQLiteConnectorDatabase.java | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 47cc5a347..48b96ea4c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,6 @@ # Changes -##### cordova-sqlite-legacy-core 1.0.7-pre1 +##### cordova-sqlite-legacy-core 1.0.7-pre2 ###### cordova-sqlite-legacy-express-core 1.0.5 diff --git a/package.json b/package.json index d6cd9fea8..ba6f9a857 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cordova-sqlite-legacy-core", - "version": "1.0.7-pre1", + "version": "1.0.7-pre2", "description": "Native interface to SQLite for PhoneGap/Cordova (legacy core version branch)", "cordova": { "id": "cordova-sqlite-legacy-core", diff --git a/plugin.xml b/plugin.xml index e1468a928..087103243 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="1.0.7-pre2"> Cordova sqlite storage plugin - legacy core version branch diff --git a/src/android/io/sqlc/SQLiteConnectorDatabase.java b/src/android/io/sqlc/SQLiteConnectorDatabase.java index 63cd1198d..850266bb8 100644 --- a/src/android/io/sqlc/SQLiteConnectorDatabase.java +++ b/src/android/io/sqlc/SQLiteConnectorDatabase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016: Christopher J. Brody (aka Chris Brody) + * Copyright (c) 2012-2018: Christopher J. Brody (aka Chris Brody) * Copyright (c) 2005-2010, Nitobi Software Inc. * Copyright (c) 2010, IBM Corporation */ From e028aaf00642ad20599d64cabe00b229c622f570 Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Mon, 1 Jan 2018 18:46:51 -0500 Subject: [PATCH 07/12] additional doc fixes --- README.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index da7392503..c2f8123ec 100644 --- a/README.md +++ b/README.md @@ -69,9 +69,11 @@ Use the `location` or `iosDatabaseLocation` option in `sqlitePlugin.openDatabase ## Status -- A recent version of the Cordova CLI (such as `6.5.0` or `7.1.0`) is recommended. _(TBD issue with cordova-android@7 as included by Cordova 8)_ Cordova versions older than `6.0.0` are missing the `cordova-ios@4.0.0` security fixes. In addition it is *required* to use `cordova prepare` in case of cordova-ios older than `4.3.0` (Cordova CLI `6.4.0`). -- This version branch uses a `before_plugin_install` hook to install sqlite3 library dependencies from `cordova-sqlite-storage-dependencies` via npm. -- This plugin will NOT work on `cordova-android@7` due to issue with JAR and NDK library files as discussed in [litehelpers/Cordova-sqlite-storage#729](https://github.com/litehelpers/Cordova-sqlite-storage/issues/729). +- A recent version of the Cordova CLI (such as `6.5.0` / `7.1.0`) is recommended. (Cordova CLI 8.x includes `cordova-android@7`, NOT supported by this plugin version due to [litehelpers/Cordova-sqlite-storage#729](https://github.com/litehelpers/Cordova-sqlite-storage/issues/729).) Cordova versions older than `6.0.0` are missing the `cordova-ios@4.0.0` security fixes. In addition it may be necessary to use `cordova prepare` in case of cordova-ios older than `4.3.0` (Cordova CLI `6.4.0`). +- This plugin is NOT supported by PhoneGap Developer App or PhoneGap Desktop App. +- This plugin version uses a `before_plugin_install` hook to install sqlite3 library dependencies from `cordova-sqlite-storage-dependencies` via npm. +- This plugin version will NOT work on `cordova-android@7` due to issue with JAR and NDK library files as discussed in [litehelpers/Cordova-sqlite-storage#729](https://github.com/litehelpers/Cordova-sqlite-storage/issues/729). +- Use of other systems such as Cordova Plugman, PhoneGap CLI, PhoneGap Build, and Intel XDK is no longer supported with this plugin version since they do not honor the `before_plugin_install` hook. The supported solution is to use [brodybits / cordova-sqlite-legacy-build-support](https://github.com/brodybits/cordova-sqlite-legacy-build-support) (limited testing, limited updates). - SQLite `3.8.10.2` included when building (all platforms), with the following definitions for iOS/macOS/Windows: - `SQLITE_THREADSAFE=1` (`SQLITE_THREADSAFE=2` on iOS/macOS) - `SQLITE_DEFAULT_MEMSTATUS=0` @@ -111,7 +113,7 @@ Use the `location` or `iosDatabaseLocation` option in `sqlitePlugin.openDatabase - iOS versions supported: 8.x / 9.x / 10.x / 11.x - FTS3, FTS4, and R-Tree are fully tested and supported for all target platforms in this version branch. - Default `PRAGMA journal_mode` setting (*tested*): - - Android _pre-8.0_ (builtin android.database implementation _as selected using the `androidDatabaseImplementation` option in `window.sqlitePlugin.openDatabase`_): `persist` + - Android pre-8.0 with builtin android.database implementation (as selected using the `androidDatabaseImplementation` option in `window.sqlitePlugin.openDatabase`): `persist` - otherwise: `delete` - AUTO-VACUUM is not enabled by default. If no form of `VACUUM` or `PRAGMA auto_vacuum` is used then sqlite will automatically reuse deleted data space for new data but the database file will never shrink. For reference: and [litehelpers/Cordova-sqlite-storage#646](https://github.com/litehelpers/Cordova-sqlite-storage/issues/646) - In case of memory issues please use smaller transactions or use the plugin version at [litehelpers / Cordova-sqlite-evcore-extbuild-free](https://github.com/litehelpers/Cordova-sqlite-evcore-extbuild-free) (GPL or commercial license terms). @@ -257,7 +259,7 @@ Some additional issues are tracked in [open Cordova-sqlite-storage bug-general i - Problems have been reported when using this plugin with Crosswalk (for Android). It may help to install Crosswalk as a plugin instead of using Crosswalk to create the project. - Does not work with [axemclion / react-native-cordova-plugin](https://github.com/axemclion/react-native-cordova-plugin) since the `window.sqlitePlugin` object is *not* properly exported (ES5 feature). It is recommended to use [andpor / react-native-sqlite-storage](https://github.com/andpor/react-native-sqlite-storage) for SQLite database access with React Native Android/iOS instead. -Additional limitations are tracked in [open Cordova-sqlite-storage doc-todo issues](https://github.com/litehelpers/Cordova-sqlite-storage/issues?q=is%3Aissue+is%3Aopen+label%3Adoc-todo). +Additional limitations are tracked in [marked Cordova-sqlite-storage doc-todo issues](https://github.com/litehelpers/Cordova-sqlite-storage/issues?q=is%3Aissue+label%3Adoc-todo). @@ -327,7 +329,7 @@ Documented in: [brodybits / Avoiding-some-Cordova-pitfalls](https://github.com/b - IndexedDBShim adapter (possibly based on IndexedDBShim) - Further cleanup of [support](#support) section - Resolve or document remaining [open Cordova-sqlite-storage bugs](https://github.com/litehelpers/Cordova-sqlite-storage/issues?q=is%3Aissue+is%3Aopen+label%3Abug-general) -- Resolve [cordova-sqlite-help doc-todo issues](https://github.com/litehelpers/Cordova-sqlite-help/issues?q=is%3Aissue%20label%3Adoc-todo) and [cordova-sqlite-storage doc-todo issues](https://github.com/litehelpers/Cordova-sqlite-storage/issues?q=is%3Aissue+is%3Aopen+label%3Adoc-todo) +- Resolve [cordova-sqlite-help doc-todo issues](https://github.com/litehelpers/Cordova-sqlite-help/issues?q=is%3Aissue%20label%3Adoc-todo) and [marked Cordova-sqlite-storage doc-todo issues](https://github.com/litehelpers/Cordova-sqlite-storage/issues?q=is%3Aissue+label%3Adoc-todo) From 238ea6acc54aef4a35ff4607be16d19e028f6e46 Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Mon, 1 Jan 2018 18:49:17 -0500 Subject: [PATCH 08/12] doc fixes for macOS/Windows build flags --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c2f8123ec..f9227e935 100644 --- a/README.md +++ b/README.md @@ -87,9 +87,9 @@ Use the `location` or `iosDatabaseLocation` option in `sqlitePlugin.openDatabase - `SQLITE_ENABLE_FTS3_PARENTHESIS` - `SQLITE_ENABLE_FTS4` - `SQLITE_ENABLE_RTREE` - - `SQLITE_DEFAULT_PAGE_SIZE=1024` and `SQLITE_DEFAULT_CACHE_SIZE=2000` to avoid "potentially distruptive change(s)" from SQLite 3.12.0 ref: - - `SQLITE_OS_WINRT` for Windows only -- Use of other systems such as Cordova Plugman, PhoneGap CLI, PhoneGap Build, and Intel XDK is no longer supported 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) (available with GPL or commercial license terms) or [litehelpers / Cordova-sqlite-legacy-build-support](https://github.com/litehelpers/Cordova-sqlite-legacy-build-support) (limited testing, limited updates) + - `SQLITE_DEFAULT_PAGE_SIZE=1024` and `SQLITE_DEFAULT_CACHE_SIZE=2000` (`SQLITE_DEFAULT_CACHE_SIZE` missing for macOS "osx" and Windows) to avoid "potentially distruptive change(s)" from SQLite 3.12.0 described at: + - `SQLITE_OS_WINRT` (Windows only) + - `NDEBUG` (Windows only) - 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) From f03c96a978fd395f8d8b851b7d4f20db9dae8138 Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Mon, 1 Jan 2018 19:23:53 -0500 Subject: [PATCH 09/12] build flag fix for macOS ("osx") --- CHANGES.md | 4 +++- README.md | 2 +- package.json | 2 +- plugin.xml | 4 ++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 48b96ea4c..a6a602d7d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,8 @@ # Changes -##### cordova-sqlite-legacy-core 1.0.7-pre2 +##### cordova-sqlite-legacy-core 1.0.7-pre3 + +- SQLITE_DEFAULT_CACHE_SIZE build flag fix for macOS ("osx") ###### cordova-sqlite-legacy-express-core 1.0.5 diff --git a/README.md b/README.md index f9227e935..07db137d1 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ Use the `location` or `iosDatabaseLocation` option in `sqlitePlugin.openDatabase - `SQLITE_ENABLE_FTS3_PARENTHESIS` - `SQLITE_ENABLE_FTS4` - `SQLITE_ENABLE_RTREE` - - `SQLITE_DEFAULT_PAGE_SIZE=1024` and `SQLITE_DEFAULT_CACHE_SIZE=2000` (`SQLITE_DEFAULT_CACHE_SIZE` missing for macOS "osx" and Windows) to avoid "potentially distruptive change(s)" from SQLite 3.12.0 described at: + - `SQLITE_DEFAULT_PAGE_SIZE=1024` and `SQLITE_DEFAULT_CACHE_SIZE=2000` (`SQLITE_DEFAULT_CACHE_SIZE` missing for Windows) to avoid "potentially distruptive change(s)" from SQLite 3.12.0 described at: - `SQLITE_OS_WINRT` (Windows only) - `NDEBUG` (Windows only) - The iOS database location is now mandatory, as documented below. diff --git a/package.json b/package.json index ba6f9a857..7e170327c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cordova-sqlite-legacy-core", - "version": "1.0.7-pre2", + "version": "1.0.7-pre3", "description": "Native interface to SQLite for PhoneGap/Cordova (legacy core version branch)", "cordova": { "id": "cordova-sqlite-legacy-core", diff --git a/plugin.xml b/plugin.xml index 087103243..94eab8ebf 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="1.0.7-pre3"> Cordova sqlite storage plugin - legacy core version branch @@ -82,7 +82,7 @@ + compiler-flags="-w -DSQLITE_THREADSAFE=2 -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_RTREE -DSQLITE_DEFAULT_PAGE_SIZE=1024 -DSQLITE_DEFAULT_CACHE_SIZE=2000" /> From 31185b684ac3db2ba09c9e505c6567624b446dc8 Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Mon, 1 Jan 2018 19:23:53 -0500 Subject: [PATCH 10/12] build flag fix for Windows --- CHANGES.md | 4 ++-- README.md | 2 +- package.json | 2 +- plugin.xml | 2 +- src/windows/SQLite3-Win-RT/SQLite3/SQLite3.Shared.vcxitems | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index a6a602d7d..8b5341f7e 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,8 +1,8 @@ # Changes -##### cordova-sqlite-legacy-core 1.0.7-pre3 +##### cordova-sqlite-legacy-core 1.0.7-pre4 -- SQLITE_DEFAULT_CACHE_SIZE build flag fix for macOS ("osx") +- SQLITE_DEFAULT_CACHE_SIZE build flag fix for macOS ("osx") and Windows ###### cordova-sqlite-legacy-express-core 1.0.5 diff --git a/README.md b/README.md index 07db137d1..2d4587d72 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ Use the `location` or `iosDatabaseLocation` option in `sqlitePlugin.openDatabase - `SQLITE_ENABLE_FTS3_PARENTHESIS` - `SQLITE_ENABLE_FTS4` - `SQLITE_ENABLE_RTREE` - - `SQLITE_DEFAULT_PAGE_SIZE=1024` and `SQLITE_DEFAULT_CACHE_SIZE=2000` (`SQLITE_DEFAULT_CACHE_SIZE` missing for Windows) to avoid "potentially distruptive change(s)" from SQLite 3.12.0 described at: + - `SQLITE_DEFAULT_PAGE_SIZE=1024` and `SQLITE_DEFAULT_CACHE_SIZE=2000` to avoid "potentially distruptive change(s)" from SQLite 3.12.0 described at: - `SQLITE_OS_WINRT` (Windows only) - `NDEBUG` (Windows only) - The iOS database location is now mandatory, as documented below. diff --git a/package.json b/package.json index 7e170327c..428c09ef1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cordova-sqlite-legacy-core", - "version": "1.0.7-pre3", + "version": "1.0.7-pre4", "description": "Native interface to SQLite for PhoneGap/Cordova (legacy core version branch)", "cordova": { "id": "cordova-sqlite-legacy-core", diff --git a/plugin.xml b/plugin.xml index 94eab8ebf..141e4fd7f 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="1.0.7-pre4"> Cordova sqlite storage plugin - legacy core version branch diff --git a/src/windows/SQLite3-Win-RT/SQLite3/SQLite3.Shared.vcxitems b/src/windows/SQLite3-Win-RT/SQLite3/SQLite3.Shared.vcxitems index 37144485e..06a6b4767 100644 --- a/src/windows/SQLite3-Win-RT/SQLite3/SQLite3.Shared.vcxitems +++ b/src/windows/SQLite3-Win-RT/SQLite3/SQLite3.Shared.vcxitems @@ -11,7 +11,7 @@ %(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory);$(MSBuildThisFileDirectory)..\..\..\..\node_modules\cordova-sqlite-storage-dependencies - /DSQLITE_THREADSAFE=1 /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_RTREE /DSQLITE_DEFAULT_PAGE_SIZE=1024 /DSQLITE_OS_WINRT %(AdditionalOptions) + /DSQLITE_THREADSAFE=1 /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_RTREE /DSQLITE_DEFAULT_PAGE_SIZE=1024 /DSQLITE_DEFAULT_CACHE_SIZE=2000 /DSQLITE_OS_WINRT %(AdditionalOptions) From 760dec7f5340f953a91689840fbdc44df16d983f Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Mon, 1 Jan 2018 20:25:46 -0500 Subject: [PATCH 11/12] Signal INTERNAL ERROR in case of attempt to reuse db on Windows Should never happen due to workaround solution to litehelpers/Cordova-sqlite-storage#666 --- CHANGES.md | 3 ++- package.json | 2 +- plugin.xml | 2 +- src/windows/sqlite-proxy.js | 6 +++++- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 8b5341f7e..da4c38954 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,7 +1,8 @@ # Changes -##### cordova-sqlite-legacy-core 1.0.7-pre4 +##### cordova-sqlite-legacy-core 1.0.7-pre5 +- Signal INTERNAL ERROR in case of attempt to reuse db on Windows (should never happen due to workaround solution to BUG 666) - SQLITE_DEFAULT_CACHE_SIZE build flag fix for macOS ("osx") and Windows ###### cordova-sqlite-legacy-express-core 1.0.5 diff --git a/package.json b/package.json index 428c09ef1..e6853d8b2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cordova-sqlite-legacy-core", - "version": "1.0.7-pre4", + "version": "1.0.7-pre5", "description": "Native interface to SQLite for PhoneGap/Cordova (legacy core version branch)", "cordova": { "id": "cordova-sqlite-legacy-core", diff --git a/plugin.xml b/plugin.xml index 141e4fd7f..a06e29074 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="1.0.7-pre5"> Cordova sqlite storage plugin - legacy core version branch diff --git a/src/windows/sqlite-proxy.js b/src/windows/sqlite-proxy.js index 2eb3af3ae..6065fab1e 100644 --- a/src/windows/sqlite-proxy.js +++ b/src/windows/sqlite-proxy.js @@ -29,7 +29,11 @@ module.exports = { var res; function openImmediate(dbname) { - //var dbname = options.name; + if (!!dbmap[dbname]) { + // NO LONGER EXPECTED due to BUG 666 workaround solution: + fail("INTERNAL ERROR: database already open for dbname: " + dbname); + } + // from @EionRobb / phonegap-win8-sqlite: var opendbname = Windows.Storage.ApplicationData.current.localFolder.path + "\\" + dbname; console.log("open db name: " + dbname + " at full path: " + opendbname); From d45252181f0b485d7afa5df0db67af62189e88da Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Mon, 1 Jan 2018 20:35:59 -0500 Subject: [PATCH 12/12] Add error info text in case of close error on Windows --- CHANGES.md | 3 ++- package.json | 2 +- plugin.xml | 2 +- src/windows/sqlite-proxy.js | 16 ++++++++++------ 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index da4c38954..9386d41f0 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,7 +1,8 @@ # Changes -##### cordova-sqlite-legacy-core 1.0.7-pre5 +##### cordova-sqlite-legacy-core 1.0.7 +- Add error info text in case of close error on Windows - Signal INTERNAL ERROR in case of attempt to reuse db on Windows (should never happen due to workaround solution to BUG 666) - SQLITE_DEFAULT_CACHE_SIZE build flag fix for macOS ("osx") and Windows diff --git a/package.json b/package.json index e6853d8b2..9ba6affb6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cordova-sqlite-legacy-core", - "version": "1.0.7-pre5", + "version": "1.0.7", "description": "Native interface to SQLite for PhoneGap/Cordova (legacy core version branch)", "cordova": { "id": "cordova-sqlite-legacy-core", diff --git a/plugin.xml b/plugin.xml index a06e29074..72fd716f5 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="1.0.7"> Cordova sqlite storage plugin - legacy core version branch diff --git a/src/windows/sqlite-proxy.js b/src/windows/sqlite-proxy.js index 6065fab1e..90755a4a8 100644 --- a/src/windows/sqlite-proxy.js +++ b/src/windows/sqlite-proxy.js @@ -63,20 +63,24 @@ module.exports = { var options = args[0]; var res; try { - //res = SQLitePluginRT.SQLitePlugin.closeAsync(JSON.stringify(options)); var dbname = options.path; + nextTick(function() { - if (!!dbmap[dbname] && dbmap[dbname].close() == 0) { + var rc = 0; + var db = dbmap[dbname]; + + if (!db) { + fail("CLOSE ERROR: cannot find db object for dbname: " + dbname); + } else if ((rc = db.close()) !== 0) { + fail("CLOSE ERROR CODE: " + rc); + } else { delete dbmap[dbname]; win(); - } else { - fail(); // XXX TODO REPORT ERROR } }); - } catch (ex) { + } catch (ex) { fail(ex); } - //handle(res, win, fail); }, backgroundExecuteSqlBatch: function(win, fail, args) { var options = args[0];