Skip to content

Commit

Permalink
cordova-sqlite-storage 2.1.1 - merge release with minor doc fixes
Browse files Browse the repository at this point in the history
Merge branch 'cordova-sqlite-legacy-core' into storage-master
  • Loading branch information
Christopher J. Brody committed Nov 8, 2017
2 parents 98dc352 + 65fc769 commit 00a197d
Show file tree
Hide file tree
Showing 15 changed files with 339 additions and 72 deletions.
20 changes: 20 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# Changes

## cordova-sqlite-storage 2.1.1

##### cordova-sqlite-legacy-core 1.0.3

- Suppress warnings when building sqlite3.c & PSPDFThreadSafeMutableDictionary.m on iOS/macOS

##### cordova-sqlite-legacy-core 1.0.2

- Fix log in case of transaction waiting for open to finish; doc fixes
- SQLite 3.15.2 build with SQLITE_THREADSAFE=2 on iOS/macOS (SQLITE_THREADSAFE=1 on Android/Windows) and other flag fixes in this version branch to avoid possible malformed database due to multithreaded access ref: litehelpers/Cordova-sqlite-storage#703
- Windows 10 (UWP) build with /SAFESEH flag on Win32 (x86) target

###### cordova-sqlite-legacy-express-core 1.0.2

- Use PSPDFThreadSafeMutableDictionary for iOS/macOS to avoid threading issue ref: litehelpers/Cordova-sqlite-storage#716

###### cordova-sqlite-legacy-express-core 1.0.1

- Fix bug 666 workaround to trigger ROLLBACK in the next event tick (needed to support version with pre-populated database on Windows)

## cordova-sqlite-storage 2.1.0

- Visual Studio 2017 updates for Windows UWP build
Expand Down
2 changes: 2 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ MIT only

based on Phonegap-SQLitePlugin by @davibe (Davide Bertola <[email protected]>) and @joenoon (Joe Noon <[email protected]>)

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

## Windows version

MIT or Apache 2.0
Expand Down
108 changes: 67 additions & 41 deletions README.md

Large diffs are not rendered by default.

20 changes: 12 additions & 8 deletions SQLitePlugin.coffee.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@

else
if @dbname of @openDBs
console.log 'new transaction is waiting for open operation'
console.log 'new transaction is queued, waiting for open operation to finish'
else
# XXX SHOULD NOT GET HERE.
# FUTURE TBD TODO: in this exceptional case abort and discard the transaction.
Expand Down Expand Up @@ -213,6 +213,8 @@
success @
return

# (done)

else
console.log 'OPEN database: ' + @dbname

Expand Down Expand Up @@ -248,19 +250,21 @@
# store initial DB state:
@openDBs[@dbname] = DB_STATE_INIT

# As a WORKAROUND SOLUTION to BUG litehelpers/Cordova-sqlite-storage#666:
# As a WORKAROUND SOLUTION to BUG litehelpers/Cordova-sqlite-storage#666
# (in the next event tick):
# If the database was never opened on the JavaScript side
# start an extra ROLLBACK statement to abort any pending transaction
# (does not matter whether it succeeds or fails here).
# FUTURE TBD a better solution would be to send a special signal or parameter
# if the database was never opened on the JavaScript side.
if not txLocks[@dbname]
myfn = (tx) ->
tx.addStatement 'ROLLBACK'
return
@addTransaction new SQLitePluginTransaction @, myfn, null, null, false, false
nextTick =>
if not txLocks[@dbname]
myfn = (tx) ->
tx.addStatement 'ROLLBACK'
return
@addTransaction new SQLitePluginTransaction @, myfn, null, null, false, false

cordova.exec opensuccesscb, openerrorcb, "SQLitePlugin", "open", [ @openargs ]
cordova.exec opensuccesscb, openerrorcb, "SQLitePlugin", "open", [ @openargs ]

