Skip to content

Commit

Permalink
cordova-sqlite-evcore-extbuild-free 0.9.1 - merge release
Browse files Browse the repository at this point in the history
Merge branch 'evcore-common-master'

cordova-sqlite-evcore-common-free compile-time option fixes for iOS/macOS:
- SQLITE_THREADSAFE=2 on iOS/macOS to avoid possible malformed database due
  to multithreaded access ref: storesafe/cordova-sqlite-storage#703
- Suppress warnings when building sqlite3.c (iOS/macOS)
- Remove unwanted SQLITE_OMIT_BUILTIN_TEST option (iOS/macOS)

Additional doc fixes
  • Loading branch information
Christopher J. Brody committed Jan 8, 2018
2 parents 55d6800 + c817436 commit a0e2601
Show file tree
Hide file tree
Showing 23 changed files with 935 additions and 255 deletions.
54 changes: 53 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,60 @@
# Changes

# cordova-sqlite-evcore-extbuild-free 0.9.1-pre1
# cordova-sqlite-evcore-extbuild-free 0.9.1

- cordova-sqlite-evcore-common-free compile-time option fixes for iOS/macOS:
- SQLITE_THREADSAFE=2 on iOS/macOS to avoid possible malformed database due to multithreaded access ref: <https://github.com/litehelpers/Cordova-sqlite-storage/issues/703>
- Suppress warnings when building sqlite3.c (iOS/macOS)
- Remove unwanted SQLITE_OMIT_BUILTIN_TEST option (iOS/macOS)
- Android evcore-native-driver NDK build in JAR from <https://github.com/litehelpers/Android-sqlite-evcore-native-driver-free/tree/ext-master> (with FTS5/JSON1/SQLITE_DEFAULT_PAGE_SIZE/SQLITE_DEFAULT_CACHE_SIZE build fixes included), wth JSMN (http://zserge.com/jsmn.html) included again under MIT license, now supports cordova-android@7.
- additional doc fixes

## cordova-sqlite-evcore-common-free 0.7.6

##### cordova-sqlite-legacy-core 1.0.7

- Add error info text in case of close error on Windows
- Signal INTERNAL ERROR in case of attempt to reuse db on Windows (should never happen due to workaround solution to BUG 666)

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

- iOS/macOS @synchronized guard for sqlite3_open operation
- Signal INTERNAL ERROR in case of attempt to reuse db (Android/iOS) (should never happen due to workaround solution to BUG 666)

##### 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-legacy-core 1.0.2

- Fix log in case of transaction waiting for open to finish; doc fixes
- 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-evcore-extbuild-free 0.9.0

