Skip to content

Commit 60fefa8

Browse files
author
Christopher J. Brody
committed
Test emoji & INLINE BLOB; other parameter checks; other test/doc fixes
ISSUES documented: - emojis and other 4-octet UTF-8 characters on Android-sqlite-connector & Windows ref: storesafe#564 - INLINE BLOB values on Android-sqlite-connector & Windows - In case of too many parameters the plugin reports INCORRECT error code 0 (SQLError.UNKNOWN_ERR) while Android/iOS (WebKit) Web SQL reports correct error code - The results data objects are not immutable as specified/implied by: https://www.w3.org/TR/webdatabase/#database-query-results
1 parent bd07f26 commit 60fefa8

File tree

5 files changed

+656
-144
lines changed

5 files changed

+656
-144
lines changed

README.md

+10-5
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ License for Android and Windows versions: MIT or Apache 2.0
66

77
License for iOS version: MIT only
88

9-
|Android Circle-CI (**full** suite)|iOS Travis-CI (*very* limited suite)|
9+
|Android Circle-CI (**full** suite)|iOS Travis-CI (partial suite)|
1010
|-----------------------|----------------------|
1111
|[![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)|
1212

@@ -124,6 +124,8 @@ See the [Sample section](#sample) for a sample with a more detailed explanation.
124124
- Issue with UNICODE `\u0000` character (same as `\0`)
125125
- No background processing
126126
- 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)
127+
- Issue with emojis and other 4-octet UTF-8 characters (apparently not stored correctly)
128+
- Not possible to read BLOB column values
127129
- 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.
128130
- FTS3, FTS4, and R-Tree support is tested working OK in this version (for all target platforms in this version branch Android/iOS/Windows)
129131
- Android is supported back to SDK 10 (a.k.a. Gingerbread, Android 2.3.3); support for older versions is available upon request.
@@ -317,14 +319,16 @@ As "strongly recommended" by [Web SQL Database API 8.5 SQL injection](https://ww
317319
- This plugin does *not* support the synchronous Web SQL interfaces.
318320
- 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)
319321
- It is possible to insert multiple rows like: `transaction.executeSql('INSERT INTO MyTable VALUES (?,?),(?,?)', ['Alice', 101, 'Betty', 102]);` which was not supported by SQLite 3.6.19 as referenced by [Web SQL API section 5](https://www.w3.org/TR/webdatabase/#web-sql). The iOS WebKit Web SQL implementation seems to support this as well.
320-
- Unlike the HTML5/[Web SQL API](http://www.w3.org/TR/webdatabase/) this plugin handles executeSql calls with too few parameters without error reporting.
322+
- 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
321323
- Known issue(s) with handling of `Infinity` values (positive or negative) and certain ASCII/UNICODE characters as described below.
322324
- 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)
323325
- Certain errors such as CREATE VIRTUAL TABLE USING bogus module are reported with error code 5 (SQLError.SYNTAX_ERR) on Android and iOS. This happens to be the case for WebKit Web SQL (Android/iOS).
324326
- A number of uncategorized errors are reported with error code 5 (SQLError.SYNTAX_ERR) on Android and iOS by both WebKit Web SQL and this plugin.
325327
- Issues with error code on Windows as well as Android with the `androidDatabaseImplementation: 2` setting described below.
326328
- In case of an issue that causes an API function to throw an exception (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.
327329
- This plugin supports some non-standard features as documented below.
330+
- Results of SELECT with BLOB data such as `SELECT LOWER(X'40414243') AS myresult`, `SELECT X'40414243' AS myresult`, or reading data stored by `INSERT INTO MyTable VALUES (X'40414243')` are not consistent on Android in case the built-in Android database is used (using the `androidDatabaseImplementation: 2` setting in `window.sqlitePlugin.openDatabase`) or Windows. (These work with Android/iOS WebKit Web SQL and have been supported by SQLite for a number of years.)
331+
- 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).
328332

329333
### Security of deleted data
330334

@@ -343,7 +347,8 @@ See **Security of sensitive data** in the [Security](#security) section above.
343347

344348
- iOS version does not support certain rapidly repeated open-and-close or open-and-delete test scenarios due to how the implementation handles background processing
345349
- As described below, auto-vacuum is NOT enabled by default.
346-
- INSERT statement that affects multiple rows (due to SELECT cause or using TRIGGER(s), for example) does not report proper rowsAffected on Android in case the built-in Android database used (using the `androidDatabaseImplementation` option in `window.sqlitePlugin.openDatabase`)
350+
- 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`)
351+
- 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`)
347352
- 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)
348353
- Infinity (positive or negative) values are not supported (known to be broken on Android, may cause a crash on iOS ref: [litehelpers/Cordova-sqlite-storage#405](https://github.com/litehelpers/Cordova-sqlite-storage/issues/405))
349354
- 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).
@@ -352,7 +357,7 @@ See **Security of sensitive data** in the [Security](#security) section above.
352357
- Close/delete database bugs described below.
353358
- When a database is opened and deleted without closing, the iOS version is known to leak resources.
354359
- It is NOT possible to open multiple databases with the same name but in different locations (iOS version).
355-
- Incorrect or missing insertId/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.
360+
- 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.
356361

357362
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).
358363

@@ -402,7 +407,7 @@ Some more limitations are tracked in the [open Cordova-sqlite-storage documentat
402407
- Delete an open database inside a statement or transaction callback.
403408
- WITH clause (not supported by some older sqlite3 versions)
404409
- _Handling of invalid transaction and transaction.executeSql arguments_
405-
- _Emojis and other 4-octet UTF-8 characters_
410+
- More emojis and other 4-octet UTF-8 characters
406411

407412
<!-- END Further testing needed -->
408413

spec/www/spec/db-tx-error-handling-test.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ var mytests = function() {
388388
expect(ex.message).toBeDefined();
389389

390390
if (!isWebSql)
391-
expect(ex.code).toBe(0); // [UNKNOWN_ERR]
391+
expect(ex.code).toBe(0); // (SQLite.UNKNOWN_ERR)
392392

393393
if (!isWebSql)
394394
expect(ex.message).toMatch(/transaction expected a function/);
@@ -441,7 +441,7 @@ var mytests = function() {
441441
expect(ex.message).toBeDefined();
442442

443443
if (!isWebSql)
444-
expect(ex.code).toBe(0); // [UNKNOWN_ERR]
444+
expect(ex.code).toBe(0); // (SQLite.UNKNOWN_ERR)
445445

446446
if (!isWebSql)
447447
expect(ex.message).toMatch(/transaction expected a function/);
@@ -580,7 +580,7 @@ var mytests = function() {
580580
else if (isWebSql)
581581
expect(error.message).toMatch(/the SQLTransactionCallback was null or threw an exception/);
582582
else if (isAndroid)
583-
expect(error.message).toMatch(/Cannot call method 'toString' of undefined/);
583+
expect(error.message).toMatch(/Cannot .* 'toString' of undefined/);
584584
else
585585
expect(error.message).toMatch(/undefined is not an object \(evaluating 'sql\.toString'\)/);
586586

@@ -969,7 +969,7 @@ var mytests = function() {
969969
else if (isWindows)
970970
expect(error.message).toMatch(/Unable to get property 'toString' of undefined or null reference/);
971971
else if (isAndroid)
972-
expect(error.message).toMatch(/Cannot call method 'toString' of null/);
972+
expect(error.message).toMatch(/Cannot .* 'toString' of null/);
973973
else
974974
expect(error.message).toMatch(/null is not an object \(evaluating 'sql\.toString'\)/);
975975

@@ -1155,7 +1155,7 @@ var mytests = function() {
11551155
else if (isWindows)
11561156
expect(error.message).toMatch(/Unable to get property 'toString' of undefined or null reference/);
11571157
else if (isAndroid)
1158-
expect(error.message).toMatch(/Cannot call method 'toString' of undefined/);
1158+
expect(error.message).toMatch(/Cannot .* 'toString' of undefined/);
11591159
else
11601160
expect(error.message).toMatch(/undefined is not an object \(evaluating 'sql\.toString'\)/);
11611161

@@ -1215,7 +1215,7 @@ var mytests = function() {
12151215
else if (isWindows)
12161216
expect(ex.message).toMatch(/Unable to get property 'toString' of undefined or null reference/);
12171217
else if (!isWebSql && isAndroid)
1218-
expect(ex.message).toMatch(/Cannot call method 'toString' of undefined/);
1218+
expect(ex.message).toMatch(/Cannot .* 'toString' of undefined/);
12191219
else if (!isWebSql)
12201220
expect(ex.message).toMatch(/undefined is not an object \(evaluating 'sql\.toString'\)/);
12211221
else if (isAndroid)
@@ -1239,7 +1239,7 @@ var mytests = function() {
12391239
else if (isWindows)
12401240
expect(error.message).toMatch(/Unable to get property 'toString' of undefined or null reference/);
12411241
else if (!isWebSql && isAndroid)
1242-
expect(error.message).toMatch(/Cannot call method 'toString' of undefined/);
1242+
expect(error.message).toMatch(/Cannot .* 'toString' of undefined/);
12431243
else if (!isWebSql)
12441244
expect(error.message).toMatch(/undefined is not an object \(evaluating 'sql\.toString'\)/);
12451245
else

0 commit comments

Comments
 (0)