Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Update some documentation for version 3.1. (CVS 2188) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
5b7a5a4d69be425163135698d889797d |
User & Date: | danielk1977 2005-01-10 06:39:57.000 |
Context
2005-01-10
| ||
12:59 | Extra test cases to improve coverage of btree.c (CVS 2189) (check-in: a461988661 user: danielk1977 tags: trunk) | |
06:39 | Update some documentation for version 3.1. (CVS 2188) (check-in: 5b7a5a4d69 user: danielk1977 tags: trunk) | |
02:48 | Fix an assertion failure due to interaction between the count_changes pragma and triggers. (CVS 2187) (check-in: 6c7bec1b3a user: danielk1977 tags: trunk) | |
Changes
Changes to www/lang.tcl.
1 2 3 | # # Run this Tcl script to generate the lang-*.html files. # | | | 1 2 3 4 5 6 7 8 9 10 11 | # # Run this Tcl script to generate the lang-*.html files. # set rcsid {$Id: lang.tcl,v 1.81 2005/01/10 06:39:57 danielk1977 Exp $} source common.tcl if {[llength $argv]>0} { set outputdir [lindex $argv 0] } else { set outputdir "" } |
︙ | ︙ | |||
883 884 885 886 887 888 889 | } Section expression expr Syntax {expr} { <expr> <binary-op> <expr> | | | > | > > | 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 | } Section expression expr Syntax {expr} { <expr> <binary-op> <expr> | <expr> <like-op> <expr> [ESCAPE <expr>] | <expr> <glob-op> <expr> | <unary-op> <expr> | ( <expr> ) | <column-name> | <table-name> . <column-name> | <database-name> . <table-name> . <column-name> | <literal-value> | <function-name> ( <expr-list> | STAR ) | <expr> ISNULL | <expr> NOTNULL | <expr> [NOT] BETWEEN <expr> AND <expr> | <expr> [NOT] IN ( <value-list> ) | <expr> [NOT] IN ( <select-statement> ) | <expr> [NOT] IN [<database-name> .] <table-name> | ( <select-statement> ) | CASE [<expr>] LP WHEN <expr> THEN <expr> RPPLUS [ELSE <expr>] END } {like-op} { LIKE | NOT LIKE } {glob-op} { GLOB | NOT GLOB } puts { <p>This section is different from the others. Most other sections of this document talks about a particular SQL command. This section does not talk about a standalone command but about "expressions" which are subcomponents of most other commands.</p> |
︙ | ︙ | |||
946 947 948 949 950 951 952 953 954 955 956 957 958 | The [Operator ||] operator is \"concatenate\" - it joins together the two strings of its operands. The operator [Operator %] outputs the remainder of its left operand modulo its right operand.</p>" puts { <a name="like"></a> <p>The LIKE operator does a wildcard comparison. The operand to the right contains the wildcards.} puts "A percent symbol [Operator %] in the right operand matches any sequence of zero or more characters on the left. An underscore [Operator _] on the right matches any single character on the left." | > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | | | | | 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 | The [Operator ||] operator is \"concatenate\" - it joins together the two strings of its operands. The operator [Operator %] outputs the remainder of its left operand modulo its right operand.</p>" puts { <a name="like"></a> <p>The LIKE operator does a pattern matching comparison. The operand to the right contains the pattern, the left hand operand contains the string to match against the pattern. } puts "A percent symbol [Operator %] in the pattern matches any sequence of zero or more characters in the string. An underscore [Operator _] in the pattern matches any single character in the string. Any other character matches itself or it's lower/upper case equivalent (i.e. case-insensitive matching). (A bug: SQLite only understands upper/lower case for 7-bit Latin characters. Hence the LIKE operator is case sensitive for 8-bit iso8859 characters or UTF-8 characters. For example, the expression <b>'a' LIKE 'A'</b> is TRUE but <b>'æ' LIKE 'Æ'</b> is FALSE.).</p>" puts { <p>If the optional ESCAPE clause is present, then the expression following the ESCAPE keyword must evaluate to a string consisting of a single character. This character may be used in the LIKE pattern to include literal percent or underscore characters. The escape character followed by a percent symbol, underscore or itself matches a literal percent symbol, underscore or escape character in the string, respectively. The infix LIKE operator is implemented by calling the user function <a href="#likeFunc"> like(<i>X</i>,<i>Y</i>)</a>.</p> } puts { <p>The LIKE operator does a wildcard comparison. The operand to the right contains the wildcards.} puts "A percent symbol [Operator %] in the right operand matches any sequence of zero or more characters on the left. An underscore [Operator _] on the right matches any single character on the left." puts { The LIKE operator is not case sensitive and will match upper case characters on one side against lower case characters on the other. (A bug: SQLite only understands upper/lower case for 7-bit Latin characters. Hence the LIKE operator is case sensitive for 8-bit iso8859 characters or UTF-8 characters. For example, the expression <b>'a' LIKE 'A'</b> is TRUE but <b>'æ' LIKE 'Æ'</b> is FALSE.). The infix LIKE operator is identical the user function <a href="#likeFunc"> like(<i>X</i>,<i>Y</i>)</a>. </p> <a name="glob"></a> <p>The GLOB operator is similar to LIKE but uses the Unix file globbing syntax for its wildcards. Also, GLOB is case sensitive, unlike LIKE. Both GLOB and LIKE may be preceded by |
︙ | ︙ | |||
1063 1064 1065 1066 1067 1068 1069 | <td valign="top">Return the string length of <i>X</i> in characters. If SQLite is configured to support UTF-8, then the number of UTF-8 characters is returned, not the number of bytes.</td> </tr> <tr> <a name="likeFunc"></a> | | | > | > > | | | | > > > > | 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 | <td valign="top">Return the string length of <i>X</i> in characters. If SQLite is configured to support UTF-8, then the number of UTF-8 characters is returned, not the number of bytes.</td> </tr> <tr> <a name="likeFunc"></a> <td valign="top" align="right">like(<i>X</i>,<i>Y</i> [,<i>Z</i>])</td> <td valign="top"> This function is used to implement the "<b>X LIKE Y [ESCAPE Z]</b>" syntax of SQL. If the optional ESCAPE clause is present, then the user-function is invoked with three arguments. Otherwise, it is invoked with two arguments only. The <a href="capi3ref.html#sqlite3_create_function"> sqlite_create_function()</a> interface can be used to override this function and thereby change the operation of the <a href= "#like">LIKE</a> operator. When doing this, it may be important to override both the two and three argument versions of the like() function. Otherwise, different code may be called to implement the LIKE operator depending on whether or not an ESCAPE clause was specified.</td> </tr> <tr> <td valign="top" align="right">lower(<i>X</i>)</td> <td valign="top">Return a copy of string <i>X</i> will all characters converted to lower case. The C library <b>tolower()</b> routine is used for the conversion, which means that this function might not |
︙ | ︙ |
Changes to www/pragma.tcl.
1 2 3 | # # Run this Tcl script to generate the pragma.html file. # | | | 1 2 3 4 5 6 7 8 9 10 11 | # # Run this Tcl script to generate the pragma.html file. # set rcsid {$Id: pragma.tcl,v 1.8 2005/01/10 06:39:57 danielk1977 Exp $} source common.tcl header {Pragma statements supported by SQLite} proc Section {name {label {}}} { puts "\n<hr />" if {$label!=""} { puts "<a name=\"$label\"></a>" |
︙ | ︙ | |||
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | improvement.</p> <p>When you change the cache size using the cache_size pragma, the change only endures for the current session. The cache size reverts to the default value when the database is closed and reopened. Use the <a href="#pragma_default_cache_size"><b>default_cache_size</b></a> pragma to check the cache size permanently.</p></li> <a name="pragma_default_cache_size"></a> <li><p><b>PRAGMA default_cache_size; <br>PRAGMA default_cache_size = </b><i>Number-of-pages</i><b>;</b></p> <p>Query or change the maximum number of database disk pages that SQLite will hold in memory at once. Each page uses 1K on disk and about 1.5K in memory. This pragma works like the <a href="#pragma_cache_size"><b>cache_size</b></a> pragma with the additional feature that it changes the cache size persistently. With this pragma, you can set the cache size once and that setting is retained and reused every time you reopen the database.</p></li> | > > > > > > > > > > > > > > > > > > > > > > > > > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | | | < < < | > | > > > > > > > > > > | | | | | | | | | | > > > > > > | | > < < < < < < < < < < < < < < < < < < | | < < < < < < < < < < < < < < < < < < < | 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 | improvement.</p> <p>When you change the cache size using the cache_size pragma, the change only endures for the current session. The cache size reverts to the default value when the database is closed and reopened. Use the <a href="#pragma_default_cache_size"><b>default_cache_size</b></a> pragma to check the cache size permanently.</p></li> <a name="pragma_count_changes"></a> <li><p><b>PRAGMA count_changes; <br>PRAGMA count_changes = </b><i>0 | 1</i><b>;</b></p> <p>Query or change the count-changes flag. Normally, when the count-changes flag is not set, INSERT, UPDATE and DELETE statements return no data. When count-changes is set, each of these commands returns a single row of data consisting of one integer value - the number of rows inserted, modified or deleted by the command. The returned change count does not include any insertions, modifications or deletions performed by triggers.</p> <a name="pragma_default_cache_size"></a> <li><p><b>PRAGMA default_cache_size; <br>PRAGMA default_cache_size = </b><i>Number-of-pages</i><b>;</b></p> <p>Query or change the maximum number of database disk pages that SQLite will hold in memory at once. Each page uses 1K on disk and about 1.5K in memory. This pragma works like the <a href="#pragma_cache_size"><b>cache_size</b></a> pragma with the additional feature that it changes the cache size persistently. With this pragma, you can set the cache size once and that setting is retained and reused every time you reopen the database.</p></li> <a name="pragma_empty_result_callbacks"></a> <li><p><b>PRAGMA empty_result_callbacks; <br>PRAGMA empty_result_callbacks = </b><i>0 | 1</i><b>;</b></p> <p>Query or change the empty-result-callbacks flag.</p> <p>The empty-result-callbacks flag affects the sqlite3_exec API only. Normally, when the empty-result-callbacks flag is cleared, the callback function supplied to the sqlite3_exec() call is not invoked for commands that return zero rows of data. When empty-result-callbacks is set in this situation, the callback function is invoked exactly once, with the third parameter set to 0 (NULL). This is to enable programs that use the sqlite3_exec() API to retrieve column-names even when a query returns no data. </p> <a name="pragma_encoding"></a> <li><p><b>PRAGMA encoding; <br>PRAGMA encoding = "UTF-8"; <br>PRAGMA encoding = "UTF-16"; <br>PRAGMA encoding = "UTF-16le"; <br>PRAGMA encoding = "UTF-16be";</b></p> <p>In it's first form, if the main database has already been created, then this pragma returns the text encoding used by the main database, one of "UTF-8", "UTF-16le" (little-endian UTF-16 encoding) or "UTF-16be" (big-endian UTF-16 encoding). If the main database has not already been created, then the value returned is the text encoding that will be used to create the main database, if it is created by this session.</p> <p>The second and subsequent forms of this pragma are only useful if the main database has not already been created. In this case the pragma sets the encoding that the main database will be created with if it is created by this session. The string "UTF-16" is interpreted as "UTF-16 encoding using native machine byte-ordering".</p> <p>Databases created by the ATTACH command always use the same encoding as the main database.</p> </li> <a name="pragma_full_column_names"></a> <li><p><b>PRAGMA full_column_names; <br>PRAGMA full_column_names = </b><i>0 | 1</i><b>;</b></p> <p>Query or change the full-column-names flag. This flag affects the way SQLite names columns of data returned by SELECT statements when the expression for the column is a table-column name or the wildcard "*". Normally, such result columns are named <table-name/alias>.<column-name> if the SELECT statement joins two or more tables together, or simply <column-name> if the SELECT statement queries a single table. When the full-column-names flag is set, such columns are always named <table-name/alias>.<column-name>, regardless of whether or not a join is performed. </p> <p>If both the short-column-names and full-column-names are set, then the behaviour associated with the full-column-names flag is exhibited. </p> </li> <a name="pragma_page_size"></a> <li><p><b>PRAGMA page_size; <br>PRAGMA page_size = </b><i>bytes</i><b>;</b></p> <p>Query or set the page-size of the database. The page-size may only be set if the database has not yet been created. The page size must be a power of two greater than or equal to 512 and less than or equal to 8192. The upper limit may be modified by setting the value of macro SQLITE_MAX_PAGE_SIZE during compilation. </p> </li> <a name="pragma_short_column_names"></a> <li><p><b>PRAGMA full_column_names; <br>PRAGMA full_column_names = </b><i>0 | 1</i><b>;</b></p> <p>Query or change the short-column-names flag. This flag affects the way SQLite names columns of data returned by SELECT statements when the expression for the column is a table-column name or the wildcard "*". Normally, such result columns are named <table-name/alias>.<column-name> if the SELECT statement joins two or more tables together, or simply <column-name> if the SELECT statement queries a single table. When the short-column-names flag is set, such columns are always named <column-name>, regardless of whether or not a join is performed. </p> <p>If both the short-column-names and full-column-names are set, then the behaviour associated with the full-column-names flag is exhibited. </p> </li> <a name="pragma_synchronous"></a> <li><p><b>PRAGMA synchronous; <br>PRAGMA synchronous = FULL; </b>(2)<b> <br>PRAGMA synchronous = NORMAL; </b>(1)<b> <br>PRAGMA synchronous = OFF; </b>(0)</p> <p>Query or change the setting of the "synchronous" flag. The first (query) form will return the setting as an integer. When synchronous is FULL (2), the SQLite database engine will pause at critical moments to make sure that data has actually been written to the disk surface before continuing. This ensures that if the operating system crashes or if there is a power failure, the database will be uncorrupted after rebooting. FULL synchronous is very safe, but it is also slow. When synchronous is NORMAL (1, the default), the SQLite database engine will still pause at the most critical moments, but less often than in FULL mode. There is a very small (though non-zero) chance that a power failure at just the wrong time could corrupt the database in NORMAL mode. But in practice, you are more likely to suffer a catastrophic disk failure or some other unrecoverable hardware fault. So NORMAL is the default mode. With synchronous OFF (0), SQLite continues without pausing as soon as it has handed data off to the operating system. If the application running SQLite crashes, the data will be safe, but the database might become corrupted if the operating system crashes or the computer loses power before that data has been written to the disk surface. On the other hand, some operations are as much as 50 or more times faster with synchronous OFF. </p></li> <a name="pragma_temp_store"></a> <li><p><b>PRAGMA temp_store; <br>PRAGMA temp_store = DEFAULT; </b>(0)<b> <br>PRAGMA temp_store = MEMORY; </b>(2)<b> <br>PRAGMA temp_store = FILE;</b> (1)</p> <p>Query or change the setting of the "temp_store" flag affecting the database for the duration of the current database connection. The temp_store flag reverts to its default value when the database is closed and reopened. For additional information on the temp_store flag, see the description of the <a href="#pragma_default_temp_store"> <b>default_temp_store</b></a> pragma. Note that it is possible for the library compile-time options to override this setting. <a name="pragma_temp_store"></a> <li><p><b>PRAGMA temp_store; <br>PRAGMA temp_store = DEFAULT; </b>(0)<b> <br>PRAGMA temp_store = MEMORY; </b>(2)<b> <br>PRAGMA temp_store = FILE;</b> (1)</p> <p>Query or change the setting of the "<b>temp_store</b>" parameter. 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. See PRAGMA <a href="#pragma_temp_store_directory"> temp_store_directory</a> for further temporary storage options when <b>FILE</b> is specified. When the temp_store setting is changed, all existing temporary tables, indices, triggers, and viewers are immediately deleted.</p> <p>It is possible for the library compile-time symbol TEMP_STORE to override this setting. The following table summarizes this:</p> <table cellpadding="2"> <tr><th>TEMP_STORE</th><th>temp_store</th><th>temp database location</th></tr> <tr><td align="center">0</td><td align="center"><em>any</em></td><td align="center">file</td></tr> <tr><td align="center">1</td><td align="center">0</td><td align="center">file</td></tr> <tr><td align="center">1</td><td align="center">1</td><td align="center">file</td></tr> <tr><td align="center">1</td><td align="center">2</td><td align="center">memory</td></tr> <tr><td align="center">2</td><td align="center">0</td><td align="center">memory</td></tr> <tr><td align="center">2</td><td align="center">1</td><td align="center">file</td></tr> <tr><td align="center">2</td><td align="center">2</td><td align="center">memory</td></tr> <tr><td align="center">3</td><td align="center"><em>any</em></td><td align="center">memory</td></tr> </table> </li> <br> <a name="pragma_temp_store_directory"></a> <li><p><b>PRAGMA temp_store_directory; <br>PRAGMA temp_store_directory = 'directory-name';</b></p> <p>Query or change the setting of the "temp_store_directory" flag affecting the database for the duration of the current database connection. The temp_store_directory flag reverts to its default value when the database |
︙ | ︙ |