b.innerHTML='hide';
}
return false;
}
</script>
</div>
<div class=nosearch><h1 align="center">SQL As Understood By SQLite</h1><p><a href="lang.html">[Top]</a></p><h2>ALTER TABLE</h2></div><p><b><a href="syntax/alter-table-stmt.html">alter-table-stmt:</a></b>
<button id='x789' onclick='hideorshow("x789","x790")'>hide</button></p>
<div id='x790' class='imgcontainer'>
<img alt="syntax diagram alter-table-stmt" src="images/syntax/alter-table-stmt.gif" />
<p><b><a href="syntax/column-def.html">column-def:</a></b>
<button id='x791' onclick='hideorshow("x791","x792")'>show</button></p>
<div id='x792' style='display:none;' class='imgcontainer'>
<img alt="syntax diagram column-def" src="images/syntax/column-def.gif" />
<p><b><a href="syntax/column-constraint.html">column-constraint:</a></b>
<button id='x793' onclick='hideorshow("x793","x794")'>show</button></p>
<div id='x794' style='display:none;' class='imgcontainer'>
<img alt="syntax diagram column-constraint" src="images/syntax/column-constraint.gif" />
<p><b><a href="syntax/conflict-clause.html">conflict-clause:</a></b>
<button id='x795' onclick='hideorshow("x795","x796")'>show</button></p>
<div id='x796' style='display:none;' class='imgcontainer'>
<img alt="syntax diagram conflict-clause" src="images/syntax/conflict-clause.gif" />
</div>
<p><b><a href="syntax/expr.html">expr:</a></b>
<button id='x797' onclick='hideorshow("x797","x798")'>show</button></p>
<div id='x798' style='display:none;' class='imgcontainer'>
<img alt="syntax diagram expr" src="images/syntax/expr.gif" />
<p><b><a href="syntax/raise-function.html">raise-function:</a></b>
<button id='x799' onclick='hideorshow("x799","x800")'>show</button></p>
<div id='x800' style='display:none;' class='imgcontainer'>
<img alt="syntax diagram raise-function" src="images/syntax/raise-function.gif" />
</div>
<p><b><a href="syntax/select-stmt.html">select-stmt:</a></b>
<button id='x801' onclick='hideorshow("x801","x802")'>show</button></p>
<div id='x802' style='display:none;' class='imgcontainer'>
<img alt="syntax diagram select-stmt" src="images/syntax/select-stmt.gif" />
<p><b><a href="syntax/common-table-expression.html">common-table-expression:</a></b>
<button id='x803' onclick='hideorshow("x803","x804")'>show</button></p>
<div id='x804' style='display:none;' class='imgcontainer'>
<img alt="syntax diagram common-table-expression" src="images/syntax/common-table-expression.gif" />
</div>
<p><b><a href="syntax/compound-operator.html">compound-operator:</a></b>
<button id='x805' onclick='hideorshow("x805","x806")'>show</button></p>
<div id='x806' style='display:none;' class='imgcontainer'>
<img alt="syntax diagram compound-operator" src="images/syntax/compound-operator.gif" />
</div>
<p><b><a href="syntax/join-clause.html">join-clause:</a></b>
<button id='x807' onclick='hideorshow("x807","x808")'>show</button></p>
<div id='x808' style='display:none;' class='imgcontainer'>
<img alt="syntax diagram join-clause" src="images/syntax/join-clause.gif" />
<p><b><a href="syntax/join-constraint.html">join-constraint:</a></b>
<button id='x809' onclick='hideorshow("x809","x810")'>show</button></p>
<div id='x810' style='display:none;' class='imgcontainer'>
<img alt="syntax diagram join-constraint" src="images/syntax/join-constraint.gif" />
</div>
<p><b><a href="syntax/join-operator.html">join-operator:</a></b>
<button id='x811' onclick='hideorshow("x811","x812")'>show</button></p>
<div id='x812' style='display:none;' class='imgcontainer'>
<img alt="syntax diagram join-operator" src="images/syntax/join-operator.gif" />
</div>
</div>
<p><b><a href="syntax/ordering-term.html">ordering-term:</a></b>
<button id='x813' onclick='hideorshow("x813","x814")'>show</button></p>
<div id='x814' style='display:none;' class='imgcontainer'>
<img alt="syntax diagram ordering-term" src="images/syntax/ordering-term.gif" />
</div>
<p><b><a href="syntax/result-column.html">result-column:</a></b>
<button id='x815' onclick='hideorshow("x815","x816")'>show</button></p>
<div id='x816' style='display:none;' class='imgcontainer'>
<img alt="syntax diagram result-column" src="images/syntax/result-column.gif" />
</div>
<p><b><a href="syntax/table-or-subquery.html">table-or-subquery:</a></b>
<button id='x817' onclick='hideorshow("x817","x818")'>show</button></p>
<div id='x818' style='display:none;' class='imgcontainer'>
<img alt="syntax diagram table-or-subquery" src="images/syntax/table-or-subquery.gif" />
</div>
</div>
</div>
<p><b><a href="syntax/foreign-key-clause.html">foreign-key-clause:</a></b>
<button id='x819' onclick='hideorshow("x819","x820")'>show</button></p>
<div id='x820' style='display:none;' class='imgcontainer'>
<img alt="syntax diagram foreign-key-clause" src="images/syntax/foreign-key-clause.gif" />
</div>
<p><b><a href="syntax/literal-value.html">literal-value:</a></b>
<button id='x821' onclick='hideorshow("x821","x822")'>show</button></p>
<div id='x822' style='display:none;' class='imgcontainer'>
<img alt="syntax diagram literal-value" src="images/syntax/literal-value.gif" />
</div>
<p><b><a href="syntax/signed-number.html">signed-number:</a></b>
<button id='x823' onclick='hideorshow("x823","x824")'>show</button></p>
<div id='x824' style='display:none;' class='imgcontainer'>
<img alt="syntax diagram signed-number" src="images/syntax/signed-number.gif" />
</div>
</div>
<p><b><a href="syntax/type-name.html">type-name:</a></b>
<button id='x825' onclick='hideorshow("x825","x826")'>show</button></p>
<div id='x826' style='display:none;' class='imgcontainer'>
<img alt="syntax diagram type-name" src="images/syntax/type-name.gif" />
<p><b><a href="syntax/signed-number.html">signed-number:</a></b>
<button id='x827' onclick='hideorshow("x827","x828")'>show</button></p>
<div id='x828' style='display:none;' class='imgcontainer'>
<img alt="syntax diagram signed-number" src="images/syntax/signed-number.gif" />
</div>
</div>
</div>
</div>
<p>SQLite supports a limited subset of ALTER TABLE.
The ALTER TABLE command in SQLite allows the user to rename a table
or to add a new column to an existing table.
</p>
<p> The RENAME TO syntax changes the name of <span class='yyterm'>table-name</span>
to <span class='yyterm'>new-table-name</span>.
This command
cannot be used to move a table between attached databases, only to rename
a table within the same database.</p><p> If the table being renamed has triggers or indices, then these remain
attached to the table after it has been renamed. However, if there areany view definitions, or statements executed by triggers that refer tothe table being renamed, these are not automatically modified to use the newtable name. If this is required, the triggers or view definitions must bedropped and recreated to use the new table name by hand.
</p>
<blockquote><table border="1" cellpadding="10"><tr><td><em>Important Note:</em>The 'ALTER TABLE ... RENAME TO ...' command does not update actionstatements within triggers or SELECT statements within views.If the table being renamed is referenced from within triggers or views,then those triggers and views must be dropped and recreated separatelyby the application.</td></tr></table></blockquote><p>If <a href="foreignkeys.html">foreign key constraints</a> are <a href="pragma.html#pragma_foreign_keys">enabled</a> when a table is renamed, then any<a href="syntax/foreign-key-clause.html">REFERENCES clauses</a> in any table (either thetable being renamed or some other table)that refer to the table being renamed are modified to refer to the renamed table by its new name.
<p> The ADD COLUMN syntax
is used to add a new column to an existing table.
The new column is always appended to the end of the list of existing columns.
The <a href="syntax/column-def.html">column-def</a> rule defines the characteristics of the new column.
The new column may take any of the forms permissible in a <a href="lang_createtable.html">CREATE TABLE</a>
statement, with the following restrictions:
................................................................................
<p>Note also that when adding a <a href="lang_createtable.html#ckconst">CHECK constraint</a>, the CHECK constraint
is not tested against preexisting rows of the table.
This can result in a table that contains data that
is in violation of the CHECK constraint. Future versions of SQLite might
change to validate CHECK constraints as they are added.</p>
<p> The execution time of the ALTER TABLE command is independent of
the amount of data in the table. The ALTER TABLE command runs as quickly
on a table with 10 million rows as it does on a table with 1 row.
</p>
<p>After ADD COLUMN has been run on a database, that database will not
be readable by SQLite version 3.1.3 (2005-02-20) and earlier.</p>
<a name="otheralter"></a>
<h3>Making Other Kinds Of Table Schema Changes</h3>
<p> The only schema altering commands directly supported by SQLite are the
"rename table" and "add column" commands shown above. However, applications
can make other arbitrary changes to the format of a table using a simple
sequence of operations.
The steps to make arbitrary changes to the schema design of some table X
are as follows:
<ol>
<li><p>
................................................................................
changing the order of columns, adding or removing a UNIQUE constraint
or PRIMARY KEY, adding CHECK or FOREIGN KEY or NOT NULL constraints,
or changing the datatype for a column, for example. However, a simpler
and faster procedure can optionally be used for
some changes that do no affect the on-disk content in any way.
The following simpler procedure is appropriate for removing
CHECK or FOREIGN KEY or NOT NULL constraints,
renaming columns, or adding or removing or changing default values on
a column.
<ol>
<lI><p> Start a transaction.
<li><p> Run <a href="pragma.html#pragma_schema_version">PRAGMA schema_version</a> to determine the current schema
version number. This number will be needed for step 6 below.
................................................................................
<li><p> If the change to table X also affects other tables or indexes or
triggers are views within schema, then run <a href="lang_update.html">UPDATE</a> statements to modify
those other tables indexes and views too. For example, if the name of
a column changes, all FOREIGN KEY constraints, triggers, indexes, and
views that refer to that column must be modified.
<p><em>Caution:</em> Once again, making changes to the sqlite_master
table like this will render the database corrupt and unreadable if the
change contains an error. Carefully test of this entire procedure
on a separate test database prior to using it on
a database containing important data and/or make backup copies of
important databases prior to running this procedure.
<li><p> Increment the schema version number using
<a href="pragma.html#pragma_schema_version">PRAGMA schema_version=X</a> where X is one
more than the old schema version number found in step 2 above.

}
</script>
</div>
<div class=nosearch><h1 align="center">SQL As Understood By SQLite</h1><p><a href="lang.html">[Top]</a></p><h2>Core Functions</h2></div>
<p>The core functions shown below are available by default.
<a href="lang_datefunc.html">Date &amp; Time functions</a>,
<a href="lang_aggfunc.html">aggregate functions</a>, and
<a href="json1.html">JSON functions</a> are documented separately. An
application may define additional
functions written in C and added to the database engine using
the <a href="c3ref/create_function.html">sqlite3_create_function()</a> API.</p>
<style>
#listtab32 tr td {vertical-align:top;}
................................................................................
2 arguments.
</dd>
<a name="glob"></a>
<dt><p><b>glob(<i>X</i>,<i>Y</i>)</b></dt><dd><p>
The glob(X,Y) function is equivalent to the
expression "<b>Y GLOB X</b>".
Note that the X and Y arguments are reversed in the glob() function
relative to the infix <a href="lang_expr.html#glob">GLOB</a> operator.
If the <a href="c3ref/create_function.html">sqlite3_create_function()</a> interface is used to
override the glob(X,Y) function with an alternative implementation then
the <a href="lang_expr.html#glob">GLOB</a> operator will invoke the alternative implementation.
</dd>
<a name="hex"></a>
<dt><p><b>hex(<i>X</i>)</b></dt><dd><p>
The hex() function interprets its argument as a BLOB and returns
a string which is the upper-case hexadecimal rendering of the content of
................................................................................
<dt><p><b>like(<i>X</i>,<i>Y</i>)<br />like(<i>X</i>,<i>Y</i>,<i>Z</i>)</b></dt><dd><p>
The like() function is used to implement the
"<b>Y LIKE X &#91;ESCAPE Z&#93;</b>" expression.
If the optional ESCAPE clause is present, then the
like() function is invoked with three arguments. Otherwise, it is
invoked with two arguments only. Note that the X and Y parameters are
reversed in the like() function relative to the infix <a href="lang_expr.html#like">LIKE</a> operator.
The <a href="c3ref/create_function.html">sqlite3_create_function()</a> interface can be used to override the
like() function and thereby change the operation of the
<a href="lang_expr.html#like">LIKE</a> operator. When overriding the like() function, 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
<a href="lang_expr.html#like">LIKE</a> operator depending on whether or not an ESCAPE clause was
specified.

}
</script>
</div>
<div class=nosearch><h1 align="center">SQL As Understood By SQLite</h1><p><a href="lang.html">[Top]</a></p><h2>Core Functions</h2></div>
<p>The core functions shown below are available by default.
<a href="lang_datefunc.html">Date &amp; Time functions</a>,
<a href="lang_aggfunc.html">aggregate functions</a>,
<a href="windowfunctions.html#biwinfunc">window functions</a>, and
<a href="json1.html">JSON functions</a> are documented separately. An
application may define additional
functions written in C and added to the database engine using
the <a href="c3ref/create_function.html">sqlite3_create_function()</a> API.</p>
<style>
#listtab32 tr td {vertical-align:top;}
................................................................................
2 arguments.
</dd>
<a name="glob"></a>
<dt><p><b>glob(<i>X</i>,<i>Y</i>)</b></dt><dd><p>
The glob(X,Y) function is equivalent to the
expression "<b>Y GLOB X</b>".
Note that the X and Y arguments are reversed in the glob() function
relative to the infix <a href="lang_expr.html#glob">GLOB</a> operator. Y is the string and X is the pattern. So, for example, the following expressions are equivalent: <blockquote><pre> name LIKE '*helium*' glob('*helium*',name) </pre></blockquote><p>If the <a href="c3ref/create_function.html">sqlite3_create_function()</a> interface is used to
override the glob(X,Y) function with an alternative implementation then
the <a href="lang_expr.html#glob">GLOB</a> operator will invoke the alternative implementation.
</dd>
<a name="hex"></a>
<dt><p><b>hex(<i>X</i>)</b></dt><dd><p>
The hex() function interprets its argument as a BLOB and returns
a string which is the upper-case hexadecimal rendering of the content of
................................................................................
<dt><p><b>like(<i>X</i>,<i>Y</i>)<br />like(<i>X</i>,<i>Y</i>,<i>Z</i>)</b></dt><dd><p>
The like() function is used to implement the
"<b>Y LIKE X &#91;ESCAPE Z&#93;</b>" expression.
If the optional ESCAPE clause is present, then the
like() function is invoked with three arguments. Otherwise, it is
invoked with two arguments only. Note that the X and Y parameters are
reversed in the like() function relative to the infix <a href="lang_expr.html#like">LIKE</a> operator.
X is the pattern and Y is the string to match against that pattern. Hence, the following expressions are equivalent: <blockquote><pre> name LIKE '%neon%' like('%neon%',name) </pre></blockquote>
The <a href="c3ref/create_function.html">sqlite3_create_function()</a> interface can be used to override the
like() function and thereby change the operation of the
<a href="lang_expr.html#like">LIKE</a> operator. When overriding the like() function, 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
<a href="lang_expr.html#like">LIKE</a> operator depending on whether or not an ESCAPE clause was
specified.

