| 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 #include "tcl.h" | |
| 28 #include <stdlib.h> | |
| 29 #include <string.h> | |
| 30 | |
| 31 /* | |
| 32 ** Macro to stringify the results of the evaluation a pre-processor | |
| 33 ** macro. i.e. so that STRINGVALUE(SQLITE_NOMEM) -> "7". | |
| 34 */ | |
| 35 #define STRINGVALUE2(x) #x | |
| 36 #define STRINGVALUE(x) STRINGVALUE2(x) | |
| 37 | |
| 38 /* | |
| 39 ** This routine sets entries in the global ::sqlite_options() array variable | |
| 40 ** according to the compile-time configuration of the database. Test | |
| 41 ** procedures use this to determine when tests should be omitted. | |
| 42 */ | |
| 43 static void set_options(Tcl_Interp *interp){ | |
| 44 #if HAVE_MALLOC_USABLE_SIZE | |
| 45 Tcl_SetVar2(interp, "sqlite_options", "malloc_usable_size", "1", | |
| 46 TCL_GLOBAL_ONLY); | |
| 47 #else | |
| 48 Tcl_SetVar2(interp, "sqlite_options", "malloc_usable_size", "0", | |
| 49 TCL_GLOBAL_ONLY); | |
| 50 #endif | |
| 51 | |
| 52 #ifdef SQLITE_32BIT_ROWID | |
| 53 Tcl_SetVar2(interp, "sqlite_options", "rowid32", "1", TCL_GLOBAL_ONLY); | |
| 54 #else | |
| 55 Tcl_SetVar2(interp, "sqlite_options", "rowid32", "0", TCL_GLOBAL_ONLY); | |
| 56 #endif | |
| 57 | |
| 58 #ifdef SQLITE_CASE_SENSITIVE_LIKE | |
| 59 Tcl_SetVar2(interp, "sqlite_options","casesensitivelike","1",TCL_GLOBAL_ONLY); | |
| 60 #else | |
| 61 Tcl_SetVar2(interp, "sqlite_options","casesensitivelike","0",TCL_GLOBAL_ONLY); | |
| 62 #endif | |
| 63 | |
| 64 #if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT | |
| 65 Tcl_SetVar2(interp, "sqlite_options", "curdir", "1", TCL_GLOBAL_ONLY); | |
| 66 #else | |
| 67 Tcl_SetVar2(interp, "sqlite_options", "curdir", "0", TCL_GLOBAL_ONLY); | |
| 68 #endif | |
| 69 | |
| 70 #ifdef SQLITE_WIN32_MALLOC | |
| 71 Tcl_SetVar2(interp, "sqlite_options", "win32malloc", "1", TCL_GLOBAL_ONLY); | |
| 72 #else | |
| 73 Tcl_SetVar2(interp, "sqlite_options", "win32malloc", "0", TCL_GLOBAL_ONLY); | |
| 74 #endif | |
| 75 | |
| 76 #ifdef SQLITE_DEBUG | |
| 77 Tcl_SetVar2(interp, "sqlite_options", "debug", "1", TCL_GLOBAL_ONLY); | |
| 78 #else | |
| 79 Tcl_SetVar2(interp, "sqlite_options", "debug", "0", TCL_GLOBAL_ONLY); | |
| 80 #endif | |
| 81 | |
| 82 #ifdef SQLITE_DIRECT_OVERFLOW_READ | |
| 83 Tcl_SetVar2(interp, "sqlite_options", "direct_read", "1", TCL_GLOBAL_ONLY); | |
| 84 #else | |
| 85 Tcl_SetVar2(interp, "sqlite_options", "direct_read", "0", TCL_GLOBAL_ONLY); | |
| 86 #endif | |
| 87 | |
| 88 #ifdef SQLITE_DISABLE_DIRSYNC | |
| 89 Tcl_SetVar2(interp, "sqlite_options", "dirsync", "0", TCL_GLOBAL_ONLY); | |
| 90 #else | |
| 91 Tcl_SetVar2(interp, "sqlite_options", "dirsync", "1", TCL_GLOBAL_ONLY); | |
| 92 #endif | |
| 93 | |
| 94 #ifdef SQLITE_DISABLE_LFS | |
| 95 Tcl_SetVar2(interp, "sqlite_options", "lfs", "0", TCL_GLOBAL_ONLY); | |
| 96 #else | |
| 97 Tcl_SetVar2(interp, "sqlite_options", "lfs", "1", TCL_GLOBAL_ONLY); | |
| 98 #endif | |
| 99 | |
| 100 #if SQLITE_MAX_MMAP_SIZE>0 | |
| 101 Tcl_SetVar2(interp, "sqlite_options", "mmap", "1", TCL_GLOBAL_ONLY); | |
| 102 #else | |
| 103 Tcl_SetVar2(interp, "sqlite_options", "mmap", "0", TCL_GLOBAL_ONLY); | |
| 104 #endif | |
| 105 | |
| 106 Tcl_SetVar2(interp, "sqlite_options", "worker_threads", | |
| 107 STRINGVALUE(SQLITE_MAX_WORKER_THREADS), TCL_GLOBAL_ONLY | |
| 108 ); | |
| 109 | |
| 110 #if 1 /* def SQLITE_MEMDEBUG */ | |
| 111 Tcl_SetVar2(interp, "sqlite_options", "memdebug", "1", TCL_GLOBAL_ONLY); | |
| 112 #else | |
| 113 Tcl_SetVar2(interp, "sqlite_options", "memdebug", "0", TCL_GLOBAL_ONLY); | |
| 114 #endif | |
| 115 | |
| 116 #ifdef SQLITE_ENABLE_8_3_NAMES | |
| 117 Tcl_SetVar2(interp, "sqlite_options", "8_3_names", "1", TCL_GLOBAL_ONLY); | |
| 118 #else | |
| 119 Tcl_SetVar2(interp, "sqlite_options", "8_3_names", "0", TCL_GLOBAL_ONLY); | |
| 120 #endif | |
| 121 | |
| 122 #ifdef SQLITE_ENABLE_CURSOR_HINTS | |
| 123 Tcl_SetVar2(interp, "sqlite_options", "cursorhints", "1", TCL_GLOBAL_ONLY); | |
| 124 #else | |
| 125 Tcl_SetVar2(interp, "sqlite_options", "cursorhints", "0", TCL_GLOBAL_ONLY); | |
| 126 #endif | |
| 127 | |
| 128 #ifdef SQLITE_ENABLE_HIDDEN_COLUMNS | |
| 129 Tcl_SetVar2(interp, "sqlite_options", "hiddencolumns", "1", TCL_GLOBAL_ONLY); | |
| 130 #else | |
| 131 Tcl_SetVar2(interp, "sqlite_options", "hiddencolumns", "0", TCL_GLOBAL_ONLY); | |
| 132 #endif | |
| 133 | |
| 134 #ifdef SQLITE_ENABLE_MEMSYS3 | |
| 135 Tcl_SetVar2(interp, "sqlite_options", "mem3", "1", TCL_GLOBAL_ONLY); | |
| 136 #else | |
| 137 Tcl_SetVar2(interp, "sqlite_options", "mem3", "0", TCL_GLOBAL_ONLY); | |
| 138 #endif | |
| 139 | |
| 140 #ifdef SQLITE_ENABLE_MEMSYS5 | |
| 141 Tcl_SetVar2(interp, "sqlite_options", "mem5", "1", TCL_GLOBAL_ONLY); | |
| 142 #else | |
| 143 Tcl_SetVar2(interp, "sqlite_options", "mem5", "0", TCL_GLOBAL_ONLY); | |
| 144 #endif | |
| 145 | |
| 146 #ifdef SQLITE_ENABLE_SNAPSHOT | |
| 147 Tcl_SetVar2(interp, "sqlite_options", "snapshot", "1", TCL_GLOBAL_ONLY); | |
| 148 #else | |
| 149 Tcl_SetVar2(interp, "sqlite_options", "snapshot", "0", TCL_GLOBAL_ONLY); | |
| 150 #endif | |
| 151 | |
| 152 #ifdef SQLITE_MUTEX_OMIT | |
| 153 Tcl_SetVar2(interp, "sqlite_options", "mutex", "0", TCL_GLOBAL_ONLY); | |
| 154 #else | |
| 155 Tcl_SetVar2(interp, "sqlite_options", "mutex", "1", TCL_GLOBAL_ONLY); | |
| 156 #endif | |
| 157 | |
| 158 #ifdef SQLITE_MUTEX_NOOP | |
| 159 Tcl_SetVar2(interp, "sqlite_options", "mutex_noop", "1", TCL_GLOBAL_ONLY); | |
| 160 #else | |
| 161 Tcl_SetVar2(interp, "sqlite_options", "mutex_noop", "0", TCL_GLOBAL_ONLY); | |
| 162 #endif | |
| 163 | |
| 164 #ifdef SQLITE_OMIT_ALTERTABLE | |
| 165 Tcl_SetVar2(interp, "sqlite_options", "altertable", "0", TCL_GLOBAL_ONLY); | |
| 166 #else | |
| 167 Tcl_SetVar2(interp, "sqlite_options", "altertable", "1", TCL_GLOBAL_ONLY); | |
| 168 #endif | |
| 169 | |
| 170 #ifdef SQLITE_OMIT_ANALYZE | |
| 171 Tcl_SetVar2(interp, "sqlite_options", "analyze", "0", TCL_GLOBAL_ONLY); | |
| 172 #else | |
| 173 Tcl_SetVar2(interp, "sqlite_options", "analyze", "1", TCL_GLOBAL_ONLY); | |
| 174 #endif | |
| 175 | |
| 176 #ifdef SQLITE_ENABLE_API_ARMOR | |
| 177 Tcl_SetVar2(interp, "sqlite_options", "api_armor", "1", TCL_GLOBAL_ONLY); | |
| 178 #else | |
| 179 Tcl_SetVar2(interp, "sqlite_options", "api_armor", "0", TCL_GLOBAL_ONLY); | |
| 180 #endif | |
| 181 | |
| 182 #ifdef SQLITE_ENABLE_ATOMIC_WRITE | |
| 183 Tcl_SetVar2(interp, "sqlite_options", "atomicwrite", "1", TCL_GLOBAL_ONLY); | |
| 184 #else | |
| 185 Tcl_SetVar2(interp, "sqlite_options", "atomicwrite", "0", TCL_GLOBAL_ONLY); | |
| 186 #endif | |
| 187 | |
| 188 #ifdef SQLITE_ENABLE_JSON1 | |
| 189 Tcl_SetVar2(interp, "sqlite_options", "json1", "1", TCL_GLOBAL_ONLY); | |
| 190 #else | |
| 191 Tcl_SetVar2(interp, "sqlite_options", "json1", "0", TCL_GLOBAL_ONLY); | |
| 192 #endif | |
| 193 | |
| 194 #ifdef SQLITE_LIKE_DOESNT_MATCH_BLOBS | |
| 195 Tcl_SetVar2(interp, "sqlite_options", "like_match_blobs", "0", TCL_GLOBAL_ONLY
); | |
| 196 #else | |
| 197 Tcl_SetVar2(interp, "sqlite_options", "like_match_blobs", "1", TCL_GLOBAL_ONLY
); | |
| 198 #endif | |
| 199 | |
| 200 #ifdef SQLITE_OMIT_ATTACH | |
| 201 Tcl_SetVar2(interp, "sqlite_options", "attach", "0", TCL_GLOBAL_ONLY); | |
| 202 #else | |
| 203 Tcl_SetVar2(interp, "sqlite_options", "attach", "1", TCL_GLOBAL_ONLY); | |
| 204 #endif | |
| 205 | |
| 206 #ifdef SQLITE_OMIT_AUTHORIZATION | |
| 207 Tcl_SetVar2(interp, "sqlite_options", "auth", "0", TCL_GLOBAL_ONLY); | |
| 208 #else | |
| 209 Tcl_SetVar2(interp, "sqlite_options", "auth", "1", TCL_GLOBAL_ONLY); | |
| 210 #endif | |
| 211 | |
| 212 #ifdef SQLITE_OMIT_AUTOINCREMENT | |
| 213 Tcl_SetVar2(interp, "sqlite_options", "autoinc", "0", TCL_GLOBAL_ONLY); | |
| 214 #else | |
| 215 Tcl_SetVar2(interp, "sqlite_options", "autoinc", "1", TCL_GLOBAL_ONLY); | |
| 216 #endif | |
| 217 | |
| 218 #ifdef SQLITE_OMIT_AUTOMATIC_INDEX | |
| 219 Tcl_SetVar2(interp, "sqlite_options", "autoindex", "0", TCL_GLOBAL_ONLY); | |
| 220 #else | |
| 221 Tcl_SetVar2(interp, "sqlite_options", "autoindex", "1", TCL_GLOBAL_ONLY); | |
| 222 #endif | |
| 223 | |
| 224 #ifdef SQLITE_OMIT_AUTORESET | |
| 225 Tcl_SetVar2(interp, "sqlite_options", "autoreset", "0", TCL_GLOBAL_ONLY); | |
| 226 #else | |
| 227 Tcl_SetVar2(interp, "sqlite_options", "autoreset", "1", TCL_GLOBAL_ONLY); | |
| 228 #endif | |
| 229 | |
| 230 #ifdef SQLITE_OMIT_AUTOVACUUM | |
| 231 Tcl_SetVar2(interp, "sqlite_options", "autovacuum", "0", TCL_GLOBAL_ONLY); | |
| 232 #else | |
| 233 Tcl_SetVar2(interp, "sqlite_options", "autovacuum", "1", TCL_GLOBAL_ONLY); | |
| 234 #endif /* SQLITE_OMIT_AUTOVACUUM */ | |
| 235 #if !defined(SQLITE_DEFAULT_AUTOVACUUM) | |
| 236 Tcl_SetVar2(interp,"sqlite_options","default_autovacuum","0",TCL_GLOBAL_ONLY); | |
| 237 #else | |
| 238 Tcl_SetVar2(interp, "sqlite_options", "default_autovacuum", | |
| 239 STRINGVALUE(SQLITE_DEFAULT_AUTOVACUUM), TCL_GLOBAL_ONLY); | |
| 240 #endif | |
| 241 | |
| 242 #ifdef SQLITE_OMIT_BETWEEN_OPTIMIZATION | |
| 243 Tcl_SetVar2(interp, "sqlite_options", "between_opt", "0", TCL_GLOBAL_ONLY); | |
| 244 #else | |
| 245 Tcl_SetVar2(interp, "sqlite_options", "between_opt", "1", TCL_GLOBAL_ONLY); | |
| 246 #endif | |
| 247 | |
| 248 #ifdef SQLITE_OMIT_BUILTIN_TEST | |
| 249 Tcl_SetVar2(interp, "sqlite_options", "builtin_test", "0", TCL_GLOBAL_ONLY); | |
| 250 #else | |
| 251 Tcl_SetVar2(interp, "sqlite_options", "builtin_test", "1", TCL_GLOBAL_ONLY); | |
| 252 #endif | |
| 253 | |
| 254 #ifdef SQLITE_OMIT_BLOB_LITERAL | |
| 255 Tcl_SetVar2(interp, "sqlite_options", "bloblit", "0", TCL_GLOBAL_ONLY); | |
| 256 #else | |
| 257 Tcl_SetVar2(interp, "sqlite_options", "bloblit", "1", TCL_GLOBAL_ONLY); | |
| 258 #endif | |
| 259 | |
| 260 #ifdef SQLITE_OMIT_CAST | |
| 261 Tcl_SetVar2(interp, "sqlite_options", "cast", "0", TCL_GLOBAL_ONLY); | |
| 262 #else | |
| 263 Tcl_SetVar2(interp, "sqlite_options", "cast", "1", TCL_GLOBAL_ONLY); | |
| 264 #endif | |
| 265 | |
| 266 #ifdef SQLITE_OMIT_CHECK | |
| 267 Tcl_SetVar2(interp, "sqlite_options", "check", "0", TCL_GLOBAL_ONLY); | |
| 268 #else | |
| 269 Tcl_SetVar2(interp, "sqlite_options", "check", "1", TCL_GLOBAL_ONLY); | |
| 270 #endif | |
| 271 | |
| 272 #ifdef SQLITE_OMIT_CTE | |
| 273 Tcl_SetVar2(interp, "sqlite_options", "cte", "0", TCL_GLOBAL_ONLY); | |
| 274 #else | |
| 275 Tcl_SetVar2(interp, "sqlite_options", "cte", "1", TCL_GLOBAL_ONLY); | |
| 276 #endif | |
| 277 | |
| 278 #ifdef SQLITE_ENABLE_COLUMN_METADATA | |
| 279 Tcl_SetVar2(interp, "sqlite_options", "columnmetadata", "1", TCL_GLOBAL_ONLY); | |
| 280 #else | |
| 281 Tcl_SetVar2(interp, "sqlite_options", "columnmetadata", "0", TCL_GLOBAL_ONLY); | |
| 282 #endif | |
| 283 | |
| 284 #ifdef SQLITE_ENABLE_OVERSIZE_CELL_CHECK | |
| 285 Tcl_SetVar2(interp, "sqlite_options", "oversize_cell_check", "1", | |
| 286 TCL_GLOBAL_ONLY); | |
| 287 #else | |
| 288 Tcl_SetVar2(interp, "sqlite_options", "oversize_cell_check", "0", | |
| 289 TCL_GLOBAL_ONLY); | |
| 290 #endif | |
| 291 | |
| 292 #ifdef SQLITE_OMIT_COMPILEOPTION_DIAGS | |
| 293 Tcl_SetVar2(interp, "sqlite_options", "compileoption_diags", "0", TCL_GLOBAL_O
NLY); | |
| 294 #else | |
| 295 Tcl_SetVar2(interp, "sqlite_options", "compileoption_diags", "1", TCL_GLOBAL_O
NLY); | |
| 296 #endif | |
| 297 | |
| 298 #ifdef SQLITE_OMIT_COMPLETE | |
| 299 Tcl_SetVar2(interp, "sqlite_options", "complete", "0", TCL_GLOBAL_ONLY); | |
| 300 #else | |
| 301 Tcl_SetVar2(interp, "sqlite_options", "complete", "1", TCL_GLOBAL_ONLY); | |
| 302 #endif | |
| 303 | |
| 304 #ifdef SQLITE_OMIT_COMPOUND_SELECT | |
| 305 Tcl_SetVar2(interp, "sqlite_options", "compound", "0", TCL_GLOBAL_ONLY); | |
| 306 #else | |
| 307 Tcl_SetVar2(interp, "sqlite_options", "compound", "1", TCL_GLOBAL_ONLY); | |
| 308 #endif | |
| 309 | |
| 310 Tcl_SetVar2(interp, "sqlite_options", "conflict", "1", TCL_GLOBAL_ONLY); | |
| 311 Tcl_SetVar2(interp, "sqlite_options", "crashtest", "1", TCL_GLOBAL_ONLY); | |
| 312 | |
| 313 #ifdef SQLITE_OMIT_DATETIME_FUNCS | |
| 314 Tcl_SetVar2(interp, "sqlite_options", "datetime", "0", TCL_GLOBAL_ONLY); | |
| 315 #else | |
| 316 Tcl_SetVar2(interp, "sqlite_options", "datetime", "1", TCL_GLOBAL_ONLY); | |
| 317 #endif | |
| 318 | |
| 319 #ifdef SQLITE_OMIT_DECLTYPE | |
| 320 Tcl_SetVar2(interp, "sqlite_options", "decltype", "0", TCL_GLOBAL_ONLY); | |
| 321 #else | |
| 322 Tcl_SetVar2(interp, "sqlite_options", "decltype", "1", TCL_GLOBAL_ONLY); | |
| 323 #endif | |
| 324 | |
| 325 #ifdef SQLITE_OMIT_DEPRECATED | |
| 326 Tcl_SetVar2(interp, "sqlite_options", "deprecated", "0", TCL_GLOBAL_ONLY); | |
| 327 #else | |
| 328 Tcl_SetVar2(interp, "sqlite_options", "deprecated", "1", TCL_GLOBAL_ONLY); | |
| 329 #endif | |
| 330 | |
| 331 #ifdef SQLITE_OMIT_DISKIO | |
| 332 Tcl_SetVar2(interp, "sqlite_options", "diskio", "0", TCL_GLOBAL_ONLY); | |
| 333 #else | |
| 334 Tcl_SetVar2(interp, "sqlite_options", "diskio", "1", TCL_GLOBAL_ONLY); | |
| 335 #endif | |
| 336 | |
| 337 #ifdef SQLITE_OMIT_EXPLAIN | |
| 338 Tcl_SetVar2(interp, "sqlite_options", "explain", "0", TCL_GLOBAL_ONLY); | |
| 339 #else | |
| 340 Tcl_SetVar2(interp, "sqlite_options", "explain", "1", TCL_GLOBAL_ONLY); | |
| 341 #endif | |
| 342 | |
| 343 #ifdef SQLITE_OMIT_FLOATING_POINT | |
| 344 Tcl_SetVar2(interp, "sqlite_options", "floatingpoint", "0", TCL_GLOBAL_ONLY); | |
| 345 #else | |
| 346 Tcl_SetVar2(interp, "sqlite_options", "floatingpoint", "1", TCL_GLOBAL_ONLY); | |
| 347 #endif | |
| 348 | |
| 349 #ifdef SQLITE_OMIT_FOREIGN_KEY | |
| 350 Tcl_SetVar2(interp, "sqlite_options", "foreignkey", "0", TCL_GLOBAL_ONLY); | |
| 351 #else | |
| 352 Tcl_SetVar2(interp, "sqlite_options", "foreignkey", "1", TCL_GLOBAL_ONLY); | |
| 353 #endif | |
| 354 | |
| 355 #ifdef SQLITE_ENABLE_FTS1 | |
| 356 Tcl_SetVar2(interp, "sqlite_options", "fts1", "1", TCL_GLOBAL_ONLY); | |
| 357 #else | |
| 358 Tcl_SetVar2(interp, "sqlite_options", "fts1", "0", TCL_GLOBAL_ONLY); | |
| 359 #endif | |
| 360 | |
| 361 #ifdef SQLITE_ENABLE_FTS2 | |
| 362 Tcl_SetVar2(interp, "sqlite_options", "fts2", "1", TCL_GLOBAL_ONLY); | |
| 363 #else | |
| 364 Tcl_SetVar2(interp, "sqlite_options", "fts2", "0", TCL_GLOBAL_ONLY); | |
| 365 #endif | |
| 366 | |
| 367 #ifdef SQLITE_ENABLE_FTS3 | |
| 368 Tcl_SetVar2(interp, "sqlite_options", "fts3", "1", TCL_GLOBAL_ONLY); | |
| 369 #else | |
| 370 Tcl_SetVar2(interp, "sqlite_options", "fts3", "0", TCL_GLOBAL_ONLY); | |
| 371 #endif | |
| 372 | |
| 373 #ifdef SQLITE_ENABLE_FTS5 | |
| 374 Tcl_SetVar2(interp, "sqlite_options", "fts5", "1", TCL_GLOBAL_ONLY); | |
| 375 #else | |
| 376 Tcl_SetVar2(interp, "sqlite_options", "fts5", "0", TCL_GLOBAL_ONLY); | |
| 377 #endif | |
| 378 | |
| 379 #if defined(SQLITE_ENABLE_FTS3) && !defined(SQLITE_DISABLE_FTS3_UNICODE) | |
| 380 Tcl_SetVar2(interp, "sqlite_options", "fts3_unicode", "1", TCL_GLOBAL_ONLY); | |
| 381 #else | |
| 382 Tcl_SetVar2(interp, "sqlite_options", "fts3_unicode", "0", TCL_GLOBAL_ONLY); | |
| 383 #endif | |
| 384 | |
| 385 #ifdef SQLITE_DISABLE_FTS4_DEFERRED | |
| 386 Tcl_SetVar2(interp, "sqlite_options", "fts4_deferred", "0", TCL_GLOBAL_ONLY); | |
| 387 #else | |
| 388 Tcl_SetVar2(interp, "sqlite_options", "fts4_deferred", "1", TCL_GLOBAL_ONLY); | |
| 389 #endif | |
| 390 | |
| 391 #ifdef SQLITE_OMIT_GET_TABLE | |
| 392 Tcl_SetVar2(interp, "sqlite_options", "gettable", "0", TCL_GLOBAL_ONLY); | |
| 393 #else | |
| 394 Tcl_SetVar2(interp, "sqlite_options", "gettable", "1", TCL_GLOBAL_ONLY); | |
| 395 #endif | |
| 396 | |
| 397 #ifdef SQLITE_ENABLE_ICU | |
| 398 Tcl_SetVar2(interp, "sqlite_options", "icu", "1", TCL_GLOBAL_ONLY); | |
| 399 #else | |
| 400 Tcl_SetVar2(interp, "sqlite_options", "icu", "0", TCL_GLOBAL_ONLY); | |
| 401 #endif | |
| 402 | |
| 403 #ifdef SQLITE_OMIT_INCRBLOB | |
| 404 Tcl_SetVar2(interp, "sqlite_options", "incrblob", "0", TCL_GLOBAL_ONLY); | |
| 405 #else | |
| 406 Tcl_SetVar2(interp, "sqlite_options", "incrblob", "1", TCL_GLOBAL_ONLY); | |
| 407 #endif /* SQLITE_OMIT_AUTOVACUUM */ | |
| 408 | |
| 409 #ifdef SQLITE_OMIT_INTEGRITY_CHECK | |
| 410 Tcl_SetVar2(interp, "sqlite_options", "integrityck", "0", TCL_GLOBAL_ONLY); | |
| 411 #else | |
| 412 Tcl_SetVar2(interp, "sqlite_options", "integrityck", "1", TCL_GLOBAL_ONLY); | |
| 413 #endif | |
| 414 | |
| 415 #if defined(SQLITE_DEFAULT_FILE_FORMAT) && SQLITE_DEFAULT_FILE_FORMAT==1 | |
| 416 Tcl_SetVar2(interp, "sqlite_options", "legacyformat", "1", TCL_GLOBAL_ONLY); | |
| 417 #else | |
| 418 Tcl_SetVar2(interp, "sqlite_options", "legacyformat", "0", TCL_GLOBAL_ONLY); | |
| 419 #endif | |
| 420 | |
| 421 #ifdef SQLITE_OMIT_LIKE_OPTIMIZATION | |
| 422 Tcl_SetVar2(interp, "sqlite_options", "like_opt", "0", TCL_GLOBAL_ONLY); | |
| 423 #else | |
| 424 Tcl_SetVar2(interp, "sqlite_options", "like_opt", "1", TCL_GLOBAL_ONLY); | |
| 425 #endif | |
| 426 | |
| 427 #ifdef SQLITE_OMIT_LOAD_EXTENSION | |
| 428 Tcl_SetVar2(interp, "sqlite_options", "load_ext", "0", TCL_GLOBAL_ONLY); | |
| 429 #else | |
| 430 Tcl_SetVar2(interp, "sqlite_options", "load_ext", "1", TCL_GLOBAL_ONLY); | |
| 431 #endif | |
| 432 | |
| 433 #ifdef SQLITE_OMIT_LOCALTIME | |
| 434 Tcl_SetVar2(interp, "sqlite_options", "localtime", "0", TCL_GLOBAL_ONLY); | |
| 435 #else | |
| 436 Tcl_SetVar2(interp, "sqlite_options", "localtime", "1", TCL_GLOBAL_ONLY); | |
| 437 #endif | |
| 438 | |
| 439 #ifdef SQLITE_OMIT_LOOKASIDE | |
| 440 Tcl_SetVar2(interp, "sqlite_options", "lookaside", "0", TCL_GLOBAL_ONLY); | |
| 441 #else | |
| 442 Tcl_SetVar2(interp, "sqlite_options", "lookaside", "1", TCL_GLOBAL_ONLY); | |
| 443 #endif | |
| 444 | |
| 445 Tcl_SetVar2(interp, "sqlite_options", "long_double", | |
| 446 sizeof(LONGDOUBLE_TYPE)>sizeof(double) ? "1" : "0", | |
| 447 TCL_GLOBAL_ONLY); | |
| 448 | |
| 449 #ifdef SQLITE_OMIT_MEMORYDB | |
| 450 Tcl_SetVar2(interp, "sqlite_options", "memorydb", "0", TCL_GLOBAL_ONLY); | |
| 451 #else | |
| 452 Tcl_SetVar2(interp, "sqlite_options", "memorydb", "1", TCL_GLOBAL_ONLY); | |
| 453 #endif | |
| 454 | |
| 455 #ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT | |
| 456 Tcl_SetVar2(interp, "sqlite_options", "memorymanage", "1", TCL_GLOBAL_ONLY); | |
| 457 #else | |
| 458 Tcl_SetVar2(interp, "sqlite_options", "memorymanage", "0", TCL_GLOBAL_ONLY); | |
| 459 #endif | |
| 460 | |
| 461 Tcl_SetVar2(interp, "sqlite_options", "mergesort", "1", TCL_GLOBAL_ONLY); | |
| 462 | |
| 463 #ifdef SQLITE_OMIT_OR_OPTIMIZATION | |
| 464 Tcl_SetVar2(interp, "sqlite_options", "or_opt", "0", TCL_GLOBAL_ONLY); | |
| 465 #else | |
| 466 Tcl_SetVar2(interp, "sqlite_options", "or_opt", "1", TCL_GLOBAL_ONLY); | |
| 467 #endif | |
| 468 | |
| 469 #ifdef SQLITE_ENABLE_RBU | |
| 470 Tcl_SetVar2(interp, "sqlite_options", "rbu", "1", TCL_GLOBAL_ONLY); | |
| 471 #else | |
| 472 Tcl_SetVar2(interp, "sqlite_options", "rbu", "0", TCL_GLOBAL_ONLY); | |
| 473 #endif | |
| 474 | |
| 475 #ifdef SQLITE_OMIT_PAGER_PRAGMAS | |
| 476 Tcl_SetVar2(interp, "sqlite_options", "pager_pragmas", "0", TCL_GLOBAL_ONLY); | |
| 477 #else | |
| 478 Tcl_SetVar2(interp, "sqlite_options", "pager_pragmas", "1", TCL_GLOBAL_ONLY); | |
| 479 #endif | |
| 480 | |
| 481 #if defined(SQLITE_OMIT_PRAGMA) || defined(SQLITE_OMIT_FLAG_PRAGMAS) | |
| 482 Tcl_SetVar2(interp, "sqlite_options", "pragma", "0", TCL_GLOBAL_ONLY); | |
| 483 Tcl_SetVar2(interp, "sqlite_options", "integrityck", "0", TCL_GLOBAL_ONLY); | |
| 484 #else | |
| 485 Tcl_SetVar2(interp, "sqlite_options", "pragma", "1", TCL_GLOBAL_ONLY); | |
| 486 #endif | |
| 487 | |
| 488 #ifdef SQLITE_OMIT_PROGRESS_CALLBACK | |
| 489 Tcl_SetVar2(interp, "sqlite_options", "progress", "0", TCL_GLOBAL_ONLY); | |
| 490 #else | |
| 491 Tcl_SetVar2(interp, "sqlite_options", "progress", "1", TCL_GLOBAL_ONLY); | |
| 492 #endif | |
| 493 | |
| 494 #ifdef SQLITE_OMIT_REINDEX | |
| 495 Tcl_SetVar2(interp, "sqlite_options", "reindex", "0", TCL_GLOBAL_ONLY); | |
| 496 #else | |
| 497 Tcl_SetVar2(interp, "sqlite_options", "reindex", "1", TCL_GLOBAL_ONLY); | |
| 498 #endif | |
| 499 | |
| 500 #ifdef SQLITE_ENABLE_RTREE | |
| 501 Tcl_SetVar2(interp, "sqlite_options", "rtree", "1", TCL_GLOBAL_ONLY); | |
| 502 #else | |
| 503 Tcl_SetVar2(interp, "sqlite_options", "rtree", "0", TCL_GLOBAL_ONLY); | |
| 504 #endif | |
| 505 | |
| 506 #ifdef SQLITE_RTREE_INT_ONLY | |
| 507 Tcl_SetVar2(interp, "sqlite_options", "rtree_int_only", "1", TCL_GLOBAL_ONLY); | |
| 508 #else | |
| 509 Tcl_SetVar2(interp, "sqlite_options", "rtree_int_only", "0", TCL_GLOBAL_ONLY); | |
| 510 #endif | |
| 511 | |
| 512 #ifdef SQLITE_OMIT_SCHEMA_PRAGMAS | |
| 513 Tcl_SetVar2(interp, "sqlite_options", "schema_pragmas", "0", TCL_GLOBAL_ONLY); | |
| 514 #else | |
| 515 Tcl_SetVar2(interp, "sqlite_options", "schema_pragmas", "1", TCL_GLOBAL_ONLY); | |
| 516 #endif | |
| 517 | |
| 518 #ifdef SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS | |
| 519 Tcl_SetVar2(interp, "sqlite_options", "schema_version", "0", TCL_GLOBAL_ONLY); | |
| 520 #else | |
| 521 Tcl_SetVar2(interp, "sqlite_options", "schema_version", "1", TCL_GLOBAL_ONLY); | |
| 522 #endif | |
| 523 | |
| 524 #ifdef SQLITE_ENABLE_STAT4 | |
| 525 Tcl_SetVar2(interp, "sqlite_options", "stat4", "1", TCL_GLOBAL_ONLY); | |
| 526 #else | |
| 527 Tcl_SetVar2(interp, "sqlite_options", "stat4", "0", TCL_GLOBAL_ONLY); | |
| 528 #endif | |
| 529 #if defined(SQLITE_ENABLE_STAT3) && !defined(SQLITE_ENABLE_STAT4) | |
| 530 Tcl_SetVar2(interp, "sqlite_options", "stat3", "1", TCL_GLOBAL_ONLY); | |
| 531 #else | |
| 532 Tcl_SetVar2(interp, "sqlite_options", "stat3", "0", TCL_GLOBAL_ONLY); | |
| 533 #endif | |
| 534 | |
| 535 #ifdef SQLITE_ENABLE_STMT_SCANSTATUS | |
| 536 Tcl_SetVar2(interp, "sqlite_options", "scanstatus", "1", TCL_GLOBAL_ONLY); | |
| 537 #else | |
| 538 Tcl_SetVar2(interp, "sqlite_options", "scanstatus", "0", TCL_GLOBAL_ONLY); | |
| 539 #endif | |
| 540 | |
| 541 #if !defined(SQLITE_ENABLE_LOCKING_STYLE) | |
| 542 # if defined(__APPLE__) | |
| 543 # define SQLITE_ENABLE_LOCKING_STYLE 1 | |
| 544 # else | |
| 545 # define SQLITE_ENABLE_LOCKING_STYLE 0 | |
| 546 # endif | |
| 547 #endif | |
| 548 #if SQLITE_ENABLE_LOCKING_STYLE && defined(__APPLE__) | |
| 549 Tcl_SetVar2(interp,"sqlite_options","lock_proxy_pragmas","1",TCL_GLOBAL_ONLY); | |
| 550 #else | |
| 551 Tcl_SetVar2(interp,"sqlite_options","lock_proxy_pragmas","0",TCL_GLOBAL_ONLY); | |
| 552 #endif | |
| 553 #if defined(SQLITE_PREFER_PROXY_LOCKING) && defined(__APPLE__) | |
| 554 Tcl_SetVar2(interp,"sqlite_options","prefer_proxy_locking","1",TCL_GLOBAL_ONLY
); | |
| 555 #else | |
| 556 Tcl_SetVar2(interp,"sqlite_options","prefer_proxy_locking","0",TCL_GLOBAL_ONLY
); | |
| 557 #endif | |
| 558 | |
| 559 | |
| 560 #ifdef SQLITE_OMIT_SHARED_CACHE | |
| 561 Tcl_SetVar2(interp, "sqlite_options", "shared_cache", "0", TCL_GLOBAL_ONLY); | |
| 562 #else | |
| 563 Tcl_SetVar2(interp, "sqlite_options", "shared_cache", "1", TCL_GLOBAL_ONLY); | |
| 564 #endif | |
| 565 | |
| 566 #ifdef SQLITE_OMIT_SUBQUERY | |
| 567 Tcl_SetVar2(interp, "sqlite_options", "subquery", "0", TCL_GLOBAL_ONLY); | |
| 568 #else | |
| 569 Tcl_SetVar2(interp, "sqlite_options", "subquery", "1", TCL_GLOBAL_ONLY); | |
| 570 #endif | |
| 571 | |
| 572 #ifdef SQLITE_OMIT_TCL_VARIABLE | |
| 573 Tcl_SetVar2(interp, "sqlite_options", "tclvar", "0", TCL_GLOBAL_ONLY); | |
| 574 #else | |
| 575 Tcl_SetVar2(interp, "sqlite_options", "tclvar", "1", TCL_GLOBAL_ONLY); | |
| 576 #endif | |
| 577 | |
| 578 Tcl_SetVar2(interp, "sqlite_options", "threadsafe", | |
| 579 STRINGVALUE(SQLITE_THREADSAFE), TCL_GLOBAL_ONLY); | |
| 580 assert( sqlite3_threadsafe()==SQLITE_THREADSAFE ); | |
| 581 | |
| 582 #ifdef SQLITE_OMIT_TEMPDB | |
| 583 Tcl_SetVar2(interp, "sqlite_options", "tempdb", "0", TCL_GLOBAL_ONLY); | |
| 584 #else | |
| 585 Tcl_SetVar2(interp, "sqlite_options", "tempdb", "1", TCL_GLOBAL_ONLY); | |
| 586 #endif | |
| 587 | |
| 588 #ifdef SQLITE_OMIT_TRACE | |
| 589 Tcl_SetVar2(interp, "sqlite_options", "trace", "0", TCL_GLOBAL_ONLY); | |
| 590 #else | |
| 591 Tcl_SetVar2(interp, "sqlite_options", "trace", "1", TCL_GLOBAL_ONLY); | |
| 592 #endif | |
| 593 | |
| 594 #ifdef SQLITE_OMIT_TRIGGER | |
| 595 Tcl_SetVar2(interp, "sqlite_options", "trigger", "0", TCL_GLOBAL_ONLY); | |
| 596 #else | |
| 597 Tcl_SetVar2(interp, "sqlite_options", "trigger", "1", TCL_GLOBAL_ONLY); | |
| 598 #endif | |
| 599 | |
| 600 #ifdef SQLITE_OMIT_TRUNCATE_OPTIMIZATION | |
| 601 Tcl_SetVar2(interp, "sqlite_options", "truncate_opt", "0", TCL_GLOBAL_ONLY); | |
| 602 #else | |
| 603 Tcl_SetVar2(interp, "sqlite_options", "truncate_opt", "1", TCL_GLOBAL_ONLY); | |
| 604 #endif | |
| 605 | |
| 606 #ifdef SQLITE_OMIT_UTF16 | |
| 607 Tcl_SetVar2(interp, "sqlite_options", "utf16", "0", TCL_GLOBAL_ONLY); | |
| 608 #else | |
| 609 Tcl_SetVar2(interp, "sqlite_options", "utf16", "1", TCL_GLOBAL_ONLY); | |
| 610 #endif | |
| 611 | |
| 612 #if defined(SQLITE_OMIT_VACUUM) || defined(SQLITE_OMIT_ATTACH) | |
| 613 Tcl_SetVar2(interp, "sqlite_options", "vacuum", "0", TCL_GLOBAL_ONLY); | |
| 614 #else | |
| 615 Tcl_SetVar2(interp, "sqlite_options", "vacuum", "1", TCL_GLOBAL_ONLY); | |
| 616 #endif | |
| 617 | |
| 618 #ifdef SQLITE_OMIT_VIEW | |
| 619 Tcl_SetVar2(interp, "sqlite_options", "view", "0", TCL_GLOBAL_ONLY); | |
| 620 #else | |
| 621 Tcl_SetVar2(interp, "sqlite_options", "view", "1", TCL_GLOBAL_ONLY); | |
| 622 #endif | |
| 623 | |
| 624 #ifdef SQLITE_OMIT_VIRTUALTABLE | |
| 625 Tcl_SetVar2(interp, "sqlite_options", "vtab", "0", TCL_GLOBAL_ONLY); | |
| 626 #else | |
| 627 Tcl_SetVar2(interp, "sqlite_options", "vtab", "1", TCL_GLOBAL_ONLY); | |
| 628 #endif | |
| 629 | |
| 630 #ifdef SQLITE_OMIT_WAL | |
| 631 Tcl_SetVar2(interp, "sqlite_options", "wal", "0", TCL_GLOBAL_ONLY); | |
| 632 #else | |
| 633 Tcl_SetVar2(interp, "sqlite_options", "wal", "1", TCL_GLOBAL_ONLY); | |
| 634 #endif | |
| 635 | |
| 636 #ifdef SQLITE_OMIT_WSD | |
| 637 Tcl_SetVar2(interp, "sqlite_options", "wsd", "0", TCL_GLOBAL_ONLY); | |
| 638 #else | |
| 639 Tcl_SetVar2(interp, "sqlite_options", "wsd", "1", TCL_GLOBAL_ONLY); | |
| 640 #endif | |
| 641 | |
| 642 #if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY) | |
| 643 Tcl_SetVar2(interp, "sqlite_options", "update_delete_limit", "1", TCL_GLOBAL_O
NLY); | |
| 644 #else | |
| 645 Tcl_SetVar2(interp, "sqlite_options", "update_delete_limit", "0", TCL_GLOBAL_O
NLY); | |
| 646 #endif | |
| 647 | |
| 648 #if defined(SQLITE_ENABLE_UNLOCK_NOTIFY) | |
| 649 Tcl_SetVar2(interp, "sqlite_options", "unlock_notify", "1", TCL_GLOBAL_ONLY); | |
| 650 #else | |
| 651 Tcl_SetVar2(interp, "sqlite_options", "unlock_notify", "0", TCL_GLOBAL_ONLY); | |
| 652 #endif | |
| 653 | |
| 654 #ifdef SQLITE_SECURE_DELETE | |
| 655 Tcl_SetVar2(interp, "sqlite_options", "secure_delete", "1", TCL_GLOBAL_ONLY); | |
| 656 #else | |
| 657 Tcl_SetVar2(interp, "sqlite_options", "secure_delete", "0", TCL_GLOBAL_ONLY); | |
| 658 #endif | |
| 659 | |
| 660 #ifdef SQLITE_USER_AUTHENTICATION | |
| 661 Tcl_SetVar2(interp, "sqlite_options", "userauth", "1", TCL_GLOBAL_ONLY); | |
| 662 #else | |
| 663 Tcl_SetVar2(interp, "sqlite_options", "userauth", "0", TCL_GLOBAL_ONLY); | |
| 664 #endif | |
| 665 | |
| 666 #ifdef SQLITE_MULTIPLEX_EXT_OVWR | |
| 667 Tcl_SetVar2(interp, "sqlite_options", "multiplex_ext_overwrite", "1", TCL_GLOB
AL_ONLY); | |
| 668 #else | |
| 669 Tcl_SetVar2(interp, "sqlite_options", "multiplex_ext_overwrite", "0", TCL_GLOB
AL_ONLY); | |
| 670 #endif | |
| 671 | |
| 672 #ifdef YYTRACKMAXSTACKDEPTH | |
| 673 Tcl_SetVar2(interp, "sqlite_options", "yytrackmaxstackdepth", "1", TCL_GLOBAL_
ONLY); | |
| 674 #else | |
| 675 Tcl_SetVar2(interp, "sqlite_options", "yytrackmaxstackdepth", "0", TCL_GLOBAL_
ONLY); | |
| 676 #endif | |
| 677 | |
| 678 #ifdef SQLITE_ENABLE_SQLLOG | |
| 679 Tcl_SetVar2(interp, "sqlite_options", "sqllog", "1", TCL_GLOBAL_ONLY); | |
| 680 #else | |
| 681 Tcl_SetVar2(interp, "sqlite_options", "sqllog", "0", TCL_GLOBAL_ONLY); | |
| 682 #endif | |
| 683 | |
| 684 #define LINKVAR(x) { \ | |
| 685 static const int cv_ ## x = SQLITE_ ## x; \ | |
| 686 Tcl_LinkVar(interp, "SQLITE_" #x, (char *)&(cv_ ## x), \ | |
| 687 TCL_LINK_INT | TCL_LINK_READ_ONLY); } | |
| 688 | |
| 689 LINKVAR( MAX_LENGTH ); | |
| 690 LINKVAR( MAX_COLUMN ); | |
| 691 LINKVAR( MAX_SQL_LENGTH ); | |
| 692 LINKVAR( MAX_EXPR_DEPTH ); | |
| 693 LINKVAR( MAX_COMPOUND_SELECT ); | |
| 694 LINKVAR( MAX_VDBE_OP ); | |
| 695 LINKVAR( MAX_FUNCTION_ARG ); | |
| 696 LINKVAR( MAX_VARIABLE_NUMBER ); | |
| 697 LINKVAR( MAX_PAGE_SIZE ); | |
| 698 LINKVAR( MAX_PAGE_COUNT ); | |
| 699 LINKVAR( MAX_LIKE_PATTERN_LENGTH ); | |
| 700 LINKVAR( MAX_TRIGGER_DEPTH ); | |
| 701 LINKVAR( DEFAULT_CACHE_SIZE ); | |
| 702 LINKVAR( DEFAULT_PAGE_SIZE ); | |
| 703 LINKVAR( DEFAULT_FILE_FORMAT ); | |
| 704 LINKVAR( MAX_ATTACHED ); | |
| 705 LINKVAR( MAX_DEFAULT_PAGE_SIZE ); | |
| 706 LINKVAR( MAX_WORKER_THREADS ); | |
| 707 | |
| 708 { | |
| 709 static const int cv_TEMP_STORE = SQLITE_TEMP_STORE; | |
| 710 Tcl_LinkVar(interp, "TEMP_STORE", (char *)&(cv_TEMP_STORE), | |
| 711 TCL_LINK_INT | TCL_LINK_READ_ONLY); | |
| 712 } | |
| 713 | |
| 714 #ifdef _MSC_VER | |
| 715 { | |
| 716 static const int cv__MSC_VER = 1; | |
| 717 Tcl_LinkVar(interp, "_MSC_VER", (char *)&(cv__MSC_VER), | |
| 718 TCL_LINK_INT | TCL_LINK_READ_ONLY); | |
| 719 } | |
| 720 #endif | |
| 721 #ifdef __GNUC__ | |
| 722 { | |
| 723 static const int cv___GNUC__ = 1; | |
| 724 Tcl_LinkVar(interp, "__GNUC__", (char *)&(cv___GNUC__), | |
| 725 TCL_LINK_INT | TCL_LINK_READ_ONLY); | |
| 726 } | |
| 727 #endif | |
| 728 } | |
| 729 | |
| 730 | |
| 731 /* | |
| 732 ** Register commands with the TCL interpreter. | |
| 733 */ | |
| 734 int Sqliteconfig_Init(Tcl_Interp *interp){ | |
| 735 set_options(interp); | |
| 736 return TCL_OK; | |
| 737 } | |
| OLD | NEW |