From: jplyon
Transactions can be started manually using the BEGIN
-command. Such transactions usually persist until the next
-COMMIT or ROLLBACK command. But a transaction will also
+command. Such transactions usually persist until the next
+COMMIT or ROLLBACK command. But a transaction will also
ROLLBACK if the database is closed or if an error occurs
and the ROLLBACK conflict resolution algorithm is specified.
See the documention on the ON CONFLICT
@@ -236,18 +236,18 @@ Syntax {comment} { Comments aren't SQL commands, but can occur in SQL queries. They are
-treated as whitespace by the parser. They can begin anywhere whitespace
+treated as whitespace by the parser. They can begin anywhere whitespace
can be found, including inside expressions that span multiple lines.
SQL comments only extend to the end of the current line. C comments can span any number of lines. If there is no terminating
-delimiter, they extend to the end of the input. This is not treated as
-an error. A new SQL statement can begin on a line after a multiline
-comment ends. C comments can be embedded anywhere whitespace can occur,
+ C comments can span any number of lines. If there is no terminating
+delimiter, they extend to the end of the input. This is not treated as
+an error. A new SQL statement can begin on a line after a multiline
+comment ends. C comments can be embedded anywhere whitespace can occur,
including inside expressions, and in the middle of other SQL statements.
-C comments do not nest. SQL comments inside a C comment will be ignored.
+C comments do not nest. SQL comments inside a C comment will be ignored.
Non-temporary indexes cannot be added on tables in attached -databases. They are removed with the DROP INDEX +
Indexes cannot be added on tables in attached databases. +Indexes are removed with the DROP INDEX command.
} @@ -364,8 +364,8 @@ UNIQUE [The DROP INDEX statement does not reduce the size of the database +file. Empty space in the database is retained for later INSERTs. To +remove free space in the database, use the VACUUM +command.
} @@ -697,6 +702,11 @@ 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. + +The DROP TABLE statement does not reduce the size of the database +file. Empty space in the database is retained for later INSERTs. To +remove free space in the database, use the VACUUM +command.
} @@ -761,12 +771,12 @@ Syntax {expr} {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 @@ -1318,16 +1319,29 @@ is returned it is as an integer.
Query or change the setting of the "temp_store" flag stored in - the database. When temp_store is DEFAULT (0), the compile-time default - is used for the temporary database. When temp_store is MEMORY (2), an - in-memory database is used. When temp_store is FILE (1), a temporary - database file on disk will be used. Note that it is possible for - the library compile-time options to override this setting. Once - the temporary database is in use, its location cannot be changed.
+Query or change the setting of the "temp_store" flag stored in + the database. When temp_store is DEFAULT (0), the compile-time value + of the symbol TEMP_STORE is used for the temporary database. + When temp_store is MEMORY (2), an in-memory database is used. + When temp_store is FILE (1), a temporary database file on disk will be used. + Once the temporary database is in use, its location cannot be changed. + It is possible for the library compile-time symbol TEMP_STORE to override + this setting. The following table summarizes this:
+ +TEMP_STORE | temp_store | temp database location |
---|---|---|
0 | any | file |
1 | 0 | file |
1 | 1 | file |
1 | 2 | memory |
2 | 0 | memory |
2 | 1 | file |
2 | 2 | memory |
3 | any | memory |
This pragma changes the temp_store mode persistently. Once changed, - the mode stays as set even if the database is closed and reopened. The + the mode stays set even if the database is closed and reopened. The temp_store pragma does the same thing but only applies the setting to the current session.
@@ -1342,6 +1356,12 @@ is returned it is as an integer. determine the number and names of the columns that would have been in the result set had the set not been empty. +PRAGMA foreign_key_list(table-name);
+For each foreign key that references a column in the argument + table, invoke the callback function with information about that + foreign key. The callback function will be invoked once for each + column in each foreign key.
PRAGMA full_column_names = ON; (1)
PRAGMA full_column_names = OFF; (0)
The column names reported in an SQLite callback are normally just @@ -1615,12 +1635,21 @@ In version 1.0 of SQLite, the VACUUM command would invoke
VACUUM became a no-op when the GDBM backend was removed from SQLITE in version 2.0.0. -VACUUM was reimplimented in version 2.8.1. It now cleans +VACUUM was reimplimented in version 2.8.1. +The index or table name argument is now ignored. +
+ +When an object (table, index, or trigger) is dropped from the +database, it leaves behind empty space. This makes the database +file larger than it needs to be, but can speed up inserts. In time +inserts and deletes can leave the database file structure fragmented, +which slows down disk access to the database contents. + +The VACUUM command cleans the database by copying its contents to a temporary database file and -reloading the original database file from the copy. This will eliminate -free pages, align table data to be contiguous, and otherwise clean up -the database file structure. The index or table name argument is now -ignored.
+reloading the original database file from the copy. This eliminates +free pages, aligns table data to be contiguous, and otherwise cleans +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.
@@ -1630,7 +1659,7 @@ command has no effect on an in-memory database. Section {SQLite keywords} keywords puts { -The following keywords are used by SQLite. Most are either reserved +
The following keywords are used by SQLite. Most are either reserved words in SQL-92 or were listed as potential reserved words. Those which aren't are shown in italics. Not all of these words are actually used by SQLite. Keywords are not reserved in SQLite. Any keyword can be used