Update mojo sdk to rev 1dc8a9a5db73d3718d99917fadf31f5fb2ebad4f
[chromium-blink-merge.git] / third_party / sqlite / sqlite-src-3080704 / src / ctime.c
blob82a2f352044804e44384fec0ddb932cf5190d433
1 /*
2 ** 2010 February 23
3 **
4 ** The author disclaims copyright to this source code. In place of
5 ** a legal notice, here is a blessing:
6 **
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
23 ** be sorted A-Z.
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
37 "32BIT_ROWID",
38 #endif
39 #ifdef SQLITE_4_BYTE_ALIGNED_MALLOC
40 "4_BYTE_ALIGNED_MALLOC",
41 #endif
42 #ifdef SQLITE_CASE_SENSITIVE_LIKE
43 "CASE_SENSITIVE_LIKE",
44 #endif
45 #ifdef SQLITE_CHECK_PAGES
46 "CHECK_PAGES",
47 #endif
48 #ifdef SQLITE_COVERAGE_TEST
49 "COVERAGE_TEST",
50 #endif
51 #ifdef SQLITE_DEBUG
52 "DEBUG",
53 #endif
54 #ifdef SQLITE_DEFAULT_LOCKING_MODE
55 "DEFAULT_LOCKING_MODE=" CTIMEOPT_VAL(SQLITE_DEFAULT_LOCKING_MODE),
56 #endif
57 #if defined(SQLITE_DEFAULT_MMAP_SIZE) && !defined(SQLITE_DEFAULT_MMAP_SIZE_xc)
58 "DEFAULT_MMAP_SIZE=" CTIMEOPT_VAL(SQLITE_DEFAULT_MMAP_SIZE),
59 #endif
60 #ifdef SQLITE_DISABLE_DIRSYNC
61 "DISABLE_DIRSYNC",
62 #endif
63 #ifdef SQLITE_DISABLE_LFS
64 "DISABLE_LFS",
65 #endif
66 #ifdef SQLITE_ENABLE_ATOMIC_WRITE
67 "ENABLE_ATOMIC_WRITE",
68 #endif
69 #ifdef SQLITE_ENABLE_CEROD
70 "ENABLE_CEROD",
71 #endif
72 #ifdef SQLITE_ENABLE_COLUMN_METADATA
73 "ENABLE_COLUMN_METADATA",
74 #endif
75 #ifdef SQLITE_ENABLE_EXPENSIVE_ASSERT
76 "ENABLE_EXPENSIVE_ASSERT",
77 #endif
78 #ifdef SQLITE_ENABLE_FTS1
79 "ENABLE_FTS1",
80 #endif
81 #ifdef SQLITE_ENABLE_FTS2
82 "ENABLE_FTS2",
83 #endif
84 #ifdef SQLITE_ENABLE_FTS3
85 "ENABLE_FTS3",
86 #endif
87 #ifdef SQLITE_ENABLE_FTS3_PARENTHESIS
88 "ENABLE_FTS3_PARENTHESIS",
89 #endif
90 #ifdef SQLITE_ENABLE_FTS4
91 "ENABLE_FTS4",
92 #endif
93 #ifdef SQLITE_ENABLE_ICU
94 "ENABLE_ICU",
95 #endif
96 #ifdef SQLITE_ENABLE_IOTRACE
97 "ENABLE_IOTRACE",
98 #endif
99 #ifdef SQLITE_ENABLE_LOAD_EXTENSION
100 "ENABLE_LOAD_EXTENSION",
101 #endif
102 #ifdef SQLITE_ENABLE_LOCKING_STYLE
103 "ENABLE_LOCKING_STYLE=" CTIMEOPT_VAL(SQLITE_ENABLE_LOCKING_STYLE),
104 #endif
105 #ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
106 "ENABLE_MEMORY_MANAGEMENT",
107 #endif
108 #ifdef SQLITE_ENABLE_MEMSYS3
109 "ENABLE_MEMSYS3",
110 #endif
111 #ifdef SQLITE_ENABLE_MEMSYS5
112 "ENABLE_MEMSYS5",
113 #endif
114 #ifdef SQLITE_ENABLE_OVERSIZE_CELL_CHECK
115 "ENABLE_OVERSIZE_CELL_CHECK",
116 #endif
117 #ifdef SQLITE_ENABLE_RTREE
118 "ENABLE_RTREE",
119 #endif
120 #if defined(SQLITE_ENABLE_STAT4)
121 "ENABLE_STAT4",
122 #elif defined(SQLITE_ENABLE_STAT3)
123 "ENABLE_STAT3",
124 #endif
125 #ifdef SQLITE_ENABLE_UNLOCK_NOTIFY
126 "ENABLE_UNLOCK_NOTIFY",
127 #endif
128 #ifdef SQLITE_ENABLE_UPDATE_DELETE_LIMIT
129 "ENABLE_UPDATE_DELETE_LIMIT",
130 #endif
131 #ifdef SQLITE_HAS_CODEC
132 "HAS_CODEC",
133 #endif
134 #ifdef SQLITE_HAVE_ISNAN
135 "HAVE_ISNAN",
136 #endif
137 #ifdef SQLITE_HOMEGROWN_RECURSIVE_MUTEX
138 "HOMEGROWN_RECURSIVE_MUTEX",
139 #endif
140 #ifdef SQLITE_IGNORE_AFP_LOCK_ERRORS
141 "IGNORE_AFP_LOCK_ERRORS",
142 #endif
143 #ifdef SQLITE_IGNORE_FLOCK_LOCK_ERRORS
144 "IGNORE_FLOCK_LOCK_ERRORS",
145 #endif
146 #ifdef SQLITE_INT64_TYPE
147 "INT64_TYPE",
148 #endif
149 #ifdef SQLITE_LOCK_TRACE
150 "LOCK_TRACE",
151 #endif
152 #if defined(SQLITE_MAX_MMAP_SIZE) && !defined(SQLITE_MAX_MMAP_SIZE_xc)
153 "MAX_MMAP_SIZE=" CTIMEOPT_VAL(SQLITE_MAX_MMAP_SIZE),
154 #endif
155 #ifdef SQLITE_MAX_SCHEMA_RETRY
156 "MAX_SCHEMA_RETRY=" CTIMEOPT_VAL(SQLITE_MAX_SCHEMA_RETRY),
157 #endif
158 #ifdef SQLITE_MEMDEBUG
159 "MEMDEBUG",
160 #endif
161 #ifdef SQLITE_MIXED_ENDIAN_64BIT_FLOAT
162 "MIXED_ENDIAN_64BIT_FLOAT",
163 #endif
164 #ifdef SQLITE_NO_SYNC
165 "NO_SYNC",
166 #endif
167 #ifdef SQLITE_OMIT_ALTERTABLE
168 "OMIT_ALTERTABLE",
169 #endif
170 #ifdef SQLITE_OMIT_ANALYZE
171 "OMIT_ANALYZE",
172 #endif
173 #ifdef SQLITE_OMIT_ATTACH
174 "OMIT_ATTACH",
175 #endif
176 #ifdef SQLITE_OMIT_AUTHORIZATION
177 "OMIT_AUTHORIZATION",
178 #endif
179 #ifdef SQLITE_OMIT_AUTOINCREMENT
180 "OMIT_AUTOINCREMENT",
181 #endif
182 #ifdef SQLITE_OMIT_AUTOINIT
183 "OMIT_AUTOINIT",
184 #endif
185 #ifdef SQLITE_OMIT_AUTOMATIC_INDEX
186 "OMIT_AUTOMATIC_INDEX",
187 #endif
188 #ifdef SQLITE_OMIT_AUTORESET
189 "OMIT_AUTORESET",
190 #endif
191 #ifdef SQLITE_OMIT_AUTOVACUUM
192 "OMIT_AUTOVACUUM",
193 #endif
194 #ifdef SQLITE_OMIT_BETWEEN_OPTIMIZATION
195 "OMIT_BETWEEN_OPTIMIZATION",
196 #endif
197 #ifdef SQLITE_OMIT_BLOB_LITERAL
198 "OMIT_BLOB_LITERAL",
199 #endif
200 #ifdef SQLITE_OMIT_BTREECOUNT
201 "OMIT_BTREECOUNT",
202 #endif
203 #ifdef SQLITE_OMIT_BUILTIN_TEST
204 "OMIT_BUILTIN_TEST",
205 #endif
206 #ifdef SQLITE_OMIT_CAST
207 "OMIT_CAST",
208 #endif
209 #ifdef SQLITE_OMIT_CHECK
210 "OMIT_CHECK",
211 #endif
212 #ifdef SQLITE_OMIT_COMPLETE
213 "OMIT_COMPLETE",
214 #endif
215 #ifdef SQLITE_OMIT_COMPOUND_SELECT
216 "OMIT_COMPOUND_SELECT",
217 #endif
218 #ifdef SQLITE_OMIT_CTE
219 "OMIT_CTE",
220 #endif
221 #ifdef SQLITE_OMIT_DATETIME_FUNCS
222 "OMIT_DATETIME_FUNCS",
223 #endif
224 #ifdef SQLITE_OMIT_DECLTYPE
225 "OMIT_DECLTYPE",
226 #endif
227 #ifdef SQLITE_OMIT_DEPRECATED
228 "OMIT_DEPRECATED",
229 #endif
230 #ifdef SQLITE_OMIT_DISKIO
231 "OMIT_DISKIO",
232 #endif
233 #ifdef SQLITE_OMIT_EXPLAIN
234 "OMIT_EXPLAIN",
235 #endif
236 #ifdef SQLITE_OMIT_FLAG_PRAGMAS
237 "OMIT_FLAG_PRAGMAS",
238 #endif
239 #ifdef SQLITE_OMIT_FLOATING_POINT
240 "OMIT_FLOATING_POINT",
241 #endif
242 #ifdef SQLITE_OMIT_FOREIGN_KEY
243 "OMIT_FOREIGN_KEY",
244 #endif
245 #ifdef SQLITE_OMIT_GET_TABLE
246 "OMIT_GET_TABLE",
247 #endif
248 #ifdef SQLITE_OMIT_INCRBLOB
249 "OMIT_INCRBLOB",
250 #endif
251 #ifdef SQLITE_OMIT_INTEGRITY_CHECK
252 "OMIT_INTEGRITY_CHECK",
253 #endif
254 #ifdef SQLITE_OMIT_LIKE_OPTIMIZATION
255 "OMIT_LIKE_OPTIMIZATION",
256 #endif
257 #ifdef SQLITE_OMIT_LOAD_EXTENSION
258 "OMIT_LOAD_EXTENSION",
259 #endif
260 #ifdef SQLITE_OMIT_LOCALTIME
261 "OMIT_LOCALTIME",
262 #endif
263 #ifdef SQLITE_OMIT_LOOKASIDE
264 "OMIT_LOOKASIDE",
265 #endif
266 #ifdef SQLITE_OMIT_MEMORYDB
267 "OMIT_MEMORYDB",
268 #endif
269 #ifdef SQLITE_OMIT_OR_OPTIMIZATION
270 "OMIT_OR_OPTIMIZATION",
271 #endif
272 #ifdef SQLITE_OMIT_PAGER_PRAGMAS
273 "OMIT_PAGER_PRAGMAS",
274 #endif
275 #ifdef SQLITE_OMIT_PRAGMA
276 "OMIT_PRAGMA",
277 #endif
278 #ifdef SQLITE_OMIT_PROGRESS_CALLBACK
279 "OMIT_PROGRESS_CALLBACK",
280 #endif
281 #ifdef SQLITE_OMIT_QUICKBALANCE
282 "OMIT_QUICKBALANCE",
283 #endif
284 #ifdef SQLITE_OMIT_REINDEX
285 "OMIT_REINDEX",
286 #endif
287 #ifdef SQLITE_OMIT_SCHEMA_PRAGMAS
288 "OMIT_SCHEMA_PRAGMAS",
289 #endif
290 #ifdef SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS
291 "OMIT_SCHEMA_VERSION_PRAGMAS",
292 #endif
293 #ifdef SQLITE_OMIT_SHARED_CACHE
294 "OMIT_SHARED_CACHE",
295 #endif
296 #ifdef SQLITE_OMIT_SUBQUERY
297 "OMIT_SUBQUERY",
298 #endif
299 #ifdef SQLITE_OMIT_TCL_VARIABLE
300 "OMIT_TCL_VARIABLE",
301 #endif
302 #ifdef SQLITE_OMIT_TEMPDB
303 "OMIT_TEMPDB",
304 #endif
305 #ifdef SQLITE_OMIT_TRACE
306 "OMIT_TRACE",
307 #endif
308 #ifdef SQLITE_OMIT_TRIGGER
309 "OMIT_TRIGGER",
310 #endif
311 #ifdef SQLITE_OMIT_TRUNCATE_OPTIMIZATION
312 "OMIT_TRUNCATE_OPTIMIZATION",
313 #endif
314 #ifdef SQLITE_OMIT_UTF16
315 "OMIT_UTF16",
316 #endif
317 #ifdef SQLITE_OMIT_VACUUM
318 "OMIT_VACUUM",
319 #endif
320 #ifdef SQLITE_OMIT_VIEW
321 "OMIT_VIEW",
322 #endif
323 #ifdef SQLITE_OMIT_VIRTUALTABLE
324 "OMIT_VIRTUALTABLE",
325 #endif
326 #ifdef SQLITE_OMIT_WAL
327 "OMIT_WAL",
328 #endif
329 #ifdef SQLITE_OMIT_WSD
330 "OMIT_WSD",
331 #endif
332 #ifdef SQLITE_OMIT_XFER_OPT
333 "OMIT_XFER_OPT",
334 #endif
335 #ifdef SQLITE_PERFORMANCE_TRACE
336 "PERFORMANCE_TRACE",
337 #endif
338 #ifdef SQLITE_PROXY_DEBUG
339 "PROXY_DEBUG",
340 #endif
341 #ifdef SQLITE_RTREE_INT_ONLY
342 "RTREE_INT_ONLY",
343 #endif
344 #ifdef SQLITE_SECURE_DELETE
345 "SECURE_DELETE",
346 #endif
347 #ifdef SQLITE_SMALL_STACK
348 "SMALL_STACK",
349 #endif
350 #ifdef SQLITE_SOUNDEX
351 "SOUNDEX",
352 #endif
353 #ifdef SQLITE_SYSTEM_MALLOC
354 "SYSTEM_MALLOC",
355 #endif
356 #ifdef SQLITE_TCL
357 "TCL",
358 #endif
359 #if defined(SQLITE_TEMP_STORE) && !defined(SQLITE_TEMP_STORE_xc)
360 "TEMP_STORE=" CTIMEOPT_VAL(SQLITE_TEMP_STORE),
361 #endif
362 #ifdef SQLITE_TEST
363 "TEST",
364 #endif
365 #if defined(SQLITE_THREADSAFE)
366 "THREADSAFE=" CTIMEOPT_VAL(SQLITE_THREADSAFE),
367 #endif
368 #ifdef SQLITE_USE_ALLOCA
369 "USE_ALLOCA",
370 #endif
371 #ifdef SQLITE_USER_AUTHENTICATION
372 "USER_AUTHENTICATION",
373 #endif
374 #ifdef SQLITE_WIN32_MALLOC
375 "WIN32_MALLOC",
376 #endif
377 #ifdef SQLITE_ZERO_MALLOC
378 "ZERO_MALLOC"
379 #endif
383 ** Given the name of a compile-time option, return true if that option
384 ** was used and false if not.
386 ** The name can optionally begin with "SQLITE_" but the "SQLITE_" prefix
387 ** is not required for a match.
389 int sqlite3_compileoption_used(const char *zOptName){
390 int i, n;
391 if( sqlite3StrNICmp(zOptName, "SQLITE_", 7)==0 ) zOptName += 7;
392 n = sqlite3Strlen30(zOptName);
394 /* Since ArraySize(azCompileOpt) is normally in single digits, a
395 ** linear search is adequate. No need for a binary search. */
396 for(i=0; i<ArraySize(azCompileOpt); i++){
397 if( sqlite3StrNICmp(zOptName, azCompileOpt[i], n)==0
398 && sqlite3IsIdChar((unsigned char)azCompileOpt[i][n])==0
400 return 1;
403 return 0;
407 ** Return the N-th compile-time option string. If N is out of range,
408 ** return a NULL pointer.
410 const char *sqlite3_compileoption_get(int N){
411 if( N>=0 && N<ArraySize(azCompileOpt) ){
412 return azCompileOpt[N];
414 return 0;
417 #endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */