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