so the date is normalized to 2001-05-01. A similar effect occurs when
the original date is February 29 of a leapyear and the modifier is
&plusmn;N years where N is not a multiple of four.</p>
<p>The "start of" modifiers (7 through 9) shift the date backwards
to the beginning of the current month, year or day.</p>
<p>The "weekday" modifier advances the date forward to the next date
where the weekday number is N. Sunday is 0, Monday is 1, and so forth.</p>
<p>The "unixepoch" modifier (11) only works if it immediately follows
a timestring in the DDDDDDDDDD format.
This modifier causes the DDDDDDDDDD to be interpreted not
as a Julian day number as it normally would be, but as
<a href="http://en.wikipedia.org/wiki/Unix_time">Unix Time</a> - the
number of seconds since 1970. If the "unixepoch" modifier does not

so the date is normalized to 2001-05-01. A similar effect occurs when
the original date is February 29 of a leapyear and the modifier is
&plusmn;N years where N is not a multiple of four.</p>
<p>The "start of" modifiers (7 through 9) shift the date backwards
to the beginning of the current month, year or day.</p>
<p>The "weekday" modifier advances the date forward, if necessary,to the next date where the weekday number is N. Sunday is 0, Monday is 1,
and so forth.If the date is already on the desired weekday, the "weekday" modifierleaves the date unchanged. </p>
<p>The "unixepoch" modifier (11) only works if it immediately follows
a timestring in the DDDDDDDDDD format.
This modifier causes the DDDDDDDDDD to be interpreted not
as a Julian day number as it normally would be, but as
<a href="http://en.wikipedia.org/wiki/Unix_time">Unix Time</a> - the
number of seconds since 1970. If the "unixepoch" modifier does not

