establish default sqlcipher log level and target upon first activation
[sqlcipher.git] / src / test_config.c
blob762bc7b365e259b89529387a885bc4383660b28f
1 /*
2 ** 2007 May 7
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 *************************************************************************
12 **
13 ** This file contains code used for testing the SQLite system.
14 ** None of the code in this file goes into a deliverable build.
15 **
16 ** The focus of this file is providing the TCL testing layer
17 ** access to compile-time constants.
20 #include "sqliteLimit.h"
22 #include "sqliteInt.h"
23 #if SQLITE_OS_WIN
24 # include "os_win.h"
25 #endif
27 #if defined(INCLUDE_SQLITE_TCL_H)
28 # include "sqlite_tcl.h"
29 #else
30 # include "tcl.h"
31 #endif
32 #include <stdlib.h>
33 #include <string.h>
36 ** Macro to stringify the results of the evaluation a pre-processor
37 ** macro. i.e. so that STRINGVALUE(SQLITE_NOMEM) -> "7".
39 #define STRINGVALUE2(x) #x
40 #define STRINGVALUE(x) STRINGVALUE2(x)
43 ** This routine sets entries in the global ::sqlite_options() array variable
44 ** according to the compile-time configuration of the database. Test
45 ** procedures use this to determine when tests should be omitted.
47 static void set_options(Tcl_Interp *interp){
48 #if HAVE_MALLOC_USABLE_SIZE
49 Tcl_SetVar2(interp, "sqlite_options", "malloc_usable_size", "1",
50 TCL_GLOBAL_ONLY);
51 #else
52 Tcl_SetVar2(interp, "sqlite_options", "malloc_usable_size", "0",
53 TCL_GLOBAL_ONLY);
54 #endif
56 #ifdef SQLITE_32BIT_ROWID
57 Tcl_SetVar2(interp, "sqlite_options", "rowid32", "1", TCL_GLOBAL_ONLY);
58 #else
59 Tcl_SetVar2(interp, "sqlite_options", "rowid32", "0", TCL_GLOBAL_ONLY);
60 #endif
62 #ifdef SQLITE_ALLOW_ROWID_IN_VIEW
63 Tcl_SetVar2(
64 interp, "sqlite_options", "allow_rowid_in_view", "1", TCL_GLOBAL_ONLY);
65 #else
66 Tcl_SetVar2(
67 interp, "sqlite_options", "allow_rowid_in_view", "0", TCL_GLOBAL_ONLY);
68 #endif
70 #ifdef SQLITE_CASE_SENSITIVE_LIKE
71 Tcl_SetVar2(interp, "sqlite_options","casesensitivelike","1",TCL_GLOBAL_ONLY);
72 #else
73 Tcl_SetVar2(interp, "sqlite_options","casesensitivelike","0",TCL_GLOBAL_ONLY);
74 #endif
76 #ifdef CONFIG_SLOWDOWN_FACTOR
77 Tcl_SetVar2(interp, "sqlite_options","configslower",
78 STRINGVALUE(CONFIG_SLOWDOWN_FACTOR),TCL_GLOBAL_ONLY);
79 #else
80 Tcl_SetVar2(interp, "sqlite_options","configslower","1.0",TCL_GLOBAL_ONLY);
81 #endif
83 #if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT
84 Tcl_SetVar2(interp, "sqlite_options", "curdir", "1", TCL_GLOBAL_ONLY);
85 #else
86 Tcl_SetVar2(interp, "sqlite_options", "curdir", "0", TCL_GLOBAL_ONLY);
87 #endif
89 #ifdef SQLITE_WIN32_MALLOC
90 Tcl_SetVar2(interp, "sqlite_options", "win32malloc", "1", TCL_GLOBAL_ONLY);
91 #else
92 Tcl_SetVar2(interp, "sqlite_options", "win32malloc", "0", TCL_GLOBAL_ONLY);
93 #endif
95 #ifdef SQLITE_DEBUG
96 Tcl_SetVar2(interp, "sqlite_options", "debug", "1", TCL_GLOBAL_ONLY);
97 #else
98 Tcl_SetVar2(interp, "sqlite_options", "debug", "0", TCL_GLOBAL_ONLY);
99 #endif
101 #ifdef SQLITE_DEFAULT_CKPTFULLFSYNC
102 Tcl_SetVar2(interp, "sqlite_options", "default_ckptfullfsync",
103 SQLITE_DEFAULT_CKPTFULLFSYNC ? "1" : "0", TCL_GLOBAL_ONLY);
104 #else
105 Tcl_SetVar2(interp, "sqlite_options", "default_ckptfullfsync", "0", TCL_GLOBAL_ONLY);
106 #endif
108 #ifdef SQLITE_DIRECT_OVERFLOW_READ
109 Tcl_SetVar2(interp, "sqlite_options", "direct_read", "1", TCL_GLOBAL_ONLY);
110 #else
111 Tcl_SetVar2(interp, "sqlite_options", "direct_read", "0", TCL_GLOBAL_ONLY);
112 #endif
114 #ifdef SQLITE_DISABLE_DIRSYNC
115 Tcl_SetVar2(interp, "sqlite_options", "dirsync", "0", TCL_GLOBAL_ONLY);
116 #else
117 Tcl_SetVar2(interp, "sqlite_options", "dirsync", "1", TCL_GLOBAL_ONLY);
118 #endif
120 #ifdef SQLITE_DISABLE_LFS
121 Tcl_SetVar2(interp, "sqlite_options", "lfs", "0", TCL_GLOBAL_ONLY);
122 #else
123 Tcl_SetVar2(interp, "sqlite_options", "lfs", "1", TCL_GLOBAL_ONLY);
124 #endif
126 #ifdef SQLITE_DISABLE_PAGECACHE_OVERFLOW_STATS
127 Tcl_SetVar2(interp, "sqlite_options", "pagecache_overflow_stats","0",TCL_GLOBAL_ONLY);
128 #else
129 Tcl_SetVar2(interp, "sqlite_options", "pagecache_overflow_stats","1",TCL_GLOBAL_ONLY);
130 #endif
132 #if SQLITE_MAX_MMAP_SIZE>0
133 Tcl_SetVar2(interp, "sqlite_options", "mmap", "1", TCL_GLOBAL_ONLY);
134 #else
135 Tcl_SetVar2(interp, "sqlite_options", "mmap", "0", TCL_GLOBAL_ONLY);
136 #endif
138 Tcl_SetVar2(interp, "sqlite_options", "worker_threads",
139 STRINGVALUE(SQLITE_MAX_WORKER_THREADS), TCL_GLOBAL_ONLY
142 #ifdef SQLITE_MEMDEBUG
143 Tcl_SetVar2(interp, "sqlite_options", "memdebug", "1", TCL_GLOBAL_ONLY);
144 #else
145 Tcl_SetVar2(interp, "sqlite_options", "memdebug", "0", TCL_GLOBAL_ONLY);
146 #endif
148 #ifdef SQLITE_ENABLE_8_3_NAMES
149 Tcl_SetVar2(interp, "sqlite_options", "8_3_names", "1", TCL_GLOBAL_ONLY);
150 #else
151 Tcl_SetVar2(interp, "sqlite_options", "8_3_names", "0", TCL_GLOBAL_ONLY);
152 #endif
154 #ifdef SQLITE_ENABLE_CURSOR_HINTS
155 Tcl_SetVar2(interp, "sqlite_options", "cursorhints", "1", TCL_GLOBAL_ONLY);
156 #else
157 Tcl_SetVar2(interp, "sqlite_options", "cursorhints", "0", TCL_GLOBAL_ONLY);
158 #endif
160 #ifdef SQLITE_ENABLE_HIDDEN_COLUMNS
161 Tcl_SetVar2(interp, "sqlite_options", "hiddencolumns", "1", TCL_GLOBAL_ONLY);
162 #else
163 Tcl_SetVar2(interp, "sqlite_options", "hiddencolumns", "0", TCL_GLOBAL_ONLY);
164 #endif
166 #ifndef SQLITE_OMIT_DESERIALIZE
167 Tcl_SetVar2(interp, "sqlite_options", "deserialize", "1", TCL_GLOBAL_ONLY);
168 #else
169 Tcl_SetVar2(interp, "sqlite_options", "deserialize", "0", TCL_GLOBAL_ONLY);
170 #endif
172 #ifdef SQLITE_ENABLE_MATH_FUNCTIONS
173 Tcl_SetVar2(interp, "sqlite_options", "mathlib", "1", TCL_GLOBAL_ONLY);
174 #else
175 Tcl_SetVar2(interp, "sqlite_options", "mathlib", "0", TCL_GLOBAL_ONLY);
176 #endif
178 #ifdef SQLITE_ENABLE_MEMSYS3
179 Tcl_SetVar2(interp, "sqlite_options", "mem3", "1", TCL_GLOBAL_ONLY);
180 #else
181 Tcl_SetVar2(interp, "sqlite_options", "mem3", "0", TCL_GLOBAL_ONLY);
182 #endif
184 #ifdef SQLITE_ENABLE_MEMSYS5
185 Tcl_SetVar2(interp, "sqlite_options", "mem5", "1", TCL_GLOBAL_ONLY);
186 #else
187 Tcl_SetVar2(interp, "sqlite_options", "mem5", "0", TCL_GLOBAL_ONLY);
188 #endif
190 #ifdef SQLITE_ENABLE_OFFSET_SQL_FUNC
191 Tcl_SetVar2(interp, "sqlite_options", "offset_sql_func","1",TCL_GLOBAL_ONLY);
192 #else
193 Tcl_SetVar2(interp, "sqlite_options", "offset_sql_func","0",TCL_GLOBAL_ONLY);
194 #endif
196 #ifdef SQLITE_ENABLE_PREUPDATE_HOOK
197 Tcl_SetVar2(interp, "sqlite_options", "preupdate", "1", TCL_GLOBAL_ONLY);
198 #else
199 Tcl_SetVar2(interp, "sqlite_options", "preupdate", "0", TCL_GLOBAL_ONLY);
200 #endif
202 #ifdef SQLITE_ENABLE_SNAPSHOT
203 Tcl_SetVar2(interp, "sqlite_options", "snapshot", "1", TCL_GLOBAL_ONLY);
204 #else
205 Tcl_SetVar2(interp, "sqlite_options", "snapshot", "0", TCL_GLOBAL_ONLY);
206 #endif
208 #ifdef SQLITE_MUTEX_OMIT
209 Tcl_SetVar2(interp, "sqlite_options", "mutex", "0", TCL_GLOBAL_ONLY);
210 #else
211 Tcl_SetVar2(interp, "sqlite_options", "mutex", "1", TCL_GLOBAL_ONLY);
212 #endif
214 #ifdef SQLITE_MUTEX_NOOP
215 Tcl_SetVar2(interp, "sqlite_options", "mutex_noop", "1", TCL_GLOBAL_ONLY);
216 #else
217 Tcl_SetVar2(interp, "sqlite_options", "mutex_noop", "0", TCL_GLOBAL_ONLY);
218 #endif
220 #ifdef SQLITE_OMIT_ALTERTABLE
221 Tcl_SetVar2(interp, "sqlite_options", "altertable", "0", TCL_GLOBAL_ONLY);
222 #else
223 Tcl_SetVar2(interp, "sqlite_options", "altertable", "1", TCL_GLOBAL_ONLY);
224 #endif
226 #ifdef SQLITE_OMIT_ANALYZE
227 Tcl_SetVar2(interp, "sqlite_options", "analyze", "0", TCL_GLOBAL_ONLY);
228 #else
229 Tcl_SetVar2(interp, "sqlite_options", "analyze", "1", TCL_GLOBAL_ONLY);
230 #endif
232 #ifdef SQLITE_ENABLE_API_ARMOR
233 Tcl_SetVar2(interp, "sqlite_options", "api_armor", "1", TCL_GLOBAL_ONLY);
234 #else
235 Tcl_SetVar2(interp, "sqlite_options", "api_armor", "0", TCL_GLOBAL_ONLY);
236 #endif
238 #ifdef SQLITE_ENABLE_ATOMIC_WRITE
239 Tcl_SetVar2(interp, "sqlite_options", "atomicwrite", "1", TCL_GLOBAL_ONLY);
240 #else
241 Tcl_SetVar2(interp, "sqlite_options", "atomicwrite", "0", TCL_GLOBAL_ONLY);
242 #endif
244 #ifdef SQLITE_ENABLE_GEOPOLY
245 Tcl_SetVar2(interp, "sqlite_options", "geopoly", "1", TCL_GLOBAL_ONLY);
246 #else
247 Tcl_SetVar2(interp, "sqlite_options", "geopoly", "0", TCL_GLOBAL_ONLY);
248 #endif
250 #ifndef SQLITE_OMIT_JSON
251 Tcl_SetVar2(interp, "sqlite_options", "json1", "1", TCL_GLOBAL_ONLY);
252 #else
253 Tcl_SetVar2(interp, "sqlite_options", "json1", "0", TCL_GLOBAL_ONLY);
254 #endif
256 /* BEGIN SQLCIPHER */
257 #ifdef SQLITE_HAS_CODEC
258 Tcl_SetVar2(interp, "sqlite_options", "has_codec", "1", TCL_GLOBAL_ONLY);
259 #else
260 Tcl_SetVar2(interp, "sqlite_options", "has_codec", "0", TCL_GLOBAL_ONLY);
261 #endif
262 /* END SQLCIPHER */
264 #ifdef SQLITE_LIKE_DOESNT_MATCH_BLOBS
265 Tcl_SetVar2(interp, "sqlite_options", "like_match_blobs", "0", TCL_GLOBAL_ONLY);
266 #else
267 Tcl_SetVar2(interp, "sqlite_options", "like_match_blobs", "1", TCL_GLOBAL_ONLY);
268 #endif
270 #ifdef SQLITE_OMIT_ATTACH
271 Tcl_SetVar2(interp, "sqlite_options", "attach", "0", TCL_GLOBAL_ONLY);
272 #else
273 Tcl_SetVar2(interp, "sqlite_options", "attach", "1", TCL_GLOBAL_ONLY);
274 #endif
276 #ifdef SQLITE_OMIT_AUTHORIZATION
277 Tcl_SetVar2(interp, "sqlite_options", "auth", "0", TCL_GLOBAL_ONLY);
278 #else
279 Tcl_SetVar2(interp, "sqlite_options", "auth", "1", TCL_GLOBAL_ONLY);
280 #endif
282 #ifdef SQLITE_OMIT_AUTOINCREMENT
283 Tcl_SetVar2(interp, "sqlite_options", "autoinc", "0", TCL_GLOBAL_ONLY);
284 #else
285 Tcl_SetVar2(interp, "sqlite_options", "autoinc", "1", TCL_GLOBAL_ONLY);
286 #endif
288 #ifdef SQLITE_OMIT_AUTOMATIC_INDEX
289 Tcl_SetVar2(interp, "sqlite_options", "autoindex", "0", TCL_GLOBAL_ONLY);
290 #else
291 Tcl_SetVar2(interp, "sqlite_options", "autoindex", "1", TCL_GLOBAL_ONLY);
292 #endif
294 #ifdef SQLITE_OMIT_AUTORESET
295 Tcl_SetVar2(interp, "sqlite_options", "autoreset", "0", TCL_GLOBAL_ONLY);
296 #else
297 Tcl_SetVar2(interp, "sqlite_options", "autoreset", "1", TCL_GLOBAL_ONLY);
298 #endif
300 #ifdef SQLITE_OMIT_AUTOVACUUM
301 Tcl_SetVar2(interp, "sqlite_options", "autovacuum", "0", TCL_GLOBAL_ONLY);
302 #else
303 Tcl_SetVar2(interp, "sqlite_options", "autovacuum", "1", TCL_GLOBAL_ONLY);
304 #endif /* SQLITE_OMIT_AUTOVACUUM */
305 #if !defined(SQLITE_DEFAULT_AUTOVACUUM)
306 Tcl_SetVar2(interp,"sqlite_options","default_autovacuum","0",TCL_GLOBAL_ONLY);
307 #else
308 Tcl_SetVar2(interp, "sqlite_options", "default_autovacuum",
309 STRINGVALUE(SQLITE_DEFAULT_AUTOVACUUM), TCL_GLOBAL_ONLY);
310 #endif
312 #ifdef SQLITE_OMIT_BETWEEN_OPTIMIZATION
313 Tcl_SetVar2(interp, "sqlite_options", "between_opt", "0", TCL_GLOBAL_ONLY);
314 #else
315 Tcl_SetVar2(interp, "sqlite_options", "between_opt", "1", TCL_GLOBAL_ONLY);
316 #endif
318 #ifdef SQLITE_UNTESTABLE
319 Tcl_SetVar2(interp, "sqlite_options", "builtin_test", "0", TCL_GLOBAL_ONLY);
320 #else
321 Tcl_SetVar2(interp, "sqlite_options", "builtin_test", "1", TCL_GLOBAL_ONLY);
322 #endif
324 #ifdef SQLITE_OMIT_BLOB_LITERAL
325 Tcl_SetVar2(interp, "sqlite_options", "bloblit", "0", TCL_GLOBAL_ONLY);
326 #else
327 Tcl_SetVar2(interp, "sqlite_options", "bloblit", "1", TCL_GLOBAL_ONLY);
328 #endif
330 #ifdef SQLITE_OMIT_CAST
331 Tcl_SetVar2(interp, "sqlite_options", "cast", "0", TCL_GLOBAL_ONLY);
332 #else
333 Tcl_SetVar2(interp, "sqlite_options", "cast", "1", TCL_GLOBAL_ONLY);
334 #endif
336 #ifdef SQLITE_OMIT_CHECK
337 Tcl_SetVar2(interp, "sqlite_options", "check", "0", TCL_GLOBAL_ONLY);
338 #else
339 Tcl_SetVar2(interp, "sqlite_options", "check", "1", TCL_GLOBAL_ONLY);
340 #endif
342 #ifdef SQLITE_OMIT_CTE
343 Tcl_SetVar2(interp, "sqlite_options", "cte", "0", TCL_GLOBAL_ONLY);
344 #else
345 Tcl_SetVar2(interp, "sqlite_options", "cte", "1", TCL_GLOBAL_ONLY);
346 #endif
348 #ifdef SQLITE_ENABLE_COLUMN_METADATA
349 Tcl_SetVar2(interp, "sqlite_options", "columnmetadata", "1", TCL_GLOBAL_ONLY);
350 #else
351 Tcl_SetVar2(interp, "sqlite_options", "columnmetadata", "0", TCL_GLOBAL_ONLY);
352 #endif
354 #ifdef SQLITE_ENABLE_OVERSIZE_CELL_CHECK
355 Tcl_SetVar2(interp, "sqlite_options", "oversize_cell_check", "1",
356 TCL_GLOBAL_ONLY);
357 #else
358 Tcl_SetVar2(interp, "sqlite_options", "oversize_cell_check", "0",
359 TCL_GLOBAL_ONLY);
360 #endif
362 #ifdef SQLITE_OMIT_COMPILEOPTION_DIAGS
363 Tcl_SetVar2(interp, "sqlite_options", "compileoption_diags", "0", TCL_GLOBAL_ONLY);
364 #else
365 Tcl_SetVar2(interp, "sqlite_options", "compileoption_diags", "1", TCL_GLOBAL_ONLY);
366 #endif
368 #ifdef SQLITE_OMIT_COMPLETE
369 Tcl_SetVar2(interp, "sqlite_options", "complete", "0", TCL_GLOBAL_ONLY);
370 #else
371 Tcl_SetVar2(interp, "sqlite_options", "complete", "1", TCL_GLOBAL_ONLY);
372 #endif
374 #ifdef SQLITE_OMIT_COMPOUND_SELECT
375 Tcl_SetVar2(interp, "sqlite_options", "compound", "0", TCL_GLOBAL_ONLY);
376 #else
377 Tcl_SetVar2(interp, "sqlite_options", "compound", "1", TCL_GLOBAL_ONLY);
378 #endif
380 Tcl_SetVar2(interp, "sqlite_options", "conflict", "1", TCL_GLOBAL_ONLY);
381 Tcl_SetVar2(interp, "sqlite_options", "crashtest", "1", TCL_GLOBAL_ONLY);
383 #ifdef SQLITE_OMIT_DATETIME_FUNCS
384 Tcl_SetVar2(interp, "sqlite_options", "datetime", "0", TCL_GLOBAL_ONLY);
385 #else
386 Tcl_SetVar2(interp, "sqlite_options", "datetime", "1", TCL_GLOBAL_ONLY);
387 #endif
389 #ifdef SQLITE_OMIT_DECLTYPE
390 Tcl_SetVar2(interp, "sqlite_options", "decltype", "0", TCL_GLOBAL_ONLY);
391 #else
392 Tcl_SetVar2(interp, "sqlite_options", "decltype", "1", TCL_GLOBAL_ONLY);
393 #endif
395 #ifdef SQLITE_OMIT_DEPRECATED
396 Tcl_SetVar2(interp, "sqlite_options", "deprecated", "0", TCL_GLOBAL_ONLY);
397 #else
398 Tcl_SetVar2(interp, "sqlite_options", "deprecated", "1", TCL_GLOBAL_ONLY);
399 #endif
401 #ifdef SQLITE_OMIT_DISKIO
402 Tcl_SetVar2(interp, "sqlite_options", "diskio", "0", TCL_GLOBAL_ONLY);
403 #else
404 Tcl_SetVar2(interp, "sqlite_options", "diskio", "1", TCL_GLOBAL_ONLY);
405 #endif
407 #ifdef SQLITE_OMIT_EXPLAIN
408 Tcl_SetVar2(interp, "sqlite_options", "explain", "0", TCL_GLOBAL_ONLY);
409 #else
410 Tcl_SetVar2(interp, "sqlite_options", "explain", "1", TCL_GLOBAL_ONLY);
411 #endif
413 #ifdef SQLITE_OMIT_FLOATING_POINT
414 Tcl_SetVar2(interp, "sqlite_options", "floatingpoint", "0", TCL_GLOBAL_ONLY);
415 #else
416 Tcl_SetVar2(interp, "sqlite_options", "floatingpoint", "1", TCL_GLOBAL_ONLY);
417 #endif
419 #ifdef SQLITE_OMIT_FOREIGN_KEY
420 Tcl_SetVar2(interp, "sqlite_options", "foreignkey", "0", TCL_GLOBAL_ONLY);
421 #else
422 Tcl_SetVar2(interp, "sqlite_options", "foreignkey", "1", TCL_GLOBAL_ONLY);
423 #endif
425 #ifdef SQLITE_ENABLE_FTS3
426 Tcl_SetVar2(interp, "sqlite_options", "fts3", "1", TCL_GLOBAL_ONLY);
427 #else
428 Tcl_SetVar2(interp, "sqlite_options", "fts3", "0", TCL_GLOBAL_ONLY);
429 #endif
431 #ifdef SQLITE_ENABLE_FTS5
432 Tcl_SetVar2(interp, "sqlite_options", "fts5", "1", TCL_GLOBAL_ONLY);
433 #else
434 Tcl_SetVar2(interp, "sqlite_options", "fts5", "0", TCL_GLOBAL_ONLY);
435 #endif
437 #if defined(SQLITE_ENABLE_FTS3) && !defined(SQLITE_DISABLE_FTS3_UNICODE)
438 Tcl_SetVar2(interp, "sqlite_options", "fts3_unicode", "1", TCL_GLOBAL_ONLY);
439 #else
440 Tcl_SetVar2(interp, "sqlite_options", "fts3_unicode", "0", TCL_GLOBAL_ONLY);
441 #endif
443 #ifdef SQLITE_DISABLE_FTS4_DEFERRED
444 Tcl_SetVar2(interp, "sqlite_options", "fts4_deferred", "0", TCL_GLOBAL_ONLY);
445 #else
446 Tcl_SetVar2(interp, "sqlite_options", "fts4_deferred", "1", TCL_GLOBAL_ONLY);
447 #endif
449 #ifdef SQLITE_OMIT_GET_TABLE
450 Tcl_SetVar2(interp, "sqlite_options", "gettable", "0", TCL_GLOBAL_ONLY);
451 #else
452 Tcl_SetVar2(interp, "sqlite_options", "gettable", "1", TCL_GLOBAL_ONLY);
453 #endif
455 #ifdef SQLITE_ENABLE_ICU
456 Tcl_SetVar2(interp, "sqlite_options", "icu", "1", TCL_GLOBAL_ONLY);
457 #else
458 Tcl_SetVar2(interp, "sqlite_options", "icu", "0", TCL_GLOBAL_ONLY);
459 #endif
461 #ifdef SQLITE_ENABLE_ICU_COLLATIONS
462 Tcl_SetVar2(interp, "sqlite_options", "icu_collations", "1", TCL_GLOBAL_ONLY);
463 #else
464 Tcl_SetVar2(interp, "sqlite_options", "icu_collations", "0", TCL_GLOBAL_ONLY);
465 #endif
467 #ifdef SQLITE_OMIT_INCRBLOB
468 Tcl_SetVar2(interp, "sqlite_options", "incrblob", "0", TCL_GLOBAL_ONLY);
469 #else
470 Tcl_SetVar2(interp, "sqlite_options", "incrblob", "1", TCL_GLOBAL_ONLY);
471 #endif /* SQLITE_OMIT_AUTOVACUUM */
473 #ifdef SQLITE_OMIT_INTEGRITY_CHECK
474 Tcl_SetVar2(interp, "sqlite_options", "integrityck", "0", TCL_GLOBAL_ONLY);
475 #else
476 Tcl_SetVar2(interp, "sqlite_options", "integrityck", "1", TCL_GLOBAL_ONLY);
477 #endif
479 #if defined(SQLITE_DEFAULT_FILE_FORMAT) && SQLITE_DEFAULT_FILE_FORMAT==1
480 Tcl_SetVar2(interp, "sqlite_options", "legacyformat", "1", TCL_GLOBAL_ONLY);
481 #else
482 Tcl_SetVar2(interp, "sqlite_options", "legacyformat", "0", TCL_GLOBAL_ONLY);
483 #endif
485 #ifdef SQLITE_OMIT_LIKE_OPTIMIZATION
486 Tcl_SetVar2(interp, "sqlite_options", "like_opt", "0", TCL_GLOBAL_ONLY);
487 #else
488 Tcl_SetVar2(interp, "sqlite_options", "like_opt", "1", TCL_GLOBAL_ONLY);
489 #endif
491 #ifdef SQLITE_OMIT_LOAD_EXTENSION
492 Tcl_SetVar2(interp, "sqlite_options", "load_ext", "0", TCL_GLOBAL_ONLY);
493 #else
494 Tcl_SetVar2(interp, "sqlite_options", "load_ext", "1", TCL_GLOBAL_ONLY);
495 #endif
497 #ifdef SQLITE_OMIT_LOCALTIME
498 Tcl_SetVar2(interp, "sqlite_options", "localtime", "0", TCL_GLOBAL_ONLY);
499 #else
500 Tcl_SetVar2(interp, "sqlite_options", "localtime", "1", TCL_GLOBAL_ONLY);
501 #endif
503 #ifdef SQLITE_OMIT_LOOKASIDE
504 Tcl_SetVar2(interp, "sqlite_options", "lookaside", "0", TCL_GLOBAL_ONLY);
505 #else
506 Tcl_SetVar2(interp, "sqlite_options", "lookaside", "1", TCL_GLOBAL_ONLY);
507 #endif
509 Tcl_SetVar2(interp, "sqlite_options", "long_double",
510 sizeof(LONGDOUBLE_TYPE)>sizeof(double) ? "1" : "0",
511 TCL_GLOBAL_ONLY);
513 #ifdef SQLITE_OMIT_MEMORYDB
514 Tcl_SetVar2(interp, "sqlite_options", "memorydb", "0", TCL_GLOBAL_ONLY);
515 #else
516 Tcl_SetVar2(interp, "sqlite_options", "memorydb", "1", TCL_GLOBAL_ONLY);
517 #endif
519 #ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
520 Tcl_SetVar2(interp, "sqlite_options", "memorymanage", "1", TCL_GLOBAL_ONLY);
521 #else
522 Tcl_SetVar2(interp, "sqlite_options", "memorymanage", "0", TCL_GLOBAL_ONLY);
523 #endif
525 Tcl_SetVar2(interp, "sqlite_options", "mergesort", "1", TCL_GLOBAL_ONLY);
527 #ifdef SQLITE_ENABLE_NULL_TRIM
528 Tcl_SetVar2(interp, "sqlite_options", "null_trim", "1", TCL_GLOBAL_ONLY);
529 #else
530 Tcl_SetVar2(interp, "sqlite_options", "null_trim", "0", TCL_GLOBAL_ONLY);
531 #endif
533 #ifdef SQLITE_OMIT_OR_OPTIMIZATION
534 Tcl_SetVar2(interp, "sqlite_options", "or_opt", "0", TCL_GLOBAL_ONLY);
535 #else
536 Tcl_SetVar2(interp, "sqlite_options", "or_opt", "1", TCL_GLOBAL_ONLY);
537 #endif
539 #ifdef SQLITE_ENABLE_RBU
540 Tcl_SetVar2(interp, "sqlite_options", "rbu", "1", TCL_GLOBAL_ONLY);
541 #else
542 Tcl_SetVar2(interp, "sqlite_options", "rbu", "0", TCL_GLOBAL_ONLY);
543 #endif
545 #ifdef SQLITE_OMIT_PAGER_PRAGMAS
546 Tcl_SetVar2(interp, "sqlite_options", "pager_pragmas", "0", TCL_GLOBAL_ONLY);
547 #else
548 Tcl_SetVar2(interp, "sqlite_options", "pager_pragmas", "1", TCL_GLOBAL_ONLY);
549 #endif
551 #if defined(SQLITE_OMIT_PRAGMA) || defined(SQLITE_OMIT_FLAG_PRAGMAS)
552 Tcl_SetVar2(interp, "sqlite_options", "pragma", "0", TCL_GLOBAL_ONLY);
553 Tcl_SetVar2(interp, "sqlite_options", "integrityck", "0", TCL_GLOBAL_ONLY);
554 #else
555 Tcl_SetVar2(interp, "sqlite_options", "pragma", "1", TCL_GLOBAL_ONLY);
556 #endif
558 #ifdef SQLITE_OMIT_PROGRESS_CALLBACK
559 Tcl_SetVar2(interp, "sqlite_options", "progress", "0", TCL_GLOBAL_ONLY);
560 #else
561 Tcl_SetVar2(interp, "sqlite_options", "progress", "1", TCL_GLOBAL_ONLY);
562 #endif
564 #ifdef SQLITE_OMIT_REINDEX
565 Tcl_SetVar2(interp, "sqlite_options", "reindex", "0", TCL_GLOBAL_ONLY);
566 #else
567 Tcl_SetVar2(interp, "sqlite_options", "reindex", "1", TCL_GLOBAL_ONLY);
568 #endif
570 #ifdef SQLITE_ENABLE_RTREE
571 Tcl_SetVar2(interp, "sqlite_options", "rtree", "1", TCL_GLOBAL_ONLY);
572 #else
573 Tcl_SetVar2(interp, "sqlite_options", "rtree", "0", TCL_GLOBAL_ONLY);
574 #endif
576 #ifdef SQLITE_RTREE_INT_ONLY
577 Tcl_SetVar2(interp, "sqlite_options", "rtree_int_only", "1", TCL_GLOBAL_ONLY);
578 #else
579 Tcl_SetVar2(interp, "sqlite_options", "rtree_int_only", "0", TCL_GLOBAL_ONLY);
580 #endif
582 #ifdef SQLITE_OMIT_SCHEMA_PRAGMAS
583 Tcl_SetVar2(interp, "sqlite_options", "schema_pragmas", "0", TCL_GLOBAL_ONLY);
584 #else
585 Tcl_SetVar2(interp, "sqlite_options", "schema_pragmas", "1", TCL_GLOBAL_ONLY);
586 #endif
588 #ifdef SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS
589 Tcl_SetVar2(interp, "sqlite_options", "schema_version", "0", TCL_GLOBAL_ONLY);
590 #else
591 Tcl_SetVar2(interp, "sqlite_options", "schema_version", "1", TCL_GLOBAL_ONLY);
592 #endif
594 #if defined(SQLITE_ENABLE_SESSION) && defined(SQLITE_ENABLE_PREUPDATE_HOOK)
595 Tcl_SetVar2(interp, "sqlite_options", "session", "1", TCL_GLOBAL_ONLY);
596 #else
597 Tcl_SetVar2(interp, "sqlite_options", "session", "0", TCL_GLOBAL_ONLY);
598 #endif
600 #ifdef SQLITE_ENABLE_STAT4
601 Tcl_SetVar2(interp, "sqlite_options", "stat4", "1", TCL_GLOBAL_ONLY);
602 #else
603 Tcl_SetVar2(interp, "sqlite_options", "stat4", "0", TCL_GLOBAL_ONLY);
604 #endif
605 #if defined(SQLITE_ENABLE_STMTVTAB) && !defined(SQLITE_OMIT_VIRTUALTABLE)
606 Tcl_SetVar2(interp, "sqlite_options", "stmtvtab", "1", TCL_GLOBAL_ONLY);
607 #else
608 Tcl_SetVar2(interp, "sqlite_options", "stmtvtab", "0", TCL_GLOBAL_ONLY);
609 #endif
611 #ifdef SQLITE_ENABLE_STMT_SCANSTATUS
612 Tcl_SetVar2(interp, "sqlite_options", "scanstatus", "1", TCL_GLOBAL_ONLY);
613 #else
614 Tcl_SetVar2(interp, "sqlite_options", "scanstatus", "0", TCL_GLOBAL_ONLY);
615 #endif
617 #if !defined(SQLITE_ENABLE_LOCKING_STYLE)
618 # if defined(__APPLE__)
619 # define SQLITE_ENABLE_LOCKING_STYLE 1
620 # else
621 # define SQLITE_ENABLE_LOCKING_STYLE 0
622 # endif
623 #endif
624 #if SQLITE_ENABLE_LOCKING_STYLE && defined(__APPLE__)
625 Tcl_SetVar2(interp,"sqlite_options","lock_proxy_pragmas","1",TCL_GLOBAL_ONLY);
626 #else
627 Tcl_SetVar2(interp,"sqlite_options","lock_proxy_pragmas","0",TCL_GLOBAL_ONLY);
628 #endif
629 #if defined(SQLITE_PREFER_PROXY_LOCKING) && defined(__APPLE__)
630 Tcl_SetVar2(interp,"sqlite_options","prefer_proxy_locking","1",TCL_GLOBAL_ONLY);
631 #else
632 Tcl_SetVar2(interp,"sqlite_options","prefer_proxy_locking","0",TCL_GLOBAL_ONLY);
633 #endif
636 #ifdef SQLITE_OMIT_SHARED_CACHE
637 Tcl_SetVar2(interp, "sqlite_options", "shared_cache", "0", TCL_GLOBAL_ONLY);
638 #else
639 Tcl_SetVar2(interp, "sqlite_options", "shared_cache", "1", TCL_GLOBAL_ONLY);
640 #endif
642 #ifdef SQLITE_OMIT_SUBQUERY
643 Tcl_SetVar2(interp, "sqlite_options", "subquery", "0", TCL_GLOBAL_ONLY);
644 #else
645 Tcl_SetVar2(interp, "sqlite_options", "subquery", "1", TCL_GLOBAL_ONLY);
646 #endif
648 #ifdef SQLITE_OMIT_TCL_VARIABLE
649 Tcl_SetVar2(interp, "sqlite_options", "tclvar", "0", TCL_GLOBAL_ONLY);
650 #else
651 Tcl_SetVar2(interp, "sqlite_options", "tclvar", "1", TCL_GLOBAL_ONLY);
652 #endif
654 Tcl_SetVar2(interp, "sqlite_options", "threadsafe",
655 SQLITE_THREADSAFE ? "1" : "0", TCL_GLOBAL_ONLY);
656 Tcl_SetVar2(interp, "sqlite_options", "threadsafe1",
657 SQLITE_THREADSAFE==1 ? "1" : "0", TCL_GLOBAL_ONLY);
658 Tcl_SetVar2(interp, "sqlite_options", "threadsafe2",
659 SQLITE_THREADSAFE==2 ? "1" : "0", TCL_GLOBAL_ONLY);
660 assert( sqlite3_threadsafe()==SQLITE_THREADSAFE );
662 #ifdef SQLITE_OMIT_TEMPDB
663 Tcl_SetVar2(interp, "sqlite_options", "tempdb", "0", TCL_GLOBAL_ONLY);
664 #else
665 Tcl_SetVar2(interp, "sqlite_options", "tempdb", "1", TCL_GLOBAL_ONLY);
666 #endif
668 #ifdef SQLITE_OMIT_TRACE
669 Tcl_SetVar2(interp, "sqlite_options", "trace", "0", TCL_GLOBAL_ONLY);
670 #else
671 Tcl_SetVar2(interp, "sqlite_options", "trace", "1", TCL_GLOBAL_ONLY);
672 #endif
674 #ifdef SQLITE_OMIT_TRIGGER
675 Tcl_SetVar2(interp, "sqlite_options", "trigger", "0", TCL_GLOBAL_ONLY);
676 #else
677 Tcl_SetVar2(interp, "sqlite_options", "trigger", "1", TCL_GLOBAL_ONLY);
678 #endif
680 #ifdef SQLITE_OMIT_TRUNCATE_OPTIMIZATION
681 Tcl_SetVar2(interp, "sqlite_options", "truncate_opt", "0", TCL_GLOBAL_ONLY);
682 #else
683 Tcl_SetVar2(interp, "sqlite_options", "truncate_opt", "1", TCL_GLOBAL_ONLY);
684 #endif
686 #ifdef SQLITE_OMIT_UTF16
687 Tcl_SetVar2(interp, "sqlite_options", "utf16", "0", TCL_GLOBAL_ONLY);
688 #else
689 Tcl_SetVar2(interp, "sqlite_options", "utf16", "1", TCL_GLOBAL_ONLY);
690 #endif
692 #if defined(SQLITE_OMIT_VACUUM) || defined(SQLITE_OMIT_ATTACH)
693 Tcl_SetVar2(interp, "sqlite_options", "vacuum", "0", TCL_GLOBAL_ONLY);
694 #else
695 Tcl_SetVar2(interp, "sqlite_options", "vacuum", "1", TCL_GLOBAL_ONLY);
696 #endif
698 #ifdef SQLITE_OMIT_VIEW
699 Tcl_SetVar2(interp, "sqlite_options", "view", "0", TCL_GLOBAL_ONLY);
700 #else
701 Tcl_SetVar2(interp, "sqlite_options", "view", "1", TCL_GLOBAL_ONLY);
702 #endif
704 #ifdef SQLITE_OMIT_VIRTUALTABLE
705 Tcl_SetVar2(interp, "sqlite_options", "vtab", "0", TCL_GLOBAL_ONLY);
706 #else
707 Tcl_SetVar2(interp, "sqlite_options", "vtab", "1", TCL_GLOBAL_ONLY);
708 #endif
710 #ifdef SQLITE_OMIT_WAL
711 Tcl_SetVar2(interp, "sqlite_options", "wal", "0", TCL_GLOBAL_ONLY);
712 #else
713 Tcl_SetVar2(interp, "sqlite_options", "wal", "1", TCL_GLOBAL_ONLY);
714 #endif
716 #ifdef SQLITE_OMIT_WSD
717 Tcl_SetVar2(interp, "sqlite_options", "wsd", "0", TCL_GLOBAL_ONLY);
718 #else
719 Tcl_SetVar2(interp, "sqlite_options", "wsd", "1", TCL_GLOBAL_ONLY);
720 #endif
722 #if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY)
723 Tcl_SetVar2(interp, "sqlite_options", "update_delete_limit", "1", TCL_GLOBAL_ONLY);
724 #else
725 Tcl_SetVar2(interp, "sqlite_options", "update_delete_limit", "0", TCL_GLOBAL_ONLY);
726 #endif
728 #if defined(SQLITE_ENABLE_UNLOCK_NOTIFY)
729 Tcl_SetVar2(interp, "sqlite_options", "unlock_notify", "1", TCL_GLOBAL_ONLY);
730 #else
731 Tcl_SetVar2(interp, "sqlite_options", "unlock_notify", "0", TCL_GLOBAL_ONLY);
732 #endif
734 #ifdef SQLITE_FAST_SECURE_DELETE
735 Tcl_SetVar2(interp, "sqlite_options", "fast_secure_delete", "1", TCL_GLOBAL_ONLY);
736 #else
737 Tcl_SetVar2(interp, "sqlite_options", "fast_secure_delete", "0", TCL_GLOBAL_ONLY);
738 #endif
740 #ifdef SQLITE_SECURE_DELETE
741 Tcl_SetVar2(interp, "sqlite_options", "secure_delete", "1", TCL_GLOBAL_ONLY);
742 #else
743 Tcl_SetVar2(interp, "sqlite_options", "secure_delete", "0", TCL_GLOBAL_ONLY);
744 #endif
746 #ifdef SQLITE_USER_AUTHENTICATION
747 Tcl_SetVar2(interp, "sqlite_options", "userauth", "1", TCL_GLOBAL_ONLY);
748 #else
749 Tcl_SetVar2(interp, "sqlite_options", "userauth", "0", TCL_GLOBAL_ONLY);
750 #endif
752 #ifdef SQLITE_MULTIPLEX_EXT_OVWR
753 Tcl_SetVar2(interp, "sqlite_options", "multiplex_ext_overwrite", "1", TCL_GLOBAL_ONLY);
754 #else
755 Tcl_SetVar2(interp, "sqlite_options", "multiplex_ext_overwrite", "0", TCL_GLOBAL_ONLY);
756 #endif
758 #ifdef YYTRACKMAXSTACKDEPTH
759 Tcl_SetVar2(interp, "sqlite_options", "yytrackmaxstackdepth", "1", TCL_GLOBAL_ONLY);
760 #else
761 Tcl_SetVar2(interp, "sqlite_options", "yytrackmaxstackdepth", "0", TCL_GLOBAL_ONLY);
762 #endif
764 #ifdef SQLITE_ENABLE_SQLLOG
765 Tcl_SetVar2(interp, "sqlite_options", "sqllog", "1", TCL_GLOBAL_ONLY);
766 #else
767 Tcl_SetVar2(interp, "sqlite_options", "sqllog", "0", TCL_GLOBAL_ONLY);
768 #endif
770 #ifdef SQLITE_ENABLE_URI_00_ERROR
771 Tcl_SetVar2(interp, "sqlite_options", "uri_00_error", "1", TCL_GLOBAL_ONLY);
772 #else
773 Tcl_SetVar2(interp, "sqlite_options", "uri_00_error", "0", TCL_GLOBAL_ONLY);
774 #endif
776 #if defined(SQLITE_ENABLE_NORMALIZE)
777 Tcl_SetVar2(interp, "sqlite_options", "normalize", "1", TCL_GLOBAL_ONLY);
778 #else
779 Tcl_SetVar2(interp, "sqlite_options", "normalize", "0", TCL_GLOBAL_ONLY);
780 #endif
782 #ifdef SQLITE_OMIT_WINDOWFUNC
783 Tcl_SetVar2(interp, "sqlite_options", "windowfunc", "0", TCL_GLOBAL_ONLY);
784 #else
785 Tcl_SetVar2(interp, "sqlite_options", "windowfunc", "1", TCL_GLOBAL_ONLY);
786 #endif
788 #define LINKVAR(x) { \
789 static const int cv_ ## x = SQLITE_ ## x; \
790 Tcl_LinkVar(interp, "SQLITE_" #x, (char *)&(cv_ ## x), \
791 TCL_LINK_INT | TCL_LINK_READ_ONLY); }
793 LINKVAR( MAX_LENGTH );
794 LINKVAR( MAX_COLUMN );
795 LINKVAR( MAX_SQL_LENGTH );
796 LINKVAR( MAX_EXPR_DEPTH );
797 LINKVAR( MAX_COMPOUND_SELECT );
798 LINKVAR( MAX_VDBE_OP );
799 LINKVAR( MAX_FUNCTION_ARG );
800 LINKVAR( MAX_VARIABLE_NUMBER );
801 LINKVAR( MAX_PAGE_SIZE );
802 LINKVAR( MAX_PAGE_COUNT );
803 LINKVAR( MAX_LIKE_PATTERN_LENGTH );
804 LINKVAR( MAX_TRIGGER_DEPTH );
805 LINKVAR( DEFAULT_CACHE_SIZE );
806 LINKVAR( DEFAULT_PAGE_SIZE );
807 LINKVAR( DEFAULT_FILE_FORMAT );
808 LINKVAR( DEFAULT_SYNCHRONOUS );
809 LINKVAR( DEFAULT_WAL_SYNCHRONOUS );
810 LINKVAR( MAX_ATTACHED );
811 LINKVAR( MAX_DEFAULT_PAGE_SIZE );
812 LINKVAR( MAX_WORKER_THREADS );
815 static const int cv_TEMP_STORE = SQLITE_TEMP_STORE;
816 Tcl_LinkVar(interp, "TEMP_STORE", (char *)&(cv_TEMP_STORE),
817 TCL_LINK_INT | TCL_LINK_READ_ONLY);
820 #ifdef _MSC_VER
822 static const int cv__MSC_VER = 1;
823 Tcl_LinkVar(interp, "_MSC_VER", (char *)&(cv__MSC_VER),
824 TCL_LINK_INT | TCL_LINK_READ_ONLY);
826 #endif
827 #ifdef __GNUC__
829 static const int cv___GNUC__ = 1;
830 Tcl_LinkVar(interp, "__GNUC__", (char *)&(cv___GNUC__),
831 TCL_LINK_INT | TCL_LINK_READ_ONLY);
833 #endif
838 ** Register commands with the TCL interpreter.
840 int Sqliteconfig_Init(Tcl_Interp *interp){
841 set_options(interp);
842 return TCL_OK;