4 ** The author disclaims copyright to this source code. In place of
5 ** a legal notice, here is a blessing:
7 ** May you do good and not evil.
8 ** May you find forgiveness for yourself and forgive others.
9 ** May you share freely, never taking more than you give.
11 *************************************************************************
13 ** This file implements routines used to report what compile-time options
14 ** SQLite was built with.
17 #ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
19 #include "sqliteInt.h"
22 ** An array of names of all compile-time options. This array should
25 ** This array looks large, but in a typical installation actually uses
26 ** only a handful of compile-time options, so most times this array is usually
27 ** rather short and uses little memory space.
29 static const char * const azCompileOpt
[] = {
31 /* These macros are provided to "stringify" the value of the define
32 ** for those options in which the value is meaningful. */
33 #define CTIMEOPT_VAL_(opt) #opt
34 #define CTIMEOPT_VAL(opt) CTIMEOPT_VAL_(opt)
36 #ifdef SQLITE_32BIT_ROWID
39 #ifdef SQLITE_4_BYTE_ALIGNED_MALLOC
40 "4_BYTE_ALIGNED_MALLOC",
42 #ifdef SQLITE_CASE_SENSITIVE_LIKE
43 "CASE_SENSITIVE_LIKE",
45 #ifdef SQLITE_CHECK_PAGES
48 #ifdef SQLITE_COVERAGE_TEST
57 #ifdef SQLITE_DEFAULT_LOCKING_MODE
58 "DEFAULT_LOCKING_MODE=" CTIMEOPT_VAL(SQLITE_DEFAULT_LOCKING_MODE
),
60 #ifdef SQLITE_DISABLE_DIRSYNC
63 #ifdef SQLITE_DISABLE_LFS
66 #ifdef SQLITE_ENABLE_ATOMIC_WRITE
67 "ENABLE_ATOMIC_WRITE",
69 #ifdef SQLITE_ENABLE_CEROD
72 #ifdef SQLITE_ENABLE_COLUMN_METADATA
73 "ENABLE_COLUMN_METADATA",
75 #ifdef SQLITE_ENABLE_EXPENSIVE_ASSERT
76 "ENABLE_EXPENSIVE_ASSERT",
78 #ifdef SQLITE_ENABLE_FTS1
81 #ifdef SQLITE_ENABLE_FTS2
84 #ifdef SQLITE_ENABLE_FTS3
87 #ifdef SQLITE_ENABLE_FTS3_PARENTHESIS
88 "ENABLE_FTS3_PARENTHESIS",
90 #ifdef SQLITE_ENABLE_FTS4
93 #ifdef SQLITE_ENABLE_ICU
96 #ifdef SQLITE_ENABLE_IOTRACE
99 #ifdef SQLITE_ENABLE_LOAD_EXTENSION
100 "ENABLE_LOAD_EXTENSION",
102 #ifdef SQLITE_ENABLE_LOCKING_STYLE
103 "ENABLE_LOCKING_STYLE=" CTIMEOPT_VAL(SQLITE_ENABLE_LOCKING_STYLE
),
105 #ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
106 "ENABLE_MEMORY_MANAGEMENT",
108 #ifdef SQLITE_ENABLE_MEMSYS3
111 #ifdef SQLITE_ENABLE_MEMSYS5
114 #ifdef SQLITE_ENABLE_OVERSIZE_CELL_CHECK
115 "ENABLE_OVERSIZE_CELL_CHECK",
117 #ifdef SQLITE_ENABLE_RTREE
120 #ifdef SQLITE_ENABLE_STAT3
123 #ifdef SQLITE_ENABLE_UNLOCK_NOTIFY
124 "ENABLE_UNLOCK_NOTIFY",
126 #ifdef SQLITE_ENABLE_UPDATE_DELETE_LIMIT
127 "ENABLE_UPDATE_DELETE_LIMIT",
129 #ifdef SQLITE_HAS_CODEC
132 #ifdef SQLITE_HAVE_ISNAN
135 #ifdef SQLITE_HOMEGROWN_RECURSIVE_MUTEX
136 "HOMEGROWN_RECURSIVE_MUTEX",
138 #ifdef SQLITE_IGNORE_AFP_LOCK_ERRORS
139 "IGNORE_AFP_LOCK_ERRORS",
141 #ifdef SQLITE_IGNORE_FLOCK_LOCK_ERRORS
142 "IGNORE_FLOCK_LOCK_ERRORS",
144 #ifdef SQLITE_INT64_TYPE
147 #ifdef SQLITE_LOCK_TRACE
150 #ifdef SQLITE_MAX_SCHEMA_RETRY
151 "MAX_SCHEMA_RETRY=" CTIMEOPT_VAL(SQLITE_MAX_SCHEMA_RETRY
),
153 #ifdef SQLITE_MEMDEBUG
156 #ifdef SQLITE_MIXED_ENDIAN_64BIT_FLOAT
157 "MIXED_ENDIAN_64BIT_FLOAT",
159 #ifdef SQLITE_NO_SYNC
162 #ifdef SQLITE_OMIT_ALTERTABLE
165 #ifdef SQLITE_OMIT_ANALYZE
168 #ifdef SQLITE_OMIT_ATTACH
171 #ifdef SQLITE_OMIT_AUTHORIZATION
172 "OMIT_AUTHORIZATION",
174 #ifdef SQLITE_OMIT_AUTOINCREMENT
175 "OMIT_AUTOINCREMENT",
177 #ifdef SQLITE_OMIT_AUTOINIT
180 #ifdef SQLITE_OMIT_AUTOMATIC_INDEX
181 "OMIT_AUTOMATIC_INDEX",
183 #ifdef SQLITE_OMIT_AUTORESET
186 #ifdef SQLITE_OMIT_AUTOVACUUM
189 #ifdef SQLITE_OMIT_BETWEEN_OPTIMIZATION
190 "OMIT_BETWEEN_OPTIMIZATION",
192 #ifdef SQLITE_OMIT_BLOB_LITERAL
195 #ifdef SQLITE_OMIT_BTREECOUNT
198 #ifdef SQLITE_OMIT_BUILTIN_TEST
201 #ifdef SQLITE_OMIT_CAST
204 #ifdef SQLITE_OMIT_CHECK
208 ** #ifdef SQLITE_OMIT_COMPILEOPTION_DIAGS
209 ** "OMIT_COMPILEOPTION_DIAGS",
212 #ifdef SQLITE_OMIT_COMPLETE
215 #ifdef SQLITE_OMIT_COMPOUND_SELECT
216 "OMIT_COMPOUND_SELECT",
218 #ifdef SQLITE_OMIT_DATETIME_FUNCS
219 "OMIT_DATETIME_FUNCS",
221 #ifdef SQLITE_OMIT_DECLTYPE
224 #ifdef SQLITE_OMIT_DEPRECATED
227 #ifdef SQLITE_OMIT_DISKIO
230 #ifdef SQLITE_OMIT_EXPLAIN
233 #ifdef SQLITE_OMIT_FLAG_PRAGMAS
236 #ifdef SQLITE_OMIT_FLOATING_POINT
237 "OMIT_FLOATING_POINT",
239 #ifdef SQLITE_OMIT_FOREIGN_KEY
242 #ifdef SQLITE_OMIT_GET_TABLE
245 #ifdef SQLITE_OMIT_INCRBLOB
248 #ifdef SQLITE_OMIT_INTEGRITY_CHECK
249 "OMIT_INTEGRITY_CHECK",
251 #ifdef SQLITE_OMIT_LIKE_OPTIMIZATION
252 "OMIT_LIKE_OPTIMIZATION",
254 #ifdef SQLITE_OMIT_LOAD_EXTENSION
255 "OMIT_LOAD_EXTENSION",
257 #ifdef SQLITE_OMIT_LOCALTIME
260 #ifdef SQLITE_OMIT_LOOKASIDE
263 #ifdef SQLITE_OMIT_MEMORYDB
266 #ifdef SQLITE_OMIT_MERGE_SORT
269 #ifdef SQLITE_OMIT_OR_OPTIMIZATION
270 "OMIT_OR_OPTIMIZATION",
272 #ifdef SQLITE_OMIT_PAGER_PRAGMAS
273 "OMIT_PAGER_PRAGMAS",
275 #ifdef SQLITE_OMIT_PRAGMA
278 #ifdef SQLITE_OMIT_PROGRESS_CALLBACK
279 "OMIT_PROGRESS_CALLBACK",
281 #ifdef SQLITE_OMIT_QUICKBALANCE
284 #ifdef SQLITE_OMIT_REINDEX
287 #ifdef SQLITE_OMIT_SCHEMA_PRAGMAS
288 "OMIT_SCHEMA_PRAGMAS",
290 #ifdef SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS
291 "OMIT_SCHEMA_VERSION_PRAGMAS",
293 #ifdef SQLITE_OMIT_SHARED_CACHE
296 #ifdef SQLITE_OMIT_SUBQUERY
299 #ifdef SQLITE_OMIT_TCL_VARIABLE
302 #ifdef SQLITE_OMIT_TEMPDB
305 #ifdef SQLITE_OMIT_TRACE
308 #ifdef SQLITE_OMIT_TRIGGER
311 #ifdef SQLITE_OMIT_TRUNCATE_OPTIMIZATION
312 "OMIT_TRUNCATE_OPTIMIZATION",
314 #ifdef SQLITE_OMIT_UTF16
317 #ifdef SQLITE_OMIT_VACUUM
320 #ifdef SQLITE_OMIT_VIEW
323 #ifdef SQLITE_OMIT_VIRTUALTABLE
326 #ifdef SQLITE_OMIT_WAL
329 #ifdef SQLITE_OMIT_WSD
332 #ifdef SQLITE_OMIT_XFER_OPT
335 #ifdef SQLITE_PERFORMANCE_TRACE
338 #ifdef SQLITE_PROXY_DEBUG
341 #ifdef SQLITE_SECURE_DELETE
344 #ifdef SQLITE_SMALL_STACK
347 #ifdef SQLITE_SOUNDEX
353 #ifdef SQLITE_TEMP_STORE
354 "TEMP_STORE=" CTIMEOPT_VAL(SQLITE_TEMP_STORE
),
359 #ifdef SQLITE_THREADSAFE
360 "THREADSAFE=" CTIMEOPT_VAL(SQLITE_THREADSAFE
),
362 #ifdef SQLITE_USE_ALLOCA
365 #ifdef SQLITE_ZERO_MALLOC
371 ** Given the name of a compile-time option, return true if that option
372 ** was used and false if not.
374 ** The name can optionally begin with "SQLITE_" but the "SQLITE_" prefix
375 ** is not required for a match.
377 int sqlite3_compileoption_used(const char *zOptName
){
379 if( sqlite3StrNICmp(zOptName
, "SQLITE_", 7)==0 ) zOptName
+= 7;
380 n
= sqlite3Strlen30(zOptName
);
382 /* Since ArraySize(azCompileOpt) is normally in single digits, a
383 ** linear search is adequate. No need for a binary search. */
384 for(i
=0; i
<ArraySize(azCompileOpt
); i
++){
385 if( (sqlite3StrNICmp(zOptName
, azCompileOpt
[i
], n
)==0)
386 && ( (azCompileOpt
[i
][n
]==0) || (azCompileOpt
[i
][n
]=='=') ) ) return 1;
392 ** Return the N-th compile-time option string. If N is out of range,
393 ** return a NULL pointer.
395 const char *sqlite3_compileoption_get(int N
){
396 if( N
>=0 && N
<ArraySize(azCompileOpt
) ){
397 return azCompileOpt
[N
];
402 #endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */