From cb4b654bf98fbd5ead3598d4f4e6f893dfa8fc28 Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Tue, 22 Nov 2016 14:54:43 +0100 Subject: [PATCH 01/29] cordova-sqlite-storage 2.0.0-edge01 - support Visual Studio 2017 (RC) Reference Windows PlatformToolset v141 to support VS 2017 (RC) --- CHANGES.md | 4 ++++ README.md | 3 ++- package.json | 2 +- plugin.xml | 2 +- .../SQLite3/SQLite3.UWP/SQLite3.UWP.vcxproj | 14 +++++++------- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index b8167fa1..a5b12655 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,9 @@ # Changes +### cordova-sqlite-storage 2.0.0-edge01 + +- Reference Windows platform toolset v141 to support Visual Studio 2017 (RC) + ### cordova-sqlite-storage 1.5.0 - Build with sqlite 3.15.1, with the following settings: diff --git a/README.md b/README.md index 3793bc4f..54f91809 100644 --- a/README.md +++ b/README.md @@ -136,7 +136,7 @@ See the [Sample section](#sample) for a sample with a more detailed explanation. - Issue with `undefined` SQL parameter argument value described below - It is **not** possible to use this plugin with the default "Any CPU" target. A specific target CPU type **must** be specified when building an app with this plugin. - Windows version may crash in certain cases when invalid (bogus) function parameters are given, for example: `db.readTransaction('bogus');` - - Hard coded dependency on platform toolset libraries included by Visual Studio 2015 ref: [litehelpers/Cordova-sqlite-storage#580](https://github.com/litehelpers/Cordova-sqlite-storage/issues/580) + - Hard coded dependency on platform toolset libraries included by Visual Studio 2017 (RC) ref: [litehelpers/Cordova-sqlite-storage#580](https://github.com/litehelpers/Cordova-sqlite-storage/issues/580) - macOS version ("osx" platform) has not been tested in a release build and should be considered pre-alpha. - FTS3, FTS4, and R-Tree support is tested working OK in this version (for all target platforms in this version branch Android/iOS/macOS/Windows) - Android is supported back to SDK 10 (a.k.a. Gingerbread, Android 2.3.3); support for older versions is available upon request. @@ -147,6 +147,7 @@ See the [Sample section](#sample) for a sample with a more detailed explanation. ## Announcements +- This version references Windows platform toolset v141 to support Visual Studio 2017 (RC). - macOS ("osx" platform) is now supported - The [brodybits / Cordova-sqlite-bootstrap-test](https://github.com/brodybits/Cordova-sqlite-bootstrap-test) project is a CC0 (public domain) starting point to reproduce issues with this plugin and may be used as a quick way to start developing a new app. - New [litehelpers / Cordova-sqlite-evcore-extbuild-free](https://github.com/litehelpers/Cordova-sqlite-evcore-extbuild-free) version with Android JSON and SQL statement handling implemented in C, as well as support for PhoneGap Build, Intel XDK, etc., available with GPL or commercial license options. Handles large SQL batches in less than half the time as this version. Also supports arbitrary database location on Android. diff --git a/package.json b/package.json index bb19aaec..b59a9fb7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cordova-sqlite-storage", - "version": "1.5.0", + "version": "2.0.0-edge01", "description": "Native interface to SQLite for PhoneGap/Cordova", "cordova": { "id": "cordova-sqlite-storage", diff --git a/plugin.xml b/plugin.xml index 03ab566d..3f2c38ab 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="2.0.0-edge01"> Cordova sqlite storage plugin diff --git a/src/windows/SQLite3-Win-RT/SQLite3/SQLite3.UWP/SQLite3.UWP.vcxproj b/src/windows/SQLite3-Win-RT/SQLite3/SQLite3.UWP/SQLite3.UWP.vcxproj index 9e71c368..81b3327a 100644 --- a/src/windows/SQLite3-Win-RT/SQLite3/SQLite3.UWP/SQLite3.UWP.vcxproj +++ b/src/windows/SQLite3-Win-RT/SQLite3/SQLite3.UWP/SQLite3.UWP.vcxproj @@ -43,35 +43,35 @@ DynamicLibrary true - v140 + v141 DynamicLibrary true - v140 + v141 DynamicLibrary true - v140 + v141 DynamicLibrary false true - v140 + v141 DynamicLibrary false true - v140 + v141 DynamicLibrary false true - v140 + v141 @@ -219,4 +219,4 @@ - \ No newline at end of file + From 680bbc008f3e181abe6227abf50e351a7fc3bdae Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Mon, 28 Nov 2016 19:05:08 +0100 Subject: [PATCH 02/29] cordova-sqlite-storage 2.0.0 --- CHANGES.md | 2 +- package.json | 2 +- plugin.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 6d2152a2..8f436950 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,6 @@ # Changes -### cordova-sqlite-storage 2.0.0-edge02 +### cordova-sqlite-storage 2.0.0 - Reference Windows platform toolset v141 to support Visual Studio 2017 (RC) diff --git a/package.json b/package.json index 209d23de..80f0fffc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cordova-sqlite-storage", - "version": "2.0.0-edge02", + "version": "2.0.0", "description": "Native interface to SQLite for PhoneGap/Cordova", "cordova": { "id": "cordova-sqlite-storage", diff --git a/plugin.xml b/plugin.xml index c6955070..8699e4e9 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="2.0.0"> Cordova sqlite storage plugin From 64131fd95582e0c485da37b82fbb3900025adf25 Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Tue, 31 Jan 2017 20:47:34 +0100 Subject: [PATCH 03/29] Fix handling of undefined SQL argument values (Windows) --- CHANGES.md | 4 +++ README.md | 2 -- SQLitePlugin.coffee.md | 3 +- package.json | 2 +- plugin.xml | 2 +- spec/www/spec/db-sql-operations-test.js | 26 ++-------------- spec/www/spec/db-tx-sql-select-value-test.js | 32 ++------------------ spec/www/spec/db-tx-value-bindings-test.js | 18 +---------- spec/www/spec/sql-batch-test.js | 16 +--------- www/SQLitePlugin.js | 2 +- 10 files changed, 16 insertions(+), 91 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 0ec55690..2622fd11 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,9 @@ # Changes +### cordova-sqlite-storage 1.5.3-pre1 + +- Fix handling of undefined SQL argument values (Windows) + ### cordova-sqlite-storage 1.5.2 - Build with sqlite 3.15.2 with the following settings in this version branch: diff --git a/README.md b/README.md index a118a4c4..d73a9b76 100644 --- a/README.md +++ b/README.md @@ -145,7 +145,6 @@ See the [Sample section](#sample) for a sample with a more detailed explanation. - INCORRECT error code (0) and INCONSISTENT error message (missing actual error info) in error callbacks ref: [litehelpers/Cordova-sqlite-storage#539](https://github.com/litehelpers/Cordova-sqlite-storage/issues/539) - Issue with emojis and other 4-octet UTF-8 characters (apparently not stored correctly) ref: [litehelpers/Cordova-sqlite-storage#564](https://github.com/litehelpers/Cordova-sqlite-storage/issues/564) - Not possible to read BLOB column values - - Issue with `undefined` SQL parameter argument value described below - It is **not** possible to use this plugin with the default "Any CPU" target. A specific target CPU type **must** be specified when building an app with this plugin. - This version branch with dependency on platform toolset libraries included by Visual Studio 2015 ref: [litehelpers/Cordova-sqlite-storage#580](https://github.com/litehelpers/Cordova-sqlite-storage/issues/580) - macOS version ("osx" platform) has not been tested in a release build and should be considered pre-alpha. @@ -404,7 +403,6 @@ As "strongly recommended" by [Web SQL Database API 8.5 SQL injection](https://ww - Unlike the HTML5/[Web SQL API](http://www.w3.org/TR/webdatabase/) this plugin handles executeSql calls with too few parameters without error reporting. In case of too many parameters this plugin reports error code 0 (SQLError.UNKNOWN_ERR) while Android/iOS (WebKit) Web SQL correctly reports error code 5 (SQLError.SYNTAX_ERR) ref: https://www.w3.org/TR/webdatabase/#dom-sqlexception-code-syntax - Positive and negative `Infinity` SQL parameter argument values are treated like `null` by this plugin on Android and iOS ref: [litehelpers/Cordova-sqlite-storage#405](https://github.com/litehelpers/Cordova-sqlite-storage/issues/405) - Positive and negative `Infinity` result values cause a crash on iOS/macOS cases ref: [litehelpers/Cordova-sqlite-storage#405](https://github.com/litehelpers/Cordova-sqlite-storage/issues/405) -- Windows version fails with an error in case an `undefined` SQL parameter argument value is used. - Known issue(s) with of certain ASCII/UNICODE characters as described below. - Boolean `true` and `false` values are handled by converting them to the "true" and "false" TEXT string values, same as WebKit Web SQL on Android and iOS. This does not seem to be 100% correct as discussed in: [litehelpers/Cordova-sqlite-storage#545](https://github.com/litehelpers/Cordova-sqlite-storage/issues/545) - A number of uncategorized errors such as CREATE VIRTUAL TABLE USING bogus module are reported with error code 5 (SQLError.SYNTAX_ERR) on Android/iOS/macOS by both (WebKit) Web SQL and this plugin. diff --git a/SQLitePlugin.coffee.md b/SQLitePlugin.coffee.md index 22a9c95b..7b02894d 100644 --- a/SQLitePlugin.coffee.md +++ b/SQLitePlugin.coffee.md @@ -389,7 +389,8 @@ for v in values t = typeof v params.push ( - if v == null || v == undefined || t == 'number' || t == 'string' then v + if v == null || v == undefined then null + else if t == 'number' || t == 'string' then v else v.toString() ) diff --git a/package.json b/package.json index edf495bc..225a1a13 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cordova-sqlite-storage", - "version": "1.5.2", + "version": "1.5.3-pre1", "description": "Native interface to SQLite for PhoneGap/Cordova", "cordova": { "id": "cordova-sqlite-storage", diff --git a/plugin.xml b/plugin.xml index c6c4c85a..e1173513 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="1.5.3-pre1"> Cordova sqlite storage plugin diff --git a/spec/www/spec/db-sql-operations-test.js b/spec/www/spec/db-sql-operations-test.js index 2d36c053..a5ed27b7 100755 --- a/spec/www/spec/db-sql-operations-test.js +++ b/spec/www/spec/db-sql-operations-test.js @@ -385,14 +385,11 @@ var mytests = function() { }); }, MYTIMEOUT); - it(suiteName + 'db.executeSql check SELECT TYPEOF(?) with [undefined] for parameter argument array [BROKEN on Windows]', function(done) { - if (isWP8) pending('SKIP for WP8'); // SKIP for now - + it(suiteName + 'db.executeSql check SELECT TYPEOF(?) with [undefined] for parameter argument array', function(done) { var db = openDatabase("DB-sql-SELECT-TYPEOF-undefined.db", "1.0", "Demo", DEFAULT_SIZE); expect(db).toBeDefined(); db.executeSql('SELECT TYPEOF(?) AS myresult', [undefined], function(rs) { - if (isWindows) expect('Windows plugin version FIXED please update this test').toBe('--'); expect(rs).toBeDefined(); expect(rs.rows).toBeDefined(); expect(rs.rows.length).toBe(1); @@ -402,17 +399,6 @@ var mytests = function() { expect(rs.rows.item(0).myresult).toBe('null'); db.close(done, done); }, function(error) { - // ERROR in case of Windows: - if (isWindows) { - expect(error).toBeDefined(); - expect(error.code).toBeDefined(); - expect(error.message).toBeDefined(); - expect(error.code).toBe(0); - expect(error.message).toMatch(/Unsupported argument type: undefined/); - return done(); - } - - // OTHERWISE // NOT EXPECTED: expect(false).toBe(true); expect(error.message).toBe('--'); @@ -631,9 +617,7 @@ var mytests = function() { }); }, MYTIMEOUT); - it(suiteName + 'db.executeSql store null/undefined values and check [store undefined value BROKEN on Windows]', function(done) { - if (isWP8) pending('SKIP for WP8'); // SKIP for now - + it(suiteName + 'db.executeSql store null/undefined values and check', function(done) { var db = openDatabase("DB-sql-store-null-undefined-values-and-check.db", "1.0", "Demo", DEFAULT_SIZE); expect(db).toBeDefined(); @@ -645,15 +629,11 @@ var mytests = function() { db.executeSql('SELECT data AS d1, TYPEOF(data) AS t1, ABS(data) AS a1, UPPER(data) as u1 FROM MyTable', [], function (rs) { expect(rs.rows).toBeDefined(); - if (isWindows) // [FUTURE TBD] - expect(rs.rows.length).toBe(1); - else - expect(rs.rows.length).toBe(2); + expect(rs.rows.length).toBe(2); expect(rs.rows.item(0).d1).toBe(null); expect(rs.rows.item(0).t1).toBe('null'); expect(rs.rows.item(0).a1).toBe(null); expect(rs.rows.item(0).u1).toBe(null); - if (isWindows) return done(); // [FUTURE TBD] expect(rs.rows.item(1).d1).toBe(null); expect(rs.rows.item(1).t1).toBe('null'); expect(rs.rows.item(1).a1).toBe(null); diff --git a/spec/www/spec/db-tx-sql-select-value-test.js b/spec/www/spec/db-tx-sql-select-value-test.js index 436924b8..cbbdf1fe 100644 --- a/spec/www/spec/db-tx-sql-select-value-test.js +++ b/spec/www/spec/db-tx-sql-select-value-test.js @@ -202,7 +202,7 @@ var mytests = function() { }); }, MYTIMEOUT); - it(suiteName + 'SELECT ? with [null] parameter argument [returns text in case of androidDatabaseImplementation: 2; BROKEN for Windows]', function(done) { + it(suiteName + 'SELECT ? with [null] parameter argument [returns text in case of androidDatabaseImplementation: 2]', function(done) { var db = openDatabase('SELECT-with-null-argument.db'); expect(db).toBeDefined(); @@ -224,15 +224,12 @@ var mytests = function() { }); }, MYTIMEOUT); - it(suiteName + 'SELECT TYPEOF(?) with [undefined] parameter argument [returns text in case of Android (WebKit) Web SQL or androidDatabaseImplementation: 2; BROKEN for Windows]', function(done) { - if (isWP8) pending('SKIP for WP8'); // SKIP for now - + it(suiteName + 'SELECT TYPEOF(?) with [undefined] parameter argument [returns text in case of Android (WebKit) Web SQL or androidDatabaseImplementation: 2]', function(done) { var db = openDatabase('SELECT-TYPEOF-with-undefined-argument.db'); expect(db).toBeDefined(); db.transaction(function(tx) { tx.executeSql('SELECT TYPEOF(?) as myresult', [undefined], function(ignored, rs) { - if (isWindows) expect('Windows plugin version FIXED please update this test').toBe('--'); expect(rs).toBeDefined(); expect(rs.rows).toBeDefined(); expect(rs.rows.length).toBe(1); @@ -243,17 +240,6 @@ var mytests = function() { done(); }); }, function(error) { - // ERROR in case of Windows: - if (isWindows) { - expect(error).toBeDefined(); - expect(error.code).toBeDefined(); - expect(error.message).toBeDefined(); - expect(error.code).toBe(0); - expect(error.message).toMatch(/a statement with no error handler failed: Unsupported argument type: undefined/); - return done(); - } - - // OTHERWISE // NOT EXPECTED: expect(false).toBe(true); expect(error.message).toBe('--'); @@ -262,14 +248,11 @@ var mytests = function() { }, MYTIMEOUT); it(suiteName + 'SELECT ? with [undefined] parameter argument [returns text in case of androidDatabaseImplementation: 2]', function(done) { - if (isWP8) pending('SKIP for WP8'); // SKIP for now - var db = openDatabase('SELECT-with-undefined-argument.db'); expect(db).toBeDefined(); db.transaction(function(tx) { tx.executeSql('SELECT ? as myresult', [undefined], function(ignored, rs) { - if (isWindows) expect('Windows plugin version FIXED please update this test').toBe('--'); expect(rs).toBeDefined(); expect(rs.rows).toBeDefined(); expect(rs.rows.length).toBe(1); @@ -282,17 +265,6 @@ var mytests = function() { done(); }); }, function(error) { - // ERROR in case of Windows: - if (isWindows) { - expect(error).toBeDefined(); - expect(error.code).toBeDefined(); - expect(error.message).toBeDefined(); - expect(error.code).toBe(0); - expect(error.message).toMatch(/a statement with no error handler failed: Unsupported argument type: undefined/); - return done(); - } - - // OTHERWISE // NOT EXPECTED: expect(false).toBe(true); expect(error.message).toBe('--'); diff --git a/spec/www/spec/db-tx-value-bindings-test.js b/spec/www/spec/db-tx-value-bindings-test.js index 70f5707a..dd72829c 100755 --- a/spec/www/spec/db-tx-value-bindings-test.js +++ b/spec/www/spec/db-tx-value-bindings-test.js @@ -118,9 +118,7 @@ var mytests = function() { }); }, MYTIMEOUT); - it(suiteName + 'INSERT with undefined parameter argument value (inserted as null) and check stored data [BROKEN for Windows: Unsupported argument type ERROR]', function(done) { - if (isWP8) pending('SKIP for WP8'); // SKIP for now - + it(suiteName + 'INSERT with undefined parameter argument value (inserted as null) and check stored data [returns text in case of Android (WebKit) Web SQL]', function(done) { var db = openDatabase('INSERT-undefined-arg-value-and-check.db', '1.0', 'Demo', DEFAULT_SIZE); db.transaction(function(tx) { @@ -128,9 +126,6 @@ var mytests = function() { tx.executeSql('CREATE TABLE IF NOT EXISTS test_table (data1, data2)', [], function(ignored1, ignored2) { tx.executeSql('INSERT INTO test_table VALUES (?,?)', [undefined, 'test-string'], function(ignored, rs1) { - - if (isWindows) expect('Windows plugin version FIXED please update this test').toBe('--'); - expect(rs1).toBeDefined(); expect(rs1.rowsAffected).toBe(1); @@ -161,17 +156,6 @@ var mytests = function() { }); }); }, function(error) { - // ERROR in case of Windows: - if (isWindows) { - expect(error).toBeDefined(); - expect(error.code).toBeDefined(); - expect(error.message).toBeDefined(); - expect(error.code).toBe(0); - expect(error.message).toMatch(/a statement with no error handler failed: Unsupported argument type: undefined/); - return done(); - } - - // OTHERWISE // NOT EXPECTED: expect(false).toBe(true); expect(error.message).toBe('---'); diff --git a/spec/www/spec/sql-batch-test.js b/spec/www/spec/sql-batch-test.js index a678c113..2ddd7d31 100644 --- a/spec/www/spec/sql-batch-test.js +++ b/spec/www/spec/sql-batch-test.js @@ -179,9 +179,7 @@ var mytests = function() { }); }, MYTIMEOUT); - it(suiteName + 'Single-column batch sql test values: INSERT null/undefined values and check stored data [BROKEN on Windows]', function(done) { - if (isWP8) pending('SKIP for WP8'); // SKIP for now - + it(suiteName + 'Single-column batch sql test values: INSERT null/undefined values and check stored data', function(done) { var db = openDatabase('Single-column-batch-sql-test-null-undefined-values.db', '1.0', 'Test', DEFAULT_SIZE); expect(db).toBeDefined(); @@ -191,7 +189,6 @@ var mytests = function() { [ 'INSERT INTO MyTable VALUES (?)', [null] ], [ 'INSERT INTO MyTable VALUES (?)', [undefined] ], ], function() { - if (isWindows) expect('Windows plugin version FIXED please update this test').toBe('--'); db.executeSql('SELECT data AS d1, TYPEOF(data) AS t1, ABS(data) AS a1, UPPER(data) as u1 FROM MyTable', [], function (rs) { expect(rs.rows).toBeDefined(); expect(rs.rows.length).toBe(2); @@ -206,17 +203,6 @@ var mytests = function() { db.close(done, done); }); }, function(error) { - // ERROR EXPECTED in case of Windows: - if (isWindows) { - expect(error).toBeDefined(); - expect(error.code).toBeDefined(); - expect(error.message).toBeDefined(); - expect(error.code).toBe(0); - expect(error.message).toMatch(/a statement with no error handler failed: Unsupported argument type: undefined/); - return done(); - } - - // OTHERWISE // NOT EXPECTED: expect(false).toBe(true); expect(error.message).toBe('--'); diff --git a/www/SQLitePlugin.js b/www/SQLitePlugin.js index 482bc84a..d709a95e 100644 --- a/www/SQLitePlugin.js +++ b/www/SQLitePlugin.js @@ -355,7 +355,7 @@ for (j = 0, len1 = values.length; j < len1; j++) { v = values[j]; t = typeof v; - params.push((v === null || v === void 0 || t === 'number' || t === 'string' ? v : v.toString())); + params.push((v === null || v === void 0 ? null : t === 'number' || t === 'string' ? v : v.toString())); } } this.executes.push({ From d0751ebb729591f281aa698192c5a1879626a16a Mon Sep 17 00:00:00 2001 From: Kevin Smith Date: Tue, 17 Jan 2017 12:18:49 -0800 Subject: [PATCH 04/29] Signal error in case of a failure opening the database file (iOS/macOS) --- CHANGES.md | 3 ++- package.json | 2 +- plugin.xml | 2 +- src/ios/SQLitePlugin.m | 1 + 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 2622fd11..596f9a23 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,8 +1,9 @@ # Changes -### cordova-sqlite-storage 1.5.3-pre1 +### cordova-sqlite-storage 1.5.3-pre2 - Fix handling of undefined SQL argument values (Windows) +- Signal error in case of a failure opening the database file (iOS/macOS) ### cordova-sqlite-storage 1.5.2 diff --git a/package.json b/package.json index 225a1a13..02816f34 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cordova-sqlite-storage", - "version": "1.5.3-pre1", + "version": "1.5.3-pre2", "description": "Native interface to SQLite for PhoneGap/Cordova", "cordova": { "id": "cordova-sqlite-storage", diff --git a/plugin.xml b/plugin.xml index e1173513..54d6451c 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="1.5.3-pre2"> Cordova sqlite storage plugin diff --git a/src/ios/SQLitePlugin.m b/src/ios/SQLitePlugin.m index 0082bc4e..5bf2524b 100755 --- a/src/ios/SQLitePlugin.m +++ b/src/ios/SQLitePlugin.m @@ -138,6 +138,7 @@ -(void)openNow: (CDVInvokedUrlCommand*)command if (sqlite3_open(name, &db) != SQLITE_OK) { pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Unable to open DB"]; + [self.commandDelegate sendPluginResult:pluginResult callbackId: command.callbackId]; return; } else { // for SQLCipher version: From 6703b13428949c7a7d122aa52f172dc5ee3e1f55 Mon Sep 17 00:00:00 2001 From: daserge Date: Fri, 20 Jan 2017 22:12:34 +0300 Subject: [PATCH 05/29] Fix merges to prevent possible conflicts with other plugins (Windows) See https://issues.apache.org/jira/browse/CB-12353 for details --- CHANGES.md | 3 ++- package.json | 2 +- plugin.xml | 6 +++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 596f9a23..cbf26857 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,7 +1,8 @@ # Changes -### cordova-sqlite-storage 1.5.3-pre2 +### cordova-sqlite-storage 1.5.3-pre3 +- Fix merges to prevent possible conflicts with other plugins (Windows) - Fix handling of undefined SQL argument values (Windows) - Signal error in case of a failure opening the database file (iOS/macOS) diff --git a/package.json b/package.json index 02816f34..f3331745 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cordova-sqlite-storage", - "version": "1.5.3-pre2", + "version": "1.5.3-pre3", "description": "Native interface to SQLite for PhoneGap/Cordova", "cordova": { "id": "cordova-sqlite-storage", diff --git a/plugin.xml b/plugin.xml index 54d6451c..9357e6d7 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="1.5.3-pre3"> Cordova sqlite storage plugin @@ -81,12 +81,12 @@ - + - + From ba433c85afaa8e5bdd3cbbca2629338ecfed10a2 Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Tue, 31 Jan 2017 22:48:11 +0100 Subject: [PATCH 06/29] cordova-sqlite-storage 1.5.3 - Fix merges to prevent possible conflicts with other plugins (Windows) - Fix handling of undefined SQL argument values (Windows) - Signal error in case of a failure opening the database file (iOS/macOS) - Doc fixes and updates --- CHANGES.md | 3 ++- LICENSE.md | 2 ++ README.md | 15 +++++++-------- package.json | 2 +- plugin.xml | 2 +- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index cbf26857..ccc0f4b5 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,10 +1,11 @@ # Changes -### cordova-sqlite-storage 1.5.3-pre3 +### cordova-sqlite-storage 1.5.3 - Fix merges to prevent possible conflicts with other plugins (Windows) - Fix handling of undefined SQL argument values (Windows) - Signal error in case of a failure opening the database file (iOS/macOS) +- Doc fixes and updates ### cordova-sqlite-storage 1.5.2 diff --git a/LICENSE.md b/LICENSE.md index ff87b37e..f6312b84 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -12,6 +12,8 @@ MIT or Apache 2.0 MIT only +based on Phonegap-SQLitePlugin by @davibe (Davide Bertola ) and @joenoon (Joe Noon ) + ## Windows version MIT or Apache 2.0 diff --git a/README.md b/README.md index d73a9b76..1d3f5767 100644 --- a/README.md +++ b/README.md @@ -24,8 +24,8 @@ This is the common version which supports the most widely used features and serv The primary author and maintainer [@brodybits (Christopher J. Brody aka Chris Brody)](https://github.com/brodybits) is available for part-time contract assignments. Services available for this project include: -- Support for Ionic and other Angular derivatives -- Single issue support +- Priority issue support +- Help with application code such as debugging, optimization, etc. - Warranty and support retainers - Priority fixes and enhancements - Custom feature development @@ -532,6 +532,7 @@ Some more limitations are tracked in the [open Cordova-sqlite-storage documentat - Angular/ngCordova/Ionic controller/factory/service callbacks may be triggered before the 'deviceready' event is fired - As discussed in [litehelpers/Cordova-sqlite-storage#355](https://github.com/litehelpers/Cordova-sqlite-storage/issues/355), it may be necessary to install ionic-plugin-keyboard +- Navigation items such as root page can be tricky on Ionic 2 ref: [litehelpers/Cordova-sqlite-storage#613](https://github.com/litehelpers/Cordova-sqlite-storage/issues/613) ### Windows platform pitfalls @@ -1151,6 +1152,8 @@ Documentation at: Other resource (apparently for Ionic 1): +**NOTE:** Some Ionic and other Angular pitfalls are described above. + # Installing @@ -1237,7 +1240,7 @@ Assuming your app has a recent template as used by the Cordova create script, ad ## Free support policy -Free support is provided on a best-effort basis and is only available in public forums. Please follow the steps below to be sure you have done your best before requesting help. Use with Ionic and other Angular derivatives is no longer covered by free support. +Free support is provided on a best-effort basis and is only available in public forums. Please follow the steps below to be sure you have done your best before requesting help. ## Professional support @@ -1288,11 +1291,7 @@ In case of a problem with a pre-populated database, please post your entire proj ## What is NOT supported for free -- Use with Ionic and other Angular derivatives is no longer covered by free support. - -## Support for issues with Angular/"ngCordova"/Ionic - -Professional support is available for use with Ionic and other forms of ngCordova/Angular. For more information please contact: +- Debugging, optimization, and other help with application code. ## What information is needed for help diff --git a/package.json b/package.json index f3331745..6d64c85e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cordova-sqlite-storage", - "version": "1.5.3-pre3", + "version": "1.5.3", "description": "Native interface to SQLite for PhoneGap/Cordova", "cordova": { "id": "cordova-sqlite-storage", diff --git a/plugin.xml b/plugin.xml index 9357e6d7..df2c5551 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="1.5.3"> Cordova sqlite storage plugin From 79bfd5a2e0e3d652c0414bcbc606a61b5bc7455f Mon Sep 17 00:00:00 2001 From: Nikita Matrosov Date: Fri, 27 Jan 2017 15:33:12 +0300 Subject: [PATCH 07/29] Fix Windows target platform version VS 2017 support for UWP development (that carries v141 build toolset) by default installs Windows10 SDK v10.0.14393. This plugin still uses v10.0.10586 so to avoid asking users to install additional SDKs we need to upgrade it to 14393 See docs: https://www.visualstudio.com/en-us/productinfo/vs2017-install-product-Community.workloads#universal-windows-platform-development --- CHANGES.md | 4 +++- package.json | 2 +- plugin.xml | 2 +- .../SQLite3-Win-RT/SQLite3/SQLite3.UWP/SQLite3.UWP.vcxproj | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 8eedf408..d355d079 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,8 @@ # Changes -## cordova-sqlite-storage 2.0.2-pre1 +## cordova-sqlite-storage 2.0.2-pre2 + +- Fix Windows target platform version ### cordova-sqlite-storage 1.5.3 diff --git a/package.json b/package.json index ca3856ec..dc372730 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cordova-sqlite-storage", - "version": "2.0.2-pre1", + "version": "2.0.2-pre2", "description": "Native interface to SQLite for PhoneGap/Cordova", "cordova": { "id": "cordova-sqlite-storage", diff --git a/plugin.xml b/plugin.xml index 5db482c2..4903aeba 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="2.0.2-pre2"> Cordova sqlite storage plugin diff --git a/src/windows/SQLite3-Win-RT/SQLite3/SQLite3.UWP/SQLite3.UWP.vcxproj b/src/windows/SQLite3-Win-RT/SQLite3/SQLite3.UWP/SQLite3.UWP.vcxproj index 81b3327a..b286a67d 100644 --- a/src/windows/SQLite3-Win-RT/SQLite3/SQLite3.UWP/SQLite3.UWP.vcxproj +++ b/src/windows/SQLite3-Win-RT/SQLite3/SQLite3.UWP/SQLite3.UWP.vcxproj @@ -35,7 +35,7 @@ 14.0 true Windows Store - 10.0.10586.0 + 10.0.14393.0 10.0.10240.0 10.0 From df3968f5be1d516e5970ff79b09931d6fa41d509 Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Tue, 31 Jan 2017 23:55:33 +0100 Subject: [PATCH 08/29] cordova-sqlite-storage 2.0.2 --- CHANGES.md | 2 +- package.json | 2 +- plugin.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index d355d079..ca43a077 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,6 @@ # Changes -## cordova-sqlite-storage 2.0.2-pre2 +## cordova-sqlite-storage 2.0.2 - Fix Windows target platform version diff --git a/package.json b/package.json index dc372730..48d91f3a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cordova-sqlite-storage", - "version": "2.0.2-pre2", + "version": "2.0.2", "description": "Native interface to SQLite for PhoneGap/Cordova", "cordova": { "id": "cordova-sqlite-storage", diff --git a/plugin.xml b/plugin.xml index 4903aeba..9bb2101e 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="2.0.2"> Cordova sqlite storage plugin From 6bd03c49213ab480584792f1b469134294bac0b3 Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Thu, 16 Mar 2017 23:58:19 +0100 Subject: [PATCH 09/29] Some sqlite build flag fixes - Drop -DSQLITE_OMIT_BUILTIN_TEST (renamed & not recommended) - Certain LOCAL_CFLAGS added from https://www.sqlite.org/compile.html#recommended_compile_time_options - Minor reordering --- CHANGES.md | 4 ++++ README.md | 10 +++++++--- package.json | 4 ++-- plugin.xml | 6 +++--- .../SQLite3-Win-RT/SQLite3/SQLite3.Shared.vcxitems | 2 +- 5 files changed, 17 insertions(+), 9 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index ccc0f4b5..00a11669 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,9 @@ # Changes +### cordova-sqlite-storage 1.5.4-pre1 + +- SQLite 3.15.2 build fixes + ### cordova-sqlite-storage 1.5.3 - Fix merges to prevent possible conflicts with other plugins (Windows) diff --git a/README.md b/README.md index 1d3f5767..a1d45015 100644 --- a/README.md +++ b/README.md @@ -116,14 +116,18 @@ See the [Sample section](#sample) for a sample with a more detailed explanation. - NOT supported by PhoneGap Developer App or PhoneGap Desktop App - This version uses a `before_plugin_install` hook to install sqlite3 library dependencies from `cordova-sqlite-storage-dependencies` via npm. - SQLite version `3.15.2` included with the following build settings: - - `SQLITE_TEMP_STORE=2` - `SQLITE_THREADSAFE=1` + - `SQLITE_DEFAULT_MEMSTATUS=0` + - `SQLITE_OMIT_DECLTYPE` + - `SQLITE_OMIT_DEPRECATED` + - `SQLITE_OMIT_PROGRESS_CALLBACK` + - `SQLITE_OMIT_SHARED_CACHE` + - `SQLITE_TEMP_STORE=2` + - `SQLITE_OMIT_LOAD_EXTENSION` - `SQLITE_ENABLE_FTS3` - `SQLITE_ENABLE_FTS3_PARENTHESIS` - `SQLITE_ENABLE_FTS4` - `SQLITE_ENABLE_RTREE` - - `SQLITE_OMIT_BUILTIN_TEST` - - `SQLITE_OMIT_LOAD_EXTENSION` - `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 - A recent version of the Cordova CLI (such as `6.4.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`). diff --git a/package.json b/package.json index 6d64c85e..fb0ecf5f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cordova-sqlite-storage", - "version": "1.5.3", + "version": "1.5.4-pre1", "description": "Native interface to SQLite for PhoneGap/Cordova", "cordova": { "id": "cordova-sqlite-storage", @@ -33,7 +33,7 @@ }, "homepage": "https://github.com/litehelpers/Cordova-sqlite-storage", "dependencies": { - "cordova-sqlite-storage-dependencies": "1.0.3" + "cordova-sqlite-storage-dependencies": "1.0.4" }, "scripts": { "start": "node scripts/prepareSpec.js" diff --git a/plugin.xml b/plugin.xml index df2c5551..6b8bf9d7 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="1.5.4-pre1"> Cordova sqlite storage plugin @@ -57,7 +57,7 @@ + compiler-flags="-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" /> @@ -75,7 +75,7 @@ + compiler-flags="-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" /> diff --git a/src/windows/SQLite3-Win-RT/SQLite3/SQLite3.Shared.vcxitems b/src/windows/SQLite3-Win-RT/SQLite3/SQLite3.Shared.vcxitems index 6950a0e4..37144485 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_TEMP_STORE=2 /DSQLITE_THREADSAFE=1 /DSQLITE_ENABLE_FTS3 /DSQLITE_ENABLE_FTS3_PARENTHESIS /DSQLITE_ENABLE_FTS4 /DSQLITE_ENABLE_RTREE /DSQLITE_OMIT_BUILTIN_TEST /DSQLITE_OMIT_LOAD_EXTENSION /DSQLITE_DEFAULT_PAGE_SIZE=1024 /DSQLITE_DEFAULT_CACHE_SIZE=2000 /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_OS_WINRT %(AdditionalOptions) From aeda0733afec5434edb07844bc955cdcd9444630 Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Fri, 17 Mar 2017 00:25:47 +0100 Subject: [PATCH 10/29] General test fixes; minor doc fix --- README.md | 3 +- .../spec/basic-db-tx-sql-storage-results.js | 2 ++ spec/www/spec/db-tx-error-handling-test.js | 35 ++++++------------- spec/www/spec/db-tx-sql-select-value-test.js | 1 + spec/www/spec/db-tx-string-test.js | 2 +- 5 files changed, 15 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index a1d45015..7c3e25b9 100644 --- a/README.md +++ b/README.md @@ -130,8 +130,7 @@ See the [Sample section](#sample) for a sample with a more detailed explanation. - `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 -- A recent version of the Cordova CLI (such as `6.4.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.4.0` or `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`). - 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 options) or [litehelpers / Cordova-sqlite-legacy-build-support](https://github.com/litehelpers/Cordova-sqlite-legacy-build-support) (limited testing, limited updates) - The iOS database location is now mandatory, as documented below. - This version supports the use of two (2) possible Android sqlite database implementations: diff --git a/spec/www/spec/basic-db-tx-sql-storage-results.js b/spec/www/spec/basic-db-tx-sql-storage-results.js index 76ad66f1..996b5c14 100644 --- a/spec/www/spec/basic-db-tx-sql-storage-results.js +++ b/spec/www/spec/basic-db-tx-sql-storage-results.js @@ -772,6 +772,8 @@ var mytests = function() { describe(suiteName + 'STANDARD multi-row INSERT tests', function() { it(suiteName + 'INSERT multiple rows from with SELECT; check results & check stored data [rowsAffected INCORRECT with androidDatabaseImplementation: 2 (built-in android.database) setting]', function(done) { + // NOTE: This test also verifies litehelpers/Cordova-sqlite-storage#63 + // (insertId randomly "returns undefined" after an INSERT) is fixed. var db = openDatabase('INSERT-with-SELECT-test.db', '1.0', 'Test', DEFAULT_SIZE); db.transaction(function(tx) { diff --git a/spec/www/spec/db-tx-error-handling-test.js b/spec/www/spec/db-tx-error-handling-test.js index d40b35c8..8d51be26 100644 --- a/spec/www/spec/db-tx-error-handling-test.js +++ b/spec/www/spec/db-tx-error-handling-test.js @@ -1565,11 +1565,8 @@ var mytests = function() { }); }, function() { - // NOT EXPECTED by Web SQL, Android, or iOS: - if (isWindows) - expect(true).toBe(true); - else - expect(false).toBe(true); + // NOT EXPECTED: + expect(false).toBe(true); // Close (plugin only) & finish: (isWebSql) ? done() : db.close(done, done); }); @@ -1630,11 +1627,8 @@ var mytests = function() { }); }, function() { - // NOT EXPECTED by Web SQL, Android, or iOS: - if (isWindows) - expect(true).toBe(true); - else - expect(false).toBe(true); + // NOT EXPECTED: + expect(false).toBe(true); // Close (plugin only) & finish: (isWebSql) ? done() : db.close(done, done); }); @@ -1695,11 +1689,8 @@ var mytests = function() { }); }, function() { - // NOT EXPECTED by Web SQL, Android, or iOS: - if (isWindows) - expect(true).toBe(true); - else - expect(false).toBe(true); + // NOT EXPECTED: + expect(false).toBe(true); // Close (plugin only) & finish: (isWebSql) ? done() : db.close(done, done); }); @@ -1761,11 +1752,8 @@ var mytests = function() { }); }, function() { - // NOT EXPECTED by Web SQL, Android, or iOS: - if (isWindows) - expect(true).toBe(true); - else - expect(false).toBe(true); + // NOT EXPECTED: + expect(false).toBe(true); // Close (plugin only) & finish: (isWebSql) ? done() : db.close(done, done); }); @@ -1827,11 +1815,8 @@ var mytests = function() { }); }, function() { - // NOT EXPECTED by Web SQL, Android, or iOS: - if (isWindows) - expect(true).toBe(true); - else - expect(false).toBe(true); + // NOT EXPECTED: + expect(false).toBe(true); // Close (plugin only) & finish: (isWebSql) ? done() : db.close(done, done); }); diff --git a/spec/www/spec/db-tx-sql-select-value-test.js b/spec/www/spec/db-tx-sql-select-value-test.js index cbbdf1fe..5ae9eeed 100644 --- a/spec/www/spec/db-tx-sql-select-value-test.js +++ b/spec/www/spec/db-tx-sql-select-value-test.js @@ -1824,6 +1824,7 @@ var mytests = function() { it(suiteName + "SELECT X'FFD1FFD2' [TBD BROKEN androidDatabaseImplementation: 2 & Windows; missing result value iOS/macOS]", function(done) { if (isWP8) pending('SKIP for WP8'); + if (!isWebSql && !isWindows && isAndroid && !isImpl2) pending('BROKEN: CRASH on Android 5.x (default sqlite-connector version)'); var db = openDatabase("Inline-SELECT-BLOB-FFD1FFD2-result-test.db", "1.0", "Demo", DEFAULT_SIZE); diff --git a/spec/www/spec/db-tx-string-test.js b/spec/www/spec/db-tx-string-test.js index ccd00a54..1526eded 100755 --- a/spec/www/spec/db-tx-string-test.js +++ b/spec/www/spec/db-tx-string-test.js @@ -312,7 +312,7 @@ var mytests = function() { it(suiteName + "Inline BLOB with emoji string manipulation test: SELECT LOWER(X'41F09F9883') [A\uD83D\uDE03] [\\u1F603 SMILING FACE (MOUTH OPEN)]", function(done) { if (isWP8) pending('BROKEN for WP8'); - if (isAndroid && !isWebSql && !isImpl2) pending('BROKEN for Android (default sqlite-connector version)'); // CRASH on Android 5.x + if (!isWebSql && !isWindows && isAndroid && !isImpl2) pending('BROKEN: CRASH on Android 5.x (default sqlite-connector version)'); if (isWindows) pending('BROKEN for Windows'); var db = openDatabase("Inline-emoji-select-lower-result-test.db", "1.0", "Demo", DEFAULT_SIZE); From cb4665d492e5c4f25a67dd25acbd213b09cc0158 Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Fri, 17 Mar 2017 04:03:58 +0100 Subject: [PATCH 11/29] INSERT OR IGNORE test reproduce litehelpers/Cordova-sqlite-storage#650 --- README.md | 1 + .../spec/basic-db-tx-sql-storage-results.js | 59 +++++++++++++++++++ 2 files changed, 60 insertions(+) diff --git a/README.md b/README.md index 7c3e25b9..e43971ef 100644 --- a/README.md +++ b/README.md @@ -422,6 +422,7 @@ As "strongly recommended" by [Web SQL Database API 8.5 SQL injection](https://ww - In certain cases such as `transaction.executeSql()` with no arguments (Android/iOS WebKit) Web SQL includes includes a code member with value of 0 (SQLError.UNKNOWN_ERR) in the exception while the plugin includes no such code member. - If the SQL arguments are passed in an `Array` subclass object where the `constructor` does not point to `Array` then the SQL arguments are ignored by the plugin. - The results data objects are not immutable as specified/implied by [Web SQL API section 4.5](https://www.w3.org/TR/webdatabase/#database-query-results). +- In case of ignored INSERT OR IGNORE statement this plugin reports an old INSERT row id value on iOS/macOS. (WebKit Web SQL also reports an old INSERT row id value in case of an ignored INSERT OR IGNORE statement on Android and iOS.) ### Security of deleted data diff --git a/spec/www/spec/basic-db-tx-sql-storage-results.js b/spec/www/spec/basic-db-tx-sql-storage-results.js index 996b5c14..e47e39e3 100644 --- a/spec/www/spec/basic-db-tx-sql-storage-results.js +++ b/spec/www/spec/basic-db-tx-sql-storage-results.js @@ -7,6 +7,7 @@ var DEFAULT_SIZE = 5000000; // max to avoid popup in safari/ios var isWP8 = /IEMobile/.test(navigator.userAgent); // Matches WP(7/8/8.1) var isWindows = /Windows /.test(navigator.userAgent); // Windows var isAndroid = !isWindows && /Android/.test(navigator.userAgent); +var isMac = /Macintosh/.test(navigator.userAgent); // NOTE: In the core-master branch there is no difference between the default // implementation and implementation #2. But the test will also apply @@ -887,6 +888,64 @@ var mytests = function() { }); + it(suiteName + 'INSERT OR IGNORE result in case of constraint violation [iOS/macOS PLUGIN & Andriod/iOS WebKit Web SQL BROKEN: reports old insertId value]', function(done) { + var db = openDatabase('INSERT-OR-IGNORE-test.db', '1.0', 'Test', DEFAULT_SIZE); + + db.transaction(function(tx) { + tx.executeSql('DROP TABLE IF EXISTS tt;'); + + tx.executeSql('CREATE TABLE tt (data1 NUMERIC UNIQUE, data2 TEXT);'); + + tx.executeSql('INSERT OR IGNORE INTO tt VALUES (?,?)', [101,'Alice'], function(ignored, rs) { + // CORRECT RESULT EXPECTED: + expect(rs).toBeDefined(); + expect(rs.insertId).toBe(1); + expect(rs.rowsAffected).toBe(1); + }); + + var check1 = false; + tx.executeSql('INSERT OR IGNORE INTO tt VALUES (?,?)', [102,'Betty'], function(ignored, rs) { + // CORRECT RESULT EXPECTED: + expect(rs).toBeDefined(); + expect(rs.insertId).toBe(2); + expect(rs.rowsAffected).toBe(1); + check1 = true; + }); + + tx.executeSql('INSERT OR IGNORE INTO tt VALUES (?,?)', [102,'Carol'], function(ignored, rs1) { + expect(check1).toBe(true); + expect(rs1).toBeDefined(); + + // NOTE: According to https://www.w3.org/TR/webdatabase/#database-query-results (section 4.5) + // this access should really raise an INVALID_ACCESS_ERR exception. + var checkInsertId = rs1.insertId; + if (isWebSql || isMac || (!isWindows && !isAndroid)) + expect(checkInsertId).toBe(2); // BROKEN: OLD insertId value iOS/macOS plugin & Andriod/iOS WebKit Web SQL + else + expect(checkInsertId).toBe(undefined); + + expect(rs1.rowsAffected).toBe(0); + + tx.executeSql('SELECT COUNT(*) AS MyCount FROM tt', [], function(ignored, rs2) { + expect(rs2).toBeDefined(); + expect(rs2.rows).toBeDefined(); + expect(rs2.rows.length).toBe(1); + expect(rs2.rows.item(0).MyCount).toBe(2); + + // Close (plugin only - always the case in this test) & finish: + (isWebSql) ? done() : db.close(done, done); + }); + }); + }, function(e) { + // ERROR RESULT (NOT EXPECTED): + expect(false).toBe(true); + expect(e).toBeDefined(); + + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); + }); + }, MYTIMEOUT); + describe(suiteName + 'ALTER TABLE tests', function() { it(suiteName + 'ALTER TABLE ADD COLUMN test', function(done) { From c42ecb0635320144138de97cc22d25ad88fe2c6f Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Sun, 19 Mar 2017 17:14:18 +0100 Subject: [PATCH 12/29] Check sqlite version; string test fixes --- spec/www/index.html | 1 + spec/www/spec/db-tx-string-test.js | 187 +++++++++++++++++++++++---- spec/www/spec/sqlite-version-test.js | 93 +++++++++++++ 3 files changed, 258 insertions(+), 23 deletions(-) create mode 100755 spec/www/spec/sqlite-version-test.js diff --git a/spec/www/index.html b/spec/www/index.html index 6637533f..f286f7a1 100644 --- a/spec/www/index.html +++ b/spec/www/index.html @@ -21,6 +21,7 @@ + diff --git a/spec/www/spec/db-tx-string-test.js b/spec/www/spec/db-tx-string-test.js index 1526eded..7dda24c4 100755 --- a/spec/www/spec/db-tx-string-test.js +++ b/spec/www/spec/db-tx-string-test.js @@ -8,9 +8,10 @@ var isWP8 = /IEMobile/.test(navigator.userAgent); // Matches WP(7/8/8.1) var isWindows = /Windows /.test(navigator.userAgent); // Windows (8.1) var isAndroid = !isWindows && /Android/.test(navigator.userAgent); -// NOTE: In the common storage-master branch there is no difference between the -// default implementation and implementation #2. But the test will also apply -// the androidLockWorkaround: 1 option in the case of implementation #2. +// The following openDatabase settings are used for Plugin-implementation-2 +// on Android: +// - androidDatabaseImplementation: 2 +// - androidLockWorkaround: 1 var scenarioList = [ isAndroid ? 'Plugin-implementation-default' : 'Plugin', 'HTML5', @@ -29,15 +30,19 @@ var mytests = function() { var isWebSql = (i === 1); var isImpl2 = (i === 2); - // NOTE: MUST be defined in proper describe function scope, NOT outer scope: - var openDatabase = function(name, ignored1, ignored2, ignored3) { + // NOTE 1: MUST be defined in proper describe function scope, NOT outer scope. + // NOTE 2: Using same database name in this script to avoid issue with + // "Too many open files" on iOS with WKWebView engine plugin. + // (FUTURE TBD NEEDS INVESTIGATION) + var openDatabase = function(name_ignored, ignored1, ignored2, ignored3) { + var name = 'string-test.db'; if (isImpl2) { return window.sqlitePlugin.openDatabase({ // prevent reuse of database from default db implementation: name: 'i2-'+name, androidDatabaseImplementation: 2, androidLockWorkaround: 1, - iosDatabaseLocation: 'Documents' + location: 'default' }); } if (isWebSql) { @@ -57,12 +62,21 @@ var mytests = function() { db.transaction(function(tx) { expect(tx).toBeDefined(); - tx.executeSql("SELECT UPPER('Some US-ASCII text') AS uppertext", [], function(tx, res) { - expect(res.rows.item(0).uppertext).toBe("SOME US-ASCII TEXT"); + tx.executeSql("SELECT UPPER('Some US-ASCII text') AS uppertext", [], function(tx_ignored, rs) { + expect(rs).toBeDefined(); + expect(rs.rows).toBeDefined(); + expect(rs.rows.length).toBe(1); + expect(rs.rows.item(0).uppertext).toBe("SOME US-ASCII TEXT"); // Close (plugin only) & finish: (isWebSql) ? done() : db.close(done, done); }); + }, function(error) { + // NOT EXPECTED: + expect(false).toBe(true); + expect(error.message).toBe('--'); + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); }); }, MYTIMEOUT); @@ -74,12 +88,21 @@ var mytests = function() { db.transaction(function(tx) { expect(tx).toBeDefined(); - tx.executeSql("SELECT UPPER('Some US-ASCII text') AS uppertext", null, function(tx, res) { - expect(res.rows.item(0).uppertext).toBe("SOME US-ASCII TEXT"); + tx.executeSql("SELECT UPPER('Some US-ASCII text') AS uppertext", null, function(tx_ignored, rs) { + expect(rs).toBeDefined(); + expect(rs.rows).toBeDefined(); + expect(rs.rows.length).toBe(1); + expect(rs.rows.item(0).uppertext).toBe("SOME US-ASCII TEXT"); // Close (plugin only) & finish: (isWebSql) ? done() : db.close(done, done); }); + }, function(error) { + // NOT EXPECTED: + expect(false).toBe(true); + expect(error.message).toBe('--'); + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); }); }, MYTIMEOUT); @@ -91,12 +114,21 @@ var mytests = function() { db.transaction(function(tx) { expect(tx).toBeDefined(); - tx.executeSql("SELECT UPPER('Some US-ASCII text') AS uppertext", undefined, function(tx, res) { - expect(res.rows.item(0).uppertext).toBe("SOME US-ASCII TEXT"); + tx.executeSql("SELECT UPPER('Some US-ASCII text') AS uppertext", undefined, function(tx_ignored, rs) { + expect(rs).toBeDefined(); + expect(rs.rows).toBeDefined(); + expect(rs.rows.length).toBe(1); + expect(rs.rows.item(0).uppertext).toBe("SOME US-ASCII TEXT"); // Close (plugin only) & finish: (isWebSql) ? done() : db.close(done, done); }); + }, function(error) { + // NOT EXPECTED: + expect(false).toBe(true); + expect(error.message).toBe('--'); + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); }); }, MYTIMEOUT); @@ -104,12 +136,21 @@ var mytests = function() { var db = openDatabase("ASCII-string-binding-test.db", "1.0", "Demo", DEFAULT_SIZE); db.transaction(function(tx) { - tx.executeSql('SELECT UPPER(?) AS uppertext', ['Some US-ASCII text'], function(tx, res) { - expect(res.rows.item(0).uppertext).toBe("SOME US-ASCII TEXT"); + tx.executeSql('SELECT UPPER(?) AS uppertext', ['Some US-ASCII text'], function(tx_ignored, rs) { + expect(rs).toBeDefined(); + expect(rs.rows).toBeDefined(); + expect(rs.rows.length).toBe(1); + expect(rs.rows.item(0).uppertext).toBe("SOME US-ASCII TEXT"); // Close (plugin only) & finish: (isWebSql) ? done() : db.close(done, done); }); + }, function(error) { + // NOT EXPECTED: + expect(false).toBe(true); + expect(error.message).toBe('--'); + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); }); }, MYTIMEOUT); @@ -119,12 +160,21 @@ var mytests = function() { db.transaction(function(tx) { expect(tx).toBeDefined(); - tx.executeSql(new String("SELECT UPPER('Some US-ASCII text') AS uppertext"), [], function(tx, res) { - expect(res.rows.item(0).uppertext).toBe("SOME US-ASCII TEXT"); + tx.executeSql(new String("SELECT UPPER('Some US-ASCII text') AS uppertext"), [], function(tx_ignored, rs) { + expect(rs).toBeDefined(); + expect(rs.rows).toBeDefined(); + expect(rs.rows.length).toBe(1); + expect(rs.rows.item(0).uppertext).toBe("SOME US-ASCII TEXT"); // Close (plugin only) & finish: (isWebSql) ? done() : db.close(done, done); }); + }, function(error) { + // NOT EXPECTED: + expect(false).toBe(true); + expect(error.message).toBe('--'); + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); }); }, MYTIMEOUT); @@ -486,6 +536,9 @@ var mytests = function() { db.transaction(function(tx) { tx.executeSql('SELECT UPPER(?) AS upper_result', ['Test ¢ é €'], function(ignored, rs) { + expect(rs).toBeDefined(); + expect(rs.rows).toBeDefined(); + expect(rs.rows.length).toBe(1); if (isAndroid && (isWebSql || (isImpl2 && /Android [5-9]/.test(navigator.userAgent)))) expect(rs.rows.item(0).upper_result).toBe('TEST ¢ É €'); else @@ -494,6 +547,12 @@ var mytests = function() { // Close (plugin only) & finish: (isWebSql) ? done() : db.close(done, done); }); + }, function(error) { + // NOT EXPECTED: + expect(false).toBe(true); + expect(error.message).toBe('--'); + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); }); }, MYTIMEOUT); @@ -516,26 +575,44 @@ var mytests = function() { db.transaction(function(tx) { - tx.executeSql('SELECT UPPER(?) AS upper_result', ['"String" test'], function(ignored, rs) { - expect(rs.rows.item(0).upper_result).toBe('"STRING" TEST'); + tx.executeSql('SELECT UPPER(?) AS upper_result', ['"String" test'], function(tx_ignored, rs1) { + expect(rs1).toBeDefined(); + expect(rs1.rows).toBeDefined(); + expect(rs1.rows.length).toBe(1); + expect(rs1.rows.item(0).upper_result).toBe('"STRING" TEST'); // Close (plugin only) & finish: (isWebSql) ? done() : db.close(done, done); }); + }, function(error) { + // NOT EXPECTED: + expect(false).toBe(true); + expect(error.message).toBe('--'); + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); }); }, MYTIMEOUT); - it(suiteName + 'Backslash string test', function(done) { - var db = openDatabase("Backslash-string-test.db", "1.0", "Demo", DEFAULT_SIZE); + it(suiteName + 'INLINE Backslash string test', function(done) { + var db = openDatabase("INLINE-Backslash-string-test.db", "1.0", "Demo", DEFAULT_SIZE); db.transaction(function(tx) { tx.executeSql("SELECT UPPER('Test \\') AS upper_result", [], function(ignored, rs) { + expect(rs).toBeDefined(); + expect(rs.rows).toBeDefined(); + expect(rs.rows.length).toBe(1); expect(rs.rows.item(0).upper_result).toBe('TEST \\'); // Close (plugin only) & finish: (isWebSql) ? done() : db.close(done, done); }); + }, function(error) { + // NOT EXPECTED: + expect(false).toBe(true); + expect(error.message).toBe('--'); + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); }); }, MYTIMEOUT); @@ -544,12 +621,22 @@ var mytests = function() { db.transaction(function(tx) { - tx.executeSql('SELECT UPPER(?) AS upper_result', ['Test \\'], function(ignored, rs) { - expect(rs.rows.item(0).upper_result).toBe('TEST \\'); + tx.executeSql('SELECT UPPER(?) AS upper_result', ['Test \\'], function(tx_ignored, rs1) { + expect(rs1).toBeDefined(); + expect(rs1.rows).toBeDefined(); + expect(rs1.rows.length).toBe(1); + expect(rs1.rows.item(0).upper_result).toBe('TEST \\'); + // Close (plugin only) & finish: (isWebSql) ? done() : db.close(done, done); }); + }, function(error) { + // NOT EXPECTED: + expect(false).toBe(true); + expect(error.message).toBe('--'); + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); }); }, MYTIMEOUT); @@ -563,11 +650,20 @@ var mytests = function() { db.transaction(function(tx) { tx.executeSql('SELECT UPPER(?) AS upper_result', [['Test',null,123.456,789]], function(ignored, rs) { + expect(rs).toBeDefined(); + expect(rs.rows).toBeDefined(); + expect(rs.rows.length).toBe(1); expect(rs.rows.item(0).upper_result).toBe('TEST,,123.456,789'); // Close (plugin only) & finish: (isWebSql) ? done() : db.close(done, done); }); + }, function(error) { + // NOT EXPECTED: + expect(false).toBe(true); + expect(error.message).toBe('--'); + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); }); }, MYTIMEOUT); @@ -577,11 +673,20 @@ var mytests = function() { db.transaction(function(tx) { tx.executeSql('SELECT UPPER(?) AS upper_result', [new String('Test value')], function(ignored, rs) { + expect(rs).toBeDefined(); + expect(rs.rows).toBeDefined(); + expect(rs.rows.length).toBe(1); expect(rs.rows.item(0).upper_result).toBe('TEST VALUE'); // Close (plugin only) & finish: (isWebSql) ? done() : db.close(done, done); }); + }, function(error) { + // NOT EXPECTED: + expect(false).toBe(true); + expect(error.message).toBe('--'); + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); }); }, MYTIMEOUT); @@ -601,11 +706,20 @@ var mytests = function() { db.transaction(function(tx) { tx.executeSql('SELECT UPPER(?) AS upper_result', [myObject], function(ignored, rs) { + expect(rs).toBeDefined(); + expect(rs.rows).toBeDefined(); + expect(rs.rows.length).toBe(1); expect(rs.rows.item(0).upper_result).toBe('TOSTRING RESULT'); // Close (plugin only) & finish: (isWebSql) ? done() : db.close(done, done); }); + }, function(error) { + // NOT EXPECTED: + expect(false).toBe(true); + expect(error.message).toBe('--'); + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); }); }, MYTIMEOUT); }); @@ -772,13 +886,19 @@ var mytests = function() { (isWebSql) ? done() : db.close(done, done); }); myObject.name = 'Carol'; + + }, function(error) { + // NOT EXPECTED: + expect(false).toBe(true); + expect(error.message).toBe('--'); + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); }); }, MYTIMEOUT); }); describe(suiteName + 'string test with Array "subclass" for SQL parameter arg values array', function() { - ; it(suiteName + 'SELECT UPPER(?) AS upper1, UPPER(?) AS upper2 with "naive" Array subclass (constructor NOT explicitly set) as value arguments array', function(done) { var db = openDatabase('SELECT-multi-upper-on-array-subclass.db'); expect(db).toBeDefined(); @@ -800,6 +920,7 @@ var mytests = function() { db.transaction(function(tx) { tx.executeSql('SELECT UPPER(?) AS upper1, UPPER(?) AS upper2', myObject, function(ignored, rs) { + // EXPECTED RESULT: expect(rs).toBeDefined(); expect(rs.rows).toBeDefined(); expect(rs.rows.length).toBe(1); @@ -838,6 +959,7 @@ var mytests = function() { db.transaction(function(tx) { tx.executeSql('SELECT UPPER(?) AS upper1, UPPER(?) AS upper2', myObject, function(ignored, rs) { + // EXPECTED RESULT: expect(rs).toBeDefined(); expect(rs.rows).toBeDefined(); expect(rs.rows.length).toBe(1); @@ -937,6 +1059,9 @@ var mytests = function() { db.transaction(function(tx) { tx.executeSql('SELECT UPPER(?) AS uppertext', ['Some US-ASCII text'], function success(ignored, rs) { + expect(rs).toBeDefined(); + expect(rs.rows).toBeDefined(); + expect(rs.rows.length).toBe(1); expect(rs.rows.item(0).uppertext).toBe("SOME US-ASCII TEXT"); // Close (plugin only) & finish: @@ -960,6 +1085,9 @@ var mytests = function() { db.readTransaction(function(tx) { tx.executeSql('SELECT UPPER(?) AS uppertext', ['Some US-ASCII text'], function success(ignored, rs) { + expect(rs).toBeDefined(); + expect(rs.rows).toBeDefined(); + expect(rs.rows.length).toBe(1); expect(rs.rows.item(0).uppertext).toBe("SOME US-ASCII TEXT"); // Close (plugin only) & finish: @@ -987,6 +1115,9 @@ var mytests = function() { tx.executeSql("SELECT UPPER('Some US-ASCII text') AS uppertext", null, function(ignored, rs) { check1 = true; + expect(rs).toBeDefined(); + expect(rs.rows).toBeDefined(); + expect(rs.rows.length).toBe(1); expect(rs.rows.item(0).uppertext).toBe("SOME US-ASCII TEXT"); }); }, function error(error) { @@ -1015,6 +1146,9 @@ var mytests = function() { tx.executeSql("SELECT UPPER('Some US-ASCII text') AS uppertext", null, function(ignored, rs) { check1 = true; + expect(rs).toBeDefined(); + expect(rs.rows).toBeDefined(); + expect(rs.rows.length).toBe(1); expect(rs.rows.item(0).uppertext).toBe("SOME US-ASCII TEXT"); }); }, function error(error) { @@ -1052,6 +1186,13 @@ var mytests = function() { // Close (plugin only) & finish: (isWebSql) ? done() : db.close(done, done); }); + + }, function(error) { + // NOT EXPECTED: + expect(false).toBe(true); + expect(error.message).toBe('--'); + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); }); }, MYTIMEOUT); diff --git a/spec/www/spec/sqlite-version-test.js b/spec/www/spec/sqlite-version-test.js new file mode 100755 index 00000000..4c27e312 --- /dev/null +++ b/spec/www/spec/sqlite-version-test.js @@ -0,0 +1,93 @@ +/* 'use strict'; */ + +var MYTIMEOUT = 12000; + +var DEFAULT_SIZE = 5000000; // max to avoid popup in safari/ios + +var isWP8 = /IEMobile/.test(navigator.userAgent); // Matches WP(7/8/8.1) +var isWindows = /Windows /.test(navigator.userAgent); // Windows (8.1) +var isAndroid = !isWindows && /Android/.test(navigator.userAgent); + +// The following openDatabase settings are used for Plugin-implementation-2 +// on Android: +// - androidDatabaseImplementation: 2 +// - androidLockWorkaround: 1 +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 Date: Tue, 21 Mar 2017 18:10:54 +0100 Subject: [PATCH 13/29] Check db encoding; check string HEX values; other string test fixes --- README.md | 5 +- spec/www/spec/db-tx-string-test.js | 679 ++++++++++++++++++--- spec/www/spec/db-tx-value-bindings-test.js | 474 ++++++++------ spec/www/spec/sqlite-version-test.js | 30 + 4 files changed, 905 insertions(+), 283 deletions(-) diff --git a/README.md b/README.md index e43971ef..5596a8ce 100644 --- a/README.md +++ b/README.md @@ -143,13 +143,14 @@ See the [Sample section](#sample) for a sample with a more detailed explanation. - Pre-populated database (Android/iOS/macOS/Windows) - Amazon Fire-OS is dropped due to lack of support by Cordova. Android version should be used to deploy to Fire-OS 5.0(+) devices. For reference: [cordova/cordova-discuss#32 (comment)](https://github.com/cordova/cordova-discuss/issues/32#issuecomment-167021676) - Windows version (using a customized version of the performant [doo / SQLite3-WinRT](https://github.com/doo/SQLite3-WinRT) C++ component) has the following known limitations: - - Issue with UNICODE `\u0000` character (same as `\0`) + - Truncation issue with UNICODE `\u0000` character (same as `\0`) - No background processing - INCORRECT error code (0) and INCONSISTENT error message (missing actual error info) in error callbacks ref: [litehelpers/Cordova-sqlite-storage#539](https://github.com/litehelpers/Cordova-sqlite-storage/issues/539) - Issue with emojis and other 4-octet UTF-8 characters (apparently not stored correctly) ref: [litehelpers/Cordova-sqlite-storage#564](https://github.com/litehelpers/Cordova-sqlite-storage/issues/564) - Not possible to read BLOB column values - It is **not** possible to use this plugin with the default "Any CPU" target. A specific target CPU type **must** be specified when building an app with this plugin. - This version branch with dependency on platform toolset libraries included by Visual Studio 2015 ref: [litehelpers/Cordova-sqlite-storage#580](https://github.com/litehelpers/Cordova-sqlite-storage/issues/580) + - Windows version uses `UTF-16le` internal database encoding while the other platform versions use `UTF-8` internal encoding. (`UTF-8` internal encoding is preferred ref: [litehelpers/Cordova-sqlite-storage#652](https://github.com/litehelpers/Cordova-sqlite-storage/issues/652)) - macOS version ("osx" platform) has not been tested in a release build and should be considered pre-alpha. - FTS3, FTS4, and R-Tree support is tested working OK in this version (for all target platforms in this version branch Android/iOS/macOS/Windows) - Android is supported back to SDK 10 (a.k.a. Gingerbread, Android 2.3.3); support for older versions is available upon request. @@ -470,7 +471,7 @@ Some more known issues are tracked in the [open Cordova-sqlite-storage bugs](htt - SQL error messages on Windows version are not consistent with Android/iOS/macOS versions. - UNICODE `\u2028` (line separator) and `\u2029` (paragraph separator) characters are currently not supported and known to be broken in iOS, macOS, and Android version due to JSON issues reported in [Cordova bug CB-9435](https://issues.apache.org/jira/browse/CB-9435) and [cordova/cordova-discuss#57](https://github.com/cordova/cordova-discuss/issues/57). There *may* be a similar issue with certain other UNICODE characters in the iOS/macOS version (needs further investigation). This is fixed for iOS in: [litehelpers / Cordova-sqlite-evplus-legacy-free](https://github.com/litehelpers/Cordova-sqlite-evplus-legacy-free) and [litehelpers / Cordova-sqlite-evplus-legacy-attach-detach-free](https://github.com/litehelpers/Cordova-sqlite-evplus-legacy-attach-detach-free) (available with GPL or special commercial license options) as well as [litehelpers / Cordova-sqlite-evplus-legacy-workers-free](https://github.com/litehelpers/Cordova-sqlite-evplus-legacy-workers-free) (available with GPL or premium commercial license options) - BLOB type is not supported in this version branch (*reading* of BLOBs is supported by [litehelpers / cordova-sqlite-ext](https://github.com/litehelpers/cordova-sqlite-ext) for Android/iOS) -- UNICODE `\u0000` (same as `\0`) character not working in Android (default Android-sqlite-connector database implentation) or Windows +- Truncation in case of UNICODE `\u0000` (same as `\0`) character on Android (default Android-sqlite-connector database implementation) and Windows - 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. - iOS/macOS version uses a thread pool but with only one thread working at a time due to "synchronized" database access - Large query result can be slow, also due to JSON implementation diff --git a/spec/www/spec/db-tx-string-test.js b/spec/www/spec/db-tx-string-test.js index 7dda24c4..64401321 100755 --- a/spec/www/spec/db-tx-string-test.js +++ b/spec/www/spec/db-tx-string-test.js @@ -52,7 +52,7 @@ var mytests = function() { } } - describe(suiteName + 'basic string binding/manipulation tests', function() { + describe(suiteName + 'Basic US-ASCII string binding/manipulation tests [default sqlite encoding: UTF-16le on Windows; UTF-8 on others]', function() { it(suiteName + 'Inline US-ASCII String manipulation test with empty ([]) parameter list', function(done) { var db = openDatabase("Inline-US-ASCII-string-test-with-empty-parameter-list.db", "1.0", "Demo", DEFAULT_SIZE); @@ -154,6 +154,58 @@ var mytests = function() { }); }, MYTIMEOUT); + it(suiteName + 'US-ASCII String HEX parameter value test ("Test 123")', function(done) { + var db = openDatabase("ASCII-String-hex-value-test.db", "1.0", "Demo", DEFAULT_SIZE); + + db.transaction(function(tx) { + + tx.executeSql('SELECT HEX(?) AS myresult', ['Test 123'], function(ignored, rs) { + expect(rs).toBeDefined(); + expect(rs.rows).toBeDefined(); + expect(rs.rows.length).toBe(1); + if (isWindows) + expect(rs.rows.item(0).myresult).toBe('54006500730074002000310032003300'); // (UTF-16le) + else + expect(rs.rows.item(0).myresult).toBe('5465737420313233'); // (UTF-8) + + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); + }); + }, function(error) { + // NOT EXPECTED: + expect(false).toBe(true); + expect(error.message).toBe('--'); + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); + }); + }, MYTIMEOUT); + + it(suiteName + 'US-ASCII String HEX parameter value test ("Test 123")', function(done) { + var db = openDatabase("ASCII-String-hex-value-test.db", "1.0", "Demo", DEFAULT_SIZE); + + db.transaction(function(tx) { + + tx.executeSql('SELECT HEX(?) AS myresult', ['Test 123'], function(ignored, rs) { + expect(rs).toBeDefined(); + expect(rs.rows).toBeDefined(); + expect(rs.rows.length).toBe(1); + if (isWindows) + expect(rs.rows.item(0).myresult).toBe('54006500730074002000310032003300'); // (UTF-16le) + else + expect(rs.rows.item(0).myresult).toBe('5465737420313233'); // (UTF-8) + + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); + }); + }, function(error) { + // NOT EXPECTED: + expect(false).toBe(true); + expect(error.message).toBe('--'); + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); + }); + }, MYTIMEOUT); + it(suiteName + 'tx.executeSql(new String(sql))', function(done) { var db = openDatabase("tx-executeSql-new-String-test.db", "1.0", "Demo", DEFAULT_SIZE); @@ -178,35 +230,107 @@ var mytests = function() { }); }, MYTIMEOUT); - it(suiteName + 'String encoding test with UNICODE \\u0000', function (done) { - if (isWP8) pending('BROKEN for WP(8)'); // [BUG #202] UNICODE characters not working with WP(8) - if (isWindows) pending('BROKEN for Windows'); // [FUTURE TBD, already documented] - if (!isWebSql && isAndroid && !isImpl2) pending('BROKEN for Android (default sqlite-connector version)'); // [FUTURE TBD (documented)] - - var dbName = "Unicode-hex-test"; - var db = openDatabase(dbName, "1.0", "Demo", DEFAULT_SIZE); + it(suiteName + 'String HEX encoding test with \\0 (null) character [TRUNCATION BUG on Windows; HEX encoding BUG on Android-sqlite-connector]', function (done) { + var db = openDatabase('text-string-with-null-character-test.db'); db.transaction(function (tx) { - tx.executeSql('SELECT HEX("foob") AS hexvalue', [], function (tx, res) { - console.log(suiteName + "res.rows.item(0).hexvalue: " + res.rows.item(0).hexvalue); + tx.executeSql('SELECT HEX(?) AS hexvalue', ['abcd'], function (tx_ignored, rs) { + expect(rs).toBeDefined(); + expect(rs.rows).toBeDefined(); + expect(rs.rows.length).toBe(1); - var expected_hexvalue_length = res.rows.item(0).hexvalue.length; + // NOTE: WebKit Web SQL on recent versions of Android & iOS + // seems to use follow UTF-8 encoding/decoding rules. - tx.executeSql('SELECT HEX(?) AS hexvalue', ['\u0000foo'], function (tx, res) { - //console.log(suiteName + "res.rows.item(0).hexvalue: " + res.rows.item(0).hexvalue); + if (isWindows) + expect(rs.rows.item(0).hexvalue).toBe('6100620063006400'); // (UTF16-le) + else + expect(rs.rows.item(0).hexvalue).toBe('61626364'); // (UTF-8) + + var expected_hexvalue_length = rs.rows.item(0).hexvalue.length; + if (!isWindows) + expect(expected_hexvalue_length).toBe(8); + + tx.executeSql('SELECT HEX(?) AS hexvalue', ['a\0cd'], function (tx_ignored, rs2) { + expect(rs2).toBeDefined(); + expect(rs2.rows).toBeDefined(); + expect(rs2.rows.length).toBe(1); + expect(rs2.rows.item(0).hexvalue).toBeDefined(); + + // STOP HERE [HEX encoding BUG] for Android-sqlite-connector: + if (!isWebSql && !isWindows && isAndroid && !isImpl2) return done(); + + var hexvalue = rs2.rows.item(0).hexvalue; + if (isWindows) + expect(hexvalue).toBe('6100'); // (UTF16-le with TRUNCATION BUG) + else if (!isWebSql && isAndroid && !isImpl2) + expect(hexvalue).toBe('--'); // (UTF-8 with TRUNCATION BUG) + else + expect(hexvalue).toBe('61006364'); // (UTF-8) + + // extra check: + // ensure this matches our expectation of that database's + // default encoding + if (!isWindows) + expect(hexvalue.length).toBe(expected_hexvalue_length); - expect(res.rows.length).toBe(1); - expect(res.rows.item(0).hexvalue).toBeDefined(); + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); + }); - var hexvalue = res.rows.item(0).hexvalue; + }); + }, function(err) { + // NOT EXPECTED: + expect(false).toBe(true); + expect(JSON.stringify(err)).toBe('--'); + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); + }); + }, MYTIMEOUT); - // varies between Chrome-like (UTF-8) - // and Safari-like (UTF-16) - expect(['000066006F006F00', '00666F6F'].indexOf(hexvalue)).not.toBe(-1); + it(suiteName + 'String encoding test with UNICODE \\u0000 (same as \\0) [TRUNCATION BUG on Windows; HEX encoding BUG on Android-sqlite-connector]', function (done) { + var db = openDatabase('UNICODE-0000-hex-test.db'); + db.transaction(function (tx) { + tx.executeSql('SELECT HEX("efgh") AS hexvalue', [], function (tx_ignored, rs) { + expect(rs).toBeDefined(); + expect(rs.rows).toBeDefined(); + expect(rs.rows.length).toBe(1); + + // NOTE: WebKit Web SQL on recent versions of Android & iOS + // seems to use follow UTF-8 encoding/decoding rules. + + if (isWindows) + expect(rs.rows.item(0).hexvalue).toBe('6500660067006800'); // )UTF-16le) + else + expect(rs.rows.item(0).hexvalue).toBe('65666768'); // (UTF-8) + + var expected_hexvalue_length = rs.rows.item(0).hexvalue.length; + if (!isWindows) + expect(expected_hexvalue_length).toBe(8); + + tx.executeSql('SELECT HEX(?) AS hexvalue', ['e\u0000gh'], function (tx_ignored, rs2) { + expect(rs2).toBeDefined(); + expect(rs2.rows).toBeDefined(); + expect(rs2.rows.length).toBe(1); + expect(rs2.rows.item(0).hexvalue).toBeDefined(); + + // STOP HERE [HEX encoding BUG] for Android-sqlite-connector: + if (!isWebSql && !isWindows && isAndroid && !isImpl2) return done(); + + var hexvalue = rs2.rows.item(0).hexvalue; + if (isWindows) + expect(hexvalue).toBe('6500'); // (UTF-16le with TRUNCATION BUG) + else if (!isWebSql && isAndroid && !isImpl2) + expect(hexvalue).toBe('--'); // (UTF-8 with TRUNCATION BUG) + else + expect(hexvalue).toBe('65006768'); // (UTF-8) + + // extra check: // ensure this matches our expectation of that database's // default encoding - expect(hexvalue.length).toBe(expected_hexvalue_length); + if (!isWindows) + expect(hexvalue.length).toBe(expected_hexvalue_length); // Close (plugin only) & finish: (isWebSql) ? done() : db.close(done, done); @@ -222,46 +346,99 @@ var mytests = function() { }); }, MYTIMEOUT); - it(suiteName + "CR-LF String test", function(done) { - var db = openDatabase("CR-LF-String-test.db", "1.0", "Demo", DEFAULT_SIZE); + it(suiteName + "INLINE CR-LF String test", function(done) { + var db = openDatabase("Inline-CR-LF-String-test.db", "1.0", "Demo", DEFAULT_SIZE); expect(db).toBeDefined(); db.transaction(function(tx) { expect(tx).toBeDefined(); - tx.executeSql("SELECT UPPER('cr\r\nlf') AS uppertext", [], function(tx, res) { - expect(res.rows.item(0).uppertext).not.toBe("CR\nLF"); // CR-LF should not be converted to \\n - expect(res.rows.item(0).uppertext).toBe("CR\r\nLF"); // Check CR-LF OK - tx.executeSql("SELECT UPPER('Carriage\rReturn') AS uppertext", [], function(tx, res) { - expect(res.rows.item(0).uppertext).toBe("CARRIAGE\rRETURN"); // Check CR OK - tx.executeSql("SELECT UPPER('New\nLine') AS uppertext", [], function(tx, res) { - expect(res.rows.item(0).uppertext).toBe("NEW\nLINE"); // CHECK newline OK - - // Close (plugin only) & finish: - (isWebSql) ? done() : db.close(done, done); + tx.executeSql("SELECT UPPER('cr\r\nlf') AS uppertext", [], function(tx_ignored, rs1) { + // Check INLINE string result: + expect(rs1).toBeDefined(); + expect(rs1.rows).toBeDefined(); + expect(rs1.rows.length).toBe(1); + expect(rs1.rows.item(0).uppertext).not.toBe("CR\nLF"); // CR-LF should not be converted to \\n + expect(rs1.rows.item(0).uppertext).toBe("CR\r\nLF"); // Check CR-LF OK + + tx.executeSql("SELECT UPPER('Carriage\rReturn') AS uppertext", [], function(tx_ignored, rs2) { + // Check INLINE string result: + expect(rs2).toBeDefined(); + expect(rs2.rows).toBeDefined(); + expect(rs2.rows.length).toBe(1); + expect(rs2.rows.item(0).uppertext).toBe("CARRIAGE\rRETURN"); // Check CR OK + + tx.executeSql("SELECT UPPER('New\nLine') AS uppertext", [], function(tx_ignored, rs3) { + // Check INLINE string result: + expect(rs3).toBeDefined(); + expect(rs3.rows).toBeDefined(); + expect(rs3.rows.length).toBe(1); + expect(rs3.rows.item(0).uppertext).toBe("NEW\nLINE"); // CHECK newline OK + + // Check value binding & HEX result: + tx.executeSql("SELECT HEX(?) AS myResult", ['1\r2\n3\r\n4'], function(tx_ignored, rs4) { + expect(rs4).toBeDefined(); + expect(rs4.rows).toBeDefined(); + expect(rs4.rows.length).toBe(1); + if (isWindows) + expect(rs4.rows.item(0).myResult).toBe('31000D0032000A0033000D000A003400'); // (UTF-16le) + else + expect(rs4.rows.item(0).myResult).toBe('310D320A330D0A34'); + + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); + }); }); }); }); + }, function(error) { + // NOT EXPECTED: + expect(false).toBe(true); + expect(error.message).toBe('--'); + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); }); }, MYTIMEOUT); - it(suiteName + "String tab test", function(done) { - var db = openDatabase("String-tab-test.db", "1.0", "Demo", DEFAULT_SIZE); + it(suiteName + "INLINE string tab test", function(done) { + var db = openDatabase("Inline-string-tab-test.db", "1.0", "Demo", DEFAULT_SIZE); expect(db).toBeDefined(); db.transaction(function(tx) { expect(tx).toBeDefined(); - tx.executeSql("SELECT UPPER('first\tsecond') AS uppertext", [], function(tx, res) { - expect(res.rows.item(0).uppertext).toBe('FIRST\tSECOND'); + tx.executeSql("SELECT UPPER('first\tsecond') AS uppertext", [], function(tx_ignored, rs1) { + // Check INLINE string result: + expect(rs1).toBeDefined(); + expect(rs1.rows).toBeDefined(); + expect(rs1.rows.length).toBe(1); + expect(rs1.rows.item(0).uppertext).toBe('FIRST\tSECOND'); + + // Check value binding & HEX result: + tx.executeSql("SELECT HEX(?) AS myResult", ['A\t1'], function(tx_ignored, rs2) { + expect(rs2).toBeDefined(); + expect(rs2.rows).toBeDefined(); + expect(rs2.rows.length).toBe(1); + if (isWindows) + expect(rs2.rows.item(0).myResult).toBe('410009003100'); // (UTF-16le) + else + expect(rs2.rows.item(0).myResult).toBe('410931'); + + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); + }); - // Close (plugin only) & finish: - (isWebSql) ? done() : db.close(done, done); }); + }, function(error) { + // NOT EXPECTED: + expect(false).toBe(true); + expect(error.message).toBe('--'); + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); }); }, MYTIMEOUT); - it(suiteName + "String vertical tab test", function(done) { + it(suiteName + "INLINE string vertical tab test", function(done) { if (isWP8) pending('BROKEN for WP(8)'); // [BUG #202] UNICODE characters not working with WP(8) var db = openDatabase("String-vertical-tab-test.db", "1.0", "Demo", DEFAULT_SIZE); @@ -270,16 +447,38 @@ var mytests = function() { db.transaction(function(tx) { expect(tx).toBeDefined(); - tx.executeSql("SELECT UPPER('first\vsecond') AS uppertext", [], function(tx, res) { - expect(res.rows.item(0).uppertext).toBe('FIRST\vSECOND'); + tx.executeSql("SELECT UPPER('first\vsecond') AS uppertext", [], function(tx_ignored, rs1) { + // Check INLINE string result: + expect(rs1).toBeDefined(); + expect(rs1.rows).toBeDefined(); + expect(rs1.rows.length).toBe(1); + expect(rs1.rows.item(0).uppertext).toBe('FIRST\vSECOND'); + + // Check value binding & HEX result: + tx.executeSql("SELECT HEX(?) AS myResult", ['A\v1'], function(tx_ignored, rs2) { + expect(rs2).toBeDefined(); + expect(rs2.rows).toBeDefined(); + expect(rs2.rows.length).toBe(1); + if (isWindows) + expect(rs2.rows.item(0).myResult).toBe('41000B003100'); // (UTF-16le) + else + expect(rs2.rows.item(0).myResult).toBe('410B31'); + + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); + }); - // Close (plugin only) & finish: - (isWebSql) ? done() : db.close(done, done); }); + }, function(error) { + // NOT EXPECTED: + expect(false).toBe(true); + expect(error.message).toBe('--'); + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); }); }, MYTIMEOUT); - it(suiteName + "String form feed test", function(done) { + it(suiteName + "INLINE string form feed test", function(done) { if (isWP8) pending('BROKEN for WP(8)'); // [BUG #202] UNICODE characters not working with WP(8) var db = openDatabase("String-form-feed-test.db", "1.0", "Demo", DEFAULT_SIZE); @@ -288,16 +487,38 @@ var mytests = function() { db.transaction(function(tx) { expect(tx).toBeDefined(); - tx.executeSql("SELECT UPPER('first\fsecond') AS uppertext", [], function(tx, res) { - expect(res.rows.item(0).uppertext).toBe('FIRST\fSECOND'); + tx.executeSql("SELECT UPPER('first\fsecond') AS uppertext", [], function(tx_ignored, rs1) { + // Check INLINE string result: + expect(rs1).toBeDefined(); + expect(rs1.rows).toBeDefined(); + expect(rs1.rows.length).toBe(1); + expect(rs1.rows.item(0).uppertext).toBe('FIRST\fSECOND'); + + // Check value binding & HEX result: + tx.executeSql("SELECT HEX(?) AS myResult", ['A\f1'], function(tx_ignored, rs2) { + expect(rs2).toBeDefined(); + expect(rs2.rows).toBeDefined(); + expect(rs2.rows.length).toBe(1); + if (isWindows) + expect(rs2.rows.item(0).myResult).toBe('41000C003100'); // (UTF-16le) + else + expect(rs2.rows.item(0).myResult).toBe('410C31'); + + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); + }); - // Close (plugin only) & finish: - (isWebSql) ? done() : db.close(done, done); }); + }, function(error) { + // NOT EXPECTED: + expect(false).toBe(true); + expect(error.message).toBe('--'); + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); }); }, MYTIMEOUT); - it(suiteName + "String backspace test", function(done) { + it(suiteName + "INLINE string backspace test", function(done) { if (isWP8) pending('BROKEN for WP(8)'); // [BUG #202] UNICODE characters not working with WP(8) var db = openDatabase("String-backspace-test.db", "1.0", "Demo", DEFAULT_SIZE); @@ -306,23 +527,153 @@ var mytests = function() { db.transaction(function(tx) { expect(tx).toBeDefined(); - tx.executeSql("SELECT UPPER('first\bsecond') AS uppertext", [], function(tx, res) { - expect(res.rows.item(0).uppertext).toBe('FIRST\bSECOND'); + tx.executeSql("SELECT UPPER('first\bsecond') AS uppertext", [], function(tx_ignored, rs1) { + // Check INLINE string result: + expect(rs1).toBeDefined(); + expect(rs1.rows).toBeDefined(); + expect(rs1.rows.length).toBe(1); + expect(rs1.rows.item(0).uppertext).toBe('FIRST\bSECOND'); + + // Check value binding & HEX result: + tx.executeSql("SELECT HEX(?) AS myResult", ['A\b1'], function(tx_ignored, rs2) { + expect(rs2).toBeDefined(); + expect(rs2.rows).toBeDefined(); + expect(rs2.rows.length).toBe(1); + if (isWindows) + expect(rs2.rows.item(0).myResult).toBe('410008003100'); // (UTF-16le) + else + expect(rs2.rows.item(0).myResult).toBe('410831'); + + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); + }); + }); + }, function(error) { + // NOT EXPECTED: + expect(false).toBe(true); + expect(error.message).toBe('--'); + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); + }); + }, MYTIMEOUT); + + }); + + describe(suiteName + 'UTF-8 multiple octet character string binding/manipulation tests [default sqlite encoding: UTF-16le on Windows, UTF-8 encoding on others]', function() { + + it(suiteName + 'string HEX parameter value test with UTF-8 2-octet character é', function(done) { + var db = openDatabase("UTF8-2-octet-hex-value-test.db", "1.0", "Demo", DEFAULT_SIZE); + + db.transaction(function(tx) { + + tx.executeSql('SELECT HEX(?) AS myresult', ['1é'], function(ignored, rs) { + expect(rs).toBeDefined(); + expect(rs.rows).toBeDefined(); + expect(rs.rows.length).toBe(1); + if (isWindows) + expect(rs.rows.item(0).myresult).toBe('3100E900'); // (UTF-16le) + else + expect(rs.rows.item(0).myresult).toBe('31C3A9'); // (UTF-8) + + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); + }); + }, function(error) { + // NOT EXPECTED: + expect(false).toBe(true); + expect(error.message).toBe('--'); + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); + }); + }, MYTIMEOUT); + + it(suiteName + 'string parameter value manipulation test with UTF-8 2-octet character é', function(done) { + var db = openDatabase("UTF8-2-octet-upper-value-string-test.db", "1.0", "Demo", DEFAULT_SIZE); + + db.transaction(function(tx) { + + tx.executeSql('SELECT UPPER(?) AS myresult', ['aé'], function(ignored, rs) { + expect(rs).toBeDefined(); + expect(rs.rows).toBeDefined(); + expect(rs.rows.length).toBe(1); + if (isAndroid && (isWebSql || (isImpl2 && /Android [5-9]/.test(navigator.userAgent)))) + expect(rs.rows.item(0).myresult).toBe('AÉ'); + else + expect(rs.rows.item(0).myresult).toBe('Aé'); + + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); + }); + }, function(error) { + // NOT EXPECTED: + expect(false).toBe(true); + expect(error.message).toBe('--'); + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); + }); + }, MYTIMEOUT); + + it(suiteName + 'string HEX parameter value test with UTF-8 3-octet character €', function(done) { + if (isWP8) pending('SKIP for WP(8)'); + + var db = openDatabase("UTF8-3-octet-hex-value-test.db", "1.0", "Demo", DEFAULT_SIZE); + + db.transaction(function(tx) { + + tx.executeSql('SELECT HEX(?) AS myresult', ['1€'], function(ignored, rs) { + expect(rs).toBeDefined(); + expect(rs.rows).toBeDefined(); + expect(rs.rows.length).toBe(1); + if (isWindows) + expect(rs.rows.item(0).myresult).toBe('3100AC20'); // (UTF-16le) + else + expect(rs.rows.item(0).myresult).toBe('31E282AC'); // (UTF-8) // Close (plugin only) & finish: (isWebSql) ? done() : db.close(done, done); }); + }, function(error) { + // NOT EXPECTED: + expect(false).toBe(true); + expect(error.message).toBe('--'); + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); }); }, MYTIMEOUT); - // NOTE On Windows [using a customized version of the SQLite3-WinRT component] and - // default Android-sqlite-connector implementations it is possible to manipulate, + it(suiteName + 'string parameter value manipulation test with UTF-8 3-octet character €', function(done) { + if (isWP8) pending('SKIP for WP(8)'); + + var db = openDatabase("UTF8-3-octet-string-upper-value-test.db", "1.0", "Demo", DEFAULT_SIZE); + + db.transaction(function(tx) { + + tx.executeSql('SELECT UPPER(?) AS myresult', ['a€'], function(ignored, rs) { + expect(rs).toBeDefined(); + expect(rs.rows).toBeDefined(); + expect(rs.rows.length).toBe(1); + expect(rs.rows.item(0).myresult).toBe('A€'); + + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); + }); + }, function(error) { + // NOT EXPECTED: + expect(false).toBe(true); + expect(error.message).toBe('--'); + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); + }); + }, MYTIMEOUT); + + // TBD NOTE: In case of the default Android database implementation + // (Android-sqlite-connector) it is possible to manipulate, // store, and retrieve a text string with 4-octet UTF-8 characters such as emojis. // However HEX manipulations do not work the same as Android/iOS WebKit Web SQL, // iOS plugin, or Android plugin with androidDatabaseImplementation : 2 setting. - // This linkely indicates that such characters are stored differently + // This linkely indicates that such characters are stored differently [incorrectly] // due to UTF-8 string handling limitations of Android-sqlite-connector - // and Windows (SQLite3-WinRT) versions. ref: litehelpers/Cordova-sqlite-storage#564 + // and Android-sqlite-native-driver. ref: litehelpers/Cordova-sqlite-storage#564 it(suiteName + 'Inline emoji string manipulation test: SELECT UPPER("a\\uD83D\\uDE03.") [\\u1F603 SMILING FACE (MOUTH OPEN)]', function(done) { var db = openDatabase("Inline-emoji-hex-test.db", "1.0", "Demo", DEFAULT_SIZE); @@ -331,39 +682,60 @@ var mytests = function() { db.transaction(function(tx) { expect(tx).toBeDefined(); - tx.executeSql('SELECT UPPER("a\uD83D\uDE03.") AS uppertext', [], function(tx, res) { - expect(res.rows.item(0).uppertext).toBe('A\uD83D\uDE03.'); + tx.executeSql('SELECT UPPER("a\uD83D\uDE03.") AS uppertext', [], function(tx_ignored, rs) { + expect(rs).toBeDefined(); + expect(rs.rows).toBeDefined(); + expect(rs.rows.length).toBe(1); + expect(rs.rows.item(0).uppertext).toBe('A\uD83D\uDE03.'); // Close (plugin only) & finish: (isWebSql) ? done() : db.close(done, done); }); + }, function(error) { + // NOT EXPECTED: + expect(false).toBe(true); + expect(error.message).toBe('--'); + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); }); }, MYTIMEOUT); - it(suiteName + 'Inline emoji HEX test: SELECT HEX("@\\uD83D\\uDE03!") [\\u1F603 SMILING FACE (MOUTH OPEN)]', function(done) { - if (isWP8) pending('BROKEN for WP8'); - if (isAndroid && !isWebSql && !isImpl2) pending('BROKEN for Android (default sqlite-connector version)'); - if (isWindows) pending('BROKEN for Windows'); - + it(suiteName + 'Inline emoji HEX test: SELECT HEX("@\\uD83D\\uDE03!") [\\u1F603 SMILING FACE (MOUTH OPEN)] [HEX encoding BUG on Android-sqlite-connector]', function(done) { var db = openDatabase("Inline-emoji-hex-test.db", "1.0", "Demo", DEFAULT_SIZE); expect(db).toBeDefined(); db.transaction(function(tx) { expect(tx).toBeDefined(); - tx.executeSql('SELECT HEX("@\uD83D\uDE03!") AS hexvalue', [], function(tx, res) { - expect(res.rows.item(0).hexvalue).toBe('40F09F988321'); + tx.executeSql('SELECT HEX("@\uD83D\uDE03!") AS hexvalue', [], function(tx_ignored, rs) { + expect(rs).toBeDefined(); + expect(rs.rows).toBeDefined(); + expect(rs.rows.length).toBe(1); + + // STOP HERE [HEX encoding BUG] for Android-sqlite-connector: + if (!isWebSql && !isWindows && isAndroid && !isImpl2) return done(); + + if (isWindows) + expect(rs.rows.item(0).hexvalue).toBe('40003DD803DE2100'); // (UTF-16le) + else + expect(rs.rows.item(0).hexvalue).toBe('40F09F988321'); // (UTF-8) // Close (plugin only) & finish: (isWebSql) ? done() : db.close(done, done); }); + }, function(error) { + // NOT EXPECTED: + expect(false).toBe(true); + expect(error.message).toBe('--'); + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); }); }, MYTIMEOUT); it(suiteName + "Inline BLOB with emoji string manipulation test: SELECT LOWER(X'41F09F9883') [A\uD83D\uDE03] [\\u1F603 SMILING FACE (MOUTH OPEN)]", function(done) { if (isWP8) pending('BROKEN for WP8'); if (!isWebSql && !isWindows && isAndroid && !isImpl2) pending('BROKEN: CRASH on Android 5.x (default sqlite-connector version)'); - if (isWindows) pending('BROKEN for Windows'); + if (isWindows) pending('SKIP for Windows'); // FUTURE TBD var db = openDatabase("Inline-emoji-select-lower-result-test.db", "1.0", "Demo", DEFAULT_SIZE); expect(db).toBeDefined(); @@ -371,20 +743,27 @@ var mytests = function() { db.transaction(function(tx) { expect(tx).toBeDefined(); - tx.executeSql("SELECT LOWER(X'41F09F9883') AS lowertext", [], function(ignored, res) { - expect(res).toBeDefined(); - expect(res.rows.item(0).lowertext).toBe('a\uD83D\uDE03'); + tx.executeSql("SELECT LOWER(X'41F09F9883') AS lowertext", [], function(ignored, rs) { + expect(rs).toBeDefined(); + expect(rs.rows).toBeDefined(); + expect(rs.rows.length).toBe(1); + expect(rs.rows.item(0).lowertext).toBe('a\uD83D\uDE03'); // Close (plugin only) & finish: (isWebSql) ? done() : db.close(done, done); }); + }, function(error) { + // NOT EXPECTED: + expect(false).toBe(true); + expect(error.message).toBe('--'); + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); }); }, MYTIMEOUT); it(suiteName + 'emoji SELECT HEX(?) parameter value test: "@\\uD83D\\uDE03!" [\\u1F603 SMILING FACE (MOUTH OPEN)]', function(done) { if (isWP8) pending('BROKEN for WP8'); if (isAndroid && !isWebSql && !isImpl2) pending('BROKEN for Android (default sqlite-connector version)'); - if (isWindows) pending('BROKEN for Windows'); var db = openDatabase("String-emoji-parameter-value-test.db", "1.0", "Demo", DEFAULT_SIZE); expect(db).toBeDefined(); @@ -392,22 +771,35 @@ var mytests = function() { db.transaction(function(tx) { expect(tx).toBeDefined(); - tx.executeSql('SELECT HEX(?) AS hexvalue', ['@\uD83D\uDE03!'], function(tx, res) { - expect(res.rows.item(0).hexvalue).toBe('40F09F988321'); + tx.executeSql('SELECT HEX(?) AS hexvalue', ['@\uD83D\uDE03!'], function(tx_ignored, rs) { + expect(rs).toBeDefined(); + expect(rs.rows).toBeDefined(); + expect(rs.rows.length).toBe(1); + if (isWindows) + expect(rs.rows.item(0).hexvalue).toBe('40003DD803DE2100'); // (UTF-16le) + else + expect(rs.rows.item(0).hexvalue).toBe('40F09F988321'); // (UTF-8) // Close (plugin only) & finish: (isWebSql) ? done() : db.close(done, done); }); + }, function(error) { + // NOT EXPECTED: + expect(false).toBe(true); + expect(error.message).toBe('--'); + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); }); }, MYTIMEOUT); - // NOTE: the next two tests show that for iOS/macOS/Android: + // NOTE: the next 3 tests show that for iOS/macOS/Android: // - UNICODE \u2028 line separator from JavaScript to native (Objective-C/Java) is working OK // - UNICODE \u2028 line separator from native (Objective-C/Java) to JavaScript is BROKEN // For reference: // - litehelpers/Cordova-sqlite-storage#147 // - Apache Cordova CB-9435 (issue with cordova-ios, also affects macOS) // - cordova/cordova-discuss#57 (issue with cordova-android) + it(suiteName + "UNICODE \\u2028 line separator string length", function(done) { if (isWP8) pending('BROKEN for WP(8)'); // [BUG #202] Certain UNICODE characters not working with WP(8) @@ -420,12 +812,49 @@ var mytests = function() { db.transaction(function(tx) { expect(tx).toBeDefined(); - tx.executeSql("select length(?) AS stringlength", ['First\u2028Second'], function (tx, res) { - expect(res.rows.item(0).stringlength).toBe(12); + tx.executeSql("select length(?) AS stringlength", ['First\u2028Second'], function (tx_ignored, rs) { + expect(rs).toBeDefined(); + expect(rs.rows).toBeDefined(); + expect(rs.rows.length).toBe(1); + expect(rs.rows.item(0).stringlength).toBe(12); + + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); + }); + }, function(error) { + // NOT EXPECTED: + expect(false).toBe(true); + expect(error.message).toBe('--'); + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); + }); + }, MYTIMEOUT); + + it(suiteName + 'HEX value of string with UNICODE \\u2028 line separator', function(done) { + // NOTE: this test verifies that the UNICODE line separator (\u2028) + // is seen by the sqlite implementation OK: + var db = openDatabase("UNICODE-line-separator-hex-value-test.db", "1.0", "Demo", DEFAULT_SIZE); + + expect(db).toBeDefined(); + + db.transaction(function(tx) { + expect(tx).toBeDefined(); + + tx.executeSql('SELECT HEX(?) AS myresult', ['1\u2028'], function (tx_ignored, rs) { + if (isWindows) + expect(rs.rows.item(0).myresult).toBe('31002820'); // (UTF-16le) + else + expect(rs.rows.item(0).myresult).toBe('31E280A8'); // (UTF-8) // Close (plugin only) & finish: (isWebSql) ? done() : db.close(done, done); }); + }, function(error) { + // NOT EXPECTED: + expect(false).toBe(true); + expect(error.message).toBe('--'); + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); }); }, MYTIMEOUT); @@ -444,17 +873,23 @@ var mytests = function() { db.transaction(function(tx) { expect(tx).toBeDefined(); - tx.executeSql("SELECT LOWER(?) AS lowertext", ['First\u2028Second'], function (tx, res) { - expect(res).toBeDefined(); - expect(res.rows.item(0).lowertext).toBe("first\u2028second"); + tx.executeSql("SELECT LOWER(?) AS lowertext", ['First\u2028Second'], function (tx_ignored, rs) { + expect(rs).toBeDefined(); + expect(rs.rows.item(0).lowertext).toBe("first\u2028second"); // Close (plugin only) & finish: (isWebSql) ? done() : db.close(done, done); }); + }, function(error) { + // NOT EXPECTED: + expect(false).toBe(true); + expect(error.message).toBe('--'); + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); }); }, MYTIMEOUT); - // NOTE: the next two tests repeat the above for UNICODE \u2029 paragraph separator + // NOTE: the next 3 tests repeat the above for UNICODE \u2029 paragraph separator // on iOS/macOS/Android: // - UNICODE \u2029 paragraph separator from JavaScript to native (Objective-C/Java) is working OK // - UNICODE \u2029 paragraph separator from native (Objective-C/Java) to JavaScript is BROKEN @@ -462,6 +897,7 @@ var mytests = function() { // - litehelpers/Cordova-sqlite-storage#147 // - Apache Cordova CB-9435 (issue with cordova-ios, also affects macOS) // - cordova/cordova-discuss#57 (issue with cordova-android) + it(suiteName + "UNICODE \\u2029 paragraph separator string length", function(done) { if (isWP8) pending('BROKEN for WP(8)'); // [BUG #202] Certain UNICODE characters not working with WP(8) @@ -475,12 +911,46 @@ var mytests = function() { expect(tx).toBeDefined(); var text = 'Abcd\u20281234'; - tx.executeSql("select length(?) AS stringlength", ['First\u2029Second'], function (tx, res) { - expect(res.rows.item(0).stringlength).toBe(12); + tx.executeSql("select length(?) AS stringlength", ['First\u2029Second'], function (tx_ignored, rs) { + expect(rs.rows.item(0).stringlength).toBe(12); + + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); + }); + }, function(error) { + // NOT EXPECTED: + expect(false).toBe(true); + expect(error.message).toBe('--'); + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); + }); + }, MYTIMEOUT); + + it(suiteName + 'HEX value of string with UNICODE \\u2029 paragraph separator', function(done) { + // NOTE: this test verifies that the UNICODE paragraph separator (\u2029) + // is seen by the sqlite implementation OK: + var db = openDatabase("UNICODE-paragraph-separator-hex-value-test.db", "1.0", "Demo", DEFAULT_SIZE); + + expect(db).toBeDefined(); + + db.transaction(function(tx) { + expect(tx).toBeDefined(); + + tx.executeSql('SELECT HEX(?) AS myresult', ['1\u2029'], function (tx_ignored, rs) { + if (isWindows) + expect(rs.rows.item(0).myresult).toBe('31002920'); // (UTF-16le) + else + expect(rs.rows.item(0).myresult).toBe('31E280A9'); // (UTF-8) // Close (plugin only) & finish: (isWebSql) ? done() : db.close(done, done); }); + }, function(error) { + // NOT EXPECTED: + expect(false).toBe(true); + expect(error.message).toBe('--'); + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); }); }, MYTIMEOUT); @@ -499,24 +969,33 @@ var mytests = function() { db.transaction(function(tx) { expect(tx).toBeDefined(); - tx.executeSql("SELECT LOWER(?) AS lowertext", ['First\u2029Second'], function (tx, res) { - expect(res).toBeDefined(); - expect(res.rows.item(0).lowertext).toBe("first\u2029second"); + tx.executeSql("SELECT LOWER(?) AS lowertext", ['First\u2029Second'], function (tx_ignored, rs) { + expect(rs).toBeDefined(); + expect(rs.rows.item(0).lowertext).toBe("first\u2029second"); // Close (plugin only) & finish: (isWebSql) ? done() : db.close(done, done); }); + }, function(error) { + // NOT EXPECTED: + expect(false).toBe(true); + expect(error.message).toBe('--'); + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); }); }, MYTIMEOUT); - it(suiteName + 'UTF-8 string test', function(done) { + it(suiteName + 'Inline string manipulation test with UTF-8 2/3 octet characters', function(done) { if (isWP8) pending('SKIP for WP(8)'); - var db = openDatabase("UTF8-string-test.db", "1.0", "Demo", DEFAULT_SIZE); + var db = openDatabase("Inline-UTF8-string-manipulation-test.db", "1.0", "Demo", DEFAULT_SIZE); db.transaction(function(tx) { tx.executeSql("SELECT UPPER('Test ¢ é €') AS upper_result", [], function(ignored, rs) { + expect(rs).toBeDefined(); + expect(rs.rows).toBeDefined(); + expect(rs.rows.length).toBe(1); if (isAndroid && (isWebSql || (isImpl2 && /Android [5-9]/.test(navigator.userAgent)))) expect(rs.rows.item(0).upper_result).toBe('TEST ¢ É €'); else @@ -525,13 +1004,19 @@ var mytests = function() { // Close (plugin only) & finish: (isWebSql) ? done() : db.close(done, done); }); + }, function(error) { + // NOT EXPECTED: + expect(false).toBe(true); + expect(error.message).toBe('--'); + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); }); }, MYTIMEOUT); - it(suiteName + 'UTF-8 string binding test', function(done) { + it(suiteName + 'string parameter manipulation test with UTF-8 2/3 octet characters', function(done) { if (isWP8) pending('SKIP for WP(8)'); - var db = openDatabase("UTF8-string-binding-test.db", "1.0", "Demo", DEFAULT_SIZE); + var db = openDatabase("UTF8-string-parameter-manipulation-test.db", "1.0", "Demo", DEFAULT_SIZE); db.transaction(function(tx) { @@ -556,17 +1041,32 @@ var mytests = function() { }); }, MYTIMEOUT); - it(suiteName + 'Double-quote string test', function(done) { - var db = openDatabase("Double-quote-string-test.db", "1.0", "Demo", DEFAULT_SIZE); + }); + + describe(suiteName + 'Additional US-ASCII string binding/manipulation tests', function() { + + // TBD CHECK HEX value results + + it(suiteName + 'INLINE Double-quote string manipulation test', function(done) { + var db = openDatabase("INLINE-Double-quote-string-test.db", "1.0", "Demo", DEFAULT_SIZE); db.transaction(function(tx) { tx.executeSql("SELECT UPPER('\"String\" test') AS upper_result", [], function(ignored, rs) { + expect(rs).toBeDefined(); + expect(rs.rows).toBeDefined(); + expect(rs.rows.length).toBe(1); expect(rs.rows.item(0).upper_result).toBe('"STRING" TEST'); // Close (plugin only) & finish: (isWebSql) ? done() : db.close(done, done); }); + }, function(error) { + // NOT EXPECTED: + expect(false).toBe(true); + expect(error.message).toBe('--'); + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); }); }, MYTIMEOUT); @@ -627,7 +1127,6 @@ var mytests = function() { expect(rs1.rows.length).toBe(1); expect(rs1.rows.item(0).upper_result).toBe('TEST \\'); - // Close (plugin only) & finish: (isWebSql) ? done() : db.close(done, done); }); diff --git a/spec/www/spec/db-tx-value-bindings-test.js b/spec/www/spec/db-tx-value-bindings-test.js index dd72829c..419c657e 100755 --- a/spec/www/spec/db-tx-value-bindings-test.js +++ b/spec/www/spec/db-tx-value-bindings-test.js @@ -4,41 +4,16 @@ var MYTIMEOUT = 12000; var DEFAULT_SIZE = 5000000; // max to avoid popup in safari/ios -// FUTURE TODO replace in test(s): -function ok(test, desc) { expect(test).toBe(true); } -function equal(a, b, desc) { expect(a).toEqual(b); } // '==' -function strictEqual(a, b, desc) { expect(a).toBe(b); } // '===' - -// XXX TODO REFACTOR OUT OF OLD TESTS: -var wait = 0; -var test_it_done = null; -function xtest_it(desc, fun) { xit(desc, fun); } -function test_it(desc, fun) { - wait = 0; - it(desc, function(done) { - test_it_done = done; - fun(); - }, MYTIMEOUT); -} -function stop(n) { - if (!!n) wait += n - else ++wait; -} -function start(n) { - if (!!n) wait -= n; - else --wait; - if (wait == 0) test_it_done(); -} - var isWP8 = /IEMobile/.test(navigator.userAgent); // Matches WP(7/8/8.1) var isWindows = /Windows /.test(navigator.userAgent); // Windows (8.1) var isAndroid = !isWindows && /Android/.test(navigator.userAgent); var isMac = /Macintosh/.test(navigator.userAgent); var isWKWebView = !isWindows && !isAndroid && !isWP8 && !isMac && !!window.webkit && !!window.webkit.messageHandlers; -// NOTE: In the core-master branch there is no difference between the default -// implementation and implementation #2. But the test will also apply -// the androidLockWorkaround: 1 option in the case of implementation #2. +// The following openDatabase settings are used for Plugin-implementation-2 +// on Android: +// - androidDatabaseImplementation: 2 +// - androidLockWorkaround: 1 var scenarioList = [ isAndroid ? 'Plugin-implementation-default' : 'Plugin', 'HTML5', @@ -51,7 +26,7 @@ var mytests = function() { for (var i=0; i Date: Tue, 21 Mar 2017 22:52:58 +0100 Subject: [PATCH 14/29] Test various database file names; other test fixes --- README.md | 7 + spec/www/spec/db-open-close-delete-test.js | 450 ++++++++++++++++++- spec/www/spec/db-tx-sql-select-value-test.js | 17 +- 3 files changed, 461 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 5596a8ce..2b6f883f 100644 --- a/README.md +++ b/README.md @@ -719,6 +719,13 @@ window.sqlitePlugin.openDatabase({name: 'my.db', location: 'default'}, function( If any sql statements or transactions are attempted on a database object before the openDatabase result is known, they will be queued and will be aborted in case the database cannot be opened. +**DATABASE NAME NOTES:** + +- Database file names with slash (`/`) character(s) are not supported and not expected to work. +- Database file names with ASCII control characters such as tab, vertical tab, carriage return, line feed, form feed, and backspace are not supported and do not work on Windows. +- Some other ASCII characters not supported and not working on Windows: `*` `<` `>` `?` `\` `"` `|` +- Database file names with emojis and other 4-octet UTF-8 characters are NOT RECOMMENDED. + **OTHER NOTES:** - The database file name should include the extension, if desired. - It is possible to open multiple database access handle objects for the same database. diff --git a/spec/www/spec/db-open-close-delete-test.js b/spec/www/spec/db-open-close-delete-test.js index 55908f75..81044e80 100755 --- a/spec/www/spec/db-open-close-delete-test.js +++ b/spec/www/spec/db-open-close-delete-test.js @@ -48,6 +48,442 @@ var pluginScenarioCount = isAndroid ? 2 : 1; var mytests = function() { + describe('Plugin - open database file name test(s)', function() { + + for (var i=0; i', dbName: 'first > second.db'}, + {label: '\\', dbName: 'first\\second.db'}, + {label: '?', dbName: 'a?.db'}, + {label: '"2".db', dbName: '"2".db'}, + {label: '||', dbName: 'first||second.db'}, + ]; + + unsupportedDatabaseNameScenariosWithFailureOnWindows.forEach(function(mytest) { + it(suiteName + 'Open database & check database file name with ' + mytest.label + ' [NOT SUPPORTED, NOT WORKING on Windows]', function(done) { + var dbName = mytest.dbName; + + try { + openDatabase({name: dbName, location: 'default'}, function(db) { + // EXPECTED RESULT (Android/iOS/macOS): + if (isWindows) expect('UNEXPECTED SUCCESS on Windows PLEASE UPDATE THIS TEST').toBe('--'); + expect(db).toBeDefined(); + + db.executeSql('PRAGMA database_list', [], function(rs) { + // EXPECTED RESULT: + expect(rs).toBeDefined(); + expect(rs.rows).toBeDefined(); + expect(rs.rows.length).toBe(1); + expect(rs.rows.item(0).name).toBe('main'); + expect(rs.rows.item(0).file).toBeDefined(); + expect(rs.rows.item(0).file.indexOf(dbName)).not.toBe(-1); + + // Close & finish: + db.close(done, done); + }, function(error) { + // NOT EXPECTED: + expect(false).toBe(true); + expect(error.message).toBe('--'); + done(); + }); + + }, function(error) { + // NOT EXPECTED on Android/iOS/macOS: + if (isWindows) { + expect(error).toBeDefined(); + expect(error.message).toBeDefined(); + } else { + expect(false).toBe(true); + expect(error.message).toBe('--'); + } + done(); + }); + + } catch (e) { + // NOT EXPECTED: + expect(false).toBe(true); + expect(e.message).toBe('--'); + done(); + } + }, MYTIMEOUT); + }); + + }); + } + + }); + describe('Plugin - BASIC sqlitePlugin.openDatabase parameter check test(s)', function() { var suiteName = 'plugin: '; @@ -572,11 +1008,11 @@ var mytests = function() { describe(pluginScenarioList[i] + ': basic sqlitePlugin.deleteDatabase test(s)', function() { var scenarioName = pluginScenarioList[i]; var suiteName = scenarioName + ': '; - var isOldAndroidImpl = (i === 1); + var isImpl2 = (i === 1); // NOTE: MUST be defined in function scope, NOT outer scope: var openDatabase = function(first, second, third, fourth, fifth, sixth) { - //if (!isOldAndroidImpl) { + //if (!isImpl2) { // return window.sqlitePlugin.openDatabase(first, second, third, fourth, fifth, sixth); //} @@ -592,7 +1028,7 @@ var mytests = function() { errorcb = third; } - if (!isOldAndroidImpl) { + if (!isImpl2) { return window.sqlitePlugin.openDatabase({name: dbname, location: 0}, okcb, errorcb); } @@ -607,7 +1043,7 @@ var mytests = function() { } var deleteDatabase = function(first, second, third) { - if (!isOldAndroidImpl) { + if (!isImpl2) { window.sqlitePlugin.deleteDatabase({name: first, location: 0}, second, third); } else { window.sqlitePlugin.deleteDatabase({name: 'i2-'+first, location: 0}, second, third); @@ -691,11 +1127,11 @@ var mytests = function() { describe(pluginScenarioList[i] + ': basic plugin open-close test(s)', function() { var scenarioName = pluginScenarioList[i]; var suiteName = scenarioName + ': '; - var isOldAndroidImpl = (i === 1); + var isImpl2 = (i === 1); // NOTE: MUST be defined in function scope, NOT outer scope: var openDatabase = function(first, second, third, fourth, fifth, sixth) { - //if (!isOldAndroidImpl) { + //if (!isImpl2) { // return window.sqlitePlugin.openDatabase(first, second, third, fourth, fifth, sixth); //} @@ -711,7 +1147,7 @@ var mytests = function() { errorcb = third; } - if (!isOldAndroidImpl) { + if (!isImpl2) { return window.sqlitePlugin.openDatabase({name: dbname, location: 0}, okcb, errorcb); } diff --git a/spec/www/spec/db-tx-sql-select-value-test.js b/spec/www/spec/db-tx-sql-select-value-test.js index 5ae9eeed..690d8b93 100644 --- a/spec/www/spec/db-tx-sql-select-value-test.js +++ b/spec/www/spec/db-tx-sql-select-value-test.js @@ -10,9 +10,10 @@ var isAndroid = !isWindows && /Android/.test(navigator.userAgent); var isMac = /Macintosh/.test(navigator.userAgent); var isWKWebView = !isWindows && !isAndroid && !isWP8 && !isMac && !!window.webkit && !!window.webkit.messageHandlers; -// NOTE: In the core-master branch there is no difference between the default -// implementation and implementation #2. But the test will also apply -// the androidLockWorkaround: 1 option in the case of implementation #2. +// The following openDatabase settings are used for Plugin-implementation-2 +// on Android: +// - androidDatabaseImplementation: 2 +// - androidLockWorkaround: 1 var scenarioList = [ isAndroid ? 'Plugin-implementation-default' : 'Plugin', 'HTML5', @@ -31,15 +32,19 @@ var mytests = function() { var isWebSql = (i === 1); var isImpl2 = (i === 2); - // NOTE: MUST be defined in function scope, NOT outer scope: - var openDatabase = function(name, ignored1, ignored2, ignored3) { + // NOTE 1: MUST be defined in proper describe function scope, NOT outer scope. + // NOTE 2: Using same database name in this script to avoid issue with + // "Too many open files" on iOS with WKWebView engine plugin. + // (FUTURE TBD NEEDS INVESTIGATION) + var openDatabase = function(name_ignored, ignored1, ignored2, ignored3) { + var name = 'select-value-test.db'; if (isImpl2) { return window.sqlitePlugin.openDatabase({ // prevent reuse of database from default db implementation: name: 'i2-'+name, androidDatabaseImplementation: 2, androidLockWorkaround: 1, - location: 1 + location: 'default' }); } if (isWebSql) { From 39affc6ceaaa816cc442040d3f94ad0d30c3f1ee Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Tue, 28 Mar 2017 04:21:29 -0400 Subject: [PATCH 15/29] Add missing spaces Some spacing was missing in order for the headers to render properly --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 2b6f883f..fa3de85c 100644 --- a/README.md +++ b/README.md @@ -1380,7 +1380,7 @@ The SQLite storage plugin sample allows you to execute SQL statements to interac * [Update rows in the database](#updateRow) that match a column value * [Close the database](#closeDb) -##Open the database and create a table +## Open the database and create a table Call the `openDatabase()` function to get started, passing in the name and location for the database. @@ -1444,7 +1444,7 @@ addItem("Joe", "Auzomme", 102); addItem("Pete", "Smith", 103); ``` -##Read data from the database +## Read data from the database Add code to read from the database using a SELECT statement. Include a WHERE condition to match the resultSet to the passed in last name. @@ -1473,7 +1473,7 @@ function getData(last) { } ``` -##Remove a row from the database +## Remove a row from the database Add a function to remove a row from the database that matches the passed in customer account number. @@ -1499,7 +1499,7 @@ function removeItem(acctNum) { } ``` -##Update rows in the database +## Update rows in the database Add a function to update rows in the database for records that match the passed in customer account number. In this form, the statement will update multiple rows if the account numbers are not unique. @@ -1531,7 +1531,7 @@ To call the preceding function, add code like this in your app. updateItem("Yme", 102); ``` -##Close the database +## Close the database When you are finished with your transactions, close the database. Call `closeDB` within the transaction success or failure callbacks (rather than the callbacks for `executeSql()`). From 457f4ba96d0f3448476ca252ee785ae9531c94ee Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Mon, 3 Apr 2017 02:42:47 +0200 Subject: [PATCH 16/29] Completely remove extra BLOB handling code --- CHANGES.md | 2 +- package.json | 2 +- plugin.xml | 2 +- .../io/sqlc/SQLiteAndroidDatabase.java | 15 +---- src/ios/SQLitePlugin.m | 56 +++---------------- 5 files changed, 13 insertions(+), 64 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 00a11669..82fa5b88 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,6 @@ # Changes -### cordova-sqlite-storage 1.5.4-pre1 +### cordova-sqlite-storage 1.5.4-pre2 - SQLite 3.15.2 build fixes diff --git a/package.json b/package.json index fb0ecf5f..1daa5427 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cordova-sqlite-storage", - "version": "1.5.4-pre1", + "version": "1.5.4-pre2", "description": "Native interface to SQLite for PhoneGap/Cordova", "cordova": { "id": "cordova-sqlite-storage", diff --git a/plugin.xml b/plugin.xml index 6b8bf9d7..6cbbc596 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="1.5.4-pre2"> Cordova sqlite storage plugin diff --git a/src/android/io/sqlc/SQLiteAndroidDatabase.java b/src/android/io/sqlc/SQLiteAndroidDatabase.java index 5530b27f..e65acba2 100644 --- a/src/android/io/sqlc/SQLiteAndroidDatabase.java +++ b/src/android/io/sqlc/SQLiteAndroidDatabase.java @@ -17,7 +17,6 @@ import android.database.sqlite.SQLiteException; import android.database.sqlite.SQLiteStatement; -import android.util.Base64; import android.util.Log; import java.io.File; @@ -501,13 +500,8 @@ private void bindPostHoneycomb(JSONObject row, String key, Cursor cur, int i) th case Cursor.FIELD_TYPE_FLOAT: row.put(key, cur.getDouble(i)); break; - /* ** Read BLOB as Base-64 DISABLED in this branch: - case Cursor.FIELD_TYPE_BLOB: - row.put(key, new String(Base64.encode(cur.getBlob(i), Base64.DEFAULT))); - break; - // ** Read BLOB as Base-64 DISABLED to HERE. */ case Cursor.FIELD_TYPE_STRING: - default: /* (not expected) */ + default: /* (BLOB) */ row.put(key, cur.getString(i)); break; } @@ -526,11 +520,8 @@ private void bindPreHoneycomb(JSONObject row, String key, Cursor cursor, int i) row.put(key, cursor.getLong(i)); } else if (cursorWindow.isFloat(pos, i)) { row.put(key, cursor.getDouble(i)); - /* ** Read BLOB as Base-64 DISABLED in this branch: - } else if (cursorWindow.isBlob(pos, i)) { - row.put(key, new String(Base64.encode(cursor.getBlob(i), Base64.DEFAULT))); - // ** Read BLOB as Base-64 DISABLED to HERE. */ - } else { // string + } else { + // STRING or BLOB: row.put(key, cursor.getString(i)); } } diff --git a/src/ios/SQLitePlugin.m b/src/ios/SQLitePlugin.m index 5bf2524b..c7e29345 100755 --- a/src/ios/SQLitePlugin.m +++ b/src/ios/SQLitePlugin.m @@ -10,12 +10,6 @@ #import "sqlite3.h" -// FUTURE TBD (in another version branch): -//#define READ_BLOB_AS_BASE64 - -// FUTURE TBD (in another version branch & TBD subjet to change): -//#define INCLUDE_SQL_BLOB_BINDING - // Defines Macro to only log lines when in DEBUG mode #ifdef DEBUG # define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__); @@ -385,14 +379,6 @@ -(CDVPluginResult*) executeSqlWithDict: (NSMutableDictionary*)options andArgs: ( columnValue = [NSNumber numberWithDouble: sqlite3_column_double(statement, i)]; break; case SQLITE_BLOB: -#ifdef READ_BLOB_AS_BASE64 - columnValue = [SQLitePlugin getBlobAsBase64String: sqlite3_column_blob(statement, i) - withLength: sqlite3_column_bytes(statement, i)]; -#ifdef INCLUDE_SQL_BLOB_BINDING // TBD subjet to change: - columnValue = [@"sqlblob:;base64," stringByAppendingString:columnValue]; -#endif - break; -#endif // else case SQLITE_TEXT: columnValue = [[NSString alloc] initWithBytes:(char *)sqlite3_column_text(statement, i) length:sqlite3_column_bytes(statement, i) @@ -454,8 +440,10 @@ -(int)bindStatement:(sqlite3_stmt *)statement withArg:(NSObject *)arg atIndex:(i int bindResult = SQLITE_ERROR; if ([arg isEqual:[NSNull null]]) { + // bind null: bindResult = sqlite3_bind_null(statement, argIndex); } else if ([arg isKindOfClass:[NSNumber class]]) { + // bind NSNumber (int64 or double): NSNumber *numberArg = (NSNumber *)arg; const char *numberType = [numberArg objCType]; @@ -466,7 +454,8 @@ -(int)bindStatement:(sqlite3_stmt *)statement withArg:(NSObject *)arg atIndex:(i } else { bindResult = sqlite3_bind_double(statement, argIndex, [numberArg doubleValue]); } - } else { // NSString + } else { + // bind NSString (text): NSString *stringArg; if ([arg isKindOfClass:[NSString class]]) { @@ -475,27 +464,9 @@ -(int)bindStatement:(sqlite3_stmt *)statement withArg:(NSObject *)arg atIndex:(i stringArg = [arg description]; // convert to text } -#ifdef INCLUDE_SQL_BLOB_BINDING // TBD subjet to change: - // If the string is a sqlblob URI then decode it and store the binary directly. - // - // A sqlblob URI is formatted similar to a data URI which makes it easy to convert: - // sqlblob:[][;charset=][;base64], - // - // The reason the `sqlblob` prefix is used instead of `data` is because - // applications may want to use data URI strings directly, so the - // `sqlblob` prefix disambiguates the desired behavior. - if ([stringArg hasPrefix:@"sqlblob:"]) { - // convert to data URI, decode, store as blob - stringArg = [stringArg stringByReplacingCharactersInRange:NSMakeRange(0,7) withString:@"data"]; - NSData *data = [NSData dataWithContentsOfURL: [NSURL URLWithString:stringArg]]; - bindResult = sqlite3_bind_blob(statement, argIndex, data.bytes, data.length, SQLITE_TRANSIENT); - } - else -#endif - { - NSData *data = [stringArg dataUsingEncoding:NSUTF8StringEncoding]; - bindResult = sqlite3_bind_text(statement, argIndex, data.bytes, (int)data.length, SQLITE_TRANSIENT); - } + // always bind text string as UTF-8 (sqlite does internal conversion if necessary): + NSData *data = [stringArg dataUsingEncoding:NSUTF8StringEncoding]; + bindResult = sqlite3_bind_text(statement, argIndex, data.bytes, (int)data.length, SQLITE_TRANSIENT); } return bindResult; @@ -563,17 +534,4 @@ +(int)mapSQLiteErrorCode:(int)code } } -#ifdef READ_BLOB_AS_BASE64 -+(NSString*)getBlobAsBase64String:(const char*)blob_chars - withLength:(int)blob_length -{ - // THANKS for guidance: http://stackoverflow.com/a/8354941/1283667 - NSData * data = [NSData dataWithBytes: (const void *)blob_chars length: blob_length]; - - // THANKS for guidance: - // https://github.com/apache/cordova-ios/blob/master/guides/API%20changes%20in%204.0.md#nsdatabase64h-removed - return [data base64EncodedStringWithOptions:0]; -} -#endif - @end /* vim: set expandtab : */ From 474085937273d292aeb6252e2a770b52182adbb4 Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Mon, 3 Apr 2017 03:51:08 +0200 Subject: [PATCH 17/29] Fix FIRST_WORD check for android.sqlite.database implementation Fix litehelpers/Cordova-sqlite-storage#458 (needed for Cordova-sqlcipher-adapter version) --- CHANGES.md | 3 ++- README.md | 1 - package.json | 2 +- plugin.xml | 2 +- .../spec/basic-db-tx-sql-storage-results.js | 2 -- spec/www/spec/db-tx-error-handling-test.js | 8 +++++++ .../io/sqlc/SQLiteAndroidDatabase.java | 22 +++++++++++++++---- 7 files changed, 30 insertions(+), 10 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 82fa5b88..c579ea21 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,7 +1,8 @@ # Changes -### cordova-sqlite-storage 1.5.4-pre2 +### cordova-sqlite-storage 1.5.4-pre3 +- Fix FIRST_WORD check for android.sqlite.database implementation - SQLite 3.15.2 build fixes ### cordova-sqlite-storage 1.5.3 diff --git a/README.md b/README.md index fa3de85c..fc24c16f 100644 --- a/README.md +++ b/README.md @@ -453,7 +453,6 @@ See **Security of sensitive data** in the [Security](#security) section above. - Close/delete database bugs described below. - When a database is opened and deleted without closing, the iOS/macOS version is known to leak resources. - It is NOT possible to open multiple databases with the same name but in different locations (iOS/macOS). -- Incorrect or missing rowsAffected in results for INSERT/UPDATE/DELETE SQL statements with extra semicolon(s) in the beginning for Android in case the `androidDatabaseImplementation: 2` (built-in android.database implementation) option is used. Some more known issues are tracked in the [open Cordova-sqlite-storage bugs](https://github.com/litehelpers/Cordova-sqlite-storage/issues?q=is%3Aissue+is%3Aopen+label%3Abug). diff --git a/package.json b/package.json index 1daa5427..45b1b8bf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cordova-sqlite-storage", - "version": "1.5.4-pre2", + "version": "1.5.4-pre3", "description": "Native interface to SQLite for PhoneGap/Cordova", "cordova": { "id": "cordova-sqlite-storage", diff --git a/plugin.xml b/plugin.xml index 6cbbc596..da3ca9c7 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="1.5.4-pre3"> Cordova sqlite storage plugin diff --git a/spec/www/spec/basic-db-tx-sql-storage-results.js b/spec/www/spec/basic-db-tx-sql-storage-results.js index e47e39e3..4b7d8a83 100644 --- a/spec/www/spec/basic-db-tx-sql-storage-results.js +++ b/spec/www/spec/basic-db-tx-sql-storage-results.js @@ -480,9 +480,7 @@ var mytests = function() { }, MYTIMEOUT); it(suiteName + 'tx sql starting with extra semicolon results test', function(done) { - // [BUG #458] BROKEN for androidDatabaseImplementation: 2 (built-in android.database) setting if (isWP8) pending('BROKEN for WP8'); - if (isAndroid && isImpl2) pending('BROKEN for androidDatabaseImplementation: 2 (built-in android.database) setting'); var db = openDatabase('tx-sql-starting-with-extra-semicolon-results-test.db', '1.0', 'Test', DEFAULT_SIZE); diff --git a/spec/www/spec/db-tx-error-handling-test.js b/spec/www/spec/db-tx-error-handling-test.js index 8d51be26..bb2a6efe 100644 --- a/spec/www/spec/db-tx-error-handling-test.js +++ b/spec/www/spec/db-tx-error-handling-test.js @@ -1600,6 +1600,8 @@ var mytests = function() { expect(true).toBe(true); // SKIP for now else if (isWindows) expect(error.message).toMatch(/a statement with no error handler failed: SQLite3 step error result code: 21/); + else if (isAndroid && isImpl2) + expect(error.message).toMatch(/a statement with no error handler failed: query not found/); else if (!isWebSql) expect(error.message).toMatch(/a statement with no error handler failed:.*not an error/); else @@ -1662,6 +1664,8 @@ var mytests = function() { expect(true).toBe(true); // SKIP for now else if (isWindows) expect(error.message).toMatch(/a statement with no error handler failed: SQLite3 step error result code: 21/); + else if (isAndroid && isImpl2) + expect(error.message).toMatch(/a statement with no error handler failed: query not found/); else if (!isWebSql) expect(error.message).toMatch(/a statement with no error handler failed:.*not an error/); else @@ -1724,6 +1728,8 @@ var mytests = function() { expect(true).toBe(true); // SKIP for now else if (isWindows) expect(error.message).toMatch(/a statement with no error handler failed: SQLite3 step error result code: 21/); + else if (isAndroid && isImpl2) + expect(error.message).toMatch(/a statement with no error handler failed: query not found/); else if (!isWebSql) expect(error.message).toMatch(/a statement with no error handler failed:.*not an error/); else @@ -1787,6 +1793,8 @@ var mytests = function() { expect(true).toBe(true); // SKIP for now else if (isWindows) expect(error.message).toMatch(/a statement with no error handler failed: SQLite3 step error result code: 21/); + else if (isAndroid && isImpl2) + expect(error.message).toMatch(/a statement with no error handler failed: query not found/); else if (!isWebSql) expect(error.message).toMatch(/a statement with no error handler failed:.*not an error/); else diff --git a/src/android/io/sqlc/SQLiteAndroidDatabase.java b/src/android/io/sqlc/SQLiteAndroidDatabase.java index e65acba2..28567b9f 100644 --- a/src/android/io/sqlc/SQLiteAndroidDatabase.java +++ b/src/android/io/sqlc/SQLiteAndroidDatabase.java @@ -38,7 +38,7 @@ */ class SQLiteAndroidDatabase { - private static final Pattern FIRST_WORD = Pattern.compile("^\\s*(\\S+)", + private static final Pattern FIRST_WORD = Pattern.compile("^[\\s;]*([^\\s;]+)", Pattern.CASE_INSENSITIVE); private static final Pattern WHERE_CLAUSE = Pattern.compile("\\s+WHERE\\s+(.+)$", @@ -130,7 +130,9 @@ private void executeSqlBatchStatement(String query, JSONArray json_params, JSONA try { boolean needRawQuery = true; + //Log.v("executeSqlBatch", "get query type"); QueryType queryType = getQueryType(query); + //Log.v("executeSqlBatch", "query type: " + queryType); if (queryType == QueryType.update || queryType == queryType.delete) { if (isPostHoneycomb) { @@ -528,14 +530,26 @@ private void bindPreHoneycomb(JSONObject row, String key, Cursor cursor, int i) static QueryType getQueryType(String query) { Matcher matcher = FIRST_WORD.matcher(query); + + // FIND & return query type, or throw: if (matcher.find()) { try { - return QueryType.valueOf(matcher.group(1).toLowerCase()); + String first = matcher.group(1); + + // explictly reject if blank + // (needed for SQLCipher version) + if (first.length() == 0) throw new RuntimeException("query not found"); + + return QueryType.valueOf(first.toLowerCase()); } catch (IllegalArgumentException ignore) { - // unknown verb + // unknown verb (NOT blank) + return QueryType.other; } + } else { + // explictly reject if blank + // (needed for SQLCipher version) + throw new RuntimeException("query not found"); } - return QueryType.other; } static enum QueryType { From c2df44d8e9d8af6a07a34063603cd0339b8d982a Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Mon, 3 Apr 2017 04:27:08 +0200 Subject: [PATCH 18/29] Report insertId: undefined in case INSERT OR IGNORE is ignored (iOS/macOS) Fix litehelpers/Cordova-sqlite-storage#650 --- CHANGES.md | 3 ++- README.md | 2 +- package.json | 2 +- plugin.xml | 2 +- spec/www/spec/basic-db-tx-sql-storage-results.js | 6 +++--- src/ios/SQLitePlugin.m | 2 +- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index c579ea21..ad243499 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,7 +1,8 @@ # Changes -### cordova-sqlite-storage 1.5.4-pre3 +### cordova-sqlite-storage 1.5.4-pre4 +- Fix iOS/macOS version to report undefined insertId in case INSERT OR IGNORE is ignored - Fix FIRST_WORD check for android.sqlite.database implementation - SQLite 3.15.2 build fixes diff --git a/README.md b/README.md index fc24c16f..c8f8f9ba 100644 --- a/README.md +++ b/README.md @@ -423,7 +423,6 @@ As "strongly recommended" by [Web SQL Database API 8.5 SQL injection](https://ww - In certain cases such as `transaction.executeSql()` with no arguments (Android/iOS WebKit) Web SQL includes includes a code member with value of 0 (SQLError.UNKNOWN_ERR) in the exception while the plugin includes no such code member. - If the SQL arguments are passed in an `Array` subclass object where the `constructor` does not point to `Array` then the SQL arguments are ignored by the plugin. - The results data objects are not immutable as specified/implied by [Web SQL API section 4.5](https://www.w3.org/TR/webdatabase/#database-query-results). -- In case of ignored INSERT OR IGNORE statement this plugin reports an old INSERT row id value on iOS/macOS. (WebKit Web SQL also reports an old INSERT row id value in case of an ignored INSERT OR IGNORE statement on Android and iOS.) ### Security of deleted data @@ -431,6 +430,7 @@ See **Security of sensitive data** in the [Security](#security) section above. ### Other differences with WebKit Web SQL implementations +- In case of ignored INSERT OR IGNORE statement WebKit Web SQL (Android/iOS) reports insertId with an old INSERT row id value while the plugin reports insertId: undefined. - In case of a SQL error handler that does not recover the transaction, WebKit Web SQL (Android/iOS) would incorrectly report error code 0 while the plugin would report the same error code as in the SQL error handler. (In case of an error with no SQL error handler then Android/iOS WebKit Web SQL would report the same error code that would have been reported in the SQL error hander.) - In case a transaction function throws an exception, the message and code if present are reported by the plugin but *not* by (WebKit) Web SQL. - SQL error messages are inconsistent on Windows. diff --git a/package.json b/package.json index 45b1b8bf..9e09d9bc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cordova-sqlite-storage", - "version": "1.5.4-pre3", + "version": "1.5.4-pre4", "description": "Native interface to SQLite for PhoneGap/Cordova", "cordova": { "id": "cordova-sqlite-storage", diff --git a/plugin.xml b/plugin.xml index da3ca9c7..7b83db53 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="1.5.4-pre4"> Cordova sqlite storage plugin diff --git a/spec/www/spec/basic-db-tx-sql-storage-results.js b/spec/www/spec/basic-db-tx-sql-storage-results.js index 4b7d8a83..2ad14b56 100644 --- a/spec/www/spec/basic-db-tx-sql-storage-results.js +++ b/spec/www/spec/basic-db-tx-sql-storage-results.js @@ -886,7 +886,7 @@ var mytests = function() { }); - it(suiteName + 'INSERT OR IGNORE result in case of constraint violation [iOS/macOS PLUGIN & Andriod/iOS WebKit Web SQL BROKEN: reports old insertId value]', function(done) { + it(suiteName + 'INSERT OR IGNORE result in case of constraint violation [(WebKit) Web SQL DEVIATION on Android/iOS: reports old insertId value]', function(done) { var db = openDatabase('INSERT-OR-IGNORE-test.db', '1.0', 'Test', DEFAULT_SIZE); db.transaction(function(tx) { @@ -917,8 +917,8 @@ var mytests = function() { // NOTE: According to https://www.w3.org/TR/webdatabase/#database-query-results (section 4.5) // this access should really raise an INVALID_ACCESS_ERR exception. var checkInsertId = rs1.insertId; - if (isWebSql || isMac || (!isWindows && !isAndroid)) - expect(checkInsertId).toBe(2); // BROKEN: OLD insertId value iOS/macOS plugin & Andriod/iOS WebKit Web SQL + if (isWebSql) + expect(checkInsertId).toBe(2); // Andriod/iOS WebKit Web SQL DEVIATION: OLD insertId value else expect(checkInsertId).toBe(undefined); diff --git a/src/ios/SQLitePlugin.m b/src/ios/SQLitePlugin.m index c7e29345..614ab2d8 100755 --- a/src/ios/SQLitePlugin.m +++ b/src/ios/SQLitePlugin.m @@ -408,7 +408,7 @@ -(CDVPluginResult*) executeSqlWithDict: (NSMutableDictionary*)options andArgs: ( diffRowsAffected = nowRowsAffected - previousRowsAffected; rowsAffected = [NSNumber numberWithInt:diffRowsAffected]; nowInsertId = sqlite3_last_insert_rowid(db); - if (nowRowsAffected > 0 && nowInsertId != 0) { + if (diffRowsAffected > 0 && nowInsertId != 0) { hasInsertId = YES; insertId = [NSNumber numberWithLongLong:sqlite3_last_insert_rowid(db)]; } From f771ee646859e572fc223719dcc89e73de2f8040 Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Mon, 3 Apr 2017 13:03:31 +0200 Subject: [PATCH 19/29] cordova-sqlite-storage 1.5.4 - Fix iOS/macOS version to report undefined insertId in case INSERT OR IGNORE is ignored - Fix FIRST_WORD check for android.sqlite.database implementation - SQLite 3.15.2 build fixes - Doc updates --- CHANGES.md | 3 ++- README.md | 10 ++-------- package.json | 2 +- plugin.xml | 2 +- 4 files changed, 6 insertions(+), 11 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index ad243499..8d8a4b34 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,10 +1,11 @@ # Changes -### cordova-sqlite-storage 1.5.4-pre4 +### cordova-sqlite-storage 1.5.4 - Fix iOS/macOS version to report undefined insertId in case INSERT OR IGNORE is ignored - Fix FIRST_WORD check for android.sqlite.database implementation - SQLite 3.15.2 build fixes +- Doc updates ### cordova-sqlite-storage 1.5.3 diff --git a/README.md b/README.md index c8f8f9ba..3db75ae5 100644 --- a/README.md +++ b/README.md @@ -14,10 +14,6 @@ License for iOS/macOS version: MIT only This is the common version which supports the most widely used features and serves as the basis for the other versions. -## Commercial evcore license giveaway - -**Limited time offer:** free commercial license available for [litehelpers / Cordova-sqlite-evcore-extbuild-free](https://github.com/litehelpers/Cordova-sqlite-evcore-extbuild-free) with Android NDK performance/memory enhancements - see [litehelpers/Cordova-sqlite-evcore-extbuild-free#17](https://github.com/litehelpers/Cordova-sqlite-evcore-extbuild-free/issues/17) for details. - ## Available for hire @@ -35,8 +31,6 @@ Other services available include: - Front-end/back-end development - Mentoring and training services -Fixed cost contract assignments are preferred. - For more information: - - @@ -130,7 +124,7 @@ See the [Sample section](#sample) for a sample with a more detailed explanation. - `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 -- A recent version of the Cordova CLI (such as `6.4.0` or `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`) 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`). - 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 options) or [litehelpers / Cordova-sqlite-legacy-build-support](https://github.com/litehelpers/Cordova-sqlite-legacy-build-support) (limited testing, limited updates) - The iOS database location is now mandatory, as documented below. - This version supports the use of two (2) possible Android sqlite database implementations: @@ -469,7 +463,7 @@ Some more known issues are tracked in the [open Cordova-sqlite-storage bugs](htt - The Android version cannot work with more than 100 open db files (due to the threading model used). - SQL error messages on Windows version are not consistent with Android/iOS/macOS versions. - UNICODE `\u2028` (line separator) and `\u2029` (paragraph separator) characters are currently not supported and known to be broken in iOS, macOS, and Android version due to JSON issues reported in [Cordova bug CB-9435](https://issues.apache.org/jira/browse/CB-9435) and [cordova/cordova-discuss#57](https://github.com/cordova/cordova-discuss/issues/57). There *may* be a similar issue with certain other UNICODE characters in the iOS/macOS version (needs further investigation). This is fixed for iOS in: [litehelpers / Cordova-sqlite-evplus-legacy-free](https://github.com/litehelpers/Cordova-sqlite-evplus-legacy-free) and [litehelpers / Cordova-sqlite-evplus-legacy-attach-detach-free](https://github.com/litehelpers/Cordova-sqlite-evplus-legacy-attach-detach-free) (available with GPL or special commercial license options) as well as [litehelpers / Cordova-sqlite-evplus-legacy-workers-free](https://github.com/litehelpers/Cordova-sqlite-evplus-legacy-workers-free) (available with GPL or premium commercial license options) -- BLOB type is not supported in this version branch (*reading* of BLOBs is supported by [litehelpers / cordova-sqlite-ext](https://github.com/litehelpers/cordova-sqlite-ext) for Android/iOS) +- BLOB data type is not fully supported by this version branch. SELECT BLOB in Base64 format is supported by [litehelpers / cordova-sqlite-ext](https://github.com/litehelpers/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). - Truncation in case of UNICODE `\u0000` (same as `\0`) character on Android (default Android-sqlite-connector database implementation) and Windows - 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. - iOS/macOS version uses a thread pool but with only one thread working at a time due to "synchronized" database access diff --git a/package.json b/package.json index 9e09d9bc..abed9a46 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cordova-sqlite-storage", - "version": "1.5.4-pre4", + "version": "1.5.4", "description": "Native interface to SQLite for PhoneGap/Cordova", "cordova": { "id": "cordova-sqlite-storage", diff --git a/plugin.xml b/plugin.xml index 7b83db53..7cb66088 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="1.5.4"> Cordova sqlite storage plugin From d21f6e56e59ad091813681108a1c673d5c04dea5 Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Thu, 6 Apr 2017 19:32:20 +0200 Subject: [PATCH 20/29] Drop engines rule from package.json --- CHANGES.md | 4 +++- README.md | 20 ++++---------------- package.json | 7 +------ plugin.xml | 2 +- 4 files changed, 9 insertions(+), 24 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 6ecc5810..cfc25332 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,8 @@ # Changes -## cordova-sqlite-storage 2.0.3-pre1 +## cordova-sqlite-storage 2.0.3-pre2 + +- Drop engines rule from package.json ### cordova-sqlite-storage 1.5.4 diff --git a/README.md b/README.md index 30320d7f..b8401f5e 100644 --- a/README.md +++ b/README.md @@ -130,7 +130,7 @@ See the [Sample section](#sample) for a sample with a more detailed explanation. - This version supports the use of two (2) possible Android sqlite database implementations: - default: lightweight [Android-sqlite-connector](https://github.com/liteglue/Android-sqlite-connector) - optional: built-in Android database classes (usage described below) -- Windows 8.1 and Windows Phone 8.1 are no longer supported by this version. WP8, Windows 8.1, and Windows Phone 8.1 support is available in: [litehelpers / Cordova-sqlite-legacy-build-support](https://github.com/litehelpers/Cordova-sqlite-legacy-build-support) +- Windows 8.1 and Windows Phone 8.1 are no longer supported by this version. WP8 and Windows 8.1/Windows Phone 8.1/Windows 10 support for Visual Studio 2015 is available in: [litehelpers / Cordova-sqlite-legacy-build-support](https://github.com/litehelpers/Cordova-sqlite-legacy-build-support) - The following features are available in [litehelpers / cordova-sqlite-ext](https://github.com/litehelpers/cordova-sqlite-ext): - REGEXP (Android/iOS/macOS) - SELECT BLOB data in Base64 format (all platforms Android/iOS/macOS/Windows) @@ -143,7 +143,7 @@ See the [Sample section](#sample) for a sample with a more detailed explanation. - Issue with emojis and other 4-octet UTF-8 characters (apparently not stored correctly) ref: [litehelpers/Cordova-sqlite-storage#564](https://github.com/litehelpers/Cordova-sqlite-storage/issues/564) - Not possible to read BLOB column values - It is **not** possible to use this plugin with the default "Any CPU" target. A specific target CPU type **must** be specified when building an app with this plugin. - - This version branch with dependency on platform toolset libraries included by Visual Studio 2017 ~~(RC)~~ ref: [litehelpers/Cordova-sqlite-storage#580](https://github.com/litehelpers/Cordova-sqlite-storage/issues/580) + - This version has dependency on platform toolset libraries included by Visual Studio 2017 ([litehelpers/Cordova-sqlite-storage#580](https://github.com/litehelpers/Cordova-sqlite-storage/issues/580)). Visual Studio 2015 is now supported by [litehelpers / Cordova-sqlite-legacy-build-support](https://github.com/litehelpers/Cordova-sqlite-legacy-build-support). - Windows version uses `UTF-16le` internal database encoding while the other platform versions use `UTF-8` internal encoding. (`UTF-8` internal encoding is preferred ref: [litehelpers/Cordova-sqlite-storage#652](https://github.com/litehelpers/Cordova-sqlite-storage/issues/652)) - macOS version ("osx" platform) has not been tested in a release build and should be considered pre-alpha. - FTS3, FTS4, and R-Tree support is tested working OK in this version (for all target platforms in this version branch Android/iOS/macOS/Windows) @@ -155,7 +155,7 @@ See the [Sample section](#sample) for a sample with a more detailed explanation. ## Announcements -- This version references Windows platform toolset v141 to support Visual Studio 2017 ~~(RC)~~. +- This version references Windows platform toolset v141 to support Visual Studio 2017. Visual Studio 2015 is now supported by [litehelpers / Cordova-sqlite-legacy-build-support](https://github.com/litehelpers/Cordova-sqlite-legacy-build-support). - [brodybits / cordova-sqlite-storage-starter-app](https://github.com/brodybits/cordova-sqlite-storage-starter-app) project is a CC0 (public domain) starting point and may also be used to reproduce issues with this plugin. In addition [brodybits / cordova-sqlite-test-app](https://github.com/brodybits/cordova-sqlite-test-app) may be used to reproduce issues with other versions of this plugin. - The Lawnchair adapter is now moved to [litehelpers / cordova-sqlite-lawnchair-adapter](https://github.com/litehelpers/cordova-sqlite-lawnchair-adapter). - [litehelpers / cordova-sqlite-ext](https://github.com/litehelpers/cordova-sqlite-ext) now supports SELECT BLOB data in Base64 format on all platforms in addition to REGEXP (Android/iOS/macOS) and pre-populated database (all platforms). @@ -237,12 +237,6 @@ Use the following command to install this plugin from the Cordova CLI: cordova plugin add cordova-sqlite-storage --save ``` -**NOTICE _(TBD GOING AWAY)_:** In case of using Cordova CLI with Visual Studio 2015 the following command is required (ref: [litehelpers/Cordova-sqlite-storage#599](https://github.com/litehelpers/Cordova-sqlite-storage/issues/599)): - -```shell -cordova plugin add cordova-sqlite-storage@latest --save -``` - Add any desired platform(s) if not already present, for example: ```shell @@ -538,7 +532,7 @@ Some more limitations are tracked in the [open Cordova-sqlite-storage documentat - This plugin does **not** work with the default "Any CPU" target. A specific, valid CPU target platform **must** be specified. - It is **not** allowed to change the app ID in the Windows platform project. As described in the **Windows platform usage** of the [Installing](#installing) section a Windows-specific app ID may be declared using the `windows-identity-name` attribute or "WindowsStoreIdentityName" setting. - A problem locating `SQLite3.md` generally means that there was a problem building the C++ library. -- _TBD GOING AWAY:_ When using Cordova CLI with Visual Studio 2015 the following command must be used to avoid a build error (ref: [litehelpers/Cordova-sqlite-storage#599](https://github.com/litehelpers/Cordova-sqlite-storage/issues/599)): `cordova plugin add cordova-sqlite-storage@latest --save` +- Visual Studio 2015 is no longer supported by this version. Visual Studio 2015 is now supported by [litehelpers / Cordova-sqlite-legacy-build-support](https://github.com/litehelpers/Cordova-sqlite-legacy-build-support). ### General Cordova pitfalls @@ -1174,12 +1168,6 @@ cordova platform add # repeat for all desired platform(s) cordova prepare # OPTIONAL (MANDATORY cordova-ios older than 4.3.0 (Cordova CLI 6.4.0)) ``` -**NOTICE _(TBD GOING AWAY)_:** In case of using Cordova CLI with Visual Studio 2015 the following command is required (ref: [litehelpers/Cordova-sqlite-storage#599](https://github.com/litehelpers/Cordova-sqlite-storage/issues/599)): - -```shell -cordova plugin add cordova-sqlite-storage@latest --save -``` - **Additional Cordova CLI NOTES:** - It is recommended to add *all* plugins including standard plugins such as `cordova-plugin-whitelist` with the `--save` flag to track these in `config.xml`. diff --git a/package.json b/package.json index eb0196b0..578df93d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cordova-sqlite-storage", - "version": "2.0.3-pre1", + "version": "2.0.3-pre2", "description": "Native interface to SQLite for PhoneGap/Cordova", "cordova": { "id": "cordova-sqlite-storage", @@ -10,11 +10,6 @@ "windows" ] }, - "engines": { - "cordovaDependencies": { - "2.0.0": { "cordova-windows": ">4.4.1" } - } - }, "repository": { "type": "git", "url": "https://github.com/litehelpers/Cordova-sqlite-storage.git" diff --git a/plugin.xml b/plugin.xml index d00c6098..d4a60802 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="2.0.3-pre2"> Cordova sqlite storage plugin From af45d6e9057080ca6a7f3dbadbc696c0c2c82570 Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Thu, 6 Apr 2017 21:55:59 +0200 Subject: [PATCH 21/29] cordova-sqlite-storage 2.0.3 - Drop engines rule from package.json - Doc fixes --- CHANGES.md | 3 ++- CONTRIBUTING.md | 16 ++++++++++++++-- HISTORY.md | 4 ++++ README.md | 16 ++++++++-------- package.json | 2 +- plugin.xml | 2 +- 6 files changed, 30 insertions(+), 13 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index cfc25332..bdd08da1 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,8 +1,9 @@ # Changes -## cordova-sqlite-storage 2.0.3-pre2 +## cordova-sqlite-storage 2.0.3 - Drop engines rule from package.json +- Doc fixes ### cordova-sqlite-storage 1.5.4 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b23a05db..63c6af67 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,11 +1,23 @@ -## Bugs and other issues +# General + +**IMPORTANT:** Please raise general questions in [litehelpers / Cordova-sqlite-help / issues](https://github.com/litehelpers/Cordova-sqlite-help/issues). + +## Reproducible bugs - Verify the results of calling the echoTest and selfTest functions as described in README.md - Check the pitfalls and other troubleshooting steps in README.md and [brodybits / Avoiding-some-Cordova-pitfalls](https://github.com/brodybits/Avoiding-some-Cordova-pitfalls) -- Reproduce the issue in a fresh, clean project, ideally based on [brodybits / Cordova-sqlite-bootstrap-test](https://github.com/brodybits/Cordova-sqlite-bootstrap-test) +- Reproduce the issue in a fresh, clean project, preferably based on [brodybits / Cordova-sqlite-bootstrap-test](https://github.com/brodybits/Cordova-sqlite-bootstrap-test) or [brodybits / cordova-sqlite-test-app](https://github.com/brodybits/cordova-sqlite-test-app). Please see README.md for more details. +## Feature requests + +Feature requests are welcome for community discussion and future consideration. Preference will be given to paid customers. Please contact for more information. + +## Other questions + +**NOTE:** As stated above please other questions in [litehelpers / Cordova-sqlite-help / issues](https://github.com/litehelpers/Cordova-sqlite-help/issues). + ## Contributing patches - Patches with bug fixes are helpful, especially when submitted with test code. diff --git a/HISTORY.md b/HISTORY.md index 206ce833..3d2769f1 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -134,6 +134,10 @@ New versions introduced available under GPL or commercial licensing options with support for PhoneGap Build - Cordova-sqlite-evplus (legacy) versions with GPL or premium commercial licensing options +## Major changes 2017 + +Windows platform toolset dependency updated for Visual Studio 2017 + ## Recent changes See CHANGES.md diff --git a/README.md b/README.md index b8401f5e..c407b4ea 100644 --- a/README.md +++ b/README.md @@ -140,7 +140,6 @@ See the [Sample section](#sample) for a sample with a more detailed explanation. - Truncation issue with UNICODE `\u0000` character (same as `\0`) - No background processing - INCORRECT error code (0) and INCONSISTENT error message (missing actual error info) in error callbacks ref: [litehelpers/Cordova-sqlite-storage#539](https://github.com/litehelpers/Cordova-sqlite-storage/issues/539) - - Issue with emojis and other 4-octet UTF-8 characters (apparently not stored correctly) ref: [litehelpers/Cordova-sqlite-storage#564](https://github.com/litehelpers/Cordova-sqlite-storage/issues/564) - Not possible to read BLOB column values - It is **not** possible to use this plugin with the default "Any CPU" target. A specific target CPU type **must** be specified when building an app with this plugin. - This version has dependency on platform toolset libraries included by Visual Studio 2017 ([litehelpers/Cordova-sqlite-storage#580](https://github.com/litehelpers/Cordova-sqlite-storage/issues/580)). Visual Studio 2015 is now supported by [litehelpers / Cordova-sqlite-legacy-build-support](https://github.com/litehelpers/Cordova-sqlite-legacy-build-support). @@ -185,7 +184,7 @@ See the [Sample section](#sample) for a sample with a more detailed explanation. - Also tested with multi-page applications - This project is self-contained though with sqlite3 dependencies auto-fetched by npm. No dependencies on other plugins such as cordova-plugin-file - Windows version uses a customized version of the performant [doo / SQLite3-WinRT](https://github.com/doo/SQLite3-WinRT) C++ component. -- [SQLCipher](https://www.zetetic.net/sqlcipher/) support for Android/iOS/Windows is available at: [litehelpers / Cordova-sqlcipher-adapter](https://github.com/litehelpers/Cordova-sqlcipher-adapter) +- [SQLCipher](https://www.zetetic.net/sqlcipher/) support for Android/iOS/macOS/Windows is available at: [litehelpers / Cordova-sqlcipher-adapter](https://github.com/litehelpers/Cordova-sqlcipher-adapter) - Intellectual property: - All source code is tracked to the original author in git - Major authors are tracked in AUTHORS.md @@ -431,7 +430,7 @@ See **Security of sensitive data** in the [Security](#security) section above. - iOS/macOS version does not support certain rapidly repeated open-and-close or open-and-delete test scenarios due to how the implementation handles background processing - As described below, auto-vacuum is NOT enabled by default. -- The Android and Windows versions do not always handle four-byte UTF-8 characters emoji characters such as `\u1F603` (SMILING FACE, MOUTH OPEN) correctly ref: [litehelpers/Cordova-sqlite-storage#564](https://github.com/litehelpers/Cordova-sqlite-storage/issues/564). It is sometimes possible to store and retrieve such characters but certain operations hex conversions do not work properly with the default [Android-sqlite-connector](https://github.com/liteglue/Android-sqlite-connector) database implementation. It is suspected that such characters would be stored incorrectly in the Android and Windows versions. This is not an issue in case the built-in Android database is used (using the `androidDatabaseImplementation: 2` setting in `window.sqlitePlugin.openDatabase`) +- The Android platform version does not always handle four-byte UTF-8 characters emoji characters such as `\u1F603` (SMILING FACE, MOUTH OPEN) correctly ref: [litehelpers/Cordova-sqlite-storage#564](https://github.com/litehelpers/Cordova-sqlite-storage/issues/564). It is sometimes possible to store and retrieve such characters but certain operations hex conversions do not work properly with the default [Android-sqlite-connector](https://github.com/liteglue/Android-sqlite-connector) database implementation. It is suspected that such characters would be stored incorrectly in the Android platform version. This is not an issue in case the built-in Android database is used (using the `androidDatabaseImplementation: 2` setting in `window.sqlitePlugin.openDatabase`) - It is possible to request a SQL statement list such as "SELECT 1; SELECT 2" within a single SQL statement string, however the plugin will only execute the first statement and silently ignore the others ref: [litehelpers/Cordova-sqlite-storage#551](https://github.com/litehelpers/Cordova-sqlite-storage/issues/551) - INSERT statement that affects multiple rows (due to SELECT cause or using TRIGGER(s), for example) reports incorrect rowsAffected on Android in case the built-in Android database used (using the `androidDatabaseImplementation` option in `window.sqlitePlugin.openDatabase`) - Memory issue observed when adding a large number of records due to the JSON implementation which is improved in [litehelpers / Cordova-sqlite-evcore-extbuild-free](https://github.com/litehelpers/Cordova-sqlite-evcore-extbuild-free) (available with GPL or commercial license options) @@ -483,7 +482,7 @@ Some more limitations are tracked in the [open Cordova-sqlite-storage documentat - Maximum record size supported - Actual behavior when using SAVEPOINT(s) - R-Tree is not fully tested with Android -- UNICODE characters not fully tested +- Some more UNICODE characters - ORDER BY random() (ref: [litehelpers/Cordova-sqlite-storage#334](https://github.com/litehelpers/Cordova-sqlite-storage/issues/334)) - UPDATE/DELETE with LIMIT or ORDER BY (newer Android/iOS versions) - Integration with JXCore for Cordova (must be built without sqlite(3) built-in) @@ -491,10 +490,11 @@ Some more limitations are tracked in the [open Cordova-sqlite-storage documentat - WITH clause (not supported by some older sqlite3 versions) - Handling of invalid transaction and transaction.executeSql arguments - Use of database locations on macOS -- Use of very large REAL numbers such as 1234567890123.4 +- Extremely large and small INTEGER and REAL values ref: [litehelpers/Cordova-sqlite-storage#627](https://github.com/litehelpers/Cordova-sqlite-storage/issues/627)) - More emojis and other 4-octet UTF-8 characters - `?NNN`/`:AAA`/`@AAAA`/`$AAAA` parameter placeholders ref: , ) - Single-statement and SQL batch transaction calls with invalid arguments (TBD behavior subject to change) +- Other [open Cordova-sqlite-storage testing issues](https://github.com/litehelpers/Cordova-sqlite-storage/issues?q=is%3Aissue+is%3Aopen+label%3Atesting) @@ -567,7 +567,7 @@ FUTURE TBD: Proper date/time handling will be further tested and documented at s - IndexedDBShim adapter - 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) -- Resolve [open Cordova-sqlite-storage documentation issues](https://github.com/litehelpers/Cordova-sqlite-storage/issues?q=is%3Aissue+is%3Aopen+label%3Adocumentation) +- Resolve [doc-needed issues on Cordova-sqlite-help](https://github.com/litehelpers/Cordova-sqlite-help/issues?q=is%3Aissue%20label%3Adoc-needed) and [doc-needed issues on Cordova-sqlite-storage](https://github.com/litehelpers/Cordova-sqlite-storage/issues?q=is%3Aissue%20label%3Adoc-needed) ## For future considertion @@ -1304,8 +1304,8 @@ Please include the following: ## Where to ask for help Once you have followed the directions above, you may request free support in the following location(s): -- [litehelpers / Cordova-sqlite-storage / issues](https://github.com/litehelpers/Cordova-sqlite-storage/issues) -- [litehelpers / Cordova-sqlite-help](https://github.com/litehelpers/Cordova-sqlite-help) +- **For reproducible bugs only:** [litehelpers / Cordova-sqlite-storage / issues](https://github.com/litehelpers/Cordova-sqlite-storage/issues) +- **For other questions:** [litehelpers / Cordova-sqlite-help / issues](https://github.com/litehelpers/Cordova-sqlite-help/issues) Please include the information described above otherwise. diff --git a/package.json b/package.json index 578df93d..688f3e10 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cordova-sqlite-storage", - "version": "2.0.3-pre2", + "version": "2.0.3", "description": "Native interface to SQLite for PhoneGap/Cordova", "cordova": { "id": "cordova-sqlite-storage", diff --git a/plugin.xml b/plugin.xml index d4a60802..76d783ab 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="2.0.3"> Cordova sqlite storage plugin From 19cdc3200188fdd251e7c51e2bc6cfe338742d22 Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Tue, 2 May 2017 01:39:51 +0200 Subject: [PATCH 22/29] General doc updates --- README.md | 90 +++++++++++++++++++++++++++---------------------------- 1 file changed, 44 insertions(+), 46 deletions(-) diff --git a/README.md b/README.md index c407b4ea..7853bfdf 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,20 @@ -# Cordova/PhoneGap sqlite storage adapter +# Cordova/PhoneGap sqlite storage plugin Native interface to sqlite in a Cordova/PhoneGap plugin for Android, iOS, macOS, and Windows 10 (UWP), with API similar to HTML5/[Web SQL API](http://www.w3.org/TR/webdatabase/). -License for Android and Windows versions: MIT or Apache 2.0 +License for Android and Windows platform versions: MIT or Apache 2.0 -License for iOS/macOS version: MIT only +License for iOS/macOS platform version: MIT only |Android Circle-CI (**full** suite)|iOS Travis-CI (partial suite)| |-----------------------|----------------------| |[![Circle CI](https://circleci.com/gh/litehelpers/Cordova-sqlite-storage.svg?style=svg)](https://circleci.com/gh/litehelpers/Cordova-sqlite-storage)|[![Build Status](https://travis-ci.org/litehelpers/Cordova-sqlite-storage.svg)](https://travis-ci.org/litehelpers/Cordova-sqlite-storage)| -## About this version +## About this version branch -This is the common version which supports the most widely used features and serves as the basis for the other versions. +This is the common version branch which supports the most widely used features and serves as the basis for the other versions. - + ## Available for hire @@ -135,16 +135,16 @@ See the [Sample section](#sample) for a sample with a more detailed explanation. - REGEXP (Android/iOS/macOS) - SELECT BLOB data in Base64 format (all platforms Android/iOS/macOS/Windows) - Pre-populated database (Android/iOS/macOS/Windows) -- Amazon Fire-OS is dropped due to lack of support by Cordova. Android version should be used to deploy to Fire-OS 5.0(+) devices. For reference: [cordova/cordova-discuss#32 (comment)](https://github.com/cordova/cordova-discuss/issues/32#issuecomment-167021676) -- Windows version (using a customized version of the performant [doo / SQLite3-WinRT](https://github.com/doo/SQLite3-WinRT) C++ component) has the following known limitations: +- Amazon Fire-OS is dropped due to lack of support by Cordova. Android platform version should be used to deploy to Fire-OS 5.0(+) devices. For reference: [cordova/cordova-discuss#32 (comment)](https://github.com/cordova/cordova-discuss/issues/32#issuecomment-167021676) +- Windows platform version (using a customized version of the performant [doo / SQLite3-WinRT](https://github.com/doo/SQLite3-WinRT) C++ component) has the following known limitations: - Truncation issue with UNICODE `\u0000` character (same as `\0`) - No background processing - INCORRECT error code (0) and INCONSISTENT error message (missing actual error info) in error callbacks ref: [litehelpers/Cordova-sqlite-storage#539](https://github.com/litehelpers/Cordova-sqlite-storage/issues/539) - Not possible to read BLOB column values - It is **not** possible to use this plugin with the default "Any CPU" target. A specific target CPU type **must** be specified when building an app with this plugin. - This version has dependency on platform toolset libraries included by Visual Studio 2017 ([litehelpers/Cordova-sqlite-storage#580](https://github.com/litehelpers/Cordova-sqlite-storage/issues/580)). Visual Studio 2015 is now supported by [litehelpers / Cordova-sqlite-legacy-build-support](https://github.com/litehelpers/Cordova-sqlite-legacy-build-support). - - Windows version uses `UTF-16le` internal database encoding while the other platform versions use `UTF-8` internal encoding. (`UTF-8` internal encoding is preferred ref: [litehelpers/Cordova-sqlite-storage#652](https://github.com/litehelpers/Cordova-sqlite-storage/issues/652)) -- macOS version ("osx" platform) has not been tested in a release build and should be considered pre-alpha. + - Windows platform version uses `UTF-16le` internal database encoding while the other platform versions use `UTF-8` internal encoding. (`UTF-8` internal encoding is preferred ref: [litehelpers/Cordova-sqlite-storage#652](https://github.com/litehelpers/Cordova-sqlite-storage/issues/652)) +- The macOS platform version ("osx" platform) has not been tested in a release build and should be considered pre-alpha. - FTS3, FTS4, and R-Tree support is tested working OK in this version (for all target platforms in this version branch Android/iOS/macOS/Windows) - Android is supported back to SDK 10 (a.k.a. Gingerbread, Android 2.3.3); support for older versions is available upon request. - iOS versions supported: 8.x/9.x/10.x (see [deviations section](#deviations) below for differences in case of WKWebView) @@ -163,13 +163,11 @@ See the [Sample section](#sample) for a sample with a more detailed explanation. - macOS ("osx" platform) is now supported - New [litehelpers / Cordova-sqlite-evcore-extbuild-free](https://github.com/litehelpers/Cordova-sqlite-evcore-extbuild-free) version with Android JSON and SQL statement handling implemented in C, as well as support for PhoneGap Build, Intel XDK, etc., available with GPL or commercial license options. Handles large SQL batches in less than half the time as this 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 version uses the lightweight [Android-sqlite-connector](https://github.com/liteglue/Android-sqlite-connector) by default configuration (may be changed as described below) -- Self-test functions to verify proper installation and operation of this plugin +- Android platform version uses the lightweight [Android-sqlite-connector](https://github.com/liteglue/Android-sqlite-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 simple sql batch function - [MetaMemoryT / websql-promise](https://github.com/MetaMemoryT/websql-promise) now provides a Promises-based interface to both Web SQL and this plugin -- iOS version is now fixed to override the correct pluginInitialize method and should work with recent versions of iOS -- [SQLCipher](https://www.zetetic.net/sqlcipher/) for Android/iOS/Windows is supported by [litehelpers / Cordova-sqlcipher-adapter](https://github.com/litehelpers/Cordova-sqlcipher-adapter) @@ -177,14 +175,14 @@ See the [Sample section](#sample) for a sample with a more detailed explanation. - Drop-in replacement for HTML5/[Web SQL API](http://www.w3.org/TR/webdatabase/): the only change should be to replace the static `window.openDatabase()` factory call with `window.sqlitePlugin.openDatabase()`, with parameters as documented below. Known deviations are documented in the [deviations section](#deviations) below. - Failure-safe nested transactions with batch processing optimizations (according to HTML5/[Web SQL API](http://www.w3.org/TR/webdatabase/)) -- API is designed to be as flexible as possible but does not allow the application to leave any transactions hanging open. +- API (based on HTML5/[Web SQL API](http://www.w3.org/TR/webdatabase/)) is designed to be as flexible as possible but does not allow any transactions to be kept hanging open. - As described in [this posting](http://brodyspark.blogspot.com/2012/12/cordovaphonegap-sqlite-plugins-offer.html): - - Keeps sqlite database in a user data location that is known; can be reconfigured (iOS version); and may be synchronized to iCloud (iOS version). - - No extra size limit. SQLite limits described at: -- Also tested with multi-page applications -- This project is self-contained though with sqlite3 dependencies auto-fetched by npm. No dependencies on other plugins such as cordova-plugin-file -- Windows version uses a customized version of the performant [doo / SQLite3-WinRT](https://github.com/doo/SQLite3-WinRT) C++ component. -- [SQLCipher](https://www.zetetic.net/sqlcipher/) support for Android/iOS/macOS/Windows is available at: [litehelpers / Cordova-sqlcipher-adapter](https://github.com/litehelpers/Cordova-sqlcipher-adapter) + - Keeps sqlite database in known, platform specific user data location on all platforms (Android/iOS/macOS/Windows), which can be reconfigured on iOS/macOS. Whether or not the database on the iOS platform is synchronized to iCloud depends on the selected database location. + - No arbitrary size limit. SQLite limits described at: +- Also tested with multi-page applications (XXX BUG: possible transaction issue after window.location (page) change, with possible data loss ref: [litehelpers/Cordova-sqlite-storage#666](https://github.com/litehelpers/Cordova-sqlite-storage/issues/666)) +- This project is self-contained though with sqlite3 dependencies auto-fetched by npm. There are no dependencies on other plugins such as cordova-plugin-file. +- Windows platform version uses a customized version of the performant [doo / SQLite3-WinRT](https://github.com/doo/SQLite3-WinRT) C++ component. +- [SQLCipher](https://www.zetetic.net/sqlcipher/) support for Android/iOS/macOS/Windows is available in: [litehelpers / Cordova-sqlcipher-adapter](https://github.com/litehelpers/Cordova-sqlcipher-adapter) - Intellectual property: - All source code is tracked to the original author in git - Major authors are tracked in AUTHORS.md @@ -350,7 +348,7 @@ Other plugin tutorials wanted ref: [litehelpers/Cordova-sqlite-storage#609](http - [Trailforks Mountain Bike Trail Map App](http://www.trailforks.com/apps/map/) with a couple of nice videos at: - [Get It Done app](http://getitdoneapp.com/) by [marcucio.com](http://marcucio.com/) - [KAAHE Health Encyclopedia](http://www.kaahe.org/en/index.php?option=com_content&view=article&id=817): Official health app of the Kingdom of Saudi Arabia. -- [Larkwire](http://www.larkwire.com/) (iOS version): Learn bird songs the fun way +- [Larkwire](http://www.larkwire.com/) (iOS platform): Learn bird songs the fun way - [Tangorin](https://play.google.com/store/apps/details?id=com.tangorin.app) (Android) Japanese Dictionary at [tangorin.com](http://tangorin.com/) - [GeoWiz.Biz](http://www.geowiz.biz/) Truck Tracker app with a [Personal Edition](http://geowiz.biz/personal-edition-login) available in the Android and iOS app stores @@ -428,21 +426,21 @@ See **Security of sensitive data** in the [Security](#security) section above. ## Known issues -- iOS/macOS version does not support certain rapidly repeated open-and-close or open-and-delete test scenarios due to how the implementation handles background processing +- The iOS/macOS platform version does not support certain rapidly repeated open-and-close or open-and-delete test scenarios due to how the implementation handles background processing. - As described below, auto-vacuum is NOT enabled by default. -- The Android platform version does not always handle four-byte UTF-8 characters emoji characters such as `\u1F603` (SMILING FACE, MOUTH OPEN) correctly ref: [litehelpers/Cordova-sqlite-storage#564](https://github.com/litehelpers/Cordova-sqlite-storage/issues/564). It is sometimes possible to store and retrieve such characters but certain operations hex conversions do not work properly with the default [Android-sqlite-connector](https://github.com/liteglue/Android-sqlite-connector) database implementation. It is suspected that such characters would be stored incorrectly in the Android platform version. This is not an issue in case the built-in Android database is used (using the `androidDatabaseImplementation: 2` setting in `window.sqlitePlugin.openDatabase`) +- The Android platform version does not always handle four-byte UTF-8 characters emoji characters such as `\u1F603` (SMILING FACE, MOUTH OPEN) correctly ref: [litehelpers/Cordova-sqlite-storage#564](https://github.com/litehelpers/Cordova-sqlite-storage/issues/564). It is sometimes possible to store and retrieve such characters but certain operations such as hex conversions do not work properly with the default [Android-sqlite-connector](https://github.com/liteglue/Android-sqlite-connector) database implementation. It is suspected that such characters would be stored incorrectly by the default Android platform version. This is not an issue in case the built-in Android database is used (using the `androidDatabaseImplementation: 2` setting in `window.sqlitePlugin.openDatabase`) - It is possible to request a SQL statement list such as "SELECT 1; SELECT 2" within a single SQL statement string, however the plugin will only execute the first statement and silently ignore the others ref: [litehelpers/Cordova-sqlite-storage#551](https://github.com/litehelpers/Cordova-sqlite-storage/issues/551) - INSERT statement that affects multiple rows (due to SELECT cause or using TRIGGER(s), for example) reports incorrect rowsAffected on Android in case the built-in Android database used (using the `androidDatabaseImplementation` option in `window.sqlitePlugin.openDatabase`) - Memory issue observed when adding a large number of records due to the JSON implementation which is improved in [litehelpers / Cordova-sqlite-evcore-extbuild-free](https://github.com/litehelpers/Cordova-sqlite-evcore-extbuild-free) (available with GPL or commercial license options) - Infinity (positive or negative) values are not supported on Android/iOS/macOS due to issues described above including a possible crash on iOS/macOS ref: [litehelpers/Cordova-sqlite-storage#405](https://github.com/litehelpers/Cordova-sqlite-storage/issues/405) -- A stability issue was reported on the iOS version when in use together with [SockJS](http://sockjs.org/) client such as [pusher-js](https://github.com/pusher/pusher-js) at the same time (see [litehelpers/Cordova-sqlite-storage#196](https://github.com/litehelpers/Cordova-sqlite-storage/issues/196)). The workaround is to call sqlite functions and [SockJS](http://sockjs.org/) client functions in separate ticks (using setTimeout with 0 timeout). +- A stability issue was reported on the iOS platform version when in use together with [SockJS](http://sockjs.org/) client such as [pusher-js](https://github.com/pusher/pusher-js) at the same time (see [litehelpers/Cordova-sqlite-storage#196](https://github.com/litehelpers/Cordova-sqlite-storage/issues/196)). The workaround is to call sqlite functions and [SockJS](http://sockjs.org/) client functions in separate ticks (using setTimeout with 0 timeout). - SQL errors are reported with an INCORRECT error code (0) on Windows ref: [litehelpers/Cordova-sqlite-storage#539](https://github.com/litehelpers/Cordova-sqlite-storage/issues/539). In certain cases SQL errors are also reported with error code 0 on Android in case the built-in Android database is used (using the `androidDatabaseImplementation: 2` setting in `window.sqlitePlugin.openDatabase`). - Possible crash on Android when using Unicode emoji and other 4-octet UTF-8 characters due to [Android bug 81341](https://code.google.com/p/android/issues/detail?id=81341), which *should* be fixed in Android 6.x - Close/delete database bugs described below. -- When a database is opened and deleted without closing, the iOS/macOS version is known to leak resources. -- It is NOT possible to open multiple databases with the same name but in different locations (iOS/macOS). +- When a database is opened and deleted without closing, the iOS/macOS platform version is known to leak resources. +- It is NOT possible to open multiple databases with the same name but in different locations (iOS/macOS platform version). -Some more known issues are tracked in the [open Cordova-sqlite-storage bugs](https://github.com/litehelpers/Cordova-sqlite-storage/issues?q=is%3Aissue+is%3Aopen+label%3Abug). +Some more known issues are tracked in the [open cordova-sqlite-storage bug-general issues](https://github.com/litehelpers/Cordova-sqlite-storage/issues?q=is%3Aissue+is%3Aopen+label%3Abug-general). @@ -451,17 +449,17 @@ Some more known issues are tracked in the [open Cordova-sqlite-storage bugs](htt - ~~The db version, display name, and size parameter values are not supported and will be ignored.~~ (No longer supported by the API) - Absolute and relative subdirectory path(s) are not tested or supported. - This plugin will not work before the callback for the 'deviceready' event has been fired, as described in **Usage**. (This is consistent with the other Cordova plugins.) -- This plugin cannot support large records. TBD: specify maximum record; FUTURE TBD: to be fixed in [litehelpers / Cordova-sqlite-evcore-extbuild-free](https://github.com/litehelpers/Cordova-sqlite-evcore-extbuild-free) (available with GPL or commercial license options) -- This version will not work within a web worker (not properly supported by the Cordova framework). Use within a web worker is supported for Android and iOS in: [litehelpers / Cordova-sqlite-evplus-legacy-workers-free](https://github.com/litehelpers/Cordova-sqlite-evplus-legacy-workers-free) (available with GPL or premium commercial license options) +- Extremely large records are not supported by this plugin version. It is recommended to store images and similar binary data in separate files. TBD: specify maximum record. For future consideration: support in a version such as [litehelpers / Cordova-sqlite-evcore-extbuild-free](https://github.com/litehelpers/Cordova-sqlite-evcore-extbuild-free) (available with GPL or commercial license options) +- This plugin version will not work within a web worker (not properly supported by the Cordova framework). Use within a web worker is supported for Android and iOS in: [litehelpers / Cordova-sqlite-evplus-legacy-workers-free](https://github.com/litehelpers/Cordova-sqlite-evplus-legacy-workers-free) (available with GPL or premium commercial license options) - In-memory database `db=window.sqlitePlugin.openDatabase({name: ':memory:', ...})` is currently not supported. -- The Android version cannot work with more than 100 open db files (due to the threading model used). -- SQL error messages on Windows version are not consistent with Android/iOS/macOS versions. -- UNICODE `\u2028` (line separator) and `\u2029` (paragraph separator) characters are currently not supported and known to be broken in iOS, macOS, and Android version due to JSON issues reported in [Cordova bug CB-9435](https://issues.apache.org/jira/browse/CB-9435) and [cordova/cordova-discuss#57](https://github.com/cordova/cordova-discuss/issues/57). There *may* be a similar issue with certain other UNICODE characters in the iOS/macOS version (needs further investigation). This is fixed for iOS in: [litehelpers / Cordova-sqlite-evplus-legacy-free](https://github.com/litehelpers/Cordova-sqlite-evplus-legacy-free) and [litehelpers / Cordova-sqlite-evplus-legacy-attach-detach-free](https://github.com/litehelpers/Cordova-sqlite-evplus-legacy-attach-detach-free) (available with GPL or special commercial license options) as well as [litehelpers / Cordova-sqlite-evplus-legacy-workers-free](https://github.com/litehelpers/Cordova-sqlite-evplus-legacy-workers-free) (available with GPL or premium commercial license options) -- BLOB data type is not fully supported by this version branch. SELECT BLOB in Base64 format is supported by [litehelpers / cordova-sqlite-ext](https://github.com/litehelpers/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). +- The Android platform version cannot properly support more than 100 open database files due to the threading model used. +- SQL error messages on Windows platform version are not consistent with Android/iOS/macOS platform versions. +- UNICODE `\u2028` (line separator) and `\u2029` (paragraph separator) characters are currently not supported and known to be broken in iOS, macOS, and Android platform versions due to JSON issues reported in [Cordova bug CB-9435](https://issues.apache.org/jira/browse/CB-9435) and [cordova/cordova-discuss#57](https://github.com/cordova/cordova-discuss/issues/57). This is fixed with a workaround for iOS/macOS in: [litehelpers / Cordova-sqlite-evplus-legacy-free](https://github.com/litehelpers/Cordova-sqlite-evplus-legacy-free) and [litehelpers / Cordova-sqlite-evplus-legacy-attach-detach-free](https://github.com/litehelpers/Cordova-sqlite-evplus-legacy-attach-detach-free) (available with GPL or special commercial license options) as well as [litehelpers / Cordova-sqlite-evplus-legacy-workers-free](https://github.com/litehelpers/Cordova-sqlite-evplus-legacy-workers-free) (available with GPL or premium commercial license options) +- The BLOB data type is not fully supported by this version branch. SELECT BLOB in Base64 format is supported by [litehelpers / cordova-sqlite-ext](https://github.com/litehelpers/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). - Truncation in case of UNICODE `\u0000` (same as `\0`) character on Android (default Android-sqlite-connector database implementation) and Windows - 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. -- iOS/macOS version uses a thread pool but with only one thread working at a time due to "synchronized" database access -- Large query result can be slow, also due to JSON implementation +- The iOS/macOS platform version uses a thread pool but with only one thread working at a time due to "synchronized" database access. +- Some large query results may be slow, also due to the JSON implementation. - ATTACH to another database file is not supported by this version. Attach/detach is supported (along with the memory and iOS UNICODE `\u2028` line separator / `\u2029` paragraph separator fixes) in: [litehelpers / Cordova-sqlite-evplus-legacy-attach-detach-free](https://github.com/litehelpers/Cordova-sqlite-evplus-legacy-attach-detach-free) (available with GPL or special commercial license options) - UPDATE/DELETE with LIMIT or ORDER BY is not supported. - WITH clause is not supported by older Android versions in case the `androidDatabaseImplementation: 2` (built-in android.database implementation) option is used. @@ -469,7 +467,7 @@ Some more known issues are tracked in the [open Cordova-sqlite-storage bugs](htt - 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. -Some more limitations are tracked in the [open Cordova-sqlite-storage documentation issues](https://github.com/litehelpers/Cordova-sqlite-storage/issues?q=is%3Aissue+is%3Aopen+label%3Adocumentation). +Some more limitations are tracked in the [open cordova-sqlite-storage doc-todo issues](https://github.com/litehelpers/Cordova-sqlite-storage/issues?q=is%3Aissue+is%3Aopen+label%3Adoc-todo). @@ -566,13 +564,14 @@ FUTURE TBD: Proper date/time handling will be further tested and documented at s - More formal documentation of API, especially for non-standard functions - IndexedDBShim adapter - 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) -- Resolve [doc-needed issues on Cordova-sqlite-help](https://github.com/litehelpers/Cordova-sqlite-help/issues?q=is%3Aissue%20label%3Adoc-needed) and [doc-needed issues on Cordova-sqlite-storage](https://github.com/litehelpers/Cordova-sqlite-storage/issues?q=is%3Aissue%20label%3Adoc-needed) +- 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) ## For future considertion - Auto-vacuum option - Browser platform +- Support for extremely large records in a version such as [litehelpers / Cordova-sqlite-evcore-extbuild-free](https://github.com/litehelpers/Cordova-sqlite-evcore-extbuild-free) (available with GPL or commercial license options) - Integrate with some other libraries such as Sequelize, Squel.js, WebSqlSync, Persistence.js, Knex, etc. ## Alternatives @@ -611,7 +610,6 @@ FUTURE TBD: Proper date/time handling will be further tested and documented at s - Use [phearme / cordova-ContentProviderPlugin](https://github.com/phearme/cordova-ContentProviderPlugin) to query content providers on Android devices - [ABB-Austin / cordova-plugin-indexeddb-async](https://github.com/ABB-Austin/cordova-plugin-indexeddb-async) - Asynchronous IndexedDB plugin for Cordova that uses [axemclion / IndexedDBShim](https://github.com/axemclion/IndexedDBShim) (Browser/iOS/Android/Windows) and [Thinkwise / cordova-plugin-websql](https://github.com/Thinkwise/cordova-plugin-websql) - (Windows) -- Another sqlite binding for React-Native (iOS version): [almost/react-native-sqlite](https://github.com/almost/react-native-sqlite) - Use [NativeScript](https://www.nativescript.org) with its web view and [NathanaelA / nativescript-sqlite](https://github.com/Natha naelA/nativescript-sqlite) (Android and/or iOS) - Standard HTML5 [local storage](https://en.wikipedia.org/wiki/Web_storage#localStorage) @@ -639,7 +637,7 @@ window.sqlitePlugin.selfTest(successCallback, errorCallback); ## General -- Drop-in replacement for HTML5/[Web SQL API](http://www.w3.org/TR/webdatabase/): the only change should be to replace the static `window.openDatabase()` factory call with `window.sqlitePlugin.openDatabase()`, with parameters as documented below. Some other known deviations are documented below. Please report if you find any other possible deviations. +- Drop-in replacement for HTML5/[Web SQL API](http://www.w3.org/TR/webdatabase/): the only change should be to replace the static `window.openDatabase()` factory call with `window.sqlitePlugin.openDatabase()`, with parameters as documented below. Some other known deviations are documented below. Reports of any other deviations would be appreciated. - Single-page application design is recommended. - In case of a multi-page application the JavaScript used by each page must use `sqlitePlugin.openDatabase` to open the database access handle object before it can access the data. @@ -791,7 +789,7 @@ var db = window.sqlitePlugin.openDatabase({ **IMPORTANT NOTE:** This workaround is *only* applied when using `db.sqlBatch` or `db.transaction()`, *not* applied when running `executeSql()` on the database object. - + ## SQL transactions @@ -1098,7 +1096,7 @@ db.executeSql("SELECT LENGTH('tenletters') AS stringlength", [], function (res) }); ``` -**SECOND BUG:** When a database connection is closed, any queued transactions are left hanging. All pending transactions should be errored when a database connection is closed. +**SECOND BUG:** When a database connection is closed, any queued transactions are left hanging. TODO: All pending transactions should be errored when a database connection is closed. **NOTE:** As described above, if multiple database access handle objects are opened for the same database and one database handle access object is closed, the database is no longer available for the other database handle objects. Possible workarounds: - It is still possible to open one or more new database handle objects on a database that has been closed. @@ -1116,7 +1114,7 @@ window.sqlitePlugin.deleteDatabase({name: 'my.db', location: 'default'}, success with `location` or `iosDatabaseLocation` parameter *required* as described above for `openDatabase` (affects iOS/macOS *only*) -**BUG:** When a database is deleted, any queued transactions for that database are left hanging. All pending transactions should be errored when a database is deleted. +**BUG:** When a database is deleted, any queued transactions for that database are left hanging. TODO: All pending transactions should be errored when a database is deleted. @@ -1290,7 +1288,7 @@ In case of a problem with a pre-populated database, please post your entire proj ## What information is needed for help Please include the following: -- Which platform(s) Android/iOS/macOS/Windows +- Which platform(s) (Android/iOS/macOS/Windows) - Clear description of the issue - A small, complete, self-contained program that demonstrates the problem, preferably as a Github project, based on [brodybits / cordova-sqlite-test-app](https://github.com/brodybits/cordova-sqlite-test-app). ZIP/TGZ/BZ2 archive available from a public link is OK. No RAR or other such formats please. - In case of a Windows build problem please capture the entire compiler output. @@ -1537,7 +1535,7 @@ function closeDB() { - `node_modules`: placeholder for external dependencies - `scripts`: installation hook script to fetch the external dependencies via `npm` - `spec`: test suite using Jasmine (`2.4.1`) -- `tests`: very simple Jasmine test suite that is run on Circle CI (Android version) and Travis CI (iOS version) (used as a placeholder) +- `tests`: very simple Jasmine test suite that is run on Circle CI (Android platform) and Travis CI (iOS platform) (used as a placeholder) From 06ad95b6b1af08cf4d0d34768187ca732177fe08 Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Tue, 2 May 2017 01:39:51 +0200 Subject: [PATCH 23/29] Some test updates --- spec/config.xml | 2 +- .../spec/basic-db-tx-sql-storage-results.js | 7 +++--- spec/www/spec/browser-check-startup.js | 6 ++--- .../spec/db-simultaneous-tx-access-test.js | 2 +- spec/www/spec/db-sql-operations-test.js | 7 +++--- spec/www/spec/db-tx-multiple-update-test.js | 7 +++--- spec/www/spec/db-tx-sql-features-test.js | 7 +++--- spec/www/spec/db-tx-value-bindings-test.js | 2 +- spec/www/spec/ext-tx-blob-test.js | 12 +++------- spec/www/spec/regexp-test.js | 16 +++++++------ spec/www/spec/tx-semantics-test.js | 23 +++++++++++-------- 11 files changed, 47 insertions(+), 44 deletions(-) diff --git a/spec/config.xml b/spec/config.xml index 4177ccb8..bd3ab6fb 100644 --- a/spec/config.xml +++ b/spec/config.xml @@ -1,7 +1,7 @@ - Cordova-sqlite-spec + cordova-sqlite-spec Runs the unit tests suite for the Cordova SQLite plugin. diff --git a/spec/www/spec/basic-db-tx-sql-storage-results.js b/spec/www/spec/basic-db-tx-sql-storage-results.js index 2ad14b56..8f7c7b78 100644 --- a/spec/www/spec/basic-db-tx-sql-storage-results.js +++ b/spec/www/spec/basic-db-tx-sql-storage-results.js @@ -9,9 +9,10 @@ var isWindows = /Windows /.test(navigator.userAgent); // Windows var isAndroid = !isWindows && /Android/.test(navigator.userAgent); var isMac = /Macintosh/.test(navigator.userAgent); -// NOTE: In the core-master branch there is no difference between the default -// implementation and implementation #2. But the test will also apply -// the androidLockWorkaround: 1 option in the case of implementation #2. +// NOTE: While in certain version branches there is no difference between +// the default Android implementation and implementation #2, +// this test script will also apply the androidLockWorkaround: 1 option +// in case of implementation #2. var scenarioList = [ isAndroid ? 'Plugin-implementation-default' : 'Plugin', 'HTML5', diff --git a/spec/www/spec/browser-check-startup.js b/spec/www/spec/browser-check-startup.js index 019ddefe..c0ff2001 100644 --- a/spec/www/spec/browser-check-startup.js +++ b/spec/www/spec/browser-check-startup.js @@ -2,14 +2,14 @@ var MYTIMEOUT = 12000; -var isAndroid = /Android/.test(navigator.userAgent); var isWP8 = /IEMobile/.test(navigator.userAgent); // Matches WP(7/8/8.1) var isWindows = /Windows /.test(navigator.userAgent); // Windows 8.1/Windows Phone 8.1/Windows 10 +var isAndroid = !isWindows && /Android/.test(navigator.userAgent); var isMac = /Macintosh/.test(navigator.userAgent); window.hasBrowser = true; -// XXX TODO rename to something like window.hasWebKitWebSQL here and -// in actual test scripts +// XXX FUTURE TODO rename to something like window.hasWebKitWebSQL here +// and in actual test scripts window.hasWebKitBrowser = (!isWindows && !isWP8 && !isMac && (isAndroid || !(window.webkit && window.webkit.messageHandlers))); describe('check startup', function() { diff --git a/spec/www/spec/db-simultaneous-tx-access-test.js b/spec/www/spec/db-simultaneous-tx-access-test.js index b397f6a3..996373c4 100755 --- a/spec/www/spec/db-simultaneous-tx-access-test.js +++ b/spec/www/spec/db-simultaneous-tx-access-test.js @@ -30,7 +30,7 @@ function start(n) { if (wait == 0) test_it_done(); } -var isWindows = /Windows /.test(navigator.userAgent); // Windows (8.1) +var isWindows = /Windows /.test(navigator.userAgent); // Windows 8.1/Windows Phone 8.1/Windows 10 var isAndroid = !isWindows && /Android/.test(navigator.userAgent); // NOTE: In the common storage-master branch there is no difference between the diff --git a/spec/www/spec/db-sql-operations-test.js b/spec/www/spec/db-sql-operations-test.js index a5ed27b7..628266e0 100755 --- a/spec/www/spec/db-sql-operations-test.js +++ b/spec/www/spec/db-sql-operations-test.js @@ -35,9 +35,10 @@ var isAndroid = !isWindows && /Android/.test(navigator.userAgent); var isMac = /Macintosh/.test(navigator.userAgent); var isWKWebView = !isWindows && !isAndroid && !isWP8 && !isMac && !!window.webkit && !!window.webkit.messageHandlers; -// NOTE: In the common storage-master branch there is no difference between the -// default implementation and implementation #2. But the test will also apply -// the androidLockWorkaround: 1 option in the case of implementation #2. +// NOTE: While in certain version branches there is no difference between +// the default Android implementation and implementation #2, +// this test script will also apply the androidLockWorkaround: 1 option +// in case of implementation #2. var scenarioList = [ isAndroid ? 'Plugin-implementation-default' : 'Plugin', 'HTML5', diff --git a/spec/www/spec/db-tx-multiple-update-test.js b/spec/www/spec/db-tx-multiple-update-test.js index 2b8211fd..83fe5f44 100755 --- a/spec/www/spec/db-tx-multiple-update-test.js +++ b/spec/www/spec/db-tx-multiple-update-test.js @@ -31,9 +31,10 @@ function start(n) { var isWindows = /Windows /.test(navigator.userAgent); // Windows var isAndroid = !isWindows && /Android/.test(navigator.userAgent); -// NOTE: In the common storage-master branch there is no difference between the -// default implementation and implementation #2. But the test will also apply -// the androidLockWorkaround: 1 option in the case of implementation #2. +// NOTE: While in certain version branches there is no difference between +// the default Android implementation and implementation #2, +// this test script will also apply the androidLockWorkaround: 1 option +// in case of implementation #2. var scenarioList = [ isAndroid ? 'Plugin-implementation-default' : 'Plugin', 'HTML5', diff --git a/spec/www/spec/db-tx-sql-features-test.js b/spec/www/spec/db-tx-sql-features-test.js index a272e6eb..283551a7 100644 --- a/spec/www/spec/db-tx-sql-features-test.js +++ b/spec/www/spec/db-tx-sql-features-test.js @@ -8,9 +8,10 @@ var isWP8 = /IEMobile/.test(navigator.userAgent); // Matches WP(7/8/8.1) var isWindows = /Windows /.test(navigator.userAgent); // Windows var isAndroid = !isWindows && /Android/.test(navigator.userAgent); -// NOTE: In the common storage-master branch there is no difference between the -// default implementation and implementation #2. But the test will also apply -// the androidLockWorkaround: 1 option in the case of implementation #2. +// NOTE: While in certain version branches there is no difference between +// the default Android implementation and implementation #2, +// this test script will also apply the androidLockWorkaround: 1 option +// in case of implementation #2. var scenarioList = [ isAndroid ? 'Plugin-implementation-default' : 'Plugin', 'HTML5', diff --git a/spec/www/spec/db-tx-value-bindings-test.js b/spec/www/spec/db-tx-value-bindings-test.js index 419c657e..cd5be8c3 100755 --- a/spec/www/spec/db-tx-value-bindings-test.js +++ b/spec/www/spec/db-tx-value-bindings-test.js @@ -5,7 +5,7 @@ var MYTIMEOUT = 12000; var DEFAULT_SIZE = 5000000; // max to avoid popup in safari/ios var isWP8 = /IEMobile/.test(navigator.userAgent); // Matches WP(7/8/8.1) -var isWindows = /Windows /.test(navigator.userAgent); // Windows (8.1) +var isWindows = /Windows /.test(navigator.userAgent); // Windows 8.1/Windows Phone 8.1/Windows 10 var isAndroid = !isWindows && /Android/.test(navigator.userAgent); var isMac = /Macintosh/.test(navigator.userAgent); var isWKWebView = !isWindows && !isAndroid && !isWP8 && !isMac && !!window.webkit && !!window.webkit.messageHandlers; diff --git a/spec/www/spec/ext-tx-blob-test.js b/spec/www/spec/ext-tx-blob-test.js index a88cb264..705a4bda 100755 --- a/spec/www/spec/ext-tx-blob-test.js +++ b/spec/www/spec/ext-tx-blob-test.js @@ -7,15 +7,9 @@ var DEFAULT_SIZE = 5000000; // max to avoid popup in safari/ios // FUTURE TODO replace in test(s): function ok(test, desc) { expect(test).toBe(true); } -var isAndroid = /Android/.test(navigator.userAgent); var isWP8 = /IEMobile/.test(navigator.userAgent); // Matches WP(7/8/8.1) -//var isWindows = /Windows NT/.test(navigator.userAgent); // Windows [NT] (8.1) -var isWindows = /Windows /.test(navigator.userAgent); // Windows (8.1) -//var isWindowsPC = /Windows NT/.test(navigator.userAgent); // Windows [NT] (8.1) -//var isWindowsPhone_8_1 = /Windows Phone 8.1/.test(navigator.userAgent); // Windows Phone 8.1 -//var isIE = isWindows || isWP8 || isWindowsPhone_8_1; -var isIE = isWindows || isWP8; -var isWebKit = !isIE; // TBD [Android or iOS] +var isWindows = /Windows /.test(navigator.userAgent); // Windows 8.1/Windows Phone 8.1/Windows 10 +var isAndroid = !isWindows && /Android/.test(navigator.userAgent); // NOTE: In the core-master branch there is no difference between the default // implementation and implementation #2. But the test will also apply @@ -32,7 +26,7 @@ var mytests = function() { for (var i=0; i Date: Wed, 3 May 2017 22:36:04 +0200 Subject: [PATCH 24/29] General open/close/delete test updates --- spec/www/spec/db-open-close-delete-test.js | 401 ++++++++++++++------- 1 file changed, 270 insertions(+), 131 deletions(-) diff --git a/spec/www/spec/db-open-close-delete-test.js b/spec/www/spec/db-open-close-delete-test.js index 81044e80..8bbfb76a 100755 --- a/spec/www/spec/db-open-close-delete-test.js +++ b/spec/www/spec/db-open-close-delete-test.js @@ -31,14 +31,13 @@ function start(n) { } var isWP8 = /IEMobile/.test(navigator.userAgent); // Matches WP(7/8/8.1) -var isWindows = /Windows /.test(navigator.userAgent); // Windows (8.1) +var isWindows = /Windows /.test(navigator.userAgent); var isAndroid = !isWindows && /Android/.test(navigator.userAgent); -var isIE = isWindows || isWP8; -var isWebKit = !isIE; // TBD [Android or iOS] -// NOTE: In the core-master branch there is no difference between the default -// implementation and implementation #2. But the test will also apply -// the androidLockWorkaround: 1 option in the case of implementation #2. +// NOTE: While in certain version branches there is no difference between +// the default Android implementation and implementation #2, +// this test script will also apply the androidLockWorkaround: 1 option +// in case of implementation #2. var pluginScenarioList = [ isAndroid ? 'Plugin-implementation-default' : 'Plugin', 'Plugin-implementation-2' @@ -48,11 +47,11 @@ var pluginScenarioCount = isAndroid ? 2 : 1; var mytests = function() { - describe('Plugin - open database file name test(s)', function() { + describe('Open database parameter test(s)', function() { for (var i=0; i Date: Wed, 3 May 2017 23:39:44 +0200 Subject: [PATCH 25/29] Error test updates --- spec/www/spec/db-tx-error-handling-test.js | 202 ++++++++++++++++++++- spec/www/spec/db-tx-error-mapping-test.js | 97 +++++++++- spec/www/spec/tx-semantics-test.js | 5 + 3 files changed, 298 insertions(+), 6 deletions(-) diff --git a/spec/www/spec/db-tx-error-handling-test.js b/spec/www/spec/db-tx-error-handling-test.js index bb2a6efe..4be71971 100644 --- a/spec/www/spec/db-tx-error-handling-test.js +++ b/spec/www/spec/db-tx-error-handling-test.js @@ -8,9 +8,10 @@ var isWP8 = /IEMobile/.test(navigator.userAgent); // Matches WP(7/8/8.1) var isWindows = /Windows /.test(navigator.userAgent); // Windows var isAndroid = !isWindows && /Android/.test(navigator.userAgent); -// NOTE: In the common storage-master branch there is no difference between the -// default implementation and implementation #2. But the test will also apply -// the androidLockWorkaround: 1 option in the case of implementation #2. +// NOTE: While in certain version branches there is no difference between +// the default Android implementation and implementation #2, +// this test script will also apply the androidLockWorkaround: 1 option +// in case of implementation #2. var scenarioList = [ isAndroid ? 'Plugin-implementation-default' : 'Plugin', 'HTML5', @@ -361,6 +362,138 @@ var mytests = function() { }); }, MYTIMEOUT); + it(suiteName + 'transaction ends with error if success callback throws [TBD (WebKit) Web SQL vs plugin error message]', function(done) { + var db = openDatabase('transaction-error-if-success-cb-throws.db') + expect(db).toBeDefined(); + + db.transaction(function(tx) { + expect(tx).toBeDefined(); + + //var check1 = false; + tx.executeSql('SELECT 1', null, function(ignored, rs) { + expect(rs).toBeDefined(); + expect(rs.rows).toBeDefined(); + expect(rs.rows.length).toBe(1); + //check1 = true; + throw new Error('Boom'); + }); + + tx.executeSql('SELECT 1', null, function(ignored1, ignored2) { + // NOT EXPECTED: + expect(false).toBe(true); + + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); + }, function(ignored1, ignored2) { + // NOT EXPECTED: + expect(false).toBe(true); + }); + }, function(error) { + expect(error).toBeDefined(); + expect(error.code).toBeDefined(); + expect(error.message).toBeDefined(); + expect(error.code).toBe(0); + // TBD (WebKit) Web SQL vs plugin: + if (isWebSql) + expect(error.message).toMatch(/callback raised an exception.*or.*error callback did not return false/); + else + expect(error.message).toBe('Boom'); + + // VERIFY we can still continue: + var gotStringLength = false; // poor man's spy + db.transaction(function (tx) { + tx.executeSql("SELECT LENGTH('tenletters') AS stringlength", [], function (txIgnored, rs) { + expect(rs).toBeDefined(); + expect(rs.rows).toBeDefined(); + expect(rs.rows.length).toBe(1); + expect(rs.rows.item(0).stringlength).toBe(10); + gotStringLength = true; + }); + + }, function (error) { + // NOT EXPECTED: + expect(false).toBe(true); + expect(error.message).toBe('--'); + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); + + }, function () { + // EXPECTED RESULT (transaction finished OK): + expect(true).toBe(true); + expect(gotStringLength).toBe(true); + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); + }); + + }); + }, MYTIMEOUT); + + it(suiteName + 'readTransaction ends with error if success callback throws [TBD (WebKit) Web SQL vs plugin error message]', function(done) { + var db = openDatabase('readTransaction-error-if-success-cb-throws.db') + expect(db).toBeDefined(); + + db.readTransaction(function(tx) { + expect(tx).toBeDefined(); + + //var check1 = false; + tx.executeSql('SELECT 1', null, function(ignored, rs) { + expect(rs).toBeDefined(); + expect(rs.rows).toBeDefined(); + expect(rs.rows.length).toBe(1); + //check1 = true; + throw new Error('Boom'); + }); + + tx.executeSql('SELECT 1', null, function(ignored1, ignored2) { + // NOT EXPECTED: + expect(false).toBe(true); + + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); + }, function(ignored1, ignored2) { + // NOT EXPECTED: + expect(false).toBe(true); + }); + }, function(error) { + expect(error).toBeDefined(); + expect(error.code).toBeDefined(); + expect(error.message).toBeDefined(); + expect(error.code).toBe(0); + // TBD (WebKit) Web SQL vs plugin: + if (isWebSql) + expect(error.message).toMatch(/callback raised an exception.*or.*error callback did not return false/); + else + expect(error.message).toBe('Boom'); + + // VERIFY we can still continue: + var gotStringLength = false; // poor man's spy + db.readTransaction(function (tx) { + tx.executeSql("SELECT LENGTH('tenletters') AS stringlength", [], function (txIgnored, rs) { + expect(rs).toBeDefined(); + expect(rs.rows).toBeDefined(); + expect(rs.rows.length).toBe(1); + expect(rs.rows.item(0).stringlength).toBe(10); + gotStringLength = true; + }); + + }, function (error) { + // NOT EXPECTED: + expect(false).toBe(true); + expect(error.message).toBe('--'); + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); + + }, function () { + // EXPECTED RESULT (transaction finished OK): + expect(true).toBe(true); + expect(gotStringLength).toBe(true); + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); + }); + + }); + }, MYTIMEOUT); + }); describe(scenarioList[i] + ': other tx error handling test(s)', function() { @@ -2151,6 +2284,69 @@ var mytests = function() { }, MYTIMEOUT); + it(suiteName + 'transaction.executeSql with undefined for SQL statement (BOGUS)', function (done) { + var db = openDatabase('tx-with-undefined-for-sql-statement.db'); + + var check1 = false; + db.transaction(function(transaction) { + // NOT expected to throw in case of Web SQL: + transaction.executeSql(undefined); + + if (!isWebSql) expect('Plugin behavior changed please update this test').toBe('--'); + check1 = true; + + }, function(error) { + // EXPECTED RESULT: + if (isWebSql) + expect(check1).toBe(true); + expect(error).toBeDefined(); + expect(error.code).toBeDefined() + expect(error.message).toBeDefined(); + + if (!isWebSql) + expect(error.code).toBe(0); + else + expect(error.code).toBe(5); + + if (isWebSql) + expect(error.message).toMatch(/could not prepare statement \(1 near \"undefined\": syntax error\)/); + else if (isWindows) + expect(error.message).toMatch(/Unable to get property 'toString' of undefined or null reference/); + else if (isAndroid) + expect(error.message).toMatch(/Cannot .* 'toString' of undefined/); + else + expect(error.message).toMatch(/undefined is not an object \(evaluating 'sql\.toString'\)/); + + // Verify we can still continue: + var gotStringLength = false; // poor man's spy + db.transaction(function (tx) { + tx.executeSql("SELECT LENGTH('tenletters') AS stringlength", [], function (tx, res) { + expect(res.rows.item(0).stringlength).toBe(10); + gotStringLength = true; + }); + }, function (error) { + // NOT EXPECTED: + expect(false).toBe(true); + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); + + }, function () { + // EXPECTED RESULT (transaction finished OK): + expect(true).toBe(true); + expect(gotStringLength).toBe(true); + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); + }); + + }, function() { + // NOT EXPECTED: + expect(false).toBe(true); + // Close (plugin only) & finish: + (isWebSql) ? done() : db.close(done, done); + }); + + }, MYTIMEOUT); + it(suiteName + 'transaction.executeSql with null for SQL statement (BOGUS)', function (done) { var db = openDatabase("tx-with-null-for-sql-statement.db", "1.0", "Demo", DEFAULT_SIZE); diff --git a/spec/www/spec/db-tx-error-mapping-test.js b/spec/www/spec/db-tx-error-mapping-test.js index f37880a7..f7e346ca 100755 --- a/spec/www/spec/db-tx-error-mapping-test.js +++ b/spec/www/spec/db-tx-error-mapping-test.js @@ -8,9 +8,10 @@ var isWP8 = /IEMobile/.test(navigator.userAgent); // Matches WP(7/8/8.1) var isWindows = /Windows /.test(navigator.userAgent); // Windows var isAndroid = !isWindows && /Android/.test(navigator.userAgent); -// NOTE: In the common storage-master branch there is no difference between the -// default implementation and implementation #2. But the test will also apply -// the androidLockWorkaround: 1 option in the case of implementation #2. +// NOTE: While in certain version branches there is no difference between +// the default Android implementation and implementation #2, +// this test script will also apply the androidLockWorkaround: 1 option +// in case of implementation #2. var scenarioList = [ isAndroid ? 'Plugin-implementation-default' : 'Plugin', 'HTML5', @@ -101,6 +102,11 @@ var mytests = function() { expect(error.code).toBeDefined(); expect(error.message).toBeDefined(); + // error.hasOwnProperty('message') apparently NOT WORKING on + // WebKit Web SQL on Android 5.x/... or iOS 10.x/...: + if (!isWebSql || isWindows || (isAndroid && (/Android [1-4]/.test(navigator.userAgent)))) + expect(error.hasOwnProperty('message')).toBe(true); + if (isWindows || (isAndroid && isImpl2)) expect(error.code).toBe(0); else @@ -127,6 +133,11 @@ var mytests = function() { expect(error.code).toBeDefined(); expect(error.message).toBeDefined(); + // error.hasOwnProperty('message') apparently NOT WORKING on + // WebKit Web SQL on Android 5.x/... or iOS 10.x/...: + if (!isWebSql || isWindows || (isAndroid && (/Android [1-4]/.test(navigator.userAgent)))) + expect(error.hasOwnProperty('message')).toBe(true); + if (isWindows || isWebSql || (isAndroid && isImpl2)) expect(error.code).toBe(0); else @@ -171,6 +182,11 @@ var mytests = function() { expect(error.code).toBeDefined(); expect(error.message).toBeDefined(); + // error.hasOwnProperty('message') apparently NOT WORKING on + // WebKit Web SQL on Android 5.x/... or iOS 10.x/...: + if (!isWebSql || isWindows || (isAndroid && (/Android [1-4]/.test(navigator.userAgent)))) + expect(error.hasOwnProperty('message')).toBe(true); + if (isWindows || (isAndroid && isImpl2)) expect(error.code).toBe(0); else @@ -196,6 +212,11 @@ var mytests = function() { expect(error.code).toBeDefined(); expect(error.message).toBeDefined(); + // error.hasOwnProperty('message') apparently NOT WORKING on + // WebKit Web SQL on Android 5.x/... or iOS 10.x/...: + if (!isWebSql || isWindows || (isAndroid && (/Android [1-4]/.test(navigator.userAgent)))) + expect(error.hasOwnProperty('message')).toBe(true); + if (isWindows || isWebSql || (isAndroid && isImpl2)) expect(error.code).toBe(0); else @@ -247,6 +268,11 @@ var mytests = function() { expect(error.code).toBeDefined(); expect(error.message).toBeDefined(); + // error.hasOwnProperty('message') apparently NOT WORKING on + // WebKit Web SQL on Android 5.x/... or iOS 10.x/...: + if (!isWebSql || isWindows || (isAndroid && (/Android [1-4]/.test(navigator.userAgent)))) + expect(error.hasOwnProperty('message')).toBe(true); + if (isWebSql && !isAndroid) expect(true).toBe(true); // SKIP for iOS (WebKit) Web SQL else if (isWindows) @@ -278,6 +304,11 @@ var mytests = function() { expect(error.code).toBeDefined(); expect(error.message).toBeDefined(); + // error.hasOwnProperty('message') apparently NOT WORKING on + // WebKit Web SQL on Android 5.x/... or iOS 10.x/...: + if (!isWebSql || isWindows || (isAndroid && (/Android [1-4]/.test(navigator.userAgent)))) + expect(error.hasOwnProperty('message')).toBe(true); + if (isWindows || isWebSql) expect(error.code).toBe(0); else @@ -319,6 +350,11 @@ var mytests = function() { expect(error.code).toBeDefined(); expect(error.message).toBeDefined(); + // error.hasOwnProperty('message') apparently NOT WORKING on + // WebKit Web SQL on Android 5.x/... or iOS 10.x/...: + if (!isWebSql || isWindows || (isAndroid && (/Android [1-4]/.test(navigator.userAgent)))) + expect(error.hasOwnProperty('message')).toBe(true); + if (isWindows || (isAndroid && isImpl2)) expect(error.code).toBe(0); else @@ -346,6 +382,11 @@ var mytests = function() { expect(error.code).toBeDefined(); expect(error.message).toBeDefined(); + // error.hasOwnProperty('message') apparently NOT WORKING on + // WebKit Web SQL on Android 5.x/... or iOS 10.x/...: + if (!isWebSql || isWindows || (isAndroid && (/Android [1-4]/.test(navigator.userAgent)))) + expect(error.hasOwnProperty('message')).toBe(true); + if (isWebSql || isWindows || (isAndroid && isImpl2)) expect(error.code).toBe(0); else @@ -388,6 +429,11 @@ var mytests = function() { expect(error.code).toBeDefined(); expect(error.message).toBeDefined(); + // error.hasOwnProperty('message') apparently NOT WORKING on + // WebKit Web SQL on Android 5.x/... or iOS 10.x/...: + if (!isWebSql || isWindows || (isAndroid && (/Android [1-4]/.test(navigator.userAgent)))) + expect(error.hasOwnProperty('message')).toBe(true); + if (isWindows || (isAndroid && isImpl2)) expect(error.code).toBe(0); else @@ -413,6 +459,11 @@ var mytests = function() { expect(error.code).toBeDefined(); expect(error.message).toBeDefined(); + // error.hasOwnProperty('message') apparently NOT WORKING on + // WebKit Web SQL on Android 5.x/... or iOS 10.x/...: + if (!isWebSql || isWindows || (isAndroid && (/Android [1-4]/.test(navigator.userAgent)))) + expect(error.hasOwnProperty('message')).toBe(true); + if (isWebSql || isWindows || (isAndroid && isImpl2)) expect(error.code).toBe(0); else @@ -456,6 +507,11 @@ var mytests = function() { expect(error.code).toBeDefined(); expect(error.message).toBeDefined(); + // error.hasOwnProperty('message') apparently NOT WORKING on + // WebKit Web SQL on Android 5.x/... or iOS 10.x/...: + if (!isWebSql || isWindows || (isAndroid && (/Android [1-4]/.test(navigator.userAgent)))) + expect(error.hasOwnProperty('message')).toBe(true); + if (isWindows || (isAndroid && isImpl2)) expect(error.code).toBe(0); else @@ -482,6 +538,11 @@ var mytests = function() { expect(error.code).toBeDefined(); expect(error.message).toBeDefined(); + // error.hasOwnProperty('message') apparently NOT WORKING on + // WebKit Web SQL on Android 5.x/... or iOS 10.x/...: + if (!isWebSql || isWindows || (isAndroid && (/Android [1-4]/.test(navigator.userAgent)))) + expect(error.hasOwnProperty('message')).toBe(true); + if (isWebSql || isWindows || (isAndroid && isImpl2)) expect(error.code).toBe(0); else @@ -525,6 +586,11 @@ var mytests = function() { expect(error.code).toBeDefined(); expect(error.message).toBeDefined(); + // error.hasOwnProperty('message') apparently NOT WORKING on + // WebKit Web SQL on Android 5.x/... or iOS 10.x/...: + if (!isWebSql || isWindows || (isAndroid && (/Android [1-4]/.test(navigator.userAgent)))) + expect(error.hasOwnProperty('message')).toBe(true); + if (isWindows || (isAndroid && isImpl2)) expect(error.code).toBe(0); else @@ -551,6 +617,11 @@ var mytests = function() { expect(error.code).toBeDefined(); expect(error.message).toBeDefined(); + // error.hasOwnProperty('message') apparently NOT WORKING on + // WebKit Web SQL on Android 5.x/... or iOS 10.x/...: + if (!isWebSql || isWindows || (isAndroid && (/Android [1-4]/.test(navigator.userAgent)))) + expect(error.hasOwnProperty('message')).toBe(true); + if (isWebSql || isWindows || (isAndroid && isImpl2)) expect(error.code).toBe(0); else @@ -596,6 +667,11 @@ var mytests = function() { expect(error.code).toBeDefined(); expect(error.message).toBeDefined(); + // error.hasOwnProperty('message') apparently NOT WORKING on + // WebKit Web SQL on Android 5.x/... or iOS 10.x/...: + if (!isWebSql || isWindows || (isAndroid && (/Android [1-4]/.test(navigator.userAgent)))) + expect(error.hasOwnProperty('message')).toBe(true); + if (isWindows || (!isWebSql && isAndroid && isImpl2)) expect(error.code).toBe(0); else @@ -623,6 +699,11 @@ var mytests = function() { expect(error.code).toBeDefined(); expect(error.message).toBeDefined(); + // error.hasOwnProperty('message') apparently NOT WORKING on + // WebKit Web SQL on Android 5.x/... or iOS 10.x/...: + if (!isWebSql || isWindows || (isAndroid && (/Android [1-4]/.test(navigator.userAgent)))) + expect(error.hasOwnProperty('message')).toBe(true); + if (isWebSql || isWindows || (isAndroid && isImpl2)) expect(error.code).toBe(0); else @@ -657,6 +738,11 @@ var mytests = function() { expect(error.code).toBeDefined(); expect(error.message).toBeDefined(); + // error.hasOwnProperty('message') apparently NOT WORKING on + // WebKit Web SQL on Android 5.x/... or iOS 10.x/...: + if (!isWebSql || isWindows || (isAndroid && (/Android [1-4]/.test(navigator.userAgent)))) + expect(error.hasOwnProperty('message')).toBe(true); + if (isWindows || (isAndroid && isImpl2)) expect(error.code).toBe(0); else @@ -699,6 +785,11 @@ var mytests = function() { expect(error.code).toBeDefined(); expect(error.message).toBeDefined(); + // error.hasOwnProperty('message') apparently NOT WORKING on + // WebKit Web SQL on Android 5.x/... or iOS 10.x/...: + if (!isWebSql || isWindows || (isAndroid && (/Android [1-4]/.test(navigator.userAgent)))) + expect(error.hasOwnProperty('message')).toBe(true); + if (isWebSql && !isAndroid) expect(true).toBe(true); // SKIP for iOS (WebKit) Web SQL else if (isWindows) diff --git a/spec/www/spec/tx-semantics-test.js b/spec/www/spec/tx-semantics-test.js index 766139aa..364cac14 100755 --- a/spec/www/spec/tx-semantics-test.js +++ b/spec/www/spec/tx-semantics-test.js @@ -390,6 +390,11 @@ var mytests = function() { expect(error.code).toBeDefined(); expect(error.message).toBeDefined(); + // error.hasOwnProperty('message') apparently NOT WORKING on + // WebKit Web SQL on Android 5.x/... or iOS 10.x/...: + if (!isWebSql || isWindows || (isAndroid && (/Android [1-4]/.test(navigator.userAgent)))) + expect(error.hasOwnProperty('message')).toBe(true); + expect(error.code).toBe(0); if (isWebSql) From b9e3277705eaf8e9db19bdb8f84b9a5c64fa7277 Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Thu, 26 Oct 2017 17:09:37 -0400 Subject: [PATCH 26/29] README.md add deprecated transaction API notice ref: litehelpers/Cordova-sqlite-storage#720 --- README.md | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index eb3f9a1b..cfc59f54 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,17 @@ License for iOS/macOS platform version: MIT only |-----------------------|----------------------| |[![Circle CI](https://circleci.com/gh/litehelpers/Cordova-sqlite-storage.svg?style=svg)](https://circleci.com/gh/litehelpers/Cordova-sqlite-storage)|[![Build Status](https://travis-ci.org/litehelpers/Cordova-sqlite-storage.svg)](https://travis-ci.org/litehelpers/Cordova-sqlite-storage)| +## IMPORTANT API DEPRECATION NOTICE + +The "standard" transaction API documented in [Standard asynchronous transactions section](#standard-asynchronous-transactions) (`db.transaction()` and `db.readTransaction` calls) are now deprecated in this plugin version and scheduled to be removed from the next major release ref: + +It is recommended to use the following calls instead: + +- `db.executeSql()` to read data or execute a single modification statement +- `db.sqlBatch()` to execute a batch of modification statements within an ACID (atomic, failure-safe) transaction. + +Note that the "standard" (deprecated) transaction API calls will continue to be supported by other plugin versions such as `cordova-sqlite-ext` (permissive license terms) and `cordova-sqlite-evcore-extbuild-free` (GPL or commercial license terms). + ## About this version branch This is the common version branch which supports the most widely used features and serves as the basis for the other versions. @@ -51,6 +62,10 @@ document.addEventListener('deviceready', function() { **IMPORTANT:** Like with the other Cordova plugins your application must wait for the `deviceready` event. This is especially tricky in Angular/ngCordova/Ionic controller/factory/service callbacks which may be triggered before the `deviceready` event is fired. +### Using deprecated transaction API + +**NOTICE:** Support for this API is scheduled to be removed from the next major release ref: . It is recommended to use `db.executeSql()` and `db.sqlBatch()` as described below. + To populate a database using the standard transaction API: ```Javascript @@ -65,7 +80,7 @@ To populate a database using the standard transaction API: }); ``` -To check the data using the standard transaction API: +To check the data using the "standard" (deprecated) transaction API: ```Javascript db.transaction(function(tx) { @@ -77,6 +92,8 @@ To check the data using the standard transaction API: }); ``` +### Using recommended API calls + To populate a database using the SQL batch API: ```Javascript @@ -107,6 +124,7 @@ See the [Sample section](#sample) for a sample with a more detailed explanation. ## Status +- The "standard" transaction API documented in [Standard asynchronous transactions section](#standard-asynchronous-transactions) (`db.transaction()` and `db.readTransaction` calls) are now deprecated in this plugin version and scheduled to be removed from the next major release ref: . It is recommended to use `db.executeSql()` and `db.sqlBatch()` instead, as documented below. NOTE that the "standard", deprecated API calls will NOT be removed from other plugin versions such as `cordova-sqlite-ext` (permissive license terms) or `cordova-sqlite-evcore-extbuild-free` (GPL or commercial license terms). - NOT supported by PhoneGap Developer App or PhoneGap Desktop App - This version uses a `before_plugin_install` hook to install sqlite3 library dependencies from `cordova-sqlite-storage-dependencies` via npm. - SQLite version `3.15.2` included with the following build settings: @@ -798,7 +816,7 @@ var db = window.sqlitePlugin.openDatabase({ The following types of SQL transactions are supported by this version: - Single-statement transactions - SQL batch transactions -- Standard asynchronous transactions +- DEPRECATED and scheduled for removal (): Standard asynchronous transactions **NOTE:** Transaction requests are kept in one queue per database and executed in sequential order, according to the HTML5/[Web SQL API](http://www.w3.org/TR/webdatabase/). @@ -864,7 +882,9 @@ In case of an error, all changes in a sql batch are automatically discarded usin ### Standard asynchronous transactions -Standard asynchronous transactions follow the HTML5/[Web SQL API](http://www.w3.org/TR/webdatabase/) which is very well documented and uses BEGIN and COMMIT or ROLLBACK to keep the transactions failure-safe. Here is a simple example: +**NOTICE:** The "standard" (deprecated) transaction API calls described here (`db.transaction()` and `db.readTransaction()`) are scheduled to be removed from the next major release of this plugin version. It is recommended to use the `db.executeSql()` and `db.sqlBatch()` calls instead, as described above. Note that the "standard" (deprecated) transaction API calls will continue to be supported by other plugin versions such as `cordova-sqlite-ext` (permissive license terms) and `cordova-sqlite-evcore-extbuild-free` (GPL or commercial license terms). + +"Standard" (deprecated) asynchronous transactions follow the HTML5/[Web SQL API](http://www.w3.org/TR/webdatabase/) which is very well documented and uses BEGIN and COMMIT or ROLLBACK to keep the transactions failure-safe. Here is a simple example: ```Javascript db.transaction(function(tx) { @@ -1333,6 +1353,8 @@ To run from a windows powershell (here is a sample for android target): # Adapters +**NOTICE:** These adapters use the deprecated transaction API calls, scheduled to be removed from the next major release of this plugin version ref: . It is recommended to use another sqlite plugin version such as `cordova-sqlite-ext` or `cordova-plugin-sqlite-2` instead. + ## Lawnchair Adapter - [litehelpers / cordova-sqlite-lawnchair-adapter](https://github.com/litehelpers/cordova-sqlite-lawnchair-adapter) @@ -1351,6 +1373,8 @@ To run from a windows powershell (here is a sample for android target): Contributed by [@Mikejo5000 (Mike Jones)](https://github.com/Mikejo5000) from Microsoft. +**WARNING:** The sample below uses deprecated transaction API calls, scheduled to be removed from the next major release of this plugin version ref: . TODO is to rework the sample JavaScript below to use `db.executeSql()` and `db.sqlBatch()` instead. + ## Interact with the SQLite database The SQLite storage plugin sample allows you to execute SQL statements to interact with the database. The code snippets in this section demonstrate simple plugin tasks including: From eeab860bc23f7a6e576ca564e1a215f843771767 Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Fri, 3 Nov 2017 14:03:34 -0400 Subject: [PATCH 27/29] cordova-sqlite-storage 2.1.0 - Visual Studio 2017 updates for Windows UWP build --- CHANGES.md | 4 ++ package.json | 2 +- plugin.xml | 2 +- .../SQLite3/SQLite3.UWP/SQLite3.UWP.vcxproj | 44 ++++++++++++++----- 4 files changed, 40 insertions(+), 12 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 689d8d56..125fe9ce 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,9 @@ # Changes +## cordova-sqlite-storage 2.1.0 + +- Visual Studio 2017 updates for Windows UWP build + ## cordova-sqlite-storage 2.0.4 ###### cordova-sqlite-legacy-express-core 1.0.0 diff --git a/package.json b/package.json index 8b26054e..6cab6221 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cordova-sqlite-storage", - "version": "2.0.4", + "version": "2.1.0", "description": "Native interface to SQLite for PhoneGap/Cordova", "cordova": { "id": "cordova-sqlite-storage", diff --git a/plugin.xml b/plugin.xml index 54e1390e..7e660d81 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="2.1.0"> Cordova sqlite storage plugin diff --git a/src/windows/SQLite3-Win-RT/SQLite3/SQLite3.UWP/SQLite3.UWP.vcxproj b/src/windows/SQLite3-Win-RT/SQLite3/SQLite3.UWP/SQLite3.UWP.vcxproj index b286a67d..b7ac8b96 100644 --- a/src/windows/SQLite3-Win-RT/SQLite3/SQLite3.UWP/SQLite3.UWP.vcxproj +++ b/src/windows/SQLite3-Win-RT/SQLite3/SQLite3.UWP/SQLite3.UWP.vcxproj @@ -1,5 +1,6 @@ - - + + + Debug @@ -26,6 +27,7 @@ x64 + {76e68196-b7dc-4393-a070-d32fc33bc489} WindowsRuntimeComponent @@ -35,11 +37,13 @@ 14.0 true Windows Store - 10.0.14393.0 + 10.0.15063.0 10.0.10240.0 10.0 + + DynamicLibrary true @@ -73,50 +77,68 @@ true v141 + + + - + + + + + + + + + + false + false + false + false + false + false + NotUsing @@ -126,13 +148,13 @@ $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories) /bigobj %(AdditionalOptions) 28204 - %(AdditionalIncludeDirectories) Console false + NotUsing @@ -142,13 +164,13 @@ $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories) /bigobj %(AdditionalOptions) 28204 - %(AdditionalIncludeDirectories) Console false + NotUsing @@ -159,13 +181,13 @@ /bigobj %(AdditionalOptions) 28204 true - %(AdditionalIncludeDirectories) Console false + NotUsing @@ -176,7 +198,6 @@ /bigobj %(AdditionalOptions) 28204 true - %(AdditionalIncludeDirectories) false @@ -184,6 +205,7 @@ false + NotUsing @@ -193,13 +215,13 @@ $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories) /bigobj %(AdditionalOptions) 28204 - %(AdditionalIncludeDirectories) Console false + NotUsing @@ -209,14 +231,16 @@ $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories) /bigobj %(AdditionalOptions) 28204 - %(AdditionalIncludeDirectories) Console false + + + From 98dc352c22eb3c050fe5a909358a2968850a23c8 Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Tue, 7 Nov 2017 23:21:56 -0500 Subject: [PATCH 28/29] Update null char & error tests for Android Lollipop vs KitKat --- spec/www/spec/db-tx-error-handling-test.js | 56 +++++++++++++++------- spec/www/spec/db-tx-value-bindings-test.js | 5 +- 2 files changed, 41 insertions(+), 20 deletions(-) diff --git a/spec/www/spec/db-tx-error-handling-test.js b/spec/www/spec/db-tx-error-handling-test.js index 4be71971..d3ccf66c 100644 --- a/spec/www/spec/db-tx-error-handling-test.js +++ b/spec/www/spec/db-tx-error-handling-test.js @@ -3181,6 +3181,7 @@ var mytests = function() { it(suiteName + 'Inline US-ASCII blank string test with arguments array=function (BOGUS) in a try-catch block [TBD (WebKit) Web SQL vs plugin]', function(done) { var db = openDatabase("Inline-US-ASCII-string-test-with-arguments-array-equals-function.db", "1.0", "Demo", DEFAULT_SIZE); + var check1 = false; db.transaction(function(transaction) { try { transaction.executeSql("SELECT ''", function(ignored1, ignored2) { @@ -3199,10 +3200,12 @@ var mytests = function() { return true; }); } catch(ex) { - // NOT EXPECTED for (WebKit) Web SQL or plugin: - expect(false).toBe(true); + // EXPECTED RESULT for (WebKit) Web SQL ONLY: + if (!isWebSql) expect('Plugin BEHAVIOR CHANGED, please update this test').toBe('--'); + if (isWebSql && !isAndroid) expect('iOS WebKit Web SQL behavior changed').toBe('--'); + check1 = true; expect(ex).toBeDefined(); - expect(ex.code).toBeDefined(); + // expect(ex.code).toBeDefined(); expect(ex.message).toBeDefined(); throw ex; } @@ -3210,11 +3213,14 @@ var mytests = function() { }, function(error) { // EXPECTED RESULT for (WebKit) Web SQL ONLY: if (!isWebSql) expect('Plugin BEHAVIOR CHANGED, please update this test').toBe('--'); + if (isWebSql && isAndroid && !(/Android [1-4]/.test(navigator.userAgent))) + expect(check1).toBe(true); expect(error).toBeDefined(); expect(error.code).toBeDefined(); expect(error.message).toBeDefined(); expect(error.code).toBe(0); - expect(error.message).toMatch(/callback raised an exception.*or.*error callback did not return false/); + // TBD ???: + // expect(error.message).toMatch(/callback raised an exception.*or.*error callback did not return false/); // Close (plugin only) & finish: (isWebSql) ? done() : db.close(done, done); @@ -3230,6 +3236,7 @@ var mytests = function() { it(suiteName + 'Inline US-ASCII blank string test with arguments array=function (BOGUS) in a try-catch block read tx [TBD (WebKit) Web SQL vs plugin]', function(done) { var db = openDatabase("Inline-US-ASCII-string-test-with-arguments-array-equals-function-read-tx.db", "1.0", "Demo", DEFAULT_SIZE); + var check1 = false; db.readTransaction(function(readTransaction) { try { readTransaction.executeSql("SELECT ''", function(ignored1, ignored2) { @@ -3248,10 +3255,12 @@ var mytests = function() { return true; }); } catch(ex) { - // NOT EXPECTED for (WebKit) Web SQL or plugin: - expect(false).toBe(true); + // EXPECTED RESULT for (WebKit) Web SQL ONLY: + if (!isWebSql) expect('Plugin BEHAVIOR CHANGED, please update this test').toBe('--'); + if (isWebSql && !isAndroid) expect('iOS WebKit Web SQL behavior changed').toBe('--'); + check1 = true; expect(ex).toBeDefined(); - expect(ex.code).toBeDefined(); + // expect(ex.code).toBeDefined(); expect(ex.message).toBeDefined(); throw ex; } @@ -3259,11 +3268,14 @@ var mytests = function() { }, function(error) { // EXPECTED RESULT for (WebKit) Web SQL ONLY: if (!isWebSql) expect('Plugin BEHAVIOR CHANGED, please update this test').toBe('--'); + if (isWebSql && isAndroid && !(/Android [1-4]/.test(navigator.userAgent))) + expect(check1).toBe(true); expect(error).toBeDefined(); expect(error.code).toBeDefined(); expect(error.message).toBeDefined(); expect(error.code).toBe(0); - expect(error.message).toMatch(/callback raised an exception.*or.*error callback did not return false/); + // TBD ???: + // expect(error.message).toMatch(/callback raised an exception.*or.*error callback did not return false/); // Close (plugin only) & finish: (isWebSql) ? done() : db.close(done, done); @@ -3279,6 +3291,7 @@ var mytests = function() { it(suiteName + 'SELECT ? test with arguments array=function (BOGUS) in a try-catch block [TBD (WebKit) Web SQL vs plugin]', function(done) { var db = openDatabase("SELECT-parameter-with-arguments-array-equals-function.db", "1.0", "Demo", DEFAULT_SIZE); + var check1 = false; db.transaction(function(transaction) { try { transaction.executeSql("SELECT ?", function(ignored1, ignored2) { @@ -3297,10 +3310,12 @@ var mytests = function() { return true; }); } catch(ex) { - // NOT EXPECTED for (WebKit) Web SQL or plugin: - expect(false).toBe(true); + // EXPECTED RESULT for (WebKit) Web SQL ONLY: + if (!isWebSql) expect('Plugin BEHAVIOR CHANGED, please update this test').toBe('--'); + if (isWebSql && !isAndroid) expect('iOS WebKit Web SQL behavior changed').toBe('--'); + check1 = true; expect(ex).toBeDefined(); - expect(ex.code).toBeDefined(); + // expect(ex.code).toBeDefined(); expect(ex.message).toBeDefined(); throw ex; } @@ -3308,11 +3323,14 @@ var mytests = function() { }, function(error) { // EXPECTED RESULT for (WebKit) Web SQL ONLY: if (!isWebSql) expect('Plugin BEHAVIOR CHANGED, please update this test').toBe('--'); + if (isWebSql && isAndroid && !(/Android [1-4]/.test(navigator.userAgent))) + expect(check1).toBe(true); expect(error).toBeDefined(); expect(error.code).toBeDefined(); expect(error.message).toBeDefined(); expect(error.code).toBe(0); - expect(error.message).toMatch(/callback raised an exception.*or.*error callback did not return false/); + // TBD ???: + // expect(error.message).toMatch(/callback raised an exception.*or.*error callback did not return false/); // Close (plugin only) & finish: (isWebSql) ? done() : db.close(done, done); @@ -3328,6 +3346,7 @@ var mytests = function() { it(suiteName + 'SELECT ? test with arguments array=function (BOGUS) in a try-catch block read tx [TBD (WebKit) Web SQL vs plugin]', function(done) { var db = openDatabase("SELECT-parameter-with-arguments-array-equals-function-read-tx.db", "1.0", "Demo", DEFAULT_SIZE); + var check1 = false; db.readTransaction(function(transaction) { try { transaction.executeSql("SELECT ?", function(ignored1, ignored2) { @@ -3346,10 +3365,12 @@ var mytests = function() { return true; }); } catch(ex) { - // NOT EXPECTED for (WebKit) Web SQL or plugin: - expect(false).toBe(true); + // EXPECTED RESULT for (WebKit) Web SQL ONLY: + if (!isWebSql) expect('Plugin BEHAVIOR CHANGED, please update this test').toBe('--'); + if (isWebSql && !isAndroid) expect('iOS WebKit Web SQL behavior changed').toBe('--'); + check1 = true; expect(ex).toBeDefined(); - expect(ex.code).toBeDefined(); + // expect(ex.code).toBeDefined(); expect(ex.message).toBeDefined(); throw ex; } @@ -3357,11 +3378,14 @@ var mytests = function() { }, function(error) { // EXPECTED RESULT for (WebKit) Web SQL ONLY: if (!isWebSql) expect('Plugin BEHAVIOR CHANGED, please update this test').toBe('--'); + if (isWebSql && isAndroid && !(/Android [1-4]/.test(navigator.userAgent))) + expect(check1).toBe(true); expect(error).toBeDefined(); expect(error.code).toBeDefined(); expect(error.message).toBeDefined(); expect(error.code).toBe(0); - expect(error.message).toMatch(/callback raised an exception.*or.*error callback did not return false/); + // TBD ???: + // expect(error.message).toMatch(/callback raised an exception.*or.*error callback did not return false/); // Close (plugin only) & finish: (isWebSql) ? done() : db.close(done, done); diff --git a/spec/www/spec/db-tx-value-bindings-test.js b/spec/www/spec/db-tx-value-bindings-test.js index 36f57908..50295c7e 100755 --- a/spec/www/spec/db-tx-value-bindings-test.js +++ b/spec/www/spec/db-tx-value-bindings-test.js @@ -1324,10 +1324,7 @@ var mytests = function() { // we would like to know, so the test is coded to fail if it starts // working there. - if (isWebSql) { - expect(name.length).toBe(1); - expect(name).toBe('a'); - } else if (isWindows) { + if (isWindows || (isWebSql && !(/Android [5-9]/.test(navigator.userAgent)))) { expect(name.length).toBe(1); expect(name).toBe('a'); } else { From fdd1a4e9985e36e05024e6288df36b230079cf2d Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Sun, 10 Dec 2017 09:59:22 -0500 Subject: [PATCH 29/29] cordova-sqlite-storage doc fixes --- README.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 652d0a9c..ae5d7e23 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,8 @@ This version branch uses a `before_plugin_install` hook to install sqlite3 libra |-----------------------|----------------------| |[![Circle CI](https://circleci.com/gh/litehelpers/Cordova-sqlite-storage.svg?style=svg)](https://circleci.com/gh/litehelpers/Cordova-sqlite-storage)|[![Build Status](https://travis-ci.org/litehelpers/Cordova-sqlite-storage.svg)](https://travis-ci.org/litehelpers/Cordova-sqlite-storage)| + + ## IMPORTANT API DEPRECATION NOTICE @@ -144,8 +146,8 @@ See the [Sample section](#sample) for a sample with a more detailed explanation. - NOT supported by PhoneGap Developer App or PhoneGap Desktop App - This version uses a `before_plugin_install` hook to install sqlite3 library dependencies from `cordova-sqlite-storage-dependencies` via npm. - A recent version of the Cordova CLI (such as `6.5.0` or `7.1.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`). -- _Other build 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 _`3.15.2`_ included when building (all platforms), with the following definitions _for iOS/macOS/Windows_: +- Other build systems such as Cordova Plugman, PhoneGap CLI, PhoneGap Build, and Intel XDK are 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 `3.15.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` - `SQLITE_OMIT_DECLTYPE` @@ -164,7 +166,7 @@ See the [Sample section](#sample) for a sample with a more detailed explanation. - This version supports the use of two (2) possible Android sqlite database implementations: - default: lightweight [Android-sqlite-connector](https://github.com/liteglue/Android-sqlite-connector) - optional: built-in Android database classes (usage described below) -- Support for WP8 along with Windows 8.1/Windows Phone 8.1/Windows 10 using Visual Studio 2015 is available _in: [litehelpers / Cordova-sqlite-legacy-build-support](https://github.com/litehelpers/Cordova-sqlite-legacy-build-support)_ +- Support for WP8 along with Windows 8.1/Windows Phone 8.1/Windows 10 using Visual Studio 2015 is available in: [litehelpers / Cordova-sqlite-legacy-build-support](https://github.com/litehelpers/Cordova-sqlite-legacy-build-support) - The following features are available in [litehelpers / cordova-sqlite-ext](https://github.com/litehelpers/cordova-sqlite-ext): - REGEXP (Android/iOS/macOS) - SELECT BLOB data in Base64 format (all platforms Android/iOS/macOS/Windows) @@ -178,11 +180,11 @@ See the [Sample section](#sample) for a sample with a more detailed explanation. - INCORRECT error code (0) and INCONSISTENT error message (missing actual error info) in error callbacks ref: [litehelpers/Cordova-sqlite-storage#539](https://github.com/litehelpers/Cordova-sqlite-storage/issues/539) - Not possible to read BLOB column values - Windows platform version uses `UTF-16le` internal database encoding while the other platform versions use `UTF-8` internal encoding. (`UTF-8` internal encoding is preferred ref: [litehelpers/Cordova-sqlite-storage#652](https://github.com/litehelpers/Cordova-sqlite-storage/issues/652)) - - Certain close/delete scenarios in the test suite not working on Windows + - ~~Certain close/delete scenarios in the test suite not working on Windows~~ - The macOS platform version ("osx" platform) has not been tested in a release build and should be considered pre-alpha. - FTS3, FTS4, and R-Tree support is tested working OK in this version (for all target platforms in this version branch Android/iOS/macOS/Windows) - 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 _(see [deviations section](#deviations) below for differences in case of WKWebView)_ +- iOS versions supported: 8.x / 9.x / 10.x / 11.x (see [deviations section](#deviations) below for differences in case of WKWebView) - In case of memory issues please use smaller transactions or use the version at [litehelpers / Cordova-sqlite-evcore-extbuild-free](https://github.com/litehelpers/Cordova-sqlite-evcore-extbuild-free) (GPL or commercial license terms).