<div class=nosearch><h1 align="center">SQL As Understood By SQLite</h1><p><a href="lang.html">[Top]</a></p><h2>INDEXED BY</h2></div>
<p>The INDEXED BY phrase forces the <a href="optoverview.html">SQLite query planner</a> to use a
particular named index on a <a href="lang_delete.html">DELETE</a>, <a href="lang_select.html">SELECT</a>, or <a href="lang_update.html">UPDATE</a> statement.
The INDEXED BY phrase is an SQLite extension and
is not portable to other SQL database engines.</p>
<p><b><a href="syntax/qualified-table-name.html">qualified-table-name:</a></b>
<button id='x1535' onclick='hideorshow("x1535","x1536")'>hide</button></p>
<div id='x1536' class='imgcontainer'>
<img alt="syntax diagram qualified-table-name" src="images/syntax/qualified-table-name.gif" />
</div>
<p>The "INDEXED BY <span class='yyterm'>index-name</span>" phrase specifies
that the named index
must be used in order to look up values on the preceding table.

|
|

94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109

<div class=nosearch><h1 align="center">SQL As Understood By SQLite</h1><p><a href="lang.html">[Top]</a></p><h2>INDEXED BY</h2></div>
<p>The INDEXED BY phrase forces the <a href="optoverview.html">SQLite query planner</a> to use a
particular named index on a <a href="lang_delete.html">DELETE</a>, <a href="lang_select.html">SELECT</a>, or <a href="lang_update.html">UPDATE</a> statement.
The INDEXED BY phrase is an SQLite extension and
is not portable to other SQL database engines.</p>
<p><b><a href="syntax/qualified-table-name.html">qualified-table-name:</a></b>
<button id='x1993' onclick='hideorshow("x1993","x1994")'>hide</button></p>
<div id='x1994' class='imgcontainer'>
<img alt="syntax diagram qualified-table-name" src="images/syntax/qualified-table-name.gif" />
</div>
<p>The "INDEXED BY <span class='yyterm'>index-name</span>" phrase specifies
that the named index
must be used in order to look up values on the preceding table.

}
return false;
}
</script>
</div>
<div class=nosearch><h1 align="center">SQL As Understood By SQLite</h1><p><a href="lang.html">[Top]</a></p><h2>SQLite Keywords</h2></div></DIV>
<p>The SQL standard specifies a huge number of keywords which may not
be used as the names of tables, indices, columns, databases, user-defined
functions, collations, virtual table modules, or any other named object.
The list of keywords is so long that few people can remember them all.
For most SQL code, your safest bet is to never use any English language
word as the name of a user-defined object.</p>
<p>If you want to use a keyword as a name, you need to quote it. There
................................................................................
<p>
The list below shows all possible keywords used by any build of
SQLite regardless of <a href="compile.html">compile-time options</a>.
Most reasonable configurations use most or all of these keywords,
but some keywords may be omitted when SQL language features are
disabled.
Regardless of the compile-time configuration, any identifier that is not on
the following 124 element
list is not a keyword to the SQL parser in SQLite:
</p>
<ol>
<li>ABORT</li>
<li>ACTION</li>
<li>ADD</li>
................................................................................
<li>COLLATE</li>
<li>COLUMN</li>
<li>COMMIT</li>
<li>CONFLICT</li>
<li>CONSTRAINT</li>
<li>CREATE</li>
<li>CROSS</li>
<li>CURRENT_DATE</li>
<li>CURRENT_TIME</li>
<li>CURRENT_TIMESTAMP</li>
<li>DATABASE</li>
<li>DEFAULT</li>
<li>DEFERRABLE</li>
<li>DEFERRED</li>
<li>DELETE</li>
<li>DESC</li>
<li>DETACH</li>
<li>DISTINCT</li>
<li>DROP</li>
<li>EACH</li>
<li>ELSE</li>
<li>END</li>
<li>ESCAPE</li>
<li>EXCEPT</li>
<li>EXCLUSIVE</li>
<li>EXISTS</li>
<li>EXPLAIN</li>
<li>FAIL</li>
<li>FOR</li>
<li>FOREIGN</li>
<li>FROM</li>
<li>FULL</li>
<li>GLOB</li>
<li>GROUP</li>
<li>HAVING</li>
................................................................................
<li>LEFT</li>
<li>LIKE</li>
<li>LIMIT</li>
<li>MATCH</li>
<li>NATURAL</li>
<li>NO</li>
<li>NOT</li>
<li>NOTNULL</li>
<li>NULL</li>
<li>OF</li>
<li>OFFSET</li>
<li>ON</li>
<li>OR</li>
<li>ORDER</li>
<li>OUTER</li>
<li>PLAN</li>
<li>PRAGMA</li>
<li>PRIMARY</li>
<li>QUERY</li>
<li>RAISE</li>
<li>RECURSIVE</li>
<li>REFERENCES</li>
<li>REGEXP</li>
<li>REINDEX</li>
<li>RELEASE</li>
<li>RENAME</li>
<li>REPLACE</li>
<li>RESTRICT</li>
<li>RIGHT</li>
<li>ROLLBACK</li>
<li>ROW</li>
<li>SAVEPOINT</li>
<li>SELECT</li>
<li>SET</li>
<li>TABLE</li>
<li>TEMP</li>
<li>TEMPORARY</li>
<li>THEN</li>
<li>TO</li>
<li>TRANSACTION</li>
<li>TRIGGER</li>
<li>UNION</li>
<li>UNIQUE</li>
<li>UPDATE</li>
<li>USING</li>
<li>VACUUM</li>
<li>VALUES</li>
<li>VIEW</li>
<li>VIRTUAL</li>
<li>WHEN</li>
<li>WHERE</li>
<li>WITH</li>
<li>WITHOUT</li>
</ol>

