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