Lines Matching defs:statement
694 ** sqlite3_exec(), then execution of the current statement stops and
731 ** <li> The application must not modify the SQL statement text passed into
1319 ** ^Whenever a [PRAGMA] statement is parsed, an [SQLITE_FCNTL_PRAGMA]
1321 ** to the database file to which the pragma statement refers. ^The argument
1334 ** prepared statement if result string is NULL, or that returns a copy
1340 ** file control occurs at the beginning of pragma statement analysis and so
2111 ** mutexing on [database connection] and [prepared statement] objects.
2126 ** mutexes on [database connection] and [prepared statement] objects.
2131 ** same [prepared statement] in different threads at the same time.
2346 ** fourth parameter is 1, then the SQL statement that the third parameter
2396 ** becomes the [statement journal] spill-to-disk threshold.
2399 ** Or if the threshold is -1, statement journals are always held
2401 ** Since many statement journals never become large, setting the spill
2403 ** I/O required to support statement rollback.
2605 ** a single SQL query statement will always use the same algorithm regardless
2657 ** <li> The [PRAGMA writable_schema=ON] statement.
2658 ** <li> The [PRAGMA journal_mode=OFF] statement.
2659 ** <li> The [PRAGMA schema_version=N] statement.
2683 ** using the [PRAGMA legacy_alter_table] statement.
2721 ** can also be controlled using the [PRAGMA trusted_schema] statement.
2858 ** statement on the database connection specified by the only parameter.
2863 ** type of SQL statement does not modify the value returned by these functions.
2865 ** ^Only changes made directly by the INSERT, UPDATE or DELETE statement are
2872 ** DELETE statement run on a view is always zero. Only changes made to real
2886 ** statement sets the value returned by sqlite3_changes()
2893 ** by the first INSERT, UPDATE or DELETE statement within a trigger, it
2894 ** returns the value as set when the calling statement began executing.
2895 ** ^If it is used by the second or subsequent such statement within a trigger
2897 ** previous INSERT, UPDATE or DELETE statement within the same trigger.
2925 ** any other type of SQL statement does not affect the value returned by
2934 ** of rows that changed due to SQL statement run against database
2983 ** running statement count reaches zero are interrupted as if they had been
2985 ** that are started after the running statement count reaches zero are
2997 ** currently entered text seems to form a complete SQL statement or
3000 ** appears to be a complete SQL statement. ^A statement is judged to be
3002 ** well-formed CREATE TRIGGER statement. ^Semicolons that are embedded within
3005 ** embedded) and thus do not count as a statement terminator. ^Whitespace
3008 ** ^These routines return 0 if the statement is incomplete. ^If a
3086 ** or [prepared statement] that invoked the busy handler.
3387 ** specific action but allow the SQL statement to continue to be
3388 ** compiled, or [SQLITE_DENY] to cause the entire SQL statement to be
3411 ** [prepared statement] statement is constructed to substitute
3450 ** ^When [sqlite3_prepare_v2()] is used to prepare a statement, the
3451 ** statement might be re-prepared during [sqlite3_step()] due to a
3457 ** performed during statement evaluation in [sqlite3_step()], unless
3459 ** sqlite3_prepare_v2() to reprepare a statement after a schema change.
3479 #define SQLITE_DENY 1 /* Abort the SQL statement with an error */
3486 ** that is invoked to authorize certain SQL statement actions. The
3548 ** various times when an SQL statement is being run by [sqlite3_step()].
3550 ** SQL statement text as the statement first begins executing.
3559 ** as each SQL statement finishes. ^The profile callback contains
3560 ** the original statement text and an estimate of wall-clock time
3561 ** of how long that statement took to run. ^The profile callback
3594 ** <dd>^An SQLITE_TRACE_STMT callback is invoked when a prepared statement
3596 ** execution of the prepared statement, such as at the start of each
3598 ** [prepared statement]. ^The X argument is a pointer to a string which
3599 ** is the unexpanded SQL text of the prepared statement or an SQL comment
3608 ** ^The P argument is a pointer to the [prepared statement] and the
3610 ** the number of nanosecond that the prepared statement took to run.
3611 ** ^The SQLITE_TRACE_PROFILE callback is invoked when the statement finishes.
3615 ** statement generates a single row of result.
3616 ** ^The P argument is a pointer to the [prepared statement] and the
4233 ** KEYWORDS: {prepared statement} {prepared statements}
4235 ** An instance of this object represents a single SQL statement that
4238 ** Think of each SQL statement as a separate computer program. The
4239 ** original SQL text is source code. A prepared statement object
4241 ** prepared statement before it can be run.
4243 ** The life-cycle of a prepared statement object usually goes like this:
4246 ** <li> Create the prepared statement object using [sqlite3_prepare_v2()].
4250 ** <li> Reset the prepared statement using [sqlite3_reset()] then go back
4313 ** <dd>The maximum length of an SQL statement, in bytes.</dd>)^
4324 ** <dd>The maximum number of terms in a compound SELECT statement.</dd>)^
4328 ** used to implement an SQL statement. If [sqlite3_prepare_v2()] or
4330 ** in a single prepared statement, an SQLITE_NOMEM error is returned.</dd>)^
4345 ** <dd>The maximum index number of any [parameter] in an SQL statement.)^
4352 ** [prepared statement] may start.</dd>)^
4380 ** that the prepared statement will be retained for a long time and
4382 ** and [sqlite3_prepare16_v3()] assume that the prepared statement will
4391 ** to be required for any prepared statement that wanted to use the
4399 ** to return an error (error code SQLITE_ERROR) if the statement uses
4409 ** KEYWORDS: {SQL statement compiler}
4413 ** To execute an SQL statement, it must first be compiled into a byte-code
4415 ** are constructors for the [prepared statement] object.
4431 ** The second argument, "zSql", is the statement to be compiled, encoded
4440 ** statement is generated.
4447 ** past the end of the first SQL statement in zSql. These routines only
4448 ** compile the first statement in zSql, so *pzTail is left pointing to
4451 ** ^*ppStmt is left pointing to a compiled [prepared statement] that can be
4456 ** SQL statement using [sqlite3_finalize()] after it has finished with it.
4466 ** ^In the "vX" interfaces, the prepared statement
4475 ** statement and try to run it again. As many as [SQLITE_MAX_SCHEMA_RETRY]
4490 ** WHERE clause might influence the choice of query plan for a statement,
4491 ** then the statement will be automatically recompiled, as if there had been
4509 const char *zSql, /* SQL statement, UTF-8 encoded */
4516 const char *zSql, /* SQL statement, UTF-8 encoded */
4523 const char *zSql, /* SQL statement, UTF-8 encoded */
4531 const void *zSql, /* SQL statement, UTF-16 encoded */
4538 const void *zSql, /* SQL statement, UTF-16 encoded */
4545 const void *zSql, /* SQL statement, UTF-16 encoded */
4557 ** SQL text used to create [prepared statement] P if P was
4561 ** string containing the SQL text of prepared statement P with
4564 ** string containing the normalized SQL text of prepared statement P. The
4565 ** semantics used to normalize a SQL statement are unspecified and subject
4569 ** ^(For example, if a prepared statement is created using the SQL
4585 ** statement is finalized.
4604 ** and only if the [prepared statement] X makes no direct changes to
4610 ** calls [sqlite3_exec()], then the following SQL statement would
4617 ** But because the [SELECT] statement does not change the database file
4634 ** statement might change the database file. ^A false return does
4635 ** not guarantee that the statement will change the database file.
4636 ** ^For example, an UPDATE statement might have a WHERE clause that
4638 ** be false. ^Similarly, a CREATE TABLE IF NOT EXISTS statement is a
4640 ** sqlite3_stmt_readonly() still returns false for such a statement.
4642 ** ^If prepared statement X is an [EXPLAIN] or [EXPLAIN QUERY PLAN]
4643 ** statement, then sqlite3_stmt_readonly(X) returns the same value as
4653 ** prepared statement S is an EXPLAIN statement, or 2 if the
4654 ** statement S is an EXPLAIN QUERY PLAN.
4656 ** an ordinary statement or a NULL pointer.
4665 ** [prepared statement] S has been stepped at least once using
4670 ** NULL pointer and is not a pointer to a valid [prepared statement]
4745 ** ^(In the SQL statement text input to [sqlite3_prepare_v2()] and its variants,
4826 ** either the prepared statement is finalized or the same SQL parameter is
4850 ** [prepared statement] S to have an SQL value of NULL, but to also be
4859 ** for the [prepared statement] or with a prepared statement for which
4862 ** routine is passed a [prepared statement] that has been finalized, the
4900 ** in a [prepared statement]. SQL parameters are tokens of the
4921 ** the name of the N-th [SQL parameter] in the [prepared statement] P.
4952 ** name must be given in UTF-8 even if the original statement
4967 ** the [sqlite3_bind_blob | bindings] on a [prepared statement].
4977 ** [prepared statement]. ^If this routine returns 0, that means the
4978 ** [prepared statement] returns no data (for example an [UPDATE]).
4980 ** mean that one or more rows of data will be returned. ^A SELECT statement
4993 ** in the result set of a [SELECT] statement. ^The sqlite3_column_name()
4996 ** UTF-16 string. ^The first parameter is the [prepared statement]
4997 ** that implements the [SELECT] statement. ^The second parameter is the
5000 ** ^The returned string pointer is valid until either the [prepared statement]
5001 ** is destroyed by [sqlite3_finalize()] or until the statement is automatically
5024 ** [SELECT] statement.
5029 ** ^The returned string is valid until the [prepared statement] is destroyed
5030 ** using [sqlite3_finalize()] or until the statement is automatically
5038 ** ^The first argument to these interfaces is a [prepared statement].
5040 ** the statement, where N is the second function argument.
5043 ** ^If the Nth column returned by the statement is an expression or
5057 ** for the same [prepared statement] and result column
5071 ** ^(The first parameter is a [prepared statement].
5072 ** If this statement is a [SELECT] statement and the Nth column of the
5083 ** and the following statement to be compiled:
5104 ** After a [prepared statement] has been prepared using any of
5108 ** must be called one or more times to evaluate the statement.
5111 ** on whether the statement was prepared using the newer "vX" interfaces
5124 ** database locks it needs to do its job. ^If the statement is a [COMMIT]
5126 ** statement. If the statement is not a [COMMIT] and occurs within an
5130 ** ^[SQLITE_DONE] means that the statement has finished executing
5135 ** ^If the SQL statement being executed returns any data, then [SQLITE_ROW]
5146 ** [prepared statement]. ^In the "v2" interface,
5150 ** Perhaps it was called on a [prepared statement] that has
5159 ** sqlite3_step(). Failure to reset the prepared statement using
5192 ** current row of the result set of [prepared statement] P.
5193 ** ^If prepared statement P does not have results ready to return
5269 ** to the [prepared statement] that is being evaluated (the [sqlite3_stmt*]
5276 ** If the SQL statement does not currently point to a valid row, or if the
5468 ** ^The sqlite3_finalize() function is called to delete a [prepared statement].
5469 ** ^If the most recent evaluation of the statement encountered no errors
5470 ** or if the statement is never been evaluated, then sqlite3_finalize() returns
5471 ** SQLITE_OK. ^If the most recent evaluation of statement S failed, then
5476 ** the life cycle of [prepared statement] S:
5477 ** before statement S is ever evaluated, after
5479 ** to [sqlite3_step()] regardless of whether or not the statement has
5484 ** The application must finalize every [prepared statement] in order to avoid
5486 ** a prepared statement after it has been finalized. Any use of a prepared
5487 ** statement after it has been finalized can result in undefined and
5496 ** The sqlite3_reset() function is called to reset a [prepared statement]
5498 ** ^Any SQL statement variables that had values bound to them using
5502 ** ^The [sqlite3_reset(S)] interface resets the [prepared statement] S
5506 ** [prepared statement] S returned [SQLITE_ROW] or [SQLITE_DONE],
5511 ** [prepared statement] S indicated an error, then
5515 ** of any [sqlite3_bind_blob|bindings] on the [prepared statement] S.
5569 ** the same inputs within a single SQL statement. Most SQL functions are
5640 ** statement in which the function is running.
5888 ** than within an [xUpdate] method call for an UPDATE statement, then
6079 ** SQL statement)^, or
6657 ** ^Autocommit mode is disabled by a [BEGIN] statement.
6660 ** If certain kinds of errors occur on a statement within a multi-statement
6678 ** to which a [prepared statement] belongs. ^The [database connection]
6682 ** create the statement in the first place.
6802 ** CAPI3REF: Find the next prepared statement
6805 ** ^This interface returns a pointer to the next [prepared statement] after
6807 ** then this interface returns a pointer to the first prepared statement
6808 ** associated with the database connection pDb. ^If no prepared statement
6857 ** rolled back if an explicit "ROLLBACK" statement is executed, or
7465 ** zero in the order in which they appear within the CREATE TABLE statement
7512 ** part of the same statement to delete or update a virtual table row and the
7562 sqlite3_uint64 colUsed; /* Input: Mask of columns used by statement */
7808 ** the name that appears after the AS keyword in the [ATTACH] statement.
8009 ** have been overwritten by the statement that expired the BLOB handle
8461 ** parsing ambiguity. For example, the statement
8888 ** ^(Each prepared statement maintains various
8894 ** that the prepared statement is using a full table scan rather than
8898 ** a [prepared statement]. The first argument is the prepared statement
8935 ** need to be reinitialized each time the statement is run.</dd>
8939 ** by the prepared statement if that number is less than or equal
8941 ** used as a proxy for the total work done by the prepared statement.
8943 ** then the value returned by this statement status code is undefined.
8946 ** <dd>^This is the number of times that the prepare statement has been
8951 ** <dd>^This is the number of times that the prepared statement has
8969 ** used to store the prepared statement. ^This value is not actually
9260 ** an [ATTACH] statement for an attached database.
9522 ** one exception. When executing a "DROP TABLE" or "DROP INDEX" statement,
9638 ** SQLite code base to cause the statement that provoked the callback
9863 ** statement is rolled back as if [ON CONFLICT | OR ABORT] had been
9864 ** specified as part of the users SQL statement, regardless of the actual
9871 ** is able to roll back a statement or database transaction, and abandon
9872 ** or continue processing the current SQL statement as appropriate.
9918 ** of the SQL statement that triggered the call to the [xUpdate] method of the
9956 ** the column is not changed by the UPDATE statement, then the xColumn
9966 ** returns false for the enhanced [UPDATE FROM] statement.
9998 ** statement that was passed into [sqlite3_declare_vtab()], then the
10224 ** SQL statement. If the right-hand operand is an expression or a reference
10248 ** is for the SQL statement being evaluated.
10269 ** managed by the prepared statement S and will be automatically freed when
10335 ** the statement - a non-zero value is returned and the variable that pOut
10346 sqlite3_stmt *pStmt, /* Prepared statement for which info desired */
10371 ** active SQL statement is reading from it, or if it is page 1 of a database
10426 ** the name given after the AS keyword in the [ATTACH] statement for attached
11115 ** instead of directly as a result of a users SQL statement.
11149 ** defined as part of their CREATE TABLE statement. It does not matter if the
13017 ** tokenizer name as part of the CREATE VIRTUAL TABLE statement used
13322 ** * Terms in the SET clause of an UPDATE statement
13323 ** * Terms in the result set of a SELECT statement
13324 ** * Terms in the GROUP BY or ORDER BY clauses of a SELECT statement.
13325 ** * Terms in the VALUES clause of an INSERT statement
13338 ** The maximum length of a single SQL statement in bytes.
13359 ** The maximum number of terms in a compound SELECT statement.
13753 ** to setup for a later assert() statement. We do not want this code to
14653 ** 3. The PRAGMA table_list statement uses the PREFERRED name
14836 ** in the SQL statement (such as $abc, @pqr, or :xyz) and the integer
15979 ** number of columns of data returned by the statement.
16770 ** The "PRAGMA synchronous" statement also uses the zero-based numbers.
17024 int errByteOffset; /* Byte offset of error in SQL statement */
17051 unsigned orphanTrigger : 1; /* Last statement is orphaned TEMP trigger */
17126 int nStatement; /* Number of nested statement-transactions */
17295 #define SQLITE_STATE_ZOMBIE 0xa7 /* Close with last statement close */
17720 ** next time a statement is prepared using said sqlite3*. This is done
18077 ** While parsing a CREATE TABLE or CREATE INDEX statement in order to
18189 ** original Select structure that describes the SELECT statement. These
18282 ** gives a different answer at different times during statement processing
18353 int iOfst; /* else: start of token from start of statement */
18545 ** column names after a table name in an INSERT statement. In the statement
18596 Select *pSelect; /* A SELECT statement used in place of a table name */
18644 ** content for an SQL statement. For example, a single SrcList object
18645 ** is used to hold the FROM clause of a SELECT statement. SrcList also
18735 Select *pWinSelect; /* SELECT statement for any window functions */
18764 #define NC_IsDDL 0x010000 /* Resolving names in a CREATE statement */
18779 ** pUpsertSet is the list of column=expr terms of the UPDATE statement.
18798 ** statement and will be freed by INSERT processing. */
18808 ** needed to generate code for a single SELECT statement.
18836 Select *pPrior; /* Prior select in a compound select statement */
18877 #define SF_View 0x0200000 /* SELECT statement is a view */
18882 #define SF_CopyCte 0x4000000 /* SELECT statement is a copy of a CTE */
18984 ** a SELECT statement.
19015 ** statement. All such objects are stored in the linked list headed at
19016 ** Parse.pTriggerPrg and deleted once statement compilation has been
19102 ** used to store the set of table-locks required by the statement being
19115 u8 isMultiWrite; /* True if statement may modify/insert multiple rows */
19116 u8 mayAbort; /* True if statement may throw an ABORT exception */
19335 ** An instance of struct TriggerStep is used to store a single SQL statement
19344 ** "SELECT" statement. The meanings of the other members is determined by the
19349 ** pSelect -> The content to be inserted - either a SELECT statement or
19353 ** statement, then this stores the column-names to be
19359 ** pWhere -> The WHERE clause of the DELETE statement if one is specified.
19364 ** pWhere -> The WHERE clause of the UPDATE statement if one is specified.
19371 ** pSelect -> The SELECT statement
19382 Select *pSelect; /* SELECT statement or RHS of INSERT INTO SELECT ... */
19384 SrcList *pFrom; /* FROM clause for UPDATE statement (if any) */
22186 ** threshold (in bytes). 0 means that statement journals are created and
22188 ** before 3.12.0). -1 means always keep the entire statement journal in
22189 ** memory. (The statement journal is also always held entirely in memory
22430 ** The maximum number of times that a statement will try to reparse
22810 ** string for a prepared statement. A linked list of these objects
22811 ** is constructed during statement parsing and is held on Vdbe.pDblStr.
22812 ** When computing a normalized SQL statement for an SQL statement, that
22830 sqlite3 *db; /* The database connection that owns this statement */
22841 i64 iCurrentTime; /* Value of julianday('now') for this statement */
22875 bft usesStmtJournal:1; /* True if uses a statement journal */
22881 char *zSql; /* Text of the SQL statement that generated this */
22883 char *zNormSql; /* Normalization of the associated SQL statement */
22910 #define VDBE_INIT_STATE 0 /* Prepared statement under construction */
26153 ** This routine is designed for use within an assert() statement, to
26175 ** This routine is designed for use within an assert() statement, to
29832 ** SQL statement. Make a copy of this phrase in space obtained form
32336 ** into generating an DELETE statement.
32392 ** into generating an INSERT statement.
32462 ** into generating an UPDATE statement.
33781 ** compiling an SQL statement (i.e. within sqlite3_prepare()). The
33785 ** during statement execution (sqlite3_step() etc.).
52871 ** cache size requested by the "PRAGMA cache_size" statement.
55807 ** statement executed within a transaction. In this case, if the error
55810 ** read-only statement cannot leave the pager in an internally inconsistent
55915 ** savepoint and statement transaction in the system. All such structures
56767 ** is defined, and NDEBUG is not defined, an assert() statement checks
57745 ** The main rollback journal uses checksums - the statement journal does
57876 ** Ticket #1171: The statement journal might contain page content that is
57878 ** This occurs when a page is changed prior to the start of a statement
57879 ** then changed again within the statement. When rolling back such a
57880 ** statement we must not write to the original database unless we know
57891 ** is possible to fail a statement on a database that does not yet exist.
61184 ** test in the previous statement, and avoid testing pgno==0 in the
61622 /* If the statement journal is open and the page is not in it,
61623 ** then write the page into the statement journal.
62684 ** required that a statement transaction was not active, but this restriction
62685 ** has been removed (CREATE INDEX needs to move a page when a statement
62729 ** statement were is processed.
63060 ** a transaction to initialize pWal. The PRAGMA table_list statement is
68457 ** a statement since we will be comparing table and column names
68776 **** This function is only used as part of an assert() statement. ***
68937 ** statement is a simplification of:
73042 ** Start a statement subtransaction. The subtransaction can be rolled
73049 ** error occurs within the statement, the effect of that one statement
73052 ** A statement sub-transaction is implemented as an anonymous savepoint. The
73055 ** are no active savepoints and no other statement-transactions open,
73068 /* At the pager level, a statement transaction is a savepoint with
73071 ** such savepoints while the statement transaction savepoint is active.
73147 ** as part of a larger DELETE statement. The FORDELETE hint is not used by
77250 ** cause an assert() statement to fail. */
77887 ** happen while processing an "INSERT INTO ... SELECT" statement), it
80526 ** within a single call (unless an error occurs). The assert() statement
82602 ** Remember the SQL string for a prepared statement.
82638 Vdbe *pVdbe, /* The prepared statement */
82655 ** SQLITE_SCHEMA. The statement was then reprepared in pA.
83221 ** throw an ABORT exception (causing the statement, but not entire transaction
83238 ** part of an assert statement in the compiler. Similar to:
83272 ** where a "DELETE FROM tbl" has a statement-journal but does not
83334 ** indicate what the prepared statement actually does.
83596 Vdbe *p, /* Add opcodes to the prepared statement */
84430 ** statement p will ever use. Let N be the number of bits in p->btreeMask
84569 ** with no indexes using a single prepared INSERT statement, bind()
84629 Vdbe *p, /* The statement being explained */
84914 ** by subcomponents of a prepared statement. Space is allocated out
84935 ** statement.
85050 ** of the prepared statement.
85093 ** reduce the amount of memory held by a prepared statement.
85238 ** statement. This is now set at compile time, rather than during
85240 ** be called on an SQL statement before sqlite3_step().
85258 ** Set the name of the idx'th column to be returned by the SQL statement.
85582 ** If the Vdbe passed as the first argument opened a statement-transaction,
85584 ** SAVEPOINT_RELEASE. If it is SAVEPOINT_ROLLBACK, then the statement
85586 ** statement transaction is committed.
85628 /* If the statement transaction is being rolled back, also restore the
85630 ** the statement transaction was opened. */
85688 /* This function contains the logic that determines if a statement or
85700 ** state. We need to rollback the statement transaction, if there is
85701 ** one, or the complete transaction if there is no statement transaction.
85712 ** SQL statement does not read or write a database file. */
85718 /* Lock all btrees used by the statement */
85737 ** Even if the statement is read-only, it is important to perform
85738 ** a statement or transaction rollback operation. If the error
85823 /* If eStatementOp is non-zero, then a statement transaction needs to
85825 ** do so. If this operation returns an error, and the current statement
85827 ** current statement error code.
85844 /* If this was an INSERT, UPDATE or DELETE and no statement transaction
87347 ** statement (since the range of switch targets now starts at zero and
87638 ** Mark every prepared statement associated with a database connection
87641 ** An expired statement means that recompilation of the statement is
87647 ** If iCode is 1, then expiration is advisory. The statement should
87703 ** to sqlite3_reoptimize() that re-preparing the statement may result
87883 ** Return TRUE (non-zero) of the statement supplied as an argument needs
87884 ** to be recompiled. A statement needs to be recompiled whenever the
87903 sqlite3_log(SQLITE_MISUSE, "API called with finalized prepared statement");
87911 sqlite3_log(SQLITE_MISUSE, "API called with NULL prepared statement");
87983 ** Terminate the current execution of an SQL statement and reset it
88009 ** Set all the parameters in the compiled SQL statement to NULL.
88500 ** Execute the statement pStmt, either until a row of data is ready, the
88501 ** statement is completely executed or an error occurs.
88521 /* If this statement was prepared using saved SQL and an
88533 ** from interrupting a statement that has not yet started.
88611 /* If the statement completed successfully, invoke the profile callback */
88622 /* If this statement was prepared using saved SQL and an
88661 Vdbe *v = (Vdbe*)pStmt; /* the prepared statement */
88682 /* This case occurs after failing to recompile an sql statement.
88685 ** from the database handle into the statement and sets the statement
88686 ** program counter to 0 to ensure that when the statement is
88847 ** Return the current time for a statement. If the current time
88849 ** statement, the exact same time is returned for each invocation regardless
88914 ** single prepared statement. The iArg values must match.
88941 ** to all functions within the current prepared statement using iArg as an
89004 ** Return the number of columns in the result set for the statement pStmt.
89013 ** currently executing statement pStmt.
89059 ** Check to see if column iCol of the given statement is valid. If
89084 ** select list of a SELECT statement) that may cause a malloc() failure. If
89086 ** code of statement pStmt set to SQLITE_NOMEM.
89102 ** sqlite3_column_XXX API, then set the return code of the statement to
89198 sqlite3_stmt *pStmt, /* The statement */
89244 ** statement pStmt.
89267 ** of the result set of SQL statement pStmt.
89326 ** Routines used to attach values to wildcards in a compiled SQL statement.
89349 "bind on a busy prepared statement: [%s]", p->zSql);
89367 ** for a statement, then the statement will be automatically recompiled,
89382 sqlite3_stmt *pStmt, /* The statement to bind against */
89415 ** Bind a blob value to an SQL statement variable.
89619 ** Transfer all bindings from the first statement over to the second.
89667 ** Return the sqlite3* database handle to which the prepared statement given
89670 ** the statement in the first place.
89677 ** Return true if the prepared statement is guaranteed to not modify the
89685 ** Return 1 if the statement is an EXPLAIN and return 2 if the
89686 ** statement is an EXPLAIN QUERY PLAN
89693 ** Return true if the prepared statement is in need of being reset.
89701 ** Return a pointer to the next prepared statement after pStmt associated
89703 ** prepared statement for the database connection. Return NULL if there
89725 ** Return the value of a status counter for a prepared statement
89757 ** Return the SQL associated with a prepared statement
89765 ** Return the SQL associated with a prepared statement with
89791 ** Return the normalized SQL associated with a prepared statement.
89904 ** immediately by a user SQL statement. Or, if the change was made by a
90010 sqlite3_stmt *pStmt, /* Prepared statement being queried */
90143 ** statement for the corresponding OP_Variable opcode. Once the host
90148 Vdbe *p, /* The prepared statement being evaluated */
90149 const char *zRawSql /* Raw text of the SQL statement */
90283 ** bytecode of a prepared statement.
91202 ** What follows is a massive switch statement where each case implements a
91206 ** the switch statement will break with convention and be flush-left. Another
91216 ** case statement is followed by a comment of the form "/# same as ... #/"
91899 ** FK constraint violations are also checked when the prepared statement
91973 ** prepared statement restarts. This is because sqlite3_column()
93747 ** computing an unchanging column value in an UPDATE statement.
94240 ** throw an ABORT exception), a statement transaction may also be opened.
94241 ** More specifically, a statement transaction is opened iff the database
94243 ** active statements. A statement transaction allows the changes made by this
94245 ** entire transaction. If no error is encountered, the statement transaction
94257 ** statement and rerun it from the beginning.
94272 /* Writes prohibited by the "PRAGMA query_only=TRUE" statement */
94314 ** counter. If the statement transaction needs to be rolled back,
94326 ** IMPLEMENTATION-OF: R-03189-51135 As each SQL statement runs, the schema
94328 ** SQL statement was prepared.
94352 ** from being modified in sqlite3VdbeHalt(). If this statement is
94402 ** schema version is set to P3-P5. The "PRAGMA schema_version=N" statement
94586 ** If there were a failure, the prepared statement would have halted
95660 ** parts of the prepared statement. */
96549 ** number P5-1 in the prepared statement is incremented.
96574 ** number P5-1 in the prepared statement is incremented.
96730 ** an UPDATE or DELETE statement and the index entry to be updated
97143 ** Run the SQL statement or statements specified in the P4 string.
97169 /* Any prepared statement that invokes this opcode will hold mutexes
97216 ** at least one SQL statement. Any less than that indicates that
97629 ** statement counter is incremented (immediate foreign key constraints).
97651 ** zero, the jump is taken if the statement constraint-counter is zero
98191 ** Cause precompiled statements to expire. When an expired statement
98197 ** then only the currently executing statement is expired.
98202 ** that might help the statement run faster but which does not affect the
98924 ** Write P4 on the statement trace output if statement tracing is
99050 ** an active statement journal.
99125 ** The cases of the switch statement above this line should all be indented
99197 sqlite3_log(rc, "statement aborts at %d: [%s] %s",
99316 /* Set the value of register r[1] in the SQL statement to integer iRow.
99322 /* If the statement has been run before (and is paused at the OP_ResultRow)
99656 /* If there is no statement handle, then the blob-handle has
99662 ** returned, clean-up the statement handle.
99752 /* If there is no statement handle, then the blob-handle has
99825 ** CREATE UNIQUE INDEX statement.
100693 ** statement. In this case, keys are always delivered to the sorter in
101331 ** This is used by an assert() statement at the end of this function. */
102559 ** of a prepared statement.
102579 sqlite3_stmt *pStmt; /* The statement whose bytecode is displayed */
102885 "argument to %s() is not a valid SQL statement",
102991 ** For example, statement journals that are not too big will be held
103428 ** an SQL statement.
103541 ** Walk all expressions associated with SELECT statement p. Do
103574 ** FROM clause of SELECT statement p. Do not invoke the select
103601 ** Call sqlite3WalkExpr() for every expression in Select statement p.
103695 ** Magic table number to mean the EXCLUDED table in an UPSERT statement.
103820 /* Currently parsing a DDL statement */
103826 /* Currently parsing a DML statement */
104554 ** UPDATE ... FROM statement processing.
104979 ** a SELECT statement. pE is a term in an ORDER BY or GROUP BY clause.
105023 ** SELECT statement. Return the index i of the matching column,
105026 ** same integer value that would be used in the SQL statement to indicate
105033 Select *pSelect, /* The SELECT statement with the ORDER BY clause */
105092 ** Analyze the ORDER BY clause in a compound SELECT statement. Modify
105108 Select *pSelect /* The SELECT statement containing the ORDER BY */
105153 ** it against each expression returned by the SELECT statement.
105211 ** the SELECT statement pSelect. If any term is reference to a
105221 Select *pSelect, /* The SELECT statement containing the clause */
105280 ** pOrderBy is an ORDER BY or GROUP BY clause in SELECT statement pSelect.
105281 ** The Name context of the SELECT statement is pNC. zType is either
105298 NameContext *pNC, /* The name context of the SELECT statement */
105299 Select *pSelect, /* The SELECT statement holding pOrderBy */
105358 ** Resolve names in the SELECT statement p and all of its descendants.
105479 ** other expressions in the SELECT statement. This is so that
105745 Select *p, /* The SELECT statement being coded. */
105746 NameContext *pOuterNC /* Name context for parent SELECT statement */
106610 ** by the select statement passed as an argument.
106795 ** converts the contents of pEList to a VALUES(...) Select statement
106946 ** in the original SQL statement.
106953 ** the SQL statement comes from an external source.
107364 ** an a newly duplicated SELECT statement and gather all of the Window
107665 ** clause of an UPDATE statement. Like this:
107717 /* Store the SELECT statement in pRight so it will be deleted when
107791 ** statement handled by the parser. And so no token need be added
107983 ** expressions in a CREATE TABLE statement. The Walker.eCode value is 5
107985 ** when processing a new CREATE TABLE statement. A bound parameter raises
108048 ** statements into a NULL when parsing the CREATE statement text out
108052 /* A bound parameter in a CREATE statement that originates from
108100 ** the prepared statement starts up. See sqlite3ExprCodeRunJustOnce().
108213 ** in a CREATE TABLE statement. Return non-zero if the expression is
108219 ** processing a new CREATE TABLE statement. When isInit is true, parameters
108222 ** allowed in a CREATE TABLE statement, but some legacy versions of SQLite
108388 ** pX is the RHS of an IN operator. If pX is a SELECT statement
108390 ** a pointer to the SELECT statement. If pX is not a SELECT statement,
108391 ** or if the SELECT statement needs to be manifested into a transient
108542 ** one element for each column returned by the SELECT statement on the RHS
108857 ** the SELECT statement returns a column value, then the affinity of that
108859 ** SELECT... statement are columns, then numeric affinity is used
108861 ** 'x' nor the SELECT... statement are columns, then numeric affinity
108874 Vdbe *v; /* The prepared statement under construction */
109067 Select *pSel; /* SELECT statement to encode */
110691 ** per prepared statement execution.
110696 ** the end of the prepared statement in the initialization section.
110704 ** prepared statement.
112376 ** statement to ensure that the operation has not rendered any schema
112632 ** This function is called after an "ALTER TABLE ... ADD" statement
112649 Vdbe *v; /* The prepared statement under construction */
112732 /* Modify the CREATE TABLE statement. */
112791 ** an "ALTER TABLE <table-name> ADD" statement is parsed. Argument
112802 ** coding the "ALTER TABLE ... ADD" statement.
112968 /* Do the rename operation using a recursive UPDATE statement that
112970 ** CREATE statement text for the sqlite_schema table.
113146 ** to select statement pSelect.
113330 ** ALTER TABLE statement. If it is, then attach its associated
113353 ** is being renamed by an ALTER TABLE statement. Return the "last"
113358 ** in the SQL statement.
113450 ** Parse the SQL statement zSql using Parse object (*p). The Parse object
113498 ** This function edits SQL statement zSql, replacing each token identified
113509 const char *zSql, /* SQL statement to edit */
113526 ** ALTER TABLE statement was quoted (bQuote==1), then set zNew to
113768 ** 0. zSql: SQL statement to rewrite
113778 ** Do a column rename operation on the CREATE statement given in zSql.
114002 ** 3: The complete text of the schema statement being modified,
114005 ** 6: True if the schema statement comes from the temp db.
114007 ** It returns the new schema statement. For example:
114173 ** Rewrite the DDL statement "SQL" so that any string literals that use
114179 ** 1: SQL statement to edit.
114181 ** The returned value is the modified SQL statement. For example, given
114290 ** resolution problems in a CREATE TRIGGER|TABLE|VIEW|INDEX statement.
114292 ** reloaded, this function is called on each SQL statement in the schema
114296 ** 1: SQL statement.
114380 ** argv[1]: CREATE TABLE statement to modify.
114383 ** The value returned is a string containing the CREATE TABLE statement
114448 ** statement. Argument pSrc contains the possibly qualified name of the
114818 ** side-effect of the CREATE TABLE statement is to leave the rootpage
115552 Vdbe *v, /* Prepared statement under construction */
116316 const char *zSql1, /* SQL statement 1 (see above) */
116317 const char *zSql2, /* SQL statement 2 (see above) */
116321 sqlite3_stmt *pStmt = 0; /* An SQL statement being run */
116322 char *zSql; /* Text of the SQL statement */
116564 ** Resolve an expression that was part of an ATTACH or DETACH statement. This
116575 ** This only applies to the root node of pExpr, so the statement:
116606 ** An SQL user-function registered to do the work of an ATTACH statement. The
116607 ** three arguments to the function come directly from an attach statement:
116841 ** An SQL user-function registered to do the work of an DETACH statement. The
116842 ** three arguments to the function come directly from a detach statement:
116964 /* Code an OP_Expire. For an ATTACH statement, set P1 to true (expire this
116965 ** statement only). For DETACH, set it to false (expire all existing
116978 ** Called by the parser to compile a DETACH statement.
116998 ** Called by the parser to compile an ATTACH statement.
117112 ** was left unspecified in the original SQL statement. The pFix structure
117139 Select *pSelect /* The SELECT statement to be fixed to one database */
117248 ** means that the SQL statement will never-run - the sqlite3_exec() call
117249 ** will return with an error. SQLITE_IGNORE means that the SQL statement
117556 ** statement (configured by calls to sqlite3TableLock()).
117588 ** This routine is called after a single SQL statement has been
117589 ** parsed and a VDBE program to execute that statement has been
117748 ** code for the SQL statement given onto the end of the pParse context
118561 ** for the column iCol in the table (as defined by the CREATE TABLE statement)
118578 ** is the index (0,1,2,...) of the column in the CREATE TABLE statement.
118605 ** the CREATE TABLE statement.
118653 ** prepared statement to return false for sqlite3_stmt_readonly(). This
118655 ** exists, so that the prepared statement for CREATE TABLE IF NOT EXISTS
118656 ** will return false for sqlite3_stmt_readonly() even if that statement
118671 ** to a CREATE TABLE statement. In particular, this routine is called
118679 ** As more of the CREATE TABLE statement is parsed, additional action
118681 ** At the end of the CREATE TABLE statement, the sqlite3EndTable() routine
118750 ** it does. The exception is if the statement being parsed was passed
118907 ** of the DML statement. That TEMP trigger contains a single SELECT
118908 ** statement with a result set that is the argument of the RETURNING clause.
118963 ** in a CREATE TABLE statement. sqlite3StartTable() gets called
119076 ** parsing a CREATE TABLE statement. A "NOT NULL" constraint has
119202 ** parsing a CREATE TABLE statement.
119577 ** Generate a CREATE TABLE statement appropriate for the given
119578 ** table. Memory to hold the text of the statement is obtained
119785 ** This routine runs at the end of parsing a CREATE TABLE statement that
120070 ** a CREATE TABLE statement.
120085 ** "CREATE TABLE ... AS SELECT ..." statement. The column names of
120251 char *zStmt; /* Text of the CREATE TABLE or CREATE VIEW statement */
120274 ** statement to populate the new table. The root-page number for the
120335 /* Compute the complete text of the CREATE statement */
120432 Token *pBegin, /* The CREATE token that begins the statement */
120436 Select *pSelect, /* A SELECT statement that will become the new view */
120471 /* Make a copy of the entire SELECT statement that defines the view.
120487 /* Locate the end of the CREATE VIEW statement. Make sEnd point to
120578 ** statement that defines the view.
120621 ** the column names from the SELECT statement that defines the view.
120928 ** This routine is called to do the work of a DROP TABLE statement.
121276 ** overhead of adding a statement journal to a CREATE INDEX statement is
121278 ** needs to be restored if the statement aborts), so we call
121367 ** currently being constructed by a CREATE TABLE statement.
121380 Token *pStart, /* The CREATE token that begins this statement */
121543 ** The following statement converts "sqlite3_autoindex..." into
121545 ** The "vtab_err.test" test demonstrates the need of this statement. */
121792 ** constraint specified somewhere in the CREATE TABLE statement.
121845 /* If this is the initial CREATE INDEX statement (or CREATE TABLE if the
121854 ** or UNIQUE index in a CREATE TABLE statement. Since the table
121877 /* Gather the complete text of the CREATE INDEX statement into
121884 /* A named index with an explicit CREATE INDEX statement */
122028 ** implements the DROP INDEX statement.
122196 ** SELECT statement, and the query planner cannot deal with more
122408 ** SELECT statement that the subquery encodes. The pTable and
122582 ** Generate VDBE code for a BEGIN statement.
122616 ** Generate VDBE code for a COMMIT or ROLLBACK statement.
122750 ** Indicate that the statement currently under construction might write
122763 ** possible to abort a statement prior to completion. In order to
122765 ** sure that the statement is protected by a statement transaction.
122784 ** error. The onError parameter determines which (if any) of the statement
123716 ** (as in the FROM clause of a SELECT statement) in this case it contains
123718 ** or UPDATE statement. Look up that table in the symbol table and
123745 ** by a DELETE, INSERT, or UPDATE statement.
123771 ** is for a top-level SQL statement.
123907 ** term for the DELETE or UPDATE statement. For example:
123968 ** Generate code for a DELETE FROM statement.
124274 ** only effect this statement has is to fire the INSTEAD OF
124521 ** a view (in which case the only effect of the DELETE statement is to
124595 Vdbe *v; /* The prepared statement under construction */
125836 ** value of its argument suitable for inclusion into an SQL statement.
126429 ** Therefore the next statement sets variable 'max' to 1 for the max()
126715 /* The memcpy() statement assumes that the wildcard characters are
127150 ** statement transaction rolled back. If a
127157 ** database transaction is opened. Each time a statement is executed
127159 ** time a statement is executed that removes an existing violation from
127212 ** is that the counter used is stored as part of each individual statement
127213 ** object (struct Vdbe). If, after the statement has run, its immediate
127216 ** and the statement transaction is rolled back. An exception is an INSERT
127217 ** statement that inserts a single row only (no triggers). In this case,
127220 ** an INSERT does not open a statement transaction.
127256 ** For the following INSERT statement:
127568 /* Special case: If this is an INSERT statement that will insert exactly
127571 ** generated for will not open a statement transaction. */
127872 ** when this statement is run. */
127888 ** any modifications to the schema are made. This is because statement
127892 ** the statement transaction will not be rolled back even if FK
127912 ** for which pTab is the child table. An UPDATE statement against pTab
127916 ** is set to -1). If the rowid column is modified by the UPDATE statement
127939 ** for which pTab is the parent table. An UPDATE statement against pTab
127943 ** is set to -1). If the rowid column is modified by the UPDATE statement
128186 ** may-abort flag will eventually be set on this statement anyway
128248 ** UPDATE statement modifies the rowid fields of the table.
128824 ** a statement of the form "INSERT INTO <iDb, pTab> SELECT ..." can
129125 ** Every statement that might do an INSERT into an autoincrement
129183 Select *pSelect, /* A SELECT statement to use as the data source */
129202 ** for a SELECT statement that omits the FROM clause and everything else
129204 ** DEFAULT VALUES form of the INSERT statement is intended.
129216 ** The three remaining templates assume the statement is of the form
129259 ** The 4th template is used if the insert statement takes its
129288 Select *pSelect, /* A SELECT statement to use as the data source */
129411 /* If the statement is of the form
129447 /* If the INSERT statement included an IDLIST term, then make sure
129507 ** is coming from a SELECT statement, then generate a co-routine that
129534 /* Set useTempTable to TRUE if the result of the SELECT statement
129540 ** of the tables being read by the SELECT statement. Also use a
129987 ** is a SELECT statement.
130060 ** columns that are being modifed by an UPDATE statement.
130084 ** the new row in the UPDATE statement.
130200 ** was explicitly specified as part of the INSERT statement. If pkChng
130203 ** pkChng will only be true if the INSERT statement provides an integer
130700 ** statement rollback (if the statement is aborted after the delete
130706 ** to run without a statement journal if there are no indexes on the
131385 Select *pSelect, /* A SELECT statement to use as the data source */
131458 /* At this point we have established that the statement is of the
131498 ** generated columns, then this statement is semantically incorrect:
131503 ** the SELECT statement on the right but the INSERT statement on the
131802 sqlite3_stmt *pStmt = 0; /* The current SQL statement */
134436 Vdbe *v, /* Prepared statement under construction */
134543 Vdbe *v, /* The prepared statement being created */
134605 ** Process a pragma statement.
134635 Vdbe *v = sqlite3GetVdbe(pParse); /* Prepared statement */
134648 /* Interpret the [schema.] part of the pragma statement. iDb is the
134677 ** handled the pragma and generate a no-op prepared statement.
134679 ** IMPLEMENTATION-OF: R-12238-55120 Whenever a PRAGMA statement is parsed,
134682 ** statement refers.
134901 /* Simple "PRAGMA locking_mode;" statement. This is a query for
136588 char *zSubSql; /* SQL statement for the OP_SqlExec opcode */
136845 sqlite3_stmt *pPragma; /* The pragma statement to run */
137215 const char *zSql, /* UTF-8 encoded SQL statement. */
137219 sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */
137235 ** argv[4] = SQL text for the CREATE statement.
137265 ** No other valid SQL statement, other than the variable CREATE statements,
137267 ** any other kind of statement while parsing the schema, even a corrupt
137539 ** but the following one will attempt to compile the supplied statement
137810 ** Maximum number of times that we will try again to prepare a statement
137818 ** Compile the UTF-8 encoded SQL statement zSql into a statement handle.
137822 const char *zSql, /* UTF-8 encoded SQL statement. */
137826 sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */
137844 /* For a long-term use prepared statement avoid the use of
137859 ** Were we to proceed and prepare the statement against the uncommitted
137862 ** prepared statement goes to run the schema cookie would fail to detect
137902 sqlite3ErrorWithMsg(db, SQLITE_TOOBIG, "statement too long");
137953 /* Delete any TriggerPrg structures allocated while parsing this statement. */
137967 const char *zSql, /* UTF-8 encoded SQL statement. */
137971 sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */
138005 ** Rerun the compilation of a statement after a schema change.
138007 ** If the statement is successfully recompiled, return SQLITE_OK. Otherwise,
138008 ** if the statement cannot be recompiled because another connection has
138045 ** version, the original SQL text is not saved in the prepared statement
138048 ** and the statement is automatically recompiled if an schema change
138053 const char *zSql, /* UTF-8 encoded SQL statement. */
138055 sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */
138065 const char *zSql, /* UTF-8 encoded SQL statement. */
138067 sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */
138083 const char *zSql, /* UTF-8 encoded SQL statement. */
138086 sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */
138107 ** Compile the UTF-16 encoded SQL statement zSql into a statement handle.
138111 const void *zSql, /* UTF-16 encoded SQL statement. */
138114 sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */
138161 ** version, the original SQL text is not saved in the prepared statement
138164 ** and the statement is automatically recompiled if an schema change
138169 const void *zSql, /* UTF-16 encoded SQL statement. */
138171 sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */
138181 const void *zSql, /* UTF-16 encoded SQL statement. */
138183 sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */
138193 const void *zSql, /* UTF-16 encoded SQL statement. */
138196 sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */
138395 ** Return a pointer to the right-most SELECT statement in a compound.
138676 ** This routine processes the join information for a SELECT statement.
138900 Select *pSelect, /* The whole SELECT statement */
139207 ** statement with an ORDER BY that is not optimized by an index. It
139301 Select *p, /* The complete select statement being coded */
139467 /* If the DISTINCT keyword was present on the SELECT statement
139865 Select *p, /* The SELECT statement */
139870 Vdbe *v = pParse->pVdbe; /* The prepared statement */
140082 ** original CREATE TABLE statement if the expression is a column. The
140168 ** of the SELECT statement. Return the declaration type and origin
140222 ** statement.
140292 ** Compute the column names for a SELECT statement.
140309 ** originally appears in the SELECT statement. In
140323 Select *pSelect /* Generate column names for this SELECT statement */
140394 ** that form the result set of a SELECT statement) compute appropriate
140521 ** a SELECT statement.
140528 ** statement be resolved.
140582 ** Given a SELECT statement, generate a Table structure that describes
140634 ** that appear in the original SQL statement after the LIMIT and OFFSET
140705 ** the result set for the compound-select statement "p". Return NULL if
140729 ** The select statement passed as the second parameter is a compound SELECT
140810 Vdbe *v = pParse->pVdbe; /* The prepared statement under construction */
141012 ** Return true if the SELECT statement which is known to be the recursive
141033 ** Example 1: Consider a three-way compound SQL statement.
141037 ** This statement is parsed up as follows:
141095 /* Make sure all SELECTs in the statement have the same number of elements
141207 /* Code the current SELECT statement
141347 ** This section is run by the right-most SELECT statement only.
141440 Select *p, /* The SELECT statement */
141822 /* Generate a coroutine to evaluate the SELECT statement to the
141834 /* Generate a coroutine to evaluate the SELECT statement on
142137 Select *p, /* SELECT statement in which to make substitutions */
142164 ** pSelect is a SELECT statement and pSrcItem is one item in the FROM
142167 ** This routine scans the entire SELECT statement and recomputes the
142180 Select *pSelect, /* The complete SELECT statement */
142259 ** of the SELECT statement passed as the second argument, and to each
142269 ** select statement passed as an argument, and
142272 ** FROM clauses of the select statement as described above are
142417 ** SELECT statement, but all the code here does is make sure that no
142478 Select *p, /* The parent or outer SELECT statement */
142668 /* If the sub-query is a compound SELECT statement, then (by restrictions
142837 ** expression returned by SELECT statement pSub. Since these values
142838 ** do not necessarily correspond to columns in SELECT statement pParent,
143060 ** clause of a SELECT statement. This function examines pExpr to see if
143443 ** The select statement passed as the first argument is an aggregate query.
143557 ** to a result column of the SELECT statement. This occurs when the
143654 ** statement with which it is associated.
143731 Select *pLeft; /* Left-most SELECT statement */
143892 ** sub-query in the FROM clause of a SELECT statement. This function
143950 ** This routine is a Walker callback for "expanding" a SELECT statement.
143958 ** fill pTabList->a[].pSelect with a copy of the SELECT statement
143960 ** statement so that we can freely modify or delete that statement
144010 ** the FROM clause of the SELECT statement.
144340 ** This routine "expands" a SELECT statement and all of its subqueries.
144342 ** statement, see the comment on the selectExpand worker callback above.
144344 ** Expanding a SELECT statement is the first step in processing a
144345 ** SELECT statement. The SELECT statement must be expanded before
144413 ** SELECT statement.
144430 ** This routine sets up a SELECT statement for processing. The
144443 Select *p, /* The SELECT statement being coded. */
144883 ** Generate code for the SELECT statement given in the p argument.
144897 Select *p, /* The SELECT statement being coded. */
144976 ** as part of populating the temp table for an UPDATE...FROM statement.
145626 ** SELECT statement.
145965 ** the SQL statement is of the form:
145971 ** This statement is so common that it is optimized specially. The
146458 ** This is called by the parser when it sees a CREATE TRIGGER statement
146466 Parse *pParse, /* The parse context of the CREATE TRIGGER statement */
146716 /* If this is a new CREATE TABLE statement, and if shadow tables
146774 ** Duplicate a range of text from an SQL statement, then convert all
146785 ** Turn a SELECT statement (that the pSelect parameter points to) into
146788 ** The parser calls this routine when it finds a SELECT statement in
146793 Select *pSelect, /* The SELECT statement */
146842 ** Build a trigger step out of an INSERT statement. Return a pointer
146852 Select *pSelect, /* A SELECT statement that supplies values */
146889 ** Construct a trigger step that implements an UPDATE statement and return
146891 ** sees an UPDATE statement inside the body of a CREATE TRIGGER.
146929 ** Construct a trigger step that implements a DELETE statement and return
146931 ** sees a DELETE statement inside the body of a CREATE TRIGGER.
147092 ** pEList is the SET clause of an UPDATE statement. Each entry
147128 ExprList *pChanges, /* Columns that change in an UPDATE statement */
147191 ExprList *pChanges, /* Columns that change in an UPDATE statement */
147406 ** of the trigger program. If the statement that caused this trigger
147409 ** step statement. Example:
147761 ** 1. The trigger is an exact match to the current DML statement
147863 ExprList *pChanges, /* The columns to change in the UPDATE statement */
147866 Expr *pWhere, /* WHERE clause of the UPDATE statement */
148116 ** Process an UPDATE statement.
148233 ** an UPSERT statement. */
148300 ** of the UPDATE statement. Also find the column index
148762 ** this UPDATE statement and (b) not accessed by new.* references. The
148835 ** all columns not modified by the update statement into their registers
149028 ExprList *pChanges, /* The columns to change in the UPDATE statement */
149031 Expr *pWhere, /* WHERE clause of the UPDATE statement */
149493 /* pUpsert does not own pTop->pUpsertSrc - the outer INSERT statement does.
150319 ** statement. The module name has been parsed, but the optional list
150381 ** The parser calls this routine after the CREATE VIRTUAL TABLE statement
150394 /* If the CREATE VIRTUAL TABLE statement is being entered for the
150397 ** do additional initialization work and store the statement text
150409 /* Compute the complete text of the CREATE VIRTUAL TABLE statement */
150465 ** of an argument to the module name in a CREATE VIRTUAL TABLE statement.
150475 ** in an argument to the module name in a CREATE VIRTUAL TABLE statement.
151159 ** statement in order to come into existance. Eponymous virtual table
151776 Select *pSelect; /* The entire SELECT statement containing WHERE */
151853 Vdbe *v, /* Prepared statement under construction */
152446 /* If the SELECT statement has an ORDER BY clause, zero the
152449 ** result-set. Since the result-set of the SELECT statement may
152815 Vdbe *v, /* prepared statement under construction */
153061 ** the statement currently being coded is a SELECT, then additional information
153244 Vdbe *v, /* Prepared statement under construction */
154991 ** reprepare the statement when that parameter is rebound */
155629 ** Recursively walk the expressions of a SELECT statement and generate
156285 ** SELECT statement passed as the second argument. These terms are only
156288 ** 1. The SELECT statement has a LIMIT clause, and
156289 ** 2. The SELECT statement is not an aggregate or DISTINCT query, and
156290 ** 3. The SELECT statement has exactly one object in its from clause, and
156702 ** Return ONEPASS_OFF (0) if an UPDATE or DELETE statement is unable to
156704 ** ONEPASS_SINGLE (1) if the statement can operation directly because only
157381 Vdbe *v; /* Prepared statement under construction */
160496 ** Cause the prepared statement that is associated with a call to
160497 ** xBestIndex to potentiall use all schemas. If the statement being
162159 ** if the WHERE_GROUPBY flag is set in wctrlFlags) of a SELECT statement
162161 ** is called from an UPDATE or DELETE statement, then pOrderBy is NULL.
162177 Select *pSelect, /* The entire SELECT statement */
162497 /* If the caller is an UPDATE or DELETE statement that is requesting
162511 ** The last qualification is because an UPDATE statement uses
163146 ** Any SELECT statement that contains one or more window functions in
163154 ** the statement:
163165 ** SELECT statement. This allows the implementation of the window function
163206 ** When processing the rewritten SELECT statement, code in select.c calls
163253 ** window frame is sometimes modified before the SELECT statement is
163770 ** for a window function within a SELECT statement. Argument pList is a
163771 ** linked list of WINDOW definitions for the current SELECT statement.
163881 ** that used by the SELECT statement being processed, only process
164077 ** If the SELECT statement passed as the second argument does not invoke
164079 ** rewrites the SELECT statement so that window function xStep functions
164235 ** result-set or ORDER BY clause of the SELECT statement p. */
164454 ** to be processed as part of SELECT statement pSel). The window is linked
165569 ** sqlite3WhereBegin() has already been called for the SELECT statement
165767 ** The new "continue" statement in the above jumps to the next iteration
165905 Select *p, /* Rewritten SELECT statement */
166321 ** UPDATE or DELETE statement.
166340 ** For a compound SELECT statement, make sure p->pPrior->pNext==p for
168744 /* This array of booleans keeps track of the parser statement
173075 ** Whenever the CREATE TRIGGER keywords are seen, the statement
173082 ** (1) START At the beginning or end of an SQL statement. This routine
173086 ** (2) NORMAL We are in the middle of statement which ends with a single
173090 ** a statement.
173093 ** statement, possibly preceded by EXPLAIN and/or followed by
173129 /* A complex statement machine used to detect the end of a CREATE TRIGGER
173130 ** statement. This is the normal case.
173145 /* If triggers are not supported by this compile then the statement machine
173146 ** used to detect the end of a statement is much simpler
174719 ** prepare statement or sqlite3_backup closes.
175564 ** SQL statement.
175616 ** each SQL statement that is run.
175969 ** a temporary file for transient pager files and statement journals.
177168 ** by default. Autocommit is disabled by a BEGIN statement and reenabled
177805 ** run a single CREATE TABLE statement to construct the imposter table in
177852 ** inject an intreal() value at arbitrary places in an SQL statement,
178560 ** This function is called while stepping or preparing a statement
179076 ** the tokenizer clause of the CREATE VIRTUAL TABLE statement to the
179102 ** TABLE statement that created the fts3 table. For example, if
179610 sqlite3_stmt *pStmt; /* Prepared statement in use by the cursor */
180278 char *zSql; /* SQL statement passed to declare_vtab() */
180291 /* Create the whole "CREATE TABLE" statement to pass to SQLite */
180398 sqlite3_stmt *pStmt; /* Compiled "PRAGMA %Q.page_size" statement */
180507 ** could be used in a SELECT statement such as the following:
180657 ** (if any) specified as part of the CREATE VIRTUAL TABLE statement.
180748 char *zSql; /* "SELECT *" statement on zTbl */
181001 ** TABLE statement, use all columns from the content table.
181399 ** Finalize the statement handle at pCsr->pStmt.
181401 ** Or, if that statement handle is one created by fts3CursorSeekStmt(),
181402 ** and the Fts3Table.pSeekStmt slot is currently NULL, save the statement
181446 ** compose and prepare an SQL statement of the form:
181477 ** Position the pCsr->pStmt statement so that it is on the row
181551 ** root node, then the buffer comes from a SELECT statement. SQLite does
182947 char *zSql; /* SQL statement used to access %_content */
183018 /* Compile a SELECT statement for this cursor. For a full-table-scan, the
183019 ** statement loops through all rows of the %_content table. For a
183020 ** full-text query or docid lookup, the statement retrieves a single
183523 ** because an "ALTER TABLE RENAME TABLE" statement inside a transaction
185459 /* Ensure the %_content statement is reset. */
189456 ** statement and returns one row for each token in the result. With
190164 ** This function is used to obtain an SQLite prepared statement handle
190165 ** for the statement identified by the second argument. If successful,
190166 ** *pp is set to the requested statement handle and SQLITE_OK returned.
190170 ** at least as many entries as the requested statement has bound
190178 sqlite3_value **apVal /* Values to bind to statement */
190218 /* This statement is used to determine which level to read the input from
190221 ** if no level in the FTS index contains more than ? segments, the statement
190375 ** array apVal[] to the SQL statement identified by eStmt, the statement
190378 ** Returns SQLITE_OK if the statement is successfully executed, or an
190384 int eStmt, /* Index of statement to evaluate */
190468 ** Set *ppStmt to a statement handle that may be used to iterate through
190470 ** return SQLITE_OK. If an error occurs while preparing the statement,
190473 ** There is only ever one instance of this SQL statement compiled for
190476 ** The statement returns the following columns from the %_segdir table:
190489 sqlite3_stmt **ppStmt /* OUT: Compiled statement */
190862 /* Locate the statement handle used to insert data into the %_content
190863 ** table. The SQL for this statement is:
190867 ** The statement features N '?' variables, where N is the number of user
190879 /* There is a quirk here. The users INSERT statement may have specified
190900 /* Execute the statement to insert the record. Set *piDocid to the
192424 sqlite3_stmt *pDelete; /* SQL statement to delete rows */
192460 sqlite3_stmt *pDelete = 0; /* SQL statement to delete rows */
192963 ** statement passed as the first argument.
193434 ** This function is called when the user executes the following statement:
193454 /* Compose and prepare an SQL statement to loop through the content table */
194391 ** The DELETE statement removes the specific %_segdir level. The UPDATE
194392 ** statement ensures that the remaining segments have contiguously allocated
194401 sqlite3_stmt *pDelete = 0; /* DELETE statement */
194428 sqlite3_stmt *pSelect = 0; /* Select statement to read idx values */
194429 sqlite3_stmt *pUpdate = 0; /* Update statement to modify idx values */
195614 ** the statement is either an INSERT or an UPDATE that modifies the
197573 ** statement has specified that the tokenizer for this table shall consider
201114 char *zReadAuxSql; /* SQL for statement to read aux data */
204580 ** The second argument to this function contains the text of an SQL statement
204581 ** that returns a single integer value. The statement is compiled and executed
204676 int argc, const char *const*argv, /* Parameters to CREATE TABLE statement */
204801 ** deserialize all nodes, a statement like:
204902 ** Reset SQL statement pStmt. If the sqlite3_reset() call returns an error,
204913 ** to compile it as an SQL statement.
204915 ** If successful, a pointer to the new SQL statement is returned. Otherwise,
206574 int argc, const char *const*argv, /* Parameters to CREATE TABLE statement */
208431 ** above, the update statement:
208451 ** is similar to an UPDATE statement such as:
209042 sqlite3_stmt *pUpdate; /* Last update statement (or NULL) */
209529 ** Prepare the SQL statement in buffer zSql against database handle db.
209530 ** If successful, set *ppStmt to point to the new statement and return
209553 ** Reset the SQL statement passed as the first argument. Return a copy
209570 ** sqlite3_malloc containing an SQL statement. This function prepares the SQL
209571 ** statement against database db and frees the buffer. If statement
209572 ** compilation is successful, *ppStmt is set to point to the new statement
209843 ** statement on the RBU handles database.
209940 ** Finalize the statement passed as the second argument.
210470 ** expressions that follows a SELECT keyword) for a SELECT statement
210473 ** second argument. A "PRAGMA index_xinfo = <idxname>" statement is used
210680 ** The SELECT statement iterating through the keys for the current object
210695 ** an UPDATE statement used to update the table object that the iterator
210969 ** Prepare a statement used to insert rows into the "rbu_tmp_xxx" table.
210970 ** Specifically a statement of the form:
211123 ** Ensure that the SQLite statement handles required to update the
211170 /* Create the statement to insert index entries */
211187 /* Create the SELECT statement to read keys in sorted order */
211263 /* Create the INSERT statement to write to the target PK b-tree */
211273 /* Create the DELETE statement to write to the target PK b-tree.
211332 /* Create the SELECT statement to read keys from data_xxx */
211386 ** Set output variable *ppStmt to point to an UPDATE statement that may
211398 sqlite3_stmt **ppStmt /* OUT: UPDATE statement handle */
211407 /* Search for an existing statement. If one is found, shift it to the front
211816 ** recovered. Running a read-statement here to ensure that doing so
212077 ** The SELECT statement iterating through the keys for the current object
212134 ** Assert that column iCol of statement pStmt is named zName.
212162 ** statement below does actually delete a row, nPhaseOneStep will be
212202 ** SELECT statement is:
212308 ** is already a transaction open, so the prepared statement cannot
212310 ** statement reads is page 1, which is guaranteed to be in the cache.
213039 /* Close any open statement handles. */
215713 ** in which columns were declared in the CREATE TABLE statement.
215754 ** statement.
217684 ** in column iCol of the row that SQL statement pStmt currently points
217739 ** values). The statement handle passed as the second argument points
217899 ** Formulate and prepare a SELECT statement to retrieve a row from table
217911 sqlite3_stmt **ppStmt /* OUT: Prepared SELECT statement */
217955 ** to the SELECT statement passed as the first argument. The SELECT statement
218093 sqlite3_stmt *pSel = 0; /* SELECT statement to query table pTab */
218106 /* Build and compile a statement to execute: */
219287 sqlite3_stmt *pDelete; /* DELETE statement */
219288 sqlite3_stmt *pInsert; /* INSERT statement */
219289 sqlite3_stmt *pSelect; /* SELECT statement */
219308 ** Find a prepared UPDATE statement suitable for the UPDATE step currently
219466 ** Formulate a statement to DELETE a row from database db. Assuming a table
219471 ** The DELETE statement looks like this:
219480 ** pointing to the prepared version of the SQL statement.
219535 ** Formulate and prepare an SQL statement to query table zTab by primary
219540 ** The SELECT statement looks like this:
219545 ** pointing to the prepared version of the SQL statement.
219557 ** Formulate and prepare an INSERT statement to add a record to table zTab.
219563 ** pointing to the prepared version of the SQL statement.
219649 ** transfers new.* values from the current iterator entry to statement
219653 ** statement pStmt. If parameter abPK is NULL, all values from 0 to (nCol-1)
219654 ** are transfered to the statement. Otherwise, if abPK is not NULL, it points
219657 ** statement.
219666 sqlite3_stmt *pStmt /* Bind values to this statement */
219694 ** SQL statement pSelect is as generated by the sessionSelectRow() function.
219697 ** entry. If a row is found, the SELECT statement left pointing at the row
219699 ** has occured, the statement is reset and SQLITE_OK is returned. If an
219700 ** error occurs, the statement is reset and an SQLite error code is returned.
219703 ** statement pSelect. If any other value is returned, the statement does
219707 ** new.* record to the SELECT statement. Or, if it points to a DELETE or
219714 sqlite3_stmt *pSelect /* SELECT statement from sessionSelectRow() */
219839 /* Bind the new.* PRIMARY KEY values to the SELECT statement. */
219938 /* Bind values to the DELETE statement. If conflict handling is required,
219975 /* Bind values to the UPDATE statement. */
221678 ** tokenizer name as part of the CREATE VIRTUAL TABLE statement used
222070 ** to parse the arguments passed to the CREATE VIRTUAL TABLE statement.
222077 ** be gleaned from the CREATE VIRTUAL TABLE statement.
222091 ** used as part of an SQL statement it needs to be quoted appropriately.
222127 int bLock; /* True when table is preparing statement */
223480 /* This array of booleans keeps track of the parser statement
232630 ** statement used to verify that the contents of the pIter->aFirst[] array
237828 /* TODO: It would be better to have some system for reusing statement
237831 ** And since the statement required here reads from this very virtual
237834 ** If SQLite a built-in statement cache, this wouldn't be a problem. */
238286 /* If the cursor does not yet have a statement handle, obtain one now. */
238332 ** an INSERT statement of the form:
238338 ** statement. This function returns SQLITE_OK if successful, or an SQLite
238483 /* A regular INSERT, UPDATE or DELETE statement. The trick here is that
239812 sqlite3_stmt **ppStmt, /* OUT: Prepared statement handle */
240748 ** Obtain an SQLite statement handle that may be used to read data from the
240771 ** Release an SQLite statement handle obtained via an earlier call to
244349 #define STMT_COLUMN_SQL 0 /* SQL for the statement */
246061 sqlite3_stmt *statement = NULL;
246062 int rc = sqlite3_prepare_v2(db, sql, -1, &statement, NULL);
246067 rc = sqlite3_step(statement);
246069 sqlite3_finalize(statement);
246072 int metadata = sqlite3_column_int(statement, 0);
246073 sqlite3_finalize(statement);
246085 sqlite3_stmt *statement = NULL;
246086 int rc = sqlite3_prepare_v2(db, sql, -1, &statement, NULL);
246090 while(sqlite3_step(statement) == SQLITE_ROW){
246091 rc = sqlite3_exec(db, (char*)sqlite3_column_text(statement, 0), NULL, NULL, errMsg);
246093 sqlite3_finalize(statement);
246097 sqlite3_finalize(statement);