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. |
drh | c797d4d | 2007-05-08 01:08:49 +0000 | [diff] [blame] | 18 | */ |
danielk1977 | e6a58a4 | 2007-08-31 17:42:48 +0000 | [diff] [blame] | 19 | |
| 20 | #include "sqliteLimit.h" |
| 21 | |
drh | c797d4d | 2007-05-08 01:08:49 +0000 | [diff] [blame] | 22 | #include "sqliteInt.h" |
mistachkin | f74b9e0 | 2013-11-26 01:00:31 +0000 | [diff] [blame] | 23 | #if SQLITE_OS_WIN |
| 24 | # include "os_win.h" |
| 25 | #endif |
| 26 | |
mistachkin | 52b1dbb | 2016-07-28 14:37:04 +0000 | [diff] [blame] | 27 | #if defined(INCLUDE_SQLITE_TCL_H) |
| 28 | # include "sqlite_tcl.h" |
| 29 | #else |
| 30 | # include "tcl.h" |
| 31 | #endif |
drh | c797d4d | 2007-05-08 01:08:49 +0000 | [diff] [blame] | 32 | #include <stdlib.h> |
| 33 | #include <string.h> |
| 34 | |
| 35 | /* |
danielk1977 | 0a732f5 | 2008-09-04 17:17:38 +0000 | [diff] [blame] | 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 | /* |
drh | c797d4d | 2007-05-08 01:08:49 +0000 | [diff] [blame] | 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){ |
drh | 0ede9eb | 2015-01-10 16:49:23 +0000 | [diff] [blame] | 48 | #if HAVE_MALLOC_USABLE_SIZE |
drh | 6a8ab6d | 2011-11-09 01:53:25 +0000 | [diff] [blame] | 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 | |
drh | c797d4d | 2007-05-08 01:08:49 +0000 | [diff] [blame] | 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 | |
drh | 50287f5 | 2013-04-16 14:58:52 +0000 | [diff] [blame] | 68 | #if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT |
mistachkin | c548465 | 2012-03-05 22:52:33 +0000 | [diff] [blame] | 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 | |
mistachkin | ac1f104 | 2013-11-23 00:27:29 +0000 | [diff] [blame] | 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 | |
danielk1977 | 6338c76 | 2007-05-17 16:38:30 +0000 | [diff] [blame] | 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 | |
drh | 108e5a9 | 2016-03-17 23:56:23 +0000 | [diff] [blame] | 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 | |
dan | f4ba109 | 2011-10-08 14:57:07 +0000 | [diff] [blame] | 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 | |
drh | c797d4d | 2007-05-08 01:08:49 +0000 | [diff] [blame] | 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 | |
drh | b99185f | 2016-03-18 00:19:48 +0000 | [diff] [blame] | 111 | #ifdef SQLITE_DISABLE_PAGECACHE_OVERFLOW_STATS |
| 112 | Tcl_SetVar2(interp, "sqlite_options", "pagecache_overflow_stats","0",TCL_GLOBAL_ONLY); |
| 113 | #else |
| 114 | Tcl_SetVar2(interp, "sqlite_options", "pagecache_overflow_stats","1",TCL_GLOBAL_ONLY); |
| 115 | #endif |
| 116 | |
drh | 9b4c59f | 2013-04-15 17:03:42 +0000 | [diff] [blame] | 117 | #if SQLITE_MAX_MMAP_SIZE>0 |
drh | 188d488 | 2013-04-08 20:47:49 +0000 | [diff] [blame] | 118 | Tcl_SetVar2(interp, "sqlite_options", "mmap", "1", TCL_GLOBAL_ONLY); |
drh | 9b4c59f | 2013-04-15 17:03:42 +0000 | [diff] [blame] | 119 | #else |
| 120 | Tcl_SetVar2(interp, "sqlite_options", "mmap", "0", TCL_GLOBAL_ONLY); |
drh | 188d488 | 2013-04-08 20:47:49 +0000 | [diff] [blame] | 121 | #endif |
| 122 | |
dan | 0d51def | 2014-05-03 14:28:14 +0000 | [diff] [blame] | 123 | Tcl_SetVar2(interp, "sqlite_options", "worker_threads", |
| 124 | STRINGVALUE(SQLITE_MAX_WORKER_THREADS), TCL_GLOBAL_ONLY |
| 125 | ); |
dan | 578e1ca | 2014-04-01 15:38:44 +0000 | [diff] [blame] | 126 | |
dan | 253c6ee | 2018-09-18 17:00:06 +0000 | [diff] [blame] | 127 | #ifdef SQLITE_MEMDEBUG |
drh | f3a65f7 | 2007-08-22 20:18:21 +0000 | [diff] [blame] | 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 | |
drh | 81cc516 | 2011-05-17 20:36:21 +0000 | [diff] [blame] | 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 | |
drh | f7854c7 | 2015-10-27 13:24:37 +0000 | [diff] [blame] | 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 | |
drh | 03d69a6 | 2015-11-19 13:53:57 +0000 | [diff] [blame] | 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 | |
drh | 9c6396e | 2018-03-06 21:43:19 +0000 | [diff] [blame] | 151 | #ifdef SQLITE_ENABLE_DESERIALIZE |
| 152 | Tcl_SetVar2(interp, "sqlite_options", "deserialize", "1", TCL_GLOBAL_ONLY); |
drh | ac442f4 | 2018-01-03 01:28:46 +0000 | [diff] [blame] | 153 | #else |
drh | 9c6396e | 2018-03-06 21:43:19 +0000 | [diff] [blame] | 154 | Tcl_SetVar2(interp, "sqlite_options", "deserialize", "0", TCL_GLOBAL_ONLY); |
drh | ac442f4 | 2018-01-03 01:28:46 +0000 | [diff] [blame] | 155 | #endif |
| 156 | |
danielk1977 | 6b39c2e | 2008-06-25 14:57:53 +0000 | [diff] [blame] | 157 | #ifdef SQLITE_ENABLE_MEMSYS3 |
drh | 9c7a60d | 2007-10-19 17:47:24 +0000 | [diff] [blame] | 158 | Tcl_SetVar2(interp, "sqlite_options", "mem3", "1", TCL_GLOBAL_ONLY); |
| 159 | #else |
| 160 | Tcl_SetVar2(interp, "sqlite_options", "mem3", "0", TCL_GLOBAL_ONLY); |
| 161 | #endif |
| 162 | |
danielk1977 | 6b39c2e | 2008-06-25 14:57:53 +0000 | [diff] [blame] | 163 | #ifdef SQLITE_ENABLE_MEMSYS5 |
drh | 2d7636e | 2008-02-16 16:21:45 +0000 | [diff] [blame] | 164 | Tcl_SetVar2(interp, "sqlite_options", "mem5", "1", TCL_GLOBAL_ONLY); |
| 165 | #else |
| 166 | Tcl_SetVar2(interp, "sqlite_options", "mem5", "0", TCL_GLOBAL_ONLY); |
| 167 | #endif |
| 168 | |
drh | 092457b | 2017-12-29 15:04:49 +0000 | [diff] [blame] | 169 | #ifdef SQLITE_ENABLE_OFFSET_SQL_FUNC |
| 170 | Tcl_SetVar2(interp, "sqlite_options", "offset_sql_func","1",TCL_GLOBAL_ONLY); |
| 171 | #else |
| 172 | Tcl_SetVar2(interp, "sqlite_options", "offset_sql_func","0",TCL_GLOBAL_ONLY); |
| 173 | #endif |
| 174 | |
drh | 9b1c62d | 2011-03-30 21:04:43 +0000 | [diff] [blame] | 175 | #ifdef SQLITE_ENABLE_PREUPDATE_HOOK |
| 176 | Tcl_SetVar2(interp, "sqlite_options", "preupdate", "1", TCL_GLOBAL_ONLY); |
| 177 | #else |
| 178 | Tcl_SetVar2(interp, "sqlite_options", "preupdate", "0", TCL_GLOBAL_ONLY); |
| 179 | #endif |
| 180 | |
drh | 68d28ea | 2015-12-11 03:20:39 +0000 | [diff] [blame] | 181 | #ifdef SQLITE_ENABLE_SNAPSHOT |
| 182 | Tcl_SetVar2(interp, "sqlite_options", "snapshot", "1", TCL_GLOBAL_ONLY); |
| 183 | #else |
| 184 | Tcl_SetVar2(interp, "sqlite_options", "snapshot", "0", TCL_GLOBAL_ONLY); |
| 185 | #endif |
| 186 | |
drh | 18472fa | 2008-10-07 15:25:48 +0000 | [diff] [blame] | 187 | #ifdef SQLITE_MUTEX_OMIT |
| 188 | Tcl_SetVar2(interp, "sqlite_options", "mutex", "0", TCL_GLOBAL_ONLY); |
| 189 | #else |
| 190 | Tcl_SetVar2(interp, "sqlite_options", "mutex", "1", TCL_GLOBAL_ONLY); |
| 191 | #endif |
| 192 | |
dan | 7329ed9 | 2011-04-07 10:09:00 +0000 | [diff] [blame] | 193 | #ifdef SQLITE_MUTEX_NOOP |
| 194 | Tcl_SetVar2(interp, "sqlite_options", "mutex_noop", "1", TCL_GLOBAL_ONLY); |
| 195 | #else |
| 196 | Tcl_SetVar2(interp, "sqlite_options", "mutex_noop", "0", TCL_GLOBAL_ONLY); |
| 197 | #endif |
| 198 | |
drh | c797d4d | 2007-05-08 01:08:49 +0000 | [diff] [blame] | 199 | #ifdef SQLITE_OMIT_ALTERTABLE |
| 200 | Tcl_SetVar2(interp, "sqlite_options", "altertable", "0", TCL_GLOBAL_ONLY); |
| 201 | #else |
| 202 | Tcl_SetVar2(interp, "sqlite_options", "altertable", "1", TCL_GLOBAL_ONLY); |
| 203 | #endif |
| 204 | |
| 205 | #ifdef SQLITE_OMIT_ANALYZE |
| 206 | Tcl_SetVar2(interp, "sqlite_options", "analyze", "0", TCL_GLOBAL_ONLY); |
| 207 | #else |
| 208 | Tcl_SetVar2(interp, "sqlite_options", "analyze", "1", TCL_GLOBAL_ONLY); |
| 209 | #endif |
| 210 | |
dan | b391b94 | 2014-11-07 14:41:11 +0000 | [diff] [blame] | 211 | #ifdef SQLITE_ENABLE_API_ARMOR |
| 212 | Tcl_SetVar2(interp, "sqlite_options", "api_armor", "1", TCL_GLOBAL_ONLY); |
| 213 | #else |
| 214 | Tcl_SetVar2(interp, "sqlite_options", "api_armor", "0", TCL_GLOBAL_ONLY); |
| 215 | #endif |
| 216 | |
drh | d6b9386 | 2007-08-29 17:59:42 +0000 | [diff] [blame] | 217 | #ifdef SQLITE_ENABLE_ATOMIC_WRITE |
| 218 | Tcl_SetVar2(interp, "sqlite_options", "atomicwrite", "1", TCL_GLOBAL_ONLY); |
| 219 | #else |
| 220 | Tcl_SetVar2(interp, "sqlite_options", "atomicwrite", "0", TCL_GLOBAL_ONLY); |
| 221 | #endif |
| 222 | |
drh | c306e08 | 2015-10-08 23:37:00 +0000 | [diff] [blame] | 223 | #ifdef SQLITE_ENABLE_JSON1 |
| 224 | Tcl_SetVar2(interp, "sqlite_options", "json1", "1", TCL_GLOBAL_ONLY); |
| 225 | #else |
| 226 | Tcl_SetVar2(interp, "sqlite_options", "json1", "0", TCL_GLOBAL_ONLY); |
| 227 | #endif |
| 228 | |
drh | efeaec3 | 2017-10-23 16:34:07 +0000 | [diff] [blame] | 229 | #ifdef SQLITE_HAS_CODEC |
| 230 | Tcl_SetVar2(interp, "sqlite_options", "has_codec", "1", TCL_GLOBAL_ONLY); |
| 231 | #else |
| 232 | Tcl_SetVar2(interp, "sqlite_options", "has_codec", "0", TCL_GLOBAL_ONLY); |
| 233 | #endif |
| 234 | |
drh | 41d2e66 | 2015-12-01 21:23:07 +0000 | [diff] [blame] | 235 | #ifdef SQLITE_LIKE_DOESNT_MATCH_BLOBS |
| 236 | Tcl_SetVar2(interp, "sqlite_options", "like_match_blobs", "0", TCL_GLOBAL_ONLY); |
| 237 | #else |
| 238 | Tcl_SetVar2(interp, "sqlite_options", "like_match_blobs", "1", TCL_GLOBAL_ONLY); |
| 239 | #endif |
| 240 | |
drh | c797d4d | 2007-05-08 01:08:49 +0000 | [diff] [blame] | 241 | #ifdef SQLITE_OMIT_ATTACH |
| 242 | Tcl_SetVar2(interp, "sqlite_options", "attach", "0", TCL_GLOBAL_ONLY); |
| 243 | #else |
| 244 | Tcl_SetVar2(interp, "sqlite_options", "attach", "1", TCL_GLOBAL_ONLY); |
| 245 | #endif |
| 246 | |
| 247 | #ifdef SQLITE_OMIT_AUTHORIZATION |
| 248 | Tcl_SetVar2(interp, "sqlite_options", "auth", "0", TCL_GLOBAL_ONLY); |
| 249 | #else |
| 250 | Tcl_SetVar2(interp, "sqlite_options", "auth", "1", TCL_GLOBAL_ONLY); |
| 251 | #endif |
| 252 | |
| 253 | #ifdef SQLITE_OMIT_AUTOINCREMENT |
| 254 | Tcl_SetVar2(interp, "sqlite_options", "autoinc", "0", TCL_GLOBAL_ONLY); |
| 255 | #else |
| 256 | Tcl_SetVar2(interp, "sqlite_options", "autoinc", "1", TCL_GLOBAL_ONLY); |
| 257 | #endif |
| 258 | |
drh | c633908 | 2010-04-07 16:54:58 +0000 | [diff] [blame] | 259 | #ifdef SQLITE_OMIT_AUTOMATIC_INDEX |
| 260 | Tcl_SetVar2(interp, "sqlite_options", "autoindex", "0", TCL_GLOBAL_ONLY); |
| 261 | #else |
| 262 | Tcl_SetVar2(interp, "sqlite_options", "autoindex", "1", TCL_GLOBAL_ONLY); |
| 263 | #endif |
| 264 | |
drh | 602acb4 | 2011-01-17 17:42:37 +0000 | [diff] [blame] | 265 | #ifdef SQLITE_OMIT_AUTORESET |
| 266 | Tcl_SetVar2(interp, "sqlite_options", "autoreset", "0", TCL_GLOBAL_ONLY); |
| 267 | #else |
| 268 | Tcl_SetVar2(interp, "sqlite_options", "autoreset", "1", TCL_GLOBAL_ONLY); |
| 269 | #endif |
| 270 | |
drh | c797d4d | 2007-05-08 01:08:49 +0000 | [diff] [blame] | 271 | #ifdef SQLITE_OMIT_AUTOVACUUM |
| 272 | Tcl_SetVar2(interp, "sqlite_options", "autovacuum", "0", TCL_GLOBAL_ONLY); |
| 273 | #else |
| 274 | Tcl_SetVar2(interp, "sqlite_options", "autovacuum", "1", TCL_GLOBAL_ONLY); |
| 275 | #endif /* SQLITE_OMIT_AUTOVACUUM */ |
danielk1977 | f8b10a8 | 2008-09-10 10:57:27 +0000 | [diff] [blame] | 276 | #if !defined(SQLITE_DEFAULT_AUTOVACUUM) |
drh | c797d4d | 2007-05-08 01:08:49 +0000 | [diff] [blame] | 277 | Tcl_SetVar2(interp,"sqlite_options","default_autovacuum","0",TCL_GLOBAL_ONLY); |
| 278 | #else |
danielk1977 | f8b10a8 | 2008-09-10 10:57:27 +0000 | [diff] [blame] | 279 | Tcl_SetVar2(interp, "sqlite_options", "default_autovacuum", |
| 280 | STRINGVALUE(SQLITE_DEFAULT_AUTOVACUUM), TCL_GLOBAL_ONLY); |
drh | c797d4d | 2007-05-08 01:08:49 +0000 | [diff] [blame] | 281 | #endif |
| 282 | |
| 283 | #ifdef SQLITE_OMIT_BETWEEN_OPTIMIZATION |
| 284 | Tcl_SetVar2(interp, "sqlite_options", "between_opt", "0", TCL_GLOBAL_ONLY); |
| 285 | #else |
| 286 | Tcl_SetVar2(interp, "sqlite_options", "between_opt", "1", TCL_GLOBAL_ONLY); |
| 287 | #endif |
| 288 | |
drh | d12602a | 2016-12-07 15:49:02 +0000 | [diff] [blame] | 289 | #ifdef SQLITE_UNTESTABLE |
drh | 3088d59 | 2008-03-21 16:45:47 +0000 | [diff] [blame] | 290 | Tcl_SetVar2(interp, "sqlite_options", "builtin_test", "0", TCL_GLOBAL_ONLY); |
| 291 | #else |
| 292 | Tcl_SetVar2(interp, "sqlite_options", "builtin_test", "1", TCL_GLOBAL_ONLY); |
| 293 | #endif |
| 294 | |
drh | c797d4d | 2007-05-08 01:08:49 +0000 | [diff] [blame] | 295 | #ifdef SQLITE_OMIT_BLOB_LITERAL |
| 296 | Tcl_SetVar2(interp, "sqlite_options", "bloblit", "0", TCL_GLOBAL_ONLY); |
| 297 | #else |
| 298 | Tcl_SetVar2(interp, "sqlite_options", "bloblit", "1", TCL_GLOBAL_ONLY); |
| 299 | #endif |
| 300 | |
| 301 | #ifdef SQLITE_OMIT_CAST |
| 302 | Tcl_SetVar2(interp, "sqlite_options", "cast", "0", TCL_GLOBAL_ONLY); |
| 303 | #else |
| 304 | Tcl_SetVar2(interp, "sqlite_options", "cast", "1", TCL_GLOBAL_ONLY); |
| 305 | #endif |
| 306 | |
| 307 | #ifdef SQLITE_OMIT_CHECK |
| 308 | Tcl_SetVar2(interp, "sqlite_options", "check", "0", TCL_GLOBAL_ONLY); |
| 309 | #else |
| 310 | Tcl_SetVar2(interp, "sqlite_options", "check", "1", TCL_GLOBAL_ONLY); |
| 311 | #endif |
| 312 | |
dan | eede6a5 | 2014-01-15 19:42:23 +0000 | [diff] [blame] | 313 | #ifdef SQLITE_OMIT_CTE |
| 314 | Tcl_SetVar2(interp, "sqlite_options", "cte", "0", TCL_GLOBAL_ONLY); |
| 315 | #else |
| 316 | Tcl_SetVar2(interp, "sqlite_options", "cte", "1", TCL_GLOBAL_ONLY); |
| 317 | #endif |
| 318 | |
drh | c797d4d | 2007-05-08 01:08:49 +0000 | [diff] [blame] | 319 | #ifdef SQLITE_ENABLE_COLUMN_METADATA |
| 320 | Tcl_SetVar2(interp, "sqlite_options", "columnmetadata", "1", TCL_GLOBAL_ONLY); |
| 321 | #else |
| 322 | Tcl_SetVar2(interp, "sqlite_options", "columnmetadata", "0", TCL_GLOBAL_ONLY); |
| 323 | #endif |
| 324 | |
drh | 3b2a3fa | 2009-06-09 13:42:24 +0000 | [diff] [blame] | 325 | #ifdef SQLITE_ENABLE_OVERSIZE_CELL_CHECK |
| 326 | Tcl_SetVar2(interp, "sqlite_options", "oversize_cell_check", "1", |
| 327 | TCL_GLOBAL_ONLY); |
| 328 | #else |
| 329 | Tcl_SetVar2(interp, "sqlite_options", "oversize_cell_check", "0", |
| 330 | TCL_GLOBAL_ONLY); |
| 331 | #endif |
| 332 | |
shaneh | 915c8bd | 2010-02-24 19:36:10 +0000 | [diff] [blame] | 333 | #ifdef SQLITE_OMIT_COMPILEOPTION_DIAGS |
| 334 | Tcl_SetVar2(interp, "sqlite_options", "compileoption_diags", "0", TCL_GLOBAL_ONLY); |
| 335 | #else |
| 336 | Tcl_SetVar2(interp, "sqlite_options", "compileoption_diags", "1", TCL_GLOBAL_ONLY); |
| 337 | #endif |
drh | 3b2a3fa | 2009-06-09 13:42:24 +0000 | [diff] [blame] | 338 | |
drh | c797d4d | 2007-05-08 01:08:49 +0000 | [diff] [blame] | 339 | #ifdef SQLITE_OMIT_COMPLETE |
| 340 | Tcl_SetVar2(interp, "sqlite_options", "complete", "0", TCL_GLOBAL_ONLY); |
| 341 | #else |
| 342 | Tcl_SetVar2(interp, "sqlite_options", "complete", "1", TCL_GLOBAL_ONLY); |
| 343 | #endif |
| 344 | |
| 345 | #ifdef SQLITE_OMIT_COMPOUND_SELECT |
| 346 | Tcl_SetVar2(interp, "sqlite_options", "compound", "0", TCL_GLOBAL_ONLY); |
| 347 | #else |
| 348 | Tcl_SetVar2(interp, "sqlite_options", "compound", "1", TCL_GLOBAL_ONLY); |
| 349 | #endif |
| 350 | |
drh | c797d4d | 2007-05-08 01:08:49 +0000 | [diff] [blame] | 351 | Tcl_SetVar2(interp, "sqlite_options", "conflict", "1", TCL_GLOBAL_ONLY); |
drh | c797d4d | 2007-05-08 01:08:49 +0000 | [diff] [blame] | 352 | Tcl_SetVar2(interp, "sqlite_options", "crashtest", "1", TCL_GLOBAL_ONLY); |
drh | c797d4d | 2007-05-08 01:08:49 +0000 | [diff] [blame] | 353 | |
| 354 | #ifdef SQLITE_OMIT_DATETIME_FUNCS |
| 355 | Tcl_SetVar2(interp, "sqlite_options", "datetime", "0", TCL_GLOBAL_ONLY); |
| 356 | #else |
| 357 | Tcl_SetVar2(interp, "sqlite_options", "datetime", "1", TCL_GLOBAL_ONLY); |
| 358 | #endif |
| 359 | |
drh | 3f91357 | 2008-03-22 01:07:17 +0000 | [diff] [blame] | 360 | #ifdef SQLITE_OMIT_DECLTYPE |
| 361 | Tcl_SetVar2(interp, "sqlite_options", "decltype", "0", TCL_GLOBAL_ONLY); |
| 362 | #else |
| 363 | Tcl_SetVar2(interp, "sqlite_options", "decltype", "1", TCL_GLOBAL_ONLY); |
| 364 | #endif |
| 365 | |
shane | eec556d | 2008-10-12 00:27:53 +0000 | [diff] [blame] | 366 | #ifdef SQLITE_OMIT_DEPRECATED |
| 367 | Tcl_SetVar2(interp, "sqlite_options", "deprecated", "0", TCL_GLOBAL_ONLY); |
| 368 | #else |
| 369 | Tcl_SetVar2(interp, "sqlite_options", "deprecated", "1", TCL_GLOBAL_ONLY); |
| 370 | #endif |
| 371 | |
drh | c797d4d | 2007-05-08 01:08:49 +0000 | [diff] [blame] | 372 | #ifdef SQLITE_OMIT_DISKIO |
| 373 | Tcl_SetVar2(interp, "sqlite_options", "diskio", "0", TCL_GLOBAL_ONLY); |
| 374 | #else |
| 375 | Tcl_SetVar2(interp, "sqlite_options", "diskio", "1", TCL_GLOBAL_ONLY); |
| 376 | #endif |
| 377 | |
| 378 | #ifdef SQLITE_OMIT_EXPLAIN |
| 379 | Tcl_SetVar2(interp, "sqlite_options", "explain", "0", TCL_GLOBAL_ONLY); |
| 380 | #else |
| 381 | Tcl_SetVar2(interp, "sqlite_options", "explain", "1", TCL_GLOBAL_ONLY); |
| 382 | #endif |
| 383 | |
| 384 | #ifdef SQLITE_OMIT_FLOATING_POINT |
| 385 | Tcl_SetVar2(interp, "sqlite_options", "floatingpoint", "0", TCL_GLOBAL_ONLY); |
| 386 | #else |
| 387 | Tcl_SetVar2(interp, "sqlite_options", "floatingpoint", "1", TCL_GLOBAL_ONLY); |
| 388 | #endif |
| 389 | |
| 390 | #ifdef SQLITE_OMIT_FOREIGN_KEY |
| 391 | Tcl_SetVar2(interp, "sqlite_options", "foreignkey", "0", TCL_GLOBAL_ONLY); |
| 392 | #else |
| 393 | Tcl_SetVar2(interp, "sqlite_options", "foreignkey", "1", TCL_GLOBAL_ONLY); |
| 394 | #endif |
| 395 | |
| 396 | #ifdef SQLITE_ENABLE_FTS1 |
| 397 | Tcl_SetVar2(interp, "sqlite_options", "fts1", "1", TCL_GLOBAL_ONLY); |
| 398 | #else |
| 399 | Tcl_SetVar2(interp, "sqlite_options", "fts1", "0", TCL_GLOBAL_ONLY); |
| 400 | #endif |
| 401 | |
| 402 | #ifdef SQLITE_ENABLE_FTS2 |
| 403 | Tcl_SetVar2(interp, "sqlite_options", "fts2", "1", TCL_GLOBAL_ONLY); |
| 404 | #else |
| 405 | Tcl_SetVar2(interp, "sqlite_options", "fts2", "0", TCL_GLOBAL_ONLY); |
| 406 | #endif |
| 407 | |
drh | a2451e2 | 2007-08-20 23:50:24 +0000 | [diff] [blame] | 408 | #ifdef SQLITE_ENABLE_FTS3 |
| 409 | Tcl_SetVar2(interp, "sqlite_options", "fts3", "1", TCL_GLOBAL_ONLY); |
| 410 | #else |
| 411 | Tcl_SetVar2(interp, "sqlite_options", "fts3", "0", TCL_GLOBAL_ONLY); |
| 412 | #endif |
| 413 | |
dan | 48d7014 | 2014-11-15 20:07:31 +0000 | [diff] [blame] | 414 | #ifdef SQLITE_ENABLE_FTS5 |
| 415 | Tcl_SetVar2(interp, "sqlite_options", "fts5", "1", TCL_GLOBAL_ONLY); |
| 416 | #else |
| 417 | Tcl_SetVar2(interp, "sqlite_options", "fts5", "0", TCL_GLOBAL_ONLY); |
| 418 | #endif |
| 419 | |
dan | 2eaf03d | 2014-07-03 12:18:22 +0000 | [diff] [blame] | 420 | #if defined(SQLITE_ENABLE_FTS3) && !defined(SQLITE_DISABLE_FTS3_UNICODE) |
dan | 7946c53 | 2012-05-26 18:28:14 +0000 | [diff] [blame] | 421 | Tcl_SetVar2(interp, "sqlite_options", "fts3_unicode", "1", TCL_GLOBAL_ONLY); |
dan | 2c897e3 | 2012-06-06 19:51:27 +0000 | [diff] [blame] | 422 | #else |
| 423 | Tcl_SetVar2(interp, "sqlite_options", "fts3_unicode", "0", TCL_GLOBAL_ONLY); |
dan | 7946c53 | 2012-05-26 18:28:14 +0000 | [diff] [blame] | 424 | #endif |
| 425 | |
dan | 4dc3d73 | 2012-08-20 17:24:48 +0000 | [diff] [blame] | 426 | #ifdef SQLITE_DISABLE_FTS4_DEFERRED |
| 427 | Tcl_SetVar2(interp, "sqlite_options", "fts4_deferred", "0", TCL_GLOBAL_ONLY); |
| 428 | #else |
| 429 | Tcl_SetVar2(interp, "sqlite_options", "fts4_deferred", "1", TCL_GLOBAL_ONLY); |
| 430 | #endif |
| 431 | |
shane | 8225f5a | 2008-07-31 02:05:04 +0000 | [diff] [blame] | 432 | #ifdef SQLITE_OMIT_GET_TABLE |
| 433 | Tcl_SetVar2(interp, "sqlite_options", "gettable", "0", TCL_GLOBAL_ONLY); |
| 434 | #else |
| 435 | Tcl_SetVar2(interp, "sqlite_options", "gettable", "1", TCL_GLOBAL_ONLY); |
| 436 | #endif |
| 437 | |
drh | c797d4d | 2007-05-08 01:08:49 +0000 | [diff] [blame] | 438 | #ifdef SQLITE_ENABLE_ICU |
| 439 | Tcl_SetVar2(interp, "sqlite_options", "icu", "1", TCL_GLOBAL_ONLY); |
| 440 | #else |
| 441 | Tcl_SetVar2(interp, "sqlite_options", "icu", "0", TCL_GLOBAL_ONLY); |
| 442 | #endif |
| 443 | |
dan | 21540ae | 2017-12-08 16:23:38 +0000 | [diff] [blame] | 444 | #ifdef SQLITE_ENABLE_ICU_COLLATIONS |
| 445 | Tcl_SetVar2(interp, "sqlite_options", "icu_collations", "1", TCL_GLOBAL_ONLY); |
| 446 | #else |
| 447 | Tcl_SetVar2(interp, "sqlite_options", "icu_collations", "0", TCL_GLOBAL_ONLY); |
| 448 | #endif |
| 449 | |
drh | c797d4d | 2007-05-08 01:08:49 +0000 | [diff] [blame] | 450 | #ifdef SQLITE_OMIT_INCRBLOB |
| 451 | Tcl_SetVar2(interp, "sqlite_options", "incrblob", "0", TCL_GLOBAL_ONLY); |
| 452 | #else |
| 453 | Tcl_SetVar2(interp, "sqlite_options", "incrblob", "1", TCL_GLOBAL_ONLY); |
| 454 | #endif /* SQLITE_OMIT_AUTOVACUUM */ |
| 455 | |
| 456 | #ifdef SQLITE_OMIT_INTEGRITY_CHECK |
| 457 | Tcl_SetVar2(interp, "sqlite_options", "integrityck", "0", TCL_GLOBAL_ONLY); |
| 458 | #else |
| 459 | Tcl_SetVar2(interp, "sqlite_options", "integrityck", "1", TCL_GLOBAL_ONLY); |
| 460 | #endif |
| 461 | |
| 462 | #if defined(SQLITE_DEFAULT_FILE_FORMAT) && SQLITE_DEFAULT_FILE_FORMAT==1 |
| 463 | Tcl_SetVar2(interp, "sqlite_options", "legacyformat", "1", TCL_GLOBAL_ONLY); |
| 464 | #else |
| 465 | Tcl_SetVar2(interp, "sqlite_options", "legacyformat", "0", TCL_GLOBAL_ONLY); |
| 466 | #endif |
| 467 | |
| 468 | #ifdef SQLITE_OMIT_LIKE_OPTIMIZATION |
| 469 | Tcl_SetVar2(interp, "sqlite_options", "like_opt", "0", TCL_GLOBAL_ONLY); |
| 470 | #else |
| 471 | Tcl_SetVar2(interp, "sqlite_options", "like_opt", "1", TCL_GLOBAL_ONLY); |
| 472 | #endif |
| 473 | |
| 474 | #ifdef SQLITE_OMIT_LOAD_EXTENSION |
| 475 | Tcl_SetVar2(interp, "sqlite_options", "load_ext", "0", TCL_GLOBAL_ONLY); |
| 476 | #else |
| 477 | Tcl_SetVar2(interp, "sqlite_options", "load_ext", "1", TCL_GLOBAL_ONLY); |
| 478 | #endif |
| 479 | |
drh | 66147c9 | 2008-06-12 12:51:37 +0000 | [diff] [blame] | 480 | #ifdef SQLITE_OMIT_LOCALTIME |
| 481 | Tcl_SetVar2(interp, "sqlite_options", "localtime", "0", TCL_GLOBAL_ONLY); |
| 482 | #else |
| 483 | Tcl_SetVar2(interp, "sqlite_options", "localtime", "1", TCL_GLOBAL_ONLY); |
| 484 | #endif |
| 485 | |
drh | 8867e38 | 2008-10-11 17:06:04 +0000 | [diff] [blame] | 486 | #ifdef SQLITE_OMIT_LOOKASIDE |
| 487 | Tcl_SetVar2(interp, "sqlite_options", "lookaside", "0", TCL_GLOBAL_ONLY); |
| 488 | #else |
| 489 | Tcl_SetVar2(interp, "sqlite_options", "lookaside", "1", TCL_GLOBAL_ONLY); |
| 490 | #endif |
| 491 | |
drh | a7fba4b | 2007-08-13 15:18:27 +0000 | [diff] [blame] | 492 | Tcl_SetVar2(interp, "sqlite_options", "long_double", |
| 493 | sizeof(LONGDOUBLE_TYPE)>sizeof(double) ? "1" : "0", |
| 494 | TCL_GLOBAL_ONLY); |
| 495 | |
drh | c797d4d | 2007-05-08 01:08:49 +0000 | [diff] [blame] | 496 | #ifdef SQLITE_OMIT_MEMORYDB |
| 497 | Tcl_SetVar2(interp, "sqlite_options", "memorydb", "0", TCL_GLOBAL_ONLY); |
| 498 | #else |
| 499 | Tcl_SetVar2(interp, "sqlite_options", "memorydb", "1", TCL_GLOBAL_ONLY); |
| 500 | #endif |
| 501 | |
| 502 | #ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT |
| 503 | Tcl_SetVar2(interp, "sqlite_options", "memorymanage", "1", TCL_GLOBAL_ONLY); |
| 504 | #else |
| 505 | Tcl_SetVar2(interp, "sqlite_options", "memorymanage", "0", TCL_GLOBAL_ONLY); |
| 506 | #endif |
| 507 | |
drh | dba0cb2 | 2013-03-24 22:56:49 +0000 | [diff] [blame] | 508 | Tcl_SetVar2(interp, "sqlite_options", "mergesort", "1", TCL_GLOBAL_ONLY); |
dan | 689ab89 | 2011-08-12 15:02:00 +0000 | [diff] [blame] | 509 | |
dan | 1db7db1 | 2018-02-12 15:27:32 +0000 | [diff] [blame] | 510 | #ifdef SQLITE_ENABLE_NULL_TRIM |
| 511 | Tcl_SetVar2(interp, "sqlite_options", "null_trim", "1", TCL_GLOBAL_ONLY); |
| 512 | #else |
| 513 | Tcl_SetVar2(interp, "sqlite_options", "null_trim", "0", TCL_GLOBAL_ONLY); |
| 514 | #endif |
| 515 | |
drh | c797d4d | 2007-05-08 01:08:49 +0000 | [diff] [blame] | 516 | #ifdef SQLITE_OMIT_OR_OPTIMIZATION |
| 517 | Tcl_SetVar2(interp, "sqlite_options", "or_opt", "0", TCL_GLOBAL_ONLY); |
| 518 | #else |
| 519 | Tcl_SetVar2(interp, "sqlite_options", "or_opt", "1", TCL_GLOBAL_ONLY); |
| 520 | #endif |
| 521 | |
drh | cfb8f8d | 2015-07-23 20:44:49 +0000 | [diff] [blame] | 522 | #ifdef SQLITE_ENABLE_RBU |
| 523 | Tcl_SetVar2(interp, "sqlite_options", "rbu", "1", TCL_GLOBAL_ONLY); |
dan | 7bf9ec1 | 2014-11-22 09:09:50 +0000 | [diff] [blame] | 524 | #else |
drh | cfb8f8d | 2015-07-23 20:44:49 +0000 | [diff] [blame] | 525 | Tcl_SetVar2(interp, "sqlite_options", "rbu", "0", TCL_GLOBAL_ONLY); |
dan | 7bf9ec1 | 2014-11-22 09:09:50 +0000 | [diff] [blame] | 526 | #endif |
| 527 | |
drh | c797d4d | 2007-05-08 01:08:49 +0000 | [diff] [blame] | 528 | #ifdef SQLITE_OMIT_PAGER_PRAGMAS |
| 529 | Tcl_SetVar2(interp, "sqlite_options", "pager_pragmas", "0", TCL_GLOBAL_ONLY); |
| 530 | #else |
| 531 | Tcl_SetVar2(interp, "sqlite_options", "pager_pragmas", "1", TCL_GLOBAL_ONLY); |
| 532 | #endif |
| 533 | |
drh | c797d4d | 2007-05-08 01:08:49 +0000 | [diff] [blame] | 534 | #if defined(SQLITE_OMIT_PRAGMA) || defined(SQLITE_OMIT_FLAG_PRAGMAS) |
| 535 | Tcl_SetVar2(interp, "sqlite_options", "pragma", "0", TCL_GLOBAL_ONLY); |
| 536 | Tcl_SetVar2(interp, "sqlite_options", "integrityck", "0", TCL_GLOBAL_ONLY); |
| 537 | #else |
| 538 | Tcl_SetVar2(interp, "sqlite_options", "pragma", "1", TCL_GLOBAL_ONLY); |
| 539 | #endif |
| 540 | |
| 541 | #ifdef SQLITE_OMIT_PROGRESS_CALLBACK |
| 542 | Tcl_SetVar2(interp, "sqlite_options", "progress", "0", TCL_GLOBAL_ONLY); |
| 543 | #else |
| 544 | Tcl_SetVar2(interp, "sqlite_options", "progress", "1", TCL_GLOBAL_ONLY); |
| 545 | #endif |
| 546 | |
drh | c797d4d | 2007-05-08 01:08:49 +0000 | [diff] [blame] | 547 | #ifdef SQLITE_OMIT_REINDEX |
| 548 | Tcl_SetVar2(interp, "sqlite_options", "reindex", "0", TCL_GLOBAL_ONLY); |
| 549 | #else |
| 550 | Tcl_SetVar2(interp, "sqlite_options", "reindex", "1", TCL_GLOBAL_ONLY); |
| 551 | #endif |
| 552 | |
danielk1977 | ebaecc1 | 2008-05-26 18:41:54 +0000 | [diff] [blame] | 553 | #ifdef SQLITE_ENABLE_RTREE |
| 554 | Tcl_SetVar2(interp, "sqlite_options", "rtree", "1", TCL_GLOBAL_ONLY); |
| 555 | #else |
| 556 | Tcl_SetVar2(interp, "sqlite_options", "rtree", "0", TCL_GLOBAL_ONLY); |
| 557 | #endif |
| 558 | |
drh | f439fbd | 2012-04-02 21:35:42 +0000 | [diff] [blame] | 559 | #ifdef SQLITE_RTREE_INT_ONLY |
| 560 | Tcl_SetVar2(interp, "sqlite_options", "rtree_int_only", "1", TCL_GLOBAL_ONLY); |
| 561 | #else |
| 562 | Tcl_SetVar2(interp, "sqlite_options", "rtree_int_only", "0", TCL_GLOBAL_ONLY); |
| 563 | #endif |
| 564 | |
drh | c797d4d | 2007-05-08 01:08:49 +0000 | [diff] [blame] | 565 | #ifdef SQLITE_OMIT_SCHEMA_PRAGMAS |
| 566 | Tcl_SetVar2(interp, "sqlite_options", "schema_pragmas", "0", TCL_GLOBAL_ONLY); |
| 567 | #else |
| 568 | Tcl_SetVar2(interp, "sqlite_options", "schema_pragmas", "1", TCL_GLOBAL_ONLY); |
| 569 | #endif |
| 570 | |
| 571 | #ifdef SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS |
| 572 | Tcl_SetVar2(interp, "sqlite_options", "schema_version", "0", TCL_GLOBAL_ONLY); |
| 573 | #else |
| 574 | Tcl_SetVar2(interp, "sqlite_options", "schema_version", "1", TCL_GLOBAL_ONLY); |
| 575 | #endif |
| 576 | |
dan | 7cf7df7 | 2011-03-19 15:37:02 +0000 | [diff] [blame] | 577 | #ifdef SQLITE_ENABLE_SESSION |
| 578 | Tcl_SetVar2(interp, "sqlite_options", "session", "1", TCL_GLOBAL_ONLY); |
| 579 | #else |
| 580 | Tcl_SetVar2(interp, "sqlite_options", "session", "0", TCL_GLOBAL_ONLY); |
| 581 | #endif |
| 582 | |
dan | f52bb8d | 2013-08-03 20:24:58 +0000 | [diff] [blame] | 583 | #ifdef SQLITE_ENABLE_STAT4 |
| 584 | Tcl_SetVar2(interp, "sqlite_options", "stat4", "1", TCL_GLOBAL_ONLY); |
drh | faacf17 | 2011-08-12 01:51:45 +0000 | [diff] [blame] | 585 | #else |
dan | f52bb8d | 2013-08-03 20:24:58 +0000 | [diff] [blame] | 586 | Tcl_SetVar2(interp, "sqlite_options", "stat4", "0", TCL_GLOBAL_ONLY); |
drh | faacf17 | 2011-08-12 01:51:45 +0000 | [diff] [blame] | 587 | #endif |
drh | c6603af | 2017-06-29 14:33:51 +0000 | [diff] [blame] | 588 | #if defined(SQLITE_ENABLE_STMTVTAB) && !defined(SQLITE_OMIT_VIRTUALTABLE) |
| 589 | Tcl_SetVar2(interp, "sqlite_options", "stmtvtab", "1", TCL_GLOBAL_ONLY); |
drh | c799833 | 2017-06-29 13:41:59 +0000 | [diff] [blame] | 590 | #else |
drh | c6603af | 2017-06-29 14:33:51 +0000 | [diff] [blame] | 591 | Tcl_SetVar2(interp, "sqlite_options", "stmtvtab", "0", TCL_GLOBAL_ONLY); |
drh | c799833 | 2017-06-29 13:41:59 +0000 | [diff] [blame] | 592 | #endif |
| 593 | |
dan | e2f771b | 2014-11-03 15:33:17 +0000 | [diff] [blame] | 594 | #ifdef SQLITE_ENABLE_STMT_SCANSTATUS |
| 595 | Tcl_SetVar2(interp, "sqlite_options", "scanstatus", "1", TCL_GLOBAL_ONLY); |
| 596 | #else |
| 597 | Tcl_SetVar2(interp, "sqlite_options", "scanstatus", "0", TCL_GLOBAL_ONLY); |
| 598 | #endif |
| 599 | |
drh | 9b35ea6 | 2008-11-29 02:20:26 +0000 | [diff] [blame] | 600 | #if !defined(SQLITE_ENABLE_LOCKING_STYLE) |
drh | d2cb50b | 2009-01-09 21:41:17 +0000 | [diff] [blame] | 601 | # if defined(__APPLE__) |
drh | 9b35ea6 | 2008-11-29 02:20:26 +0000 | [diff] [blame] | 602 | # define SQLITE_ENABLE_LOCKING_STYLE 1 |
| 603 | # else |
| 604 | # define SQLITE_ENABLE_LOCKING_STYLE 0 |
| 605 | # endif |
| 606 | #endif |
drh | d2cb50b | 2009-01-09 21:41:17 +0000 | [diff] [blame] | 607 | #if SQLITE_ENABLE_LOCKING_STYLE && defined(__APPLE__) |
drh | 7708e97 | 2008-11-29 00:56:52 +0000 | [diff] [blame] | 608 | Tcl_SetVar2(interp,"sqlite_options","lock_proxy_pragmas","1",TCL_GLOBAL_ONLY); |
aswift | aebf413 | 2008-11-21 00:10:35 +0000 | [diff] [blame] | 609 | #else |
drh | 7708e97 | 2008-11-29 00:56:52 +0000 | [diff] [blame] | 610 | Tcl_SetVar2(interp,"sqlite_options","lock_proxy_pragmas","0",TCL_GLOBAL_ONLY); |
aswift | aebf413 | 2008-11-21 00:10:35 +0000 | [diff] [blame] | 611 | #endif |
danielk1977 | 838cce4 | 2009-01-12 14:01:45 +0000 | [diff] [blame] | 612 | #if defined(SQLITE_PREFER_PROXY_LOCKING) && defined(__APPLE__) |
| 613 | Tcl_SetVar2(interp,"sqlite_options","prefer_proxy_locking","1",TCL_GLOBAL_ONLY); |
| 614 | #else |
| 615 | Tcl_SetVar2(interp,"sqlite_options","prefer_proxy_locking","0",TCL_GLOBAL_ONLY); |
| 616 | #endif |
aswift | aebf413 | 2008-11-21 00:10:35 +0000 | [diff] [blame] | 617 | |
| 618 | |
drh | c797d4d | 2007-05-08 01:08:49 +0000 | [diff] [blame] | 619 | #ifdef SQLITE_OMIT_SHARED_CACHE |
| 620 | Tcl_SetVar2(interp, "sqlite_options", "shared_cache", "0", TCL_GLOBAL_ONLY); |
| 621 | #else |
| 622 | Tcl_SetVar2(interp, "sqlite_options", "shared_cache", "1", TCL_GLOBAL_ONLY); |
| 623 | #endif |
| 624 | |
| 625 | #ifdef SQLITE_OMIT_SUBQUERY |
| 626 | Tcl_SetVar2(interp, "sqlite_options", "subquery", "0", TCL_GLOBAL_ONLY); |
| 627 | #else |
| 628 | Tcl_SetVar2(interp, "sqlite_options", "subquery", "1", TCL_GLOBAL_ONLY); |
| 629 | #endif |
| 630 | |
| 631 | #ifdef SQLITE_OMIT_TCL_VARIABLE |
| 632 | Tcl_SetVar2(interp, "sqlite_options", "tclvar", "0", TCL_GLOBAL_ONLY); |
| 633 | #else |
| 634 | Tcl_SetVar2(interp, "sqlite_options", "tclvar", "1", TCL_GLOBAL_ONLY); |
| 635 | #endif |
| 636 | |
danielk1977 | 0a732f5 | 2008-09-04 17:17:38 +0000 | [diff] [blame] | 637 | Tcl_SetVar2(interp, "sqlite_options", "threadsafe", |
drh | b99185f | 2016-03-18 00:19:48 +0000 | [diff] [blame] | 638 | SQLITE_THREADSAFE ? "1" : "0", TCL_GLOBAL_ONLY); |
| 639 | Tcl_SetVar2(interp, "sqlite_options", "threadsafe1", |
| 640 | SQLITE_THREADSAFE==1 ? "1" : "0", TCL_GLOBAL_ONLY); |
| 641 | Tcl_SetVar2(interp, "sqlite_options", "threadsafe2", |
| 642 | SQLITE_THREADSAFE==2 ? "1" : "0", TCL_GLOBAL_ONLY); |
danielk1977 | 0a732f5 | 2008-09-04 17:17:38 +0000 | [diff] [blame] | 643 | assert( sqlite3_threadsafe()==SQLITE_THREADSAFE ); |
drh | c797d4d | 2007-05-08 01:08:49 +0000 | [diff] [blame] | 644 | |
drh | f8cecda | 2008-10-10 23:48:25 +0000 | [diff] [blame] | 645 | #ifdef SQLITE_OMIT_TEMPDB |
| 646 | Tcl_SetVar2(interp, "sqlite_options", "tempdb", "0", TCL_GLOBAL_ONLY); |
| 647 | #else |
| 648 | Tcl_SetVar2(interp, "sqlite_options", "tempdb", "1", TCL_GLOBAL_ONLY); |
| 649 | #endif |
| 650 | |
drh | c797d4d | 2007-05-08 01:08:49 +0000 | [diff] [blame] | 651 | #ifdef SQLITE_OMIT_TRACE |
| 652 | Tcl_SetVar2(interp, "sqlite_options", "trace", "0", TCL_GLOBAL_ONLY); |
| 653 | #else |
| 654 | Tcl_SetVar2(interp, "sqlite_options", "trace", "1", TCL_GLOBAL_ONLY); |
| 655 | #endif |
| 656 | |
| 657 | #ifdef SQLITE_OMIT_TRIGGER |
| 658 | Tcl_SetVar2(interp, "sqlite_options", "trigger", "0", TCL_GLOBAL_ONLY); |
| 659 | #else |
| 660 | Tcl_SetVar2(interp, "sqlite_options", "trigger", "1", TCL_GLOBAL_ONLY); |
| 661 | #endif |
| 662 | |
drh | 4d9a7bf | 2010-07-07 01:52:31 +0000 | [diff] [blame] | 663 | #ifdef SQLITE_OMIT_TRUNCATE_OPTIMIZATION |
drh | f8cecda | 2008-10-10 23:48:25 +0000 | [diff] [blame] | 664 | Tcl_SetVar2(interp, "sqlite_options", "truncate_opt", "0", TCL_GLOBAL_ONLY); |
drh | c797d4d | 2007-05-08 01:08:49 +0000 | [diff] [blame] | 665 | #else |
drh | f8cecda | 2008-10-10 23:48:25 +0000 | [diff] [blame] | 666 | Tcl_SetVar2(interp, "sqlite_options", "truncate_opt", "1", TCL_GLOBAL_ONLY); |
drh | c797d4d | 2007-05-08 01:08:49 +0000 | [diff] [blame] | 667 | #endif |
| 668 | |
| 669 | #ifdef SQLITE_OMIT_UTF16 |
| 670 | Tcl_SetVar2(interp, "sqlite_options", "utf16", "0", TCL_GLOBAL_ONLY); |
| 671 | #else |
| 672 | Tcl_SetVar2(interp, "sqlite_options", "utf16", "1", TCL_GLOBAL_ONLY); |
| 673 | #endif |
| 674 | |
| 675 | #if defined(SQLITE_OMIT_VACUUM) || defined(SQLITE_OMIT_ATTACH) |
| 676 | Tcl_SetVar2(interp, "sqlite_options", "vacuum", "0", TCL_GLOBAL_ONLY); |
| 677 | #else |
| 678 | Tcl_SetVar2(interp, "sqlite_options", "vacuum", "1", TCL_GLOBAL_ONLY); |
| 679 | #endif |
| 680 | |
| 681 | #ifdef SQLITE_OMIT_VIEW |
| 682 | Tcl_SetVar2(interp, "sqlite_options", "view", "0", TCL_GLOBAL_ONLY); |
| 683 | #else |
| 684 | Tcl_SetVar2(interp, "sqlite_options", "view", "1", TCL_GLOBAL_ONLY); |
| 685 | #endif |
| 686 | |
| 687 | #ifdef SQLITE_OMIT_VIRTUALTABLE |
| 688 | Tcl_SetVar2(interp, "sqlite_options", "vtab", "0", TCL_GLOBAL_ONLY); |
| 689 | #else |
| 690 | Tcl_SetVar2(interp, "sqlite_options", "vtab", "1", TCL_GLOBAL_ONLY); |
| 691 | #endif |
| 692 | |
dan | 5cf5353 | 2010-05-01 16:40:20 +0000 | [diff] [blame] | 693 | #ifdef SQLITE_OMIT_WAL |
| 694 | Tcl_SetVar2(interp, "sqlite_options", "wal", "0", TCL_GLOBAL_ONLY); |
| 695 | #else |
| 696 | Tcl_SetVar2(interp, "sqlite_options", "wal", "1", TCL_GLOBAL_ONLY); |
| 697 | #endif |
| 698 | |
drh | 78f82d1 | 2008-09-02 00:52:52 +0000 | [diff] [blame] | 699 | #ifdef SQLITE_OMIT_WSD |
| 700 | Tcl_SetVar2(interp, "sqlite_options", "wsd", "0", TCL_GLOBAL_ONLY); |
| 701 | #else |
| 702 | Tcl_SetVar2(interp, "sqlite_options", "wsd", "1", TCL_GLOBAL_ONLY); |
| 703 | #endif |
| 704 | |
shane | 273f619 | 2008-10-10 04:34:16 +0000 | [diff] [blame] | 705 | #if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY) |
| 706 | Tcl_SetVar2(interp, "sqlite_options", "update_delete_limit", "1", TCL_GLOBAL_ONLY); |
| 707 | #else |
| 708 | Tcl_SetVar2(interp, "sqlite_options", "update_delete_limit", "0", TCL_GLOBAL_ONLY); |
| 709 | #endif |
| 710 | |
danielk1977 | 404ca07 | 2009-03-16 13:19:36 +0000 | [diff] [blame] | 711 | #if defined(SQLITE_ENABLE_UNLOCK_NOTIFY) |
| 712 | Tcl_SetVar2(interp, "sqlite_options", "unlock_notify", "1", TCL_GLOBAL_ONLY); |
| 713 | #else |
| 714 | Tcl_SetVar2(interp, "sqlite_options", "unlock_notify", "0", TCL_GLOBAL_ONLY); |
| 715 | #endif |
| 716 | |
drh | cb45eef | 2017-11-28 00:52:14 +0000 | [diff] [blame] | 717 | #ifdef SQLITE_FAST_SECURE_DELETE |
| 718 | Tcl_SetVar2(interp, "sqlite_options", "fast_secure_delete", "1", TCL_GLOBAL_ONLY); |
| 719 | #else |
| 720 | Tcl_SetVar2(interp, "sqlite_options", "fast_secure_delete", "0", TCL_GLOBAL_ONLY); |
| 721 | #endif |
| 722 | |
drh | c5d0bd9 | 2008-04-14 01:00:57 +0000 | [diff] [blame] | 723 | #ifdef SQLITE_SECURE_DELETE |
| 724 | Tcl_SetVar2(interp, "sqlite_options", "secure_delete", "1", TCL_GLOBAL_ONLY); |
| 725 | #else |
| 726 | Tcl_SetVar2(interp, "sqlite_options", "secure_delete", "0", TCL_GLOBAL_ONLY); |
| 727 | #endif |
| 728 | |
drh | 09e6054 | 2014-09-10 22:46:46 +0000 | [diff] [blame] | 729 | #ifdef SQLITE_USER_AUTHENTICATION |
| 730 | Tcl_SetVar2(interp, "sqlite_options", "userauth", "1", TCL_GLOBAL_ONLY); |
| 731 | #else |
| 732 | Tcl_SetVar2(interp, "sqlite_options", "userauth", "0", TCL_GLOBAL_ONLY); |
| 733 | #endif |
| 734 | |
shaneh | 050d09a | 2010-11-08 19:16:16 +0000 | [diff] [blame] | 735 | #ifdef SQLITE_MULTIPLEX_EXT_OVWR |
| 736 | Tcl_SetVar2(interp, "sqlite_options", "multiplex_ext_overwrite", "1", TCL_GLOBAL_ONLY); |
| 737 | #else |
| 738 | Tcl_SetVar2(interp, "sqlite_options", "multiplex_ext_overwrite", "0", TCL_GLOBAL_ONLY); |
| 739 | #endif |
| 740 | |
drh | ec424a5 | 2008-07-25 15:39:03 +0000 | [diff] [blame] | 741 | #ifdef YYTRACKMAXSTACKDEPTH |
| 742 | Tcl_SetVar2(interp, "sqlite_options", "yytrackmaxstackdepth", "1", TCL_GLOBAL_ONLY); |
| 743 | #else |
| 744 | Tcl_SetVar2(interp, "sqlite_options", "yytrackmaxstackdepth", "0", TCL_GLOBAL_ONLY); |
| 745 | #endif |
| 746 | |
dan | d83f7ca | 2015-11-12 20:12:51 +0000 | [diff] [blame] | 747 | #ifdef SQLITE_ENABLE_SQLLOG |
| 748 | Tcl_SetVar2(interp, "sqlite_options", "sqllog", "1", TCL_GLOBAL_ONLY); |
| 749 | #else |
| 750 | Tcl_SetVar2(interp, "sqlite_options", "sqllog", "0", TCL_GLOBAL_ONLY); |
| 751 | #endif |
| 752 | |
dan | 5c35e90 | 2016-10-26 12:15:41 +0000 | [diff] [blame] | 753 | #ifdef SQLITE_ENABLE_URI_00_ERROR |
| 754 | Tcl_SetVar2(interp, "sqlite_options", "uri_00_error", "1", TCL_GLOBAL_ONLY); |
| 755 | #else |
| 756 | Tcl_SetVar2(interp, "sqlite_options", "uri_00_error", "0", TCL_GLOBAL_ONLY); |
| 757 | #endif |
| 758 | |
mistachkin | 8bee11a | 2018-10-29 17:53:23 +0000 | [diff] [blame] | 759 | #if defined(SQLITE_ENABLE_NORMALIZE) |
| 760 | Tcl_SetVar2(interp, "sqlite_options", "normalize", "1", TCL_GLOBAL_ONLY); |
| 761 | #else |
| 762 | Tcl_SetVar2(interp, "sqlite_options", "normalize", "0", TCL_GLOBAL_ONLY); |
| 763 | #endif |
| 764 | |
dan | 67a9b8e | 2018-06-22 20:51:35 +0000 | [diff] [blame] | 765 | #ifdef SQLITE_OMIT_WINDOWFUNC |
| 766 | Tcl_SetVar2(interp, "sqlite_options", "windowfunc", "0", TCL_GLOBAL_ONLY); |
| 767 | #else |
| 768 | Tcl_SetVar2(interp, "sqlite_options", "windowfunc", "1", TCL_GLOBAL_ONLY); |
| 769 | #endif |
| 770 | |
drh | bb4957f | 2008-03-20 14:03:29 +0000 | [diff] [blame] | 771 | #define LINKVAR(x) { \ |
| 772 | static const int cv_ ## x = SQLITE_ ## x; \ |
| 773 | Tcl_LinkVar(interp, "SQLITE_" #x, (char *)&(cv_ ## x), \ |
| 774 | TCL_LINK_INT | TCL_LINK_READ_ONLY); } |
danielk1977 | e6a58a4 | 2007-08-31 17:42:48 +0000 | [diff] [blame] | 775 | |
| 776 | LINKVAR( MAX_LENGTH ); |
| 777 | LINKVAR( MAX_COLUMN ); |
| 778 | LINKVAR( MAX_SQL_LENGTH ); |
| 779 | LINKVAR( MAX_EXPR_DEPTH ); |
| 780 | LINKVAR( MAX_COMPOUND_SELECT ); |
| 781 | LINKVAR( MAX_VDBE_OP ); |
| 782 | LINKVAR( MAX_FUNCTION_ARG ); |
| 783 | LINKVAR( MAX_VARIABLE_NUMBER ); |
| 784 | LINKVAR( MAX_PAGE_SIZE ); |
| 785 | LINKVAR( MAX_PAGE_COUNT ); |
| 786 | LINKVAR( MAX_LIKE_PATTERN_LENGTH ); |
dan | f589450 | 2009-10-07 18:41:19 +0000 | [diff] [blame] | 787 | LINKVAR( MAX_TRIGGER_DEPTH ); |
drh | bb4957f | 2008-03-20 14:03:29 +0000 | [diff] [blame] | 788 | LINKVAR( DEFAULT_CACHE_SIZE ); |
| 789 | LINKVAR( DEFAULT_PAGE_SIZE ); |
| 790 | LINKVAR( DEFAULT_FILE_FORMAT ); |
dan | f5da7db | 2017-03-16 18:14:39 +0000 | [diff] [blame] | 791 | LINKVAR( DEFAULT_SYNCHRONOUS ); |
| 792 | LINKVAR( DEFAULT_WAL_SYNCHRONOUS ); |
drh | bb4957f | 2008-03-20 14:03:29 +0000 | [diff] [blame] | 793 | LINKVAR( MAX_ATTACHED ); |
dan | b0a4305 | 2011-07-06 09:36:59 +0000 | [diff] [blame] | 794 | LINKVAR( MAX_DEFAULT_PAGE_SIZE ); |
drh | 3705ef6 | 2014-10-08 15:53:21 +0000 | [diff] [blame] | 795 | LINKVAR( MAX_WORKER_THREADS ); |
danielk1977 | e6a58a4 | 2007-08-31 17:42:48 +0000 | [diff] [blame] | 796 | |
drh | c797d4d | 2007-05-08 01:08:49 +0000 | [diff] [blame] | 797 | { |
danielk1977 | b06a0b6 | 2008-06-26 10:54:12 +0000 | [diff] [blame] | 798 | static const int cv_TEMP_STORE = SQLITE_TEMP_STORE; |
drh | bb4957f | 2008-03-20 14:03:29 +0000 | [diff] [blame] | 799 | Tcl_LinkVar(interp, "TEMP_STORE", (char *)&(cv_TEMP_STORE), |
| 800 | TCL_LINK_INT | TCL_LINK_READ_ONLY); |
danielk1977 | 832b266 | 2007-05-09 11:37:22 +0000 | [diff] [blame] | 801 | } |
drh | c722a2c | 2012-06-21 15:02:26 +0000 | [diff] [blame] | 802 | |
| 803 | #ifdef _MSC_VER |
| 804 | { |
| 805 | static const int cv__MSC_VER = 1; |
| 806 | Tcl_LinkVar(interp, "_MSC_VER", (char *)&(cv__MSC_VER), |
| 807 | TCL_LINK_INT | TCL_LINK_READ_ONLY); |
| 808 | } |
| 809 | #endif |
| 810 | #ifdef __GNUC__ |
| 811 | { |
| 812 | static const int cv___GNUC__ = 1; |
| 813 | Tcl_LinkVar(interp, "__GNUC__", (char *)&(cv___GNUC__), |
| 814 | TCL_LINK_INT | TCL_LINK_READ_ONLY); |
| 815 | } |
| 816 | #endif |
drh | c797d4d | 2007-05-08 01:08:49 +0000 | [diff] [blame] | 817 | } |
| 818 | |
| 819 | |
| 820 | /* |
| 821 | ** Register commands with the TCL interpreter. |
| 822 | */ |
| 823 | int Sqliteconfig_Init(Tcl_Interp *interp){ |
| 824 | set_options(interp); |
| 825 | return TCL_OK; |
| 826 | } |