opportunity to add new PRAGMA statements or to override the meaning of
built-in PRAGMA statements.</p>
<hr /><a name="syntax"></a>
<h2>PRAGMA command syntax</h2>
<p><b><a href="syntax/pragma-stmt.html">pragma-stmt:</a></b>
<button id='x1569' onclick='hideorshow("x1569","x1570")'>hide</button></p>
<div id='x1570' class='imgcontainer'>
<img alt="syntax diagram pragma-stmt" src="images/syntax/pragma-stmt.gif" />
<p><b><a href="syntax/pragma-value.html">pragma-value:</a></b>
<button id='x1571' onclick='hideorshow("x1571","x1572")'>hide</button></p>
<div id='x1572' class='imgcontainer'>
<img alt="syntax diagram pragma-value" src="images/syntax/pragma-value.gif" />
<p><b><a href="syntax/signed-number.html">signed-number:</a></b>
<button id='x1573' onclick='hideorshow("x1573","x1574")'>show</button></p>
<div id='x1574' style='display:none;' class='imgcontainer'>
<img alt="syntax diagram signed-number" src="images/syntax/signed-number.gif" />
</div>
</div>
</div>
<p>
................................................................................
{"u":"pragma.html#pragma_incremental_vacuum","x":"incremental_vacuum","s":0},
{"u":"pragma.html#pragma_index_info","x":"index_info","s":0},
{"u":"pragma.html#pragma_index_list","x":"index_list","s":0},
{"u":"pragma.html#pragma_index_xinfo","x":"index_xinfo","s":0},
{"u":"pragma.html#pragma_integrity_check","x":"integrity_check","s":0},
{"u":"pragma.html#pragma_journal_mode","x":"journal_mode","s":0},
{"u":"pragma.html#pragma_journal_size_limit","x":"journal_size_limit","s":0},
{"u":"pragma.html#pragma_legacy_file_format","x":"legacy_file_format","s":0},
{"u":"pragma.html#pragma_locking_mode","x":"locking_mode","s":0},
{"u":"pragma.html#pragma_max_page_count","x":"max_page_count","s":0},
{"u":"pragma.html#pragma_mmap_size","x":"mmap_size","s":0},
{"u":"pragma.html#pragma_module_list","x":"module_list","s":4},
{"u":"pragma.html#pragma_optimize","x":"optimize","s":0},
{"u":"pragma.html#pragma_page_count","x":"page_count","s":0},
................................................................................
for use in application programs.</ol></p>
<a name="pragma_application_id"></a>
<h _id=pragma_application_id style="display:none"> PRAGMA application_id</h><hr>
<p><b>PRAGMA </b><i>schema.</i><b>application_id;
<br>PRAGMA </b><i>schema.</i><b>application_id = </b><i>integer </i><b>;</b>
<p> The application_id PRAGMA is used to query or set the 32-bit
unsigned big-endian "Application ID" integer located at offset
68 into the <a href="fileformat2.html#database_header">database header</a>. Applications that use SQLite as their
<a href="appfileformat.html">application file-format</a> should set the Application ID integer to
a unique integer so that utilities such as
<a href="http://www.darwinsys.com/file/">file(1)</a> can determine the specific
file type rather than just reporting "SQLite3 Database". A list of
assigned application IDs can be seen by consulting the
<a href="http://www.sqlite.org/src/artifact?ci=trunk&filename=magic.txt">magic.txt</a> file in the SQLite source repository.
................................................................................
the default journal size limit at compile-time.</p>
<p>This pragma only operates on the single database specified prior
to the pragma name (or on the "main" database if no database is specified.)
There is no way to change the journal size limit on all attached databases
using a single PRAGMA statement. The size limit must be set separately for
each attached database.
<a name="pragma_legacy_file_format"></a>
<h _id=pragma_legacy_file_format style="display:none"> PRAGMA legacy_file_format</h><hr>
<p><b>PRAGMA legacy_file_format;
<br>PRAGMA legacy_file_format = <i>boolean</i></b></p>
<p>This pragma sets or queries the value of the legacy_file_format
flag. When this flag is on, new SQLite databases are created in
a file format that is readable and writable by all versions of

