Documentation Source Text

Check-in [87e7eb3d0d]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Recursive syntax diagram display.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:87e7eb3d0d2ca98727a304db8190ed7e3eff1e59
User & Date: drh 2014-01-23 15:25:02
Context
2014-01-23
15:29
Fix a link in the with-clause syntax diagram. check-in: 3598251c1c user: drh tags: trunk
15:25
Recursive syntax diagram display. check-in: 87e7eb3d0d user: drh tags: trunk
2014-01-17
23:50
Update the syntax bubble diagrams to show that the WITH clause is allowed. check-in: 3f48c6857f user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to art/syntax/bubble-generator-data.tcl.

    79     79        line RELEASE {optx SAVEPOINT} /savepoint-name
    80     80     }
    81     81     create-index-stmt {
    82     82       stack
    83     83          {line CREATE {opt UNIQUE} INDEX {opt IF NOT EXISTS}}
    84     84          {line {optx /database-name .} /index-name
    85     85                ON /table-name ( {loop indexed-column ,} )}
    86         -       {line {optx WHERE /expr}}
           86  +       {line {optx WHERE expr}}
    87     87     }
    88     88     indexed-column {
    89     89         line /column-name {opt COLLATE /collation-name} {or nil ASC DESC} 
    90     90     }
    91     91     create-table-stmt {
    92     92       stack
    93     93          {line CREATE {or {} TEMP TEMPORARY} TABLE {opt IF NOT EXISTS}}
................................................................................
   218    218     delete-stmt-limited {
   219    219       stack
   220    220           {line {opt with-clause} DELETE FROM qualified-table-name}
   221    221           {optx WHERE expr}
   222    222           {optx
   223    223               {stack
   224    224                 {optx ORDER BY {loop ordering-term ,}}
   225         -              {line LIMIT /expr {optx {or OFFSET ,} /expr}}
          225  +              {line LIMIT expr {optx {or OFFSET ,} expr}}
   226    226               }
   227    227           }
   228    228     }
   229    229     detach-stmt {
   230    230       line DETACH {optx DATABASE} /database-name
   231    231     }
   232    232     drop-index-stmt {
................................................................................
   337    337             }
   338    338     }
   339    339     select-stmt {
   340    340       stack
   341    341          {line {opt with-clause}
   342    342                {loop simple-query-stmt {nil compound-operator nil}}}
   343    343          {optx ORDER BY {loop ordering-term ,}}
   344         -       {optx LIMIT /expr {optx {or OFFSET ,} /expr}}
          344  +       {optx LIMIT expr {optx {or OFFSET ,} expr}}
   345    345     }
   346    346     simple-query-stmt {
   347    347       stack
   348    348          {line SELECT {or nil DISTINCT ALL} {loop result-column ,}}
   349    349          {optx FROM join-source}
   350    350          {optx WHERE expr}
   351    351          {optx GROUP BY {loop expr ,} {optx HAVING expr}}
................................................................................
   414    414                                        {line OR FAIL}
   415    415                                        {line OR IGNORE}}
   416    416                 qualified-table-name}
   417    417           {line SET {loop {line /column-name = expr} ,} {optx WHERE expr}}
   418    418           {optx
   419    419               {stack
   420    420                 {optx ORDER BY {loop ordering-term ,}}
   421         -              {line LIMIT /expr {optx {or OFFSET ,} /expr}}
          421  +              {line LIMIT expr {optx {or OFFSET ,} expr}}
   422    422               }
   423    423           }
   424    424     }
   425    425     qualified-table-name {
   426    426        line {optx /database-name .} /table-name
   427    427             {or nil {line INDEXED BY /index-name} {line NOT INDEXED}}
   428    428     }

Changes to art/syntax/create-index-stmt.gif.

cannot compute difference between binary files

Changes to art/syntax/delete-stmt-limited.gif.

cannot compute difference between binary files

Changes to art/syntax/select-stmt.gif.

cannot compute difference between binary files

