Skip to content

Conversation

groue
Copy link
Owner

@groue groue commented Sep 28, 2025

This pull request aims at easing the job of #1708 and #1816, by checking the SQLITE_HAS_CODEC compiler flag for enabling SQLCipher features.

The GRDBCIPHER compiler flag is now only used for detecting the SQLCipher CocoaPods:

#if GRDBCIPHER
import SQLCipher // CocoaPods
#elseif SomeTrait
import ...
#elseif OtherTrait
import ...
#endif

#if SQLITE_HAS_CODEC
// GRDB is linked against some flavor of SQLCipher:
// sqlite3_key, PRAGMA cipher_version, etc. are available
#endif

@marcprux, @R4N, I'll merge if you both agree that this pull request is actually useful.

… availability

GRDBCIPHER is now just a marker for importing SQLCipher with CocoaPods.
@groue
Copy link
Owner Author

groue commented Sep 28, 2025

Also, @marcprux, I believe this new interpretation of compiler flags removes the need to rework the order of imports, as in b26c42c. Am I correct?

@R4N
Copy link

R4N commented Sep 29, 2025

@groue This looks good to us as well. I believe we'll still need to adjust the order so that the SQLCIPHER/SKIP_SQLCIPHER import checks are prior to SWIFT_PACKAGE import check in our PR's since SWIFT_PACKAGE will be true for both:

// Import C SQLite functions
#if SQLCIPHER
import SQLCipher
// #elseif SKIP_SQLCIPHER
// import for SKIP_SQLCIPHER
#elseif SWIFT_PACKAGE
import GRDBSQLite
#elseif GRDBCIPHER
import SQLCipher
#elseif !GRDBCUSTOMSQLITE && !SQLITE_HAS_CODEC
import SQLite3
#endif

we'll sync up our fork once this is merged in and base our PR off of it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants