Merge sqlite-release(3.40.1) into prerelease-integration
[sqlcipher.git] / src / test_config.c
blob71ffd50297543ab3d6e45388bdba55aed4f3d921
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_CASE_SENSITIVE_LIKE
63 Tcl_SetVar2(interp, "sqlite_options","casesensitivelike","1",TCL_GLOBAL_ONLY);
64 #else
65 Tcl_SetVar2(interp, "sqlite_options","casesensitivelike","0",TCL_GLOBAL_ONLY);
66 #endif
68 #ifdef CONFIG_SLOWDOWN_FACTOR
69 Tcl_SetVar2(interp, "sqlite_options","configslower",
70 STRINGVALUE(CONFIG_SLOWDOWN_FACTOR),TCL_GLOBAL_ONLY);
71 #else
72 Tcl_SetVar2(interp, "sqlite_options","configslower","1.0",TCL_GLOBAL_ONLY);
73 #endif
75 #if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT
76 Tcl_SetVar2(interp, "sqlite_options", "curdir", "1", TCL_GLOBAL_ONLY);
77 #else
78 Tcl_SetVar2(interp, "sqlite_options", "curdir", "0", TCL_GLOBAL_ONLY);
79 #endif
81 #ifdef SQLITE_WIN32_MALLOC
82 Tcl_SetVar2(interp, "sqlite_options", "win32malloc", "1", TCL_GLOBAL_ONLY);
83 #else
84 Tcl_SetVar2(interp, "sqlite_options", "win32malloc", "0", TCL_GLOBAL_ONLY);
85 #endif
87 #ifdef SQLITE_DEBUG
88 Tcl_SetVar2(interp, "sqlite_options", "debug", "1", TCL_GLOBAL_ONLY);
89 #else
90 Tcl_SetVar2(interp, "sqlite_options", "debug", "0", TCL_GLOBAL_ONLY);
91 #endif
93 #ifdef SQLITE_DEFAULT_CKPTFULLFSYNC
94 Tcl_SetVar2(interp, "sqlite_options", "default_ckptfullfsync",
95 SQLITE_DEFAULT_CKPTFULLFSYNC ? "1" : "0", TCL_GLOBAL_ONLY);
96 #else
97 Tcl_SetVar2(interp, "sqlite_options", "default_ckptfullfsync", "0", TCL_GLOBAL_ONLY);
98 #endif
100 #ifdef SQLITE_DIRECT_OVERFLOW_READ
101 Tcl_SetVar2(interp, "sqlite_options", "direct_read", "1", TCL_GLOBAL_ONLY);
102 #else
103 Tcl_SetVar2(interp, "sqlite_options", "direct_read", "0", TCL_GLOBAL_ONLY);
104 #endif
106 #ifdef SQLITE_DISABLE_DIRSYNC
107 Tcl_SetVar2(interp, "sqlite_options", "dirsync", "0", TCL_GLOBAL_ONLY);
108 #else
109 Tcl_SetVar2(interp, "sqlite_options", "dirsync", "1", TCL_GLOBAL_ONLY);
110 #endif
112 #ifdef SQLITE_DISABLE_LFS
113 Tcl_SetVar2(interp, "sqlite_options", "lfs", "0", TCL_GLOBAL_ONLY);
114 #else
115 Tcl_SetVar2(interp, "sqlite_options", "lfs", "1", TCL_GLOBAL_ONLY);
116 #endif
118 #ifdef SQLITE_DISABLE_PAGECACHE_OVERFLOW_STATS
119 Tcl_SetVar2(interp, "sqlite_options", "pagecache_overflow_stats","0",TCL_GLOBAL_ONLY);
120 #else
121 Tcl_SetVar2(interp, "sqlite_options", "pagecache_overflow_stats","1",TCL_GLOBAL_ONLY);
122 #endif
124 #if SQLITE_MAX_MMAP_SIZE>0
125 Tcl_SetVar2(interp, "sqlite_options", "mmap", "1", TCL_GLOBAL_ONLY);
126 #else
127 Tcl_SetVar2(interp, "sqlite_options", "mmap", "0", TCL_GLOBAL_ONLY);
128 #endif
130 Tcl_SetVar2(interp, "sqlite_options", "worker_threads",
131 STRINGVALUE(SQLITE_MAX_WORKER_THREADS), TCL_GLOBAL_ONLY
134 #ifdef SQLITE_MEMDEBUG
135 Tcl_SetVar2(interp, "sqlite_options", "memdebug", "1", TCL_GLOBAL_ONLY);
136 #else
137 Tcl_SetVar2(interp, "sqlite_options", "memdebug", "0", TCL_GLOBAL_ONLY);
138 #endif
140 #ifdef SQLITE_ENABLE_8_3_NAMES
141 Tcl_SetVar2(interp, "sqlite_options", "8_3_names", "1", TCL_GLOBAL_ONLY);
142 #else
143 Tcl_SetVar2(interp, "sqlite_options", "8_3_names", "0", TCL_GLOBAL_ONLY);
144 #endif
146 #ifdef SQLITE_ENABLE_CURSOR_HINTS
147 Tcl_SetVar2(interp, "sqlite_options", "cursorhints", "1", TCL_GLOBAL_ONLY);
148 #else
149 Tcl_SetVar2(interp, "sqlite_options", "cursorhints", "0", TCL_GLOBAL_ONLY);
150 #endif
152 #ifdef SQLITE_ENABLE_HIDDEN_COLUMNS
153 Tcl_SetVar2(interp, "sqlite_options", "hiddencolumns", "1", TCL_GLOBAL_ONLY);
154 #else
155 Tcl_SetVar2(interp, "sqlite_options", "hiddencolumns", "0", TCL_GLOBAL_ONLY);
156 #endif
158 #ifndef SQLITE_OMIT_DESERIALIZE
159 Tcl_SetVar2(interp, "sqlite_options", "deserialize", "1", TCL_GLOBAL_ONLY);
160 #else
161 Tcl_SetVar2(interp, "sqlite_options", "deserialize", "0", TCL_GLOBAL_ONLY);
162 #endif
164 #ifdef SQLITE_ENABLE_MATH_FUNCTIONS
165 Tcl_SetVar2(interp, "sqlite_options", "mathlib", "1", TCL_GLOBAL_ONLY);
166 #else
167 Tcl_SetVar2(interp, "sqlite_options", "mathlib", "0", TCL_GLOBAL_ONLY);
168 #endif
170 #ifdef SQLITE_ENABLE_MEMSYS3
171 Tcl_SetVar2(interp, "sqlite_options", "mem3", "1", TCL_GLOBAL_ONLY);
172 #else
173 Tcl_SetVar2(interp, "sqlite_options", "mem3", "0", TCL_GLOBAL_ONLY);
174 #endif
176 #ifdef SQLITE_ENABLE_MEMSYS5
177 Tcl_SetVar2(interp, "sqlite_options", "mem5", "1", TCL_GLOBAL_ONLY);
178 #else
179 Tcl_SetVar2(interp, "sqlite_options", "mem5", "0", TCL_GLOBAL_ONLY);
180 #endif
182 #ifdef SQLITE_ENABLE_OFFSET_SQL_FUNC
183 Tcl_SetVar2(interp, "sqlite_options", "offset_sql_func","1",TCL_GLOBAL_ONLY);
184 #else
185 Tcl_SetVar2(interp, "sqlite_options", "offset_sql_func","0",TCL_GLOBAL_ONLY);
186 #endif
188 #ifdef SQLITE_ENABLE_PREUPDATE_HOOK
189 Tcl_SetVar2(interp, "sqlite_options", "preupdate", "1", TCL_GLOBAL_ONLY);
190 #else
191 Tcl_SetVar2(interp, "sqlite_options", "preupdate", "0", TCL_GLOBAL_ONLY);
192 #endif
194 #ifdef SQLITE_ENABLE_SNAPSHOT
195 Tcl_SetVar2(interp, "sqlite_options", "snapshot", "1", TCL_GLOBAL_ONLY);
196 #else
197 Tcl_SetVar2(interp, "sqlite_options", "snapshot", "0", TCL_GLOBAL_ONLY);
198 #endif
200 #ifdef SQLITE_MUTEX_OMIT
201 Tcl_SetVar2(interp, "sqlite_options", "mutex", "0", TCL_GLOBAL_ONLY);
202 #else
203 Tcl_SetVar2(interp, "sqlite_options", "mutex", "1", TCL_GLOBAL_ONLY);
204 #endif
206 #ifdef SQLITE_MUTEX_NOOP
207 Tcl_SetVar2(interp, "sqlite_options", "mutex_noop", "1", TCL_GLOBAL_ONLY);
208 #else
209 Tcl_SetVar2(interp, "sqlite_options", "mutex_noop", "0", TCL_GLOBAL_ONLY);
210 #endif
212 #ifdef SQLITE_OMIT_ALTERTABLE
213 Tcl_SetVar2(interp, "sqlite_options", "altertable", "0", TCL_GLOBAL_ONLY);
214 #else
215 Tcl_SetVar2(interp, "sqlite_options", "altertable", "1", TCL_GLOBAL_ONLY);
216 #endif
218 #ifdef SQLITE_OMIT_ANALYZE
219 Tcl_SetVar2(interp, "sqlite_options", "analyze", "0", TCL_GLOBAL_ONLY);
220 #else
221 Tcl_SetVar2(interp, "sqlite_options", "analyze", "1", TCL_GLOBAL_ONLY);
222 #endif
224 #ifdef SQLITE_ENABLE_API_ARMOR
225 Tcl_SetVar2(interp, "sqlite_options", "api_armor", "1", TCL_GLOBAL_ONLY);
226 #else
227 Tcl_SetVar2(interp, "sqlite_options", "api_armor", "0", TCL_GLOBAL_ONLY);
228 #endif
230 #ifdef SQLITE_ENABLE_ATOMIC_WRITE
231 Tcl_SetVar2(interp, "sqlite_options", "atomicwrite", "1", TCL_GLOBAL_ONLY);
232 #else
233 Tcl_SetVar2(interp, "sqlite_options", "atomicwrite", "0", TCL_GLOBAL_ONLY);
234 #endif
236 #ifdef SQLITE_ENABLE_GEOPOLY
237 Tcl_SetVar2(interp, "sqlite_options", "geopoly", "1", TCL_GLOBAL_ONLY);
238 #else
239 Tcl_SetVar2(interp, "sqlite_options", "geopoly", "0", TCL_GLOBAL_ONLY);
240 #endif
242 #ifndef SQLITE_OMIT_JSON
243 Tcl_SetVar2(interp, "sqlite_options", "json1", "1", TCL_GLOBAL_ONLY);
244 #else
245 Tcl_SetVar2(interp, "sqlite_options", "json1", "0", TCL_GLOBAL_ONLY);
246 #endif
248 /* BEGIN SQLCIPHER */
249 #ifdef SQLITE_HAS_CODEC
250 Tcl_SetVar2(interp, "sqlite_options", "has_codec", "1", TCL_GLOBAL_ONLY);
251 #else
252 Tcl_SetVar2(interp, "sqlite_options", "has_codec", "0", TCL_GLOBAL_ONLY);
253 #endif
254 /* END SQLCIPHER */
256 #ifdef SQLITE_LIKE_DOESNT_MATCH_BLOBS
257 Tcl_SetVar2(interp, "sqlite_options", "like_match_blobs", "0", TCL_GLOBAL_ONLY);
258 #else
259 Tcl_SetVar2(interp, "sqlite_options", "like_match_blobs", "1", TCL_GLOBAL_ONLY);
260 #endif
262 #ifdef SQLITE_OMIT_ATTACH
263 Tcl_SetVar2(interp, "sqlite_options", "attach", "0", TCL_GLOBAL_ONLY);
264 #else
265 Tcl_SetVar2(interp, "sqlite_options", "attach", "1", TCL_GLOBAL_ONLY);
266 #endif
268 #ifdef SQLITE_OMIT_AUTHORIZATION
269 Tcl_SetVar2(interp, "sqlite_options", "auth", "0", TCL_GLOBAL_ONLY);
270 #else
271 Tcl_SetVar2(interp, "sqlite_options", "auth", "1", TCL_GLOBAL_ONLY);
272 #endif
274 #ifdef SQLITE_OMIT_AUTOINCREMENT
275 Tcl_SetVar2(interp, "sqlite_options", "autoinc", "0", TCL_GLOBAL_ONLY);
276 #else
277 Tcl_SetVar2(interp, "sqlite_options", "autoinc", "1", TCL_GLOBAL_ONLY);
278 #endif
280 #ifdef SQLITE_OMIT_AUTOMATIC_INDEX
281 Tcl_SetVar2(interp, "sqlite_options", "autoindex", "0", TCL_GLOBAL_ONLY);
282 #else
283 Tcl_SetVar2(interp, "sqlite_options", "autoindex", "1", TCL_GLOBAL_ONLY);
284 #endif
286 #ifdef SQLITE_OMIT_AUTORESET
287 Tcl_SetVar2(interp, "sqlite_options", "autoreset", "0", TCL_GLOBAL_ONLY);
288 #else
289 Tcl_SetVar2(interp, "sqlite_options", "autoreset", "1", TCL_GLOBAL_ONLY);
290 #endif
292 #ifdef SQLITE_OMIT_AUTOVACUUM
293 Tcl_SetVar2(interp, "sqlite_options", "autovacuum", "0", TCL_GLOBAL_ONLY);
294 #else
295 Tcl_SetVar2(interp, "sqlite_options", "autovacuum", "1", TCL_GLOBAL_ONLY);
296 #endif /* SQLITE_OMIT_AUTOVACUUM */
297 #if !defined(SQLITE_DEFAULT_AUTOVACUUM)
298 Tcl_SetVar2(interp,"sqlite_options","default_autovacuum","0",TCL_GLOBAL_ONLY);
299 #else
300 Tcl_SetVar2(interp, "sqlite_options", "default_autovacuum",
301 STRINGVALUE(SQLITE_DEFAULT_AUTOVACUUM), TCL_GLOBAL_ONLY);
302 #endif
304 #ifdef SQLITE_OMIT_BETWEEN_OPTIMIZATION
305 Tcl_SetVar2(interp, "sqlite_options", "between_opt", "0", TCL_GLOBAL_ONLY);
306 #else
307 Tcl_SetVar2(interp, "sqlite_options", "between_opt", "1", TCL_GLOBAL_ONLY);
308 #endif
310 #ifdef SQLITE_UNTESTABLE
311 Tcl_SetVar2(interp, "sqlite_options", "builtin_test", "0", TCL_GLOBAL_ONLY);
312 #else
313 Tcl_SetVar2(interp, "sqlite_options", "builtin_test", "1", TCL_GLOBAL_ONLY);
314 #endif
316 #ifdef SQLITE_OMIT_BLOB_LITERAL
317 Tcl_SetVar2(interp, "sqlite_options", "bloblit", "0", TCL_GLOBAL_ONLY);
318 #else
319 Tcl_SetVar2(interp, "sqlite_options", "bloblit", "1", TCL_GLOBAL_ONLY);
320 #endif
322 #ifdef SQLITE_OMIT_CAST
323 Tcl_SetVar2(interp, "sqlite_options", "cast", "0", TCL_GLOBAL_ONLY);
324 #else
325 Tcl_SetVar2(interp, "sqlite_options", "cast", "1", TCL_GLOBAL_ONLY);
326 #endif
328 #ifdef SQLITE_OMIT_CHECK
329 Tcl_SetVar2(interp, "sqlite_options", "check", "0", TCL_GLOBAL_ONLY);
330 #else
331 Tcl_SetVar2(interp, "sqlite_options", "check", "1", TCL_GLOBAL_ONLY);
332 #endif
334 #ifdef SQLITE_OMIT_CTE
335 Tcl_SetVar2(interp, "sqlite_options", "cte", "0", TCL_GLOBAL_ONLY);
336 #else
337 Tcl_SetVar2(interp, "sqlite_options", "cte", "1", TCL_GLOBAL_ONLY);
338 #endif
340 #ifdef SQLITE_ENABLE_COLUMN_METADATA
341 Tcl_SetVar2(interp, "sqlite_options", "columnmetadata", "1", TCL_GLOBAL_ONLY);
342 #else
343 Tcl_SetVar2(interp, "sqlite_options", "columnmetadata", "0", TCL_GLOBAL_ONLY);
344 #endif
346 #ifdef SQLITE_ENABLE_OVERSIZE_CELL_CHECK
347 Tcl_SetVar2(interp, "sqlite_options", "oversize_cell_check", "1",
348 TCL_GLOBAL_ONLY);
349 #else
350 Tcl_SetVar2(interp, "sqlite_options", "oversize_cell_check", "0",
351 TCL_GLOBAL_ONLY);
352 #endif
354 #ifdef SQLITE_OMIT_COMPILEOPTION_DIAGS
355 Tcl_SetVar2(interp, "sqlite_options", "compileoption_diags", "0", TCL_GLOBAL_ONLY);
356 #else
357 Tcl_SetVar2(interp, "sqlite_options", "compileoption_diags", "1", TCL_GLOBAL_ONLY);
358 #endif
360 #ifdef SQLITE_OMIT_COMPLETE
361 Tcl_SetVar2(interp, "sqlite_options", "complete", "0", TCL_GLOBAL_ONLY);
362 #else
363 Tcl_SetVar2(interp, "sqlite_options", "complete", "1", TCL_GLOBAL_ONLY);
364 #endif
366 #ifdef SQLITE_OMIT_COMPOUND_SELECT
367 Tcl_SetVar2(interp, "sqlite_options", "compound", "0", TCL_GLOBAL_ONLY);
368 #else
369 Tcl_SetVar2(interp, "sqlite_options", "compound", "1", TCL_GLOBAL_ONLY);
370 #endif
372 Tcl_SetVar2(interp, "sqlite_options", "conflict", "1", TCL_GLOBAL_ONLY);
373 Tcl_SetVar2(interp, "sqlite_options", "crashtest", "1", TCL_GLOBAL_ONLY);
375 #ifdef SQLITE_OMIT_DATETIME_FUNCS
376 Tcl_SetVar2(interp, "sqlite_options", "datetime", "0", TCL_GLOBAL_ONLY);
377 #else
378 Tcl_SetVar2(interp, "sqlite_options", "datetime", "1", TCL_GLOBAL_ONLY);
379 #endif
381 #ifdef SQLITE_OMIT_DECLTYPE
382 Tcl_SetVar2(interp, "sqlite_options", "decltype", "0", TCL_GLOBAL_ONLY);
383 #else
384 Tcl_SetVar2(interp, "sqlite_options", "decltype", "1", TCL_GLOBAL_ONLY);
385 #endif
387 #ifdef SQLITE_OMIT_DEPRECATED
388 Tcl_SetVar2(interp, "sqlite_options", "deprecated", "0", TCL_GLOBAL_ONLY);
389 #else
390 Tcl_SetVar2(interp, "sqlite_options", "deprecated", "1", TCL_GLOBAL_ONLY);
391 #endif
393 #ifdef SQLITE_OMIT_DISKIO
394 Tcl_SetVar2(interp, "sqlite_options", "diskio", "0", TCL_GLOBAL_ONLY);
395 #else
396 Tcl_SetVar2(interp, "sqlite_options", "diskio", "1", TCL_GLOBAL_ONLY);
397 #endif
399 #ifdef SQLITE_OMIT_EXPLAIN
400 Tcl_SetVar2(interp, "sqlite_options", "explain", "0", TCL_GLOBAL_ONLY);
401 #else
402 Tcl_SetVar2(interp, "sqlite_options", "explain", "1", TCL_GLOBAL_ONLY);
403 #endif
405 #ifdef SQLITE_OMIT_FLOATING_POINT
406 Tcl_SetVar2(interp, "sqlite_options", "floatingpoint", "0", TCL_GLOBAL_ONLY);
407 #else
408 Tcl_SetVar2(interp, "sqlite_options", "floatingpoint", "1", TCL_GLOBAL_ONLY);
409 #endif
411 #ifdef SQLITE_OMIT_FOREIGN_KEY
412 Tcl_SetVar2(interp, "sqlite_options", "foreignkey", "0", TCL_GLOBAL_ONLY);
413 #else
414 Tcl_SetVar2(interp, "sqlite_options", "foreignkey", "1", TCL_GLOBAL_ONLY);
415 #endif
417 #ifdef SQLITE_ENABLE_FTS1
418 Tcl_SetVar2(interp, "sqlite_options", "fts1", "1", TCL_GLOBAL_ONLY);
419 #else
420 Tcl_SetVar2(interp, "sqlite_options", "fts1", "0", TCL_GLOBAL_ONLY);
421 #endif
423 #ifdef SQLITE_ENABLE_FTS2
424 Tcl_SetVar2(interp, "sqlite_options", "fts2", "1", TCL_GLOBAL_ONLY);
425 #else
426 Tcl_SetVar2(interp, "sqlite_options", "fts2", "0", TCL_GLOBAL_ONLY);
427 #endif
429 #ifdef SQLITE_ENABLE_FTS3
430 Tcl_SetVar2(interp, "sqlite_options", "fts3", "1", TCL_GLOBAL_ONLY);
431 #else
432 Tcl_SetVar2(interp, "sqlite_options", "fts3", "0", TCL_GLOBAL_ONLY);
433 #endif
435 #ifdef SQLITE_ENABLE_FTS5
436 Tcl_SetVar2(interp, "sqlite_options", "fts5", "1", TCL_GLOBAL_ONLY);
437 #else
438 Tcl_SetVar2(interp, "sqlite_options", "fts5", "0", TCL_GLOBAL_ONLY);
439 #endif
441 #if defined(SQLITE_ENABLE_FTS3) && !defined(SQLITE_DISABLE_FTS3_UNICODE)
442 Tcl_SetVar2(interp, "sqlite_options", "fts3_unicode", "1", TCL_GLOBAL_ONLY);
443 #else
444 Tcl_SetVar2(interp, "sqlite_options", "fts3_unicode", "0", TCL_GLOBAL_ONLY);
445 #endif
447 #ifdef SQLITE_DISABLE_FTS4_DEFERRED
448 Tcl_SetVar2(interp, "sqlite_options", "fts4_deferred", "0", TCL_GLOBAL_ONLY);
449 #else
450 Tcl_SetVar2(interp, "sqlite_options", "fts4_deferred", "1", TCL_GLOBAL_ONLY);
451 #endif
453 #ifdef SQLITE_OMIT_GET_TABLE
454 Tcl_SetVar2(interp, "sqlite_options", "gettable", "0", TCL_GLOBAL_ONLY);
455 #else
456 Tcl_SetVar2(interp, "sqlite_options", "gettable", "1", TCL_GLOBAL_ONLY);
457 #endif
459 #ifdef SQLITE_ENABLE_ICU
460 Tcl_SetVar2(interp, "sqlite_options", "icu", "1", TCL_GLOBAL_ONLY);
461 #else
462 Tcl_SetVar2(interp, "sqlite_options", "icu", "0", TCL_GLOBAL_ONLY);
463 #endif
465 #ifdef SQLITE_ENABLE_ICU_COLLATIONS
466 Tcl_SetVar2(interp, "sqlite_options", "icu_collations", "1", TCL_GLOBAL_ONLY);
467 #else
468 Tcl_SetVar2(interp, "sqlite_options", "icu_collations", "0", TCL_GLOBAL_ONLY);
469 #endif
471 #ifdef SQLITE_OMIT_INCRBLOB
472 Tcl_SetVar2(interp, "sqlite_options", "incrblob", "0", TCL_GLOBAL_ONLY);
473 #else
474 Tcl_SetVar2(interp, "sqlite_options", "incrblob", "1", TCL_GLOBAL_ONLY);
475 #endif /* SQLITE_OMIT_AUTOVACUUM */
477 #ifdef SQLITE_OMIT_INTEGRITY_CHECK
478 Tcl_SetVar2(interp, "sqlite_options", "integrityck", "0", TCL_GLOBAL_ONLY);
479 #else
480 Tcl_SetVar2(interp, "sqlite_options", "integrityck", "1", TCL_GLOBAL_ONLY);
481 #endif
483 #if defined(SQLITE_DEFAULT_FILE_FORMAT) && SQLITE_DEFAULT_FILE_FORMAT==1
484 Tcl_SetVar2(interp, "sqlite_options", "legacyformat", "1", TCL_GLOBAL_ONLY);
485 #else
486 Tcl_SetVar2(interp, "sqlite_options", "legacyformat", "0", TCL_GLOBAL_ONLY);
487 #endif
489 #ifdef SQLITE_OMIT_LIKE_OPTIMIZATION
490 Tcl_SetVar2(interp, "sqlite_options", "like_opt", "0", TCL_GLOBAL_ONLY);
491 #else
492 Tcl_SetVar2(interp, "sqlite_options", "like_opt", "1", TCL_GLOBAL_ONLY);
493 #endif
495 #ifdef SQLITE_OMIT_LOAD_EXTENSION
496 Tcl_SetVar2(interp, "sqlite_options", "load_ext", "0", TCL_GLOBAL_ONLY);
497 #else
498 Tcl_SetVar2(interp, "sqlite_options", "load_ext", "1", TCL_GLOBAL_ONLY);
499 #endif
501 #ifdef SQLITE_OMIT_LOCALTIME
502 Tcl_SetVar2(interp, "sqlite_options", "localtime", "0", TCL_GLOBAL_ONLY);
503 #else
504 Tcl_SetVar2(interp, "sqlite_options", "localtime", "1", TCL_GLOBAL_ONLY);
505 #endif
507 #ifdef SQLITE_OMIT_LOOKASIDE
508 Tcl_SetVar2(interp, "sqlite_options", "lookaside", "0", TCL_GLOBAL_ONLY);
509 #else
510 Tcl_SetVar2(interp, "sqlite_options", "lookaside", "1", TCL_GLOBAL_ONLY);
511 #endif
513 Tcl_SetVar2(interp, "sqlite_options", "long_double",
514 sizeof(LONGDOUBLE_TYPE)>sizeof(double) ? "1" : "0",
515 TCL_GLOBAL_ONLY);
517 #ifdef SQLITE_OMIT_MEMORYDB
518 Tcl_SetVar2(interp, "sqlite_options", "memorydb", "0", TCL_GLOBAL_ONLY);
519 #else
520 Tcl_SetVar2(interp, "sqlite_options", "memorydb", "1", TCL_GLOBAL_ONLY);
521 #endif
523 #ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
524 Tcl_SetVar2(interp, "sqlite_options", "memorymanage", "1", TCL_GLOBAL_ONLY);
525 #else
526 Tcl_SetVar2(interp, "sqlite_options", "memorymanage", "0", TCL_GLOBAL_ONLY);
527 #endif
529 Tcl_SetVar2(interp, "sqlite_options", "mergesort", "1", TCL_GLOBAL_ONLY);
531 #ifdef SQLITE_ENABLE_NULL_TRIM
532 Tcl_SetVar2(interp, "sqlite_options", "null_trim", "1", TCL_GLOBAL_ONLY);
533 #else
534 Tcl_SetVar2(interp, "sqlite_options", "null_trim", "0", TCL_GLOBAL_ONLY);
535 #endif
537 #ifdef SQLITE_OMIT_OR_OPTIMIZATION
538 Tcl_SetVar2(interp, "sqlite_options", "or_opt", "0", TCL_GLOBAL_ONLY);
539 #else
540 Tcl_SetVar2(interp, "sqlite_options", "or_opt", "1", TCL_GLOBAL_ONLY);
541 #endif
543 #ifdef SQLITE_ENABLE_RBU
544 Tcl_SetVar2(interp, "sqlite_options", "rbu", "1", TCL_GLOBAL_ONLY);
545 #else
546 Tcl_SetVar2(interp, "sqlite_options", "rbu", "0", TCL_GLOBAL_ONLY);
547 #endif
549 #ifdef SQLITE_OMIT_PAGER_PRAGMAS
550 Tcl_SetVar2(interp, "sqlite_options", "pager_pragmas", "0", TCL_GLOBAL_ONLY);
551 #else
552 Tcl_SetVar2(interp, "sqlite_options", "pager_pragmas", "1", TCL_GLOBAL_ONLY);
553 #endif
555 #if defined(SQLITE_OMIT_PRAGMA) || defined(SQLITE_OMIT_FLAG_PRAGMAS)
556 Tcl_SetVar2(interp, "sqlite_options", "pragma", "0", TCL_GLOBAL_ONLY);
557 Tcl_SetVar2(interp, "sqlite_options", "integrityck", "0", TCL_GLOBAL_ONLY);
558 #else
559 Tcl_SetVar2(interp, "sqlite_options", "pragma", "1", TCL_GLOBAL_ONLY);
560 #endif
562 #ifdef SQLITE_OMIT_PROGRESS_CALLBACK
563 Tcl_SetVar2(interp, "sqlite_options", "progress", "0", TCL_GLOBAL_ONLY);
564 #else
565 Tcl_SetVar2(interp, "sqlite_options", "progress", "1", TCL_GLOBAL_ONLY);
566 #endif
568 #ifdef SQLITE_OMIT_REINDEX
569 Tcl_SetVar2(interp, "sqlite_options", "reindex", "0", TCL_GLOBAL_ONLY);
570 #else
571 Tcl_SetVar2(interp, "sqlite_options", "reindex", "1", TCL_GLOBAL_ONLY);
572 #endif
574 #ifdef SQLITE_ENABLE_RTREE
575 Tcl_SetVar2(interp, "sqlite_options", "rtree", "1", TCL_GLOBAL_ONLY);
576 #else
577 Tcl_SetVar2(interp, "sqlite_options", "rtree", "0", TCL_GLOBAL_ONLY);
578 #endif
580 #ifdef SQLITE_RTREE_INT_ONLY
581 Tcl_SetVar2(interp, "sqlite_options", "rtree_int_only", "1", TCL_GLOBAL_ONLY);
582 #else
583 Tcl_SetVar2(interp, "sqlite_options", "rtree_int_only", "0", TCL_GLOBAL_ONLY);
584 #endif
586 #ifdef SQLITE_OMIT_SCHEMA_PRAGMAS
587 Tcl_SetVar2(interp, "sqlite_options", "schema_pragmas", "0", TCL_GLOBAL_ONLY);
588 #else
589 Tcl_SetVar2(interp, "sqlite_options", "schema_pragmas", "1", TCL_GLOBAL_ONLY);
590 #endif
592 #ifdef SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS
593 Tcl_SetVar2(interp, "sqlite_options", "schema_version", "0", TCL_GLOBAL_ONLY);
594 #else
595 Tcl_SetVar2(interp, "sqlite_options", "schema_version", "1", TCL_GLOBAL_ONLY);
596 #endif
598 #if defined(SQLITE_ENABLE_SESSION) && defined(SQLITE_ENABLE_PREUPDATE_HOOK)
599 Tcl_SetVar2(interp, "sqlite_options", "session", "1", TCL_GLOBAL_ONLY);
600 #else
601 Tcl_SetVar2(interp, "sqlite_options", "session", "0", TCL_GLOBAL_ONLY);
602 #endif
604 #ifdef SQLITE_ENABLE_STAT4
605 Tcl_SetVar2(interp, "sqlite_options", "stat4", "1", TCL_GLOBAL_ONLY);
606 #else
607 Tcl_SetVar2(interp, "sqlite_options", "stat4", "0", TCL_GLOBAL_ONLY);
608 #endif
609 #if defined(SQLITE_ENABLE_STMTVTAB) && !defined(SQLITE_OMIT_VIRTUALTABLE)
610 Tcl_SetVar2(interp, "sqlite_options", "stmtvtab", "1", TCL_GLOBAL_ONLY);
611 #else
612 Tcl_SetVar2(interp, "sqlite_options", "stmtvtab", "0", TCL_GLOBAL_ONLY);
613 #endif
615 #ifdef SQLITE_ENABLE_STMT_SCANSTATUS
616 Tcl_SetVar2(interp, "sqlite_options", "scanstatus", "1", TCL_GLOBAL_ONLY);
617 #else
618 Tcl_SetVar2(interp, "sqlite_options", "scanstatus", "0", TCL_GLOBAL_ONLY);
619 #endif
621 #if !defined(SQLITE_ENABLE_LOCKING_STYLE)
622 # if defined(__APPLE__)
623 # define SQLITE_ENABLE_LOCKING_STYLE 1
624 # else
625 # define SQLITE_ENABLE_LOCKING_STYLE 0
626 # endif
627 #endif
628 #if SQLITE_ENABLE_LOCKING_STYLE && defined(__APPLE__)
629 Tcl_SetVar2(interp,"sqlite_options","lock_proxy_pragmas","1",TCL_GLOBAL_ONLY);
630 #else
631 Tcl_SetVar2(interp,"sqlite_options","lock_proxy_pragmas","0",TCL_GLOBAL_ONLY);
632 #endif
633 #if defined(SQLITE_PREFER_PROXY_LOCKING) && defined(__APPLE__)
634 Tcl_SetVar2(interp,"sqlite_options","prefer_proxy_locking","1",TCL_GLOBAL_ONLY);
635 #else
636 Tcl_SetVar2(interp,"sqlite_options","prefer_proxy_locking","0",TCL_GLOBAL_ONLY);
637 #endif
640 #ifdef SQLITE_OMIT_SHARED_CACHE
641 Tcl_SetVar2(interp, "sqlite_options", "shared_cache", "0", TCL_GLOBAL_ONLY);
642 #else
643 Tcl_SetVar2(interp, "sqlite_options", "shared_cache", "1", TCL_GLOBAL_ONLY);
644 #endif
646 #ifdef SQLITE_OMIT_SUBQUERY
647 Tcl_SetVar2(interp, "sqlite_options", "subquery", "0", TCL_GLOBAL_ONLY);
648 #else
649 Tcl_SetVar2(interp, "sqlite_options", "subquery", "1", TCL_GLOBAL_ONLY);
650 #endif
652 #ifdef SQLITE_OMIT_TCL_VARIABLE
653 Tcl_SetVar2(interp, "sqlite_options", "tclvar", "0", TCL_GLOBAL_ONLY);
654 #else
655 Tcl_SetVar2(interp, "sqlite_options", "tclvar", "1", TCL_GLOBAL_ONLY);
656 #endif
658 Tcl_SetVar2(interp, "sqlite_options", "threadsafe",
659 SQLITE_THREADSAFE ? "1" : "0", TCL_GLOBAL_ONLY);
660 Tcl_SetVar2(interp, "sqlite_options", "threadsafe1",
661 SQLITE_THREADSAFE==1 ? "1" : "0", TCL_GLOBAL_ONLY);
662 Tcl_SetVar2(interp, "sqlite_options", "threadsafe2",
663 SQLITE_THREADSAFE==2 ? "1" : "0", TCL_GLOBAL_ONLY);
664 assert( sqlite3_threadsafe()==SQLITE_THREADSAFE );
666 #ifdef SQLITE_OMIT_TEMPDB
667 Tcl_SetVar2(interp, "sqlite_options", "tempdb", "0", TCL_GLOBAL_ONLY);
668 #else
669 Tcl_SetVar2(interp, "sqlite_options", "tempdb", "1", TCL_GLOBAL_ONLY);
670 #endif
672 #ifdef SQLITE_OMIT_TRACE
673 Tcl_SetVar2(interp, "sqlite_options", "trace", "0", TCL_GLOBAL_ONLY);
674 #else
675 Tcl_SetVar2(interp, "sqlite_options", "trace", "1", TCL_GLOBAL_ONLY);
676 #endif
678 #ifdef SQLITE_OMIT_TRIGGER
679 Tcl_SetVar2(interp, "sqlite_options", "trigger", "0", TCL_GLOBAL_ONLY);
680 #else
681 Tcl_SetVar2(interp, "sqlite_options", "trigger", "1", TCL_GLOBAL_ONLY);
682 #endif
684 #ifdef SQLITE_OMIT_TRUNCATE_OPTIMIZATION
685 Tcl_SetVar2(interp, "sqlite_options", "truncate_opt", "0", TCL_GLOBAL_ONLY);
686 #else
687 Tcl_SetVar2(interp, "sqlite_options", "truncate_opt", "1", TCL_GLOBAL_ONLY);
688 #endif
690 #ifdef SQLITE_OMIT_UTF16
691 Tcl_SetVar2(interp, "sqlite_options", "utf16", "0", TCL_GLOBAL_ONLY);
692 #else
693 Tcl_SetVar2(interp, "sqlite_options", "utf16", "1", TCL_GLOBAL_ONLY);
694 #endif
696 #if defined(SQLITE_OMIT_VACUUM) || defined(SQLITE_OMIT_ATTACH)
697 Tcl_SetVar2(interp, "sqlite_options", "vacuum", "0", TCL_GLOBAL_ONLY);
698 #else
699 Tcl_SetVar2(interp, "sqlite_options", "vacuum", "1", TCL_GLOBAL_ONLY);
700 #endif
702 #ifdef SQLITE_OMIT_VIEW
703 Tcl_SetVar2(interp, "sqlite_options", "view", "0", TCL_GLOBAL_ONLY);
704 #else
705 Tcl_SetVar2(interp, "sqlite_options", "view", "1", TCL_GLOBAL_ONLY);
706 #endif
708 #ifdef SQLITE_OMIT_VIRTUALTABLE
709 Tcl_SetVar2(interp, "sqlite_options", "vtab", "0", TCL_GLOBAL_ONLY);
710 #else
711 Tcl_SetVar2(interp, "sqlite_options", "vtab", "1", TCL_GLOBAL_ONLY);
712 #endif
714 #ifdef SQLITE_OMIT_WAL
715 Tcl_SetVar2(interp, "sqlite_options", "wal", "0", TCL_GLOBAL_ONLY);
716 #else
717 Tcl_SetVar2(interp, "sqlite_options", "wal", "1", TCL_GLOBAL_ONLY);
718 #endif
720 #ifdef SQLITE_OMIT_WSD
721 Tcl_SetVar2(interp, "sqlite_options", "wsd", "0", TCL_GLOBAL_ONLY);
722 #else
723 Tcl_SetVar2(interp, "sqlite_options", "wsd", "1", TCL_GLOBAL_ONLY);
724 #endif
726 #if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY)
727 Tcl_SetVar2(interp, "sqlite_options", "update_delete_limit", "1", TCL_GLOBAL_ONLY);
728 #else
729 Tcl_SetVar2(interp, "sqlite_options", "update_delete_limit", "0", TCL_GLOBAL_ONLY);
730 #endif
732 #if defined(SQLITE_ENABLE_UNLOCK_NOTIFY)
733 Tcl_SetVar2(interp, "sqlite_options", "unlock_notify", "1", TCL_GLOBAL_ONLY);
734 #else
735 Tcl_SetVar2(interp, "sqlite_options", "unlock_notify", "0", TCL_GLOBAL_ONLY);
736 #endif
738 #ifdef SQLITE_FAST_SECURE_DELETE
739 Tcl_SetVar2(interp, "sqlite_options", "fast_secure_delete", "1", TCL_GLOBAL_ONLY);
740 #else
741 Tcl_SetVar2(interp, "sqlite_options", "fast_secure_delete", "0", TCL_GLOBAL_ONLY);
742 #endif
744 #ifdef SQLITE_SECURE_DELETE
745 Tcl_SetVar2(interp, "sqlite_options", "secure_delete", "1", TCL_GLOBAL_ONLY);
746 #else
747 Tcl_SetVar2(interp, "sqlite_options", "secure_delete", "0", TCL_GLOBAL_ONLY);
748 #endif
750 #ifdef SQLITE_USER_AUTHENTICATION
751 Tcl_SetVar2(interp, "sqlite_options", "userauth", "1", TCL_GLOBAL_ONLY);
752 #else
753 Tcl_SetVar2(interp, "sqlite_options", "userauth", "0", TCL_GLOBAL_ONLY);
754 #endif
756 #ifdef SQLITE_MULTIPLEX_EXT_OVWR
757 Tcl_SetVar2(interp, "sqlite_options", "multiplex_ext_overwrite", "1", TCL_GLOBAL_ONLY);
758 #else
759 Tcl_SetVar2(interp, "sqlite_options", "multiplex_ext_overwrite", "0", TCL_GLOBAL_ONLY);
760 #endif
762 #ifdef YYTRACKMAXSTACKDEPTH
763 Tcl_SetVar2(interp, "sqlite_options", "yytrackmaxstackdepth", "1", TCL_GLOBAL_ONLY);
764 #else
765 Tcl_SetVar2(interp, "sqlite_options", "yytrackmaxstackdepth", "0", TCL_GLOBAL_ONLY);
766 #endif
768 #ifdef SQLITE_ENABLE_SQLLOG
769 Tcl_SetVar2(interp, "sqlite_options", "sqllog", "1", TCL_GLOBAL_ONLY);
770 #else
771 Tcl_SetVar2(interp, "sqlite_options", "sqllog", "0", TCL_GLOBAL_ONLY);
772 #endif
774 #ifdef SQLITE_ENABLE_URI_00_ERROR
775 Tcl_SetVar2(interp, "sqlite_options", "uri_00_error", "1", TCL_GLOBAL_ONLY);
776 #else
777 Tcl_SetVar2(interp, "sqlite_options", "uri_00_error", "0", TCL_GLOBAL_ONLY);
778 #endif
780 #if defined(SQLITE_ENABLE_NORMALIZE)
781 Tcl_SetVar2(interp, "sqlite_options", "normalize", "1", TCL_GLOBAL_ONLY);
782 #else
783 Tcl_SetVar2(interp, "sqlite_options", "normalize", "0", TCL_GLOBAL_ONLY);
784 #endif
786 #ifdef SQLITE_OMIT_WINDOWFUNC
787 Tcl_SetVar2(interp, "sqlite_options", "windowfunc", "0", TCL_GLOBAL_ONLY);
788 #else
789 Tcl_SetVar2(interp, "sqlite_options", "windowfunc", "1", TCL_GLOBAL_ONLY);
790 #endif
792 #define LINKVAR(x) { \
793 static const int cv_ ## x = SQLITE_ ## x; \
794 Tcl_LinkVar(interp, "SQLITE_" #x, (char *)&(cv_ ## x), \
795 TCL_LINK_INT | TCL_LINK_READ_ONLY); }
797 LINKVAR( MAX_LENGTH );
798 LINKVAR( MAX_COLUMN );
799 LINKVAR( MAX_SQL_LENGTH );
800 LINKVAR( MAX_EXPR_DEPTH );
801 LINKVAR( MAX_COMPOUND_SELECT );
802 LINKVAR( MAX_VDBE_OP );
803 LINKVAR( MAX_FUNCTION_ARG );
804 LINKVAR( MAX_VARIABLE_NUMBER );
805 LINKVAR( MAX_PAGE_SIZE );
806 LINKVAR( MAX_PAGE_COUNT );
807 LINKVAR( MAX_LIKE_PATTERN_LENGTH );
808 LINKVAR( MAX_TRIGGER_DEPTH );
809 LINKVAR( DEFAULT_CACHE_SIZE );
810 LINKVAR( DEFAULT_PAGE_SIZE );
811 LINKVAR( DEFAULT_FILE_FORMAT );
812 LINKVAR( DEFAULT_SYNCHRONOUS );
813 LINKVAR( DEFAULT_WAL_SYNCHRONOUS );
814 LINKVAR( MAX_ATTACHED );
815 LINKVAR( MAX_DEFAULT_PAGE_SIZE );
816 LINKVAR( MAX_WORKER_THREADS );
819 static const int cv_TEMP_STORE = SQLITE_TEMP_STORE;
820 Tcl_LinkVar(interp, "TEMP_STORE", (char *)&(cv_TEMP_STORE),
821 TCL_LINK_INT | TCL_LINK_READ_ONLY);
824 #ifdef _MSC_VER
826 static const int cv__MSC_VER = 1;
827 Tcl_LinkVar(interp, "_MSC_VER", (char *)&(cv__MSC_VER),
828 TCL_LINK_INT | TCL_LINK_READ_ONLY);
830 #endif
831 #ifdef __GNUC__
833 static const int cv___GNUC__ = 1;
834 Tcl_LinkVar(interp, "__GNUC__", (char *)&(cv___GNUC__),
835 TCL_LINK_INT | TCL_LINK_READ_ONLY);
837 #endif
842 ** Register commands with the TCL interpreter.
844 int Sqliteconfig_Init(Tcl_Interp *interp){
845 set_options(interp);
846 return TCL_OK;