| OLD | NEW |
| 1 /* | 1 /* |
| 2 ** 2007 May 7 | 2 ** 2007 May 7 |
| 3 ** | 3 ** |
| 4 ** The author disclaims copyright to this source code. In place of | 4 ** The author disclaims copyright to this source code. In place of |
| 5 ** a legal notice, here is a blessing: | 5 ** a legal notice, here is a blessing: |
| 6 ** | 6 ** |
| 7 ** May you do good and not evil. | 7 ** May you do good and not evil. |
| 8 ** May you find forgiveness for yourself and forgive others. | 8 ** May you find forgiveness for yourself and forgive others. |
| 9 ** May you share freely, never taking more than you give. | 9 ** May you share freely, never taking more than you give. |
| 10 ** | 10 ** |
| 11 ************************************************************************* | 11 ************************************************************************* |
| 12 ** | 12 ** |
| 13 ** This file contains code used for testing the SQLite system. | 13 ** This file contains code used for testing the SQLite system. |
| 14 ** None of the code in this file goes into a deliverable build. | 14 ** None of the code in this file goes into a deliverable build. |
| 15 ** | 15 ** |
| 16 ** The focus of this file is providing the TCL testing layer | 16 ** The focus of this file is providing the TCL testing layer |
| 17 ** access to compile-time constants. | 17 ** access to compile-time constants. |
| 18 */ | 18 */ |
| 19 | 19 |
| 20 #include "sqliteLimit.h" | 20 #include "sqliteLimit.h" |
| 21 | 21 |
| 22 #include "sqliteInt.h" | 22 #include "sqliteInt.h" |
| 23 #if SQLITE_OS_WIN | 23 #if SQLITE_OS_WIN |
| 24 # include "os_win.h" | 24 # include "os_win.h" |
| 25 #endif | 25 #endif |
| 26 | 26 |
| 27 #include "tcl.h" | 27 #if defined(INCLUDE_SQLITE_TCL_H) |
| 28 # include "sqlite_tcl.h" |
| 29 #else |
| 30 # include "tcl.h" |
| 31 #endif |
| 28 #include <stdlib.h> | 32 #include <stdlib.h> |
| 29 #include <string.h> | 33 #include <string.h> |
| 30 | 34 |
| 31 /* | 35 /* |
| 32 ** Macro to stringify the results of the evaluation a pre-processor | 36 ** Macro to stringify the results of the evaluation a pre-processor |
| 33 ** macro. i.e. so that STRINGVALUE(SQLITE_NOMEM) -> "7". | 37 ** macro. i.e. so that STRINGVALUE(SQLITE_NOMEM) -> "7". |
| 34 */ | 38 */ |
| 35 #define STRINGVALUE2(x) #x | 39 #define STRINGVALUE2(x) #x |
| 36 #define STRINGVALUE(x) STRINGVALUE2(x) | 40 #define STRINGVALUE(x) STRINGVALUE2(x) |
| 37 | 41 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 #else | 76 #else |
| 73 Tcl_SetVar2(interp, "sqlite_options", "win32malloc", "0", TCL_GLOBAL_ONLY); | 77 Tcl_SetVar2(interp, "sqlite_options", "win32malloc", "0", TCL_GLOBAL_ONLY); |
| 74 #endif | 78 #endif |
| 75 | 79 |
| 76 #ifdef SQLITE_DEBUG | 80 #ifdef SQLITE_DEBUG |
| 77 Tcl_SetVar2(interp, "sqlite_options", "debug", "1", TCL_GLOBAL_ONLY); | 81 Tcl_SetVar2(interp, "sqlite_options", "debug", "1", TCL_GLOBAL_ONLY); |
| 78 #else | 82 #else |
| 79 Tcl_SetVar2(interp, "sqlite_options", "debug", "0", TCL_GLOBAL_ONLY); | 83 Tcl_SetVar2(interp, "sqlite_options", "debug", "0", TCL_GLOBAL_ONLY); |
| 80 #endif | 84 #endif |
| 81 | 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 |
| 82 #ifdef SQLITE_DIRECT_OVERFLOW_READ | 93 #ifdef SQLITE_DIRECT_OVERFLOW_READ |
| 83 Tcl_SetVar2(interp, "sqlite_options", "direct_read", "1", TCL_GLOBAL_ONLY); | 94 Tcl_SetVar2(interp, "sqlite_options", "direct_read", "1", TCL_GLOBAL_ONLY); |
| 84 #else | 95 #else |
| 85 Tcl_SetVar2(interp, "sqlite_options", "direct_read", "0", TCL_GLOBAL_ONLY); | 96 Tcl_SetVar2(interp, "sqlite_options", "direct_read", "0", TCL_GLOBAL_ONLY); |
| 86 #endif | 97 #endif |
| 87 | 98 |
| 88 #ifdef SQLITE_DISABLE_DIRSYNC | 99 #ifdef SQLITE_DISABLE_DIRSYNC |
| 89 Tcl_SetVar2(interp, "sqlite_options", "dirsync", "0", TCL_GLOBAL_ONLY); | 100 Tcl_SetVar2(interp, "sqlite_options", "dirsync", "0", TCL_GLOBAL_ONLY); |
| 90 #else | 101 #else |
| 91 Tcl_SetVar2(interp, "sqlite_options", "dirsync", "1", TCL_GLOBAL_ONLY); | 102 Tcl_SetVar2(interp, "sqlite_options", "dirsync", "1", TCL_GLOBAL_ONLY); |
| 92 #endif | 103 #endif |
| 93 | 104 |
| 94 #ifdef SQLITE_DISABLE_LFS | 105 #ifdef SQLITE_DISABLE_LFS |
| 95 Tcl_SetVar2(interp, "sqlite_options", "lfs", "0", TCL_GLOBAL_ONLY); | 106 Tcl_SetVar2(interp, "sqlite_options", "lfs", "0", TCL_GLOBAL_ONLY); |
| 96 #else | 107 #else |
| 97 Tcl_SetVar2(interp, "sqlite_options", "lfs", "1", TCL_GLOBAL_ONLY); | 108 Tcl_SetVar2(interp, "sqlite_options", "lfs", "1", TCL_GLOBAL_ONLY); |
| 98 #endif | 109 #endif |
| 99 | 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 |
| 100 #if SQLITE_MAX_MMAP_SIZE>0 | 117 #if SQLITE_MAX_MMAP_SIZE>0 |
| 101 Tcl_SetVar2(interp, "sqlite_options", "mmap", "1", TCL_GLOBAL_ONLY); | 118 Tcl_SetVar2(interp, "sqlite_options", "mmap", "1", TCL_GLOBAL_ONLY); |
| 102 #else | 119 #else |
| 103 Tcl_SetVar2(interp, "sqlite_options", "mmap", "0", TCL_GLOBAL_ONLY); | 120 Tcl_SetVar2(interp, "sqlite_options", "mmap", "0", TCL_GLOBAL_ONLY); |
| 104 #endif | 121 #endif |
| 105 | 122 |
| 106 Tcl_SetVar2(interp, "sqlite_options", "worker_threads", | 123 Tcl_SetVar2(interp, "sqlite_options", "worker_threads", |
| 107 STRINGVALUE(SQLITE_MAX_WORKER_THREADS), TCL_GLOBAL_ONLY | 124 STRINGVALUE(SQLITE_MAX_WORKER_THREADS), TCL_GLOBAL_ONLY |
| 108 ); | 125 ); |
| 109 | 126 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 136 #else | 153 #else |
| 137 Tcl_SetVar2(interp, "sqlite_options", "mem3", "0", TCL_GLOBAL_ONLY); | 154 Tcl_SetVar2(interp, "sqlite_options", "mem3", "0", TCL_GLOBAL_ONLY); |
| 138 #endif | 155 #endif |
| 139 | 156 |
| 140 #ifdef SQLITE_ENABLE_MEMSYS5 | 157 #ifdef SQLITE_ENABLE_MEMSYS5 |
| 141 Tcl_SetVar2(interp, "sqlite_options", "mem5", "1", TCL_GLOBAL_ONLY); | 158 Tcl_SetVar2(interp, "sqlite_options", "mem5", "1", TCL_GLOBAL_ONLY); |
| 142 #else | 159 #else |
| 143 Tcl_SetVar2(interp, "sqlite_options", "mem5", "0", TCL_GLOBAL_ONLY); | 160 Tcl_SetVar2(interp, "sqlite_options", "mem5", "0", TCL_GLOBAL_ONLY); |
| 144 #endif | 161 #endif |
| 145 | 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 |
| 146 #ifdef SQLITE_ENABLE_SNAPSHOT | 169 #ifdef SQLITE_ENABLE_SNAPSHOT |
| 147 Tcl_SetVar2(interp, "sqlite_options", "snapshot", "1", TCL_GLOBAL_ONLY); | 170 Tcl_SetVar2(interp, "sqlite_options", "snapshot", "1", TCL_GLOBAL_ONLY); |
| 148 #else | 171 #else |
| 149 Tcl_SetVar2(interp, "sqlite_options", "snapshot", "0", TCL_GLOBAL_ONLY); | 172 Tcl_SetVar2(interp, "sqlite_options", "snapshot", "0", TCL_GLOBAL_ONLY); |
| 150 #endif | 173 #endif |
| 151 | 174 |
| 152 #ifdef SQLITE_MUTEX_OMIT | 175 #ifdef SQLITE_MUTEX_OMIT |
| 153 Tcl_SetVar2(interp, "sqlite_options", "mutex", "0", TCL_GLOBAL_ONLY); | 176 Tcl_SetVar2(interp, "sqlite_options", "mutex", "0", TCL_GLOBAL_ONLY); |
| 154 #else | 177 #else |
| 155 Tcl_SetVar2(interp, "sqlite_options", "mutex", "1", TCL_GLOBAL_ONLY); | 178 Tcl_SetVar2(interp, "sqlite_options", "mutex", "1", TCL_GLOBAL_ONLY); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 Tcl_SetVar2(interp, "sqlite_options", "default_autovacuum", | 261 Tcl_SetVar2(interp, "sqlite_options", "default_autovacuum", |
| 239 STRINGVALUE(SQLITE_DEFAULT_AUTOVACUUM), TCL_GLOBAL_ONLY); | 262 STRINGVALUE(SQLITE_DEFAULT_AUTOVACUUM), TCL_GLOBAL_ONLY); |
| 240 #endif | 263 #endif |
| 241 | 264 |
| 242 #ifdef SQLITE_OMIT_BETWEEN_OPTIMIZATION | 265 #ifdef SQLITE_OMIT_BETWEEN_OPTIMIZATION |
| 243 Tcl_SetVar2(interp, "sqlite_options", "between_opt", "0", TCL_GLOBAL_ONLY); | 266 Tcl_SetVar2(interp, "sqlite_options", "between_opt", "0", TCL_GLOBAL_ONLY); |
| 244 #else | 267 #else |
| 245 Tcl_SetVar2(interp, "sqlite_options", "between_opt", "1", TCL_GLOBAL_ONLY); | 268 Tcl_SetVar2(interp, "sqlite_options", "between_opt", "1", TCL_GLOBAL_ONLY); |
| 246 #endif | 269 #endif |
| 247 | 270 |
| 248 #ifdef SQLITE_OMIT_BUILTIN_TEST | 271 #ifdef SQLITE_UNTESTABLE |
| 249 Tcl_SetVar2(interp, "sqlite_options", "builtin_test", "0", TCL_GLOBAL_ONLY); | 272 Tcl_SetVar2(interp, "sqlite_options", "builtin_test", "0", TCL_GLOBAL_ONLY); |
| 250 #else | 273 #else |
| 251 Tcl_SetVar2(interp, "sqlite_options", "builtin_test", "1", TCL_GLOBAL_ONLY); | 274 Tcl_SetVar2(interp, "sqlite_options", "builtin_test", "1", TCL_GLOBAL_ONLY); |
| 252 #endif | 275 #endif |
| 253 | 276 |
| 254 #ifdef SQLITE_OMIT_BLOB_LITERAL | 277 #ifdef SQLITE_OMIT_BLOB_LITERAL |
| 255 Tcl_SetVar2(interp, "sqlite_options", "bloblit", "0", TCL_GLOBAL_ONLY); | 278 Tcl_SetVar2(interp, "sqlite_options", "bloblit", "0", TCL_GLOBAL_ONLY); |
| 256 #else | 279 #else |
| 257 Tcl_SetVar2(interp, "sqlite_options", "bloblit", "1", TCL_GLOBAL_ONLY); | 280 Tcl_SetVar2(interp, "sqlite_options", "bloblit", "1", TCL_GLOBAL_ONLY); |
| 258 #endif | 281 #endif |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 #else | 537 #else |
| 515 Tcl_SetVar2(interp, "sqlite_options", "schema_pragmas", "1", TCL_GLOBAL_ONLY); | 538 Tcl_SetVar2(interp, "sqlite_options", "schema_pragmas", "1", TCL_GLOBAL_ONLY); |
| 516 #endif | 539 #endif |
| 517 | 540 |
| 518 #ifdef SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS | 541 #ifdef SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS |
| 519 Tcl_SetVar2(interp, "sqlite_options", "schema_version", "0", TCL_GLOBAL_ONLY); | 542 Tcl_SetVar2(interp, "sqlite_options", "schema_version", "0", TCL_GLOBAL_ONLY); |
| 520 #else | 543 #else |
| 521 Tcl_SetVar2(interp, "sqlite_options", "schema_version", "1", TCL_GLOBAL_ONLY); | 544 Tcl_SetVar2(interp, "sqlite_options", "schema_version", "1", TCL_GLOBAL_ONLY); |
| 522 #endif | 545 #endif |
| 523 | 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 |
| 524 #ifdef SQLITE_ENABLE_STAT4 | 553 #ifdef SQLITE_ENABLE_STAT4 |
| 525 Tcl_SetVar2(interp, "sqlite_options", "stat4", "1", TCL_GLOBAL_ONLY); | 554 Tcl_SetVar2(interp, "sqlite_options", "stat4", "1", TCL_GLOBAL_ONLY); |
| 526 #else | 555 #else |
| 527 Tcl_SetVar2(interp, "sqlite_options", "stat4", "0", TCL_GLOBAL_ONLY); | 556 Tcl_SetVar2(interp, "sqlite_options", "stat4", "0", TCL_GLOBAL_ONLY); |
| 528 #endif | 557 #endif |
| 529 #if defined(SQLITE_ENABLE_STAT3) && !defined(SQLITE_ENABLE_STAT4) | 558 #if defined(SQLITE_ENABLE_STAT3) && !defined(SQLITE_ENABLE_STAT4) |
| 530 Tcl_SetVar2(interp, "sqlite_options", "stat3", "1", TCL_GLOBAL_ONLY); | 559 Tcl_SetVar2(interp, "sqlite_options", "stat3", "1", TCL_GLOBAL_ONLY); |
| 531 #else | 560 #else |
| 532 Tcl_SetVar2(interp, "sqlite_options", "stat3", "0", TCL_GLOBAL_ONLY); | 561 Tcl_SetVar2(interp, "sqlite_options", "stat3", "0", TCL_GLOBAL_ONLY); |
| 533 #endif | 562 #endif |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 Tcl_SetVar2(interp, "sqlite_options", "subquery", "1", TCL_GLOBAL_ONLY); | 598 Tcl_SetVar2(interp, "sqlite_options", "subquery", "1", TCL_GLOBAL_ONLY); |
| 570 #endif | 599 #endif |
| 571 | 600 |
| 572 #ifdef SQLITE_OMIT_TCL_VARIABLE | 601 #ifdef SQLITE_OMIT_TCL_VARIABLE |
| 573 Tcl_SetVar2(interp, "sqlite_options", "tclvar", "0", TCL_GLOBAL_ONLY); | 602 Tcl_SetVar2(interp, "sqlite_options", "tclvar", "0", TCL_GLOBAL_ONLY); |
| 574 #else | 603 #else |
| 575 Tcl_SetVar2(interp, "sqlite_options", "tclvar", "1", TCL_GLOBAL_ONLY); | 604 Tcl_SetVar2(interp, "sqlite_options", "tclvar", "1", TCL_GLOBAL_ONLY); |
| 576 #endif | 605 #endif |
| 577 | 606 |
| 578 Tcl_SetVar2(interp, "sqlite_options", "threadsafe", | 607 Tcl_SetVar2(interp, "sqlite_options", "threadsafe", |
| 579 STRINGVALUE(SQLITE_THREADSAFE), TCL_GLOBAL_ONLY); | 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); |
| 580 assert( sqlite3_threadsafe()==SQLITE_THREADSAFE ); | 613 assert( sqlite3_threadsafe()==SQLITE_THREADSAFE ); |
| 581 | 614 |
| 582 #ifdef SQLITE_OMIT_TEMPDB | 615 #ifdef SQLITE_OMIT_TEMPDB |
| 583 Tcl_SetVar2(interp, "sqlite_options", "tempdb", "0", TCL_GLOBAL_ONLY); | 616 Tcl_SetVar2(interp, "sqlite_options", "tempdb", "0", TCL_GLOBAL_ONLY); |
| 584 #else | 617 #else |
| 585 Tcl_SetVar2(interp, "sqlite_options", "tempdb", "1", TCL_GLOBAL_ONLY); | 618 Tcl_SetVar2(interp, "sqlite_options", "tempdb", "1", TCL_GLOBAL_ONLY); |
| 586 #endif | 619 #endif |
| 587 | 620 |
| 588 #ifdef SQLITE_OMIT_TRACE | 621 #ifdef SQLITE_OMIT_TRACE |
| 589 Tcl_SetVar2(interp, "sqlite_options", "trace", "0", TCL_GLOBAL_ONLY); | 622 Tcl_SetVar2(interp, "sqlite_options", "trace", "0", TCL_GLOBAL_ONLY); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 674 #else | 707 #else |
| 675 Tcl_SetVar2(interp, "sqlite_options", "yytrackmaxstackdepth", "0", TCL_GLOBAL_
ONLY); | 708 Tcl_SetVar2(interp, "sqlite_options", "yytrackmaxstackdepth", "0", TCL_GLOBAL_
ONLY); |
| 676 #endif | 709 #endif |
| 677 | 710 |
| 678 #ifdef SQLITE_ENABLE_SQLLOG | 711 #ifdef SQLITE_ENABLE_SQLLOG |
| 679 Tcl_SetVar2(interp, "sqlite_options", "sqllog", "1", TCL_GLOBAL_ONLY); | 712 Tcl_SetVar2(interp, "sqlite_options", "sqllog", "1", TCL_GLOBAL_ONLY); |
| 680 #else | 713 #else |
| 681 Tcl_SetVar2(interp, "sqlite_options", "sqllog", "0", TCL_GLOBAL_ONLY); | 714 Tcl_SetVar2(interp, "sqlite_options", "sqllog", "0", TCL_GLOBAL_ONLY); |
| 682 #endif | 715 #endif |
| 683 | 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 |
| 684 #define LINKVAR(x) { \ | 723 #define LINKVAR(x) { \ |
| 685 static const int cv_ ## x = SQLITE_ ## x; \ | 724 static const int cv_ ## x = SQLITE_ ## x; \ |
| 686 Tcl_LinkVar(interp, "SQLITE_" #x, (char *)&(cv_ ## x), \ | 725 Tcl_LinkVar(interp, "SQLITE_" #x, (char *)&(cv_ ## x), \ |
| 687 TCL_LINK_INT | TCL_LINK_READ_ONLY); } | 726 TCL_LINK_INT | TCL_LINK_READ_ONLY); } |
| 688 | 727 |
| 689 LINKVAR( MAX_LENGTH ); | 728 LINKVAR( MAX_LENGTH ); |
| 690 LINKVAR( MAX_COLUMN ); | 729 LINKVAR( MAX_COLUMN ); |
| 691 LINKVAR( MAX_SQL_LENGTH ); | 730 LINKVAR( MAX_SQL_LENGTH ); |
| 692 LINKVAR( MAX_EXPR_DEPTH ); | 731 LINKVAR( MAX_EXPR_DEPTH ); |
| 693 LINKVAR( MAX_COMPOUND_SELECT ); | 732 LINKVAR( MAX_COMPOUND_SELECT ); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 728 } | 767 } |
| 729 | 768 |
| 730 | 769 |
| 731 /* | 770 /* |
| 732 ** Register commands with the TCL interpreter. | 771 ** Register commands with the TCL interpreter. |
| 733 */ | 772 */ |
| 734 int Sqliteconfig_Init(Tcl_Interp *interp){ | 773 int Sqliteconfig_Init(Tcl_Interp *interp){ |
| 735 set_options(interp); | 774 set_options(interp); |
| 736 return TCL_OK; | 775 return TCL_OK; |
| 737 } | 776 } |
| OLD | NEW |