OLD | NEW |
(Empty) | |
| 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 #if SQLITE_OS_WIN |
| 24 # include "os_win.h" |
| 25 #endif |
| 26 |
| 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> |
| 34 |
| 35 /* |
| 36 ** Macro to stringify the results of the evaluation a pre-processor |
| 37 ** macro. i.e. so that STRINGVALUE(SQLITE_NOMEM) -> "7". |
| 38 */ |
| 39 #define STRINGVALUE2(x) #x |
| 40 #define STRINGVALUE(x) STRINGVALUE2(x) |
| 41 |
| 42 /* |
| 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. |
| 46 */ |
| 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 |
| 55 |
| 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 |
| 61 |
| 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 |
| 67 |
| 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 |
| 73 |
| 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 |
| 79 |
| 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 |
| 85 |
| 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 |
| 92 |
| 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 |
| 98 |
| 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 |
| 104 |
| 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 |
| 110 |
| 111 #ifdef SQLITE_DISABLE_PAGECACHE_OVERFLOW_STATS |
| 112 Tcl_SetVar2(interp, "sqlite_options", "pagecache_overflow_stats","0",TCL_GLOBA
L_ONLY); |
| 113 #else |
| 114 Tcl_SetVar2(interp, "sqlite_options", "pagecache_overflow_stats","1",TCL_GLOBA
L_ONLY); |
| 115 #endif |
| 116 |
| 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 |
| 122 |
| 123 Tcl_SetVar2(interp, "sqlite_options", "worker_threads", |
| 124 STRINGVALUE(SQLITE_MAX_WORKER_THREADS), TCL_GLOBAL_ONLY |
| 125 ); |
| 126 |
| 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 |
| 132 |
| 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 |
| 138 |
| 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 |
| 144 |
| 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 |
| 150 |
| 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 |
| 156 |
| 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 |
| 162 |
| 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 |
| 168 |
| 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 |
| 174 |
| 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 |
| 180 |
| 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 |
| 186 |
| 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 |
| 192 |
| 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 |
| 198 |
| 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 |
| 204 |
| 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 |
| 210 |
| 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 |
| 216 |
| 217 #ifdef SQLITE_LIKE_DOESNT_MATCH_BLOBS |
| 218 Tcl_SetVar2(interp, "sqlite_options", "like_match_blobs", "0", TCL_GLOBAL_ONLY
); |
| 219 #else |
| 220 Tcl_SetVar2(interp, "sqlite_options", "like_match_blobs", "1", TCL_GLOBAL_ONLY
); |
| 221 #endif |
| 222 |
| 223 #ifdef SQLITE_OMIT_ATTACH |
| 224 Tcl_SetVar2(interp, "sqlite_options", "attach", "0", TCL_GLOBAL_ONLY); |
| 225 #else |
| 226 Tcl_SetVar2(interp, "sqlite_options", "attach", "1", TCL_GLOBAL_ONLY); |
| 227 #endif |
| 228 |
| 229 #ifdef SQLITE_OMIT_AUTHORIZATION |
| 230 Tcl_SetVar2(interp, "sqlite_options", "auth", "0", TCL_GLOBAL_ONLY); |
| 231 #else |
| 232 Tcl_SetVar2(interp, "sqlite_options", "auth", "1", TCL_GLOBAL_ONLY); |
| 233 #endif |
| 234 |
| 235 #ifdef SQLITE_OMIT_AUTOINCREMENT |
| 236 Tcl_SetVar2(interp, "sqlite_options", "autoinc", "0", TCL_GLOBAL_ONLY); |
| 237 #else |
| 238 Tcl_SetVar2(interp, "sqlite_options", "autoinc", "1", TCL_GLOBAL_ONLY); |
| 239 #endif |
| 240 |
| 241 #ifdef SQLITE_OMIT_AUTOMATIC_INDEX |
| 242 Tcl_SetVar2(interp, "sqlite_options", "autoindex", "0", TCL_GLOBAL_ONLY); |
| 243 #else |
| 244 Tcl_SetVar2(interp, "sqlite_options", "autoindex", "1", TCL_GLOBAL_ONLY); |
| 245 #endif |
| 246 |
| 247 #ifdef SQLITE_OMIT_AUTORESET |
| 248 Tcl_SetVar2(interp, "sqlite_options", "autoreset", "0", TCL_GLOBAL_ONLY); |
| 249 #else |
| 250 Tcl_SetVar2(interp, "sqlite_options", "autoreset", "1", TCL_GLOBAL_ONLY); |
| 251 #endif |
| 252 |
| 253 #ifdef SQLITE_OMIT_AUTOVACUUM |
| 254 Tcl_SetVar2(interp, "sqlite_options", "autovacuum", "0", TCL_GLOBAL_ONLY); |
| 255 #else |
| 256 Tcl_SetVar2(interp, "sqlite_options", "autovacuum", "1", TCL_GLOBAL_ONLY); |
| 257 #endif /* SQLITE_OMIT_AUTOVACUUM */ |
| 258 #if !defined(SQLITE_DEFAULT_AUTOVACUUM) |
| 259 Tcl_SetVar2(interp,"sqlite_options","default_autovacuum","0",TCL_GLOBAL_ONLY); |
| 260 #else |
| 261 Tcl_SetVar2(interp, "sqlite_options", "default_autovacuum", |
| 262 STRINGVALUE(SQLITE_DEFAULT_AUTOVACUUM), TCL_GLOBAL_ONLY); |
| 263 #endif |
| 264 |
| 265 #ifdef SQLITE_OMIT_BETWEEN_OPTIMIZATION |
| 266 Tcl_SetVar2(interp, "sqlite_options", "between_opt", "0", TCL_GLOBAL_ONLY); |
| 267 #else |
| 268 Tcl_SetVar2(interp, "sqlite_options", "between_opt", "1", TCL_GLOBAL_ONLY); |
| 269 #endif |
| 270 |
| 271 #ifdef SQLITE_UNTESTABLE |
| 272 Tcl_SetVar2(interp, "sqlite_options", "builtin_test", "0", TCL_GLOBAL_ONLY); |
| 273 #else |
| 274 Tcl_SetVar2(interp, "sqlite_options", "builtin_test", "1", TCL_GLOBAL_ONLY); |
| 275 #endif |
| 276 |
| 277 #ifdef SQLITE_OMIT_BLOB_LITERAL |
| 278 Tcl_SetVar2(interp, "sqlite_options", "bloblit", "0", TCL_GLOBAL_ONLY); |
| 279 #else |
| 280 Tcl_SetVar2(interp, "sqlite_options", "bloblit", "1", TCL_GLOBAL_ONLY); |
| 281 #endif |
| 282 |
| 283 #ifdef SQLITE_OMIT_CAST |
| 284 Tcl_SetVar2(interp, "sqlite_options", "cast", "0", TCL_GLOBAL_ONLY); |
| 285 #else |
| 286 Tcl_SetVar2(interp, "sqlite_options", "cast", "1", TCL_GLOBAL_ONLY); |
| 287 #endif |
| 288 |
| 289 #ifdef SQLITE_OMIT_CHECK |
| 290 Tcl_SetVar2(interp, "sqlite_options", "check", "0", TCL_GLOBAL_ONLY); |
| 291 #else |
| 292 Tcl_SetVar2(interp, "sqlite_options", "check", "1", TCL_GLOBAL_ONLY); |
| 293 #endif |
| 294 |
| 295 #ifdef SQLITE_OMIT_CTE |
| 296 Tcl_SetVar2(interp, "sqlite_options", "cte", "0", TCL_GLOBAL_ONLY); |
| 297 #else |
| 298 Tcl_SetVar2(interp, "sqlite_options", "cte", "1", TCL_GLOBAL_ONLY); |
| 299 #endif |
| 300 |
| 301 #ifdef SQLITE_ENABLE_COLUMN_METADATA |
| 302 Tcl_SetVar2(interp, "sqlite_options", "columnmetadata", "1", TCL_GLOBAL_ONLY); |
| 303 #else |
| 304 Tcl_SetVar2(interp, "sqlite_options", "columnmetadata", "0", TCL_GLOBAL_ONLY); |
| 305 #endif |
| 306 |
| 307 #ifdef SQLITE_ENABLE_OVERSIZE_CELL_CHECK |
| 308 Tcl_SetVar2(interp, "sqlite_options", "oversize_cell_check", "1", |
| 309 TCL_GLOBAL_ONLY); |
| 310 #else |
| 311 Tcl_SetVar2(interp, "sqlite_options", "oversize_cell_check", "0", |
| 312 TCL_GLOBAL_ONLY); |
| 313 #endif |
| 314 |
| 315 #ifdef SQLITE_OMIT_COMPILEOPTION_DIAGS |
| 316 Tcl_SetVar2(interp, "sqlite_options", "compileoption_diags", "0", TCL_GLOBAL_O
NLY); |
| 317 #else |
| 318 Tcl_SetVar2(interp, "sqlite_options", "compileoption_diags", "1", TCL_GLOBAL_O
NLY); |
| 319 #endif |
| 320 |
| 321 #ifdef SQLITE_OMIT_COMPLETE |
| 322 Tcl_SetVar2(interp, "sqlite_options", "complete", "0", TCL_GLOBAL_ONLY); |
| 323 #else |
| 324 Tcl_SetVar2(interp, "sqlite_options", "complete", "1", TCL_GLOBAL_ONLY); |
| 325 #endif |
| 326 |
| 327 #ifdef SQLITE_OMIT_COMPOUND_SELECT |
| 328 Tcl_SetVar2(interp, "sqlite_options", "compound", "0", TCL_GLOBAL_ONLY); |
| 329 #else |
| 330 Tcl_SetVar2(interp, "sqlite_options", "compound", "1", TCL_GLOBAL_ONLY); |
| 331 #endif |
| 332 |
| 333 Tcl_SetVar2(interp, "sqlite_options", "conflict", "1", TCL_GLOBAL_ONLY); |
| 334 Tcl_SetVar2(interp, "sqlite_options", "crashtest", "1", TCL_GLOBAL_ONLY); |
| 335 |
| 336 #ifdef SQLITE_OMIT_DATETIME_FUNCS |
| 337 Tcl_SetVar2(interp, "sqlite_options", "datetime", "0", TCL_GLOBAL_ONLY); |
| 338 #else |
| 339 Tcl_SetVar2(interp, "sqlite_options", "datetime", "1", TCL_GLOBAL_ONLY); |
| 340 #endif |
| 341 |
| 342 #ifdef SQLITE_OMIT_DECLTYPE |
| 343 Tcl_SetVar2(interp, "sqlite_options", "decltype", "0", TCL_GLOBAL_ONLY); |
| 344 #else |
| 345 Tcl_SetVar2(interp, "sqlite_options", "decltype", "1", TCL_GLOBAL_ONLY); |
| 346 #endif |
| 347 |
| 348 #ifdef SQLITE_OMIT_DEPRECATED |
| 349 Tcl_SetVar2(interp, "sqlite_options", "deprecated", "0", TCL_GLOBAL_ONLY); |
| 350 #else |
| 351 Tcl_SetVar2(interp, "sqlite_options", "deprecated", "1", TCL_GLOBAL_ONLY); |
| 352 #endif |
| 353 |
| 354 #ifdef SQLITE_OMIT_DISKIO |
| 355 Tcl_SetVar2(interp, "sqlite_options", "diskio", "0", TCL_GLOBAL_ONLY); |
| 356 #else |
| 357 Tcl_SetVar2(interp, "sqlite_options", "diskio", "1", TCL_GLOBAL_ONLY); |
| 358 #endif |
| 359 |
| 360 #ifdef SQLITE_OMIT_EXPLAIN |
| 361 Tcl_SetVar2(interp, "sqlite_options", "explain", "0", TCL_GLOBAL_ONLY); |
| 362 #else |
| 363 Tcl_SetVar2(interp, "sqlite_options", "explain", "1", TCL_GLOBAL_ONLY); |
| 364 #endif |
| 365 |
| 366 #ifdef SQLITE_OMIT_FLOATING_POINT |
| 367 Tcl_SetVar2(interp, "sqlite_options", "floatingpoint", "0", TCL_GLOBAL_ONLY); |
| 368 #else |
| 369 Tcl_SetVar2(interp, "sqlite_options", "floatingpoint", "1", TCL_GLOBAL_ONLY); |
| 370 #endif |
| 371 |
| 372 #ifdef SQLITE_OMIT_FOREIGN_KEY |
| 373 Tcl_SetVar2(interp, "sqlite_options", "foreignkey", "0", TCL_GLOBAL_ONLY); |
| 374 #else |
| 375 Tcl_SetVar2(interp, "sqlite_options", "foreignkey", "1", TCL_GLOBAL_ONLY); |
| 376 #endif |
| 377 |
| 378 #ifdef SQLITE_ENABLE_FTS1 |
| 379 Tcl_SetVar2(interp, "sqlite_options", "fts1", "1", TCL_GLOBAL_ONLY); |
| 380 #else |
| 381 Tcl_SetVar2(interp, "sqlite_options", "fts1", "0", TCL_GLOBAL_ONLY); |
| 382 #endif |
| 383 |
| 384 #ifdef SQLITE_ENABLE_FTS2 |
| 385 Tcl_SetVar2(interp, "sqlite_options", "fts2", "1", TCL_GLOBAL_ONLY); |
| 386 #else |
| 387 Tcl_SetVar2(interp, "sqlite_options", "fts2", "0", TCL_GLOBAL_ONLY); |
| 388 #endif |
| 389 |
| 390 #ifdef SQLITE_ENABLE_FTS3 |
| 391 Tcl_SetVar2(interp, "sqlite_options", "fts3", "1", TCL_GLOBAL_ONLY); |
| 392 #else |
| 393 Tcl_SetVar2(interp, "sqlite_options", "fts3", "0", TCL_GLOBAL_ONLY); |
| 394 #endif |
| 395 |
| 396 #ifdef SQLITE_ENABLE_FTS5 |
| 397 Tcl_SetVar2(interp, "sqlite_options", "fts5", "1", TCL_GLOBAL_ONLY); |
| 398 #else |
| 399 Tcl_SetVar2(interp, "sqlite_options", "fts5", "0", TCL_GLOBAL_ONLY); |
| 400 #endif |
| 401 |
| 402 #if defined(SQLITE_ENABLE_FTS3) && !defined(SQLITE_DISABLE_FTS3_UNICODE) |
| 403 Tcl_SetVar2(interp, "sqlite_options", "fts3_unicode", "1", TCL_GLOBAL_ONLY); |
| 404 #else |
| 405 Tcl_SetVar2(interp, "sqlite_options", "fts3_unicode", "0", TCL_GLOBAL_ONLY); |
| 406 #endif |
| 407 |
| 408 #ifdef SQLITE_DISABLE_FTS4_DEFERRED |
| 409 Tcl_SetVar2(interp, "sqlite_options", "fts4_deferred", "0", TCL_GLOBAL_ONLY); |
| 410 #else |
| 411 Tcl_SetVar2(interp, "sqlite_options", "fts4_deferred", "1", TCL_GLOBAL_ONLY); |
| 412 #endif |
| 413 |
| 414 #ifdef SQLITE_OMIT_GET_TABLE |
| 415 Tcl_SetVar2(interp, "sqlite_options", "gettable", "0", TCL_GLOBAL_ONLY); |
| 416 #else |
| 417 Tcl_SetVar2(interp, "sqlite_options", "gettable", "1", TCL_GLOBAL_ONLY); |
| 418 #endif |
| 419 |
| 420 #ifdef SQLITE_ENABLE_ICU |
| 421 Tcl_SetVar2(interp, "sqlite_options", "icu", "1", TCL_GLOBAL_ONLY); |
| 422 #else |
| 423 Tcl_SetVar2(interp, "sqlite_options", "icu", "0", TCL_GLOBAL_ONLY); |
| 424 #endif |
| 425 |
| 426 #ifdef SQLITE_OMIT_INCRBLOB |
| 427 Tcl_SetVar2(interp, "sqlite_options", "incrblob", "0", TCL_GLOBAL_ONLY); |
| 428 #else |
| 429 Tcl_SetVar2(interp, "sqlite_options", "incrblob", "1", TCL_GLOBAL_ONLY); |
| 430 #endif /* SQLITE_OMIT_AUTOVACUUM */ |
| 431 |
| 432 #ifdef SQLITE_OMIT_INTEGRITY_CHECK |
| 433 Tcl_SetVar2(interp, "sqlite_options", "integrityck", "0", TCL_GLOBAL_ONLY); |
| 434 #else |
| 435 Tcl_SetVar2(interp, "sqlite_options", "integrityck", "1", TCL_GLOBAL_ONLY); |
| 436 #endif |
| 437 |
| 438 #if defined(SQLITE_DEFAULT_FILE_FORMAT) && SQLITE_DEFAULT_FILE_FORMAT==1 |
| 439 Tcl_SetVar2(interp, "sqlite_options", "legacyformat", "1", TCL_GLOBAL_ONLY); |
| 440 #else |
| 441 Tcl_SetVar2(interp, "sqlite_options", "legacyformat", "0", TCL_GLOBAL_ONLY); |
| 442 #endif |
| 443 |
| 444 #ifdef SQLITE_OMIT_LIKE_OPTIMIZATION |
| 445 Tcl_SetVar2(interp, "sqlite_options", "like_opt", "0", TCL_GLOBAL_ONLY); |
| 446 #else |
| 447 Tcl_SetVar2(interp, "sqlite_options", "like_opt", "1", TCL_GLOBAL_ONLY); |
| 448 #endif |
| 449 |
| 450 #ifdef SQLITE_OMIT_LOAD_EXTENSION |
| 451 Tcl_SetVar2(interp, "sqlite_options", "load_ext", "0", TCL_GLOBAL_ONLY); |
| 452 #else |
| 453 Tcl_SetVar2(interp, "sqlite_options", "load_ext", "1", TCL_GLOBAL_ONLY); |
| 454 #endif |
| 455 |
| 456 #ifdef SQLITE_OMIT_LOCALTIME |
| 457 Tcl_SetVar2(interp, "sqlite_options", "localtime", "0", TCL_GLOBAL_ONLY); |
| 458 #else |
| 459 Tcl_SetVar2(interp, "sqlite_options", "localtime", "1", TCL_GLOBAL_ONLY); |
| 460 #endif |
| 461 |
| 462 #ifdef SQLITE_OMIT_LOOKASIDE |
| 463 Tcl_SetVar2(interp, "sqlite_options", "lookaside", "0", TCL_GLOBAL_ONLY); |
| 464 #else |
| 465 Tcl_SetVar2(interp, "sqlite_options", "lookaside", "1", TCL_GLOBAL_ONLY); |
| 466 #endif |
| 467 |
| 468 Tcl_SetVar2(interp, "sqlite_options", "long_double", |
| 469 sizeof(LONGDOUBLE_TYPE)>sizeof(double) ? "1" : "0", |
| 470 TCL_GLOBAL_ONLY); |
| 471 |
| 472 #ifdef SQLITE_OMIT_MEMORYDB |
| 473 Tcl_SetVar2(interp, "sqlite_options", "memorydb", "0", TCL_GLOBAL_ONLY); |
| 474 #else |
| 475 Tcl_SetVar2(interp, "sqlite_options", "memorydb", "1", TCL_GLOBAL_ONLY); |
| 476 #endif |
| 477 |
| 478 #ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT |
| 479 Tcl_SetVar2(interp, "sqlite_options", "memorymanage", "1", TCL_GLOBAL_ONLY); |
| 480 #else |
| 481 Tcl_SetVar2(interp, "sqlite_options", "memorymanage", "0", TCL_GLOBAL_ONLY); |
| 482 #endif |
| 483 |
| 484 Tcl_SetVar2(interp, "sqlite_options", "mergesort", "1", TCL_GLOBAL_ONLY); |
| 485 |
| 486 #ifdef SQLITE_OMIT_OR_OPTIMIZATION |
| 487 Tcl_SetVar2(interp, "sqlite_options", "or_opt", "0", TCL_GLOBAL_ONLY); |
| 488 #else |
| 489 Tcl_SetVar2(interp, "sqlite_options", "or_opt", "1", TCL_GLOBAL_ONLY); |
| 490 #endif |
| 491 |
| 492 #ifdef SQLITE_ENABLE_RBU |
| 493 Tcl_SetVar2(interp, "sqlite_options", "rbu", "1", TCL_GLOBAL_ONLY); |
| 494 #else |
| 495 Tcl_SetVar2(interp, "sqlite_options", "rbu", "0", TCL_GLOBAL_ONLY); |
| 496 #endif |
| 497 |
| 498 #ifdef SQLITE_OMIT_PAGER_PRAGMAS |
| 499 Tcl_SetVar2(interp, "sqlite_options", "pager_pragmas", "0", TCL_GLOBAL_ONLY); |
| 500 #else |
| 501 Tcl_SetVar2(interp, "sqlite_options", "pager_pragmas", "1", TCL_GLOBAL_ONLY); |
| 502 #endif |
| 503 |
| 504 #if defined(SQLITE_OMIT_PRAGMA) || defined(SQLITE_OMIT_FLAG_PRAGMAS) |
| 505 Tcl_SetVar2(interp, "sqlite_options", "pragma", "0", TCL_GLOBAL_ONLY); |
| 506 Tcl_SetVar2(interp, "sqlite_options", "integrityck", "0", TCL_GLOBAL_ONLY); |
| 507 #else |
| 508 Tcl_SetVar2(interp, "sqlite_options", "pragma", "1", TCL_GLOBAL_ONLY); |
| 509 #endif |
| 510 |
| 511 #ifdef SQLITE_OMIT_PROGRESS_CALLBACK |
| 512 Tcl_SetVar2(interp, "sqlite_options", "progress", "0", TCL_GLOBAL_ONLY); |
| 513 #else |
| 514 Tcl_SetVar2(interp, "sqlite_options", "progress", "1", TCL_GLOBAL_ONLY); |
| 515 #endif |
| 516 |
| 517 #ifdef SQLITE_OMIT_REINDEX |
| 518 Tcl_SetVar2(interp, "sqlite_options", "reindex", "0", TCL_GLOBAL_ONLY); |
| 519 #else |
| 520 Tcl_SetVar2(interp, "sqlite_options", "reindex", "1", TCL_GLOBAL_ONLY); |
| 521 #endif |
| 522 |
| 523 #ifdef SQLITE_ENABLE_RTREE |
| 524 Tcl_SetVar2(interp, "sqlite_options", "rtree", "1", TCL_GLOBAL_ONLY); |
| 525 #else |
| 526 Tcl_SetVar2(interp, "sqlite_options", "rtree", "0", TCL_GLOBAL_ONLY); |
| 527 #endif |
| 528 |
| 529 #ifdef SQLITE_RTREE_INT_ONLY |
| 530 Tcl_SetVar2(interp, "sqlite_options", "rtree_int_only", "1", TCL_GLOBAL_ONLY); |
| 531 #else |
| 532 Tcl_SetVar2(interp, "sqlite_options", "rtree_int_only", "0", TCL_GLOBAL_ONLY); |
| 533 #endif |
| 534 |
| 535 #ifdef SQLITE_OMIT_SCHEMA_PRAGMAS |
| 536 Tcl_SetVar2(interp, "sqlite_options", "schema_pragmas", "0", TCL_GLOBAL_ONLY); |
| 537 #else |
| 538 Tcl_SetVar2(interp, "sqlite_options", "schema_pragmas", "1", TCL_GLOBAL_ONLY); |
| 539 #endif |
| 540 |
| 541 #ifdef SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS |
| 542 Tcl_SetVar2(interp, "sqlite_options", "schema_version", "0", TCL_GLOBAL_ONLY); |
| 543 #else |
| 544 Tcl_SetVar2(interp, "sqlite_options", "schema_version", "1", TCL_GLOBAL_ONLY); |
| 545 #endif |
| 546 |
| 547 #ifdef SQLITE_ENABLE_SESSION |
| 548 Tcl_SetVar2(interp, "sqlite_options", "session", "1", TCL_GLOBAL_ONLY); |
| 549 #else |
| 550 Tcl_SetVar2(interp, "sqlite_options", "session", "0", TCL_GLOBAL_ONLY); |
| 551 #endif |
| 552 |
| 553 #ifdef SQLITE_ENABLE_STAT4 |
| 554 Tcl_SetVar2(interp, "sqlite_options", "stat4", "1", TCL_GLOBAL_ONLY); |
| 555 #else |
| 556 Tcl_SetVar2(interp, "sqlite_options", "stat4", "0", TCL_GLOBAL_ONLY); |
| 557 #endif |
| 558 #if defined(SQLITE_ENABLE_STAT3) && !defined(SQLITE_ENABLE_STAT4) |
| 559 Tcl_SetVar2(interp, "sqlite_options", "stat3", "1", TCL_GLOBAL_ONLY); |
| 560 #else |
| 561 Tcl_SetVar2(interp, "sqlite_options", "stat3", "0", TCL_GLOBAL_ONLY); |
| 562 #endif |
| 563 |
| 564 #ifdef SQLITE_ENABLE_STMT_SCANSTATUS |
| 565 Tcl_SetVar2(interp, "sqlite_options", "scanstatus", "1", TCL_GLOBAL_ONLY); |
| 566 #else |
| 567 Tcl_SetVar2(interp, "sqlite_options", "scanstatus", "0", TCL_GLOBAL_ONLY); |
| 568 #endif |
| 569 |
| 570 #if !defined(SQLITE_ENABLE_LOCKING_STYLE) |
| 571 # if defined(__APPLE__) |
| 572 # define SQLITE_ENABLE_LOCKING_STYLE 1 |
| 573 # else |
| 574 # define SQLITE_ENABLE_LOCKING_STYLE 0 |
| 575 # endif |
| 576 #endif |
| 577 #if SQLITE_ENABLE_LOCKING_STYLE && defined(__APPLE__) |
| 578 Tcl_SetVar2(interp,"sqlite_options","lock_proxy_pragmas","1",TCL_GLOBAL_ONLY); |
| 579 #else |
| 580 Tcl_SetVar2(interp,"sqlite_options","lock_proxy_pragmas","0",TCL_GLOBAL_ONLY); |
| 581 #endif |
| 582 #if defined(SQLITE_PREFER_PROXY_LOCKING) && defined(__APPLE__) |
| 583 Tcl_SetVar2(interp,"sqlite_options","prefer_proxy_locking","1",TCL_GLOBAL_ONLY
); |
| 584 #else |
| 585 Tcl_SetVar2(interp,"sqlite_options","prefer_proxy_locking","0",TCL_GLOBAL_ONLY
); |
| 586 #endif |
| 587 |
| 588 |
| 589 #ifdef SQLITE_OMIT_SHARED_CACHE |
| 590 Tcl_SetVar2(interp, "sqlite_options", "shared_cache", "0", TCL_GLOBAL_ONLY); |
| 591 #else |
| 592 Tcl_SetVar2(interp, "sqlite_options", "shared_cache", "1", TCL_GLOBAL_ONLY); |
| 593 #endif |
| 594 |
| 595 #ifdef SQLITE_OMIT_SUBQUERY |
| 596 Tcl_SetVar2(interp, "sqlite_options", "subquery", "0", TCL_GLOBAL_ONLY); |
| 597 #else |
| 598 Tcl_SetVar2(interp, "sqlite_options", "subquery", "1", TCL_GLOBAL_ONLY); |
| 599 #endif |
| 600 |
| 601 #ifdef SQLITE_OMIT_TCL_VARIABLE |
| 602 Tcl_SetVar2(interp, "sqlite_options", "tclvar", "0", TCL_GLOBAL_ONLY); |
| 603 #else |
| 604 Tcl_SetVar2(interp, "sqlite_options", "tclvar", "1", TCL_GLOBAL_ONLY); |
| 605 #endif |
| 606 |
| 607 Tcl_SetVar2(interp, "sqlite_options", "threadsafe", |
| 608 SQLITE_THREADSAFE ? "1" : "0", TCL_GLOBAL_ONLY); |
| 609 Tcl_SetVar2(interp, "sqlite_options", "threadsafe1", |
| 610 SQLITE_THREADSAFE==1 ? "1" : "0", TCL_GLOBAL_ONLY); |
| 611 Tcl_SetVar2(interp, "sqlite_options", "threadsafe2", |
| 612 SQLITE_THREADSAFE==2 ? "1" : "0", TCL_GLOBAL_ONLY); |
| 613 assert( sqlite3_threadsafe()==SQLITE_THREADSAFE ); |
| 614 |
| 615 #ifdef SQLITE_OMIT_TEMPDB |
| 616 Tcl_SetVar2(interp, "sqlite_options", "tempdb", "0", TCL_GLOBAL_ONLY); |
| 617 #else |
| 618 Tcl_SetVar2(interp, "sqlite_options", "tempdb", "1", TCL_GLOBAL_ONLY); |
| 619 #endif |
| 620 |
| 621 #ifdef SQLITE_OMIT_TRACE |
| 622 Tcl_SetVar2(interp, "sqlite_options", "trace", "0", TCL_GLOBAL_ONLY); |
| 623 #else |
| 624 Tcl_SetVar2(interp, "sqlite_options", "trace", "1", TCL_GLOBAL_ONLY); |
| 625 #endif |
| 626 |
| 627 #ifdef SQLITE_OMIT_TRIGGER |
| 628 Tcl_SetVar2(interp, "sqlite_options", "trigger", "0", TCL_GLOBAL_ONLY); |
| 629 #else |
| 630 Tcl_SetVar2(interp, "sqlite_options", "trigger", "1", TCL_GLOBAL_ONLY); |
| 631 #endif |
| 632 |
| 633 #ifdef SQLITE_OMIT_TRUNCATE_OPTIMIZATION |
| 634 Tcl_SetVar2(interp, "sqlite_options", "truncate_opt", "0", TCL_GLOBAL_ONLY); |
| 635 #else |
| 636 Tcl_SetVar2(interp, "sqlite_options", "truncate_opt", "1", TCL_GLOBAL_ONLY); |
| 637 #endif |
| 638 |
| 639 #ifdef SQLITE_OMIT_UTF16 |
| 640 Tcl_SetVar2(interp, "sqlite_options", "utf16", "0", TCL_GLOBAL_ONLY); |
| 641 #else |
| 642 Tcl_SetVar2(interp, "sqlite_options", "utf16", "1", TCL_GLOBAL_ONLY); |
| 643 #endif |
| 644 |
| 645 #if defined(SQLITE_OMIT_VACUUM) || defined(SQLITE_OMIT_ATTACH) |
| 646 Tcl_SetVar2(interp, "sqlite_options", "vacuum", "0", TCL_GLOBAL_ONLY); |
| 647 #else |
| 648 Tcl_SetVar2(interp, "sqlite_options", "vacuum", "1", TCL_GLOBAL_ONLY); |
| 649 #endif |
| 650 |
| 651 #ifdef SQLITE_OMIT_VIEW |
| 652 Tcl_SetVar2(interp, "sqlite_options", "view", "0", TCL_GLOBAL_ONLY); |
| 653 #else |
| 654 Tcl_SetVar2(interp, "sqlite_options", "view", "1", TCL_GLOBAL_ONLY); |
| 655 #endif |
| 656 |
| 657 #ifdef SQLITE_OMIT_VIRTUALTABLE |
| 658 Tcl_SetVar2(interp, "sqlite_options", "vtab", "0", TCL_GLOBAL_ONLY); |
| 659 #else |
| 660 Tcl_SetVar2(interp, "sqlite_options", "vtab", "1", TCL_GLOBAL_ONLY); |
| 661 #endif |
| 662 |
| 663 #ifdef SQLITE_OMIT_WAL |
| 664 Tcl_SetVar2(interp, "sqlite_options", "wal", "0", TCL_GLOBAL_ONLY); |
| 665 #else |
| 666 Tcl_SetVar2(interp, "sqlite_options", "wal", "1", TCL_GLOBAL_ONLY); |
| 667 #endif |
| 668 |
| 669 #ifdef SQLITE_OMIT_WSD |
| 670 Tcl_SetVar2(interp, "sqlite_options", "wsd", "0", TCL_GLOBAL_ONLY); |
| 671 #else |
| 672 Tcl_SetVar2(interp, "sqlite_options", "wsd", "1", TCL_GLOBAL_ONLY); |
| 673 #endif |
| 674 |
| 675 #if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY) |
| 676 Tcl_SetVar2(interp, "sqlite_options", "update_delete_limit", "1", TCL_GLOBAL_O
NLY); |
| 677 #else |
| 678 Tcl_SetVar2(interp, "sqlite_options", "update_delete_limit", "0", TCL_GLOBAL_O
NLY); |
| 679 #endif |
| 680 |
| 681 #if defined(SQLITE_ENABLE_UNLOCK_NOTIFY) |
| 682 Tcl_SetVar2(interp, "sqlite_options", "unlock_notify", "1", TCL_GLOBAL_ONLY); |
| 683 #else |
| 684 Tcl_SetVar2(interp, "sqlite_options", "unlock_notify", "0", TCL_GLOBAL_ONLY); |
| 685 #endif |
| 686 |
| 687 #ifdef SQLITE_SECURE_DELETE |
| 688 Tcl_SetVar2(interp, "sqlite_options", "secure_delete", "1", TCL_GLOBAL_ONLY); |
| 689 #else |
| 690 Tcl_SetVar2(interp, "sqlite_options", "secure_delete", "0", TCL_GLOBAL_ONLY); |
| 691 #endif |
| 692 |
| 693 #ifdef SQLITE_USER_AUTHENTICATION |
| 694 Tcl_SetVar2(interp, "sqlite_options", "userauth", "1", TCL_GLOBAL_ONLY); |
| 695 #else |
| 696 Tcl_SetVar2(interp, "sqlite_options", "userauth", "0", TCL_GLOBAL_ONLY); |
| 697 #endif |
| 698 |
| 699 #ifdef SQLITE_MULTIPLEX_EXT_OVWR |
| 700 Tcl_SetVar2(interp, "sqlite_options", "multiplex_ext_overwrite", "1", TCL_GLOB
AL_ONLY); |
| 701 #else |
| 702 Tcl_SetVar2(interp, "sqlite_options", "multiplex_ext_overwrite", "0", TCL_GLOB
AL_ONLY); |
| 703 #endif |
| 704 |
| 705 #ifdef YYTRACKMAXSTACKDEPTH |
| 706 Tcl_SetVar2(interp, "sqlite_options", "yytrackmaxstackdepth", "1", TCL_GLOBAL_
ONLY); |
| 707 #else |
| 708 Tcl_SetVar2(interp, "sqlite_options", "yytrackmaxstackdepth", "0", TCL_GLOBAL_
ONLY); |
| 709 #endif |
| 710 |
| 711 #ifdef SQLITE_ENABLE_SQLLOG |
| 712 Tcl_SetVar2(interp, "sqlite_options", "sqllog", "1", TCL_GLOBAL_ONLY); |
| 713 #else |
| 714 Tcl_SetVar2(interp, "sqlite_options", "sqllog", "0", TCL_GLOBAL_ONLY); |
| 715 #endif |
| 716 |
| 717 #ifdef SQLITE_ENABLE_URI_00_ERROR |
| 718 Tcl_SetVar2(interp, "sqlite_options", "uri_00_error", "1", TCL_GLOBAL_ONLY); |
| 719 #else |
| 720 Tcl_SetVar2(interp, "sqlite_options", "uri_00_error", "0", TCL_GLOBAL_ONLY); |
| 721 #endif |
| 722 |
| 723 #define LINKVAR(x) { \ |
| 724 static const int cv_ ## x = SQLITE_ ## x; \ |
| 725 Tcl_LinkVar(interp, "SQLITE_" #x, (char *)&(cv_ ## x), \ |
| 726 TCL_LINK_INT | TCL_LINK_READ_ONLY); } |
| 727 |
| 728 LINKVAR( MAX_LENGTH ); |
| 729 LINKVAR( MAX_COLUMN ); |
| 730 LINKVAR( MAX_SQL_LENGTH ); |
| 731 LINKVAR( MAX_EXPR_DEPTH ); |
| 732 LINKVAR( MAX_COMPOUND_SELECT ); |
| 733 LINKVAR( MAX_VDBE_OP ); |
| 734 LINKVAR( MAX_FUNCTION_ARG ); |
| 735 LINKVAR( MAX_VARIABLE_NUMBER ); |
| 736 LINKVAR( MAX_PAGE_SIZE ); |
| 737 LINKVAR( MAX_PAGE_COUNT ); |
| 738 LINKVAR( MAX_LIKE_PATTERN_LENGTH ); |
| 739 LINKVAR( MAX_TRIGGER_DEPTH ); |
| 740 LINKVAR( DEFAULT_CACHE_SIZE ); |
| 741 LINKVAR( DEFAULT_PAGE_SIZE ); |
| 742 LINKVAR( DEFAULT_FILE_FORMAT ); |
| 743 LINKVAR( MAX_ATTACHED ); |
| 744 LINKVAR( MAX_DEFAULT_PAGE_SIZE ); |
| 745 LINKVAR( MAX_WORKER_THREADS ); |
| 746 |
| 747 { |
| 748 static const int cv_TEMP_STORE = SQLITE_TEMP_STORE; |
| 749 Tcl_LinkVar(interp, "TEMP_STORE", (char *)&(cv_TEMP_STORE), |
| 750 TCL_LINK_INT | TCL_LINK_READ_ONLY); |
| 751 } |
| 752 |
| 753 #ifdef _MSC_VER |
| 754 { |
| 755 static const int cv__MSC_VER = 1; |
| 756 Tcl_LinkVar(interp, "_MSC_VER", (char *)&(cv__MSC_VER), |
| 757 TCL_LINK_INT | TCL_LINK_READ_ONLY); |
| 758 } |
| 759 #endif |
| 760 #ifdef __GNUC__ |
| 761 { |
| 762 static const int cv___GNUC__ = 1; |
| 763 Tcl_LinkVar(interp, "__GNUC__", (char *)&(cv___GNUC__), |
| 764 TCL_LINK_INT | TCL_LINK_READ_ONLY); |
| 765 } |
| 766 #endif |
| 767 } |
| 768 |
| 769 |
| 770 /* |
| 771 ** Register commands with the TCL interpreter. |
| 772 */ |
| 773 int Sqliteconfig_Init(Tcl_Interp *interp){ |
| 774 set_options(interp); |
| 775 return TCL_OK; |
| 776 } |
OLD | NEW |