Changes to art/syntax/syntax_linkage.tcl.

     4      4   set syntax_linkage(begin-stmt) {{} sql-stmt}
     5      5   set syntax_linkage(column-constraint) {{conflict-clause expr foreign-key-clause literal-value signed-number} column-def}
     6      6   set syntax_linkage(column-def) {{column-constraint type-name} {alter-table-stmt create-table-stmt}}
     7      7   set syntax_linkage(comment-syntax) {{} {}}
     8      8   set syntax_linkage(commit-stmt) {{} sql-stmt}
     9      9   set syntax_linkage(compound-operator) {{} select-stmt}
    10     10   set syntax_linkage(conflict-clause) {{} {column-constraint table-constraint}}
    11         -set syntax_linkage(create-index-stmt) {indexed-column sql-stmt}
           11  +set syntax_linkage(create-index-stmt) {{expr indexed-column} sql-stmt}
    12     12   set syntax_linkage(create-table-stmt) {{column-def select-stmt table-constraint} sql-stmt}
    13     13   set syntax_linkage(create-trigger-stmt) {{delete-stmt expr insert-stmt select-stmt update-stmt} sql-stmt}
    14     14   set syntax_linkage(create-view-stmt) {select-stmt sql-stmt}
    15     15   set syntax_linkage(create-virtual-table-stmt) {{} sql-stmt}
    16     16   set syntax_linkage(delete-stmt) {{expr qualified-table-name with-clause} {create-trigger-stmt sql-stmt}}
    17     17   set syntax_linkage(delete-stmt-limited) {{expr ordering-term qualified-table-name with-clause} sql-stmt}
    18     18   set syntax_linkage(detach-stmt) {{} sql-stmt}
    19     19   set syntax_linkage(drop-index-stmt) {{} sql-stmt}
    20     20   set syntax_linkage(drop-table-stmt) {{} sql-stmt}
    21     21   set syntax_linkage(drop-trigger-stmt) {{} sql-stmt}
    22     22   set syntax_linkage(drop-view-stmt) {{} sql-stmt}
    23         -set syntax_linkage(expr) {{literal-value raise-function select-stmt type-name} {attach-stmt column-constraint create-trigger-stmt delete-stmt delete-stmt-limited insert-stmt join-constraint ordering-term result-column simple-query-stmt table-constraint update-stmt update-stmt-limited}}
           23  +set syntax_linkage(expr) {{literal-value raise-function select-stmt type-name} {attach-stmt column-constraint create-index-stmt create-trigger-stmt delete-stmt delete-stmt-limited insert-stmt join-constraint ordering-term result-column select-stmt simple-query-stmt table-constraint update-stmt update-stmt-limited}}
    24     24   set syntax_linkage(foreign-key-clause) {{} {column-constraint table-constraint}}
    25     25   set syntax_linkage(indexed-column) {{} {create-index-stmt table-constraint}}
    26     26   set syntax_linkage(insert-stmt) {{expr select-stmt with-clause} {create-trigger-stmt sql-stmt}}
    27     27   set syntax_linkage(join-constraint) {expr join-source}
    28     28   set syntax_linkage(join-op) {{} join-source}
    29     29   set syntax_linkage(join-source) {{join-constraint join-op simple-join-source} {simple-join-source simple-query-stmt}}
    30     30   set syntax_linkage(literal-value) {{} {column-constraint expr}}
................................................................................
    35     35   set syntax_linkage(qualified-table-name) {{} {delete-stmt delete-stmt-limited update-stmt update-stmt-limited}}
    36     36   set syntax_linkage(raise-function) {{} expr}
    37     37   set syntax_linkage(reindex-stmt) {{} sql-stmt}
    38     38   set syntax_linkage(release-stmt) {{} sql-stmt}
    39     39   set syntax_linkage(result-column) {expr simple-query-stmt}
    40     40   set syntax_linkage(rollback-stmt) {{} sql-stmt}
    41     41   set syntax_linkage(savepoint-stmt) {{} sql-stmt}
    42         -set syntax_linkage(select-stmt) {{compound-operator ordering-term simple-query-stmt with-clause} {create-table-stmt create-trigger-stmt create-view-stmt expr insert-stmt simple-join-source sql-stmt}}
           42  +set syntax_linkage(select-stmt) {{compound-operator expr ordering-term simple-query-stmt with-clause} {create-table-stmt create-trigger-stmt create-view-stmt expr insert-stmt simple-join-source sql-stmt}}
    43     43   set syntax_linkage(signed-number) {{} {column-constraint pragma-value type-name}}
    44     44   set syntax_linkage(simple-join-source) {{join-source select-stmt} join-source}
    45     45   set syntax_linkage(simple-query-stmt) {{expr join-source result-column} select-stmt}
    46     46   set syntax_linkage(sql-stmt) {{alter-table-stmt analyze-stmt attach-stmt begin-stmt commit-stmt create-index-stmt create-table-stmt create-trigger-stmt create-view-stmt create-virtual-table-stmt delete-stmt delete-stmt-limited detach-stmt drop-index-stmt drop-table-stmt drop-trigger-stmt drop-view-stmt insert-stmt pragma-stmt reindex-stmt release-stmt rollback-stmt savepoint-stmt select-stmt update-stmt update-stmt-limited vacuum-stmt} sql-stmt-list}
    47     47   set syntax_linkage(sql-stmt-list) {sql-stmt {}}
    48     48   set syntax_linkage(table-constraint) {{conflict-clause expr foreign-key-clause indexed-column} create-table-stmt}
    49     49   set syntax_linkage(type-name) {signed-number {column-def expr}}
    50     50   set syntax_linkage(update-stmt) {{expr qualified-table-name with-clause} {create-trigger-stmt sql-stmt}}
    51     51   set syntax_linkage(update-stmt-limited) {{expr ordering-term qualified-table-name with-clause} sql-stmt}
    52     52   set syntax_linkage(vacuum-stmt) {{} sql-stmt}
    53     53   set syntax_linkage(with-clause) {{} {delete-stmt delete-stmt-limited insert-stmt select-stmt update-stmt update-stmt-limited}}
    54     54   set syntax_order {sql-stmt-list sql-stmt alter-table-stmt analyze-stmt attach-stmt begin-stmt commit-stmt rollback-stmt savepoint-stmt release-stmt create-index-stmt indexed-column create-table-stmt column-def type-name column-constraint signed-number table-constraint foreign-key-clause conflict-clause create-trigger-stmt create-view-stmt create-virtual-table-stmt with-clause delete-stmt delete-stmt-limited detach-stmt drop-index-stmt drop-table-stmt drop-trigger-stmt drop-view-stmt expr raise-function literal-value numeric-literal insert-stmt pragma-stmt pragma-value reindex-stmt select-stmt simple-query-stmt result-column join-source simple-join-source join-op join-constraint ordering-term compound-operator update-stmt update-stmt-limited qualified-table-name vacuum-stmt comment-syntax}

