-
-
Notifications
You must be signed in to change notification settings - Fork 727
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add GRDBCustomSQLite to permit easily building GRDB with a custom, embedded SQLite library #62
Conversation
To support building GRDB with a built-in custom SQLite build/version.
…BUILTIN_SQLITE or USING_SQLCIPHER defines. This enables easier compilation of a custom version of SQLite that itself uses the SQLITE_HAS_CODEC define. (ex. If building SQLite with the SQLite Encryption Extension.) The SQLITE_HAS_CODEC define is now only used to guard use of the SQLite encryption APIs. GRDBCipher builds define USING_BUILTIN_SQLITE and USING_SQLCIPHER.
…erve user customizations. Added .example files. Added build phase script to copy .example files if user configuration files are not already present.
Define CUSTOM_OTHER_SWIFT_FLAGS in GRDB.xcconfig prior to including the "GRDBCustomSQLite-USER.xcconfig" file.
We need this to be able to take advantage of the new "Pre-Update Hook" available in SQLite 3.13.0. (Which requires both the newer version of SQLite, and building SQLite with SQLITE_ENABLE_PREUPDATE_HOOK defined.) Pre-update hooks should dramatically simplify our setup for syncing a GRDB database with the cloud - as they provide the before & after! 😁 So, changed columns... information on what the row was before it was deleted... etc! |
That's gorgeous. |
@swiftlyfalling You did an amazing job. Thanks a lot. |
This PR has shipped in v0.71.0 |
This PR lays the groundwork for building GRDB with a custom embedded version of SQLite. (Simply use the GRDBCustomSQLite variant instead of GRDB.)
This enables framework consumers to build with optional SQLite features and change other compile-time SQLite settings, as well as include the latest version of SQLite (instead of relying on the system version).
This is similar in spirit to the SQLCipher integration, but tweaks were made to no longer use SQLite compilation option flags to determine which library to import. (i.e. Previous uses of SQLITE_HAS_CODEC that were guarding "import GRDBCipher" have been changed to a neutral USING_SQLCIPHER or USING_BUILTIN_SQLITE as appropriate - the latter defined by both GRDBCipher and GRDBCustomSQLite.) This enables distinguishing the target framework from the actual options used to compile SQLite, and enables framework consumers to compile a custom SQLite with a different encryption extension (such as the official SQLite Encryption Extension.) The SQLITE_HAS_CODEC define is now only used to guard use of the SQLite encryption APIs.
GRDBCustomSQLite has OSX & iOS targets, and the standard test suite for both (matching GRDBCipher).
Documentation is available in the README.md in the /SQLiteCustom/ folder.