Created
December 9, 2017 15:16
-
-
Save mingsai/4e12d7ea05f9274c4469b4e51b776071 to your computer and use it in GitHub Desktop.
Swift to Query Apple's Compile time Options for SQLite
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Stackoverflow Answer (https://stackoverflow.com/questions/2266584/iphone-app-with-sqlite-fts3-xcode-release-build-not-working/47729842#47729842) | |
Highlights the useful code supplied by @Robert Hawkey | |
Shows full code and output for Xcode 9/Swift 4.0.3 | |
Enables one to assess useful features of SQLite in iOS (eg. JSON SQL Functions) | |
Swift 4.0.3 | |
func testSQLiteOptions(){ | |
var db: OpaquePointer? = nil | |
var statement: OpaquePointer? = nil | |
sqlite3_open(self.dbPath, &db) | |
guard db != nil else {return} | |
NSLog("Compile options specified when Apple built the library:"); | |
if (sqlite3_prepare_v2(db, "PRAGMA compile_options", -1, &statement, nil) == SQLITE_OK) | |
{ | |
while (sqlite3_step(statement) == SQLITE_ROW) | |
{ | |
NSLog("%s", sqlite3_column_text(statement, 0)); | |
} | |
} | |
} | |
Output | |
2017-12-09 06:34:04.233638-0800 jlmj[5997:2882220] Compile options specified when Apple built the library: | |
2017-12-09 06:34:04.236378-0800 jlmj[5997:2882220] BUG_COMPATIBLE_20160819 | |
2017-12-09 06:34:04.236490-0800 jlmj[5997:2882220] COMPILER=clang-9.0.0 | |
2017-12-09 06:34:04.236574-0800 jlmj[5997:2882220] DEFAULT_CACHE_SIZE=128 | |
2017-12-09 06:34:04.236651-0800 jlmj[5997:2882220] DEFAULT_CKPTFULLFSYNC | |
2017-12-09 06:34:04.236727-0800 jlmj[5997:2882220] DEFAULT_JOURNAL_SIZE_LIMIT=32768 | |
2017-12-09 06:34:04.236803-0800 jlmj[5997:2882220] DEFAULT_PAGE_SIZE=4096 | |
2017-12-09 06:34:04.236968-0800 jlmj[5997:2882220] DEFAULT_SYNCHRONOUS=2 | |
2017-12-09 06:34:04.237046-0800 jlmj[5997:2882220] DEFAULT_WAL_SYNCHRONOUS=1 | |
2017-12-09 06:34:04.237121-0800 jlmj[5997:2882220] ENABLE_API_ARMOR | |
2017-12-09 06:34:04.237195-0800 jlmj[5997:2882220] ENABLE_COLUMN_METADATA | |
2017-12-09 06:34:04.237270-0800 jlmj[5997:2882220] ENABLE_DBSTAT_VTAB | |
2017-12-09 06:34:04.237345-0800 jlmj[5997:2882220] ENABLE_FTS3 | |
2017-12-09 06:34:04.237421-0800 jlmj[5997:2882220] ENABLE_FTS3_PARENTHESIS | |
2017-12-09 06:34:04.237497-0800 jlmj[5997:2882220] ENABLE_FTS3_TOKENIZER | |
2017-12-09 06:34:04.237648-0800 jlmj[5997:2882220] ENABLE_FTS4 | |
2017-12-09 06:34:04.237726-0800 jlmj[5997:2882220] ENABLE_FTS5 | |
2017-12-09 06:34:04.237802-0800 jlmj[5997:2882220] ENABLE_JSON1 | |
2017-12-09 06:34:04.237876-0800 jlmj[5997:2882220] ENABLE_LOCKING_STYLE=1 | |
2017-12-09 06:34:04.237950-0800 jlmj[5997:2882220] ENABLE_PREUPDATE_HOOK | |
2017-12-09 06:34:04.238023-0800 jlmj[5997:2882220] ENABLE_RTREE | |
2017-12-09 06:34:04.238097-0800 jlmj[5997:2882220] ENABLE_SESSION | |
2017-12-09 06:34:04.238172-0800 jlmj[5997:2882220] ENABLE_SNAPSHOT | |
2017-12-09 06:34:04.238248-0800 jlmj[5997:2882220] ENABLE_SQLLOG | |
2017-12-09 06:34:04.238323-0800 jlmj[5997:2882220] ENABLE_UNKNOWN_SQL_FUNCTION | |
2017-12-09 06:34:04.238398-0800 jlmj[5997:2882220] ENABLE_UPDATE_DELETE_LIMIT | |
2017-12-09 06:34:04.238473-0800 jlmj[5997:2882220] HAS_CODEC_RESTRICTED | |
2017-12-09 06:34:04.238548-0800 jlmj[5997:2882220] HAVE_ISNAN | |
2017-12-09 06:34:04.238622-0800 jlmj[5997:2882220] MAX_LENGTH=2147483645 | |
2017-12-09 06:34:04.238695-0800 jlmj[5997:2882220] MAX_MMAP_SIZE=20971520 | |
2017-12-09 06:34:04.242805-0800 jlmj[5997:2882220] MAX_VARIABLE_NUMBER=500000 | |
2017-12-09 06:34:04.242891-0800 jlmj[5997:2882220] OMIT_AUTORESET | |
2017-12-09 06:34:04.242967-0800 jlmj[5997:2882220] OMIT_LOAD_EXTENSION | |
2017-12-09 06:34:04.243045-0800 jlmj[5997:2882220] STMTJRNL_SPILL=131072 | |
2017-12-09 06:34:04.243120-0800 jlmj[5997:2882220] SUBSTR_COMPATIBILITY | |
2017-12-09 06:34:04.243196-0800 jlmj[5997:2882220] THREADSAFE=2 | |
2017-12-09 06:34:04.243509-0800 jlmj[5997:2882220] USE_URI | |
Reference | |
SQLite Compile-Time Options (https://sqlite.org/compile.html) | |
JSON SQLite Functions (https://sqlite.org/json1.html) | |
Pragma Statements (https://www.sqlite.org/pragma.html#pragma_compile_options) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment