#
# 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 {<html>
<head>
{{DROP VIEW} dropview}
{{CREATE TRIGGER} createtrigger}
{{DROP TRIGGER} droptrigger}
+ {{ATTACH DATABASE} attachdatabase}
+ {{DETACH DATABASE} detachdatabase}
}] {
puts "<li><a href=\"#[lindex $section 1]\">[lindex $section 0]</a></li>"
}
puts "<blockquote><pre>$text</pre></blockquote>"
}
-Section {BEGIN TRANSACTION} createindex
+
+Section {ATTACH DATABASE} attachdatabase
+
+Syntax {sql-statement} {
+ATTACH [DATABASE] <database-filename> AS <database-name>
+}
+
+puts {
+<p>The ATTACH DATABASE statement lets you add a preexisting
+database file to the current database connection.</p>
+
+<p>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.</p>
+
+<p>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.</p>
+
+<p>There is a compile-time limit of 10 attached database files.</p>
+
+<p>Executing a BEGIN TRANSACTION statement locks all database
+files, so this feature cannot (currently) be used to increase
+concurrancy.</p>
+}
+
+
+Section {BEGIN TRANSACTION} transaction
Syntax {sql-statement} {
BEGIN [TRANSACTION [<name>]] [ON CONFLICT <conflict-algorithm>]
by a line that contains only a baskslash and a dot:}
puts "\"[Operator \\.]\".</p>"
+
Section {CREATE INDEX} createindex
Syntax {sql-statement} {
-CREATE [UNIQUE] INDEX <index-name>
+CREATE [TEMP | TEMPORARY] [UNIQUE] INDEX <index-name>
ON <table-name> ( <column-name> [, <column-name>]* )
[ ON CONFLICT <conflict-algorithm> ]
} {column-name} {
} {sql-command} {
CREATE [TEMP | TEMPORARY] TABLE <table-name> AS <select-statement>
} {column-def} {
-<name> [<type>] [<column-constraint>]*
+<name> [<type>] [[CONSTRAINT <name>] <column-constraint>]*
} {type} {
<typename> |
<typename> ( <number> ) |
<b>sqlite_temp_master</b> table.
</p>
}
+
+
Section {CREATE TRIGGER} createtrigger
Syntax {sql-statement} {
-CREATE TRIGGER <trigger-name> [ BEFORE | AFTER ]
+CREATE [TEMP | TEMPORARY] TRIGGER <trigger-name> [ BEFORE | AFTER ]
<database-event> ON <table-name>
<trigger-action>
}
Syntax {sql-statement} {
-CREATE TRIGGER <trigger-name> INSTEAD OF
+CREATE [TEMP | TEMPORARY] TRIGGER <trigger-name> INSTEAD OF
<database-event> ON <view-name>
<trigger-action>
}
</p>
}
+
Section {CREATE VIEW} {createview}
Syntax {sql-command} {
-CREATE VIEW <view-name> AS <select-statement>
+CREATE [TEMP | TEMPORARY] VIEW <view-name> AS <select-statement>
}
puts {
<p>You cannot COPY, INSERT or UPDATE a view. Views are read-only.</p>
}
+
Section DELETE delete
Syntax {sql-statement} {
}
+Section {DETACH DATABASE} detachdatabase
+
+Syntax {sql-command} {
+DETACH [DATABASE] <database-name>
+}
+
+puts {
+<p>This statement detaches an additional database file previoiusly attached
+using the ATTACH DATABASE statement.</p>
+
+<p>This statement will fail if SQLite is in the middle of a transaction.</p>
+}
+
+
Section {DROP INDEX} dropindex
Syntax {sql-command} {
appropriate CREATE INDEX command.</p>
}
+
Section {DROP TABLE} droptable
Syntax {sql-command} {
the disk. The table can not be recovered. All indices associated with
the table are also deleted.</p>}
+
Section {DROP TRIGGER} droptrigger
Syntax {sql-statement} {
DROP TRIGGER <trigger-name>
are automatically dropped when the associated table is dropped.</p>
}
+
Section {DROP VIEW} dropview
Syntax {sql-command} {
by the name of the view. The view named is removed from the database.
But no actual data is modified.</p>}
+
Section EXPLAIN explain
Syntax {sql-statement} {
on <a href="opcode.html">available opcodes</a> for the virtual machine.</p>
}
+
Section expression expr
Syntax {expr} {
<table-name> . <column-name> |
<literal-value> |
<function-name> ( <expr-list> | STAR ) |
+<expr> (+) |
<expr> ISNULL |
<expr> NOTNULL |
<expr> [NOT] BETWEEN <expr> AND <expr> |
The non-equals operator can be either
[Operator !=] or [Operator {<>}].
The [Operator ||] operator is \"concatenate\" - it joins together
-the two strings of its operands.</p>"
+the two strings of its operands.
+The operator [Operator %] outputs the remainder of its left
+operand modulo its right operand.</p>"
puts {
<p>The LIKE operator does a wildcard comparision. The operand
of a row key in an UPDATE or INSERT statement.
"SELECT * ..." does not return the row key.</p>
+<p>SQLite supports a minimal Oracle8 outer join behavior. A column
+expression of the form "column" or "table.column" can be followed by
+the special "<b>(+)</b>" 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.</p>
+
<p>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
assumed.</td>
</tr>
+<tr>
+<td valign="top" align="right">soundex(<i>X</i>)</td>
+<td valign="top">Compute the soundex encoding of the string <i>X</i>.
+This returns "?000" for a NULL argument.
+</tr>
+
<tr>
<td valign="top" align="right">substr(<i>X</i>,<i>Y</i>,<i>Z</i>)</td>
<td valign="top">Return a substring of input string <i>X</i> that begins
</table>
}
+
Section INSERT insert
Syntax {sql-statement} {
See the section titled
<a href="#conflict">ON CONFLICT</a> 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 <a href="#replace">REPLACE</a> as an alias for "INSERT OR REPLACE".
</p>
}
+
Section {ON CONFLICT clause} conflict
Syntax {conflict-clause} {
Section PRAGMA pragma
Syntax {sql-statement} {
-PRAGMA <name> = <value> |
+PRAGMA <name> [= <value>] |
PRAGMA <function>(<arg>)
}
Unknown pragmas are ignored.</p>
}
+
Section REPLACE replace
Syntax {sql-statement} {
information.</p>
}
+
Section SELECT select
Syntax {sql-statement} {
-SELECT [DISTINCT] <result> [FROM <table-list>]
+SELECT [ALL | DISTINCT] <result> [FROM <table-list>]
[WHERE <expr>]
[GROUP BY <expr-list>]
[HAVING <expr>]
are connected into a compound, they group from left to right.</p>
}
+
Section UPDATE update
Syntax {sql-statement} {
UPDATE [ OR <conflict-algorithm> ] <table-name>
-SET <assignment> [, <assignment>]
+SET <assignment> [, <assignment>]*
[WHERE <expr>]
} {assignment} {
<column-name> = <expr>
<a href="#conflict">ON CONFLICT</a> for additional information.</p>
}
+
Section VACUUM vacuum
Syntax {sql-statement} {
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
-<b>gdbm_reorganize()</b> 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.
-</p>
+<b>gdbm_reorganize()</b> to clean up the backend database file.</p>
+
+<p>
+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.</p>
+
+<p>This command will fail if there is an active transaction. This
+command has no effect on an in-memory database.</p>
}
</p>
</body></html>}
+
+
+
+
+
+