opportunity to add new PRAGMA statements or to override the meaning of
built-in PRAGMA statements.</p>
<hr /><a name="syntax"></a>
<h2>PRAGMA command syntax</h2>
<p><b><a href="syntax/pragma-stmt.html">pragma-stmt:</a></b>
<button id='x2035' onclick='hideorshow("x2035","x2036")'>hide</button></p>
<div id='x2036' class='imgcontainer'>
<img alt="syntax diagram pragma-stmt" src="images/syntax/pragma-stmt.gif" />
<p><b><a href="syntax/pragma-value.html">pragma-value:</a></b>
<button id='x2037' onclick='hideorshow("x2037","x2038")'>hide</button></p>
<div id='x2038' class='imgcontainer'>
<img alt="syntax diagram pragma-value" src="images/syntax/pragma-value.gif" />
<p><b><a href="syntax/signed-number.html">signed-number:</a></b>
<button id='x2039' onclick='hideorshow("x2039","x2040")'>show</button></p>
<div id='x2040' style='display:none;' class='imgcontainer'>
<img alt="syntax diagram signed-number" src="images/syntax/signed-number.gif" />
</div>
</div>
</div>
<p>
................................................................................
{"u":"pragma.html#pragma_incremental_vacuum","x":"incremental_vacuum","s":0},
{"u":"pragma.html#pragma_index_info","x":"index_info","s":0},
{"u":"pragma.html#pragma_index_list","x":"index_list","s":0},
{"u":"pragma.html#pragma_index_xinfo","x":"index_xinfo","s":0},
{"u":"pragma.html#pragma_integrity_check","x":"integrity_check","s":0},
{"u":"pragma.html#pragma_journal_mode","x":"journal_mode","s":0},
{"u":"pragma.html#pragma_journal_size_limit","x":"journal_size_limit","s":0},
{"u":"pragma.html#pragma_legacy_alter_table","x":"legacy_alter_table","s":0},
{"u":"pragma.html#pragma_legacy_file_format","x":"legacy_file_format","s":0},
{"u":"pragma.html#pragma_locking_mode","x":"locking_mode","s":0},
{"u":"pragma.html#pragma_max_page_count","x":"max_page_count","s":0},
{"u":"pragma.html#pragma_mmap_size","x":"mmap_size","s":0},
{"u":"pragma.html#pragma_module_list","x":"module_list","s":4},
{"u":"pragma.html#pragma_optimize","x":"optimize","s":0},
{"u":"pragma.html#pragma_page_count","x":"page_count","s":0},
................................................................................
for use in application programs.</ol></p>
<a name="pragma_application_id"></a>
<h _id=pragma_application_id style="display:none"> PRAGMA application_id</h><hr>
<p><b>PRAGMA </b><i>schema.</i><b>application_id;
<br>PRAGMA </b><i>schema.</i><b>application_id = </b><i>integer </i><b>;</b>
<p> The application_id PRAGMA is used to query or set the 32-bit
signed big-endian "Application ID" integer located at offset
68 into the <a href="fileformat2.html#database_header">database header</a>. Applications that use SQLite as their
<a href="appfileformat.html">application file-format</a> should set the Application ID integer to
a unique integer so that utilities such as
<a href="http://www.darwinsys.com/file/">file(1)</a> can determine the specific
file type rather than just reporting "SQLite3 Database". A list of
assigned application IDs can be seen by consulting the
<a href="http://www.sqlite.org/src/artifact?ci=trunk&filename=magic.txt">magic.txt</a> file in the SQLite source repository.
................................................................................
the default journal size limit at compile-time.</p>
<p>This pragma only operates on the single database specified prior
to the pragma name (or on the "main" database if no database is specified.)
There is no way to change the journal size limit on all attached databases
using a single PRAGMA statement. The size limit must be set separately for
each attached database.
<a name="pragma_legacy_alter_table"></a><h _id=pragma_legacy_alter_table style="display:none"> PRAGMA legacy_alter_table</h><hr> <p><b>PRAGMA legacy_alter_table; <br>PRAGMA legacy_alter_table = <i>boolean</i></b></p> <p>This pragma sets or queries the value of the legacy_alter_table flag. When this flag is on, the ALTER TABLE RENAME command (for changing the name of a table) works as it did in SQLite 3.24.0 (2018-06-04) and earlier. More specifically, when this flag is on the ALTER TABLE RENAME command only rewrites the initial occurrence of the table name in its CREATE TABLE statement and in any associated CREATE INDEX and CREATE TRIGGER statements. Other references to the table are unmodifed, including: <ul> <li> References to the table within the bodies of triggers and views. <li> References to the table within CHECK constraints in the original CREATE TABLE statement. <li> References to the table within the WHERE clauses of <a href="partialindex.html">partial indexes</a>. </ul> The default setting for this pragma is OFF, which means that all references to the table anywhere in the schema are converted to the new name. <p>This pragma is provided as a work-around for older programs that contain code that expect the incomplete behavior of ALTER TABLE RENAME found in older versions of SQLite. New applications should leave this flag turned off. <p>For compability with older <a href="vtab.html">virtual table</a> implementations, this flag is turned on temporarily while the <a href="vtab.html#xrename">sqlite3_module.xRename</a> method is being run. The value of this flag is restore after the <a href="vtab.html#xrename">sqlite3_module.xRename</a> method finishes.
<a name="pragma_legacy_file_format"></a>
<h _id=pragma_legacy_file_format style="display:none"> PRAGMA legacy_file_format</h><hr>
<p><b>PRAGMA legacy_file_format;
<br>PRAGMA legacy_file_format = <i>boolean</i></b></p>
<p>This pragma sets or queries the value of the legacy_file_format
flag. When this flag is on, new SQLite databases are created in
a file format that is readable and writable by all versions of

</p><h2 id="usage"><span>1.1. </span>Usage</h2>
<p>A virtual table is created using a <a href="lang_createvtab.html">CREATE VIRTUAL TABLE</a> statement.
<p><b><a href="syntax/create-virtual-table-stmt.html">create-virtual-table-stmt:</a></b>
<button id='x1575' onclick='hideorshow("x1575","x1576")'>hide</button></p>
<div id='x1576' class='imgcontainer'>
<img alt="syntax diagram create-virtual-table-stmt" src="images/syntax/create-virtual-table-stmt.gif" />
</div>
</p><p>The CREATE VIRTUAL TABLE statement creates a new table
called <span class='yyterm'>table-name</span> derived from the class
class <span class='yyterm'>module-name</span>. The <span class='yyterm'>module-name</span>
................................................................................
#define SQLITE_INDEX_CONSTRAINT_GLOB 66 /* 3.10.0 and later */
#define SQLITE_INDEX_CONSTRAINT_REGEXP 67 /* 3.10.0 and later */
#define SQLITE_INDEX_CONSTRAINT_NE 68 /* 3.21.0 and later */
#define SQLITE_INDEX_CONSTRAINT_ISNOT 69 /* 3.21.0 and later */
#define SQLITE_INDEX_CONSTRAINT_ISNOTNULL 70 /* 3.21.0 and later */
#define SQLITE_INDEX_CONSTRAINT_ISNULL 71 /* 3.21.0 and later */
#define SQLITE_INDEX_CONSTRAINT_IS 72 /* 3.21.0 and later */
#define SQLITE_INDEX_SCAN_UNIQUE 1 /* Scan visits at most 1 row */
</pre></div>
<p>The SQLite core calls the xBestIndex method when it is compiling a query
that involves a virtual table. In other words, SQLite calls this method
when it is running <a href="c3ref/prepare.html">sqlite3_prepare()</a> or the equivalent.
By calling this method, the
................................................................................
<p>The main thing that the SQLite core is trying to communicate to
the virtual table is the constraints that are available to limit
the number of rows that need to be searched. The aConstraint[] array
contains one entry for each constraint. There will be exactly
nConstraint entries in that array.
</p><p>Each constraint will correspond to a term in the WHERE clause
or in a USING or ON clause that is of the form
</p><blockquote>
column OP EXPR
</blockquote>
<p>Where "column" is a column in the virtual table, OP is an operator
................................................................................
<p>The query optimizer might translate this into three separate constraints:
</p><div class="codeblock"><pre>x &gt;= 10
x &lt;= 100
y &lt; 999
</pre></div>
<p>For each constraint, the aConstraint[].iColumn field indicates which
column appears on the left-hand side of the constraint.
The first column of the virtual table is column 0.
The rowid of the virtual table is column -1.
The aConstraint[].op field indicates which operator is used.
The SQLITE_INDEX_CONSTRAINT_* constants map integer constants
into operator values.
Columns occur in the order they were defined by the call to
<a href="c3ref/declare_vtab.html">sqlite3_declare_vtab()</a> in the <a href="vtab.html#xcreate">xCreate</a> or <a href="vtab.html#xconnect">xConnect</a> method.
Hidden columns are counted when determining the column index.
</p><p>The aConstraint[] array contains information about all constraints
that apply to the virtual table. But some of the constraints might
not be usable because of the way tables are ordered in a join.
The xBestIndex method must therefore only consider constraints
that have an aConstraint[].usable flag which is true.
................................................................................
</p><p>When a function uses a column from a virtual table as its first
argument, this method is called to see if the virtual table would
like to overload the function. The first three parameters are inputs:
the virtual table, the number of arguments to the function, and the
name of the function. If no overloading is desired, this method
returns 0. To overload the function, this method writes the new
function implementation into *pxFunc and writes user data into *ppArg
and returns 1.</p><p>Note that infix functions (<a href="lang_expr.html#like">LIKE</a>, <a href="lang_expr.html#glob">GLOB</a>, <a href="lang_expr.html#regexp">REGEXP</a>, and <a href="lang_expr.html#match">MATCH</a>) reverse
the order of their arguments. So "like(A,B)" is equivalent to "B like A".
For the form "B like A" the B term is considered the first argument
to the function. But for "like(A,B)" the A term is considered the
first argument.
</p><p>The function pointer returned by this routine must be valid for
the lifetime of the <a href="c3ref/vtab.html">sqlite3_vtab</a> object given in the first parameter.
................................................................................
</pre></div>
<p>This method provides notification that the virtual table implementation
that the virtual table will be given a new name.
If this method returns <a href="rescode.html#ok">SQLITE_OK</a> then SQLite renames the table.
If this method returns an <a href="rescode.html">error code</a> then the renaming is prevented.
</p><p>The xRename method is required for every virtual table implementation.
<a name="xsavepoint"></a>
</p><h2 id="the_xsavepoint_xrelease_and_xrollbackto_methods"><span>2.20. </span>The xSavepoint, xRelease, and xRollbackTo Methods</h2>
<div class="codeblock"><pre>int (*xSavepoint)(sqlite3_vtab *pVtab, int);
int (*xRelease)(sqlite3_vtab *pVtab, int);