Expand Down
6 changes: 4 additions & 2 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ This version is based on Cordova-sqlite-storage (https://github.com/litehelpers/

_Android platform version includes JSMN (http://zserge.com/jsmn.html) in evcore-native-driver (NDK build) under MIT license._

iOS/macOS version based on Phonegap-SQLitePlugin by @davibe (Davide Bertola <[email protected]>) and @joenoon (Joe Noon <[email protected]>)
iOS/macOS _platform version_ based on Phonegap-SQLitePlugin by @davibe (Davide Bertola <[email protected]>) and @joenoon (Joe Noon <[email protected]>) _(MIT license)_

Windows version includes SQLite3-WinRT by @doo (doo GmbH) under MIT License
_iOS/macOS platform version_ includes and uses PSPDFThreadSafeMutableDictionary (PSPDFThreadSafeMutableDictionary.m <https://gist.github.com/steipete/5928916>) by @steipete (<https://gist.github.com/steipete>) _(MIT license)_

Windows _platform version_ includes SQLite3-WinRT by @doo (doo GmbH) under MIT License

Other components:

Expand Down
269 changes: 169 additions & 100 deletions README.md

Large diffs are not rendered by default.

60 changes: 31 additions & 29 deletions SQLitePlugin.coffee.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,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 @@ -221,6 +221,8 @@
success @
return

# (done)

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

Expand Down Expand Up @@ -264,19 +266,16 @@
@dbidmap[@dbname] = @dbid = null
@fjmap[@dbname] = false

# As a WORKAROUND SOLUTION to BUG litehelpers/Cordova-sqlite-storage#666:
# 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
# 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 opensuccesscb, openerrorcb, "SQLitePlugin", "open", [ @openargs ]
cordova.exec step2, step2, 'SQLitePlugin', 'close', [ { path: @dbname } ]

return

Expand Down Expand Up @@ -1061,6 +1060,7 @@

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

, () ->
if !readTransactionFinished
SelfTest.finishWithError errorcb, 'readTransaction did not finish'
Expand Down Expand Up @@ -1104,25 +1104,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 @@ -1134,13 +1127,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
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"name": "cordova-sqlite-evcore-extbuild-free",
"version": "0.9.1-pre1",
"version": "0.9.1",
"description": "Cordova/PhoneGap sqlite storage - free enterprise version with Android performance/memory improvements and extra features for PhoneGap Build",
"cordova": {
"id": "cordova-sqlite-evcore-extbuild-free",
"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
21 changes: 17 additions & 4 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-evcore-extbuild-free"
version="0.9.1-pre1">
version="0.9.1">

<name>Cordova sqlite storage - free enterprise version with Android performance/memory improvements and extra features for PhoneGap Build</name>

Expand Down Expand Up @@ -30,6 +30,9 @@

<source-file src="src/android/io/sqlc/SQLitePlugin.java" target-dir="src/io/sqlc"/>
<source-file src="src/android/io/sqlc/SQLiteAndroidDatabase.java" target-dir="src/io/sqlc"/>
<!-- NOT USED in this plugin version branch:
<source-file src="src/android/io/sqlc/SQLiteConnectorDatabase.java" target-dir="src/io/sqlc"/>
-->

<source-file src="src/android/io/sqlc/EVCoreNativeDriver.java" target-dir="src/io/sqlc"/>

Expand All @@ -49,6 +52,10 @@
<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="src/deps/common/sqlite3-regexp-cached/sqlite3_regexp.h" />
<source-file src="src/deps/common/sqlite3-regexp-cached/sqlite3_regexp.c" />

Expand All @@ -60,10 +67,10 @@

<header-file src="src/deps/common/sqlite3.h" />
<source-file src="src/deps/common/sqlite3.c"
compiler-flags="-DSQLITE_TEMP_STORE=2 -DSQLITE_THREADSAFE=1 -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_JSON1 -DSQLITE_OMIT_BUILTIN_TEST -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_DEFAULT_PAGE_SIZE=4096 -DSQLITE_DEFAULT_CACHE_SIZE=-2000" />
compiler-flags="-w -DSQLITE_TEMP_STORE=2 -DSQLITE_THREADSAFE=2 -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_JSON1 -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_DEFAULT_PAGE_SIZE=4096 -DSQLITE_DEFAULT_CACHE_SIZE=-2000" />
</platform>

<!-- macOS -->
<!-- macOS (osx) -->
<platform name="osx">
<config-file target="config.xml" parent="/*">
<feature name="SQLitePlugin">
Expand All @@ -74,8 +81,13 @@
<!-- Note: the macOS 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="src/deps/common/sqlite3-regexp-cached/sqlite3_regexp.h" />
<source-file src="src/deps/common/sqlite3-regexp-cached/sqlite3_regexp.c" />

Expand All @@ -87,7 +99,8 @@

<header-file src="src/deps/common/sqlite3.h" />
<source-file src="src/deps/common/sqlite3.c"
compiler-flags="-DSQLITE_TEMP_STORE=2 -DSQLITE_THREADSAFE=1 -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_JSON1 -DSQLITE_OMIT_BUILTIN_TEST -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_DEFAULT_PAGE_SIZE=4096 -DSQLITE_DEFAULT_CACHE_SIZE=-2000" />
compiler-flags="-w -DSQLITE_TEMP_STORE=2 -DSQLITE_THREADSAFE=2 -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_JSON1 -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_DEFAULT_PAGE_SIZE=4096 -DSQLITE_DEFAULT_CACHE_SIZE=-2000" />
-->
</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
Loading

0 comments on commit a0e2601

Please sign in to comment.