| Index: third_party/sqlite/src/tool/mkpragmatab.tcl
|
| diff --git a/third_party/sqlite/src/tool/mkpragmatab.tcl b/third_party/sqlite/src/tool/mkpragmatab.tcl
|
| index 145a365c54e66ad85850e184cf6fc870e54f2c82..c22f72d491a2c46c6d05f521aa827892839e1b01 100644
|
| --- a/third_party/sqlite/src/tool/mkpragmatab.tcl
|
| +++ b/third_party/sqlite/src/tool/mkpragmatab.tcl
|
| @@ -10,6 +10,16 @@
|
| # new pragma in ../src/pragma.c.
|
| #
|
|
|
| +# Flag meanings:
|
| +set flagMeaning(NeedSchema) {Force schema load before running}
|
| +set flagMeaning(ReadOnly) {Read-only HEADER_VALUE}
|
| +set flagMeaning(Result0) {Acts as query when no argument}
|
| +set flagMeaning(Result1) {Acts as query when has one argument}
|
| +set flagMeaning(SchemaReq) {Schema required - "main" is default}
|
| +set flagMeaning(SchemaOpt) {Schema restricts name search if present}
|
| +set flagMeaning(NoColumns) {OP_ResultRow called with zero columns}
|
| +set flagMeaning(NoColumns1) {zero columns if RHS argument is present}
|
| +
|
| set pragma_def {
|
| NAME: full_column_names
|
| TYPE: FLAG
|
| @@ -47,6 +57,7 @@ set pragma_def {
|
| IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
|
|
| NAME: cache_spill
|
| + FLAG: Result0 SchemaReq NoColumns1
|
| IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
|
|
| NAME: reverse_unordered_selects
|
| @@ -139,108 +150,128 @@ set pragma_def {
|
| ARG: SQLITE_CellSizeCk
|
|
|
| NAME: default_cache_size
|
| - FLAG: NeedSchema
|
| + FLAG: NeedSchema Result0 SchemaReq NoColumns1
|
| + COLS: cache_size
|
| IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS) && !defined(SQLITE_OMIT_DEPRECATED)
|
|
|
| NAME: page_size
|
| + FLAG: Result0 SchemaReq NoColumns1
|
| IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS)
|
|
|
| NAME: secure_delete
|
| + FLAG: Result0
|
| IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS)
|
|
|
| NAME: page_count
|
| - FLAG: NeedSchema
|
| + FLAG: NeedSchema Result0 SchemaReq
|
| IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS)
|
|
|
| NAME: max_page_count
|
| TYPE: PAGE_COUNT
|
| - FLAG: NeedSchema
|
| + FLAG: NeedSchema Result0 SchemaReq
|
| IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS)
|
|
|
| NAME: locking_mode
|
| + FLAG: Result0 SchemaReq
|
| IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS)
|
|
|
| NAME: journal_mode
|
| - FLAG: NeedSchema
|
| + FLAG: NeedSchema Result0 SchemaReq
|
| IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS)
|
|
|
| NAME: journal_size_limit
|
| + FLAG: Result0 SchemaReq
|
| IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS)
|
|
|
| NAME: cache_size
|
| - FLAG: NeedSchema
|
| + FLAG: NeedSchema Result0 SchemaReq NoColumns1
|
| IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS)
|
|
|
| NAME: mmap_size
|
| IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS)
|
|
|
| NAME: auto_vacuum
|
| - FLAG: NeedSchema
|
| + FLAG: NeedSchema Result0 SchemaReq NoColumns1
|
| IF: !defined(SQLITE_OMIT_AUTOVACUUM)
|
|
|
| NAME: incremental_vacuum
|
| - FLAG: NeedSchema
|
| + FLAG: NeedSchema NoColumns
|
| IF: !defined(SQLITE_OMIT_AUTOVACUUM)
|
|
|
| NAME: temp_store
|
| + FLAG: Result0 NoColumns1
|
| IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS)
|
|
|
| NAME: temp_store_directory
|
| + FLAG: NoColumns1
|
| IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS)
|
|
|
| NAME: data_store_directory
|
| + FLAG: NoColumns1
|
| IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS) && SQLITE_OS_WIN
|
|
|
| NAME: lock_proxy_file
|
| + FLAG: NoColumns1
|
| IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS) && SQLITE_ENABLE_LOCKING_STYLE
|
|
|
| NAME: synchronous
|
| - FLAG: NeedSchema
|
| + FLAG: NeedSchema Result0 SchemaReq NoColumns1
|
| IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS)
|
|
|
| NAME: table_info
|
| - FLAG: NeedSchema
|
| + FLAG: NeedSchema Result1 SchemaOpt
|
| + COLS: cid name type notnull dflt_value pk
|
| IF: !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
|
|
|
| NAME: stats
|
| - FLAG: NeedSchema
|
| + FLAG: NeedSchema Result0 SchemaReq
|
| + COLS: table index width height
|
| IF: !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
|
|
|
| NAME: index_info
|
| TYPE: INDEX_INFO
|
| ARG: 0
|
| - FLAG: NeedSchema
|
| + FLAG: NeedSchema Result1 SchemaOpt
|
| + COLS: seqno cid name
|
| IF: !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
|
|
|
| NAME: index_xinfo
|
| TYPE: INDEX_INFO
|
| ARG: 1
|
| - FLAG: NeedSchema
|
| + FLAG: NeedSchema Result1 SchemaOpt
|
| + COLS: seqno cid name desc coll key
|
| IF: !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
|
|
|
| NAME: index_list
|
| - FLAG: NeedSchema
|
| + FLAG: NeedSchema Result1 SchemaOpt
|
| + COLS: seq name unique origin partial
|
| IF: !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
|
|
|
| NAME: database_list
|
| - FLAG: NeedSchema
|
| + FLAG: NeedSchema Result0
|
| + COLS: seq name file
|
| IF: !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
|
|
|
| NAME: collation_list
|
| + FLAG: Result0
|
| + COLS: seq name
|
| IF: !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
|
|
|
| NAME: foreign_key_list
|
| - FLAG: NeedSchema
|
| + FLAG: NeedSchema Result1 SchemaOpt
|
| + COLS: id seq table from to on_update on_delete match
|
| IF: !defined(SQLITE_OMIT_FOREIGN_KEY)
|
|
|
| NAME: foreign_key_check
|
| FLAG: NeedSchema
|
| + COLS: table rowid parent fkid
|
| IF: !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)
|
|
|
| NAME: parser_trace
|
| IF: defined(SQLITE_DEBUG) && !defined(SQLITE_OMIT_PARSER_TRACE)
|
|
|
| NAME: case_sensitive_like
|
| + FLAG: NoColumns
|
|
|
| NAME: integrity_check
|
| FLAG: NeedSchema
|
| @@ -252,50 +283,61 @@ set pragma_def {
|
| IF: !defined(SQLITE_OMIT_INTEGRITY_CHECK)
|
|
|
| NAME: encoding
|
| + FLAG: Result0 NoColumns1
|
| IF: !defined(SQLITE_OMIT_UTF16)
|
|
|
| NAME: schema_version
|
| TYPE: HEADER_VALUE
|
| ARG: BTREE_SCHEMA_VERSION
|
| + FLAG: NoColumns1 Result0
|
| IF: !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS)
|
|
|
| NAME: user_version
|
| TYPE: HEADER_VALUE
|
| ARG: BTREE_USER_VERSION
|
| + FLAG: NoColumns1 Result0
|
| IF: !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS)
|
|
|
| NAME: data_version
|
| TYPE: HEADER_VALUE
|
| ARG: BTREE_DATA_VERSION
|
| - FLAG: ReadOnly
|
| + FLAG: ReadOnly Result0
|
| IF: !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS)
|
|
|
| NAME: freelist_count
|
| TYPE: HEADER_VALUE
|
| ARG: BTREE_FREE_PAGE_COUNT
|
| - FLAG: ReadOnly
|
| + FLAG: ReadOnly Result0
|
| IF: !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS)
|
|
|
| NAME: application_id
|
| TYPE: HEADER_VALUE
|
| ARG: BTREE_APPLICATION_ID
|
| + FLAG: NoColumns1 Result0
|
| IF: !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS)
|
|
|
| NAME: compile_options
|
| + FLAG: Result0
|
| IF: !defined(SQLITE_OMIT_COMPILEOPTION_DIAGS)
|
|
|
| NAME: wal_checkpoint
|
| FLAG: NeedSchema
|
| + COLS: busy log checkpointed
|
| IF: !defined(SQLITE_OMIT_WAL)
|
|
|
| NAME: wal_autocheckpoint
|
| IF: !defined(SQLITE_OMIT_WAL)
|
|
|
| NAME: shrink_memory
|
| + FLAG: NoColumns
|
|
|
| NAME: busy_timeout
|
| + FLAG: Result0
|
| + COLS: timeout
|
|
|
| NAME: lock_status
|
| + FLAG: Result0
|
| + COLS: database status
|
| IF: defined(SQLITE_DEBUG) || defined(SQLITE_TEST)
|
|
|
| NAME: key
|
| @@ -315,8 +357,10 @@ set pragma_def {
|
| IF: defined(SQLITE_HAS_CODEC) || defined(SQLITE_ENABLE_CEROD)
|
|
|
| NAME: soft_heap_limit
|
| + FLAG: Result0
|
|
|
| NAME: threads
|
| + FLAG: Result0
|
| }
|
|
|
| # Open the output file
|
| @@ -336,15 +380,29 @@ set name {}
|
| set type {}
|
| set if {}
|
| set flags {}
|
| +set cols {}
|
| +set cols_list {}
|
| set arg 0
|
| proc record_one {} {
|
| - global name type if arg allbyname typebyif flags
|
| + global name type if arg allbyname typebyif flags cols allcols
|
| + global cols_list colUsedBy
|
| if {$name==""} return
|
| - set allbyname($name) [list $type $arg $if $flags]
|
| + if {$cols!=""} {
|
| + if {![info exists allcols($cols)]} {
|
| + lappend cols_list $cols
|
| + set allcols($cols) [llength $cols_list]
|
| + }
|
| + set cx $allcols($cols)
|
| + lappend colUsedBy($cols) $name
|
| + } else {
|
| + set cx 0
|
| + }
|
| + set allbyname($name) [list $type $arg $if $flags $cx]
|
| set name {}
|
| set type {}
|
| set if {}
|
| set flags {}
|
| + set cols {}
|
| set arg 0
|
| }
|
| foreach line [split $pragma_def \n] {
|
| @@ -358,8 +416,13 @@ foreach line [split $pragma_def \n] {
|
| set type [string toupper $val]
|
| } elseif {$id=="TYPE"} {
|
| set type $val
|
| + if {$type=="FLAG"} {
|
| + lappend flags Result0 NoColumns1
|
| + }
|
| } elseif {$id=="ARG"} {
|
| set arg $val
|
| + } elseif {$id=="COLS"} {
|
| + set cols $val
|
| } elseif {$id=="IF"} {
|
| lappend if $val
|
| } elseif {$id=="FLAG"} {
|
| @@ -378,6 +441,7 @@ set allnames [lsort [array names allbyname]]
|
| # omit in default builds (defined(SQLITE_DEBUG) and defined(SQLITE_HAS_CODEC))
|
| # at the end.
|
| #
|
| +puts $fd "\n/* The various pragma types */"
|
| set pnum 0
|
| foreach name $allnames {
|
| set type [lindex $allbyname($name) 0]
|
| @@ -407,25 +471,58 @@ foreach name $allnames {
|
|
|
| # Generate #defines for flags
|
| #
|
| +puts $fd "\n/* Property flags associated with various pragma. */"
|
| set fv 1
|
| foreach f [lsort [array names allflags]] {
|
| - puts $fd [format {#define PragFlag_%-20s 0x%02x} $f $fv]
|
| + puts $fd [format {#define PragFlg_%-10s 0x%02x /* %s */} \
|
| + $f $fv $flagMeaning($f)]
|
| set fv [expr {$fv*2}]
|
| }
|
|
|
| +# Generate the array of column names used by pragmas that act like
|
| +# queries.
|
| +#
|
| +puts $fd "\n/* Names of columns for pragmas that return multi-column result"
|
| +puts $fd "** or that return single-column results where the name of the"
|
| +puts $fd "** result column is different from the name of the pragma\n*/"
|
| +puts $fd "static const char *const pragCName\[\] = {"
|
| +set offset 0
|
| +foreach cols $cols_list {
|
| + set cols_offset($allcols($cols)) $offset
|
| + set ub " /* Used by: $colUsedBy($cols) */"
|
| + foreach c $cols {
|
| + puts $fd [format " /* %3d */ %-14s%s" $offset \"$c\", $ub]
|
| + set ub ""
|
| + incr offset
|
| + }
|
| +}
|
| +puts $fd "\175;"
|
| +
|
| # Generate the lookup table
|
| #
|
| -puts $fd "static const struct sPragmaNames \173"
|
| -puts $fd " const char *const zName; /* Name of pragma */"
|
| -puts $fd " u8 ePragTyp; /* PragTyp_XXX value */"
|
| -puts $fd " u8 mPragFlag; /* Zero or more PragFlag_XXX values */"
|
| -puts $fd " u32 iArg; /* Extra argument */"
|
| -puts $fd "\175 aPragmaNames\[\] = \173"
|
| +puts $fd "\n/* Definitions of all built-in pragmas */"
|
| +puts $fd "typedef struct PragmaName \173"
|
| +puts $fd " const char *const zName; /* Name of pragma */"
|
| +puts $fd " u8 ePragTyp; /* PragTyp_XXX value */"
|
| +puts $fd " u8 mPragFlg; /* Zero or more PragFlg_XXX values */"
|
| +puts $fd { u8 iPragCName; /* Start of column names in pragCName[] */}
|
| +puts $fd " u8 nPragCName; \
|
| +/* Num of col names. 0 means use pragma name */"
|
| +puts $fd " u32 iArg; /* Extra argument */"
|
| +puts $fd "\175 PragmaName;"
|
| +puts $fd "static const PragmaName aPragmaName\[\] = \173"
|
|
|
| set current_if {}
|
| set spacer [format { %26s } {}]
|
| foreach name $allnames {
|
| - foreach {type arg if flag} $allbyname($name) break
|
| + foreach {type arg if flag cx} $allbyname($name) break
|
| + if {$cx==0} {
|
| + set cy 0
|
| + set nx 0
|
| + } else {
|
| + set cy $cols_offset($cx)
|
| + set nx [llength [lindex $cols_list [expr {$cx-1}]]]
|
| + }
|
| if {$if!=$current_if} {
|
| if {$current_if!=""} {
|
| foreach this_if $current_if {
|
| @@ -443,12 +540,13 @@ foreach name $allnames {
|
| if {$flag==""} {
|
| set flagx "0"
|
| } else {
|
| - set flagx PragFlag_[join $flag {|PragFlag_}]
|
| + set flagx PragFlg_[join $flag {|PragFlg_}]
|
| }
|
| - puts $fd " \173 /* zName: */ \"$name\","
|
| - puts $fd " /* ePragTyp: */ PragTyp_$type,"
|
| - puts $fd " /* ePragFlag: */ $flagx,"
|
| - puts $fd " /* iArg: */ $arg \175,"
|
| + puts $fd " \173/* zName: */ \"$name\","
|
| + puts $fd " /* ePragTyp: */ PragTyp_$type,"
|
| + puts $fd " /* ePragFlg: */ $flagx,"
|
| + puts $fd " /* ColNames: */ $cy, $nx,"
|
| + puts $fd " /* iArg: */ $arg \175,"
|
| }
|
| if {$current_if!=""} {
|
| foreach this_if $current_if {
|
|
|