</p><h2 id="usage"><span>1.1. </span>Usage</h2>
<p>A virtual table is created using a <a href="lang_createvtab.html">CREATE VIRTUAL TABLE</a> statement.
<p><b><a href="syntax/create-virtual-table-stmt.html">create-virtual-table-stmt:</a></b>
<button id='x2041' onclick='hideorshow("x2041","x2042")'>hide</button></p>
<div id='x2042' class='imgcontainer'>
<img alt="syntax diagram create-virtual-table-stmt" src="images/syntax/create-virtual-table-stmt.gif" />
</div>
</p><p>The CREATE VIRTUAL TABLE statement creates a new table
called <span class='yyterm'>table-name</span> derived from the class
class <span class='yyterm'>module-name</span>. The <span class='yyterm'>module-name</span>
................................................................................
#define SQLITE_INDEX_CONSTRAINT_GLOB 66 /* 3.10.0 and later */
#define SQLITE_INDEX_CONSTRAINT_REGEXP 67 /* 3.10.0 and later */
#define SQLITE_INDEX_CONSTRAINT_NE 68 /* 3.21.0 and later */
#define SQLITE_INDEX_CONSTRAINT_ISNOT 69 /* 3.21.0 and later */
#define SQLITE_INDEX_CONSTRAINT_ISNOTNULL 70 /* 3.21.0 and later */
#define SQLITE_INDEX_CONSTRAINT_ISNULL 71 /* 3.21.0 and later */
#define SQLITE_INDEX_CONSTRAINT_IS 72 /* 3.21.0 and later */
#define SQLITE_INDEX_CONSTRAINT_FUNCTION 150 /* 3.25.0 and later */
#define SQLITE_INDEX_SCAN_UNIQUE 1 /* Scan visits at most 1 row */
</pre></div>
<p>The SQLite core calls the xBestIndex method when it is compiling a query
that involves a virtual table. In other words, SQLite calls this method
when it is running <a href="c3ref/prepare.html">sqlite3_prepare()</a> or the equivalent.
By calling this method, the
................................................................................
<p>The main thing that the SQLite core is trying to communicate to
the virtual table is the constraints that are available to limit
the number of rows that need to be searched. The aConstraint[] array
contains one entry for each constraint. There will be exactly
nConstraint entries in that array.
</p><p>Each constraint will usually correspond to a term in the WHERE clause
or in a USING or ON clause that is of the form
</p><blockquote>
column OP EXPR
</blockquote>
<p>Where "column" is a column in the virtual table, OP is an operator
................................................................................
<p>The query optimizer might translate this into three separate constraints:
</p><div class="codeblock"><pre>x &gt;= 10
x &lt;= 100
y &lt; 999
</pre></div>
<p>For such each constraint, the aConstraint[].iColumn field indicates which
column appears on the left-hand side of the constraint.
The first column of the virtual table is column 0.
The rowid of the virtual table is column -1.
The aConstraint[].op field indicates which operator is used.
The SQLITE_INDEX_CONSTRAINT_* constants map integer constants
into operator values.
Columns occur in the order they were defined by the call to
<a href="c3ref/declare_vtab.html">sqlite3_declare_vtab()</a> in the <a href="vtab.html#xcreate">xCreate</a> or <a href="vtab.html#xconnect">xConnect</a> method.
Hidden columns are counted when determining the column index.
</p><p>If the <a href="vtab.html#xfindfunction">xFindFunction()</a> method for the virtual table is defined, and if xFindFunction() sometimes returns <a href="c3ref/c_index_constraint_eq.html">SQLITE_INDEX_CONSTRAINT_FUNCTION</a> orlarger, then the constraints might also be of the form:</p><blockquote> FUNCTION( column, EXPR)</blockquote><p>In this case the aConstraint[].op value is the same as the valuereturned by <a href="vtab.html#xfindfunction">xFindFunction()</a> for FUNCTION.
</p><p>The aConstraint[] array contains information about all constraints
that apply to the virtual table. But some of the constraints might
not be usable because of the way tables are ordered in a join.
The xBestIndex method must therefore only consider constraints
that have an aConstraint[].usable flag which is true.
................................................................................
</p><p>When a function uses a column from a virtual table as its first
argument, this method is called to see if the virtual table would
like to overload the function. The first three parameters are inputs:
the virtual table, the number of arguments to the function, and the
name of the function. If no overloading is desired, this method
returns 0. To overload the function, this method writes the new
function implementation into *pxFunc and writes user data into *ppArg
and returns either 1 or a number between<a href="c3ref/c_index_constraint_eq.html">SQLITE_INDEX_CONSTRAINT_FUNCTION</a> and 255.</p><p>Historically, the return value from xFindFunction() was either zeroor one. Zero means that the function is not overloaded and one means thatit is overload. The ability to return values of <a href="c3ref/c_index_constraint_eq.html">SQLITE_INDEX_CONSTRAINT_FUNCTION</a> or greater was added inversion 3.25.0 (2018-09-15). If xFindFunction returns<a href="c3ref/c_index_constraint_eq.html">SQLITE_INDEX_CONSTRAINT_FUNCTION</a> or greater, than means that the functiontakes two arguments and the functioncan be used as a boolean in the WHERE clause of a query and thatthe virtual table is able to exploit that function to speed up the queryresult. When xFindFunction returns <a href="c3ref/c_index_constraint_eq.html">SQLITE_INDEX_CONSTRAINT_FUNCTION</a> or larger, the value returned becomes the sqlite3_index_info.aConstraint.opvalue for one of the constraints passed into <a href="vtab.html#xbestindex">xBestIndex()</a> and the secondargument becomes the value corresponding to that constraint that is passedto <a href="vtab.html#xfilter">xFilter()</a>. This enables thexBestIndex()/xFilter implementations to use the function to speedits search.</p><p>The technique of having xFindFunction() return values of<a href="c3ref/c_index_constraint_eq.html">SQLITE_INDEX_CONSTRAINT_FUNCTION</a> was initially used in the implementationof the <a href="geopoly.html">Geopoly module</a>. The xFindFunction() method of that module returnsSQLITE_INDEX_CONSTRAINT_FUNCTION for the <a href="geopoly.html#goverlap">geopoly_overlap()</a> SQL function
and it returns
SQLITE_INDEX_CONSTRAINT_FUNCTION+1 for the <a href="geopoly.html#gwithin">geopoly_within()</a> SQL function.This permits search optimizations for queries such as:</p><div class="codeblock"><pre>SELECT * FROM geopolytab WHERE geopoly_overlap(_shape, $query_polygon);</pre></div>
<p>Note that infix functions (<a href="lang_expr.html#like">LIKE</a>, <a href="lang_expr.html#glob">GLOB</a>, <a href="lang_expr.html#regexp">REGEXP</a>, and <a href="lang_expr.html#match">MATCH</a>) reverse
the order of their arguments. So "like(A,B)" is equivalent to "B like A".
For the form "B like A" the B term is considered the first argument
to the function. But for "like(A,B)" the A term is considered the
first argument.
</p><p>The function pointer returned by this routine must be valid for
the lifetime of the <a href="c3ref/vtab.html">sqlite3_vtab</a> object given in the first parameter.
................................................................................
</pre></div>
<p>This method provides notification that the virtual table implementation
that the virtual table will be given a new name.
If this method returns <a href="rescode.html#ok">SQLITE_OK</a> then SQLite renames the table.
If this method returns an <a href="rescode.html">error code</a> then the renaming is prevented.
</p><p>The xRename method is optional. If omitted, then the virtualtable may not be renamed using the ALTER TABLE RENAME command.</p><p>The <a href="pragma.html#pragma_legacy_alter_table">PRAGMA legacy_alter_table</a> setting is enabled prior to invoking thismethod, and the value for legacy_alter_table is restored after thismethod finishes. This is necessary for the correct operation of virtualtables that make use of <a href="fts3.html#*shadowtab">shadow tables</a> where the shadow tables must berenamed to match the new virtual table name. If the legacy_alter_format isoff, then the xConnect method will be invoked for the virtual table everytime the xRename method tries to change the name of the shadow table.
<a name="xsavepoint"></a>
</p><h2 id="the_xsavepoint_xrelease_and_xrollbackto_methods"><span>2.20. </span>The xSavepoint, xRelease, and xRollbackTo Methods</h2>
<div class="codeblock"><pre>int (*xSavepoint)(sqlite3_vtab *pVtab, int);
int (*xRelease)(sqlite3_vtab *pVtab, int);

