From: jplyon Date: Sun, 4 May 2003 07:02:55 +0000 (+0000) Subject: new section for keywords, more docs for attached databases , links, cleanup (CVS... X-Git-Tag: version-3.6.10~5116 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b24fe719706aaf32d6d52498941c2b61818e1ac2;p=thirdparty%2Fsqlite.git new section for keywords, more docs for attached databases , links, cleanup (CVS 952) FossilOrigin-Name: 87e1b6a936972670771cf90670aeb4308ba0a30a --- diff --git a/manifest b/manifest index 420f9c9156..e15d2e4885 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C More\sdocumentation\supdates.\s(CVS\s951) -D 2003-05-03T19:04:04 +C new\ssection\sfor\skeywords,\smore\sdocs\sfor\sattached\sdatabases\s,\slinks,\scleanup\s(CVS\s952) +D 2003-05-04T07:02:55 F Makefile.in 004acec253ecdde985c8ecd5b7c9accdb210378f F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906 F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd @@ -155,7 +155,7 @@ F www/faq.tcl 12d1788d4abcfe1ff3054e17605df2418883bf6f F www/fileformat.tcl d9b586416c0d099b82e02e469d532c9372f98f3f F www/formatchng.tcl cbaf0f410096c71f86a7537cf9249fa04b9a659c F www/index.tcl b155eba45136d19e7aa6ba979d4093180c335cf7 -F www/lang.tcl 46fb1a380021aa1e7a51104b53b4066e54ba9b64 +F www/lang.tcl 56f4c1996795204317c850ecf039c851692625d4 F www/mingw.tcl d96b451568c5d28545fefe0c80bee3431c73f69c F www/nulls.tcl 29497dac2bc5b437aa7e2e94577dad4d8933ed26 F www/omitted.tcl 118062f40a203fcb88b8d68ef1d7c0073ac191ec @@ -165,7 +165,7 @@ F www/speed.tcl cb4c10a722614aea76d2c51f32ee43400d5951be F www/sqlite.tcl ae3dcfb077e53833b59d4fcc94d8a12c50a44098 F www/tclsqlite.tcl 1db15abeb446aad0caf0b95b8b9579720e4ea331 F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218 -P fd28c5229ece1d90e24d0ecaa518d8df5a4f55f0 -R 0f44dbdd9ad557cbceb63cfdf312e27b -U drh -Z 7676704ebf2d2713ee0ac3dc2cc0e3d3 +P 24b9b569240d2108b17420d85cafdc718c67269f +R f59caf097b77c12dfe5196947fa850d1 +U jplyon +Z 15d8de3d7ad598167e85986bd9fd5378 diff --git a/manifest.uuid b/manifest.uuid index b74d9be41e..ed71258db1 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -24b9b569240d2108b17420d85cafdc718c67269f \ No newline at end of file +87e1b6a936972670771cf90670aeb4308ba0a30a \ No newline at end of file diff --git a/www/lang.tcl b/www/lang.tcl index 90f03f1ebd..b17d2092f2 100644 --- a/www/lang.tcl +++ b/www/lang.tcl @@ -1,7 +1,7 @@ # # Run this Tcl script to generate the sqlite.html file. # -set rcsid {$Id: lang.tcl,v 1.52 2003/05/03 19:04:04 drh Exp $} +set rcsid {$Id: lang.tcl,v 1.53 2003/05/04 07:02:55 jplyon Exp $} puts { @@ -29,7 +29,8 @@ that are part of the syntactic markup itself are shown in black roman.

This document is just an overview of the SQL syntax implemented by SQLite. Many low-level productions are omitted. For detailed information -on the language that SQLite understands, refer to the source code.

+on the language that SQLite understands, refer to the source code and +the grammar file "parse.y".

SQLite implements the follow syntax:

@@ -52,14 +53,17 @@ foreach {section} [lsort -index 0 -dictionary { {EXPLAIN explain} {expression expr} {{BEGIN TRANSACTION} transaction} + {{COMMIT TRANSACTION} transaction} + {{END TRANSACTION} transaction} + {{ROLLBACK TRANSACTION} transaction} {PRAGMA pragma} {{ON CONFLICT clause} conflict} {{CREATE VIEW} createview} {{DROP VIEW} dropview} {{CREATE TRIGGER} createtrigger} {{DROP TRIGGER} droptrigger} - {{ATTACH DATABASE} attachdatabase} - {{DETACH DATABASE} detachdatabase} + {{ATTACH DATABASE} attach} + {{DETACH DATABASE} detach} }] { puts "
  • [lindex $section 0]
  • " } @@ -112,21 +116,39 @@ proc Example {text} { } -Section {ATTACH DATABASE} attachdatabase +Section {ATTACH DATABASE} attach Syntax {sql-statement} { ATTACH [DATABASE] AS } puts { -

    The ATTACH DATABASE statement lets you add a preexisting -database file to the current database connection.

    - -

    You can read and write to the attached database, but you cannot -CREATE TABLE or DROP TABLE in the attached database. You can only -CREATE and DROP in the original database.

    - -

    With an attached database, transactions are not atomic. +

    The ATTACH DATABASE statement adds a preexisting database +file to the current database connection. If the filename contains +punctuation characters it must be quoted. The names 'main' and +'temp' refer to the main database and the database used for +temporary tables. These cannot be detached. Attached databases +are removed using the DETACH DATABASE +statement.

    + +

    You can read from and write to an attached database, but you cannot +alter the schema of an attached database. You can only CREATE and +DROP in the original database.

    + +

    You cannot create a new table with the same name as a table in +an attached database, but you can attach a database which contains +tables whose names are duplicates of tables in the main database.

    + +

    Tables in an attached database can be referred to using the syntax +database-name.table-name. If an attached table doesn't have +a duplicate table name in the main database, it doesn't require a +database name prefix. When a database is attached, all of its +tables which don't have duplicate names become the 'default' table +of that name. Any tables of that name attached afterwards require the table +prefix. If the 'default' table of a given name is detached, then +the last table of that name attached becomes the new default.

    + +

    When there are attached databases, transactions are not atomic. Transactions continue to be atomic within each individual database file. But if your machine crashes in the middle of a COMMIT where you have updated two or more database @@ -158,12 +180,17 @@ ROLLBACK [TRANSACTION []] puts {

    Beginning in version 2.0, SQLite supports transactions with -rollback and atomic commit.

    +rollback and atomic commit. See ATTACH for +an exception when there are attached databases.

    + +

    The optional transaction name is ignored. SQLite currently +doesn't allow nested transactions. Attempting to start a new +transaction inside another is an error.

    No changes can be made to the database except within a transaction. Any command that changes the database (basically, any SQL command -other than SELECT) will automatically starts a transaction if +other than SELECT) will automatically start a transaction if one is not already in effect. Automatically started transactions are committed at the conclusion of the command.

    @@ -199,7 +226,6 @@ Syntax {comment} { | } {C-comment} {/STAR [STAR/] } - puts {

    Comments aren't SQL commands, but can occur in SQL queries. They are treated as whitespace by the parser. They can begin anywhere whitespace @@ -221,11 +247,10 @@ C comments do not nest. SQL comments inside a C comment will be ignored. Section COPY copy Syntax {sql-statement} { -COPY [ OR ] FROM +COPY [ OR ] [ .] FROM [ USING DELIMITERS ] } - puts {

    The COPY command is an extension used to load large amounts of data into a table. It is modeled after a similar command found @@ -263,13 +288,12 @@ Section {CREATE INDEX} createindex Syntax {sql-statement} { CREATE [TEMP | TEMPORARY] [UNIQUE] INDEX -ON ( [, ]* ) +ON [ .] ( [, ]* ) [ ON CONFLICT ] } {column-name} { [ ASC | DESC ] } - puts {

    The CREATE INDEX command consists of the keywords "CREATE INDEX" followed by the name of the new index, the keyword "ON", the name of a previously @@ -303,6 +327,10 @@ being indexed is temporary. Everytime the database is opened, all CREATE INDEX statements are read from the sqlite_master table and used to regenerate SQLite's internal representation of the index layout.

    + +

    Non-temporary indexes cannot be added on tables in attached +databases. They are removed with the DROP INDEX +command.

    } @@ -412,6 +440,10 @@ in place of the original command. The text of CREATE TEMPORARY TABLE statements are stored in the sqlite_temp_master table.

    + +

    Tables are removed using the DROP TABLE +statement. Non-temporary tables in an attached database cannot be +dropped.

    } @@ -419,13 +451,13 @@ Section {CREATE TRIGGER} createtrigger Syntax {sql-statement} { CREATE [TEMP | TEMPORARY] TRIGGER [ BEFORE | AFTER ] - ON + ON [ .] } Syntax {sql-statement} { CREATE [TEMP | TEMPORARY] TRIGGER INSTEAD OF - ON + ON [ .] } @@ -437,7 +469,7 @@ UPDATE OF } Syntax {trigger-action} { -[ FOR EACH ROW ] [ WHEN ] +[ FOR EACH ROW | FOR EACH STATEMENT ] [ WHEN ] BEGIN ; [ ; ]* END @@ -565,6 +597,10 @@ the statement that caused the trigger program to execute and any subsequent to execute is itself part of a trigger program, then that trigger program resumes execution at the beginning of the next step.

    + +

    Triggers are removed using the DROP TRIGGER +statement. Non-temporary triggers cannot be added on a table in an +attached database.

    } @@ -580,14 +616,17 @@ statement. Once the view is created, it can be used in the FROM clause of another SELECT in place of a table name.

    -

    You cannot COPY, INSERT or UPDATE a view. Views are read-only.

    +

    You cannot COPY, INSERT or UPDATE a view. Views are read-only +in SQLite. Views are removed with the DROP VIEW +command. Non-temporary views cannot be created on tables in an attached +database.

    } Section DELETE delete Syntax {sql-statement} { -DELETE FROM [WHERE ] +DELETE FROM [ .] [WHERE ] } puts { @@ -602,15 +641,15 @@ the expression are removed.

    } -Section {DETACH DATABASE} detachdatabase +Section {DETACH DATABASE} detach Syntax {sql-command} { DETACH [DATABASE] } puts { -

    This statement detaches an additional database file previoiusly attached -using the ATTACH DATABASE statement.

    +

    This statement detaches an additional database file previously attached +using the ATTACH DATABASE statement.

    This statement will fail if SQLite is in the middle of a transaction.

    } @@ -619,14 +658,15 @@ using the ATTACH DATABASE statement.

    Section {DROP INDEX} dropindex Syntax {sql-command} { -DROP INDEX +DROP INDEX [ .] } puts { -

    The DROP INDEX statement consists of the keywords "DROP INDEX" followed -by the name of the index. The index named is completely removed from +

    The DROP INDEX statement removes an index added with the +CREATE INDEX statement. The index named is completely removed from the disk. The only way to recover the index is to reenter the -appropriate CREATE INDEX command.

    +appropriate CREATE INDEX command. Non-temporary indexes on tables in +an attached database cannot be dropped.

    } @@ -637,19 +677,25 @@ DROP TABLE } puts { -

    The DROP TABLE statement consists of the keywords "DROP TABLE" followed -by the name of the table. The table named is completely removed from -the disk. The table can not be recovered. All indices associated with -the table are also deleted.

    } +

    The DROP TABLE statement removes a table added with the CREATE TABLE statement. The name specified is the +table name. It is completely removed from the database schema and the +disk file. The table can not be recovered. All indices associated +with the table are also deleted. Non-temporary tables in an attached +database cannot be dropped.

    +} Section {DROP TRIGGER} droptrigger Syntax {sql-statement} { -DROP TRIGGER +DROP TRIGGER [ .] } puts { -

    Used to drop a trigger from the database schema. Note that triggers - are automatically dropped when the associated table is dropped.

    +

    The DROP TRIGGER statement removes a trigger created by the +CREATE TRIGGER statement. The trigger is +deleted from the database schema. Note that triggers are automatically +dropped when the associated table is dropped. Non-temporary triggers +cannot be dropped on attached tables.

    } @@ -660,9 +706,12 @@ DROP VIEW } puts { -

    The DROP VIEW statement consists of the keywords "DROP VIEW" followed -by the name of the view. The view named is removed from the database. -But no actual data is modified.

    } +

    The DROP VIEW statement removes a view created by the CREATE VIEW statement. The name specified is the +view name. It is removed from the database schema, but no actual data +in the underlying base tables is modified. Non-temporary views in +attached databases cannot be dropped.

    +} Section EXPLAIN explain @@ -695,6 +744,7 @@ Syntax {expr} { ( ) | | . | + . . | | ( | STAR ) | (+) | @@ -985,8 +1035,8 @@ The usual sort order is used to determine the minimum. Section INSERT insert Syntax {sql-statement} { -INSERT [OR ] INTO [()] VALUES() | -INSERT [OR ] INTO [()] +INSERT [OR ] INTO [ .] [()] VALUES() | +INSERT [OR ] INTO [ .] [()] } puts { @@ -1305,15 +1355,15 @@ Unknown pragmas are ignored.

    Section REPLACE replace Syntax {sql-statement} { -REPLACE INTO [( )] VALUES ( ) | -REPLACE INTO [( )] +REPLACE INTO [ .] [( )] VALUES ( ) | +REPLACE INTO [ .] [( )] } puts {

    The REPLACE command is an alias for the "INSERT OR REPLACE" variant -of the INSERT command. This alias is provided for +of the INSERT command. This alias is provided for compatibility with MySQL. See the -INSERT command documentation for additional +INSERT command documentation for additional information.

    } @@ -1338,7 +1388,7 @@ STAR | . STAR | [ [AS] ] [AS ] | (