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 contains code used for testing the SQLite system.
14 ** None of the code in this file goes into a deliverable build.
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"
27 #if defined(INCLUDE_SQLITE_TCL_H)
28 # include "sqlite_tcl.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",
52 Tcl_SetVar2(interp
, "sqlite_options", "malloc_usable_size", "0",
56 #ifdef SQLITE_32BIT_ROWID
57 Tcl_SetVar2(interp
, "sqlite_options", "rowid32", "1", TCL_GLOBAL_ONLY
);
59 Tcl_SetVar2(interp
, "sqlite_options", "rowid32", "0", TCL_GLOBAL_ONLY
);
62 #ifdef SQLITE_CASE_SENSITIVE_LIKE
63 Tcl_SetVar2(interp
, "sqlite_options","casesensitivelike","1",TCL_GLOBAL_ONLY
);
65 Tcl_SetVar2(interp
, "sqlite_options","casesensitivelike","0",TCL_GLOBAL_ONLY
);
68 #if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT
69 Tcl_SetVar2(interp
, "sqlite_options", "curdir", "1", TCL_GLOBAL_ONLY
);
71 Tcl_SetVar2(interp
, "sqlite_options", "curdir", "0", TCL_GLOBAL_ONLY
);
74 #ifdef SQLITE_WIN32_MALLOC
75 Tcl_SetVar2(interp
, "sqlite_options", "win32malloc", "1", TCL_GLOBAL_ONLY
);
77 Tcl_SetVar2(interp
, "sqlite_options", "win32malloc", "0", TCL_GLOBAL_ONLY
);
81 Tcl_SetVar2(interp
, "sqlite_options", "debug", "1", TCL_GLOBAL_ONLY
);
83 Tcl_SetVar2(interp
, "sqlite_options", "debug", "0", TCL_GLOBAL_ONLY
);
86 #ifdef SQLITE_DEFAULT_CKPTFULLFSYNC
87 Tcl_SetVar2(interp
, "sqlite_options", "default_ckptfullfsync",
88 SQLITE_DEFAULT_CKPTFULLFSYNC
? "1" : "0", TCL_GLOBAL_ONLY
);
90 Tcl_SetVar2(interp
, "sqlite_options", "default_ckptfullfsync", "0", TCL_GLOBAL_ONLY
);
93 #ifdef SQLITE_DIRECT_OVERFLOW_READ
94 Tcl_SetVar2(interp
, "sqlite_options", "direct_read", "1", TCL_GLOBAL_ONLY
);
96 Tcl_SetVar2(interp
, "sqlite_options", "direct_read", "0", TCL_GLOBAL_ONLY
);
99 #ifdef SQLITE_DISABLE_DIRSYNC
100 Tcl_SetVar2(interp
, "sqlite_options", "dirsync", "0", TCL_GLOBAL_ONLY
);
102 Tcl_SetVar2(interp
, "sqlite_options", "dirsync", "1", TCL_GLOBAL_ONLY
);
105 #ifdef SQLITE_DISABLE_LFS
106 Tcl_SetVar2(interp
, "sqlite_options", "lfs", "0", TCL_GLOBAL_ONLY
);
108 Tcl_SetVar2(interp
, "sqlite_options", "lfs", "1", TCL_GLOBAL_ONLY
);
111 #ifdef SQLITE_DISABLE_PAGECACHE_OVERFLOW_STATS
112 Tcl_SetVar2(interp
, "sqlite_options", "pagecache_overflow_stats","0",TCL_GLOBAL_ONLY
);
114 Tcl_SetVar2(interp
, "sqlite_options", "pagecache_overflow_stats","1",TCL_GLOBAL_ONLY
);
117 #if SQLITE_MAX_MMAP_SIZE>0
118 Tcl_SetVar2(interp
, "sqlite_options", "mmap", "1", TCL_GLOBAL_ONLY
);
120 Tcl_SetVar2(interp
, "sqlite_options", "mmap", "0", TCL_GLOBAL_ONLY
);
123 Tcl_SetVar2(interp
, "sqlite_options", "worker_threads",
124 STRINGVALUE(SQLITE_MAX_WORKER_THREADS
), TCL_GLOBAL_ONLY
127 #if 1 /* def SQLITE_MEMDEBUG */
128 Tcl_SetVar2(interp
, "sqlite_options", "memdebug", "1", TCL_GLOBAL_ONLY
);
130 Tcl_SetVar2(interp
, "sqlite_options", "memdebug", "0", TCL_GLOBAL_ONLY
);
133 #ifdef SQLITE_ENABLE_8_3_NAMES
134 Tcl_SetVar2(interp
, "sqlite_options", "8_3_names", "1", TCL_GLOBAL_ONLY
);
136 Tcl_SetVar2(interp
, "sqlite_options", "8_3_names", "0", TCL_GLOBAL_ONLY
);
139 #ifdef SQLITE_ENABLE_CURSOR_HINTS
140 Tcl_SetVar2(interp
, "sqlite_options", "cursorhints", "1", TCL_GLOBAL_ONLY
);
142 Tcl_SetVar2(interp
, "sqlite_options", "cursorhints", "0", TCL_GLOBAL_ONLY
);
145 #ifdef SQLITE_ENABLE_HIDDEN_COLUMNS
146 Tcl_SetVar2(interp
, "sqlite_options", "hiddencolumns", "1", TCL_GLOBAL_ONLY
);
148 Tcl_SetVar2(interp
, "sqlite_options", "hiddencolumns", "0", TCL_GLOBAL_ONLY
);
151 #ifdef SQLITE_ENABLE_MEMSYS3
152 Tcl_SetVar2(interp
, "sqlite_options", "mem3", "1", TCL_GLOBAL_ONLY
);
154 Tcl_SetVar2(interp
, "sqlite_options", "mem3", "0", TCL_GLOBAL_ONLY
);
157 #ifdef SQLITE_ENABLE_MEMSYS5
158 Tcl_SetVar2(interp
, "sqlite_options", "mem5", "1", TCL_GLOBAL_ONLY
);
160 Tcl_SetVar2(interp
, "sqlite_options", "mem5", "0", TCL_GLOBAL_ONLY
);
163 #ifdef SQLITE_ENABLE_PREUPDATE_HOOK
164 Tcl_SetVar2(interp
, "sqlite_options", "preupdate", "1", TCL_GLOBAL_ONLY
);
166 Tcl_SetVar2(interp
, "sqlite_options", "preupdate", "0", TCL_GLOBAL_ONLY
);
169 #ifdef SQLITE_ENABLE_SNAPSHOT
170 Tcl_SetVar2(interp
, "sqlite_options", "snapshot", "1", TCL_GLOBAL_ONLY
);
172 Tcl_SetVar2(interp
, "sqlite_options", "snapshot", "0", TCL_GLOBAL_ONLY
);
175 #ifdef SQLITE_MUTEX_OMIT
176 Tcl_SetVar2(interp
, "sqlite_options", "mutex", "0", TCL_GLOBAL_ONLY
);
178 Tcl_SetVar2(interp
, "sqlite_options", "mutex", "1", TCL_GLOBAL_ONLY
);
181 #ifdef SQLITE_MUTEX_NOOP
182 Tcl_SetVar2(interp
, "sqlite_options", "mutex_noop", "1", TCL_GLOBAL_ONLY
);
184 Tcl_SetVar2(interp
, "sqlite_options", "mutex_noop", "0", TCL_GLOBAL_ONLY
);
187 #ifdef SQLITE_OMIT_ALTERTABLE
188 Tcl_SetVar2(interp
, "sqlite_options", "altertable", "0", TCL_GLOBAL_ONLY
);
190 Tcl_SetVar2(interp
, "sqlite_options", "altertable", "1", TCL_GLOBAL_ONLY
);
193 #ifdef SQLITE_OMIT_ANALYZE
194 Tcl_SetVar2(interp
, "sqlite_options", "analyze", "0", TCL_GLOBAL_ONLY
);
196 Tcl_SetVar2(interp
, "sqlite_options", "analyze", "1", TCL_GLOBAL_ONLY
);
199 #ifdef SQLITE_ENABLE_API_ARMOR
200 Tcl_SetVar2(interp
, "sqlite_options", "api_armor", "1", TCL_GLOBAL_ONLY
);
202 Tcl_SetVar2(interp
, "sqlite_options", "api_armor", "0", TCL_GLOBAL_ONLY
);
205 #ifdef SQLITE_ENABLE_ATOMIC_WRITE
206 Tcl_SetVar2(interp
, "sqlite_options", "atomicwrite", "1", TCL_GLOBAL_ONLY
);
208 Tcl_SetVar2(interp
, "sqlite_options", "atomicwrite", "0", TCL_GLOBAL_ONLY
);
211 #ifdef SQLITE_ENABLE_JSON1
212 Tcl_SetVar2(interp
, "sqlite_options", "json1", "1", TCL_GLOBAL_ONLY
);
214 Tcl_SetVar2(interp
, "sqlite_options", "json1", "0", TCL_GLOBAL_ONLY
);
217 #ifdef SQLITE_HAS_CODEC
218 Tcl_SetVar2(interp
, "sqlite_options", "has_codec", "1", TCL_GLOBAL_ONLY
);
220 Tcl_SetVar2(interp
, "sqlite_options", "has_codec", "0", TCL_GLOBAL_ONLY
);
223 #ifdef SQLITE_LIKE_DOESNT_MATCH_BLOBS
224 Tcl_SetVar2(interp
, "sqlite_options", "like_match_blobs", "0", TCL_GLOBAL_ONLY
);
226 Tcl_SetVar2(interp
, "sqlite_options", "like_match_blobs", "1", TCL_GLOBAL_ONLY
);
229 #ifdef SQLITE_OMIT_ATTACH
230 Tcl_SetVar2(interp
, "sqlite_options", "attach", "0", TCL_GLOBAL_ONLY
);
232 Tcl_SetVar2(interp
, "sqlite_options", "attach", "1", TCL_GLOBAL_ONLY
);
235 #ifdef SQLITE_OMIT_AUTHORIZATION
236 Tcl_SetVar2(interp
, "sqlite_options", "auth", "0", TCL_GLOBAL_ONLY
);
238 Tcl_SetVar2(interp
, "sqlite_options", "auth", "1", TCL_GLOBAL_ONLY
);
241 #ifdef SQLITE_OMIT_AUTOINCREMENT
242 Tcl_SetVar2(interp
, "sqlite_options", "autoinc", "0", TCL_GLOBAL_ONLY
);
244 Tcl_SetVar2(interp
, "sqlite_options", "autoinc", "1", TCL_GLOBAL_ONLY
);
247 #ifdef SQLITE_OMIT_AUTOMATIC_INDEX
248 Tcl_SetVar2(interp
, "sqlite_options", "autoindex", "0", TCL_GLOBAL_ONLY
);
250 Tcl_SetVar2(interp
, "sqlite_options", "autoindex", "1", TCL_GLOBAL_ONLY
);
253 #ifdef SQLITE_OMIT_AUTORESET
254 Tcl_SetVar2(interp
, "sqlite_options", "autoreset", "0", TCL_GLOBAL_ONLY
);
256 Tcl_SetVar2(interp
, "sqlite_options", "autoreset", "1", TCL_GLOBAL_ONLY
);
259 #ifdef SQLITE_OMIT_AUTOVACUUM
260 Tcl_SetVar2(interp
, "sqlite_options", "autovacuum", "0", TCL_GLOBAL_ONLY
);
262 Tcl_SetVar2(interp
, "sqlite_options", "autovacuum", "1", TCL_GLOBAL_ONLY
);
263 #endif /* SQLITE_OMIT_AUTOVACUUM */
264 #if !defined(SQLITE_DEFAULT_AUTOVACUUM)
265 Tcl_SetVar2(interp
,"sqlite_options","default_autovacuum","0",TCL_GLOBAL_ONLY
);
267 Tcl_SetVar2(interp
, "sqlite_options", "default_autovacuum",
268 STRINGVALUE(SQLITE_DEFAULT_AUTOVACUUM
), TCL_GLOBAL_ONLY
);
271 #ifdef SQLITE_OMIT_BETWEEN_OPTIMIZATION
272 Tcl_SetVar2(interp
, "sqlite_options", "between_opt", "0", TCL_GLOBAL_ONLY
);
274 Tcl_SetVar2(interp
, "sqlite_options", "between_opt", "1", TCL_GLOBAL_ONLY
);
277 #ifdef SQLITE_UNTESTABLE
278 Tcl_SetVar2(interp
, "sqlite_options", "builtin_test", "0", TCL_GLOBAL_ONLY
);
280 Tcl_SetVar2(interp
, "sqlite_options", "builtin_test", "1", TCL_GLOBAL_ONLY
);
283 #ifdef SQLITE_OMIT_BLOB_LITERAL
284 Tcl_SetVar2(interp
, "sqlite_options", "bloblit", "0", TCL_GLOBAL_ONLY
);
286 Tcl_SetVar2(interp
, "sqlite_options", "bloblit", "1", TCL_GLOBAL_ONLY
);
289 #ifdef SQLITE_OMIT_CAST
290 Tcl_SetVar2(interp
, "sqlite_options", "cast", "0", TCL_GLOBAL_ONLY
);
292 Tcl_SetVar2(interp
, "sqlite_options", "cast", "1", TCL_GLOBAL_ONLY
);
295 #ifdef SQLITE_OMIT_CHECK
296 Tcl_SetVar2(interp
, "sqlite_options", "check", "0", TCL_GLOBAL_ONLY
);
298 Tcl_SetVar2(interp
, "sqlite_options", "check", "1", TCL_GLOBAL_ONLY
);
301 #ifdef SQLITE_OMIT_CTE
302 Tcl_SetVar2(interp
, "sqlite_options", "cte", "0", TCL_GLOBAL_ONLY
);
304 Tcl_SetVar2(interp
, "sqlite_options", "cte", "1", TCL_GLOBAL_ONLY
);
307 #ifdef SQLITE_ENABLE_COLUMN_METADATA
308 Tcl_SetVar2(interp
, "sqlite_options", "columnmetadata", "1", TCL_GLOBAL_ONLY
);
310 Tcl_SetVar2(interp
, "sqlite_options", "columnmetadata", "0", TCL_GLOBAL_ONLY
);
313 #ifdef SQLITE_ENABLE_OVERSIZE_CELL_CHECK
314 Tcl_SetVar2(interp
, "sqlite_options", "oversize_cell_check", "1",
317 Tcl_SetVar2(interp
, "sqlite_options", "oversize_cell_check", "0",
321 #ifdef SQLITE_OMIT_COMPILEOPTION_DIAGS
322 Tcl_SetVar2(interp
, "sqlite_options", "compileoption_diags", "0", TCL_GLOBAL_ONLY
);
324 Tcl_SetVar2(interp
, "sqlite_options", "compileoption_diags", "1", TCL_GLOBAL_ONLY
);
327 #ifdef SQLITE_OMIT_COMPLETE
328 Tcl_SetVar2(interp
, "sqlite_options", "complete", "0", TCL_GLOBAL_ONLY
);
330 Tcl_SetVar2(interp
, "sqlite_options", "complete", "1", TCL_GLOBAL_ONLY
);
333 #ifdef SQLITE_OMIT_COMPOUND_SELECT
334 Tcl_SetVar2(interp
, "sqlite_options", "compound", "0", TCL_GLOBAL_ONLY
);
336 Tcl_SetVar2(interp
, "sqlite_options", "compound", "1", TCL_GLOBAL_ONLY
);
339 Tcl_SetVar2(interp
, "sqlite_options", "conflict", "1", TCL_GLOBAL_ONLY
);
340 Tcl_SetVar2(interp
, "sqlite_options", "crashtest", "1", TCL_GLOBAL_ONLY
);
342 #ifdef SQLITE_OMIT_DATETIME_FUNCS
343 Tcl_SetVar2(interp
, "sqlite_options", "datetime", "0", TCL_GLOBAL_ONLY
);
345 Tcl_SetVar2(interp
, "sqlite_options", "datetime", "1", TCL_GLOBAL_ONLY
);
348 #ifdef SQLITE_OMIT_DECLTYPE
349 Tcl_SetVar2(interp
, "sqlite_options", "decltype", "0", TCL_GLOBAL_ONLY
);
351 Tcl_SetVar2(interp
, "sqlite_options", "decltype", "1", TCL_GLOBAL_ONLY
);
354 #ifdef SQLITE_OMIT_DEPRECATED
355 Tcl_SetVar2(interp
, "sqlite_options", "deprecated", "0", TCL_GLOBAL_ONLY
);
357 Tcl_SetVar2(interp
, "sqlite_options", "deprecated", "1", TCL_GLOBAL_ONLY
);
360 #ifdef SQLITE_OMIT_DISKIO
361 Tcl_SetVar2(interp
, "sqlite_options", "diskio", "0", TCL_GLOBAL_ONLY
);
363 Tcl_SetVar2(interp
, "sqlite_options", "diskio", "1", TCL_GLOBAL_ONLY
);
366 #ifdef SQLITE_OMIT_EXPLAIN
367 Tcl_SetVar2(interp
, "sqlite_options", "explain", "0", TCL_GLOBAL_ONLY
);
369 Tcl_SetVar2(interp
, "sqlite_options", "explain", "1", TCL_GLOBAL_ONLY
);
372 #ifdef SQLITE_OMIT_FLOATING_POINT
373 Tcl_SetVar2(interp
, "sqlite_options", "floatingpoint", "0", TCL_GLOBAL_ONLY
);
375 Tcl_SetVar2(interp
, "sqlite_options", "floatingpoint", "1", TCL_GLOBAL_ONLY
);
378 #ifdef SQLITE_OMIT_FOREIGN_KEY
379 Tcl_SetVar2(interp
, "sqlite_options", "foreignkey", "0", TCL_GLOBAL_ONLY
);
381 Tcl_SetVar2(interp
, "sqlite_options", "foreignkey", "1", TCL_GLOBAL_ONLY
);
384 #ifdef SQLITE_ENABLE_FTS1
385 Tcl_SetVar2(interp
, "sqlite_options", "fts1", "1", TCL_GLOBAL_ONLY
);
387 Tcl_SetVar2(interp
, "sqlite_options", "fts1", "0", TCL_GLOBAL_ONLY
);
390 #ifdef SQLITE_ENABLE_FTS2
391 Tcl_SetVar2(interp
, "sqlite_options", "fts2", "1", TCL_GLOBAL_ONLY
);
393 Tcl_SetVar2(interp
, "sqlite_options", "fts2", "0", TCL_GLOBAL_ONLY
);
396 #ifdef SQLITE_ENABLE_FTS3
397 Tcl_SetVar2(interp
, "sqlite_options", "fts3", "1", TCL_GLOBAL_ONLY
);
399 Tcl_SetVar2(interp
, "sqlite_options", "fts3", "0", TCL_GLOBAL_ONLY
);
402 #ifdef SQLITE_ENABLE_FTS5
403 Tcl_SetVar2(interp
, "sqlite_options", "fts5", "1", TCL_GLOBAL_ONLY
);
405 Tcl_SetVar2(interp
, "sqlite_options", "fts5", "0", TCL_GLOBAL_ONLY
);
408 #if defined(SQLITE_ENABLE_FTS3) && !defined(SQLITE_DISABLE_FTS3_UNICODE)
409 Tcl_SetVar2(interp
, "sqlite_options", "fts3_unicode", "1", TCL_GLOBAL_ONLY
);
411 Tcl_SetVar2(interp
, "sqlite_options", "fts3_unicode", "0", TCL_GLOBAL_ONLY
);
414 #ifdef SQLITE_DISABLE_FTS4_DEFERRED
415 Tcl_SetVar2(interp
, "sqlite_options", "fts4_deferred", "0", TCL_GLOBAL_ONLY
);
417 Tcl_SetVar2(interp
, "sqlite_options", "fts4_deferred", "1", TCL_GLOBAL_ONLY
);
420 #ifdef SQLITE_OMIT_GET_TABLE
421 Tcl_SetVar2(interp
, "sqlite_options", "gettable", "0", TCL_GLOBAL_ONLY
);
423 Tcl_SetVar2(interp
, "sqlite_options", "gettable", "1", TCL_GLOBAL_ONLY
);
426 #ifdef SQLITE_ENABLE_ICU
427 Tcl_SetVar2(interp
, "sqlite_options", "icu", "1", TCL_GLOBAL_ONLY
);
429 Tcl_SetVar2(interp
, "sqlite_options", "icu", "0", TCL_GLOBAL_ONLY
);
432 #ifdef SQLITE_OMIT_INCRBLOB
433 Tcl_SetVar2(interp
, "sqlite_options", "incrblob", "0", TCL_GLOBAL_ONLY
);
435 Tcl_SetVar2(interp
, "sqlite_options", "incrblob", "1", TCL_GLOBAL_ONLY
);
436 #endif /* SQLITE_OMIT_AUTOVACUUM */
438 #ifdef SQLITE_OMIT_INTEGRITY_CHECK
439 Tcl_SetVar2(interp
, "sqlite_options", "integrityck", "0", TCL_GLOBAL_ONLY
);
441 Tcl_SetVar2(interp
, "sqlite_options", "integrityck", "1", TCL_GLOBAL_ONLY
);
444 #if defined(SQLITE_DEFAULT_FILE_FORMAT) && SQLITE_DEFAULT_FILE_FORMAT==1
445 Tcl_SetVar2(interp
, "sqlite_options", "legacyformat", "1", TCL_GLOBAL_ONLY
);
447 Tcl_SetVar2(interp
, "sqlite_options", "legacyformat", "0", TCL_GLOBAL_ONLY
);
450 #ifdef SQLITE_OMIT_LIKE_OPTIMIZATION
451 Tcl_SetVar2(interp
, "sqlite_options", "like_opt", "0", TCL_GLOBAL_ONLY
);
453 Tcl_SetVar2(interp
, "sqlite_options", "like_opt", "1", TCL_GLOBAL_ONLY
);
456 #ifdef SQLITE_OMIT_LOAD_EXTENSION
457 Tcl_SetVar2(interp
, "sqlite_options", "load_ext", "0", TCL_GLOBAL_ONLY
);
459 Tcl_SetVar2(interp
, "sqlite_options", "load_ext", "1", TCL_GLOBAL_ONLY
);
462 #ifdef SQLITE_OMIT_LOCALTIME
463 Tcl_SetVar2(interp
, "sqlite_options", "localtime", "0", TCL_GLOBAL_ONLY
);
465 Tcl_SetVar2(interp
, "sqlite_options", "localtime", "1", TCL_GLOBAL_ONLY
);
468 #ifdef SQLITE_OMIT_LOOKASIDE
469 Tcl_SetVar2(interp
, "sqlite_options", "lookaside", "0", TCL_GLOBAL_ONLY
);
471 Tcl_SetVar2(interp
, "sqlite_options", "lookaside", "1", TCL_GLOBAL_ONLY
);
474 Tcl_SetVar2(interp
, "sqlite_options", "long_double",
475 sizeof(LONGDOUBLE_TYPE
)>sizeof(double) ? "1" : "0",
478 #ifdef SQLITE_OMIT_MEMORYDB
479 Tcl_SetVar2(interp
, "sqlite_options", "memorydb", "0", TCL_GLOBAL_ONLY
);
481 Tcl_SetVar2(interp
, "sqlite_options", "memorydb", "1", TCL_GLOBAL_ONLY
);
484 #ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
485 Tcl_SetVar2(interp
, "sqlite_options", "memorymanage", "1", TCL_GLOBAL_ONLY
);
487 Tcl_SetVar2(interp
, "sqlite_options", "memorymanage", "0", TCL_GLOBAL_ONLY
);
490 Tcl_SetVar2(interp
, "sqlite_options", "mergesort", "1", TCL_GLOBAL_ONLY
);
492 #ifdef SQLITE_OMIT_OR_OPTIMIZATION
493 Tcl_SetVar2(interp
, "sqlite_options", "or_opt", "0", TCL_GLOBAL_ONLY
);
495 Tcl_SetVar2(interp
, "sqlite_options", "or_opt", "1", TCL_GLOBAL_ONLY
);
498 #ifdef SQLITE_ENABLE_RBU
499 Tcl_SetVar2(interp
, "sqlite_options", "rbu", "1", TCL_GLOBAL_ONLY
);
501 Tcl_SetVar2(interp
, "sqlite_options", "rbu", "0", TCL_GLOBAL_ONLY
);
504 #ifdef SQLITE_OMIT_PAGER_PRAGMAS
505 Tcl_SetVar2(interp
, "sqlite_options", "pager_pragmas", "0", TCL_GLOBAL_ONLY
);
507 Tcl_SetVar2(interp
, "sqlite_options", "pager_pragmas", "1", TCL_GLOBAL_ONLY
);
510 #if defined(SQLITE_OMIT_PRAGMA) || defined(SQLITE_OMIT_FLAG_PRAGMAS)
511 Tcl_SetVar2(interp
, "sqlite_options", "pragma", "0", TCL_GLOBAL_ONLY
);
512 Tcl_SetVar2(interp
, "sqlite_options", "integrityck", "0", TCL_GLOBAL_ONLY
);
514 Tcl_SetVar2(interp
, "sqlite_options", "pragma", "1", TCL_GLOBAL_ONLY
);
517 #ifdef SQLITE_OMIT_PROGRESS_CALLBACK
518 Tcl_SetVar2(interp
, "sqlite_options", "progress", "0", TCL_GLOBAL_ONLY
);
520 Tcl_SetVar2(interp
, "sqlite_options", "progress", "1", TCL_GLOBAL_ONLY
);
523 #ifdef SQLITE_OMIT_REINDEX
524 Tcl_SetVar2(interp
, "sqlite_options", "reindex", "0", TCL_GLOBAL_ONLY
);
526 Tcl_SetVar2(interp
, "sqlite_options", "reindex", "1", TCL_GLOBAL_ONLY
);
529 #ifdef SQLITE_ENABLE_RTREE
530 Tcl_SetVar2(interp
, "sqlite_options", "rtree", "1", TCL_GLOBAL_ONLY
);
532 Tcl_SetVar2(interp
, "sqlite_options", "rtree", "0", TCL_GLOBAL_ONLY
);
535 #ifdef SQLITE_RTREE_INT_ONLY
536 Tcl_SetVar2(interp
, "sqlite_options", "rtree_int_only", "1", TCL_GLOBAL_ONLY
);
538 Tcl_SetVar2(interp
, "sqlite_options", "rtree_int_only", "0", TCL_GLOBAL_ONLY
);
541 #ifdef SQLITE_OMIT_SCHEMA_PRAGMAS
542 Tcl_SetVar2(interp
, "sqlite_options", "schema_pragmas", "0", TCL_GLOBAL_ONLY
);
544 Tcl_SetVar2(interp
, "sqlite_options", "schema_pragmas", "1", TCL_GLOBAL_ONLY
);
547 #ifdef SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS
548 Tcl_SetVar2(interp
, "sqlite_options", "schema_version", "0", TCL_GLOBAL_ONLY
);
550 Tcl_SetVar2(interp
, "sqlite_options", "schema_version", "1", TCL_GLOBAL_ONLY
);
553 #ifdef SQLITE_ENABLE_SESSION
554 Tcl_SetVar2(interp
, "sqlite_options", "session", "1", TCL_GLOBAL_ONLY
);
556 Tcl_SetVar2(interp
, "sqlite_options", "session", "0", TCL_GLOBAL_ONLY
);
559 #ifdef SQLITE_ENABLE_STAT4
560 Tcl_SetVar2(interp
, "sqlite_options", "stat4", "1", TCL_GLOBAL_ONLY
);
562 Tcl_SetVar2(interp
, "sqlite_options", "stat4", "0", TCL_GLOBAL_ONLY
);
564 #if defined(SQLITE_ENABLE_STAT3) && !defined(SQLITE_ENABLE_STAT4)
565 Tcl_SetVar2(interp
, "sqlite_options", "stat3", "1", TCL_GLOBAL_ONLY
);
567 Tcl_SetVar2(interp
, "sqlite_options", "stat3", "0", TCL_GLOBAL_ONLY
);
570 #if defined(SQLITE_ENABLE_STMTVTAB) && !defined(SQLITE_OMIT_VIRTUALTABLE)
571 Tcl_SetVar2(interp
, "sqlite_options", "stmtvtab", "1", TCL_GLOBAL_ONLY
);
573 Tcl_SetVar2(interp
, "sqlite_options", "stmtvtab", "0", TCL_GLOBAL_ONLY
);
576 #ifdef SQLITE_ENABLE_STMT_SCANSTATUS
577 Tcl_SetVar2(interp
, "sqlite_options", "scanstatus", "1", TCL_GLOBAL_ONLY
);
579 Tcl_SetVar2(interp
, "sqlite_options", "scanstatus", "0", TCL_GLOBAL_ONLY
);
582 #if !defined(SQLITE_ENABLE_LOCKING_STYLE)
583 # if defined(__APPLE__)
584 # define SQLITE_ENABLE_LOCKING_STYLE 1
586 # define SQLITE_ENABLE_LOCKING_STYLE 0
589 #if SQLITE_ENABLE_LOCKING_STYLE && defined(__APPLE__)
590 Tcl_SetVar2(interp
,"sqlite_options","lock_proxy_pragmas","1",TCL_GLOBAL_ONLY
);
592 Tcl_SetVar2(interp
,"sqlite_options","lock_proxy_pragmas","0",TCL_GLOBAL_ONLY
);
594 #if defined(SQLITE_PREFER_PROXY_LOCKING) && defined(__APPLE__)
595 Tcl_SetVar2(interp
,"sqlite_options","prefer_proxy_locking","1",TCL_GLOBAL_ONLY
);
597 Tcl_SetVar2(interp
,"sqlite_options","prefer_proxy_locking","0",TCL_GLOBAL_ONLY
);
601 #ifdef SQLITE_OMIT_SHARED_CACHE
602 Tcl_SetVar2(interp
, "sqlite_options", "shared_cache", "0", TCL_GLOBAL_ONLY
);
604 Tcl_SetVar2(interp
, "sqlite_options", "shared_cache", "1", TCL_GLOBAL_ONLY
);
607 #ifdef SQLITE_OMIT_SUBQUERY
608 Tcl_SetVar2(interp
, "sqlite_options", "subquery", "0", TCL_GLOBAL_ONLY
);
610 Tcl_SetVar2(interp
, "sqlite_options", "subquery", "1", TCL_GLOBAL_ONLY
);
613 #ifdef SQLITE_OMIT_TCL_VARIABLE
614 Tcl_SetVar2(interp
, "sqlite_options", "tclvar", "0", TCL_GLOBAL_ONLY
);
616 Tcl_SetVar2(interp
, "sqlite_options", "tclvar", "1", TCL_GLOBAL_ONLY
);
619 Tcl_SetVar2(interp
, "sqlite_options", "threadsafe",
620 SQLITE_THREADSAFE
? "1" : "0", TCL_GLOBAL_ONLY
);
621 Tcl_SetVar2(interp
, "sqlite_options", "threadsafe1",
622 SQLITE_THREADSAFE
==1 ? "1" : "0", TCL_GLOBAL_ONLY
);
623 Tcl_SetVar2(interp
, "sqlite_options", "threadsafe2",
624 SQLITE_THREADSAFE
==2 ? "1" : "0", TCL_GLOBAL_ONLY
);
625 assert( sqlite3_threadsafe()==SQLITE_THREADSAFE
);
627 #ifdef SQLITE_OMIT_TEMPDB
628 Tcl_SetVar2(interp
, "sqlite_options", "tempdb", "0", TCL_GLOBAL_ONLY
);
630 Tcl_SetVar2(interp
, "sqlite_options", "tempdb", "1", TCL_GLOBAL_ONLY
);
633 #ifdef SQLITE_OMIT_TRACE
634 Tcl_SetVar2(interp
, "sqlite_options", "trace", "0", TCL_GLOBAL_ONLY
);
636 Tcl_SetVar2(interp
, "sqlite_options", "trace", "1", TCL_GLOBAL_ONLY
);
639 #ifdef SQLITE_OMIT_TRIGGER
640 Tcl_SetVar2(interp
, "sqlite_options", "trigger", "0", TCL_GLOBAL_ONLY
);
642 Tcl_SetVar2(interp
, "sqlite_options", "trigger", "1", TCL_GLOBAL_ONLY
);
645 #ifdef SQLITE_OMIT_TRUNCATE_OPTIMIZATION
646 Tcl_SetVar2(interp
, "sqlite_options", "truncate_opt", "0", TCL_GLOBAL_ONLY
);
648 Tcl_SetVar2(interp
, "sqlite_options", "truncate_opt", "1", TCL_GLOBAL_ONLY
);
651 #ifdef SQLITE_OMIT_UTF16
652 Tcl_SetVar2(interp
, "sqlite_options", "utf16", "0", TCL_GLOBAL_ONLY
);
654 Tcl_SetVar2(interp
, "sqlite_options", "utf16", "1", TCL_GLOBAL_ONLY
);
657 #if defined(SQLITE_OMIT_VACUUM) || defined(SQLITE_OMIT_ATTACH)
658 Tcl_SetVar2(interp
, "sqlite_options", "vacuum", "0", TCL_GLOBAL_ONLY
);
660 Tcl_SetVar2(interp
, "sqlite_options", "vacuum", "1", TCL_GLOBAL_ONLY
);
663 #ifdef SQLITE_OMIT_VIEW
664 Tcl_SetVar2(interp
, "sqlite_options", "view", "0", TCL_GLOBAL_ONLY
);
666 Tcl_SetVar2(interp
, "sqlite_options", "view", "1", TCL_GLOBAL_ONLY
);
669 #ifdef SQLITE_OMIT_VIRTUALTABLE
670 Tcl_SetVar2(interp
, "sqlite_options", "vtab", "0", TCL_GLOBAL_ONLY
);
672 Tcl_SetVar2(interp
, "sqlite_options", "vtab", "1", TCL_GLOBAL_ONLY
);
675 #ifdef SQLITE_OMIT_WAL
676 Tcl_SetVar2(interp
, "sqlite_options", "wal", "0", TCL_GLOBAL_ONLY
);
678 Tcl_SetVar2(interp
, "sqlite_options", "wal", "1", TCL_GLOBAL_ONLY
);
681 #ifdef SQLITE_OMIT_WSD
682 Tcl_SetVar2(interp
, "sqlite_options", "wsd", "0", TCL_GLOBAL_ONLY
);
684 Tcl_SetVar2(interp
, "sqlite_options", "wsd", "1", TCL_GLOBAL_ONLY
);
687 #if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY)
688 Tcl_SetVar2(interp
, "sqlite_options", "update_delete_limit", "1", TCL_GLOBAL_ONLY
);
690 Tcl_SetVar2(interp
, "sqlite_options", "update_delete_limit", "0", TCL_GLOBAL_ONLY
);
693 #if defined(SQLITE_ENABLE_UNLOCK_NOTIFY)
694 Tcl_SetVar2(interp
, "sqlite_options", "unlock_notify", "1", TCL_GLOBAL_ONLY
);
696 Tcl_SetVar2(interp
, "sqlite_options", "unlock_notify", "0", TCL_GLOBAL_ONLY
);
699 #ifdef SQLITE_SECURE_DELETE
700 Tcl_SetVar2(interp
, "sqlite_options", "secure_delete", "1", TCL_GLOBAL_ONLY
);
702 Tcl_SetVar2(interp
, "sqlite_options", "secure_delete", "0", TCL_GLOBAL_ONLY
);
705 #ifdef SQLITE_USER_AUTHENTICATION
706 Tcl_SetVar2(interp
, "sqlite_options", "userauth", "1", TCL_GLOBAL_ONLY
);
708 Tcl_SetVar2(interp
, "sqlite_options", "userauth", "0", TCL_GLOBAL_ONLY
);
711 #ifdef SQLITE_MULTIPLEX_EXT_OVWR
712 Tcl_SetVar2(interp
, "sqlite_options", "multiplex_ext_overwrite", "1", TCL_GLOBAL_ONLY
);
714 Tcl_SetVar2(interp
, "sqlite_options", "multiplex_ext_overwrite", "0", TCL_GLOBAL_ONLY
);
717 #ifdef YYTRACKMAXSTACKDEPTH
718 Tcl_SetVar2(interp
, "sqlite_options", "yytrackmaxstackdepth", "1", TCL_GLOBAL_ONLY
);
720 Tcl_SetVar2(interp
, "sqlite_options", "yytrackmaxstackdepth", "0", TCL_GLOBAL_ONLY
);
723 #ifdef SQLITE_ENABLE_SQLLOG
724 Tcl_SetVar2(interp
, "sqlite_options", "sqllog", "1", TCL_GLOBAL_ONLY
);
726 Tcl_SetVar2(interp
, "sqlite_options", "sqllog", "0", TCL_GLOBAL_ONLY
);
729 #ifdef SQLITE_ENABLE_URI_00_ERROR
730 Tcl_SetVar2(interp
, "sqlite_options", "uri_00_error", "1", TCL_GLOBAL_ONLY
);
732 Tcl_SetVar2(interp
, "sqlite_options", "uri_00_error", "0", TCL_GLOBAL_ONLY
);
735 #define LINKVAR(x) { \
736 static const int cv_ ## x = SQLITE_ ## x; \
737 Tcl_LinkVar(interp, "SQLITE_" #x, (char *)&(cv_ ## x), \
738 TCL_LINK_INT | TCL_LINK_READ_ONLY); }
740 LINKVAR( MAX_LENGTH
);
741 LINKVAR( MAX_COLUMN
);
742 LINKVAR( MAX_SQL_LENGTH
);
743 LINKVAR( MAX_EXPR_DEPTH
);
744 LINKVAR( MAX_COMPOUND_SELECT
);
745 LINKVAR( MAX_VDBE_OP
);
746 LINKVAR( MAX_FUNCTION_ARG
);
747 LINKVAR( MAX_VARIABLE_NUMBER
);
748 LINKVAR( MAX_PAGE_SIZE
);
749 LINKVAR( MAX_PAGE_COUNT
);
750 LINKVAR( MAX_LIKE_PATTERN_LENGTH
);
751 LINKVAR( MAX_TRIGGER_DEPTH
);
752 LINKVAR( DEFAULT_CACHE_SIZE
);
753 LINKVAR( DEFAULT_PAGE_SIZE
);
754 LINKVAR( DEFAULT_FILE_FORMAT
);
755 LINKVAR( DEFAULT_SYNCHRONOUS
);
756 LINKVAR( DEFAULT_WAL_SYNCHRONOUS
);
757 LINKVAR( MAX_ATTACHED
);
758 LINKVAR( MAX_DEFAULT_PAGE_SIZE
);
759 LINKVAR( MAX_WORKER_THREADS
);
762 static const int cv_TEMP_STORE
= SQLITE_TEMP_STORE
;
763 Tcl_LinkVar(interp
, "TEMP_STORE", (char *)&(cv_TEMP_STORE
),
764 TCL_LINK_INT
| TCL_LINK_READ_ONLY
);
769 static const int cv__MSC_VER
= 1;
770 Tcl_LinkVar(interp
, "_MSC_VER", (char *)&(cv__MSC_VER
),
771 TCL_LINK_INT
| TCL_LINK_READ_ONLY
);
776 static const int cv___GNUC__
= 1;
777 Tcl_LinkVar(interp
, "__GNUC__", (char *)&(cv___GNUC__
),
778 TCL_LINK_INT
| TCL_LINK_READ_ONLY
);
785 ** Register commands with the TCL interpreter.
787 int Sqliteconfig_Init(Tcl_Interp
*interp
){