Home | History | Annotate | Download | only in src
      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.
     10 **
     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.
     18 */
     19 
     20 #include "sqliteLimit.h"
     21 
     22 #include "sqliteInt.h"
     23 #include "tcl.h"
     24 #include <stdlib.h>
     25 #include <string.h>
     26 
     27 /*
     28 ** Macro to stringify the results of the evaluation a pre-processor
     29 ** macro. i.e. so that STRINGVALUE(SQLITE_NOMEM) -> "7".
     30 */
     31 #define STRINGVALUE2(x) #x
     32 #define STRINGVALUE(x) STRINGVALUE2(x)
     33 
     34 /*
     35 ** This routine sets entries in the global ::sqlite_options() array variable
     36 ** according to the compile-time configuration of the database.  Test
     37 ** procedures use this to determine when tests should be omitted.
     38 */
     39 static void set_options(Tcl_Interp *interp){
     40 #ifdef SQLITE_32BIT_ROWID
     41   Tcl_SetVar2(interp, "sqlite_options", "rowid32", "1", TCL_GLOBAL_ONLY);
     42 #else
     43   Tcl_SetVar2(interp, "sqlite_options", "rowid32", "0", TCL_GLOBAL_ONLY);
     44 #endif
     45 
     46 #ifdef SQLITE_CASE_SENSITIVE_LIKE
     47   Tcl_SetVar2(interp, "sqlite_options","casesensitivelike","1",TCL_GLOBAL_ONLY);
     48 #else
     49   Tcl_SetVar2(interp, "sqlite_options","casesensitivelike","0",TCL_GLOBAL_ONLY);
     50 #endif
     51 
     52 #ifdef SQLITE_DEBUG
     53   Tcl_SetVar2(interp, "sqlite_options", "debug", "1", TCL_GLOBAL_ONLY);
     54 #else
     55   Tcl_SetVar2(interp, "sqlite_options", "debug", "0", TCL_GLOBAL_ONLY);
     56 #endif
     57 
     58 #ifdef SQLITE_DISABLE_DIRSYNC
     59   Tcl_SetVar2(interp, "sqlite_options", "dirsync", "0", TCL_GLOBAL_ONLY);
     60 #else
     61   Tcl_SetVar2(interp, "sqlite_options", "dirsync", "1", TCL_GLOBAL_ONLY);
     62 #endif
     63 
     64 #ifdef SQLITE_DISABLE_LFS
     65   Tcl_SetVar2(interp, "sqlite_options", "lfs", "0", TCL_GLOBAL_ONLY);
     66 #else
     67   Tcl_SetVar2(interp, "sqlite_options", "lfs", "1", TCL_GLOBAL_ONLY);
     68 #endif
     69 
     70 #if 1 /* def SQLITE_MEMDEBUG */
     71   Tcl_SetVar2(interp, "sqlite_options", "memdebug", "1", TCL_GLOBAL_ONLY);
     72 #else
     73   Tcl_SetVar2(interp, "sqlite_options", "memdebug", "0", TCL_GLOBAL_ONLY);
     74 #endif
     75 
     76 #ifdef SQLITE_ENABLE_MEMSYS3
     77   Tcl_SetVar2(interp, "sqlite_options", "mem3", "1", TCL_GLOBAL_ONLY);
     78 #else
     79   Tcl_SetVar2(interp, "sqlite_options", "mem3", "0", TCL_GLOBAL_ONLY);
     80 #endif
     81 
     82 #ifdef SQLITE_ENABLE_MEMSYS5
     83   Tcl_SetVar2(interp, "sqlite_options", "mem5", "1", TCL_GLOBAL_ONLY);
     84 #else
     85   Tcl_SetVar2(interp, "sqlite_options", "mem5", "0", TCL_GLOBAL_ONLY);
     86 #endif
     87 
     88 #ifdef SQLITE_MUTEX_OMIT
     89   Tcl_SetVar2(interp, "sqlite_options", "mutex", "0", TCL_GLOBAL_ONLY);
     90 #else
     91   Tcl_SetVar2(interp, "sqlite_options", "mutex", "1", TCL_GLOBAL_ONLY);
     92 #endif
     93 
     94 #ifdef SQLITE_MUTEX_NOOP
     95   Tcl_SetVar2(interp, "sqlite_options", "mutex_noop", "1", TCL_GLOBAL_ONLY);
     96 #else
     97   Tcl_SetVar2(interp, "sqlite_options", "mutex_noop", "0", TCL_GLOBAL_ONLY);
     98 #endif
     99 
    100 #ifdef SQLITE_OMIT_ALTERTABLE
    101   Tcl_SetVar2(interp, "sqlite_options", "altertable", "0", TCL_GLOBAL_ONLY);
    102 #else
    103   Tcl_SetVar2(interp, "sqlite_options", "altertable", "1", TCL_GLOBAL_ONLY);
    104 #endif
    105 
    106 #ifdef SQLITE_OMIT_ANALYZE
    107   Tcl_SetVar2(interp, "sqlite_options", "analyze", "0", TCL_GLOBAL_ONLY);
    108 #else
    109   Tcl_SetVar2(interp, "sqlite_options", "analyze", "1", TCL_GLOBAL_ONLY);
    110 #endif
    111 
    112 #ifdef SQLITE_ENABLE_ATOMIC_WRITE
    113   Tcl_SetVar2(interp, "sqlite_options", "atomicwrite", "1", TCL_GLOBAL_ONLY);
    114 #else
    115   Tcl_SetVar2(interp, "sqlite_options", "atomicwrite", "0", TCL_GLOBAL_ONLY);
    116 #endif
    117 
    118 #ifdef SQLITE_OMIT_ATTACH
    119   Tcl_SetVar2(interp, "sqlite_options", "attach", "0", TCL_GLOBAL_ONLY);
    120 #else
    121   Tcl_SetVar2(interp, "sqlite_options", "attach", "1", TCL_GLOBAL_ONLY);
    122 #endif
    123 
    124 #ifdef SQLITE_OMIT_AUTHORIZATION
    125   Tcl_SetVar2(interp, "sqlite_options", "auth", "0", TCL_GLOBAL_ONLY);
    126 #else
    127   Tcl_SetVar2(interp, "sqlite_options", "auth", "1", TCL_GLOBAL_ONLY);
    128 #endif
    129 
    130 #ifdef SQLITE_OMIT_AUTOINCREMENT
    131   Tcl_SetVar2(interp, "sqlite_options", "autoinc", "0", TCL_GLOBAL_ONLY);
    132 #else
    133   Tcl_SetVar2(interp, "sqlite_options", "autoinc", "1", TCL_GLOBAL_ONLY);
    134 #endif
    135 
    136 #ifdef SQLITE_OMIT_AUTOMATIC_INDEX
    137   Tcl_SetVar2(interp, "sqlite_options", "autoindex", "0", TCL_GLOBAL_ONLY);
    138 #else
    139   Tcl_SetVar2(interp, "sqlite_options", "autoindex", "1", TCL_GLOBAL_ONLY);
    140 #endif
    141 
    142 #ifdef SQLITE_OMIT_AUTORESET
    143   Tcl_SetVar2(interp, "sqlite_options", "autoreset", "0", TCL_GLOBAL_ONLY);
    144 #else
    145   Tcl_SetVar2(interp, "sqlite_options", "autoreset", "1", TCL_GLOBAL_ONLY);
    146 #endif
    147 
    148 #ifdef SQLITE_OMIT_AUTOVACUUM
    149   Tcl_SetVar2(interp, "sqlite_options", "autovacuum", "0", TCL_GLOBAL_ONLY);
    150 #else
    151   Tcl_SetVar2(interp, "sqlite_options", "autovacuum", "1", TCL_GLOBAL_ONLY);
    152 #endif /* SQLITE_OMIT_AUTOVACUUM */
    153 #if !defined(SQLITE_DEFAULT_AUTOVACUUM)
    154   Tcl_SetVar2(interp,"sqlite_options","default_autovacuum","0",TCL_GLOBAL_ONLY);
    155 #else
    156   Tcl_SetVar2(interp, "sqlite_options", "default_autovacuum",
    157       STRINGVALUE(SQLITE_DEFAULT_AUTOVACUUM), TCL_GLOBAL_ONLY);
    158 #endif
    159 
    160 #ifdef SQLITE_OMIT_BETWEEN_OPTIMIZATION
    161   Tcl_SetVar2(interp, "sqlite_options", "between_opt", "0", TCL_GLOBAL_ONLY);
    162 #else
    163   Tcl_SetVar2(interp, "sqlite_options", "between_opt", "1", TCL_GLOBAL_ONLY);
    164 #endif
    165 
    166 #ifdef SQLITE_OMIT_BUILTIN_TEST
    167   Tcl_SetVar2(interp, "sqlite_options", "builtin_test", "0", TCL_GLOBAL_ONLY);
    168 #else
    169   Tcl_SetVar2(interp, "sqlite_options", "builtin_test", "1", TCL_GLOBAL_ONLY);
    170 #endif
    171 
    172 #ifdef SQLITE_OMIT_BLOB_LITERAL
    173   Tcl_SetVar2(interp, "sqlite_options", "bloblit", "0", TCL_GLOBAL_ONLY);
    174 #else
    175   Tcl_SetVar2(interp, "sqlite_options", "bloblit", "1", TCL_GLOBAL_ONLY);
    176 #endif
    177 
    178 #ifdef SQLITE_OMIT_CAST
    179   Tcl_SetVar2(interp, "sqlite_options", "cast", "0", TCL_GLOBAL_ONLY);
    180 #else
    181   Tcl_SetVar2(interp, "sqlite_options", "cast", "1", TCL_GLOBAL_ONLY);
    182 #endif
    183 
    184 #ifdef SQLITE_OMIT_CHECK
    185   Tcl_SetVar2(interp, "sqlite_options", "check", "0", TCL_GLOBAL_ONLY);
    186 #else
    187   Tcl_SetVar2(interp, "sqlite_options", "check", "1", TCL_GLOBAL_ONLY);
    188 #endif
    189 
    190 #ifdef SQLITE_ENABLE_COLUMN_METADATA
    191   Tcl_SetVar2(interp, "sqlite_options", "columnmetadata", "1", TCL_GLOBAL_ONLY);
    192 #else
    193   Tcl_SetVar2(interp, "sqlite_options", "columnmetadata", "0", TCL_GLOBAL_ONLY);
    194 #endif
    195 
    196 #ifdef SQLITE_ENABLE_OVERSIZE_CELL_CHECK
    197   Tcl_SetVar2(interp, "sqlite_options", "oversize_cell_check", "1",
    198               TCL_GLOBAL_ONLY);
    199 #else
    200   Tcl_SetVar2(interp, "sqlite_options", "oversize_cell_check", "0",
    201               TCL_GLOBAL_ONLY);
    202 #endif
    203 
    204 #ifdef SQLITE_OMIT_COMPILEOPTION_DIAGS
    205   Tcl_SetVar2(interp, "sqlite_options", "compileoption_diags", "0", TCL_GLOBAL_ONLY);
    206 #else
    207   Tcl_SetVar2(interp, "sqlite_options", "compileoption_diags", "1", TCL_GLOBAL_ONLY);
    208 #endif
    209 
    210 #ifdef SQLITE_OMIT_COMPLETE
    211   Tcl_SetVar2(interp, "sqlite_options", "complete", "0", TCL_GLOBAL_ONLY);
    212 #else
    213   Tcl_SetVar2(interp, "sqlite_options", "complete", "1", TCL_GLOBAL_ONLY);
    214 #endif
    215 
    216 #ifdef SQLITE_OMIT_COMPOUND_SELECT
    217   Tcl_SetVar2(interp, "sqlite_options", "compound", "0", TCL_GLOBAL_ONLY);
    218 #else
    219   Tcl_SetVar2(interp, "sqlite_options", "compound", "1", TCL_GLOBAL_ONLY);
    220 #endif
    221 
    222 #ifdef SQLITE_OMIT_CONFLICT_CLAUSE
    223   Tcl_SetVar2(interp, "sqlite_options", "conflict", "0", TCL_GLOBAL_ONLY);
    224 #else
    225   Tcl_SetVar2(interp, "sqlite_options", "conflict", "1", TCL_GLOBAL_ONLY);
    226 #endif
    227 
    228 #if SQLITE_OS_UNIX
    229   Tcl_SetVar2(interp, "sqlite_options", "crashtest", "1", TCL_GLOBAL_ONLY);
    230 #else
    231   Tcl_SetVar2(interp, "sqlite_options", "crashtest", "0", TCL_GLOBAL_ONLY);
    232 #endif
    233 
    234 #ifdef SQLITE_OMIT_DATETIME_FUNCS
    235   Tcl_SetVar2(interp, "sqlite_options", "datetime", "0", TCL_GLOBAL_ONLY);
    236 #else
    237   Tcl_SetVar2(interp, "sqlite_options", "datetime", "1", TCL_GLOBAL_ONLY);
    238 #endif
    239 
    240 #ifdef SQLITE_OMIT_DECLTYPE
    241   Tcl_SetVar2(interp, "sqlite_options", "decltype", "0", TCL_GLOBAL_ONLY);
    242 #else
    243   Tcl_SetVar2(interp, "sqlite_options", "decltype", "1", TCL_GLOBAL_ONLY);
    244 #endif
    245 
    246 #ifdef SQLITE_OMIT_DEPRECATED
    247   Tcl_SetVar2(interp, "sqlite_options", "deprecated", "0", TCL_GLOBAL_ONLY);
    248 #else
    249   Tcl_SetVar2(interp, "sqlite_options", "deprecated", "1", TCL_GLOBAL_ONLY);
    250 #endif
    251 
    252 #ifdef SQLITE_OMIT_DISKIO
    253   Tcl_SetVar2(interp, "sqlite_options", "diskio", "0", TCL_GLOBAL_ONLY);
    254 #else
    255   Tcl_SetVar2(interp, "sqlite_options", "diskio", "1", TCL_GLOBAL_ONLY);
    256 #endif
    257 
    258 #ifdef SQLITE_OMIT_EXPLAIN
    259   Tcl_SetVar2(interp, "sqlite_options", "explain", "0", TCL_GLOBAL_ONLY);
    260 #else
    261   Tcl_SetVar2(interp, "sqlite_options", "explain", "1", TCL_GLOBAL_ONLY);
    262 #endif
    263 
    264 #ifdef SQLITE_OMIT_FLOATING_POINT
    265   Tcl_SetVar2(interp, "sqlite_options", "floatingpoint", "0", TCL_GLOBAL_ONLY);
    266 #else
    267   Tcl_SetVar2(interp, "sqlite_options", "floatingpoint", "1", TCL_GLOBAL_ONLY);
    268 #endif
    269 
    270 #ifdef SQLITE_OMIT_FOREIGN_KEY
    271   Tcl_SetVar2(interp, "sqlite_options", "foreignkey", "0", TCL_GLOBAL_ONLY);
    272 #else
    273   Tcl_SetVar2(interp, "sqlite_options", "foreignkey", "1", TCL_GLOBAL_ONLY);
    274 #endif
    275 
    276 #ifdef SQLITE_ENABLE_FTS1
    277   Tcl_SetVar2(interp, "sqlite_options", "fts1", "1", TCL_GLOBAL_ONLY);
    278 #else
    279   Tcl_SetVar2(interp, "sqlite_options", "fts1", "0", TCL_GLOBAL_ONLY);
    280 #endif
    281 
    282 #ifdef SQLITE_ENABLE_FTS2
    283   Tcl_SetVar2(interp, "sqlite_options", "fts2", "1", TCL_GLOBAL_ONLY);
    284 #else
    285   Tcl_SetVar2(interp, "sqlite_options", "fts2", "0", TCL_GLOBAL_ONLY);
    286 #endif
    287 
    288 #ifdef SQLITE_ENABLE_FTS3
    289   Tcl_SetVar2(interp, "sqlite_options", "fts3", "1", TCL_GLOBAL_ONLY);
    290 #else
    291   Tcl_SetVar2(interp, "sqlite_options", "fts3", "0", TCL_GLOBAL_ONLY);
    292 #endif
    293 
    294 #ifdef SQLITE_OMIT_GET_TABLE
    295   Tcl_SetVar2(interp, "sqlite_options", "gettable", "0", TCL_GLOBAL_ONLY);
    296 #else
    297   Tcl_SetVar2(interp, "sqlite_options", "gettable", "1", TCL_GLOBAL_ONLY);
    298 #endif
    299 
    300 #ifdef SQLITE_ENABLE_ICU
    301   Tcl_SetVar2(interp, "sqlite_options", "icu", "1", TCL_GLOBAL_ONLY);
    302 #else
    303   Tcl_SetVar2(interp, "sqlite_options", "icu", "0", TCL_GLOBAL_ONLY);
    304 #endif
    305 
    306 #ifdef SQLITE_OMIT_INCRBLOB
    307   Tcl_SetVar2(interp, "sqlite_options", "incrblob", "0", TCL_GLOBAL_ONLY);
    308 #else
    309   Tcl_SetVar2(interp, "sqlite_options", "incrblob", "1", TCL_GLOBAL_ONLY);
    310 #endif /* SQLITE_OMIT_AUTOVACUUM */
    311 
    312 #ifdef SQLITE_OMIT_INTEGRITY_CHECK
    313   Tcl_SetVar2(interp, "sqlite_options", "integrityck", "0", TCL_GLOBAL_ONLY);
    314 #else
    315   Tcl_SetVar2(interp, "sqlite_options", "integrityck", "1", TCL_GLOBAL_ONLY);
    316 #endif
    317 
    318 #if defined(SQLITE_DEFAULT_FILE_FORMAT) && SQLITE_DEFAULT_FILE_FORMAT==1
    319   Tcl_SetVar2(interp, "sqlite_options", "legacyformat", "1", TCL_GLOBAL_ONLY);
    320 #else
    321   Tcl_SetVar2(interp, "sqlite_options", "legacyformat", "0", TCL_GLOBAL_ONLY);
    322 #endif
    323 
    324 #ifdef SQLITE_OMIT_LIKE_OPTIMIZATION
    325   Tcl_SetVar2(interp, "sqlite_options", "like_opt", "0", TCL_GLOBAL_ONLY);
    326 #else
    327   Tcl_SetVar2(interp, "sqlite_options", "like_opt", "1", TCL_GLOBAL_ONLY);
    328 #endif
    329 
    330 #ifdef SQLITE_OMIT_LOAD_EXTENSION
    331   Tcl_SetVar2(interp, "sqlite_options", "load_ext", "0", TCL_GLOBAL_ONLY);
    332 #else
    333   Tcl_SetVar2(interp, "sqlite_options", "load_ext", "1", TCL_GLOBAL_ONLY);
    334 #endif
    335 
    336 #ifdef SQLITE_OMIT_LOCALTIME
    337   Tcl_SetVar2(interp, "sqlite_options", "localtime", "0", TCL_GLOBAL_ONLY);
    338 #else
    339   Tcl_SetVar2(interp, "sqlite_options", "localtime", "1", TCL_GLOBAL_ONLY);
    340 #endif
    341 
    342 #ifdef SQLITE_OMIT_LOOKASIDE
    343   Tcl_SetVar2(interp, "sqlite_options", "lookaside", "0", TCL_GLOBAL_ONLY);
    344 #else
    345   Tcl_SetVar2(interp, "sqlite_options", "lookaside", "1", TCL_GLOBAL_ONLY);
    346 #endif
    347 
    348 Tcl_SetVar2(interp, "sqlite_options", "long_double",
    349               sizeof(LONGDOUBLE_TYPE)>sizeof(double) ? "1" : "0",
    350               TCL_GLOBAL_ONLY);
    351 
    352 #ifdef SQLITE_OMIT_MEMORYDB
    353   Tcl_SetVar2(interp, "sqlite_options", "memorydb", "0", TCL_GLOBAL_ONLY);
    354 #else
    355   Tcl_SetVar2(interp, "sqlite_options", "memorydb", "1", TCL_GLOBAL_ONLY);
    356 #endif
    357 
    358 #ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
    359   Tcl_SetVar2(interp, "sqlite_options", "memorymanage", "1", TCL_GLOBAL_ONLY);
    360 #else
    361   Tcl_SetVar2(interp, "sqlite_options", "memorymanage", "0", TCL_GLOBAL_ONLY);
    362 #endif
    363 
    364 #ifdef SQLITE_OMIT_OR_OPTIMIZATION
    365   Tcl_SetVar2(interp, "sqlite_options", "or_opt", "0", TCL_GLOBAL_ONLY);
    366 #else
    367   Tcl_SetVar2(interp, "sqlite_options", "or_opt", "1", TCL_GLOBAL_ONLY);
    368 #endif
    369 
    370 #ifdef SQLITE_OMIT_PAGER_PRAGMAS
    371   Tcl_SetVar2(interp, "sqlite_options", "pager_pragmas", "0", TCL_GLOBAL_ONLY);
    372 #else
    373   Tcl_SetVar2(interp, "sqlite_options", "pager_pragmas", "1", TCL_GLOBAL_ONLY);
    374 #endif
    375 
    376 #if defined(SQLITE_OMIT_PRAGMA) || defined(SQLITE_OMIT_FLAG_PRAGMAS)
    377   Tcl_SetVar2(interp, "sqlite_options", "pragma", "0", TCL_GLOBAL_ONLY);
    378   Tcl_SetVar2(interp, "sqlite_options", "integrityck", "0", TCL_GLOBAL_ONLY);
    379 #else
    380   Tcl_SetVar2(interp, "sqlite_options", "pragma", "1", TCL_GLOBAL_ONLY);
    381 #endif
    382 
    383 #ifdef SQLITE_OMIT_PROGRESS_CALLBACK
    384   Tcl_SetVar2(interp, "sqlite_options", "progress", "0", TCL_GLOBAL_ONLY);
    385 #else
    386   Tcl_SetVar2(interp, "sqlite_options", "progress", "1", TCL_GLOBAL_ONLY);
    387 #endif
    388 
    389 #ifdef SQLITE_OMIT_REINDEX
    390   Tcl_SetVar2(interp, "sqlite_options", "reindex", "0", TCL_GLOBAL_ONLY);
    391 #else
    392   Tcl_SetVar2(interp, "sqlite_options", "reindex", "1", TCL_GLOBAL_ONLY);
    393 #endif
    394 
    395 #ifdef SQLITE_ENABLE_RTREE
    396   Tcl_SetVar2(interp, "sqlite_options", "rtree", "1", TCL_GLOBAL_ONLY);
    397 #else
    398   Tcl_SetVar2(interp, "sqlite_options", "rtree", "0", TCL_GLOBAL_ONLY);
    399 #endif
    400 
    401 #ifdef SQLITE_OMIT_SCHEMA_PRAGMAS
    402   Tcl_SetVar2(interp, "sqlite_options", "schema_pragmas", "0", TCL_GLOBAL_ONLY);
    403 #else
    404   Tcl_SetVar2(interp, "sqlite_options", "schema_pragmas", "1", TCL_GLOBAL_ONLY);
    405 #endif
    406 
    407 #ifdef SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS
    408   Tcl_SetVar2(interp, "sqlite_options", "schema_version", "0", TCL_GLOBAL_ONLY);
    409 #else
    410   Tcl_SetVar2(interp, "sqlite_options", "schema_version", "1", TCL_GLOBAL_ONLY);
    411 #endif
    412 
    413 #ifdef SQLITE_ENABLE_STAT2
    414   Tcl_SetVar2(interp, "sqlite_options", "stat2", "1", TCL_GLOBAL_ONLY);
    415 #else
    416   Tcl_SetVar2(interp, "sqlite_options", "stat2", "0", TCL_GLOBAL_ONLY);
    417 #endif
    418 
    419 #if !defined(SQLITE_ENABLE_LOCKING_STYLE)
    420 #  if defined(__APPLE__)
    421 #    define SQLITE_ENABLE_LOCKING_STYLE 1
    422 #  else
    423 #    define SQLITE_ENABLE_LOCKING_STYLE 0
    424 #  endif
    425 #endif
    426 #if SQLITE_ENABLE_LOCKING_STYLE && defined(__APPLE__)
    427   Tcl_SetVar2(interp,"sqlite_options","lock_proxy_pragmas","1",TCL_GLOBAL_ONLY);
    428 #else
    429   Tcl_SetVar2(interp,"sqlite_options","lock_proxy_pragmas","0",TCL_GLOBAL_ONLY);
    430 #endif
    431 #if defined(SQLITE_PREFER_PROXY_LOCKING) && defined(__APPLE__)
    432   Tcl_SetVar2(interp,"sqlite_options","prefer_proxy_locking","1",TCL_GLOBAL_ONLY);
    433 #else
    434   Tcl_SetVar2(interp,"sqlite_options","prefer_proxy_locking","0",TCL_GLOBAL_ONLY);
    435 #endif
    436 
    437 
    438 #ifdef SQLITE_OMIT_SHARED_CACHE
    439   Tcl_SetVar2(interp, "sqlite_options", "shared_cache", "0", TCL_GLOBAL_ONLY);
    440 #else
    441   Tcl_SetVar2(interp, "sqlite_options", "shared_cache", "1", TCL_GLOBAL_ONLY);
    442 #endif
    443 
    444 #ifdef SQLITE_OMIT_SUBQUERY
    445   Tcl_SetVar2(interp, "sqlite_options", "subquery", "0", TCL_GLOBAL_ONLY);
    446 #else
    447   Tcl_SetVar2(interp, "sqlite_options", "subquery", "1", TCL_GLOBAL_ONLY);
    448 #endif
    449 
    450 #ifdef SQLITE_OMIT_TCL_VARIABLE
    451   Tcl_SetVar2(interp, "sqlite_options", "tclvar", "0", TCL_GLOBAL_ONLY);
    452 #else
    453   Tcl_SetVar2(interp, "sqlite_options", "tclvar", "1", TCL_GLOBAL_ONLY);
    454 #endif
    455 
    456   Tcl_SetVar2(interp, "sqlite_options", "threadsafe",
    457       STRINGVALUE(SQLITE_THREADSAFE), TCL_GLOBAL_ONLY);
    458   assert( sqlite3_threadsafe()==SQLITE_THREADSAFE );
    459 
    460 #ifdef SQLITE_OMIT_TEMPDB
    461   Tcl_SetVar2(interp, "sqlite_options", "tempdb", "0", TCL_GLOBAL_ONLY);
    462 #else
    463   Tcl_SetVar2(interp, "sqlite_options", "tempdb", "1", TCL_GLOBAL_ONLY);
    464 #endif
    465 
    466 #ifdef SQLITE_OMIT_TRACE
    467   Tcl_SetVar2(interp, "sqlite_options", "trace", "0", TCL_GLOBAL_ONLY);
    468 #else
    469   Tcl_SetVar2(interp, "sqlite_options", "trace", "1", TCL_GLOBAL_ONLY);
    470 #endif
    471 
    472 #ifdef SQLITE_OMIT_TRIGGER
    473   Tcl_SetVar2(interp, "sqlite_options", "trigger", "0", TCL_GLOBAL_ONLY);
    474 #else
    475   Tcl_SetVar2(interp, "sqlite_options", "trigger", "1", TCL_GLOBAL_ONLY);
    476 #endif
    477 
    478 #ifdef SQLITE_OMIT_TRUNCATE_OPTIMIZATION
    479   Tcl_SetVar2(interp, "sqlite_options", "truncate_opt", "0", TCL_GLOBAL_ONLY);
    480 #else
    481   Tcl_SetVar2(interp, "sqlite_options", "truncate_opt", "1", TCL_GLOBAL_ONLY);
    482 #endif
    483 
    484 #ifdef SQLITE_OMIT_UTF16
    485   Tcl_SetVar2(interp, "sqlite_options", "utf16", "0", TCL_GLOBAL_ONLY);
    486 #else
    487   Tcl_SetVar2(interp, "sqlite_options", "utf16", "1", TCL_GLOBAL_ONLY);
    488 #endif
    489 
    490 #if defined(SQLITE_OMIT_VACUUM) || defined(SQLITE_OMIT_ATTACH)
    491   Tcl_SetVar2(interp, "sqlite_options", "vacuum", "0", TCL_GLOBAL_ONLY);
    492 #else
    493   Tcl_SetVar2(interp, "sqlite_options", "vacuum", "1", TCL_GLOBAL_ONLY);
    494 #endif
    495 
    496 #ifdef SQLITE_OMIT_VIEW
    497   Tcl_SetVar2(interp, "sqlite_options", "view", "0", TCL_GLOBAL_ONLY);
    498 #else
    499   Tcl_SetVar2(interp, "sqlite_options", "view", "1", TCL_GLOBAL_ONLY);
    500 #endif
    501 
    502 #ifdef SQLITE_OMIT_VIRTUALTABLE
    503   Tcl_SetVar2(interp, "sqlite_options", "vtab", "0", TCL_GLOBAL_ONLY);
    504 #else
    505   Tcl_SetVar2(interp, "sqlite_options", "vtab", "1", TCL_GLOBAL_ONLY);
    506 #endif
    507 
    508 #ifdef SQLITE_OMIT_WAL
    509   Tcl_SetVar2(interp, "sqlite_options", "wal", "0", TCL_GLOBAL_ONLY);
    510 #else
    511   Tcl_SetVar2(interp, "sqlite_options", "wal", "1", TCL_GLOBAL_ONLY);
    512 #endif
    513 
    514 #ifdef SQLITE_OMIT_WSD
    515   Tcl_SetVar2(interp, "sqlite_options", "wsd", "0", TCL_GLOBAL_ONLY);
    516 #else
    517   Tcl_SetVar2(interp, "sqlite_options", "wsd", "1", TCL_GLOBAL_ONLY);
    518 #endif
    519 
    520 #if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY)
    521   Tcl_SetVar2(interp, "sqlite_options", "update_delete_limit", "1", TCL_GLOBAL_ONLY);
    522 #else
    523   Tcl_SetVar2(interp, "sqlite_options", "update_delete_limit", "0", TCL_GLOBAL_ONLY);
    524 #endif
    525 
    526 #if defined(SQLITE_ENABLE_UNLOCK_NOTIFY)
    527   Tcl_SetVar2(interp, "sqlite_options", "unlock_notify", "1", TCL_GLOBAL_ONLY);
    528 #else
    529   Tcl_SetVar2(interp, "sqlite_options", "unlock_notify", "0", TCL_GLOBAL_ONLY);
    530 #endif
    531 
    532 #ifdef SQLITE_SECURE_DELETE
    533   Tcl_SetVar2(interp, "sqlite_options", "secure_delete", "1", TCL_GLOBAL_ONLY);
    534 #else
    535   Tcl_SetVar2(interp, "sqlite_options", "secure_delete", "0", TCL_GLOBAL_ONLY);
    536 #endif
    537 
    538 #ifdef SQLITE_MULTIPLEX_EXT_OVWR
    539   Tcl_SetVar2(interp, "sqlite_options", "multiplex_ext_overwrite", "1", TCL_GLOBAL_ONLY);
    540 #else
    541   Tcl_SetVar2(interp, "sqlite_options", "multiplex_ext_overwrite", "0", TCL_GLOBAL_ONLY);
    542 #endif
    543 
    544 #ifdef YYTRACKMAXSTACKDEPTH
    545   Tcl_SetVar2(interp, "sqlite_options", "yytrackmaxstackdepth", "1", TCL_GLOBAL_ONLY);
    546 #else
    547   Tcl_SetVar2(interp, "sqlite_options", "yytrackmaxstackdepth", "0", TCL_GLOBAL_ONLY);
    548 #endif
    549 
    550 #define LINKVAR(x) { \
    551     static const int cv_ ## x = SQLITE_ ## x; \
    552     Tcl_LinkVar(interp, "SQLITE_" #x, (char *)&(cv_ ## x), \
    553                 TCL_LINK_INT | TCL_LINK_READ_ONLY); }
    554 
    555   LINKVAR( MAX_LENGTH );
    556   LINKVAR( MAX_COLUMN );
    557   LINKVAR( MAX_SQL_LENGTH );
    558   LINKVAR( MAX_EXPR_DEPTH );
    559   LINKVAR( MAX_COMPOUND_SELECT );
    560   LINKVAR( MAX_VDBE_OP );
    561   LINKVAR( MAX_FUNCTION_ARG );
    562   LINKVAR( MAX_VARIABLE_NUMBER );
    563   LINKVAR( MAX_PAGE_SIZE );
    564   LINKVAR( MAX_PAGE_COUNT );
    565   LINKVAR( MAX_LIKE_PATTERN_LENGTH );
    566   LINKVAR( MAX_TRIGGER_DEPTH );
    567   LINKVAR( DEFAULT_TEMP_CACHE_SIZE );
    568   LINKVAR( DEFAULT_CACHE_SIZE );
    569   LINKVAR( DEFAULT_PAGE_SIZE );
    570   LINKVAR( DEFAULT_FILE_FORMAT );
    571   LINKVAR( MAX_ATTACHED );
    572 
    573   {
    574     static const int cv_TEMP_STORE = SQLITE_TEMP_STORE;
    575     Tcl_LinkVar(interp, "TEMP_STORE", (char *)&(cv_TEMP_STORE),
    576                 TCL_LINK_INT | TCL_LINK_READ_ONLY);
    577   }
    578 }
    579 
    580 
    581 /*
    582 ** Register commands with the TCL interpreter.
    583 */
    584 int Sqliteconfig_Init(Tcl_Interp *interp){
    585   set_options(interp);
    586   return TCL_OK;
    587 }
    588