Changes to art/syntax/update-stmt-limited.gif.

cannot compute difference between binary files

Changes to pages/lang.in.

   116    116     hd_puts {<p><a href="lang.html">[Top]</a></p>}
   117    117     hd_puts "<h2>$name</h2>"
   118    118   }
   119    119   
   120    120   ###############################################################################
   121    121   Section {ALTER TABLE} altertable {{ALTER TABLE} {*ALTER}}
   122    122   
   123         -BubbleDiagram alter-table-stmt 1
          123  +RecursiveBubbleDiagram alter-table-stmt
   124    124   </tcl>
   125    125   
   126    126   <p>SQLite supports a limited subset of ALTER TABLE.
   127    127   The ALTER TABLE command in SQLite allows the user to rename a table
   128         -or to add a new column to an existing table. It is not possible
   129         -to rename a column, remove a column, or add or remove constraints from a table.
          128  +or to add a new column to an existing table.
   130    129   </p>
   131    130   
   132    131   <p> ^(The RENAME TO syntax is used to rename the table identified by 
   133    132   <i>&#91;database-name.&#93;table-name</i> to <i>new-table-name</i>.)^
   134    133   This command 
   135    134   cannot be used to move a table between attached databases, only to rename 
   136    135   a table within the same database.</p>
................................................................................
   181    180   <p>After ADD COLUMN has been run on a database, that database will not
   182    181   be readable by SQLite version 3.1.3 and earlier.</p>
   183    182   
   184    183   <tcl>
   185    184   ##############################################################################
   186    185   Section {ANALYZE} analyze ANALYZE
   187    186   
   188         -BubbleDiagram analyze-stmt 1
          187  +RecursiveBubbleDiagram analyze-stmt
   189    188   </tcl>
   190    189   
   191    190   <p> ^The ANALYZE command gathers statistics about tables and
   192    191   indices and stores the collected information
   193    192   in [internal tables] of the database where the query optimizer can
   194    193   access the information and use it to help make better query planning choices.
   195    194   ^If no arguments are given, all attached databases are
................................................................................
   243    242   
   244    243   <p> 
   245    244   
   246    245   <tcl>
   247    246   ##############################################################################
   248    247   Section {ATTACH DATABASE} attach *ATTACH
   249    248   
   250         -BubbleDiagram attach-stmt 1
          249  +RecursiveBubbleDiagram attach-stmt
   251    250   </tcl>
   252    251   
   253    252   <p> ^The ATTACH DATABASE statement adds another database 
   254    253   file to the current [database connection]. 
   255    254   ^The filename for the database to be attached is the value of
   256    255   the expression that occurs before the AS keyword.
   257    256   ^The filename of the database follows the same semantics as the
................................................................................
   294    293   [SQLITE_LIMIT_ATTACHED], to the number of databases that can be
   295    294   simultaneously attached to a single database connection.</p>
   296    295   
   297    296   <tcl>
   298    297   ###############################################################################
   299    298   Section {BEGIN TRANSACTION} transaction {*BEGIN COMMIT ROLLBACK}
   300    299   
   301         -BubbleDiagram begin-stmt
   302         -BubbleDiagram commit-stmt
   303         -BubbleDiagram rollback-stmt
          300  +RecursiveBubbleDiagram begin-stmt commit-stmt rollback-stmt
   304    301   </tcl>
   305    302   
   306    303   <p>
   307    304   ^No changes can be made to the database except within a transaction.
   308    305   ^Any command that changes the database (basically, any SQL command
   309    306   other than [SELECT]) will automatically start a transaction if
   310    307   one is not already in effect.  ^Automatically started transactions
................................................................................
   441    438   choose to simplify the interface in future versions of SQLite by
   442    439   causing the errors above to force an unconditional rollback.</p>
   443    440   
   444    441   <tcl>
   445    442   ###############################################################################
   446    443   Section {SAVEPOINT} savepoint {SAVEPOINT RELEASE}
   447    444   
   448         -BubbleDiagram savepoint-stmt
   449         -BubbleDiagram release-stmt
   450         -BubbleDiagram rollback-stmt
          445  +RecursiveBubbleDiagram savepoint-stmt release-stmt rollback-stmt
   451    446   </tcl>
   452    447   
   453    448   <p> ^SAVEPOINTs are a method of creating transactions, similar to
   454    449   [BEGIN] and [COMMIT], except that the SAVEPOINT and RELEASE commands
   455    450   are named and may be nested.</p>
   456    451   
   457    452   <p> ^The SAVEPOINT command starts a new transaction with a name.
................................................................................
   556    551   match any SAVEPOINT on the stack, then the ROLLBACK command fails with an
   557    552   error and leaves the state of the database unchanged.</p>
   558    553   
   559    554   <tcl>
   560    555   ###############################################################################
   561    556   Section comment comment {comment *comments}
   562    557   
   563         -BubbleDiagram comment-syntax
          558  +RecursiveBubbleDiagram comment-syntax
   564    559   </tcl>
   565    560   
   566    561   <p>^Comments are not SQL commands, but can occur within the text of
   567    562   SQL queries passed to [sqlite3_prepare_v2()] and related interfaces.
   568    563   ^Comments are treated as whitespace by the parser.
   569    564   ^Comments can begin anywhere whitespace 
   570    565   can be found, including inside expressions that span multiple lines.
................................................................................
   585    580   </p>
   586    581   
   587    582   
   588    583   <tcl>
   589    584   ##############################################################################
   590    585   Section {CREATE INDEX} createindex {{CREATE INDEX}}
   591    586   
   592         -BubbleDiagram create-index-stmt 1
   593         -BubbleDiagram indexed-column
          587  +RecursiveBubbleDiagram create-index-stmt
   594    588   </tcl>
   595    589   
   596    590   <p>^The CREATE INDEX command consists of the keywords "CREATE INDEX" followed
   597    591   by the name of the new index, the keyword "ON", the name of a previously
   598    592   created table that is to be indexed, and a parenthesized list of names of
   599    593   columns in the table that are used for the index key.
   600    594   If the optional WHERE clause is included, then the index is a "[partial index]".
................................................................................
   641    635   <p>^Indexes are removed with the [DROP INDEX] command.</p>
   642    636   
   643    637   
   644    638   <tcl>
   645    639   ##############################################################################
   646    640   Section {CREATE TABLE} {createtable} {{CREATE TABLE}}
   647    641   
   648         -BubbleDiagram create-table-stmt 1
   649         -BubbleDiagram column-def
   650         -BubbleDiagram type-name
   651         -BubbleDiagram column-constraint
   652         -BubbleDiagram table-constraint
   653         -BubbleDiagram foreign-key-clause
          642  +RecursiveBubbleDiagram create-table-stmt
   654    643   </tcl>
   655    644   
   656    645   <p>The "CREATE TABLE" command is used to create a new table in an SQLite 
   657    646   database. A CREATE TABLE command specifies the following attributes of the
   658    647   new table:
   659    648   
   660    649   <ul>
................................................................................
   964    953   <p>^(The [parent key] of a [foreign key constraint] is not allowed to
   965    954   use the rowid.  The parent key must used named columns only.)^</p>
   966    955   
   967    956   <tcl>
   968    957   ##############################################################################
   969    958   Section {CREATE TRIGGER} createtrigger {{CREATE TRIGGER}}
   970    959   
   971         -BubbleDiagram create-trigger-stmt 1
          960  +RecursiveBubbleDiagram create-trigger-stmt
   972    961   </tcl>
   973    962   
   974    963   <p>^The CREATE TRIGGER statement is used to add triggers to the 
   975    964   database schema. ^Triggers are database operations 
   976    965   that are automatically performed when a specified database event
   977    966   occurs.  </p>
   978    967   
................................................................................
  1176   1165   in the TEMP trigger being reattached to a table with the same name in
  1177   1166   another database whenever any schema change occurs.</p>
  1178   1167   
  1179   1168   <tcl>
  1180   1169   ###############################################################################
  1181   1170   Section {CREATE VIEW} {createview} {{CREATE VIEW} view *views}
  1182   1171   
  1183         -BubbleDiagram create-view-stmt 1
         1172  +RecursiveBubbleDiagram create-view-stmt
  1184   1173   </tcl>
  1185   1174   
  1186   1175   <p>^The CREATE VIEW command assigns a name to a pre-packaged 
  1187   1176   [SELECT] statement. 
  1188   1177   ^Once the view is created, it can be used in the FROM clause
  1189   1178   of another [SELECT] in place of a table name.
  1190   1179   </p>
................................................................................
  1206   1195   the same thing.  ^Views are removed 
  1207   1196   with the [DROP VIEW] command.</p>
  1208   1197   
  1209   1198   <tcl>
  1210   1199   ##############################################################################
  1211   1200   Section {CREATE VIRTUAL TABLE} {createvtab} {{CREATE VIRTUAL TABLE}}
  1212   1201   
  1213         -BubbleDiagram create-virtual-table-stmt 1
         1202  +RecursiveBubbleDiagram create-virtual-table-stmt
  1214   1203   </tcl>
  1215   1204   
  1216   1205   <p>A [virtual table] is an interface to an external storage or computation
  1217   1206   engine that appears to be a table but does not actually store information
  1218   1207   in the database file.</p>
  1219   1208   
  1220   1209   <p>In general, you can do anything with a [virtual table] that can be done
................................................................................
  1241   1230   [DROP TABLE] statement.  There is no
  1242   1231   DROP VIRTUAL TABLE statement.</p>
  1243   1232   
  1244   1233   <tcl>
  1245   1234   ##############################################################################
  1246   1235   Section DELETE delete {DELETE *DELETEs}
  1247   1236   
  1248         -BubbleDiagram delete-stmt 1
  1249         -BubbleDiagram qualified-table-name
         1237  +RecursiveBubbleDiagram delete-stmt
  1250   1238   </tcl>
  1251   1239   
  1252   1240   <p>The DELETE command removes records from the table identified by the
  1253   1241      <i>qualified-table-name</i>. 
  1254   1242   
  1255   1243   <p>^If the WHERE clause is not present, all records in the table are deleted.
  1256   1244      ^If a WHERE clause is supplied, then only those rows for which the
................................................................................
  1343   1331   the DELETE operation will proceed but the truncate optimization will
  1344   1332   be bypassed and rows will be deleted one by one.</p>
  1345   1333   
  1346   1334   <tcl>
  1347   1335   ###############################################################################
  1348   1336   Section {DETACH DATABASE} detach *DETACH
  1349   1337   
  1350         -BubbleDiagram detach-stmt 1
         1338  +RecursiveBubbleDiagram detach-stmt
  1351   1339   </tcl>
  1352   1340   
  1353   1341   <p>^This statement detaches an additional database connection previously 
  1354   1342   attached using the [ATTACH] statement.  
  1355   1343   ^When not in [shared cache mode], 
  1356   1344   it is possible to have the same database file attached multiple times using 
  1357   1345   different names, and detaching one connection to a file will leave the 
................................................................................
  1362   1350   <p>^This statement will fail if SQLite is in the middle of a transaction.</p>
  1363   1351   
  1364   1352   
  1365   1353   <tcl>
  1366   1354   ##############################################################################
  1367   1355   Section {DROP INDEX} dropindex {{DROP INDEX}}
  1368   1356   
  1369         -BubbleDiagram drop-index-stmt 1
         1357  +RecursiveBubbleDiagram drop-index-stmt
  1370   1358   </tcl>
  1371   1359   
  1372   1360   <p>^The DROP INDEX statement removes an index added
  1373   1361   with the [CREATE INDEX] statement.  The index is completely removed from
  1374   1362   the disk.  The only way to recover the index is to reenter the
  1375   1363   appropriate [CREATE INDEX] command.</p>
  1376   1364   
  1377   1365   <tcl>
  1378   1366   ##############################################################################
  1379   1367   Section {DROP TABLE} droptable {{DROP TABLE}}
  1380   1368   
  1381         -BubbleDiagram drop-table-stmt 1
         1369  +RecursiveBubbleDiagram drop-table-stmt
  1382   1370   </tcl>
  1383   1371   
  1384   1372   <p>^The DROP TABLE statement removes a table added with the
  1385   1373   [CREATE TABLE] statement.  The name specified is the
  1386   1374   table name.  ^The dropped table is completely removed from the database 
  1387   1375   schema and the disk file.  The table can not be recovered.  
  1388   1376   ^All indices and triggers
................................................................................
  1406   1394   exist when the transaction is committed, an error is returned at the time
  1407   1395   of commit.
  1408   1396   
  1409   1397   <tcl>
  1410   1398   ##############################################################################
  1411   1399   Section {DROP TRIGGER} droptrigger {{DROP TRIGGER}}
  1412   1400   
  1413         -BubbleDiagram drop-trigger-stmt 1
         1401  +RecursiveBubbleDiagram drop-trigger-stmt
  1414   1402   </tcl>
  1415   1403   
  1416   1404   <p>^The DROP TRIGGER statement removes a trigger created by the 
  1417   1405   [CREATE TRIGGER] statement. ^Once removed, the trigger definition is no
  1418   1406   longer present in the sqlite_master (or sqlite_temp_master) table and is
  1419   1407   not fired by any subsequent INSERT, UPDATE or DELETE statements.
  1420   1408   
................................................................................
  1421   1409   <p>^Note that triggers are automatically dropped when the associated table is
  1422   1410   dropped.
  1423   1411   
  1424   1412   <tcl>
  1425   1413   ##############################################################################
  1426   1414   Section {DROP VIEW} dropview {{DROP VIEW}}
  1427   1415   
  1428         -BubbleDiagram drop-view-stmt 1
         1416  +RecursiveBubbleDiagram drop-view-stmt
  1429   1417   </tcl>
  1430   1418   
  1431   1419   <p>^The DROP VIEW statement removes a view created by the [CREATE VIEW] 
  1432   1420     statement. ^The view definition is removed from the database schema, but 
  1433   1421     no actual data in the underlying base tables is modified.
  1434   1422   
  1435   1423   <p>^(The view to drop is identified by the view-name and optional 
................................................................................
  1521   1509   The EXPLAIN QUERY PLAN command is described in 
  1522   1510   [explain query plan|more detail here].
  1523   1511   
  1524   1512   <tcl>
  1525   1513   ##############################################################################
  1526   1514   Section expression expr {*expression {expression syntax}}
  1527   1515   
  1528         -BubbleDiagram expr 1
  1529         -BubbleDiagram literal-value
  1530         -BubbleDiagram signed-number
  1531         -BubbleDiagram raise-function
         1516  +RecursiveBubbleDiagram expr 1
  1532   1517   </tcl>
  1533   1518   
  1534   1519   <p>This section is different from the others.  Most other sections of
  1535   1520   this document talks about a particular SQL command.  This section does
  1536   1521   not talk about a standalone command but about "expressions" which are 
  1537   1522   subcomponents of most other commands.</p>
  1538   1523   
................................................................................
  2846   2831   </tcl>
  2847   2832   </table>
  2848   2833   
  2849   2834   <tcl>
  2850   2835   ##############################################################################
  2851   2836   Section INSERT insert {INSERT *INSERTs}
  2852   2837   
  2853         -BubbleDiagram insert-stmt 1
         2838  +RecursiveBubbleDiagram insert-stmt
  2854   2839   </tcl>
  2855   2840   
  2856   2841   <p>The INSERT statement comes in three basic forms.  
  2857   2842   <ul>
  2858   2843   <li><p>^The first form (with the "VALUES" keyword) creates one or more
  2859   2844   new rows in
  2860   2845   an existing table. ^If no column-list is specified then the number
................................................................................
  2905   2890   triggers.
  2906   2891   <p>
  2907   2892   
  2908   2893   <tcl>
  2909   2894   ##############################################################################
  2910   2895   Section {ON CONFLICT clause} conflict {{conflict clause} {ON CONFLICT}}
  2911   2896   
  2912         -BubbleDiagram conflict-clause
         2897  +RecursiveBubbleDiagram conflict-clause
  2913   2898   </tcl>
  2914   2899   
  2915   2900   <p>The ON CONFLICT clause is not a separate SQL command.  It is a
  2916   2901   non-standard clause that can appear in many other SQL commands.
  2917   2902   It is given its own section in this document because it is not
  2918   2903   part of standard SQL and therefore might not be familiar.</p>
  2919   2904   
................................................................................
  3003   2988   overrides any algorithm specified in a CREATE TABLE.
  3004   2989   ^If no algorithm is specified anywhere, the ABORT algorithm is used.</p>
  3005   2990   
  3006   2991   <tcl>
  3007   2992   ##############################################################################
  3008   2993   Section REINDEX reindex REINDEX
  3009   2994   
  3010         -BubbleDiagram reindex-stmt 1
         2995  +RecursiveBubbleDiagram reindex-stmt
  3011   2996   </tcl>
  3012   2997   
  3013   2998   <p>^The REINDEX command is used to delete and recreate indices from scratch.
  3014   2999   This is useful when the definition of a collation sequence has changed.
  3015   3000   </p>
  3016   3001   
  3017   3002   <p>^If the REINDEX keyword is not followed by a collation-sequence or database 
................................................................................
  3042   3027   This alias is provided for compatibility other SQL database engines.  See the 
  3043   3028   [INSERT] command documentation for additional information.</p>  
  3044   3029   
  3045   3030   <tcl>
  3046   3031   ###############################################################################
  3047   3032   Section SELECT select {SELECT query}
  3048   3033   
  3049         -BubbleDiagram select-stmt 1
  3050         -BubbleDiagram simple-query-stmt
  3051         -BubbleDiagram result-column
  3052         -BubbleDiagram join-source
  3053         -BubbleDiagram simple-join-source
  3054         -BubbleDiagram join-op
  3055         -BubbleDiagram join-constraint
  3056         -BubbleDiagram ordering-term
  3057         -BubbleDiagram compound-operator
         3034  +RecursiveBubbleDiagram select-stmt simple-query-stmt
  3058   3035   </tcl>
  3059   3036   
  3060   3037   
  3061   3038   <p>The SELECT statement is used to query the database.  The
  3062   3039   result of a SELECT is zero or more rows of data where each row
  3063   3040   has a fixed number of columns.  
  3064   3041   
................................................................................
  3443   3420   the two expressions is the OFFSET and the first the LIMIT. This is intentional
  3444   3421   - it maximizes compatibility with other SQL database systems.
  3445   3422   
  3446   3423   <tcl>
  3447   3424   ##############################################################################
  3448   3425   Section UPDATE update {UPDATE *UPDATEs}
  3449   3426   
  3450         -BubbleDiagram update-stmt 1
  3451         -BubbleDiagram qualified-table-name
         3427  +RecursiveBubbleDiagram update-stmt
  3452   3428   </tcl>
  3453   3429   
  3454   3430   <p>^An UPDATE statement is used to modify a subset of the values stored in 
  3455   3431   zero or more rows of the database table identified by the 
  3456   3432   <i>qualified-table-name</i> specified as part of the UPDATE statement.
  3457   3433   
  3458   3434   <p>^If the UPDATE statement does not have a WHERE clause, all rows in the
................................................................................
  3531   3507   rows fall within the LIMIT. The order in which rows are modified is arbitrary
  3532   3508   and is not influenced by the ORDER BY clause.)^
  3533   3509   
  3534   3510   <tcl>
  3535   3511   ##############################################################################
  3536   3512   Section VACUUM vacuum VACUUM
  3537   3513   
  3538         -BubbleDiagram vacuum-stmt 1
         3514  +RecursiveBubbleDiagram vacuum-stmt
  3539   3515   </tcl>
  3540   3516   
  3541   3517   <p>
  3542   3518     The VACUUM command rebuilds the entire database. There are several 
  3543   3519     reasons an application might do this:
  3544   3520   
  3545   3521   <ul>

Changes to pages/partialindex.in.

    22     22   <h2>2.0 Creating Partial Indexes</h2>
    23     23   
    24     24   <p>
    25     25   ^Create a partial index by adding a WHERE clause to the end of an 
    26     26   ordinary [CREATE INDEX] statement.
    27     27   </p>
    28     28   
    29         -<tcl>BubbleDiagram create-index-stmt</tcl>
           29  +<tcl>RecursiveBubbleDiagram create-index-stmt</tcl>
    30     30   
    31     31   <p>
    32     32   Any index that includes the WHERE clause at the end is considered to be
    33     33   a partial index.  Indexes that omit the WHERE clause (or indexes that
    34     34   are created by UNIQUE or PRIMARY KEY constraints inside of CREATE TABLE
    35     35   statements) are ordinary full indexes.
    36     36   </p>

Changes to pages/pragma.in.

    87     87   [sqlite3_file_control | file control] which gives [VFS] implementations the
    88     88   opportunity to add new PRAGMA statements or to override the meaning of
    89     89   built-in PRAGMA statements.</p>
    90     90   
    91     91   <tcl>
    92     92   Section {PRAGMA command syntax} syntax {PRAGMA}
    93     93   
    94         -BubbleDiagram pragma-stmt
    95         -BubbleDiagram pragma-value
           94  +RecursiveBubbleDiagram pragma-stmt pragma-value
    96     95   </tcl>
    97     96   
    98     97   <p>
    99     98   ^A pragma can take either zero or one argument.  ^The argument is may be either
   100     99   in parentheses or it may be separated from the pragma name by an equal sign.
   101    100   ^The two syntaxes yield identical results.
   102    101   ^(In many pragmas, the argument is a boolean.  The boolean can be one of:

Changes to wrap.tcl.

   355    355   # characters from each line.  It also does variable substitution in
   356    356   # the namespace of its calling procedure.
   357    357   #
   358    358   proc putsin4 {fd text} {
   359    359     regsub -all "\n    " $text \n text
   360    360     puts $fd [uplevel 1 [list subst -noback -nocom $text]]
   361    361   }
          362  +
          363  +# Return a globally unique object id
          364  +#
          365  +set hd_id_counter 0
          366  +proc hd_id {} {
          367  +  global hd_id_counter
          368  +  incr hd_id_counter
          369  +  return x$hd_id_counter
          370  +}
   362    371   
   363    372   # A procedure to write the common header found on every HTML file on
   364    373   # the SQLite website.
   365    374   #
   366    375   #####################
   367    376   # NOTE:  This code is copied and reused in matrix.tcl.  When making
   368    377   # changes to this implementation, be sure to also change matrix.tcl.
................................................................................
   485    494           var q = document.getElementById("q");
   486    495           if( q.value == "" ) { 
   487    496             q.value = gMsg
   488    497             q.style.color = "#044a64"
   489    498             q.style.fontStyle = "italic"
   490    499           }
   491    500         }
          501  +      function hideorshow(btn,obj){
          502  +        var x = document.getElementById(obj);
          503  +        var b = document.getElementById(btn);
          504  +        if( x.style.display!='none' ){
          505  +          x.style.display = 'none';
          506  +          b.innerHTML='show';
          507  +        }else{
          508  +          x.style.display = '';
          509  +          b.innerHTML='hide';
          510  +        }
          511  +        return false;
          512  +      }
   492    513       </script>}
   493    514     }
   494    515     if {1} {
   495    516       putsin4 $fd {<td>
   496    517           <div style="padding:0 1em 0px 0;white-space:nowrap">
   497    518           <form name=f method="GET" action="http://www.sqlite.org/search">
   498    519             <input id=q name=q type=text
................................................................................
   522    543   #
   523    544   proc BubbleDiagram {name {anonymous_flag 0}} {
   524    545     global hd
   525    546   
   526    547     #if {!$anonymous_flag} {
   527    548     #  hd_resolve "<h4>\[$name:\]</h4>"
   528    549     #}
   529         -  hd_resolve "<h4>\[$name:\]</h4>"
          550  +  hd_resolve "<p><b>\[$name:\]</b></p>"
   530    551     set alt "alt=\"syntax diagram $name\""
   531    552     if {$hd(enable-main)} {
   532         -    puts $hd(main) "<blockquote>\
   533         -        <img $alt src=\"$hd(rootpath-main)images/syntax/$name.gif\"></img>\
          553  +    puts $hd(main) "<blockquote>\n\
          554  +        <img $alt src=\"$hd(rootpath-main)images/syntax/$name.gif\"></img>\n\
   534    555           </blockquote>"
   535    556     }
   536    557     if {$hd(enable-aux)} {
   537         -    puts $hd(aux) "<blockquote>\
   538         -        <img $alt src=\"$hd(rootpath-aux)images/syntax/$name.gif\"></img>\
          558  +    puts $hd(aux) "<blockquote>\n\
          559  +        <img $alt src=\"$hd(rootpath-aux)images/syntax/$name.gif\"></img>\n\
   539    560           </blockquote>"
   540    561     }
   541    562   }
          563  +proc HiddenBubbleDiagram {name} {
          564  +  global hd
          565  +  set alt "alt=\"syntax diagram $name\""
          566  +  hd_resolve "<p><b>\[$name:\]</b> "
          567  +  if {$hd(enable-main)} {
          568  +    set a [hd_id]
          569  +    set b [hd_id]
          570  +    puts $hd(main) \
          571  +     "<button id='$a' onclick='hideorshow(\"$a\",\"$b\")'>show</button>\
          572  +      </p>\n\
          573  +      <blockquote id='$b' style='display:none;'>\n\
          574  +      <img $alt src=\"$hd(rootpath-main)images/syntax/$name.gif\"></img>\n\
          575  +      </blockquote>"
          576  +  }
          577  +  if {$hd(enable-aux)} {
          578  +    set a [hd_id]
          579  +    set b [hd_id]
          580  +    puts $hd(aux) \
          581  +     "<button id='$a' onclick='hideorshow(\"$a\",\"$b\")'>show</button>\
          582  +      </p>\n\
          583  +      <blockquote id='$b' style='display:none;'>\n\
          584  +      <img $alt src=\"$hd(rootpath-aux)images/syntax/$name.gif\"></img>\n\
          585  +      </blockquote>"
          586  +  }
          587  +}
          588  +proc RecursiveBubbleDiagram_helper {class name openflag exclude} {
          589  +  global hd syntax_linkage
          590  +  set alt "alt=\"syntax diagram $name\""
          591  +  hd_resolve "<p><b>\[$name:\]</b>\n"
          592  +  set a [hd_id]
          593  +  set b [hd_id]
          594  +  if {$openflag} {
          595  +    puts $hd($class) \
          596  +      "<button id='$a' onclick='hideorshow(\"$a\",\"$b\")'>hide</button></p>\n\
          597  +       <blockquote id='$b'>\n\
          598  +       <img $alt src=\"$hd(rootpath-$class)images/syntax/$name.gif\" />"
          599  +  } else {
          600  +    puts $hd($class) \
          601  +      "<button id='$a' onclick='hideorshow(\"$a\",\"$b\")'>show</button></p>\n\
          602  +       <blockquote id='$b' style='display:none;'>\n\
          603  +       <img $alt src=\"$hd(rootpath-$class)images/syntax/$name.gif\" />"
          604  +  }
          605  +  if {[info exists syntax_linkage($name)]} {
          606  +    foreach {cx px} $syntax_linkage($name) break
          607  +    foreach c $cx {
          608  +      if {[lsearch $exclude $c]>=0} continue
          609  +      RecursiveBubbleDiagram_helper $class $c 0 [concat $exclude $c]
          610  +    }  
          611  +  }
          612  +  puts $hd($class) "</blockquote>"
          613  +}
          614  +proc RecursiveBubbleDiagram {args} {
          615  +  global hd
          616  +  foreach name $args {
          617  +    if {$hd(enable-main)} {
          618  +      RecursiveBubbleDiagram_helper main $name 1 $args
          619  +    }
          620  +    if {$hd(enable-aux)} {
          621  +      RecursiveBubbleDiagram_helper aux $name 1 $args
          622  +    }
          623  +  }
          624  +}
          625  +
          626  +
          627  +
          628  +# Insert a See Also line for related bubble
   542    629   
   543    630   # Record a requirement.  This procedure is active only for the first
   544    631   # pass.  This procedure becomes a no-op for the second pass.  During
   545    632   # the second pass, requirements listing report generators can use the
   546    633   # data accumulated during the first pass to construct their reports.
   547    634   #
   548    635   # If the "verbatim" argument is true, then the requirement text is