/// #define SQLITE_INDEX_CONSTRAINT_GLOB 66 /* 3.10.0 and later */
/// #define SQLITE_INDEX_CONSTRAINT_REGEXP 67 /* 3.10.0 and later */
/// #define SQLITE_INDEX_CONSTRAINT_NE 68 /* 3.21.0 and later */
/// #define SQLITE_INDEX_CONSTRAINT_ISNOT 69 /* 3.21.0 and later */
/// #define SQLITE_INDEX_CONSTRAINT_ISNOTNULL 70 /* 3.21.0 and later */
/// #define SQLITE_INDEX_CONSTRAINT_ISNULL 71 /* 3.21.0 and later */
/// #define SQLITE_INDEX_CONSTRAINT_IS 72 /* 3.21.0 and later */
/// #define SQLITE_INDEX_SCAN_UNIQUE 1 /* Scan visits at most 1 row */
/// </code></para>
/// <para>
/// The SQLite core calls the xBestIndex method when it is compiling a query
/// that involves a virtual table. In other words, SQLite calls this method
/// when it is running sqlite3_prepare() or the equivalent.
/// By calling this method, the
................................................................................
/// The main thing that the SQLite core is trying to communicate to
/// the virtual table is the constraints that are available to limit
/// the number of rows that need to be searched. The aConstraint[] array
/// contains one entry for each constraint. There will be exactly
/// nConstraint entries in that array.
/// </para>
/// <para>
/// Each constraint will correspond to a term in the WHERE clause
/// or in a USING or ON clause that is of the form
/// </para>
/// <para><code>
/// column OP EXPR
/// </code></para>
/// <para>
/// Where "column" is a column in the virtual table, OP is an operator
................................................................................
/// </para>
/// <para><code>
/// x &gt;= 10
/// x &lt;= 100
/// y &lt; 999
/// </code></para>
/// <para>
/// For each constraint, the aConstraint[].iColumn field indicates which
/// column appears on the left-hand side of the constraint.
/// The first column of the virtual table is column 0.
/// The rowid of the virtual table is column -1.
/// The aConstraint[].op field indicates which operator is used.
/// The SQLITE_INDEX_CONSTRAINT_* constants map integer constants
/// into operator values.
/// Columns occur in the order they were defined by the call to
/// sqlite3_declare_vtab() in the xCreate or xConnect method.
/// Hidden columns are counted when determining the column index.
/// </para>
/// <para>
/// The aConstraint[] array contains information about all constraints
/// that apply to the virtual table. But some of the constraints might
/// not be usable because of the way tables are ordered in a join.
/// The xBestIndex method must therefore only consider constraints
/// that have an aConstraint[].usable flag which is true.
/// </para>
................................................................................
/// When a function uses a column from a virtual table as its first
/// argument, this method is called to see if the virtual table would
/// like to overload the function. The first three parameters are inputs:
/// the virtual table, the number of arguments to the function, and the
/// name of the function. If no overloading is desired, this method
/// returns 0. To overload the function, this method writes the new
/// function implementation into *pxFunc and writes user data into *ppArg
/// and returns 1.
/// </para>
/// <para>
/// Note that infix functions (LIKE, GLOB, REGEXP, and MATCH) reverse
/// the order of their arguments. So "like(A,B)" is equivalent to "B like A".
/// For the form "B like A" the B term is considered the first argument
/// to the function. But for "like(A,B)" the A term is considered the
/// first argument.
/// </para>
................................................................................
/// <para>
/// This method provides notification that the virtual table implementation
/// that the virtual table will be given a new name.
/// If this method returns SQLITE_OK then SQLite renames the table.
/// If this method returns an error code then the renaming is prevented.
/// </para>
/// <para>
/// The xRename method is required for every virtual table implementation.
/// </para>
/// </summary>
/// <param name="pVtab">
/// The native pointer to the sqlite3_vtab derived structure.
/// </param>
/// <param name="zNew">
/// The native pointer to the UTF-8 encoded string containing the new