return

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"name": "cordova-sqlite-storage",
"version": "2.1.0",
"version": "2.1.1",
"description": "Native interface to SQLite for PhoneGap/Cordova",
"cordova": {
"id": "cordova-sqlite-storage",
"platforms": [
"android",
"ios",
"osx",
"windows"
]
},
Expand Down
19 changes: 13 additions & 6 deletions plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="cordova-sqlite-storage"
version="2.1.0">
version="2.1.1">

<name>Cordova sqlite storage plugin</name>

Expand Down Expand Up @@ -55,27 +55,34 @@
<header-file src="src/ios/SQLitePlugin.h" />
<source-file src="src/ios/SQLitePlugin.m" />

<header-file src="src/ios/PSPDFThreadSafeMutableDictionary.h" />
<source-file src="src/ios/PSPDFThreadSafeMutableDictionary.m"
compiler-flags="-w" />

<header-file src="node_modules/cordova-sqlite-storage-dependencies/sqlite3.h" />
<source-file src="node_modules/cordova-sqlite-storage-dependencies/sqlite3.c"
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" />
compiler-flags="-w -DSQLITE_THREADSAFE=2 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_TEMP_STORE=2 -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_RTREE -DSQLITE_DEFAULT_PAGE_SIZE=1024 -DSQLITE_DEFAULT_CACHE_SIZE=2000" />
</platform>

<!-- macOS -->
<!-- macOS (osx) -->
<platform name="osx">
<config-file target="config.xml" parent="/*">
<feature name="SQLitePlugin">
<param name="ios-package" value="SQLitePlugin" />
</feature>
</config-file>

<!-- Note: the macOS src is based off src/ios implicitly -->
<!-- Note: the macOS (osx) src is based off src/ios implicitly -->
<header-file src="src/ios/SQLitePlugin.h" />
<source-file src="src/ios/SQLitePlugin.m" />
<!-- FUTURE TBD: more common directory name for Apple macOS/iOS versions -->

<header-file src="src/ios/PSPDFThreadSafeMutableDictionary.h" />
<source-file src="src/ios/PSPDFThreadSafeMutableDictionary.m"
compiler-flags="-w" />

<header-file src="node_modules/cordova-sqlite-storage-dependencies/sqlite3.h" />
<source-file src="node_modules/cordova-sqlite-storage-dependencies/sqlite3.c"
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" />
compiler-flags="-w -DSQLITE_THREADSAFE=2 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_TEMP_STORE=2 -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_RTREE -DSQLITE_DEFAULT_PAGE_SIZE=1024" />
</platform>

<!-- windows -->
Expand Down
4 changes: 3 additions & 1 deletion spec/www/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
<!-- [Cordova] source file(s): -->
<script src="cordova.js"></script>

<!-- spec file(s): -->
<!-- browser startup test: -->
<script src="spec/browser-check-startup.js"></script>

