Skip to content

Commit

Permalink
cordova-sqlite-ext 0.10.7 - merge release
Browse files Browse the repository at this point in the history
Merge branch 'cordova-sqlite-legacy-core' into cordova-sqlite-ext-master
  • Loading branch information
Christopher J. Brody committed Dec 21, 2017
2 parents ca2a6f2 + 852cff6 commit 79751f9
Show file tree
Hide file tree
Showing 14 changed files with 422 additions and 166 deletions.
24 changes: 23 additions & 1 deletion CHANGES.md
@@ -1,12 +1,34 @@
# Changes

## cordova-sqlite-ext 0.10.7-pre2
## cordova-sqlite-ext 0.10.7

- cordova-sqlite-ext build flag fixes:
- SQLite (3.15.2) build with SQLITE_THREADSAFE=2 on iOS as well as macOS to avoid possible malformed database due to multithreaded access ref: litehelpers/Cordova-sqlite-storage#703
- Suppress warnings when building sqlite3.c on iOS/macOS
- Some additional iOS build flag updates in this plugin version

##### cordova-sqlite-legacy-core 1.0.6

###### cordova-sqlite-legacy-express-core 1.0.4

- Cleaned up workaround solution to BUG 666: close db before opening (ignore close error)
- android.database end transaction if active before closing (needed for new BUG 666 workaround solution to pass selfTest in case of builtin android.database implementation)

##### cordova-sqlite-legacy-core 1.0.5

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

- Resolve Java 6/7/8 concurrent map compatibility issue reported in litehelpers/Cordova-sqlite-storage#726, THANKS to pointer by @NeoLSN (Jason Yang/楊朝傑) in litehelpers/Cordova-sqlite-storage#727.
- selfTest database cleanup do not ignore close or delete error on any platforms

##### cordova-sqlite-legacy-core 1.0.4

- New workaround solution to BUG 666: close db before opening (ignore close error)

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

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

## cordova-sqlite-ext 0.10.6

- SQLite 3.15.2 build with SQLITE_THREADSAFE=2 on macOS ONLY (SQLITE_THREADSAFE=1 on Android/iOS/Windows) and other flag fixes in this plugin version
Expand Down
130 changes: 73 additions & 57 deletions README.md

Large diffs are not rendered by default.

58 changes: 28 additions & 30 deletions SQLitePlugin.coffee.md
Expand Up @@ -251,21 +251,16 @@
# store initial DB state:
@openDBs[@dbname] = DB_STATE_INIT

# 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.
nextTick =>
if not txLocks[@dbname]
myfn = (tx) ->
tx.addStatement 'ROLLBACK'
return
@addTransaction new SQLitePluginTransaction @, myfn, null, null, false, false

# UPDATED WORKAROUND SOLUTION to cordova-sqlite-storage BUG 666:
# Request to native side to close existing database
# connection in case it is already open.
# Wait for callback before opening the database
# (ignore close error).
step2 = =>
cordova.exec opensuccesscb, openerrorcb, "SQLitePlugin", "open", [ @openargs ]
return

cordova.exec step2, step2, 'SQLitePlugin', 'close', [ { path: @dbname } ]

return

Expand Down Expand Up @@ -914,6 +909,7 @@

, (tx2_err) ->
SelfTest.finishWithError errorcb, "readTransaction error: #{tx2_err}"

, () ->
if !readTransactionFinished
SelfTest.finishWithError errorcb, 'readTransaction did not finish'
Expand Down Expand Up @@ -957,25 +953,18 @@
if !secondReadTransactionFinished
SelfTest.finishWithError errorcb, 'second readTransaction did not finish'
return

# CLEANUP & FINISH:
db.close () ->
SQLiteFactory.deleteDatabase {name: SelfTest.DBNAME, location: 'default'}, successcb, (cleanup_err)->
# TBD IGNORE THIS ERROR on Windows (and WP8):
if /Windows /.test(navigator.userAgent) or /IEMobile/.test(navigator.userAgent)
console.log "IGNORE CLEANUP (DELETE) ERROR: #{JSON.stringify cleanup_err} (Windows/WP8)"
successcb()
return
SelfTest.finishWithError errorcb, "Cleanup error: #{cleanup_err}"
SelfTest.cleanupAndFinish successcb, errorcb
return

