Skip to content

Commit 650fc52

Browse files
EiyuuZackChuckytuh
authored andcommitted
Merge tag '6.0.0' into feat/RNMT-5880/update-sqlite
2 parents b9b4c0c + fc12e10 commit 650fc52

35 files changed

Lines changed: 1079 additions & 454 deletions

AUTHORS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
- API changes by @brodybits (Chris Brody)
99
- Transaction timing fixes to support PouchDB by @nolanlawson
1010

11+
## browser platform
12+
13+
- Using sql-asm-memory-growth.js built from sql.js by @kripken (Alon Zakai)
14+
1115
## Android version
1216

1317
- Extracted from DroidGap by @brodybits (Chris Brody)

CHANGES.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,57 @@
1212
### cordova-sqlite-storage 3.2.0-OS
1313
- Added support for multiple connections to the same database (enable some concurrency)
1414

15+
#### cordova-sqlite-storage 6.0.0
16+
17+
- use cordova-sqlite-storage-dependencies@4.0.0 with Android JARs built from android-sqlite-native-ndk-connector and android-sqlite-ndk-native-driver, with enhancements by Luis Silva of OutSystems needed for some Android 11 devices
18+
19+
### cordova-sqlite-storage-commoncore 2.0.0
20+
21+
- refactor: clean up imports for Android
22+
- Fix plugin param name for macOS ("osx") - *tested* with Cordova 9 and cordova-osx@5
23+
- Drop support for Windows on ARM (Windows Mobile)
24+
25+
#### cordova-sqlite-storage 5.1.0
26+
27+
- Add browser platform support using sql-asm-memory-growth.js from sql.js, with some limitations as documented
28+
29+
#### cordova-sqlite-storage 5.0.1
30+
31+
- enable RENAME table with view test - from December 2019 SQLite crash report, fixed in 2020 ref:
32+
- http://sqlite.1065341.n5.nabble.com/Crash-Bug-Report-tc109903.html
33+
- https://github.com/xpbrew/cordova-sqlite-storage/issues/904
34+
- SQLite 3.32.3 update from cordova-sqlite-storage-dependencies@2.1.2
35+
36+
#### cordova-sqlite-storage 5.0.0
37+
38+
- avoid incorrect default directory on iOS/macOS - to be extra safe (see <https://github.com/xpbrew/cordova-sqlite-storage/issues/907>)
39+
- ensure that default "nosync" directory *always* has resource value set for `NSURLIsExcludedFromBackupKey`
40+
- add more checks for missing database directory
41+
42+
#### cordova-sqlite-storage 4.0.0
43+
44+
- rename PSPDFThreadSafeMutableDictionary to CustomPSPDFThreadSafeMutableDictionary and completely remove PSPDFThreadSafeMutableDictionary.h
45+
46+
#### cordova-sqlite-storage 3.4.1
47+
48+
- SQLite 3.30.1 update from cordova-sqlite-storage-dependencies@2.1.1
49+
50+
#### cordova-sqlite-storage 3.4.0
51+
52+
- quick workaround for `SYNTAX_ERR` redefinition
53+
54+
#### cordova-sqlite-storage 3.3.0
55+
56+
- new default page & cache sizes with cordova-sqlite-storage-dependencies@2.1.0
57+
58+
##### cordova-sqlite-storage-commoncore 1.0.0
59+
60+
- additional EU string manipulation test cases
61+
62+
#### cordova-sqlite-storage 3.2.1
63+
64+
- cordova-sqlite-storage-dependencies@2.0.1 with SQLite 3.28.0 update for all supported platforms Android/iOS/macOS/Windows
65+
1566
#### cordova-sqlite-storage 3.2.0
1667

1768
- sqlite3_threadsafe() error handling on iOS/macOS

LICENSE.md

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,35 @@
44

55
MIT or Apache 2.0
66

7-
## Android version
7+
## for browser platform
88

99
MIT or Apache 2.0
1010

11-
## iOS/macOS version
11+
### sql.js
12+
13+
MIT
14+
15+
## for Android
16+
17+
MIT or Apache 2.0
18+
19+
### android-sqlite-native-ndk-connector
20+
21+
Unlicense (public domain)
22+
23+
### android-sqlite-ndk-native-driver
24+
25+
Unlicense (public domain)
26+
27+
## for iOS & macOS
1228

1329
MIT only
1430

1531
based on Phonegap-SQLitePlugin by @davibe (Davide Bertola <dade@dadeb.it>) and @joenoon (Joe Noon <joenoon@gmail.com>)
1632

1733
includes and uses PSPDFThreadSafeMutableDictionary (PSPDFThreadSafeMutableDictionary.m <https://gist.github.com/steipete/5928916>) MIT license by @steipete (<https://gist.github.com/steipete>)
1834

19-
## Windows version
35+
## for Windows
2036

2137
MIT or Apache 2.0
2238

@@ -26,6 +42,8 @@ by @doo (doo GmbH)
2642

2743
MIT License
2844

29-
## SQLite3
45+
## Common native code
46+
47+
### SQLite3
3048

3149
Public domain

README.md

Lines changed: 240 additions & 214 deletions
Large diffs are not rendered by default.

package.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
{
22
"name": "cordova-sqlite-storage",
3-
"version": "3.2.0-OS3",
4-
"description": "Native interface to SQLite for PhoneGap/Cordova - cordova-sqlite-storage plugin version",
3+
"version": "6.0.0",
4+
"description": "Native interface to SQLite for PhoneGap / Cordova - cordova-sqlite-storage plugin version",
55
"cordova": {
66
"id": "cordova-sqlite-storage",
77
"platforms": [
88
"android",
9+
"browser",
910
"ios",
1011
"osx",
1112
"windows"
@@ -19,6 +20,7 @@
1920
"sqlite",
2021
"ecosystem:cordova",
2122
"cordova-android",
23+
"cordova-browser",
2224
"cordova-ios",
2325
"cordova-osx",
2426
"cordova-windows"
@@ -30,16 +32,16 @@
3032
},
3133
"homepage": "https://github.com/xpbrew/cordova-sqlite-storage",
3234
"dependencies": {
33-
"cordova-sqlite-storage-dependencies": "https://github.com/OutSystems/cordova-sqlite-storage-dependencies#2.0.0-OS1"
35+
"cordova-sqlite-storage-dependencies": "4.0.0"
3436
},
3537
"scripts": {
36-
"clean-spec": "rm -rf spec/[mnp]* && git cl spec/config.xml && git st",
38+
"clean-spec": "rm -rf spec/[mnp]* && git cl spec/config.xml spec/package.json && git status --ignored",
3739
"prepare-js": "coffee -p SQLitePlugin.coffee.md > www/SQLitePlugin.js",
3840
"prepare-spec": "node scripts/prepareSpec.js"
3941
},
4042
"devDependencies": {
4143
"coffeescript": "1",
4244
"cross-spawn": "^6.0.5",
43-
"fs-extra": "^7.0.1"
45+
"fs-extra": "^8.1.0"
4446
}
4547
}

plugin.xml

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
33
xmlns:android="http://schemas.android.com/apk/res/android"
44
id="cordova-sqlite-storage"
5-
version="3.2.0-OS3">
5+
version="6.0.0">
66

7-
<name>Cordova sqlite storage plugin - cordova-sqlite-storage plugin version</name>
7+
<name>Cordova SQLite storage plugin - cordova-sqlite-storage plugin version</name>
88

99
<license>MIT</license>
1010

@@ -20,6 +20,17 @@
2020
<clobbers target="SQLitePlugin" />
2121
</js-module>
2222

23+
<platform name="browser">
24+
<!-- sql-asm js item must come before SQLiteProxy for SQLiteProxy.js to work on browser -->
25+
<js-module src="node_modules/cordova-sqlite-storage-dependencies/sql-asm-memory-growth.js" name="sql">
26+
<runs />
27+
</js-module>
28+
29+
<js-module src="src/browser/SQLiteProxy.js" name="SQLiteProxy">
30+
<runs />
31+
</js-module>
32+
</platform>
33+
2334
<!-- android -->
2435
<platform name="android">
2536
<!-- Cordova >= 3.0.0 -->
@@ -33,10 +44,8 @@
3344
<source-file src="src/android/io/sqlc/SQLiteAndroidDatabase.java" target-dir="src/io/sqlc"/>
3445
<source-file src="src/android/io/sqlc/SQLiteConnectorDatabase.java" target-dir="src/io/sqlc"/>
3546

36-
<!-- Android-sqlite-connector [jar]: -->
37-
<lib-file src="node_modules/cordova-sqlite-storage-dependencies/libs/sqlite-connector.jar" />
38-
<!-- Android-sqlite-connector native driver [native libs in jar]: -->
39-
<lib-file src="node_modules/cordova-sqlite-storage-dependencies/libs/sqlite-native-driver.jar" />
47+
<lib-file src="node_modules/cordova-sqlite-storage-dependencies/libs/sqlite-native-ndk-connector.jar" />
48+
<lib-file src="node_modules/cordova-sqlite-storage-dependencies/libs/sqlite-ndk-native-driver.jar" />
4049
</platform>
4150

4251
<!-- iOS -->
@@ -51,34 +60,32 @@
5160
<header-file src="src/ios/SQLitePlugin.h" />
5261
<source-file src="src/ios/SQLitePlugin.m" />
5362

54-
<header-file src="src/ios/PSPDFThreadSafeMutableDictionary.h" />
55-
<source-file src="src/ios/PSPDFThreadSafeMutableDictionary.m"
63+
<source-file src="src/ios/CustomPSPDFThreadSafeMutableDictionary.m"
5664
compiler-flags="-w" />
5765

5866
<header-file src="node_modules/cordova-sqlite-storage-dependencies/sqlite3.h" />
5967
<source-file src="node_modules/cordova-sqlite-storage-dependencies/sqlite3.c"
60-
compiler-flags="-w -DSQLITE_THREADSAFE=1 -DSQLITE_DEFAULT_SYNCHRONOUS=3 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_TEMP_STORE=2 -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_RTREE -DSQLITE_DEFAULT_PAGE_SIZE=1024" />
68+
compiler-flags="-w -DSQLITE_THREADSAFE=1 -DSQLITE_DEFAULT_SYNCHRONOUS=3 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_TEMP_STORE=2 -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_RTREE -DSQLITE_DEFAULT_PAGE_SIZE=4096" />
6169
</platform>
6270

6371
<!-- macOS (osx) -->
6472
<platform name="osx">
6573
<config-file target="config.xml" parent="/*">
6674
<feature name="SQLitePlugin">
67-
<param name="ios-package" value="SQLitePlugin" />
75+
<param name="osx-package" value="SQLitePlugin" />
6876
</feature>
6977
</config-file>
7078

7179
<!-- Note: the macOS (osx) src is based off src/ios implicitly -->
7280
<header-file src="src/ios/SQLitePlugin.h" />
7381
<source-file src="src/ios/SQLitePlugin.m" />
7482

75-
<header-file src="src/ios/PSPDFThreadSafeMutableDictionary.h" />
76-
<source-file src="src/ios/PSPDFThreadSafeMutableDictionary.m"
83+
<source-file src="src/ios/CustomPSPDFThreadSafeMutableDictionary.m"
7784
compiler-flags="-w" />
7885

7986
<header-file src="node_modules/cordova-sqlite-storage-dependencies/sqlite3.h" />
8087
<source-file src="node_modules/cordova-sqlite-storage-dependencies/sqlite3.c"
81-
compiler-flags="-w -DSQLITE_THREADSAFE=1 -DSQLITE_DEFAULT_SYNCHRONOUS=3 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_TEMP_STORE=2 -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_RTREE -DSQLITE_DEFAULT_PAGE_SIZE=1024" />
88+
compiler-flags="-w -DSQLITE_THREADSAFE=1 -DSQLITE_DEFAULT_SYNCHRONOUS=3 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_TEMP_STORE=2 -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_RTREE -DSQLITE_DEFAULT_PAGE_SIZE=4096" />
8289
</platform>
8390

8491
<!-- windows -->

spec/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "cordova-sqlite-spec",
3+
"cordova": {}
4+
}

spec/www/spec/basic-db-tx-sql-storage-results.js

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ var scenarioCount = (!!window.hasWebKitWebSQL) ? (isAndroid ? 3 : 2) : 1;
3737
var mytests = function() {
3838

3939
for (var i=0; i<scenarioCount; ++i) {
40-
// TBD skip plugin test on browser platform (not yet supported):
41-
if (isBrowser && (i === 0)) continue;
4240

4341
describe(scenarioList[i] + ': BASIC db tx sql storage results test(s)', function() {
4442
var scenarioName = scenarioList[i];
@@ -1024,6 +1022,8 @@ var mytests = function() {
10241022
}, MYTIMEOUT);
10251023

10261024
it(suiteName + 'ALTER TABLE RENAME test', function(done) {
1025+
if (isWebSql && isAppleMobileOS) pending('TBD SKIP for (WebKit) Web SQL on iOS');
1026+
10271027
var dbname = 'ALTER-TABLE-RENAME-test.db';
10281028
var createdb = openDatabase(dbname, '1.0', 'Test', DEFAULT_SIZE);
10291029

@@ -1079,6 +1079,45 @@ var mytests = function() {
10791079
}
10801080
}, MYTIMEOUT);
10811081

1082+
// From December 2019 SQLite crash report - fixed in 2020 ref:
1083+
// - http://sqlite.1065341.n5.nabble.com/Crash-Bug-Report-tc109903.html
1084+
// - https://github.com/xpbrew/cordova-sqlite-storage/issues/904
1085+
it(suiteName + 'RENAME table with view test [SQLite crash bug report December 2019]', function(done) {
1086+
if (isWebSql) pending('[TBD] NOT WORKING on (WebKit) Web SQL');
1087+
if (!isWebSql && isAndroid && isImpl2) pending('[TBD] NOT WORKING on Android system android.database provider');
1088+
1089+
var dbname = 'RENAME-table-with-view-test.db';
1090+
var db = openDatabase(dbname);
1091+
1092+
db.transaction(function(tx) {
1093+
tx.executeSql('DROP TABLE IF EXISTS v0;');
1094+
tx.executeSql('DROP TABLE IF EXISTS v2;');
1095+
tx.executeSql('DROP TABLE IF EXISTS t3;');
1096+
tx.executeSql('DROP VIEW IF EXISTS v4;');
1097+
tx.executeSql('DROP TRIGGER IF EXISTS x;');
1098+
tx.executeSql('CREATE TABLE v0 ( v1 ) ;');
1099+
tx.executeSql('CREATE TABLE v2 ( v3 ) ;');
1100+
tx.executeSql('CREATE VIEW v4 AS WITH x AS ( SELECT x () OVER( ) FROM v4 ) SELECT v3 AS x FROM v2 ;');
1101+
tx.executeSql('ALTER TABLE v2 RENAME TO t3;');
1102+
tx.executeSql('SELECT COUNT(x) AS cnt FROM v4;', null, function(tx, rs) {
1103+
expect(rs).toBeDefined();
1104+
expect(rs.rows.length).toBe(1);
1105+
expect(rs.rows.item(0).cnt).toBe(0);
1106+
1107+
// Close (plugin only) & finish:
1108+
(isWebSql) ? done() : db.close(done, done);
1109+
});
1110+
}, function(e) {
1111+
// ERROR RESULT (NOT EXPECTED):
1112+
expect(false).toBe(true);
1113+
expect(e).toBeDefined();
1114+
expect(e.message).toBe('--');
1115+
1116+
// Close (plugin only) & finish:
1117+
(isWebSql) ? done() : db.close(done, done);
1118+
});
1119+
}, MYTIMEOUT);
1120+
10821121
});
10831122

10841123
});

spec/www/spec/browser-check-startup.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ var isFirefox = /Firefox/.test(navigator.userAgent);
88
var isWebKitBrowser = !isWindows && !isAndroid && /Safari/.test(navigator.userAgent);
99
var isBrowser = isWebKitBrowser || isFirefox;
1010
var isEdgeBrowser = isBrowser && (/Edge/.test(navigator.userAgent));
11+
var isChromeBrowser = isBrowser && !isEdgeBrowser && (/Chrome/.test(navigator.userAgent));
1112
var isMac = !isBrowser && /Macintosh/.test(navigator.userAgent);
1213
var isAppleMobileOS = /iPhone/.test(navigator.userAgent) ||
1314
/iPad/.test(navigator.userAgent) || /iPod/.test(navigator.userAgent);
1415
var hasMobileWKWebView = isAppleMobileOS && !!window.webkit && !!window.webkit.messageHandlers;
1516

1617
window.hasBrowser = true;
17-
window.hasWebKitWebSQL = isAndroid || (isAppleMobileOS && !hasMobileWKWebView) || (isWebKitBrowser && !isEdgeBrowser);
18+
window.hasWebKitWebSQL = isAndroid || (isAppleMobileOS && !hasMobileWKWebView) || isChromeBrowser;
1819

1920
describe('Check startup for navigator.userAgent: ' + navigator.userAgent, function() {
2021
it('receives deviceready event', function(done) {

spec/www/spec/db-open-close-delete-test.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,13 @@ var pluginScenarioCount = isAndroid ? 2 : 1;
5757
var mytests = function() {
5858

5959
describe('Open database parameter test(s)', function() {
60-
// TBD skip plugin test on browser platform (not yet supported):
61-
if (isBrowser) return;
6260

6361
for (var i=0; i<pluginScenarioCount; ++i) {
6462

6563
describe(pluginScenarioList[i] + ': open database file name test(s)', function() {
64+
// TBD SKIP open database file name test(s) on browser platform for now:
65+
if (isBrowser) return;
66+
6667
var scenarioName = pluginScenarioList[i];
6768
var suiteName = scenarioName + ': ';
6869
var isImpl2 = (i === 1);
@@ -962,8 +963,6 @@ var mytests = function() {
962963

963964

964965
describe('Plugin - basic sqlitePlugin.deleteDatabase parameter check test(s)', function() {
965-
// TBD skip plugin test on browser platform (not yet supported):
966-
if (isBrowser) return;
967966

968967
if (true) {
969968

@@ -1201,8 +1200,6 @@ var mytests = function() {
12011200
});
12021201

12031202
describe('Plugin: db open-close-delete operation behavior test(s)', function() {
1204-
// TBD skip plugin test on browser platform (not yet supported):
1205-
if (isBrowser) return;
12061203

12071204
for (var i=0; i<pluginScenarioCount; ++i) {
12081205

@@ -1449,6 +1446,7 @@ var mytests = function() {
14491446
}, MYTIMEOUT);
14501447

14511448
test_it(suiteName + ' database.close (immediately after open) calls its success callback', function () {
1449+
if (isBrowser) pending('TBD SKIP on browser');
14521450
// TBD POSSIBLY BROKEN on iOS/macOS due to current background processing implementation:
14531451
if (isAppleMobileOS || isMac) pending('TBD POSSIBLY BROKEN on iOS/macOS (background processing implementation)');
14541452

@@ -1786,6 +1784,7 @@ var mytests = function() {
17861784
// XXX SEE BELOW: repeat scenario but wait for open callback before close/delete/reopen
17871785
// (Was needed to test support for an enterprise application)
17881786
test_it(suiteName + ' immediate close, then delete then re-open allows subsequent queries to run', function () {
1787+
if (isBrowser) pending('TBD SKIP on browser');
17891788
if (isAppleMobileOS || isMac) pending('CURRENTLY BROKEN on iOS/macOS (background processing implementation)');
17901789

17911790
var dbName = "Immediate-close-delete-Reopen.db";
@@ -1932,6 +1931,7 @@ var mytests = function() {
19321931
});
19331932

19341933
test_it(suiteName + ' repeatedly open and close database faster (5x)', function () {
1934+
if (isBrowser) pending('TBD SKIP on browser');
19351935
// TBD CURRENTLY BROKEN on iOS/macOS due to current background processing implementation:
19361936
if (isAppleMobileOS || isMac) pending('CURRENTLY BROKEN on iOS/macOS (background processing implementation)');
19371937
// TBD ???:

0 commit comments

Comments
 (0)