<!-- other spec file(s): -->
<script src="spec/self-test.js"></script>
<script src="spec/sqlite-version-test.js"></script>
<script src="spec/db-tx-string-test.js"></script>
Expand Down
12 changes: 8 additions & 4 deletions spec/www/spec/db-open-close-delete-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1617,8 +1617,10 @@ var mytests = function() {
// XXX SEE BELOW: repeat scenario but wait for open callback before close/delete/reopen
// Needed to support some large-scale applications:
test_it(suiteName + ' immediate close, then delete then re-open allows subsequent queries to run', function () {
// TBD POSSIBLY BROKEN on iOS/macOS due to current background processing implementation:
if (!isAndroid && !isWindows && !isWP8) pending('POSSIBLY BROKEN on iOS/macOS (background processing implementation)');
// TBD POSSIBLY BROKEN on iOS/macOS ...
// if (!isAndroid && !isWindows && !isWP8) pending(...);
// TBD CURRENTLY BROKEN DUE TO BUG 666 WORKAROUND HACK
pending('CURRENTLY BROKEN DUE TO BUG 666 WORKAROUND HACK');

var dbName = "Immediate-close-delete-Reopen.db";
var dbargs = {name: dbName, location: 'default'};
Expand Down Expand Up @@ -1886,8 +1888,10 @@ var mytests = function() {

// Needed to support some large-scale applications:
test_it(suiteName + ' repeatedly open and delete database faster (5x)', function () {
// TBD CURRENTLY BROKEN on iOS/macOS due to current background processing implementation:
if (!isAndroid && !isWindows && !isWP8) pending('CURRENTLY BROKEN on iOS/macOS (background processing implementation)');
// TBD POSSIBLY BROKEN on iOS/macOS ...
// if (!isAndroid && !isWindows && !isWP8) pending(...);
// TBD CURRENTLY BROKEN DUE TO BUG 666 WORKAROUND HACK
pending('CURRENTLY BROKEN DUE TO BUG 666 WORKAROUND HACK');

var dbName = 'repeatedly-open-and-delete-faster-5x.db';
var dbargs = {name: dbName, location: 'default'};
Expand Down
3 changes: 3 additions & 0 deletions spec/www/spec/db-tx-value-bindings-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1249,6 +1249,7 @@ var mytests = function() {
it(suiteName + ' stores [Unicode] string with \\u0000 (same as \\0) correctly [HEX encoding check BROKEN for Android-sqlite-connector]', function (done) {
if (isWP8) pending('BROKEN on WP(8)'); // [BUG #202] UNICODE characters not working with WP(8)
if (isWindows) pending('BROKEN on Windows'); // TBD (truncates on Windows)
// XXX TBD ???:
if (!isWebSql && !isWindows && isAndroid && !isImpl2) pending('BROKEN on Android-sqlite-connector implementation)');

var db = openDatabase('UNICODE-store-u0000-test.db');
Expand Down Expand Up @@ -1304,6 +1305,8 @@ var mytests = function() {

it(suiteName + ' returns [Unicode] string with \\u0000 (same as \\0) correctly [BROKEN: TRUNCATES on Windows]', function (done) {
if (isWP8) pending('BROKEN on WP(8)'); // [BUG #202] UNICODE characters not working with WP(8)
if (isWindows) pending('BROKEN on Windows'); // XXX
// if (isWebSql && isAndroid) pending('SKIP on Android Web SQL'); // XXX TBD INCONSISTENT RESULTS Android 4 vs 5

var db = openDatabase('UNICODE-retrieve-u0000-test.db');

Expand Down
4 changes: 2 additions & 2 deletions spec/www/spec/regexp-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ var mytests = function() {
it(suiteName + 'Simple REGEXP test',
function(done) {
// TBD Test for Android Web SQL ONLY in this version branch:
if (isWP8) pending('NOT IMPLEMENTED for WP8');
if (isWindows) pending('NOT IMPLEMENTED for Windows');
if (isWP8) pending('NOT IMPLEMENTED for WP8 (plugin)');
if (isWindows) pending('NOT IMPLEMENTED for Windows (plugin)');
if (!isWebSql && !isWindows && isAndroid) pending('SKIP for Android plugin'); // TBD SKIP for Android plugin (for now)
if (isWebSql && !isAndroid && !isWindows && !isWP8) pending('SKIP for iOS (WebKit) Web SQL');
// TBD REMOVE from version branches such as cordova-sqlite-ext:
Expand Down
28 changes: 28 additions & 0 deletions src/ios/PSPDFThreadSafeMutableDictionary.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// PSPDFThreadSafeMutableDictionary.h header copied from
// PSPDFThreadSafeMutableDictionary.m
//
// Copyright (c) 2013 Peter Steinberger, PSPDFKit GmbH. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

#import <Foundation/Foundation.h>

// Dictionary-Subclasss whose primitive operations are thread safe.
@interface PSPDFThreadSafeMutableDictionary : NSMutableDictionary
@end
Loading

0 comments on commit 00a197d

Please sign in to comment.