, (close_err) ->
# TBD IGNORE THIS ERROR on Windows (and WP8):
if /Windows /.test(navigator.userAgent) or /IEMobile/.test(navigator.userAgent)
console.log "IGNORE close ERROR: #{JSON.stringify close_err} (Windows/WP8)"
SQLiteFactory.deleteDatabase {name: SelfTest.DBNAME, location: 'default'}, successcb, successcb
return
# DO NOT IGNORE CLOSE ERROR ON ANY PLATFORM:
SelfTest.finishWithError errorcb, "close error: #{close_err}"
return

# FUTURE TODO: return
return

, (select_err) ->
SelfTest.finishWithError errorcb, "SELECT error: #{select_err}"
Expand All @@ -987,13 +976,22 @@
SelfTest.finishWithError errorcb, "Open database error: #{open_err}"
return

cleanupAndFinish: (successcb, errorcb) ->
SQLiteFactory.deleteDatabase {name: SelfTest.DBNAME, location: 'default'}, successcb, (cleanup_err)->
# DO NOT IGNORE CLEANUP DELETE ERROR ON ANY PLATFORM:
SelfTest.finishWithError errorcb, "CLEANUP DELETE ERROR: #{cleanup_err}"
return
return

finishWithError: (errorcb, message) ->
console.log "selfTest ERROR with message: #{message}"
SQLiteFactory.deleteDatabase {name: SelfTest.DBNAME, location: 'default'}, ->
errorcb newSQLError message
# FUTURE TODO: return
# FUTURE TODO log err2
, (err2)-> errorcb newSQLError "Cleanup error: #{err2} for error: #{message}"
return
, (err2)->
console.log "selfTest CLEANUP DELETE ERROR #{err2}"
errorcb newSQLError "CLEANUP DELETE ERROR: #{err2} for error: #{message}"
return
return

## Exported API:
Expand Down
4 changes: 3 additions & 1 deletion package.json
@@ -1,12 +1,13 @@
{
"name": "cordova-sqlite-ext",
"version": "0.10.7-pre2",
"version": "0.10.7",
"description": "Native interface to SQLite for PhoneGap/Cordova with extra features",
"cordova": {
"id": "cordova-sqlite-ext",
"platforms": [
"android",
"ios",
"osx",
"windows"
]
},
Expand All @@ -19,6 +20,7 @@
"ecosystem:cordova",
"cordova-android",
"cordova-ios",
"cordova-osx",
"cordova-windows"
],
"author": "various",
Expand Down
8 changes: 5 additions & 3 deletions plugin.xml
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-ext"
version="0.10.7-pre2">
version="0.10.7">

<name>Cordova sqlite storage plugin with extra features</name>

Expand Down Expand Up @@ -56,7 +56,8 @@
<source-file src="src/ios/SQLitePlugin.m" />

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

<header-file src="node_modules/cordova-sqlite-ext-deps/sqlite3-regexp-cached/sqlite3_regexp.h" />
<source-file src="node_modules/cordova-sqlite-ext-deps/sqlite3-regexp-cached/sqlite3_regexp.c" />
Expand Down Expand Up @@ -86,7 +87,8 @@
<!-- 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" />
<source-file src="src/ios/PSPDFThreadSafeMutableDictionary.m"
compiler-flags="-w" />

<header-file src="node_modules/cordova-sqlite-ext-deps/sqlite3-regexp-cached/sqlite3_regexp.h" />
<source-file src="node_modules/cordova-sqlite-ext-deps/sqlite3-regexp-cached/sqlite3_regexp.c" />
Expand Down
2 changes: 1 addition & 1 deletion spec/config.xml
@@ -1,7 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.phonegap.plugins.sqlite.tests" version="0.0.1"
xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Cordova-sqlite-spec</name>
<name>cordova-sqlite-spec</name>
<description>
Runs the unit tests suite for the Cordova SQLite plugin.
</description>
Expand Down
1 change: 1 addition & 0 deletions spec/www/index.html
Expand Up @@ -21,6 +21,7 @@

<!-- 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>
<script src="spec/db-tx-sql-select-value-test.js"></script>
<script src="spec/basic-db-tx-sql-storage-results.js"></script>
Expand Down

0 comments on commit 79751f9

Please sign in to comment.