Skip to content

Commit

Permalink
SQLite build with flag fixes in this version branch
Browse files Browse the repository at this point in the history
- SQLITE_THREADSAFE=2 on iOS/macOS (SQLITE_THREADSAFE=1 on Android/Windows) to
  avoid possible malformed database due to multithreaded access
  ref: storesafe#703
- Drop -DSQLITE_OMIT_BUILTIN_TEST (renamed & not recommended)
- Certain LOCAL_CFLAGS added from
  https://www.sqlite.org/compile.html#recommended_compile_time_options
- Minor reordering
  • Loading branch information
Christopher J. Brody committed Nov 3, 2017
1 parent da62bbe commit ece0c61
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 7 deletions.
3 changes: 2 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Changes

##### cordova-sqlite-legacy-core 1.0.1-pre1
##### cordova-sqlite-legacy-core 1.0.1

- 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
Expand Down
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,23 @@ Use the `location` or `iosDatabaseLocation` option in `sqlitePlugin.openDatabase

- A recent version of the Cordova CLI (such as `6.5.0`) is recommended. Cordova versions older than `6.0.0` are missing the `[email protected]` security fixes. In addition it is *required* to use `cordova prepare` in case of cordova-ios older than `4.3.0` (Cordova CLI `6.4.0`).
- This version uses a `before_plugin_install` hook to install sqlite3 library dependencies from `cordova-sqlite-storage-dependencies` via npm.
- Build with SQLite (version `3.8.10.2`) with the following build settings for iOS/macOS/Windows:
- `SQLITE_THREADSAFE=1` (`SQLITE_THREADSAFE=2` on iOS/macOS)
- `SQLITE_DEFAULT_MEMSTATUS=0`
- `SQLITE_OMIT_DECLTYPE`
- `SQLITE_OMIT_DEPRECATED`
- `SQLITE_OMIT_PROGRESS_CALLBACK`
- `SQLITE_OMIT_SHARED_CACHE`
- `SQLITE_TEMP_STORE=2`
- `SQLITE_OMIT_LOAD_EXTENSION`
- `SQLITE_ENABLE_FTS3`
- `SQLITE_ENABLE_FTS3_PARENTHESIS`
- `SQLITE_ENABLE_FTS4`
- `SQLITE_ENABLE_RTREE`
- `SQLITE_DEFAULT_PAGE_SIZE=1024` and `SQLITE_DEFAULT_CACHE_SIZE=2000` to avoid "potentially distruptive change(s)" from SQLite 3.12.0 ref: <http://sqlite.org/pgszchng2016.html>
- `SQLITE_OS_WINRT` for Windows only
- Use of other systems such as Cordova Plugman, PhoneGap CLI, PhoneGap Build, and Intel XDK is no longer supported since they do not honor the `before_plugin_install` hook. The supported solution is to use [litehelpers / Cordova-sqlite-evcore-extbuild-free](https://github.com/litehelpers/Cordova-sqlite-evcore-extbuild-free) (available with GPL or commercial license options) or [litehelpers / Cordova-sqlite-legacy-build-support](https://github.com/litehelpers/Cordova-sqlite-legacy-build-support) (limited testing, limited updates)
- The iOS database location is now mandatory, as documented below.
- _SQLite version `3.8.10.2` is supported for ~~all supported platforms~~ Android/iOS/Windows; macOS platform version in this version branch uses the builtin `libsqlite3.dylib` framework library (**TODO** iOS and macOS should use the same sqlite version)_
- This version supports the use of two (2) possible Android sqlite database implementations:
- default: lightweight [Android-sqlite-connector](https://github.com/liteglue/Android-sqlite-connector)
- optional: built-in Android database classes (usage described below)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cordova-sqlite-legacy-core",
"version": "1.0.1-pre1",
"version": "1.0.1",
"description": "Native interface to SQLite for PhoneGap/Cordova (legacy core version branch)",
"cordova": {
"id": "cordova-sqlite-legacy-core",
Expand Down
8 changes: 5 additions & 3 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-legacy-core"
version="1.0.1-pre1">
version="1.0.1">

<name>Cordova sqlite storage plugin - legacy core version branch</name>

Expand Down Expand Up @@ -60,7 +60,7 @@

<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_TEMP_STORE=2 -DSQLITE_THREADSAFE=2 -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_RTREE -DSQLITE_LOCKING_STYLE=1 -DSQLITE_OMIT_BUILTIN_TEST -DSQLITE_OMIT_LOAD_EXTENSION" />
compiler-flags="-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 (osx) -->
Expand All @@ -78,7 +78,9 @@
<header-file src="src/ios/PSPDFThreadSafeMutableDictionary.h" />
<source-file src="src/ios/PSPDFThreadSafeMutableDictionary.m" />

<framework src="libsqlite3.dylib" />
<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=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
2 changes: 1 addition & 1 deletion src/windows/SQLite3-Win-RT/SQLite3/SQLite3.Shared.vcxitems
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory);$(MSBuildThisFileDirectory)..\..\..\..\node_modules\cordova-sqlite-storage-dependencies</AdditionalIncludeDirectories>
<AdditionalOptions>/DSQLITE_TEMP_STORE=2 /DSQLITE_THREADSAFE=2 /DSQLITE_ENABLE_FTS3 /DSQLITE_ENABLE_FTS3_PARENTHESIS /DSQLITE_ENABLE_FTS4 /DSQLITE_ENABLE_COLUMN_METADATA /DSQLITE_ENABLE_RTREE /DSQLITE_OS_WINRT %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/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_OS_WINRT %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup>
Expand Down

0 comments on commit ece0c61

Please sign in to comment.