From: jplyon Date: Sat, 3 May 2003 04:55:19 +0000 (+0000) Subject: - added entry for ATTACH DATABASE. X-Git-Tag: version-3.6.10~5118 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2bfc9dbdcf1970eb3b9cefe59c94cdb071fe5cc8;p=thirdparty%2Fsqlite.git - added entry for ATTACH DATABASE. - added entry for DETACH DATABASE. - added soundex() function. - added some new TEMP modifiers. - added new VACUUM behavior. - added the Oracle8 outer join "(+)" syntax. - documented the modulus/remainder operator %. - added ALL as alternative to DISTINCT in SELECT. - fixed assignment list in UPDATE to use * metacharacter. - fixed value in PRAGMA to be optional. - added link from INSERT topic to REPLACE. - added optional CONSTRAINT before column constraints. - skip 2 lines before each Section in the TCL source. (CVS 950) FossilOrigin-Name: fd28c5229ece1d90e24d0ecaa518d8df5a4f55f0 --- diff --git a/manifest b/manifest index ec63d22893..86b68b5789 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Additional\stests\sof\sthe\snew\sflattener\sadded.\s\sTicket\s#272.\s(CVS\s949) -D 2003-05-02T16:44:25 +C -\sadded\sentry\sfor\sATTACH\sDATABASE.\n-\sadded\sentry\sfor\sDETACH\sDATABASE.\n-\sadded\ssoundex()\sfunction.\n-\sadded\ssome\snew\sTEMP\smodifiers.\n-\sadded\snew\sVACUUM\sbehavior.\n-\sadded\sthe\sOracle8\souter\sjoin\s"(+)"\ssyntax.\n-\sdocumented\sthe\smodulus/remainder\soperator\s%.\n-\sadded\sALL\sas\salternative\sto\sDISTINCT\sin\sSELECT.\n-\sfixed\sassignment\slist\sin\sUPDATE\sto\suse\s*\smetacharacter.\n-\sfixed\svalue\sin\sPRAGMA\sto\sbe\soptional.\n-\sadded\slink\sfrom\sINSERT\stopic\sto\sREPLACE.\n-\sadded\soptional\sCONSTRAINT\s\sbefore\scolumn\sconstraints.\n-\sskip\s2\slines\sbefore\seach\sSection\sin\sthe\sTCL\ssource.\s(CVS\s950) +D 2003-05-03T04:55:19 F Makefile.in 004acec253ecdde985c8ecd5b7c9accdb210378f F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906 F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd @@ -155,7 +155,7 @@ F www/faq.tcl 06276ff6c3e369374bb83034cc9d4a7d3a2a34a1 F www/fileformat.tcl d9b586416c0d099b82e02e469d532c9372f98f3f F www/formatchng.tcl cbaf0f410096c71f86a7537cf9249fa04b9a659c F www/index.tcl b155eba45136d19e7aa6ba979d4093180c335cf7 -F www/lang.tcl 9bd9380dceba83d11fe268e0142c05ee06c757db +F www/lang.tcl 1852abb0efcff02cc15a0d7f4c3a2a1b9c06c256 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 ad57693e9f1b83a8cc4d028264b35018a9a4a701 -R 0c892dfdfe33ba9930d105338a5e3731 -U drh -Z ba7386fd2621411a19fd3dce98cc1a19 +P 8d9ee45ab487614191e8d6aef845141fdddf832a +R 385cd6fe68bb70c11d767d812d8a42a0 +U jplyon +Z 4e270e80f98870cfebfe7350053c13b7 diff --git a/manifest.uuid b/manifest.uuid index 0bf20d8210..8492c62fd1 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -8d9ee45ab487614191e8d6aef845141fdddf832a \ No newline at end of file +fd28c5229ece1d90e24d0ecaa518d8df5a4f55f0 \ No newline at end of file diff --git a/www/lang.tcl b/www/lang.tcl index e37d366800..c4752b929b 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.50 2003/02/13 02:54:04 drh Exp $} +set rcsid {$Id: lang.tcl,v 1.51 2003/05/03 04:55:19 jplyon Exp $} puts { @@ -58,6 +58,8 @@ foreach {section} [lsort -index 0 -dictionary { {{DROP VIEW} dropview} {{CREATE TRIGGER} createtrigger} {{DROP TRIGGER} droptrigger} + {{ATTACH DATABASE} attachdatabase} + {{DETACH DATABASE} detachdatabase} }] { puts "
  • [lindex $section 0]
  • " } @@ -109,7 +111,37 @@ proc Example {text} { puts "
    $text
    " } -Section {BEGIN TRANSACTION} createindex + +Section {ATTACH DATABASE} attachdatabase + +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. +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 +files, some of those files might get the changes where others +might not.

    + +

    There is a compile-time limit of 10 attached database files.

    + +

    Executing a BEGIN TRANSACTION statement locks all database +files, so this feature cannot (currently) be used to increase +concurrancy.

    +} + + +Section {BEGIN TRANSACTION} transaction Syntax {sql-statement} { BEGIN [TRANSACTION []] [ON CONFLICT ] @@ -226,10 +258,11 @@ See the section titled by a line that contains only a baskslash and a dot:} puts "\"[Operator \\.]\".

    " + Section {CREATE INDEX} createindex Syntax {sql-statement} { -CREATE [UNIQUE] INDEX +CREATE [TEMP | TEMPORARY] [UNIQUE] INDEX ON ( [, ]* ) [ ON CONFLICT ] } {column-name} { @@ -283,7 +316,7 @@ CREATE [TEMP | TEMPORARY] TABLE ( } {sql-command} { CREATE [TEMP | TEMPORARY] TABLE AS } {column-def} { - [] []* + [] [[CONSTRAINT ] ]* } {type} { | ( ) | @@ -380,16 +413,18 @@ The text of CREATE TEMPORARY TABLE statements are stored in the sqlite_temp_master table.

    } + + Section {CREATE TRIGGER} createtrigger Syntax {sql-statement} { -CREATE TRIGGER [ BEFORE | AFTER ] +CREATE [TEMP | TEMPORARY] TRIGGER [ BEFORE | AFTER ] ON } Syntax {sql-statement} { -CREATE TRIGGER INSTEAD OF +CREATE [TEMP | TEMPORARY] TRIGGER INSTEAD OF ON } @@ -532,10 +567,11 @@ the statement that caused the trigger program to execute and any subsequent

    } + Section {CREATE VIEW} {createview} Syntax {sql-command} { -CREATE VIEW AS +CREATE [TEMP | TEMPORARY] VIEW AS } puts { @@ -547,6 +583,7 @@ of another SELECT in place of a table name.

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

    } + Section DELETE delete Syntax {sql-statement} { @@ -565,6 +602,20 @@ the expression are removed.

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

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

    + +

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

    +} + + Section {DROP INDEX} dropindex Syntax {sql-command} { @@ -578,6 +629,7 @@ the disk. The only way to recover the index is to reenter the appropriate CREATE INDEX command.

    } + Section {DROP TABLE} droptable Syntax {sql-command} { @@ -590,6 +642,7 @@ 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.

    } + Section {DROP TRIGGER} droptrigger Syntax {sql-statement} { DROP TRIGGER @@ -599,6 +652,7 @@ puts { are automatically dropped when the associated table is dropped.

    } + Section {DROP VIEW} dropview Syntax {sql-command} { @@ -610,6 +664,7 @@ puts { by the name of the view. The view named is removed from the database. But no actual data is modified.

    } + Section EXPLAIN explain Syntax {sql-statement} { @@ -630,6 +685,7 @@ the architecture description or the documentation on available opcodes for the virtual machine.

    } + Section expression expr Syntax {expr} { @@ -641,6 +697,7 @@ Syntax {expr} { . | | ( | STAR ) | + (+) | ISNULL | NOTNULL | [NOT] BETWEEN AND | @@ -689,7 +746,9 @@ puts "[Operator =] or [Operator ==]. The non-equals operator can be either [Operator !=] or [Operator {<>}]. The [Operator ||] operator is \"concatenate\" - it joins together -the two strings of its operands.

    " +the two strings of its operands. +The operator [Operator %] outputs the remainder of its left +operand modulo its right operand.

    " puts {

    The LIKE operator does a wildcard comparision. The operand @@ -726,6 +785,15 @@ column can be used, except that you cannot change the value of a row key in an UPDATE or INSERT statement. "SELECT * ..." does not return the row key.

    +

    SQLite supports a minimal Oracle8 outer join behavior. A column +expression of the form "column" or "table.column" can be followed by +the special "(+)" operator. If the table of the column expression +is the second or subsequent table in a join, then that table becomes +the left table in a LEFT OUTER JOIN. The expression that uses that +table becomes part of the ON clause for the join. +The exact Oracle8 behavior is not implemented, but it is possible to +construct queries that will work correctly for both SQLite and Oracle8.

    +

    SELECT statements can appear in expressions as either the right-hand operand of the IN operator or as a scalar quantity. In both cases, the SELECT should have only a single column in its @@ -842,6 +910,12 @@ right of the decimal point. If the Y argument is omitted, 0 is assumed. + +soundex(X) +Compute the soundex encoding of the string X. +This returns "?000" for a NULL argument. + + substr(X,Y,Z) Return a substring of input string X that begins @@ -898,6 +972,7 @@ The usual sort order is used to determine the minimum. } + Section INSERT insert Syntax {sql-statement} { @@ -930,10 +1005,11 @@ constraint conflict resolution algorithm to use during this one command. See the section titled ON CONFLICT for additional information. For compatibility with MySQL, the parser allows the use of the -single keyword "REPLACE" as an alias for "INSERT OR REPLACE". +single keyword REPLACE as an alias for "INSERT OR REPLACE".

    } + Section {ON CONFLICT clause} conflict Syntax {conflict-clause} { @@ -1035,7 +1111,7 @@ If no algorithm is specified anywhere, the ABORT algorithm is used.

    Section PRAGMA pragma Syntax {sql-statement} { -PRAGMA = | +PRAGMA [= ] | PRAGMA () } @@ -1211,6 +1287,7 @@ with caution.

    Unknown pragmas are ignored.

    } + Section REPLACE replace Syntax {sql-statement} { @@ -1226,10 +1303,11 @@ compatibility with MySQL. See the information.

    } + Section SELECT select Syntax {sql-statement} { -SELECT [DISTINCT] [FROM ] +SELECT [ALL | DISTINCT] [FROM ] [WHERE ] [GROUP BY ] [HAVING ] @@ -1317,11 +1395,12 @@ removing the results of the right SELECT. When three are more SELECTs are connected into a compound, they group from left to right.

    } + Section UPDATE update Syntax {sql-statement} { UPDATE [ OR ] -SET [, ] +SET [, ]* [WHERE ] } {assignment} { = @@ -1341,6 +1420,7 @@ See the section titled ON CONFLICT for additional information.

    } + Section VACUUM vacuum Syntax {sql-statement} { @@ -1352,10 +1432,17 @@ puts { command found in PostgreSQL. If VACUUM is invoked with the name of a table or index then it is suppose to clean up the named table or index. In version 1.0 of SQLite, the VACUUM command would invoke -gdbm_reorganize() to clean up the backend database file. -Beginning with version 2.0 of SQLite, GDBM is no longer used for -the database backend and VACUUM has become a no-op. -

    +gdbm_reorganize() to clean up the backend database file.

    + +

    +This command was readded after version 2.8.0. of SQLite. It now cleans +the database by copying its contents to a temporary database file, and +reloading the database file from it. This will eliminate free pages, +align table data to be contiguous, and otherwise clean up the database +file structure.

    + +

    This command will fail if there is an active transaction. This +command has no effect on an in-memory database.

    } @@ -1366,3 +1453,9 @@ Back to the SQLite Home Page

    } + + + + + +