/// #define SQLITE_INDEX_CONSTRAINT_GLOB 66 /* 3.10.0 and later */
/// #define SQLITE_INDEX_CONSTRAINT_REGEXP 67 /* 3.10.0 and later */
/// #define SQLITE_INDEX_CONSTRAINT_NE 68 /* 3.21.0 and later */
/// #define SQLITE_INDEX_CONSTRAINT_ISNOT 69 /* 3.21.0 and later */
/// #define SQLITE_INDEX_CONSTRAINT_ISNOTNULL 70 /* 3.21.0 and later */
/// #define SQLITE_INDEX_CONSTRAINT_ISNULL 71 /* 3.21.0 and later */
/// #define SQLITE_INDEX_CONSTRAINT_IS 72 /* 3.21.0 and later */
/// #define SQLITE_INDEX_CONSTRAINT_FUNCTION 150 /* 3.25.0 and later */
/// #define SQLITE_INDEX_SCAN_UNIQUE 1 /* Scan visits at most 1 row */
/// </code></para>
/// <para>
/// The SQLite core calls the xBestIndex method when it is compiling a query
/// that involves a virtual table. In other words, SQLite calls this method
/// when it is running sqlite3_prepare() or the equivalent.
/// By calling this method, the
................................................................................
/// The main thing that the SQLite core is trying to communicate to
/// the virtual table is the constraints that are available to limit
/// the number of rows that need to be searched. The aConstraint[] array
/// contains one entry for each constraint. There will be exactly
/// nConstraint entries in that array.
/// </para>
/// <para>
/// Each constraint will usually correspond to a term in the WHERE clause
/// or in a USING or ON clause that is of the form
/// </para>
/// <para><code>
/// column OP EXPR
/// </code></para>
/// <para>
/// Where "column" is a column in the virtual table, OP is an operator
................................................................................
/// </para>
/// <para><code>
/// x &gt;= 10
/// x &lt;= 100
/// y &lt; 999
/// </code></para>
/// <para>
/// For such each constraint, the aConstraint[].iColumn field indicates which
/// column appears on the left-hand side of the constraint.
/// The first column of the virtual table is column 0.
/// The rowid of the virtual table is column -1.
/// The aConstraint[].op field indicates which operator is used.
/// The SQLITE_INDEX_CONSTRAINT_* constants map integer constants
/// into operator values.
/// Columns occur in the order they were defined by the call to
/// sqlite3_declare_vtab() in the xCreate or xConnect method.
/// Hidden columns are counted when determining the column index.
/// </para>
/// <para> /// If the xFindFunction() method for the virtual table is defined, and /// if xFindFunction() sometimes returns SQLITE_INDEX_CONSTRAINT_FUNCTION or /// larger, then the constraints might also be of the form: /// </para> /// <para><code> /// FUNCTION( column, EXPR) /// </code></para> /// <para> /// In this case the aConstraint[].op value is the same as the value /// returned by xFindFunction() for FUNCTION. /// </para>
/// <para>
/// The aConstraint[] array contains information about all constraints
/// that apply to the virtual table. But some of the constraints might
/// not be usable because of the way tables are ordered in a join.
/// The xBestIndex method must therefore only consider constraints
/// that have an aConstraint[].usable flag which is true.
/// </para>
................................................................................
/// When a function uses a column from a virtual table as its first
/// argument, this method is called to see if the virtual table would
/// like to overload the function. The first three parameters are inputs:
/// the virtual table, the number of arguments to the function, and the
/// name of the function. If no overloading is desired, this method
/// returns 0. To overload the function, this method writes the new
/// function implementation into *pxFunc and writes user data into *ppArg
/// and returns either 1 or a number between /// SQLITE_INDEX_CONSTRAINT_FUNCTION and 255.
/// </para>
/// <para> /// Historically, the return value from xFindFunction() was either zero /// or one. Zero means that the function is not overloaded and one means that /// it is overload. The ability to return values of /// SQLITE_INDEX_CONSTRAINT_FUNCTION or greater was added in /// version 3.25.0 (2018-09-15). If xFindFunction returns /// SQLITE_INDEX_CONSTRAINT_FUNCTION or greater, than means that the function /// takes two arguments and the function /// can be used as a boolean in the WHERE clause of a query and that /// the virtual table is able to exploit that function to speed up the query /// result. When xFindFunction returns SQLITE_INDEX_CONSTRAINT_FUNCTION or /// larger, the value returned becomes the sqlite3_index_info.aConstraint.op /// value for one of the constraints passed into xBestIndex() and the second /// argument becomes the value corresponding to that constraint that is passed /// to xFilter(). This enables the /// xBestIndex()/xFilter implementations to use the function to speed /// its search. /// </para> /// <para> /// The technique of having xFindFunction() return values of /// SQLITE_INDEX_CONSTRAINT_FUNCTION was initially used in the implementation /// of the Geopoly module. The xFindFunction() method of that module returns /// SQLITE_INDEX_CONSTRAINT_FUNCTION for the geopoly_overlap() SQL function /// and it returns /// SQLITE_INDEX_CONSTRAINT_FUNCTION+1 for the geopoly_within() SQL function. /// This permits search optimizations for queries such as: /// </para> /// <para><code> /// SELECT * FROM geopolytab WHERE geopoly_overlap(_shape, $query_polygon); /// </code></para>
/// <para>
/// Note that infix functions (LIKE, GLOB, REGEXP, and MATCH) reverse
/// the order of their arguments. So "like(A,B)" is equivalent to "B like A".
/// For the form "B like A" the B term is considered the first argument
/// to the function. But for "like(A,B)" the A term is considered the
/// first argument.
/// </para>
................................................................................
/// <para>
/// This method provides notification that the virtual table implementation
/// that the virtual table will be given a new name.
/// If this method returns SQLITE_OK then SQLite renames the table.
/// If this method returns an error code then the renaming is prevented.
/// </para>
/// <para>
/// The xRename method is optional. If omitted, then the virtual /// table may not be renamed using the ALTER TABLE RENAME command. /// </para> /// <para> /// The PRAGMA legacy_alter_table setting is enabled prior to invoking this /// method, and the value for legacy_alter_table is restored after this /// method finishes. This is necessary for the correct operation of virtual /// tables that make use of shadow tables where the shadow tables must be /// renamed to match the new virtual table name. If the legacy_alter_format is /// off, then the xConnect method will be invoked for the virtual table every /// time the xRename method tries to change the name of the shadow table.
/// </para>
/// </summary>
/// <param name="pVtab">
/// The native pointer to the sqlite3_vtab derived structure.
/// </param>
/// <param name="zNew">
/// The native pointer to the UTF-8 encoded string containing the new

This page was generated in about
0.036s by
Fossil version 2.7 [869841cb04] 2018-12-12 20:03:50