Fix harmless compiler warnings.
[sqlite.git] / src / test_config.c
blob193f95edf9498f48b2398b1109f516c324fb63b7
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 #if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT
69 Tcl_SetVar2(interp, "sqlite_options", "curdir", "1", TCL_GLOBAL_ONLY);
70 #else
71 Tcl_SetVar2(interp, "sqlite_options", "curdir", "0", TCL_GLOBAL_ONLY);
72 #endif
74 #ifdef SQLITE_WIN32_MALLOC
75 Tcl_SetVar2(interp, "sqlite_options", "win32malloc", "1", TCL_GLOBAL_ONLY);
76 #else
77 Tcl_SetVar2(interp, "sqlite_options", "win32malloc", "0", TCL_GLOBAL_ONLY);
78 #endif
80 #ifdef SQLITE_DEBUG
81 Tcl_SetVar2(interp, "sqlite_options", "debug", "1", TCL_GLOBAL_ONLY);
82 #else
83 Tcl_SetVar2(interp, "sqlite_options", "debug", "0", TCL_GLOBAL_ONLY);
84 #endif
86 #ifdef SQLITE_DEFAULT_CKPTFULLFSYNC
87 Tcl_SetVar2(interp, "sqlite_options", "default_ckptfullfsync",
88 SQLITE_DEFAULT_CKPTFULLFSYNC ? "1" : "0", TCL_GLOBAL_ONLY);
89 #else
90 Tcl_SetVar2(interp, "sqlite_options", "default_ckptfullfsync", "0", TCL_GLOBAL_ONLY);
91 #endif
93 #ifdef SQLITE_DIRECT_OVERFLOW_READ
94 Tcl_SetVar2(interp, "sqlite_options", "direct_read", "1", TCL_GLOBAL_ONLY);
95 #else
96 Tcl_SetVar2(interp, "sqlite_options", "direct_read", "0", TCL_GLOBAL_ONLY);
97 #endif
99 #ifdef SQLITE_DISABLE_DIRSYNC
100 Tcl_SetVar2(interp, "sqlite_options", "dirsync", "0", TCL_GLOBAL_ONLY);
101 #else
102 Tcl_SetVar2(interp, "sqlite_options", "dirsync", "1", TCL_GLOBAL_ONLY);
103 #endif
105 #ifdef SQLITE_DISABLE_LFS
106 Tcl_SetVar2(interp, "sqlite_options", "lfs", "0", TCL_GLOBAL_ONLY);
107 #else
108 Tcl_SetVar2(interp, "sqlite_options", "lfs", "1", TCL_GLOBAL_ONLY);
109 #endif
111 #ifdef SQLITE_DISABLE_PAGECACHE_OVERFLOW_STATS
112 Tcl_SetVar2(interp, "sqlite_options", "pagecache_overflow_stats","0",TCL_GLOBAL_ONLY);
113 #else
114 Tcl_SetVar2(interp, "sqlite_options", "pagecache_overflow_stats","1",TCL_GLOBAL_ONLY);
115 #endif
117 #if SQLITE_MAX_MMAP_SIZE>0
118 Tcl_SetVar2(interp, "sqlite_options", "mmap", "1", TCL_GLOBAL_ONLY);
119 #else
120 Tcl_SetVar2(interp, "sqlite_options", "mmap", "0", TCL_GLOBAL_ONLY);
121 #endif
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);
129 #else
130 Tcl_SetVar2(interp, "sqlite_options", "memdebug", "0", TCL_GLOBAL_ONLY);
131 #endif
133 #ifdef SQLITE_ENABLE_8_3_NAMES
134 Tcl_SetVar2(interp, "sqlite_options", "8_3_names", "1", TCL_GLOBAL_ONLY);
135 #else
136 Tcl_SetVar2(interp, "sqlite_options", "8_3_names", "0", TCL_GLOBAL_ONLY);
137 #endif
139 #ifdef SQLITE_ENABLE_CURSOR_HINTS
140 Tcl_SetVar2(interp, "sqlite_options", "cursorhints", "1", TCL_GLOBAL_ONLY);
141 #else
142 Tcl_SetVar2(interp, "sqlite_options", "cursorhints", "0", TCL_GLOBAL_ONLY);
143 #endif
145 #ifdef SQLITE_ENABLE_HIDDEN_COLUMNS
146 Tcl_SetVar2(interp, "sqlite_options", "hiddencolumns", "1", TCL_GLOBAL_ONLY);
147 #else
148 Tcl_SetVar2(interp, "sqlite_options", "hiddencolumns", "0", TCL_GLOBAL_ONLY);
149 #endif
151 #ifdef SQLITE_ENABLE_MEMSYS3
152 Tcl_SetVar2(interp, "sqlite_options", "mem3", "1", TCL_GLOBAL_ONLY);
153 #else
154 Tcl_SetVar2(interp, "sqlite_options", "mem3", "0", TCL_GLOBAL_ONLY);
155 #endif
157 #ifdef SQLITE_ENABLE_MEMSYS5
158 Tcl_SetVar2(interp, "sqlite_options", "mem5", "1", TCL_GLOBAL_ONLY);
159 #else
160 Tcl_SetVar2(interp, "sqlite_options", "mem5", "0", TCL_GLOBAL_ONLY);
161 #endif
163 #ifdef SQLITE_ENABLE_PREUPDATE_HOOK
164 Tcl_SetVar2(interp, "sqlite_options", "preupdate", "1", TCL_GLOBAL_ONLY);
165 #else
166 Tcl_SetVar2(interp, "sqlite_options", "preupdate", "0", TCL_GLOBAL_ONLY);
167 #endif
169 #ifdef SQLITE_ENABLE_SNAPSHOT
170 Tcl_SetVar2(interp, "sqlite_options", "snapshot", "1", TCL_GLOBAL_ONLY);
171 #else
172 Tcl_SetVar2(interp, "sqlite_options", "snapshot", "0", TCL_GLOBAL_ONLY);
173 #endif
175 #ifdef SQLITE_MUTEX_OMIT
176 Tcl_SetVar2(interp, "sqlite_options", "mutex", "0", TCL_GLOBAL_ONLY);
177 #else
178 Tcl_SetVar2(interp, "sqlite_options", "mutex", "1", TCL_GLOBAL_ONLY);
179 #endif
181 #ifdef SQLITE_MUTEX_NOOP
182 Tcl_SetVar2(interp, "sqlite_options", "mutex_noop", "1", TCL_GLOBAL_ONLY);
183 #else
184 Tcl_SetVar2(interp, "sqlite_options", "mutex_noop", "0", TCL_GLOBAL_ONLY);
185 #endif
187 #ifdef SQLITE_OMIT_ALTERTABLE
188 Tcl_SetVar2(interp, "sqlite_options", "altertable", "0", TCL_GLOBAL_ONLY);
189 #else
190 Tcl_SetVar2(interp, "sqlite_options", "altertable", "1", TCL_GLOBAL_ONLY);
191 #endif
193 #ifdef SQLITE_OMIT_ANALYZE
194 Tcl_SetVar2(interp, "sqlite_options", "analyze", "0", TCL_GLOBAL_ONLY);
195 #else
196 Tcl_SetVar2(interp, "sqlite_options", "analyze", "1", TCL_GLOBAL_ONLY);
197 #endif
199 #ifdef SQLITE_ENABLE_API_ARMOR
200 Tcl_SetVar2(interp, "sqlite_options", "api_armor", "1", TCL_GLOBAL_ONLY);
201 #else
202 Tcl_SetVar2(interp, "sqlite_options", "api_armor", "0", TCL_GLOBAL_ONLY);
203 #endif
205 #ifdef SQLITE_ENABLE_ATOMIC_WRITE
206 Tcl_SetVar2(interp, "sqlite_options", "atomicwrite", "1", TCL_GLOBAL_ONLY);
207 #else
208 Tcl_SetVar2(interp, "sqlite_options", "atomicwrite", "0", TCL_GLOBAL_ONLY);
209 #endif
211 #ifdef SQLITE_ENABLE_JSON1
212 Tcl_SetVar2(interp, "sqlite_options", "json1", "1", TCL_GLOBAL_ONLY);
213 #else
214 Tcl_SetVar2(interp, "sqlite_options", "json1", "0", TCL_GLOBAL_ONLY);
215 #endif
217 #ifdef SQLITE_HAS_CODEC
218 Tcl_SetVar2(interp, "sqlite_options", "has_codec", "1", TCL_GLOBAL_ONLY);
219 #else
220 Tcl_SetVar2(interp, "sqlite_options", "has_codec", "0", TCL_GLOBAL_ONLY);
221 #endif
223 #ifdef SQLITE_LIKE_DOESNT_MATCH_BLOBS
224 Tcl_SetVar2(interp, "sqlite_options", "like_match_blobs", "0", TCL_GLOBAL_ONLY);
225 #else
226 Tcl_SetVar2(interp, "sqlite_options", "like_match_blobs", "1", TCL_GLOBAL_ONLY);
227 #endif
229 #ifdef SQLITE_OMIT_ATTACH
230 Tcl_SetVar2(interp, "sqlite_options", "attach", "0", TCL_GLOBAL_ONLY);
231 #else
232 Tcl_SetVar2(interp, "sqlite_options", "attach", "1", TCL_GLOBAL_ONLY);
233 #endif
235 #ifdef SQLITE_OMIT_AUTHORIZATION
236 Tcl_SetVar2(interp, "sqlite_options", "auth", "0", TCL_GLOBAL_ONLY);
237 #else
238 Tcl_SetVar2(interp, "sqlite_options", "auth", "1", TCL_GLOBAL_ONLY);
239 #endif
241 #ifdef SQLITE_OMIT_AUTOINCREMENT
242 Tcl_SetVar2(interp, "sqlite_options", "autoinc", "0", TCL_GLOBAL_ONLY);
243 #else
244 Tcl_SetVar2(interp, "sqlite_options", "autoinc", "1", TCL_GLOBAL_ONLY);
245 #endif
247 #ifdef SQLITE_OMIT_AUTOMATIC_INDEX
248 Tcl_SetVar2(interp, "sqlite_options", "autoindex", "0", TCL_GLOBAL_ONLY);
249 #else
250 Tcl_SetVar2(interp, "sqlite_options", "autoindex", "1", TCL_GLOBAL_ONLY);
251 #endif
253 #ifdef SQLITE_OMIT_AUTORESET
254 Tcl_SetVar2(interp, "sqlite_options", "autoreset", "0", TCL_GLOBAL_ONLY);
255 #else
256 Tcl_SetVar2(interp, "sqlite_options", "autoreset", "1", TCL_GLOBAL_ONLY);
257 #endif
259 #ifdef SQLITE_OMIT_AUTOVACUUM
260 Tcl_SetVar2(interp, "sqlite_options", "autovacuum", "0", TCL_GLOBAL_ONLY);
261 #else
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);
266 #else
267 Tcl_SetVar2(interp, "sqlite_options", "default_autovacuum",
268 STRINGVALUE(SQLITE_DEFAULT_AUTOVACUUM), TCL_GLOBAL_ONLY);
269 #endif
271 #ifdef SQLITE_OMIT_BETWEEN_OPTIMIZATION
272 Tcl_SetVar2(interp, "sqlite_options", "between_opt", "0", TCL_GLOBAL_ONLY);
273 #else
274 Tcl_SetVar2(interp, "sqlite_options", "between_opt", "1", TCL_GLOBAL_ONLY);
275 #endif
277 #ifdef SQLITE_UNTESTABLE
278 Tcl_SetVar2(interp, "sqlite_options", "builtin_test", "0", TCL_GLOBAL_ONLY);
279 #else
280 Tcl_SetVar2(interp, "sqlite_options", "builtin_test", "1", TCL_GLOBAL_ONLY);
281 #endif
283 #ifdef SQLITE_OMIT_BLOB_LITERAL
284 Tcl_SetVar2(interp, "sqlite_options", "bloblit", "0", TCL_GLOBAL_ONLY);
285 #else
286 Tcl_SetVar2(interp, "sqlite_options", "bloblit", "1", TCL_GLOBAL_ONLY);
287 #endif
289 #ifdef SQLITE_OMIT_CAST
290 Tcl_SetVar2(interp, "sqlite_options", "cast", "0", TCL_GLOBAL_ONLY);
291 #else
292 Tcl_SetVar2(interp, "sqlite_options", "cast", "1", TCL_GLOBAL_ONLY);
293 #endif
295 #ifdef SQLITE_OMIT_CHECK
296 Tcl_SetVar2(interp, "sqlite_options", "check", "0", TCL_GLOBAL_ONLY);
297 #else
298 Tcl_SetVar2(interp, "sqlite_options", "check", "1", TCL_GLOBAL_ONLY);
299 #endif
301 #ifdef SQLITE_OMIT_CTE
302 Tcl_SetVar2(interp, "sqlite_options", "cte", "0", TCL_GLOBAL_ONLY);
303 #else
304 Tcl_SetVar2(interp, "sqlite_options", "cte", "1", TCL_GLOBAL_ONLY);
305 #endif
307 #ifdef SQLITE_ENABLE_COLUMN_METADATA
308 Tcl_SetVar2(interp, "sqlite_options", "columnmetadata", "1", TCL_GLOBAL_ONLY);
309 #else
310 Tcl_SetVar2(interp, "sqlite_options", "columnmetadata", "0", TCL_GLOBAL_ONLY);
311 #endif
313 #ifdef SQLITE_ENABLE_OVERSIZE_CELL_CHECK
314 Tcl_SetVar2(interp, "sqlite_options", "oversize_cell_check", "1",
315 TCL_GLOBAL_ONLY);
316 #else
317 Tcl_SetVar2(interp, "sqlite_options", "oversize_cell_check", "0",
318 TCL_GLOBAL_ONLY);
319 #endif
321 #ifdef SQLITE_OMIT_COMPILEOPTION_DIAGS
322 Tcl_SetVar2(interp, "sqlite_options", "compileoption_diags", "0", TCL_GLOBAL_ONLY);
323 #else
324 Tcl_SetVar2(interp, "sqlite_options", "compileoption_diags", "1", TCL_GLOBAL_ONLY);
325 #endif
327 #ifdef SQLITE_OMIT_COMPLETE
328 Tcl_SetVar2(interp, "sqlite_options", "complete", "0", TCL_GLOBAL_ONLY);
329 #else
330 Tcl_SetVar2(interp, "sqlite_options", "complete", "1", TCL_GLOBAL_ONLY);
331 #endif
333 #ifdef SQLITE_OMIT_COMPOUND_SELECT
334 Tcl_SetVar2(interp, "sqlite_options", "compound", "0", TCL_GLOBAL_ONLY);
335 #else
336 Tcl_SetVar2(interp, "sqlite_options", "compound", "1", TCL_GLOBAL_ONLY);
337 #endif
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);
344 #else
345 Tcl_SetVar2(interp, "sqlite_options", "datetime", "1", TCL_GLOBAL_ONLY);
346 #endif
348 #ifdef SQLITE_OMIT_DECLTYPE
349 Tcl_SetVar2(interp, "sqlite_options", "decltype", "0", TCL_GLOBAL_ONLY);
350 #else
351 Tcl_SetVar2(interp, "sqlite_options", "decltype", "1", TCL_GLOBAL_ONLY);
352 #endif
354 #ifdef SQLITE_OMIT_DEPRECATED
355 Tcl_SetVar2(interp, "sqlite_options", "deprecated", "0", TCL_GLOBAL_ONLY);
356 #else
357 Tcl_SetVar2(interp, "sqlite_options", "deprecated", "1", TCL_GLOBAL_ONLY);
358 #endif
360 #ifdef SQLITE_OMIT_DISKIO
361 Tcl_SetVar2(interp, "sqlite_options", "diskio", "0", TCL_GLOBAL_ONLY);
362 #else
363 Tcl_SetVar2(interp, "sqlite_options", "diskio", "1", TCL_GLOBAL_ONLY);
364 #endif
366 #ifdef SQLITE_OMIT_EXPLAIN
367 Tcl_SetVar2(interp, "sqlite_options", "explain", "0", TCL_GLOBAL_ONLY);
368 #else
369 Tcl_SetVar2(interp, "sqlite_options", "explain", "1", TCL_GLOBAL_ONLY);
370 #endif
372 #ifdef SQLITE_OMIT_FLOATING_POINT
373 Tcl_SetVar2(interp, "sqlite_options", "floatingpoint", "0", TCL_GLOBAL_ONLY);
374 #else
375 Tcl_SetVar2(interp, "sqlite_options", "floatingpoint", "1", TCL_GLOBAL_ONLY);
376 #endif
378 #ifdef SQLITE_OMIT_FOREIGN_KEY
379 Tcl_SetVar2(interp, "sqlite_options", "foreignkey", "0", TCL_GLOBAL_ONLY);
380 #else
381 Tcl_SetVar2(interp, "sqlite_options", "foreignkey", "1", TCL_GLOBAL_ONLY);
382 #endif
384 #ifdef SQLITE_ENABLE_FTS1
385 Tcl_SetVar2(interp, "sqlite_options", "fts1", "1", TCL_GLOBAL_ONLY);
386 #else
387 Tcl_SetVar2(interp, "sqlite_options", "fts1", "0", TCL_GLOBAL_ONLY);
388 #endif
390 #ifdef SQLITE_ENABLE_FTS2
391 Tcl_SetVar2(interp, "sqlite_options", "fts2", "1", TCL_GLOBAL_ONLY);
392 #else
393 Tcl_SetVar2(interp, "sqlite_options", "fts2", "0", TCL_GLOBAL_ONLY);
394 #endif
396 #ifdef SQLITE_ENABLE_FTS3
397 Tcl_SetVar2(interp, "sqlite_options", "fts3", "1", TCL_GLOBAL_ONLY);
398 #else
399 Tcl_SetVar2(interp, "sqlite_options", "fts3", "0", TCL_GLOBAL_ONLY);
400 #endif
402 #ifdef SQLITE_ENABLE_FTS5
403 Tcl_SetVar2(interp, "sqlite_options", "fts5", "1", TCL_GLOBAL_ONLY);
404 #else
405 Tcl_SetVar2(interp, "sqlite_options", "fts5", "0", TCL_GLOBAL_ONLY);
406 #endif
408 #if defined(SQLITE_ENABLE_FTS3) && !defined(SQLITE_DISABLE_FTS3_UNICODE)
409 Tcl_SetVar2(interp, "sqlite_options", "fts3_unicode", "1", TCL_GLOBAL_ONLY);
410 #else
411 Tcl_SetVar2(interp, "sqlite_options", "fts3_unicode", "0", TCL_GLOBAL_ONLY);
412 #endif
414 #ifdef SQLITE_DISABLE_FTS4_DEFERRED
415 Tcl_SetVar2(interp, "sqlite_options", "fts4_deferred", "0", TCL_GLOBAL_ONLY);
416 #else
417 Tcl_SetVar2(interp, "sqlite_options", "fts4_deferred", "1", TCL_GLOBAL_ONLY);
418 #endif
420 #ifdef SQLITE_OMIT_GET_TABLE
421 Tcl_SetVar2(interp, "sqlite_options", "gettable", "0", TCL_GLOBAL_ONLY);
422 #else
423 Tcl_SetVar2(interp, "sqlite_options", "gettable", "1", TCL_GLOBAL_ONLY);
424 #endif
426 #ifdef SQLITE_ENABLE_ICU
427 Tcl_SetVar2(interp, "sqlite_options", "icu", "1", TCL_GLOBAL_ONLY);
428 #else
429 Tcl_SetVar2(interp, "sqlite_options", "icu", "0", TCL_GLOBAL_ONLY);
430 #endif
432 #ifdef SQLITE_OMIT_INCRBLOB
433 Tcl_SetVar2(interp, "sqlite_options", "incrblob", "0", TCL_GLOBAL_ONLY);
434 #else
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);
440 #else
441 Tcl_SetVar2(interp, "sqlite_options", "integrityck", "1", TCL_GLOBAL_ONLY);
442 #endif
444 #if defined(SQLITE_DEFAULT_FILE_FORMAT) && SQLITE_DEFAULT_FILE_FORMAT==1
445 Tcl_SetVar2(interp, "sqlite_options", "legacyformat", "1", TCL_GLOBAL_ONLY);
446 #else
447 Tcl_SetVar2(interp, "sqlite_options", "legacyformat", "0", TCL_GLOBAL_ONLY);
448 #endif
450 #ifdef SQLITE_OMIT_LIKE_OPTIMIZATION
451 Tcl_SetVar2(interp, "sqlite_options", "like_opt", "0", TCL_GLOBAL_ONLY);
452 #else
453 Tcl_SetVar2(interp, "sqlite_options", "like_opt", "1", TCL_GLOBAL_ONLY);
454 #endif
456 #ifdef SQLITE_OMIT_LOAD_EXTENSION
457 Tcl_SetVar2(interp, "sqlite_options", "load_ext", "0", TCL_GLOBAL_ONLY);
458 #else
459 Tcl_SetVar2(interp, "sqlite_options", "load_ext", "1", TCL_GLOBAL_ONLY);
460 #endif
462 #ifdef SQLITE_OMIT_LOCALTIME
463 Tcl_SetVar2(interp, "sqlite_options", "localtime", "0", TCL_GLOBAL_ONLY);
464 #else
465 Tcl_SetVar2(interp, "sqlite_options", "localtime", "1", TCL_GLOBAL_ONLY);
466 #endif
468 #ifdef SQLITE_OMIT_LOOKASIDE
469 Tcl_SetVar2(interp, "sqlite_options", "lookaside", "0", TCL_GLOBAL_ONLY);
470 #else
471 Tcl_SetVar2(interp, "sqlite_options", "lookaside", "1", TCL_GLOBAL_ONLY);
472 #endif
474 Tcl_SetVar2(interp, "sqlite_options", "long_double",
475 sizeof(LONGDOUBLE_TYPE)>sizeof(double) ? "1" : "0",
476 TCL_GLOBAL_ONLY);
478 #ifdef SQLITE_OMIT_MEMORYDB
479 Tcl_SetVar2(interp, "sqlite_options", "memorydb", "0", TCL_GLOBAL_ONLY);
480 #else
481 Tcl_SetVar2(interp, "sqlite_options", "memorydb", "1", TCL_GLOBAL_ONLY);
482 #endif
484 #ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
485 Tcl_SetVar2(interp, "sqlite_options", "memorymanage", "1", TCL_GLOBAL_ONLY);
486 #else
487 Tcl_SetVar2(interp, "sqlite_options", "memorymanage", "0", TCL_GLOBAL_ONLY);
488 #endif
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);
494 #else
495 Tcl_SetVar2(interp, "sqlite_options", "or_opt", "1", TCL_GLOBAL_ONLY);
496 #endif
498 #ifdef SQLITE_ENABLE_RBU
499 Tcl_SetVar2(interp, "sqlite_options", "rbu", "1", TCL_GLOBAL_ONLY);
500 #else
501 Tcl_SetVar2(interp, "sqlite_options", "rbu", "0", TCL_GLOBAL_ONLY);
502 #endif
504 #ifdef SQLITE_OMIT_PAGER_PRAGMAS
505 Tcl_SetVar2(interp, "sqlite_options", "pager_pragmas", "0", TCL_GLOBAL_ONLY);
506 #else
507 Tcl_SetVar2(interp, "sqlite_options", "pager_pragmas", "1", TCL_GLOBAL_ONLY);
508 #endif
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);
513 #else
514 Tcl_SetVar2(interp, "sqlite_options", "pragma", "1", TCL_GLOBAL_ONLY);
515 #endif
517 #ifdef SQLITE_OMIT_PROGRESS_CALLBACK
518 Tcl_SetVar2(interp, "sqlite_options", "progress", "0", TCL_GLOBAL_ONLY);
519 #else
520 Tcl_SetVar2(interp, "sqlite_options", "progress", "1", TCL_GLOBAL_ONLY);
521 #endif
523 #ifdef SQLITE_OMIT_REINDEX
524 Tcl_SetVar2(interp, "sqlite_options", "reindex", "0", TCL_GLOBAL_ONLY);
525 #else
526 Tcl_SetVar2(interp, "sqlite_options", "reindex", "1", TCL_GLOBAL_ONLY);
527 #endif
529 #ifdef SQLITE_ENABLE_RTREE
530 Tcl_SetVar2(interp, "sqlite_options", "rtree", "1", TCL_GLOBAL_ONLY);
531 #else
532 Tcl_SetVar2(interp, "sqlite_options", "rtree", "0", TCL_GLOBAL_ONLY);
533 #endif
535 #ifdef SQLITE_RTREE_INT_ONLY
536 Tcl_SetVar2(interp, "sqlite_options", "rtree_int_only", "1", TCL_GLOBAL_ONLY);
537 #else
538 Tcl_SetVar2(interp, "sqlite_options", "rtree_int_only", "0", TCL_GLOBAL_ONLY);
539 #endif
541 #ifdef SQLITE_OMIT_SCHEMA_PRAGMAS
542 Tcl_SetVar2(interp, "sqlite_options", "schema_pragmas", "0", TCL_GLOBAL_ONLY);
543 #else
544 Tcl_SetVar2(interp, "sqlite_options", "schema_pragmas", "1", TCL_GLOBAL_ONLY);
545 #endif
547 #ifdef SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS
548 Tcl_SetVar2(interp, "sqlite_options", "schema_version", "0", TCL_GLOBAL_ONLY);
549 #else
550 Tcl_SetVar2(interp, "sqlite_options", "schema_version", "1", TCL_GLOBAL_ONLY);
551 #endif
553 #ifdef SQLITE_ENABLE_SESSION
554 Tcl_SetVar2(interp, "sqlite_options", "session", "1", TCL_GLOBAL_ONLY);
555 #else
556 Tcl_SetVar2(interp, "sqlite_options", "session", "0", TCL_GLOBAL_ONLY);
557 #endif
559 #ifdef SQLITE_ENABLE_STAT4
560 Tcl_SetVar2(interp, "sqlite_options", "stat4", "1", TCL_GLOBAL_ONLY);
561 #else
562 Tcl_SetVar2(interp, "sqlite_options", "stat4", "0", TCL_GLOBAL_ONLY);
563 #endif
564 #if defined(SQLITE_ENABLE_STAT3) && !defined(SQLITE_ENABLE_STAT4)
565 Tcl_SetVar2(interp, "sqlite_options", "stat3", "1", TCL_GLOBAL_ONLY);
566 #else
567 Tcl_SetVar2(interp, "sqlite_options", "stat3", "0", TCL_GLOBAL_ONLY);
568 #endif
570 #if defined(SQLITE_ENABLE_STMTVTAB) && !defined(SQLITE_OMIT_VIRTUALTABLE)
571 Tcl_SetVar2(interp, "sqlite_options", "stmtvtab", "1", TCL_GLOBAL_ONLY);
572 #else
573 Tcl_SetVar2(interp, "sqlite_options", "stmtvtab", "0", TCL_GLOBAL_ONLY);
574 #endif
576 #ifdef SQLITE_ENABLE_STMT_SCANSTATUS
577 Tcl_SetVar2(interp, "sqlite_options", "scanstatus", "1", TCL_GLOBAL_ONLY);
578 #else
579 Tcl_SetVar2(interp, "sqlite_options", "scanstatus", "0", TCL_GLOBAL_ONLY);
580 #endif
582 #if !defined(SQLITE_ENABLE_LOCKING_STYLE)
583 # if defined(__APPLE__)
584 # define SQLITE_ENABLE_LOCKING_STYLE 1
585 # else
586 # define SQLITE_ENABLE_LOCKING_STYLE 0
587 # endif
588 #endif
589 #if SQLITE_ENABLE_LOCKING_STYLE && defined(__APPLE__)
590 Tcl_SetVar2(interp,"sqlite_options","lock_proxy_pragmas","1",TCL_GLOBAL_ONLY);
591 #else
592 Tcl_SetVar2(interp,"sqlite_options","lock_proxy_pragmas","0",TCL_GLOBAL_ONLY);
593 #endif
594 #if defined(SQLITE_PREFER_PROXY_LOCKING) && defined(__APPLE__)
595 Tcl_SetVar2(interp,"sqlite_options","prefer_proxy_locking","1",TCL_GLOBAL_ONLY);
596 #else
597 Tcl_SetVar2(interp,"sqlite_options","prefer_proxy_locking","0",TCL_GLOBAL_ONLY);
598 #endif
601 #ifdef SQLITE_OMIT_SHARED_CACHE
602 Tcl_SetVar2(interp, "sqlite_options", "shared_cache", "0", TCL_GLOBAL_ONLY);
603 #else
604 Tcl_SetVar2(interp, "sqlite_options", "shared_cache", "1", TCL_GLOBAL_ONLY);
605 #endif
607 #ifdef SQLITE_OMIT_SUBQUERY
608 Tcl_SetVar2(interp, "sqlite_options", "subquery", "0", TCL_GLOBAL_ONLY);
609 #else
610 Tcl_SetVar2(interp, "sqlite_options", "subquery", "1", TCL_GLOBAL_ONLY);
611 #endif
613 #ifdef SQLITE_OMIT_TCL_VARIABLE
614 Tcl_SetVar2(interp, "sqlite_options", "tclvar", "0", TCL_GLOBAL_ONLY);
615 #else
616 Tcl_SetVar2(interp, "sqlite_options", "tclvar", "1", TCL_GLOBAL_ONLY);
617 #endif
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);
629 #else
630 Tcl_SetVar2(interp, "sqlite_options", "tempdb", "1", TCL_GLOBAL_ONLY);
631 #endif
633 #ifdef SQLITE_OMIT_TRACE
634 Tcl_SetVar2(interp, "sqlite_options", "trace", "0", TCL_GLOBAL_ONLY);
635 #else
636 Tcl_SetVar2(interp, "sqlite_options", "trace", "1", TCL_GLOBAL_ONLY);
637 #endif
639 #ifdef SQLITE_OMIT_TRIGGER
640 Tcl_SetVar2(interp, "sqlite_options", "trigger", "0", TCL_GLOBAL_ONLY);
641 #else
642 Tcl_SetVar2(interp, "sqlite_options", "trigger", "1", TCL_GLOBAL_ONLY);
643 #endif
645 #ifdef SQLITE_OMIT_TRUNCATE_OPTIMIZATION
646 Tcl_SetVar2(interp, "sqlite_options", "truncate_opt", "0", TCL_GLOBAL_ONLY);
647 #else
648 Tcl_SetVar2(interp, "sqlite_options", "truncate_opt", "1", TCL_GLOBAL_ONLY);
649 #endif
651 #ifdef SQLITE_OMIT_UTF16
652 Tcl_SetVar2(interp, "sqlite_options", "utf16", "0", TCL_GLOBAL_ONLY);
653 #else
654 Tcl_SetVar2(interp, "sqlite_options", "utf16", "1", TCL_GLOBAL_ONLY);
655 #endif
657 #if defined(SQLITE_OMIT_VACUUM) || defined(SQLITE_OMIT_ATTACH)
658 Tcl_SetVar2(interp, "sqlite_options", "vacuum", "0", TCL_GLOBAL_ONLY);
659 #else
660 Tcl_SetVar2(interp, "sqlite_options", "vacuum", "1", TCL_GLOBAL_ONLY);
661 #endif
663 #ifdef SQLITE_OMIT_VIEW
664 Tcl_SetVar2(interp, "sqlite_options", "view", "0", TCL_GLOBAL_ONLY);
665 #else
666 Tcl_SetVar2(interp, "sqlite_options", "view", "1", TCL_GLOBAL_ONLY);
667 #endif
669 #ifdef SQLITE_OMIT_VIRTUALTABLE
670 Tcl_SetVar2(interp, "sqlite_options", "vtab", "0", TCL_GLOBAL_ONLY);
671 #else
672 Tcl_SetVar2(interp, "sqlite_options", "vtab", "1", TCL_GLOBAL_ONLY);
673 #endif
675 #ifdef SQLITE_OMIT_WAL
676 Tcl_SetVar2(interp, "sqlite_options", "wal", "0", TCL_GLOBAL_ONLY);
677 #else
678 Tcl_SetVar2(interp, "sqlite_options", "wal", "1", TCL_GLOBAL_ONLY);
679 #endif
681 #ifdef SQLITE_OMIT_WSD
682 Tcl_SetVar2(interp, "sqlite_options", "wsd", "0", TCL_GLOBAL_ONLY);
683 #else
684 Tcl_SetVar2(interp, "sqlite_options", "wsd", "1", TCL_GLOBAL_ONLY);
685 #endif
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);
689 #else
690 Tcl_SetVar2(interp, "sqlite_options", "update_delete_limit", "0", TCL_GLOBAL_ONLY);
691 #endif
693 #if defined(SQLITE_ENABLE_UNLOCK_NOTIFY)
694 Tcl_SetVar2(interp, "sqlite_options", "unlock_notify", "1", TCL_GLOBAL_ONLY);
695 #else
696 Tcl_SetVar2(interp, "sqlite_options", "unlock_notify", "0", TCL_GLOBAL_ONLY);
697 #endif
699 #ifdef SQLITE_SECURE_DELETE
700 Tcl_SetVar2(interp, "sqlite_options", "secure_delete", "1", TCL_GLOBAL_ONLY);
701 #else
702 Tcl_SetVar2(interp, "sqlite_options", "secure_delete", "0", TCL_GLOBAL_ONLY);
703 #endif
705 #ifdef SQLITE_USER_AUTHENTICATION
706 Tcl_SetVar2(interp, "sqlite_options", "userauth", "1", TCL_GLOBAL_ONLY);
707 #else
708 Tcl_SetVar2(interp, "sqlite_options", "userauth", "0", TCL_GLOBAL_ONLY);
709 #endif
711 #ifdef SQLITE_MULTIPLEX_EXT_OVWR
712 Tcl_SetVar2(interp, "sqlite_options", "multiplex_ext_overwrite", "1", TCL_GLOBAL_ONLY);
713 #else
714 Tcl_SetVar2(interp, "sqlite_options", "multiplex_ext_overwrite", "0", TCL_GLOBAL_ONLY);
715 #endif
717 #ifdef YYTRACKMAXSTACKDEPTH
718 Tcl_SetVar2(interp, "sqlite_options", "yytrackmaxstackdepth", "1", TCL_GLOBAL_ONLY);
719 #else
720 Tcl_SetVar2(interp, "sqlite_options", "yytrackmaxstackdepth", "0", TCL_GLOBAL_ONLY);
721 #endif
723 #ifdef SQLITE_ENABLE_SQLLOG
724 Tcl_SetVar2(interp, "sqlite_options", "sqllog", "1", TCL_GLOBAL_ONLY);
725 #else
726 Tcl_SetVar2(interp, "sqlite_options", "sqllog", "0", TCL_GLOBAL_ONLY);
727 #endif
729 #ifdef SQLITE_ENABLE_URI_00_ERROR
730 Tcl_SetVar2(interp, "sqlite_options", "uri_00_error", "1", TCL_GLOBAL_ONLY);
731 #else
732 Tcl_SetVar2(interp, "sqlite_options", "uri_00_error", "0", TCL_GLOBAL_ONLY);
733 #endif
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);
767 #ifdef _MSC_VER
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);
773 #endif
774 #ifdef __GNUC__
776 static const int cv___GNUC__ = 1;
777 Tcl_LinkVar(interp, "__GNUC__", (char *)&(cv___GNUC__),
778 TCL_LINK_INT | TCL_LINK_READ_ONLY);
780 #endif
785 ** Register commands with the TCL interpreter.
787 int Sqliteconfig_Init(Tcl_Interp *interp){
788 set_options(interp);
789 return TCL_OK;