3 # Run this script to generate the pragma name lookup table C code.
5 # To add new pragmas, first add the name and other relevant attributes
6 # of the pragma to the "pragma_def" object below. Then run this script
7 # to generate the C-code for the lookup table and copy/paste the output
8 # of this script into the appropriate spot in the pragma.c source file.
9 # Then add the extra "case PragTyp_XXXXX:" and subsequent code for the
14 NAME
: full_column_names
16 ARG
: SQLITE_FullColNames
17 IF
: !defined
(SQLITE_OMIT_FLAG_PRAGMAS
)
19 NAME
: short_column_names
21 ARG
: SQLITE_ShortColNames
22 IF
: !defined
(SQLITE_OMIT_FLAG_PRAGMAS
)
27 IF
: !defined
(SQLITE_OMIT_FLAG_PRAGMAS
)
29 NAME
: empty_result_callbacks
31 ARG
: SQLITE_NullCallback
32 IF
: !defined
(SQLITE_OMIT_FLAG_PRAGMAS
)
34 NAME
: legacy_file_format
36 ARG
: SQLITE_LegacyFileFmt
37 IF
: !defined
(SQLITE_OMIT_FLAG_PRAGMAS
)
42 IF
: !defined
(SQLITE_OMIT_FLAG_PRAGMAS
)
44 NAME
: checkpoint_fullfsync
46 ARG
: SQLITE_CkptFullFSync
47 IF
: !defined
(SQLITE_OMIT_FLAG_PRAGMAS
)
51 ARG
: SQLITE_CacheSpill
52 IF
: !defined
(SQLITE_OMIT_FLAG_PRAGMAS
)
54 NAME
: reverse_unordered_selects
56 ARG
: SQLITE_ReverseOrder
57 IF
: !defined
(SQLITE_OMIT_FLAG_PRAGMAS
)
62 IF
: !defined
(SQLITE_OMIT_FLAG_PRAGMAS
)
67 IF
: !defined
(SQLITE_OMIT_FLAG_PRAGMAS
)
68 IF
: !defined
(SQLITE_OMIT_AUTOMATIC_INDEX
)
73 IF
: !defined
(SQLITE_OMIT_FLAG_PRAGMAS
)
74 IF
: defined
(SQLITE_DEBUG
)
78 ARG
: SQLITE_VdbeListing
79 IF
: !defined
(SQLITE_OMIT_FLAG_PRAGMAS
)
80 IF
: defined
(SQLITE_DEBUG
)
85 IF
: !defined
(SQLITE_OMIT_FLAG_PRAGMAS
)
86 IF
: defined
(SQLITE_DEBUG
)
90 ARG
: SQLITE_VdbeAddopTrace
91 IF
: !defined
(SQLITE_OMIT_FLAG_PRAGMAS
)
92 IF
: defined
(SQLITE_DEBUG
)
96 ARG
: SQLITE_SqlTrace|SQLITE_VdbeListing|SQLITE_VdbeTrace
97 IF
: !defined
(SQLITE_OMIT_FLAG_PRAGMAS
)
98 IF
: defined
(SQLITE_DEBUG
)
103 IF
: !defined
(SQLITE_OMIT_FLAG_PRAGMAS
)
104 IF
: defined
(SQLITE_DEBUG
)
106 NAME
: ignore_check_constraints
108 ARG
: SQLITE_IgnoreChecks
109 IF
: !defined
(SQLITE_OMIT_FLAG_PRAGMAS
)
110 IF
: !defined
(SQLITE_OMIT_CHECK
)
112 NAME
: writable_schema
114 ARG
: SQLITE_WriteSchema|SQLITE_RecoveryMode
115 IF
: !defined
(SQLITE_OMIT_FLAG_PRAGMAS
)
117 NAME
: read_uncommitted
119 ARG
: SQLITE_ReadUncommitted
120 IF
: !defined
(SQLITE_OMIT_FLAG_PRAGMAS
)
122 NAME
: recursive_triggers
124 ARG
: SQLITE_RecTriggers
125 IF
: !defined
(SQLITE_OMIT_FLAG_PRAGMAS
)
129 ARG
: SQLITE_ForeignKeys
130 IF
: !defined
(SQLITE_OMIT_FLAG_PRAGMAS
)
131 IF
: !defined
(SQLITE_OMIT_FOREIGN_KEY
) && !defined
(SQLITE_OMIT_TRIGGER
)
133 NAME
: defer_foreign_keys
136 IF
: !defined
(SQLITE_OMIT_FLAG_PRAGMAS
)
137 IF
: !defined
(SQLITE_OMIT_FOREIGN_KEY
) && !defined
(SQLITE_OMIT_TRIGGER
)
139 NAME
: default_cache_size
141 IF
: !defined
(SQLITE_OMIT_PAGER_PRAGMAS
) && !defined
(SQLITE_OMIT_DEPRECATED
)
144 IF
: !defined
(SQLITE_OMIT_PAGER_PRAGMAS
)
147 IF
: !defined
(SQLITE_OMIT_PAGER_PRAGMAS
)
151 IF
: !defined
(SQLITE_OMIT_PAGER_PRAGMAS
)
156 IF
: !defined
(SQLITE_OMIT_PAGER_PRAGMAS
)
159 IF
: !defined
(SQLITE_OMIT_PAGER_PRAGMAS
)
163 IF
: !defined
(SQLITE_OMIT_PAGER_PRAGMAS
)
165 NAME
: journal_size_limit
166 IF
: !defined
(SQLITE_OMIT_PAGER_PRAGMAS
)
170 IF
: !defined
(SQLITE_OMIT_PAGER_PRAGMAS
)
173 IF
: !defined
(SQLITE_OMIT_PAGER_PRAGMAS
)
177 IF
: !defined
(SQLITE_OMIT_AUTOVACUUM
)
179 NAME
: incremental_vacuum
181 IF
: !defined
(SQLITE_OMIT_AUTOVACUUM
)
184 IF
: !defined
(SQLITE_OMIT_PAGER_PRAGMAS
)
186 NAME
: temp_store_directory
187 IF
: !defined
(SQLITE_OMIT_PAGER_PRAGMAS
)
189 NAME
: data_store_directory
190 IF
: !defined
(SQLITE_OMIT_PAGER_PRAGMAS
) && SQLITE_OS_WIN
192 NAME
: lock_proxy_file
193 IF
: !defined
(SQLITE_OMIT_PAGER_PRAGMAS
) && SQLITE_ENABLE_LOCKING_STYLE
197 IF
: !defined
(SQLITE_OMIT_PAGER_PRAGMAS
)
201 IF
: !defined
(SQLITE_OMIT_SCHEMA_PRAGMAS
)
205 IF
: !defined
(SQLITE_OMIT_SCHEMA_PRAGMAS
)
209 IF
: !defined
(SQLITE_OMIT_SCHEMA_PRAGMAS
)
213 IF
: !defined
(SQLITE_OMIT_SCHEMA_PRAGMAS
)
217 IF
: !defined
(SQLITE_OMIT_SCHEMA_PRAGMAS
)
220 IF
: !defined
(SQLITE_OMIT_SCHEMA_PRAGMAS
)
222 NAME
: foreign_key_list
224 IF
: !defined
(SQLITE_OMIT_FOREIGN_KEY
)
226 NAME
: foreign_key_check
228 IF
: !defined
(SQLITE_OMIT_FOREIGN_KEY
) && !defined
(SQLITE_OMIT_TRIGGER
)
231 IF
: defined
(SQLITE_DEBUG
)
233 NAME
: case_sensitive_like
235 NAME
: integrity_check
237 IF
: !defined
(SQLITE_OMIT_INTEGRITY_CHECK
)
240 TYPE
: INTEGRITY_CHECK
242 IF
: !defined
(SQLITE_OMIT_INTEGRITY_CHECK
)
245 IF
: !defined
(SQLITE_OMIT_UTF16
)
249 IF
: !defined
(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS
)
253 IF
: !defined
(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS
)
257 IF
: !defined
(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS
)
261 IF
: !defined
(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS
)
263 NAME
: compile_options
264 IF
: !defined
(SQLITE_OMIT_COMPILEOPTION_DIAGS
)
268 IF
: !defined
(SQLITE_OMIT_WAL
)
270 NAME
: wal_autocheckpoint
271 IF
: !defined
(SQLITE_OMIT_WAL
)
278 IF
: defined
(SQLITE_DEBUG
) || defined
(SQLITE_TEST
)
281 IF
: defined
(SQLITE_HAS_CODEC
)
284 IF
: defined
(SQLITE_HAS_CODEC
)
287 IF
: defined
(SQLITE_HAS_CODEC
)
291 IF
: defined
(SQLITE_HAS_CODEC
)
293 NAME
: activate_extensions
294 IF
: defined
(SQLITE_HAS_CODEC
) || defined
(SQLITE_ENABLE_CEROD
)
296 NAME
: soft_heap_limit
300 fconfigure stdout
-translation lf
307 global name type
if arg allbyname typebyif flags
308 if {$name==""} return
309 set allbyname
($name) [list $type $arg $if $flags]
316 foreach line
[split $pragma_def \n] {
317 set line
[string trim
$line]
318 if {$line==""} continue
319 foreach {id val
} [split $line :] break
320 set val
[string trim
$val]
324 set type
[string toupper
$val]
325 } elseif
{$id=="TYPE"} {
327 } elseif
{$id=="ARG"} {
329 } elseif
{$id=="IF"} {
331 } elseif
{$id=="FLAG"} {
332 foreach term
[split $val] {
334 set allflags
($term) 1
337 error "bad pragma_def line: $line"
341 set allnames
[lsort [array names allbyname
]]
343 # Generate #defines for all pragma type names. Group the pragmas that are
344 # omit in default builds (defined(SQLITE_DEBUG) and defined(SQLITE_HAS_CODEC))
348 foreach name
$allnames {
349 set type
[lindex $allbyname($name) 0]
350 if {[info exists seentype
($type)]} continue
351 set if [lindex $allbyname($name) 2]
352 if {[regexp SQLITE_DEBUG
$if] ||
[regexp SQLITE_HAS_CODEC
$if]} continue
353 set seentype
($type) 1
354 puts [format {#define %-35s %4d} PragTyp_$type $pnum]
357 foreach name
$allnames {
358 set type
[lindex $allbyname($name) 0]
359 if {[info exists seentype
($type)]} continue
360 set if [lindex $allbyname($name) 2]
361 if {[regexp SQLITE_DEBUG
$if]} continue
362 set seentype
($type) 1
363 puts [format {#define %-35s %4d} PragTyp_$type $pnum]
366 foreach name
$allnames {
367 set type
[lindex $allbyname($name) 0]
368 if {[info exists seentype
($type)]} continue
369 set seentype
($type) 1
370 puts [format {#define %-35s %4d} PragTyp_$type $pnum]
374 # Generate #defines for flags
377 foreach f
[lsort [array names allflags
]] {
378 puts [format {#define PragFlag_%-20s 0x%02x} $f $fv]
379 set fv
[expr {$fv*2}]
382 # Generate the lookup table
384 puts "static const struct sPragmaNames \173"
385 puts " const char *const zName; /* Name of pragma */"
386 puts " u8 ePragTyp; /* PragTyp_XXX value */"
387 puts " u8 mPragFlag; /* Zero or more PragFlag_XXX values */"
388 puts " u32 iArg; /* Extra argument */"
389 puts "\175 aPragmaNames\[\] = \173"
392 set spacer
[format { %26s
} {}]
393 foreach name
$allnames {
394 foreach {type arg
if flag
} $allbyname($name) break
395 if {$if!=$current_if} {
396 if {$current_if!=""} {
397 foreach this_if
$current_if {
402 if {$current_if!=""} {
403 foreach this_if
$current_if {
408 set typex
[format PragTyp_
%-23s $type,]
412 set flagx PragFlag_
[join $flag {|PragFlag_
}]
414 puts " \173 /* zName: */ \"$name\","
415 puts " /* ePragTyp: */ PragTyp_$type,"
416 puts " /* ePragFlag: */ $flagx,"
417 puts " /* iArg: */ $arg \175,"
419 if {$current_if!=""} {
420 foreach this_if
$current_if {
426 # count the number of pragmas, for information purposes
430 foreach name
$allnames {
432 set if [lindex $allbyname($name) 2]
433 if {[regexp {^defined
} $if] ||
[regexp {[^
!]defined
} $if]} continue
436 puts "/* Number of pragmas: $dfltcnt on by default, $allcnt total. */"