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 #ifdef 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_MEMSYS3 | |
123 Tcl_SetVar2(interp, "sqlite_options", "mem3", "1", TCL_GLOBAL_ONLY); | |
124 #else | |
125 Tcl_SetVar2(interp, "sqlite_options", "mem3", "0", TCL_GLOBAL_ONLY); | |
126 #endif | |
127 | |
128 #ifdef SQLITE_ENABLE_MEMSYS5 | |
129 Tcl_SetVar2(interp, "sqlite_options", "mem5", "1", TCL_GLOBAL_ONLY); | |
130 #else | |
131 Tcl_SetVar2(interp, "sqlite_options", "mem5", "0", TCL_GLOBAL_ONLY); | |
132 #endif | |
133 | |
134 #ifdef SQLITE_MUTEX_OMIT | |
135 Tcl_SetVar2(interp, "sqlite_options", "mutex", "0", TCL_GLOBAL_ONLY); | |
136 #else | |
137 Tcl_SetVar2(interp, "sqlite_options", "mutex", "1", TCL_GLOBAL_ONLY); | |
138 #endif | |
139 | |
140 #ifdef SQLITE_MUTEX_NOOP | |
141 Tcl_SetVar2(interp, "sqlite_options", "mutex_noop", "1", TCL_GLOBAL_ONLY); | |
142 #else | |
143 Tcl_SetVar2(interp, "sqlite_options", "mutex_noop", "0", TCL_GLOBAL_ONLY); | |
144 #endif | |
145 | |
146 #ifdef SQLITE_OMIT_ALTERTABLE | |
147 Tcl_SetVar2(interp, "sqlite_options", "altertable", "0", TCL_GLOBAL_ONLY); | |
148 #else | |
149 Tcl_SetVar2(interp, "sqlite_options", "altertable", "1", TCL_GLOBAL_ONLY); | |
150 #endif | |
151 | |
152 #ifdef SQLITE_OMIT_ANALYZE | |
153 Tcl_SetVar2(interp, "sqlite_options", "analyze", "0", TCL_GLOBAL_ONLY); | |
154 #else | |
155 Tcl_SetVar2(interp, "sqlite_options", "analyze", "1", TCL_GLOBAL_ONLY); | |
156 #endif | |
157 | |
158 #ifdef SQLITE_ENABLE_ATOMIC_WRITE | |
159 Tcl_SetVar2(interp, "sqlite_options", "atomicwrite", "1", TCL_GLOBAL_ONLY); | |
160 #else | |
161 Tcl_SetVar2(interp, "sqlite_options", "atomicwrite", "0", TCL_GLOBAL_ONLY); | |
162 #endif | |
163 | |
164 #ifdef SQLITE_OMIT_ATTACH | |
165 Tcl_SetVar2(interp, "sqlite_options", "attach", "0", TCL_GLOBAL_ONLY); | |
166 #else | |
167 Tcl_SetVar2(interp, "sqlite_options", "attach", "1", TCL_GLOBAL_ONLY); | |
168 #endif | |
169 | |
170 #ifdef SQLITE_OMIT_AUTHORIZATION | |
171 Tcl_SetVar2(interp, "sqlite_options", "auth", "0", TCL_GLOBAL_ONLY); | |
172 #else | |
173 Tcl_SetVar2(interp, "sqlite_options", "auth", "1", TCL_GLOBAL_ONLY); | |
174 #endif | |
175 | |
176 #ifdef SQLITE_OMIT_AUTOINCREMENT | |
177 Tcl_SetVar2(interp, "sqlite_options", "autoinc", "0", TCL_GLOBAL_ONLY); | |
178 #else | |
179 Tcl_SetVar2(interp, "sqlite_options", "autoinc", "1", TCL_GLOBAL_ONLY); | |
180 #endif | |
181 | |
182 #ifdef SQLITE_OMIT_AUTOMATIC_INDEX | |
183 Tcl_SetVar2(interp, "sqlite_options", "autoindex", "0", TCL_GLOBAL_ONLY); | |
184 #else | |
185 Tcl_SetVar2(interp, "sqlite_options", "autoindex", "1", TCL_GLOBAL_ONLY); | |
186 #endif | |
187 | |
188 #ifdef SQLITE_OMIT_AUTORESET | |
189 Tcl_SetVar2(interp, "sqlite_options", "autoreset", "0", TCL_GLOBAL_ONLY); | |
190 #else | |
191 Tcl_SetVar2(interp, "sqlite_options", "autoreset", "1", TCL_GLOBAL_ONLY); | |
192 #endif | |
193 | |
194 #ifdef SQLITE_OMIT_AUTOVACUUM | |
195 Tcl_SetVar2(interp, "sqlite_options", "autovacuum", "0", TCL_GLOBAL_ONLY); | |
196 #else | |
197 Tcl_SetVar2(interp, "sqlite_options", "autovacuum", "1", TCL_GLOBAL_ONLY); | |
198 #endif /* SQLITE_OMIT_AUTOVACUUM */ | |
199 #if !defined(SQLITE_DEFAULT_AUTOVACUUM) | |
200 Tcl_SetVar2(interp,"sqlite_options","default_autovacuum","0",TCL_GLOBAL_ONLY); | |
201 #else | |
202 Tcl_SetVar2(interp, "sqlite_options", "default_autovacuum", | |
203 STRINGVALUE(SQLITE_DEFAULT_AUTOVACUUM), TCL_GLOBAL_ONLY); | |
204 #endif | |
205 | |
206 #ifdef SQLITE_OMIT_BETWEEN_OPTIMIZATION | |
207 Tcl_SetVar2(interp, "sqlite_options", "between_opt", "0", TCL_GLOBAL_ONLY); | |
208 #else | |
209 Tcl_SetVar2(interp, "sqlite_options", "between_opt", "1", TCL_GLOBAL_ONLY); | |
210 #endif | |
211 | |
212 #ifdef SQLITE_OMIT_BUILTIN_TEST | |
213 Tcl_SetVar2(interp, "sqlite_options", "builtin_test", "0", TCL_GLOBAL_ONLY); | |
214 #else | |
215 Tcl_SetVar2(interp, "sqlite_options", "builtin_test", "1", TCL_GLOBAL_ONLY); | |
216 #endif | |
217 | |
218 #ifdef SQLITE_OMIT_BLOB_LITERAL | |
219 Tcl_SetVar2(interp, "sqlite_options", "bloblit", "0", TCL_GLOBAL_ONLY); | |
220 #else | |
221 Tcl_SetVar2(interp, "sqlite_options", "bloblit", "1", TCL_GLOBAL_ONLY); | |
222 #endif | |
223 | |
224 #ifdef SQLITE_OMIT_CAST | |
225 Tcl_SetVar2(interp, "sqlite_options", "cast", "0", TCL_GLOBAL_ONLY); | |
226 #else | |
227 Tcl_SetVar2(interp, "sqlite_options", "cast", "1", TCL_GLOBAL_ONLY); | |
228 #endif | |
229 | |
230 #ifdef SQLITE_OMIT_CHECK | |
231 Tcl_SetVar2(interp, "sqlite_options", "check", "0", TCL_GLOBAL_ONLY); | |
232 #else | |
233 Tcl_SetVar2(interp, "sqlite_options", "check", "1", TCL_GLOBAL_ONLY); | |
234 #endif | |
235 | |
236 #ifdef SQLITE_OMIT_CTE | |
237 Tcl_SetVar2(interp, "sqlite_options", "cte", "0", TCL_GLOBAL_ONLY); | |
238 #else | |
239 Tcl_SetVar2(interp, "sqlite_options", "cte", "1", TCL_GLOBAL_ONLY); | |
240 #endif | |
241 | |
242 #ifdef SQLITE_ENABLE_COLUMN_METADATA | |
243 Tcl_SetVar2(interp, "sqlite_options", "columnmetadata", "1", TCL_GLOBAL_ONLY); | |
244 #else | |
245 Tcl_SetVar2(interp, "sqlite_options", "columnmetadata", "0", TCL_GLOBAL_ONLY); | |
246 #endif | |
247 | |
248 #ifdef SQLITE_ENABLE_OVERSIZE_CELL_CHECK | |
249 Tcl_SetVar2(interp, "sqlite_options", "oversize_cell_check", "1", | |
250 TCL_GLOBAL_ONLY); | |
251 #else | |
252 Tcl_SetVar2(interp, "sqlite_options", "oversize_cell_check", "0", | |
253 TCL_GLOBAL_ONLY); | |
254 #endif | |
255 | |
256 #ifdef SQLITE_OMIT_COMPILEOPTION_DIAGS | |
257 Tcl_SetVar2(interp, "sqlite_options", "compileoption_diags", "0", TCL_GLOBAL_O
NLY); | |
258 #else | |
259 Tcl_SetVar2(interp, "sqlite_options", "compileoption_diags", "1", TCL_GLOBAL_O
NLY); | |
260 #endif | |
261 | |
262 #ifdef SQLITE_OMIT_COMPLETE | |
263 Tcl_SetVar2(interp, "sqlite_options", "complete", "0", TCL_GLOBAL_ONLY); | |
264 #else | |
265 Tcl_SetVar2(interp, "sqlite_options", "complete", "1", TCL_GLOBAL_ONLY); | |
266 #endif | |
267 | |
268 #ifdef SQLITE_OMIT_COMPOUND_SELECT | |
269 Tcl_SetVar2(interp, "sqlite_options", "compound", "0", TCL_GLOBAL_ONLY); | |
270 #else | |
271 Tcl_SetVar2(interp, "sqlite_options", "compound", "1", TCL_GLOBAL_ONLY); | |
272 #endif | |
273 | |
274 Tcl_SetVar2(interp, "sqlite_options", "conflict", "1", TCL_GLOBAL_ONLY); | |
275 Tcl_SetVar2(interp, "sqlite_options", "crashtest", "1", TCL_GLOBAL_ONLY); | |
276 | |
277 #ifdef SQLITE_OMIT_DATETIME_FUNCS | |
278 Tcl_SetVar2(interp, "sqlite_options", "datetime", "0", TCL_GLOBAL_ONLY); | |
279 #else | |
280 Tcl_SetVar2(interp, "sqlite_options", "datetime", "1", TCL_GLOBAL_ONLY); | |
281 #endif | |
282 | |
283 #ifdef SQLITE_OMIT_DECLTYPE | |
284 Tcl_SetVar2(interp, "sqlite_options", "decltype", "0", TCL_GLOBAL_ONLY); | |
285 #else | |
286 Tcl_SetVar2(interp, "sqlite_options", "decltype", "1", TCL_GLOBAL_ONLY); | |
287 #endif | |
288 | |
289 #ifdef SQLITE_OMIT_DEPRECATED | |
290 Tcl_SetVar2(interp, "sqlite_options", "deprecated", "0", TCL_GLOBAL_ONLY); | |
291 #else | |
292 Tcl_SetVar2(interp, "sqlite_options", "deprecated", "1", TCL_GLOBAL_ONLY); | |
293 #endif | |
294 | |
295 #ifdef SQLITE_OMIT_DISKIO | |
296 Tcl_SetVar2(interp, "sqlite_options", "diskio", "0", TCL_GLOBAL_ONLY); | |
297 #else | |
298 Tcl_SetVar2(interp, "sqlite_options", "diskio", "1", TCL_GLOBAL_ONLY); | |
299 #endif | |
300 | |
301 #ifdef SQLITE_OMIT_EXPLAIN | |
302 Tcl_SetVar2(interp, "sqlite_options", "explain", "0", TCL_GLOBAL_ONLY); | |
303 #else | |
304 Tcl_SetVar2(interp, "sqlite_options", "explain", "1", TCL_GLOBAL_ONLY); | |
305 #endif | |
306 | |
307 #ifdef SQLITE_OMIT_FLOATING_POINT | |
308 Tcl_SetVar2(interp, "sqlite_options", "floatingpoint", "0", TCL_GLOBAL_ONLY); | |
309 #else | |
310 Tcl_SetVar2(interp, "sqlite_options", "floatingpoint", "1", TCL_GLOBAL_ONLY); | |
311 #endif | |
312 | |
313 #ifdef SQLITE_OMIT_FOREIGN_KEY | |
314 Tcl_SetVar2(interp, "sqlite_options", "foreignkey", "0", TCL_GLOBAL_ONLY); | |
315 #else | |
316 Tcl_SetVar2(interp, "sqlite_options", "foreignkey", "1", TCL_GLOBAL_ONLY); | |
317 #endif | |
318 | |
319 #ifdef SQLITE_ENABLE_FTS1 | |
320 Tcl_SetVar2(interp, "sqlite_options", "fts1", "1", TCL_GLOBAL_ONLY); | |
321 #else | |
322 Tcl_SetVar2(interp, "sqlite_options", "fts1", "0", TCL_GLOBAL_ONLY); | |
323 #endif | |
324 | |
325 #ifdef SQLITE_ENABLE_FTS2 | |
326 Tcl_SetVar2(interp, "sqlite_options", "fts2", "1", TCL_GLOBAL_ONLY); | |
327 #else | |
328 Tcl_SetVar2(interp, "sqlite_options", "fts2", "0", TCL_GLOBAL_ONLY); | |
329 #endif | |
330 | |
331 #ifdef SQLITE_ENABLE_FTS3 | |
332 Tcl_SetVar2(interp, "sqlite_options", "fts3", "1", TCL_GLOBAL_ONLY); | |
333 #else | |
334 Tcl_SetVar2(interp, "sqlite_options", "fts3", "0", TCL_GLOBAL_ONLY); | |
335 #endif | |
336 | |
337 #if defined(SQLITE_ENABLE_FTS3) && !defined(SQLITE_DISABLE_FTS3_UNICODE) | |
338 Tcl_SetVar2(interp, "sqlite_options", "fts3_unicode", "1", TCL_GLOBAL_ONLY); | |
339 #else | |
340 Tcl_SetVar2(interp, "sqlite_options", "fts3_unicode", "0", TCL_GLOBAL_ONLY); | |
341 #endif | |
342 | |
343 #ifdef SQLITE_DISABLE_FTS4_DEFERRED | |
344 Tcl_SetVar2(interp, "sqlite_options", "fts4_deferred", "0", TCL_GLOBAL_ONLY); | |
345 #else | |
346 Tcl_SetVar2(interp, "sqlite_options", "fts4_deferred", "1", TCL_GLOBAL_ONLY); | |
347 #endif | |
348 | |
349 #ifdef SQLITE_OMIT_GET_TABLE | |
350 Tcl_SetVar2(interp, "sqlite_options", "gettable", "0", TCL_GLOBAL_ONLY); | |
351 #else | |
352 Tcl_SetVar2(interp, "sqlite_options", "gettable", "1", TCL_GLOBAL_ONLY); | |
353 #endif | |
354 | |
355 #ifdef SQLITE_ENABLE_ICU | |
356 Tcl_SetVar2(interp, "sqlite_options", "icu", "1", TCL_GLOBAL_ONLY); | |
357 #else | |
358 Tcl_SetVar2(interp, "sqlite_options", "icu", "0", TCL_GLOBAL_ONLY); | |
359 #endif | |
360 | |
361 #ifdef SQLITE_OMIT_INCRBLOB | |
362 Tcl_SetVar2(interp, "sqlite_options", "incrblob", "0", TCL_GLOBAL_ONLY); | |
363 #else | |
364 Tcl_SetVar2(interp, "sqlite_options", "incrblob", "1", TCL_GLOBAL_ONLY); | |
365 #endif /* SQLITE_OMIT_AUTOVACUUM */ | |
366 | |
367 #ifdef SQLITE_OMIT_INTEGRITY_CHECK | |
368 Tcl_SetVar2(interp, "sqlite_options", "integrityck", "0", TCL_GLOBAL_ONLY); | |
369 #else | |
370 Tcl_SetVar2(interp, "sqlite_options", "integrityck", "1", TCL_GLOBAL_ONLY); | |
371 #endif | |
372 | |
373 #if defined(SQLITE_DEFAULT_FILE_FORMAT) && SQLITE_DEFAULT_FILE_FORMAT==1 | |
374 Tcl_SetVar2(interp, "sqlite_options", "legacyformat", "1", TCL_GLOBAL_ONLY); | |
375 #else | |
376 Tcl_SetVar2(interp, "sqlite_options", "legacyformat", "0", TCL_GLOBAL_ONLY); | |
377 #endif | |
378 | |
379 #ifdef SQLITE_OMIT_LIKE_OPTIMIZATION | |
380 Tcl_SetVar2(interp, "sqlite_options", "like_opt", "0", TCL_GLOBAL_ONLY); | |
381 #else | |
382 Tcl_SetVar2(interp, "sqlite_options", "like_opt", "1", TCL_GLOBAL_ONLY); | |
383 #endif | |
384 | |
385 #ifdef SQLITE_OMIT_LOAD_EXTENSION | |
386 Tcl_SetVar2(interp, "sqlite_options", "load_ext", "0", TCL_GLOBAL_ONLY); | |
387 #else | |
388 Tcl_SetVar2(interp, "sqlite_options", "load_ext", "1", TCL_GLOBAL_ONLY); | |
389 #endif | |
390 | |
391 #ifdef SQLITE_OMIT_LOCALTIME | |
392 Tcl_SetVar2(interp, "sqlite_options", "localtime", "0", TCL_GLOBAL_ONLY); | |
393 #else | |
394 Tcl_SetVar2(interp, "sqlite_options", "localtime", "1", TCL_GLOBAL_ONLY); | |
395 #endif | |
396 | |
397 #ifdef SQLITE_OMIT_LOOKASIDE | |
398 Tcl_SetVar2(interp, "sqlite_options", "lookaside", "0", TCL_GLOBAL_ONLY); | |
399 #else | |
400 Tcl_SetVar2(interp, "sqlite_options", "lookaside", "1", TCL_GLOBAL_ONLY); | |
401 #endif | |
402 | |
403 Tcl_SetVar2(interp, "sqlite_options", "long_double", | |
404 sizeof(LONGDOUBLE_TYPE)>sizeof(double) ? "1" : "0", | |
405 TCL_GLOBAL_ONLY); | |
406 | |
407 #ifdef SQLITE_OMIT_MEMORYDB | |
408 Tcl_SetVar2(interp, "sqlite_options", "memorydb", "0", TCL_GLOBAL_ONLY); | |
409 #else | |
410 Tcl_SetVar2(interp, "sqlite_options", "memorydb", "1", TCL_GLOBAL_ONLY); | |
411 #endif | |
412 | |
413 #ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT | |
414 Tcl_SetVar2(interp, "sqlite_options", "memorymanage", "1", TCL_GLOBAL_ONLY); | |
415 #else | |
416 Tcl_SetVar2(interp, "sqlite_options", "memorymanage", "0", TCL_GLOBAL_ONLY); | |
417 #endif | |
418 | |
419 Tcl_SetVar2(interp, "sqlite_options", "mergesort", "1", TCL_GLOBAL_ONLY); | |
420 | |
421 #ifdef SQLITE_OMIT_OR_OPTIMIZATION | |
422 Tcl_SetVar2(interp, "sqlite_options", "or_opt", "0", TCL_GLOBAL_ONLY); | |
423 #else | |
424 Tcl_SetVar2(interp, "sqlite_options", "or_opt", "1", TCL_GLOBAL_ONLY); | |
425 #endif | |
426 | |
427 #ifdef SQLITE_OMIT_PAGER_PRAGMAS | |
428 Tcl_SetVar2(interp, "sqlite_options", "pager_pragmas", "0", TCL_GLOBAL_ONLY); | |
429 #else | |
430 Tcl_SetVar2(interp, "sqlite_options", "pager_pragmas", "1", TCL_GLOBAL_ONLY); | |
431 #endif | |
432 | |
433 #if defined(SQLITE_OMIT_PRAGMA) || defined(SQLITE_OMIT_FLAG_PRAGMAS) | |
434 Tcl_SetVar2(interp, "sqlite_options", "pragma", "0", TCL_GLOBAL_ONLY); | |
435 Tcl_SetVar2(interp, "sqlite_options", "integrityck", "0", TCL_GLOBAL_ONLY); | |
436 #else | |
437 Tcl_SetVar2(interp, "sqlite_options", "pragma", "1", TCL_GLOBAL_ONLY); | |
438 #endif | |
439 | |
440 #ifdef SQLITE_OMIT_PROGRESS_CALLBACK | |
441 Tcl_SetVar2(interp, "sqlite_options", "progress", "0", TCL_GLOBAL_ONLY); | |
442 #else | |
443 Tcl_SetVar2(interp, "sqlite_options", "progress", "1", TCL_GLOBAL_ONLY); | |
444 #endif | |
445 | |
446 #ifdef SQLITE_OMIT_REINDEX | |
447 Tcl_SetVar2(interp, "sqlite_options", "reindex", "0", TCL_GLOBAL_ONLY); | |
448 #else | |
449 Tcl_SetVar2(interp, "sqlite_options", "reindex", "1", TCL_GLOBAL_ONLY); | |
450 #endif | |
451 | |
452 #ifdef SQLITE_ENABLE_RTREE | |
453 Tcl_SetVar2(interp, "sqlite_options", "rtree", "1", TCL_GLOBAL_ONLY); | |
454 #else | |
455 Tcl_SetVar2(interp, "sqlite_options", "rtree", "0", TCL_GLOBAL_ONLY); | |
456 #endif | |
457 | |
458 #ifdef SQLITE_RTREE_INT_ONLY | |
459 Tcl_SetVar2(interp, "sqlite_options", "rtree_int_only", "1", TCL_GLOBAL_ONLY); | |
460 #else | |
461 Tcl_SetVar2(interp, "sqlite_options", "rtree_int_only", "0", TCL_GLOBAL_ONLY); | |
462 #endif | |
463 | |
464 #ifdef SQLITE_OMIT_SCHEMA_PRAGMAS | |
465 Tcl_SetVar2(interp, "sqlite_options", "schema_pragmas", "0", TCL_GLOBAL_ONLY); | |
466 #else | |
467 Tcl_SetVar2(interp, "sqlite_options", "schema_pragmas", "1", TCL_GLOBAL_ONLY); | |
468 #endif | |
469 | |
470 #ifdef SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS | |
471 Tcl_SetVar2(interp, "sqlite_options", "schema_version", "0", TCL_GLOBAL_ONLY); | |
472 #else | |
473 Tcl_SetVar2(interp, "sqlite_options", "schema_version", "1", TCL_GLOBAL_ONLY); | |
474 #endif | |
475 | |
476 #ifdef SQLITE_ENABLE_STAT4 | |
477 Tcl_SetVar2(interp, "sqlite_options", "stat4", "1", TCL_GLOBAL_ONLY); | |
478 #else | |
479 Tcl_SetVar2(interp, "sqlite_options", "stat4", "0", TCL_GLOBAL_ONLY); | |
480 #endif | |
481 #if defined(SQLITE_ENABLE_STAT3) && !defined(SQLITE_ENABLE_STAT4) | |
482 Tcl_SetVar2(interp, "sqlite_options", "stat3", "1", TCL_GLOBAL_ONLY); | |
483 #else | |
484 Tcl_SetVar2(interp, "sqlite_options", "stat3", "0", TCL_GLOBAL_ONLY); | |
485 #endif | |
486 | |
487 #if !defined(SQLITE_ENABLE_LOCKING_STYLE) | |
488 # if defined(__APPLE__) | |
489 # define SQLITE_ENABLE_LOCKING_STYLE 1 | |
490 # else | |
491 # define SQLITE_ENABLE_LOCKING_STYLE 0 | |
492 # endif | |
493 #endif | |
494 #if SQLITE_ENABLE_LOCKING_STYLE && defined(__APPLE__) | |
495 Tcl_SetVar2(interp,"sqlite_options","lock_proxy_pragmas","1",TCL_GLOBAL_ONLY); | |
496 #else | |
497 Tcl_SetVar2(interp,"sqlite_options","lock_proxy_pragmas","0",TCL_GLOBAL_ONLY); | |
498 #endif | |
499 #if defined(SQLITE_PREFER_PROXY_LOCKING) && defined(__APPLE__) | |
500 Tcl_SetVar2(interp,"sqlite_options","prefer_proxy_locking","1",TCL_GLOBAL_ONLY
); | |
501 #else | |
502 Tcl_SetVar2(interp,"sqlite_options","prefer_proxy_locking","0",TCL_GLOBAL_ONLY
); | |
503 #endif | |
504 | |
505 | |
506 #ifdef SQLITE_OMIT_SHARED_CACHE | |
507 Tcl_SetVar2(interp, "sqlite_options", "shared_cache", "0", TCL_GLOBAL_ONLY); | |
508 #else | |
509 Tcl_SetVar2(interp, "sqlite_options", "shared_cache", "1", TCL_GLOBAL_ONLY); | |
510 #endif | |
511 | |
512 #ifdef SQLITE_OMIT_SUBQUERY | |
513 Tcl_SetVar2(interp, "sqlite_options", "subquery", "0", TCL_GLOBAL_ONLY); | |
514 #else | |
515 Tcl_SetVar2(interp, "sqlite_options", "subquery", "1", TCL_GLOBAL_ONLY); | |
516 #endif | |
517 | |
518 #ifdef SQLITE_OMIT_TCL_VARIABLE | |
519 Tcl_SetVar2(interp, "sqlite_options", "tclvar", "0", TCL_GLOBAL_ONLY); | |
520 #else | |
521 Tcl_SetVar2(interp, "sqlite_options", "tclvar", "1", TCL_GLOBAL_ONLY); | |
522 #endif | |
523 | |
524 Tcl_SetVar2(interp, "sqlite_options", "threadsafe", | |
525 STRINGVALUE(SQLITE_THREADSAFE), TCL_GLOBAL_ONLY); | |
526 assert( sqlite3_threadsafe()==SQLITE_THREADSAFE ); | |
527 | |
528 #ifdef SQLITE_OMIT_TEMPDB | |
529 Tcl_SetVar2(interp, "sqlite_options", "tempdb", "0", TCL_GLOBAL_ONLY); | |
530 #else | |
531 Tcl_SetVar2(interp, "sqlite_options", "tempdb", "1", TCL_GLOBAL_ONLY); | |
532 #endif | |
533 | |
534 #ifdef SQLITE_OMIT_TRACE | |
535 Tcl_SetVar2(interp, "sqlite_options", "trace", "0", TCL_GLOBAL_ONLY); | |
536 #else | |
537 Tcl_SetVar2(interp, "sqlite_options", "trace", "1", TCL_GLOBAL_ONLY); | |
538 #endif | |
539 | |
540 #ifdef SQLITE_OMIT_TRIGGER | |
541 Tcl_SetVar2(interp, "sqlite_options", "trigger", "0", TCL_GLOBAL_ONLY); | |
542 #else | |
543 Tcl_SetVar2(interp, "sqlite_options", "trigger", "1", TCL_GLOBAL_ONLY); | |
544 #endif | |
545 | |
546 #ifdef SQLITE_OMIT_TRUNCATE_OPTIMIZATION | |
547 Tcl_SetVar2(interp, "sqlite_options", "truncate_opt", "0", TCL_GLOBAL_ONLY); | |
548 #else | |
549 Tcl_SetVar2(interp, "sqlite_options", "truncate_opt", "1", TCL_GLOBAL_ONLY); | |
550 #endif | |
551 | |
552 #ifdef SQLITE_OMIT_UTF16 | |
553 Tcl_SetVar2(interp, "sqlite_options", "utf16", "0", TCL_GLOBAL_ONLY); | |
554 #else | |
555 Tcl_SetVar2(interp, "sqlite_options", "utf16", "1", TCL_GLOBAL_ONLY); | |
556 #endif | |
557 | |
558 #if defined(SQLITE_OMIT_VACUUM) || defined(SQLITE_OMIT_ATTACH) | |
559 Tcl_SetVar2(interp, "sqlite_options", "vacuum", "0", TCL_GLOBAL_ONLY); | |
560 #else | |
561 Tcl_SetVar2(interp, "sqlite_options", "vacuum", "1", TCL_GLOBAL_ONLY); | |
562 #endif | |
563 | |
564 #ifdef SQLITE_OMIT_VIEW | |
565 Tcl_SetVar2(interp, "sqlite_options", "view", "0", TCL_GLOBAL_ONLY); | |
566 #else | |
567 Tcl_SetVar2(interp, "sqlite_options", "view", "1", TCL_GLOBAL_ONLY); | |
568 #endif | |
569 | |
570 #ifdef SQLITE_OMIT_VIRTUALTABLE | |
571 Tcl_SetVar2(interp, "sqlite_options", "vtab", "0", TCL_GLOBAL_ONLY); | |
572 #else | |
573 Tcl_SetVar2(interp, "sqlite_options", "vtab", "1", TCL_GLOBAL_ONLY); | |
574 #endif | |
575 | |
576 #ifdef SQLITE_OMIT_WAL | |
577 Tcl_SetVar2(interp, "sqlite_options", "wal", "0", TCL_GLOBAL_ONLY); | |
578 #else | |
579 Tcl_SetVar2(interp, "sqlite_options", "wal", "1", TCL_GLOBAL_ONLY); | |
580 #endif | |
581 | |
582 #ifdef SQLITE_OMIT_WSD | |
583 Tcl_SetVar2(interp, "sqlite_options", "wsd", "0", TCL_GLOBAL_ONLY); | |
584 #else | |
585 Tcl_SetVar2(interp, "sqlite_options", "wsd", "1", TCL_GLOBAL_ONLY); | |
586 #endif | |
587 | |
588 #if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY) | |
589 Tcl_SetVar2(interp, "sqlite_options", "update_delete_limit", "1", TCL_GLOBAL_O
NLY); | |
590 #else | |
591 Tcl_SetVar2(interp, "sqlite_options", "update_delete_limit", "0", TCL_GLOBAL_O
NLY); | |
592 #endif | |
593 | |
594 #if defined(SQLITE_ENABLE_UNLOCK_NOTIFY) | |
595 Tcl_SetVar2(interp, "sqlite_options", "unlock_notify", "1", TCL_GLOBAL_ONLY); | |
596 #else | |
597 Tcl_SetVar2(interp, "sqlite_options", "unlock_notify", "0", TCL_GLOBAL_ONLY); | |
598 #endif | |
599 | |
600 #ifdef SQLITE_SECURE_DELETE | |
601 Tcl_SetVar2(interp, "sqlite_options", "secure_delete", "1", TCL_GLOBAL_ONLY); | |
602 #else | |
603 Tcl_SetVar2(interp, "sqlite_options", "secure_delete", "0", TCL_GLOBAL_ONLY); | |
604 #endif | |
605 | |
606 #ifdef SQLITE_USER_AUTHENTICATION | |
607 Tcl_SetVar2(interp, "sqlite_options", "userauth", "1", TCL_GLOBAL_ONLY); | |
608 #else | |
609 Tcl_SetVar2(interp, "sqlite_options", "userauth", "0", TCL_GLOBAL_ONLY); | |
610 #endif | |
611 | |
612 #ifdef SQLITE_MULTIPLEX_EXT_OVWR | |
613 Tcl_SetVar2(interp, "sqlite_options", "multiplex_ext_overwrite", "1", TCL_GLOB
AL_ONLY); | |
614 #else | |
615 Tcl_SetVar2(interp, "sqlite_options", "multiplex_ext_overwrite", "0", TCL_GLOB
AL_ONLY); | |
616 #endif | |
617 | |
618 #ifdef YYTRACKMAXSTACKDEPTH | |
619 Tcl_SetVar2(interp, "sqlite_options", "yytrackmaxstackdepth", "1", TCL_GLOBAL_
ONLY); | |
620 #else | |
621 Tcl_SetVar2(interp, "sqlite_options", "yytrackmaxstackdepth", "0", TCL_GLOBAL_
ONLY); | |
622 #endif | |
623 | |
624 #define LINKVAR(x) { \ | |
625 static const int cv_ ## x = SQLITE_ ## x; \ | |
626 Tcl_LinkVar(interp, "SQLITE_" #x, (char *)&(cv_ ## x), \ | |
627 TCL_LINK_INT | TCL_LINK_READ_ONLY); } | |
628 | |
629 LINKVAR( MAX_LENGTH ); | |
630 LINKVAR( MAX_COLUMN ); | |
631 LINKVAR( MAX_SQL_LENGTH ); | |
632 LINKVAR( MAX_EXPR_DEPTH ); | |
633 LINKVAR( MAX_COMPOUND_SELECT ); | |
634 LINKVAR( MAX_VDBE_OP ); | |
635 LINKVAR( MAX_FUNCTION_ARG ); | |
636 LINKVAR( MAX_VARIABLE_NUMBER ); | |
637 LINKVAR( MAX_PAGE_SIZE ); | |
638 LINKVAR( MAX_PAGE_COUNT ); | |
639 LINKVAR( MAX_LIKE_PATTERN_LENGTH ); | |
640 LINKVAR( MAX_TRIGGER_DEPTH ); | |
641 LINKVAR( DEFAULT_TEMP_CACHE_SIZE ); | |
642 LINKVAR( DEFAULT_CACHE_SIZE ); | |
643 LINKVAR( DEFAULT_PAGE_SIZE ); | |
644 LINKVAR( DEFAULT_FILE_FORMAT ); | |
645 LINKVAR( MAX_ATTACHED ); | |
646 LINKVAR( MAX_DEFAULT_PAGE_SIZE ); | |
647 LINKVAR( MAX_WORKER_THREADS ); | |
648 | |
649 { | |
650 static const int cv_TEMP_STORE = SQLITE_TEMP_STORE; | |
651 Tcl_LinkVar(interp, "TEMP_STORE", (char *)&(cv_TEMP_STORE), | |
652 TCL_LINK_INT | TCL_LINK_READ_ONLY); | |
653 } | |
654 | |
655 #ifdef _MSC_VER | |
656 { | |
657 static const int cv__MSC_VER = 1; | |
658 Tcl_LinkVar(interp, "_MSC_VER", (char *)&(cv__MSC_VER), | |
659 TCL_LINK_INT | TCL_LINK_READ_ONLY); | |
660 } | |
661 #endif | |
662 #ifdef __GNUC__ | |
663 { | |
664 static const int cv___GNUC__ = 1; | |
665 Tcl_LinkVar(interp, "__GNUC__", (char *)&(cv___GNUC__), | |
666 TCL_LINK_INT | TCL_LINK_READ_ONLY); | |
667 } | |
668 #endif | |
669 } | |
670 | |
671 | |
672 /* | |
673 ** Register commands with the TCL interpreter. | |
674 */ | |
675 int Sqliteconfig_Init(Tcl_Interp *interp){ | |
676 set_options(interp); | |
677 return TCL_OK; | |
678 } | |
OLD | NEW |