Lines Matching defs:an

2 ** This file is an amalgamation of many separate C source files from SQLite
58 ** on an older machine (ex: Red Hat 6.0). If you compile on Red Hat 7.2
113 ** * Columns in an index
115 ** * Terms in the SET clause of an UPDATE statement
118 ** * Terms in the VALUES clause of an INSERT statement
142 ** The maximum depth of an expression tree. This is limited to
144 ** want to place more severe limits on the complexity of an
176 ** The maximum number of arguments to an SQL function.
223 ** a library that is technically incompatible with an SQLite library
225 ** with a page-size of 65536 bytes crashes, then an instance of SQLite
320 ** The number of samples of an index that SQLite takes in order to
334 ** if it is available, it requires an #include of specific headers
364 ** Older versions of SQLite used an optional THREADSAFE macro.
395 ** will cause HeapValidate to be called. If heap validation should fail, an
452 ** option is set. Thus NDEBUG becomes an opt-in rather than an opt-out
643 ** ^(The [SQLITE_VERSION_NUMBER] C preprocessor macro resolves to an integer
656 ** string contains the date and time of the check-in (UTC) and an SHA1
690 ** sqlite3_libversion_number() function returns an integer equal to
748 ** This interface can be used by an application to make sure that the
771 ** Each open SQLite database is represented by a pointer to an instance of
772 ** the opaque structure named "sqlite3". It is useful to think of an sqlite3
773 ** pointer as an object. The [sqlite3_open()], [sqlite3_open16()], and
777 ** [sqlite3_busy_timeout()] to name but three) that are methods on an
837 ** pointer or an [sqlite3] object pointer obtained
857 ** that allows an application to run multiple statements of SQL
871 ** ^If an error occurs while evaluating the SQL statements passed into
883 ** ^If an sqlite3_exec() callback returns non-zero, the sqlite3_exec()
889 ** callback is an array of pointers to strings obtained as if from
890 ** [sqlite3_column_text()], one for each column. ^If an element of a
893 ** sqlite3_exec() callback is an array of pointers to strings where each
898 ** to an empty string, or a pointer that contains only whitespace and/or
926 ** Many SQLite functions return an integer result code from the set shown
939 #define SQLITE_ABORT 4 /* Callback routine requested an abort */
974 ** much information about problems as programmers might like. In an effort to
1051 ** object returns an integer which is a vector of the these
1059 ** are aligned to an address which is an integer multiple of
1085 ** of an [sqlite3_io_methods] object.
1096 ** When SQLite invokes the xSync() method of an
1126 ** An [sqlite3_file] object represents an open file in the
1130 ** for their own use. The pMethods entry is a pointer to an
1136 const struct sqlite3_io_methods *pMethods; /* Methods for an open file */
1142 ** Every file opened by the [sqlite3_vfs.xOpen] method populates an
1144 ** [sqlite3_file] object) with a pointer to an instance of this object.
1176 ** VFS implementations to directly control an open file using the
1177 ** [sqlite3_file_control()] interface. The second "op" argument is an
1215 ** are aligned to an address which is an integer multiple of
1264 ** into an integer that the pArg argument points to. This capability
1278 ** point to an integer (type int) containing the new chunk-size to use
1304 ** by an additional 25 milliseconds with each subsequent retry. This
1307 ** within the same process. The argument is a pointer to an array of two
1323 ** [sqlite3_file_control()] for this opcode should be a pointer to an integer.
1343 ** The mutex module within SQLite defines [sqlite3_mutex] to be an
1345 ** at the internal representation of an [sqlite3_mutex]. It only
1390 ** from xFullPathname() with an optional suffix added.
1426 ** change the way it deals with files. For example, an application
1451 ** be created, and that it is an error if it already exists.
1489 ** ^The xCurrentTimeInt64() method returns, as an integer, the Julian
1554 ** the xAccess method of an [sqlite3_vfs] object. They determine
1622 ** A call to sqlite3_initialize() is an "effective" call if it is
1625 ** following a call to sqlite3_shutdown(). ^(Only an effective call
1629 ** A call to sqlite3_shutdown() is an "effective" call if it is the first
1631 ** an effective call to sqlite3_shutdown() does any deinitialization.
1647 ** as a mutex) it returns an [error code] other than [SQLITE_OK].
1650 ** SQLite interfaces so that an application usually does not need to
1709 ** implementation of an application-defined [sqlite3_os_init()].
1711 ** The first argument to sqlite3_config() is an integer
1732 ** [SQLITE_DBCONFIG_LOOKASIDE | configuration verb] - an integer code
1748 ** A pointer to an instance of this object is the argument to
1751 ** By creating an instance of this object
1753 ** during configuration, an application can specify an alternative
1761 ** also used during testing of SQLite in order to specify an alternative
1801 ** SQLite will never invoke xInit() more than once without an intervening
1808 void *(*xRealloc)(void*,int); /* Resize an allocation */
1809 int (*xSize)(void*); /* Return the size of an allocation */
1873 ** <dd> ^(This option takes a single argument which is a pointer to an
1881 ** <dd> ^(This option takes a single argument which is a pointer to an
1906 ** scratch memory. There are three arguments: A pointer an 8-byte
1911 ** The first argument must be a pointer to an 8-byte aligned buffer
1923 ** This configuration should not be used if an application-define page
1932 ** argument should point to an allocation of at least sz*N bytes of memory.
1938 ** be aligned to an 8-byte boundary or subsequent behavior of SQLite
1953 ** The first pointer (the memory pointer) must be aligned to an 8-byte
1959 ** <dd> ^(This option takes a single argument which is a pointer to an
1971 ** <dd> ^(This option takes a single argument which is a pointer to an
1995 ** an [sqlite3_pcache_methods] object. This object specifies the interface
2000 ** <dd> ^(This option takes a single argument which is a pointer to an
2014 ** [sqlite3_log()] call and is intended to be a [result code] or an
2079 ** must be aligned to an 8-byte boundary. ^If the second argument to
2093 ** The first argument is an integer which is 0 to disable FK enforcement,
2095 ** unchanged. The second parameter is a pointer to an integer into which
2103 ** The first argument is an integer which is 0 to disable triggers,
2105 ** The second parameter is a pointer to an integer into which
2129 ** ^Each entry in an SQLite table has a unique 64-bit signed
2131 ** as an undeclared column named ROWID, OID, or _ROWID_ as long as those
2143 ** ^(If an [INSERT] occurs within a trigger or within a [virtual table]
2160 ** ^For the purposes of this routine, an [INSERT] is considered to
2187 ** ^Changes to a view that are simulated by an [INSTEAD OF trigger]
2191 ** caused by an INSERT, DELETE, or UPDATE statement. Rows that
2239 ** count does not include rows of views that fire an [INSTEAD OF trigger],
2269 ** ^If an SQL operation is very nearly finished at the time when
2270 ** sqlite3_interrupt() is called, then it might not have an opportunity
2274 ** ^If the interrupted SQL operation is an INSERT, UPDATE, or DELETE
2275 ** that is inside an explicit transaction, then the entire transaction
2334 ** an attempt is made to open a database table that another thread
2357 ** to promote to an exclusive lock. The first process cannot proceed
2374 ** cache will be left in an inconsistent state and so the error
2377 ** forces an automatic rollback of the changes. See the
2406 ** ^Calling this routine with an argument less than or equal to zero
2431 ** A result table is an array of pointers to zero-terminated UTF-8 strings.
2442 ** ^(As an example of the result table format, suppose a query result
2455 ** in an array names azResult. Then azResult holds this content:
2515 ** first two parameters is reversed from snprintf().)^ This is an
2549 ** One can use this text in an SQL statement as follows:
2571 ** This second example is an SQL syntax error. As a general rule you should
2641 ** is always aligned to at least an 8 byte boundary, or to a
2720 ** ^This routine registers an authorizer callback with a particular
2731 ** rejected with an error. ^If the authorizer callback returns
2734 ** the authorizer will fail with an error message.
2739 ** authorizer will fail with an error message explaining that
2744 ** to the callback is an integer [SQLITE_COPY | action code] that specifies
2754 ** return can be used to deny an untrusted user access to individual
2761 ** SQL statements from an untrusted source, to ensure that the SQL statements
2764 ** example, an application may allow a user to enter arbitrary
2774 ** in addition to using an authorizer.
2815 #define SQLITE_DENY 1 /* Abort the SQL statement with an error */
2816 #define SQLITE_IGNORE 2 /* Don't allow access, but don't generate an error */
2823 ** second parameter to the callback is an integer code that specifies
2879 ** various times when an SQL statement is being run by [sqlite3_step()].
2888 ** the original statement text and an estimate of wall-clock time
2936 ** ^These routines open an SQLite database file as specified by the
2940 ** returned in *ppDb, even if an error occurs. The only exception is that
2944 ** [SQLITE_OK] is returned. Otherwise an [error code] is returned.)^ ^The
2946 ** an English language description of the error following a failure of any
2953 ** Whether or not an error occurs when it is opened, resources
2968 ** already exist, an error is returned.</dd>)^
2973 ** case the database must already exist, otherwise an error is returned.</dd>)^
3011 ** ^If the filename is an empty string, then a private, temporary
3028 ** URI filenames are parsed according to RFC 3986. ^If the URI contains an
3029 ** authority, then it must be either an empty string or the string
3030 ** "localhost". ^If the authority is not an empty string or "localhost", an
3036 ** then it is interpreted as an absolute path. ^If the path does not begin
3039 ** ^On windows, the first component of an absolute path
3051 ** an empty string the default VFS object is used. ^Specifying an unknown
3052 ** VFS is an error. ^If sqlite3_open_v2() is used and the vfs option is
3057 ** "rwc". Attempting to set it to any other value is an error)^.
3065 ** used, it is an error to specify a value for the mode parameter that is
3079 ** ^Specifying an unknown parameter in the query component of a URI is not an
3115 ** specifying an octet value. ^Before the path or query components of a
3118 ** corresponding octet. If this process generates an invalid UTF-8 encoding,
3191 ** If an interface fails with SQLITE_MISUSE, that means the interface
3260 ** created by an untrusted script can be contained using the
3281 ** <dd>The maximum length of an SQL statement, in bytes.</dd>)^
3285 ** result set of a [SELECT] or the maximum number of columns in an index
3286 ** or in an ORDER BY or GROUP BY clause.</dd>)^
3296 ** used to implement an SQL statement. This limit is not currently
3313 ** <dd>The maximum index number of any [parameter] in an SQL statement.)^
3335 ** To execute an SQL query, it must first be compiled into a byte-code
3353 ** performance advantage to be gained by passing an nByte parameter that
3363 ** executed using [sqlite3_step()]. ^If there is an error, *ppStmt is set
3364 ** to NULL. ^If the input text contains no SQL (if the input is an empty
3371 ** otherwise an [error code] is returned.
3389 ** ^When an error occurs, [sqlite3_step()] will return one of the detailed
3405 ** or [GLOB] operator or if the parameter is compared to an indexed column
3458 ** ^(For example, if an application defines a function "eval()" that
3491 ** will accept either a protected or an unprotected sqlite3_value.
3497 ** sqlite3_value object but no mutex is held for an unprotected
3522 ** The context in which an SQL function executes is stored in an
3523 ** sqlite3_context object. ^A pointer to an sqlite3_context object
3550 ** In the templates above, NNN represents an integer literal,
3551 ** and VVV represents an alphanumeric identifier.)^ ^The values of these
3560 ** ^The leftmost SQL parameter has an index of 1. ^When the same named
3591 ** (just an integer to hold its size) while it is being processed.
3607 ** ^The sqlite3_bind_* routines return [SQLITE_OK] on success or an
3658 ** ^The first host parameter has an index of 1, not 0.
3675 ** ^Return the index of an SQL parameter given its name. ^The
3701 ** [prepared statement]. ^This routine returns 0 if pStmt is an SQL
3702 ** statement that does not return data (for example an [UPDATE]).
3730 ** that column, if there is an AS clause. If there is no AS clause
3761 ** ^If the Nth column returned by the statement is an expression or
3794 ** returned result set of that [SELECT] is a table column (not an
3796 ** column is returned.)^ ^If the Nth column of the result set is an
3843 ** or occurs outside of an explicit transaction, then you can retry the
3844 ** statement. If the statement is not a [COMMIT] and occurs within an
3878 ** [sqlite3_reset()] would result in an [SQLITE_MISUSE] return from
3882 ** break because any application that ever receives an SQLITE_MISUSE error
4011 ** ^The object returned by [sqlite3_column_value()] is an
4164 ** [prepared statement] S indicated an error, then
4165 ** [sqlite3_reset(S)] returns an appropriate [error code].
4187 ** function is to be added. ^If an application uses more than one database
4218 ** ^(The fifth parameter is an arbitrary pointer. The implementation of the
4223 ** aggregate. ^A scalar SQL function requires an implementation of the xFunc
4225 ** parameters. ^An aggregate SQL function requires an implementation of xStep
4226 ** and xFinal and NULL pointer must be passed for xFunc. ^To delete an existing
4334 ** The 3rd parameter to these callbacks is an array of pointers to
4340 ** Any attempt to use these routines on an [unprotected sqlite3_value]
4345 ** pointer instead of a [sqlite3_stmt*] pointer and an integer column number.
4353 ** numeric affinity to the value. This means that an attempt is
4354 ** made to convert the value to an integer or floating point. If
4396 ** an aggregate query, the xStep() callback of the aggregate function
4525 ** an application-defined function to be the BLOB whose content is pointed
4534 ** an application-defined function to be a floating point value specified
4538 ** cause the implemented SQL function to throw an exception.
4541 ** as the text of an error message. ^SQLite interprets the error
4555 ** returned by SQLite as a result of an error in a function. ^By default,
4559 ** ^The sqlite3_result_toobig() interface causes SQLite to throw an error
4562 ** ^The sqlite3_result_nomem() interface causes SQLite to throw an error
4609 ** ^A [protected sqlite3_value] object may always be used where an
4659 ** on an even byte address.
4661 ** ^The fourth argument, pArg, is an application data pointer that is passed
4674 ** by the eTextRep argument. The collating function must return an
4680 ** must give an equivalent answer when invoked with equivalent strings.
4741 ** [database connection] to be invoked whenever an undefined collation
4775 ** Specify the key for an encrypted database. This routine should be
4787 ** Change the key on an open database. If the current database is not
4844 ** is a NULL pointer, then SQLite performs a search for an appropriate
4883 ** an error is to use this function.
4913 ** [sqlite3_next_stmt(D,S)] must refer to an open database
4955 ** rolled back if an explicit "ROLLBACK" statement is executed, or
4956 ** an error or constraint causes an implicit rollback to occur.
4984 ** ^In the case of an update, this is the [rowid] after the update takes place.
4990 ** is not invoked when duplication rows are deleted because of an
5026 ** ^Cache sharing is enabled and disabled for an entire process.
5052 ** pages to improve performance is an example of non-essential memory.
5070 ** an [SQLITE_NOMEM] error. In other words, the soft heap limit
5132 ** (i.e. "main", "temp", or an attached database) containing the specified
5161 ** ^If the specified table is actually a view, an [error code] is returned.
5163 ** ^If the specified column is "rowid", "oid" or "_rowid_" and an
5177 ** ^(This function may load one or more schemas from database files. If an
5179 ** cannot be found, an [error code] is returned and an error message left
5200 ** ^This interface loads an SQLite extension library from the named file.
5202 ** ^The sqlite3_load_extension() interface attempts to load an
5210 ** ^If an error occurs and pzErrMsg is not 0, then the
5218 ** otherwise an error will be returned.
5265 ** If the xEntryPoint routine encounters an error, it should make *pzErrMsg
5266 ** point to an appropriate error message (obtained from [sqlite3_mprintf()])
5267 ** and return an appropriate [error code]. ^SQLite ensures that *pzErrMsg
5270 ** xEntryPoint() returns an error, the [sqlite3_open()], [sqlite3_open16()],
5273 ** ^Calling sqlite3_auto_extension(X) with an entry point X that is already
5381 ** and makes other simplifications to the WHERE clause in an attempt to
5405 ** ^The estimatedCost value is an estimate of the cost of doing the
5441 ** an operator that is part of a constraint term in the wHERE clause of
5463 ** parameter is an arbitrary client data pointer that is passed through
5501 ** ^Virtual tables methods can set an error message by assigning a
5558 ** of the new function always causes an exception to be thrown. So
5579 ** An instance of this object represents an open BLOB on which
5602 ** ^It is not possible to open a column that is part of an index or primary
5613 ** to *ppBlob. Otherwise an [error code] is returned and *ppBlob is set
5621 ** ^(If the row that a BLOB handle points to is modified by an
5627 ** an expired BLOB handle fail with a return code of [SQLITE_ABORT].
5639 ** to create an empty, zero-filled blob in which to read or write using
5658 ** ^This function is used to move an existing blob handle so that it points
5662 ** remain the same. Moving an existing blob handle to a new row can be
5668 ** it does not contain a blob or text value, or if another error occurs, an
5671 ** [sqlite3_blob_reopen()] on an aborted blob handle immediately return
5672 ** SQLITE_ABORT. ^Calling [sqlite3_blob_bytes()] on an aborted blob handle
5682 ** ^Closes an open [BLOB handle].
5696 ** an error code, the BLOB is still closed.)^
5721 ** ^(This function is used to read data from an open [BLOB handle] into a
5731 ** ^An attempt to read from an expired [BLOB handle] fails with an
5735 ** Otherwise, an [error code] or an [extended error code] is returned.)^
5749 ** ^This function is used to write data into an open [BLOB handle] from a
5765 ** ^An attempt to write to an expired [BLOB handle] fails with an
5773 ** Otherwise, an [error code] or an [extended error code] is returned.)^
5787 ** A virtual filesystem (VFS) is an [sqlite3_vfs] object
5803 ** ^To make an existing VFS into the default VFS, register it again
5806 ** VFS is registered with a name that is NULL or an empty string,
5854 ** will unwind its stack and return an error. ^(The argument
5908 ** mutex must be exited an equal number of times before another thread
5917 ** sqlite3_mutex_try() as an optimization so this is acceptable behavior.)^
5947 ** creates and populates an instance of this structure to pass
5949 ** Additionally, an instance of this structure can be used as an
5984 ** (i.e. it is acceptable to provide an implementation that segfaults if
6020 ** never uses these routines except inside an assert() and applications
6108 ** an incorrect zDbName and an SQLITE_ERROR return from the underlying
6120 ** purposes. ^The first parameter is an operation code that determines
6168 ** highwater marks. ^The first argument is an integer code for
6294 ** is an integer constant, taken from the set of
6393 ** an index.
6398 ** is an integer code for a specific [SQLITE_STMTSTATUS counter]
6425 ** A non-zero value in this counter may indicate an opportunity to
6431 ** A non-zero value in this counter may indicate an opportunity to
6459 ** register an alternative page cache implementation by passing in an
6464 ** custom page cache using this API, an application can better control
6470 ** The alternative page cache mechanism is an
6474 ** ^(The contents of the sqlite3_pcache_methods structure are copied to an
6502 ** ^SQLite will never invoke xInit() more than once without an intervening
6511 ** will the page size of the database file that is to be cached plus an
6521 ** false if it is used for an in-memory database. The cache implementation
6545 ** A "page", in this context, means a buffer of szPage bytes aligned at an
6587 ** previously contains an entry associated with newKey, it must be
6622 ** The sqlite3_backup object records state information about an ongoing
6667 ** an [ATTACH] statement for an attached database.
6673 ** an error.
6675 ** ^If an error occurs within sqlite3_backup_init(D,N,S,M), then NULL is
6676 ** returned and an error code and error message are stored in the
6681 ** ^A successful call to sqlite3_backup_init() returns a pointer to an
6696 ** ^If an error occurs while running sqlite3_backup_step(B,N),
6697 ** then an [error code] is returned. ^As well as [SQLITE_OK] and
6699 ** [SQLITE_NOMEM], [SQLITE_BUSY], [SQLITE_LOCKED], or an
6707 ** <li> the destination database is an in-memory database and the
6728 ** ^The first call to sqlite3_backup_step() obtains an exclusive lock
6736 ** through the backup process. ^If the source database is modified by an
6759 ** ^If an out-of-memory condition or IO error occurred during any prior
6828 ** an [SQLITE_LOCKED] error if the required locks on the shared-cache or
6844 ** has locked the required resource is stored internally. ^After an
6845 ** application receives an SQLITE_LOCKED error, it may call the
6872 ** The unlock-notify callback is not reentrant. If an application invokes
6873 ** any sqlite3_xxx API functions from within an unlock-notify callback, a
6881 ** When an unlock-notify callback is registered, the application provides a
6884 ** it an array of void* context pointers. The first argument passed to
6885 ** an unlock-notify callback is a pointer to an array of void* pointers,
6889 ** more than one blocked connection that has registered for an unlock-notify
6893 ** specified by the blocked connections bundled together into an array.
6894 ** This gives the application an opportunity to prioritize any actions
6899 ** Assuming that after registering for an unlock-notify callback a
6911 ** a deadlocked state if connection A has registered for an unlock-notify
6913 ** B has itself registered for an unlock-notify callback when connection
6916 ** registered for an unlock-notify callback on the conclusion of connection
6930 ** or "DROP INDEX" query, an infinite loop might be the result.
6933 ** by an sqlite3_step() call. ^(If there is a blocking connection, then the
6965 ** nothing to prevent an application from calling sqlite3_log(), doing so
6994 ** either "main" or the name of an [ATTACH]-ed database. ^The fourth parameter
6998 ** The callback function should normally return [SQLITE_OK]. ^If an error
7001 ** to report an error, though the commit will have still occurred. If the
7020 ** CAPI3REF: Configure an auto-checkpoint
7050 ** on [database connection] D to be [checkpointed]. ^If X is NULL or an
7099 ** If no values are available because of an error, they are both set to -1
7102 ** All calls obtain an exclusive "checkpoint" lock on the database file. If
7121 ** an SQLITE_BUSY error is encountered when processing one or more of the
7124 ** error occurs while processing an attached database, processing is abandoned
7129 ** If database zDb is the name of an attached database that is not in WAL
7161 ** If this interface is invoked outside the context of an xConnect or
7181 ** where X is an integer. If X is zero, then the [virtual table] whose
7215 ** of a [virtual table] implementation for an INSERT or UPDATE operation. ^The
7237 /* #define SQLITE_ABORT 4 // Also an error code */
7279 ** Register a geometry callback named zGeom that can be used as part of an
7337 /* A complete hash table is an instance of the following structure.
7368 /* Each element in the hash table is an instance of the following
7615 ** The "file format" number is an integer that is incremented whenever
7760 ** Assert that the pointer X is aligned to an 8-byte boundary. This
7811 ** an array.
7817 ** This is an internal extension to SQLITE_STATIC and SQLITE_TRANSIENT.
7852 ** implementation of an SQL aggregate step callback may not use the
7980 #define BTREE_MEMORY 4 /* This is an in-memory DB */
8023 ** BTREE_BLOBKEY, the key is an arbitrary BLOB and no content is stored
8040 ** to constants so that the offset of the corresponding field in an
8180 ** or VDBE. The VDBE implements an abstract machine that runs a
8188 ** A single VDBE is an opaque structure named "Vdbe". Only routines
8203 ** A single instruction of the virtual machine has an opcode
8205 ** as an instance of the following structure:
8211 u8 p5; /* Fifth parameter is an unsigned character */
8278 #define P4_VTAB (-10) /* P4 is a pointer to an sqlite3_vtab structure */
8490 #define OPFLG_IN1 0x0004 /* in1: P1 is an input */
8491 #define OPFLG_IN2 0x0008 /* in2: P2 is an input */
8492 #define OPFLG_IN3 0x0010 /* in3: P3 is an input */
8493 #define OPFLG_OUT2 0x0020 /* out2: P2 is an output */
8494 #define OPFLG_OUT3 0x0040 /* out3: P3 is an output */
8639 ** Page number PAGER_MJ_PGNO is never used in an SQLite database (it is
8801 ** Every page in the cache is controlled by an instance of the following
8896 /* Increment the reference count of an existing page */
9095 ** process that requests an EXCLUSIVE lock may actually obtain a PENDING
9096 ** lock. This can be upgraded to an EXCLUSIVE lock by a subsequent call to
9149 ** is set high so that we don't have to allocate an unused page except
9239 ** to all source files. We break it out in an effort to keep the code
9302 ** Each database file to be accessed by the system is an instance
9422 ** Each database connection is an instance of the following structure.
9424 ** The sqlite.lastRowid records the last insert rowid generated by an
9545 ** tried to do recently failed with an SQLITE_LOCKED error due to locks
9620 ** Each SQL function is defined by an instance of the following
9682 ** Used to create an aggregate function definition implemented by
9729 ** Each SQLite module (virtual table definition) is defined by an
9741 ** information about each column of an SQL table is held in an instance
9759 ** A "Collating Sequence" is defined by an instance of the following
9770 ** The CollSeq.pUser member variable is an extra parameter that passed in
9776 ** collating sequence is undefined. Indices built on an undefined
9825 ** The SQLITE_AFF_MASK values masks off the significant bits of an
9831 ** Additional bit values that can be ORed with an affinity without
9859 ** When an sqlite3_prepare() operation is required to access the virtual
9864 ** When an in-memory Table object is deleted (for example when the
9872 ** Refer to comments above function sqlite3VtabUnlockList() for an
9873 ** explanation as to why it is safe to add an entry to an sqlite3.pDisconnect
9891 ** Each SQL table is represented in memory by an instance of the
9899 ** pointer to an array of Column structures, one for each column.
9901 ** If the table has an INTEGER PRIMARY KEY, then Table.iPKey is the index of
9976 ** Each foreign key constraint is an instance of the following structure.
9990 ** Each REFERENCES clause generates an instance of the following structure
10018 ** the operation in progress stops and returns an error code. But prior
10069 ** A record is an object that contains one or more fields of data.
10071 ** the key of an index. A blob encoding of a record is created by
10092 #define UNPACKED_INCRKEY 0x0008 /* Make this key an epsilon larger */
10097 ** Each SQL index is represented in memory by an
10111 ** first column to be indexed (c3) has an index of 2 in Ex1.aCol[].
10112 ** The second column to be indexed (c1) has an index of 0 in
10119 ** algorithm to employ whenever an attempt is made to insert a non-unique
10154 ** Each token coming out of the lexer is an instance of
10155 ** this structure. Tokens are also used as part of an expression.
10228 ** Each node of an expression in the parse tree is an instance
10232 ** as opcodes here. For example, the parser defines TK_GE to be an integer
10237 ** If the expression is an SQL literal (TK_INTEGER, TK_FLOAT, TK_BLOB,
10240 ** variable name. Finally, if the expression is an SQL function (TK_FUNCTION),
10246 ** Expr.x.pList is a list of arguments if the expression is an SQL function,
10247 ** a CASE expression or an IN expression of the form "<lhs> IN (<y>, <z>...)".
10248 ** Expr.x.pSelect is used if the expression is a sub-select or an expression of
10257 ** expression is used as a result in an aggregate SELECT, then the
10261 ** If the expression is an unbound variable marker (a question mark
10265 ** If the expression is a subquery then Expr.iColumn holds an integer
10278 ** help reduce memory requirements, sometimes an Expr object will be
10284 ** an Expr object is truncated. When EP_Reduced is set, then all
10343 #define EP_InfixFunc 0x0080 /* True for an infix function: LIKE, GLOB, etc */
10361 ** flag on an expression structure. This flag is used for VV&A only. The
10382 ** struct, an Expr struct with the EP_Reduced flag set in Expr.flags
10383 ** and an Expr struct with the EP_TokenOnly flag set.
10399 ** list of "ID = expr" items in an UPDATE. A list of expressions can
10420 ** the parse tree for an expression and the span of input text for an
10438 ** column names after a table name in an INSERT statement. In the statement
10474 ** is modified by an INSERT, DELETE, or UPDATE statement. In standard SQL,
10604 #define WHERE_FORCE_TABLE 0x0040 /* Do not use an index-only search */
10726 #define SRT_Union 1 /* Store result as keys in an index */
10736 #define SRT_Set 7 /* Store results as keys in an index */
10737 #define SRT_Table 8 /* Store result as data with an automatic rowid */
10779 ** trigger that may be fired while parsing an INSERT, UPDATE or DELETE
10835 u8 checkSchema; /* Causes schema cookie check after an error */
10863 u8 mayAbort; /* True if statement may throw an ABORT exception */
10938 #define OPFLAG_ISUPDATE 0x04 /* This OP_Insert is an sql UPDATE */
10939 #define OPFLAG_APPEND 0x08 /* This is likely to be an append */
10944 * Each trigger present in the database schema is stored as an instance of
10964 IdList *pColumns; /* If this is an UPDATE OF <column-list> trigger,
10973 ** A trigger is either a BEFORE or an AFTER trigger. The following constants
10997 * pSelect -> If this is an INSERT INTO ... SELECT ... statement, then
11000 * pExprList -> If this is an INSERT INTO ... VALUES ... statement, then
11002 * pIdList -> If this is an INSERT INTO ... (<column-names>) VALUES ...
11168 ** FTS4 is really an extension for FTS3. It is enabled using the
11170 ** the SQLITE_ENABLE_FTS4 macro to serve as an alisse for SQLITE_ENABLE_FTS3.
11860 ** sqlite3MemdebugSetType() sets the "type" of an allocation to one of
11872 ** and MEMTYPE_LOOKASIDE. If an allocation is MEMTYPE_LOOKASIDE, that means
11984 ** Bit 0x40 is set if the character non-alphanumeric and can be used in an
11987 ** part of an identifier is 0x46.
12106 ** 0x40000000 results in an incompatible database file format!
12567 ** executed by a virtual machine. Each instruction is an instance
12587 ** Every cursor that the virtual machine has open is represented by an
12604 Bool isIndex; /* True if an index containing keys only - no data */
12614 /* Result of last sqlite3BtreeMoveto() done by an OP_NotExists or
12712 ** If the MEM_Null flag is set, then the value is an SQL NULL value.
12723 #define MEM_Int 0x0004 /* Value is an integer */
12739 #define MEM_Ephem 0x1000 /* Mem.z points to an ephemeral string */
12740 #define MEM_Agg 0x2000 /* Mem.z points to an agg function context */
12781 ** The "context" argument for a installable function. A pointer to an
12807 ** is really a pointer to an instance of this structure.
12823 Mem *pResultSet; /* Pointer to an array of results */
12843 u8 errorAction; /* Recovery action to do in case of an error */
12866 FILE *trace; /* Write an execution trace here, if not NULL */
13058 ** This implementation assumes that reading or writing an aligned
13059 ** 32-bit integer is an atomic operation. If that assumption is not true,
13114 ** Return an approximation for the amount of memory currently used
13136 ** *pCurrent gets an accurate estimate of the amount of memory used
13179 ** *pCurrent gets an accurate estimate of the amount of memory used
13341 ** A missing specifier is not considered an error.
13614 ** already, check for an MSVC build environment that provides
13669 ** Or, if an error does occur, set *pRc to SQLITE_ERROR. The returned value
13742 ** is in a system call (i.e. localtime()), then an error message is written
13743 ** to context pCtx. If the error is an unrecognized modifier, no error is
14567 ** ability to simulate a malloc failure, so that the handling of an
14687 ** abandons the current operation and returns an error code (usually
14897 ** Like realloc(). Resize an allocation previously obtained from
15116 ** Given an allocation, find the MemBlockHdr for that allocation.
15135 ** to rounding up to an 8 byte boundary to ensure
15304 ** Change the size of an existing memory allocation.
15348 ** Set the "type" of an allocation.
15363 ** This routine is designed for use within an assert() statement, to
15364 ** verify the type of an allocation. For example:
15385 ** This routine is designed for use within an assert() statement, to
15386 ** verify the type of an allocation. For example:
15566 ** the chunk. In this way, the first chunk has an index of 1.
15608 ** True if we are evaluating an out-of-memory callback.
15732 ** Called when we are unable to satisfy an allocation of nBytes.
15800 ** or same size hash. In other words, *pRoot is an entry in either
15868 ** Look for an entry of the correct size in either the small
15930 ** Free an outstanding memory allocation.
15972 ** Return the size of an outstanding allocation, in bytes. The
16018 ** Change the size of an existing memory allocation
16238 ** that an application can, at any time, verify this constraint.
16248 ** A minimum allocation is an instance of the following structure.
16249 ** Larger allocations are an array of these structures where the
16326 ** Assuming mem5.zPool is divided up into an array of Mem5Link
16386 ** Return the size of an outstanding allocation, in bytes. The
16489 ** Free an outstanding memory allocation.
16571 ** Change the size of an existing memory allocation.
16578 ** of two. If nBytes==0 that means that an oversize allocation
16579 ** (an allocation larger than 0x40000000) was requested and this
16792 ** and uninitialized so that we can assert() if there is an attempt to
16902 ** is not currently entered. If a NULL pointer is passed as an argument
17076 ** mutex must be exited an equal number of times before another thread
17163 ** Each recursive mutex is an instance of the following structure.
17189 ** SQLite will unwind its stack and return an error. The argument
17351 ** mutex must be exited an equal number of times before another thread
17449 ** Each recursive mutex is an instance of the following structure.
17471 ** not an atomic operation, then these routines might delivery
17501 ** will unwind its stack and return an error. The argument
17614 ** mutex must be exited an equal number of times before another thread
17786 ** Each recursive mutex is an instance of the following structure.
17808 ** Here is an interesting observation: Win95, Win98, and WinME lack
17911 ** will unwind its stack and return an error. The argument
17999 ** mutex must be exited an equal number of times before another thread
18026 ** is used it is merely an optimization. So it is OK for it to always
18158 ** (so that a range test can be used to determine if an allocation
18399 ** signed integer value might cause an integer overflow inside of the
18430 ** case by setting scratchAllocOut to 1 when an allocation
18443 ** structures that would not normally fit on the stack of an
18604 ** Change the size of an existing memory allocation
18697 ** This is an important assumption. There are many places in the
18882 ** an historical reference. Most of the "enhancements" have been backed
18887 ** The following modules is an enhanced replacement for the "printf" subroutines
18895 ** * snprintf -- Works like sprintf, but has an extra argument
18914 ** * The %b field outputs an integer in binary notation.
18958 ** An "etByte" is an 8-bit unsigned value.
18964 ** by an instance of the following structure
19700 ** Reset an StrAccum string. Reclaim all malloced memory.
19763 ** to modify an existing string. For example:
19978 ** number generator) not as an encryption device.
20204 ** * This routine accepts an infinite number of different UTF8 encodings
20254 ** desiredEnc. It is an error if the string is already of the desired
20491 ** NULL is returned if there is an allocation error.
20663 ** this implementation is provided as an alternative.
20671 ** which depend on an exact implementation of IEEE or ISO
20721 ** %d Insert an integer
20749 ** Add an error message to pParse->zErrMsg and increment pParse->nErr.
20754 ** %d Insert an integer
20759 ** compiling an SQL statement (i.e. within sqlite3_prepare()). The
20783 ** Convert an SQL-style quoted string into a normal string by removing
20856 ** The string z[] is an text representation of a real number.
20891 *pResult = 0.0; /* Default return value, in case of an error */
21137 ** If zNum represents an integer that will fit in 32-bits, then set
21181 ** string is not an integer, just return 0.
21523 /* For following code (kept for historical record only) shows an
21602 ** Translate a single byte of Hex into an integer.
21641 ** Log an error that is an API call on a connection pointer that should
21664 ** used as an argument to sqlite3_errmsg() or sqlite3_close().
21700 ** Return 0 on success. Or if the operation would have resulted in an
21932 /* This function (for internal use only) locates an element in an
21996 /* Attempt to locate an element of the hash table pH with a key
22016 /* Insert an element into the hash table pH. The key is pKey,nKey
22279 ** OS layer for an embedded system, if you use this file as an example,
22629 ** Truncate an open file to a specified size
22639 ** file so that it consists of an integer number of chunks (i.e. the
22765 APIRET res = NO_ERROR; /* Result of an OS/2 lock call */
22847 /* Acquire an EXCLUSIVE lock
23228 ** Structure used internally by this VFS to record the state of an
23322 ** Find an os2ShmNode in global list or allocate a new one, if not found.
23499 ** If an error occurs, an error code is returned and *pp is set to NULL.
23705 ** If any sibling already holds an exclusive lock, go ahead and return
23787 ** This vector defines all the methods that can operate on an
23831 /* It's odd to simulate an io-error here, but really this is just
24094 /* For an SQLITE_ACCESS_EXISTS query, treat a zero-length file
24148 * symbol with an extra underscore, that might be needed depending
24299 ** strerror_r() on unix). After an error is returned by an OS
24313 ** Not supplying an error message will have no adverse effect
24314 ** on SQLite. It is fine to have an implementation that never
24315 ** returns an error message:
24322 ** However if an error message is supplied, it will be incorporated
24466 ** on an older machine (ex: RedHat 6.0). If you compile on RedHat 7.2
24565 ** structure are used to store the file descriptor while waiting for an
25294 ** A pointer to an instance of the following structure can be used as a
25378 /* Search for an existing entry that matching the canonical name.
25440 ** an exclusive lock on fd1, then try to get an exclusive lock
25465 ** The sqlite3_file structure for POSIX is no longer just an integer file
25473 ** file is unlocked. cnt==-1 means the file has an exclusive lock.
25479 ** a locked and an unlocked state.
25487 ** When an attempt is made to close an unixFile, if there are
25534 ** structure contains a pointer to an instance of this object and this
25567 ** It is invoked after an error occurs in an OS function and errno has been
25602 ** strerror_r(), which always writes an error message into aErr[].
25605 ** available, the error message will often be an empty string. Not a
25642 ** So we don't even try to recover from an EINTR. Just log the error
25700 ** return value might be uninitialized if an error occurs.
25705 ** Return an appropriate error code.
25733 /* On OS X on an msdos filesystem, the inode number is reported
25738 ** an ASCII 'S' character which also happens to be the first byte
25792 ** is set to SQLITE_OK unless an I/O error occurs during lock checking.
25839 ** ever obtained is an exclusive lock, and it is obtained exactly once
26006 ** acquiring an EXCLUSIVE lock. For the SHARED lock, the PENDING will
26064 /* We are trying for an exclusive lock but another thread in this
26146 ** If handleNFSUnlock is true, then on downgrading an EXCLUSIVE_LOCK to SHARED
26260 ** process is holding an incompatible lock. If it does, this
26264 ** an assert to fail). */
26284 /* Decrement the shared lock counter. Release the lock using an
26450 ** Nevertheless, a dotlock is an appropriate locking mode for use if no
26455 ** The existance of a lock file implies an EXCLUSIVE lock. All other lock
26469 ** is set to SQLITE_OK unless an I/O error occurs during lock checking.
26547 /* grab an exclusive lock */
26641 ** PENDING locks are the same thing as an EXCLUSIVE lock. SQLite
26668 ** is set to SQLITE_OK unless an I/O error occurs during lock checking.
26693 /* unlock failed with an error */
26765 /* grab an exclusive lock */
26809 /* shared can just be set because we always have an exclusive */
26858 ** is set to SQLITE_OK unless an I/O error occurs during lock checking.
26977 /* shared can just be set because we always have an exclusive */
27053 ** This is a utility for setting or clearing a bit-range lock on an
27102 ** is set to SQLITE_OK unless an I/O error occurs during lock checking.
27235 ** acquiring an EXCLUSIVE lock. For the SHARED lock, the PENDING will
27287 /* We are trying for an exclusive lock but another thread in this
27305 /* Acquire an EXCLUSIVE lock */
27424 /* Decrement the shared lock counter. Release the lock using an
27751 ** unix systems. The following procedure is an attempt to make
27757 ** enabled, however, since with SQLITE_NO_SYNC enabled, an OS crash
27769 ** as far as SQLite is concerned, an fdatasync() is always adequate.
27811 /* If the FULLFSYNC failed, fall back to attempting an fsync().
27814 ** isn't supported for this file system. So, attempt an fsync
27844 ** SQLITE_OK is returned. If an error occurs, either SQLITE_NOMEM
27845 ** or SQLITE_CANTOPEN is returned and *pFd is set to an undefined
27947 ** Truncate an open file to a specified size
27956 ** file so that it consists of an integer number of chunks (i.e. the
28040 ** or an error number on failure". See the manpage for details. */
28074 ** Information and control of an open file handle.
28160 ** Object used to represent an shared memory buffer.
28207 ** Structure used internally by this VFS to record the state of an
28349 ** Another approach to is to use files in /dev/shm or /dev/tmp or an
28358 ** option results in an incompatible build of SQLite; builds of SQLite
28369 ** that means that an exclusive lock is held on the database file and
28388 /* Check to see if a unixShmNode object already exists. Reuse an existing
28398 ** a new *-shm file is created, an attempt will be made to create it
28505 ** If an error occurs, an error code is returned and *pp is set to NULL.
28683 ** If any sibling already holds an exclusive lock, go ahead and return
29175 /* If an error occured in findInodeInfo(), close the file descriptor
29328 /* It's odd to simulate an io-error here, but really this is just
29366 ** Search for an unused file descriptor that was opened on the database
29384 /* Do not search for an unused file descriptor on vxworks. Not because
29387 ** not to risk breaking vxworks support for the sake of such an obscure
29393 ** almost certain that an open() call on the same path will also fail.
29394 ** For this reason, if an error occurs in the stat() call here, it is
29396 ** descriptor on the same path, fail, and return an error to SQLite.
29427 ** written to *pMode. If an IO error occurs, an SQLite error code is
29830 /* It's odd to simulate an io-error here, but really this is just
30085 ** shared range is taken for an EXCLUSIVE lock):
30151 ** by taking an sqlite-style shared lock on the conch file, reading the
30157 ** host ID and/or proxy path, then the lock is escalated to an exclusive
30172 ** The shared lock and an open file descriptor are maintained until
30450 ** Takes an open conch file, copies the contents to a new path and then moves
30643 do { /* in case we need to try again for an :auto: named lock file */
30695 /* We are trying for an exclusive lock but another thread in this
30941 ** Takes an already filled in unix file and alters it so all file locking
31103 ** is set to SQLITE_OK unless an I/O error occurs during lock checking.
31251 ** The following macro defines an initializer for an sqlite3_vfs object.
31267 ** database file and tries to choose an locking method appropriate for
31392 ** OS layer for an embedded system, if you use this file as an example,
31652 BOOL bExclusive; /* Indicates an exclusive lock has been obtained */
31783 ** Here is an interesting observation: Win95, Win98, and WinME lack
31849 ** Change the size of an existing memory allocation
31877 ** Return the size of an outstanding allocation, in bytes.
32031 ** Convert an ansi string to microsoft unicode, based on the
32183 ** This routine is invoked after an error occurs in an OS function.
32236 ** to give up with an error.
32451 /* Wanting an exclusive lock? */
32515 /* Releasing a reader lock or an exclusive lock */
32517 /* Did we have an exclusive lock? */
32615 ** whether an error has actually occured, it is also necessary to call
32631 ** It is reported that an attempt to close a handle might sometimes
32636 ** giving up and returning an error.
32763 ** Truncate an open file to a specified size
32775 ** file so that it consists of an integer number of chunks (i.e. the
33051 /* Acquire an EXCLUSIVE lock
33331 ** Structure used internally by this VFS to record the state of an
33491 /* Look to see if there is an existing winShmNode that can be used.
33669 ** If any sibling already holds an exclusive lock, go ahead and return
33743 ** If an error occurs, an error code is returned and *pp is set to NULL.
33880 ** This vector defines all the methods that can operate on an
33943 /* It's odd to simulate an io-error here, but really this is just
34233 ** up and returning an error.
34305 /* For an SQLITE_ACCESS_EXISTS query, treat a zero-length file
34391 /* It's odd to simulate an io-error here, but really this is just
34551 ** an Ansi string regardless of the _UNICODE setting */
34686 ** strerror_r() on unix). After an error is returned by an OS
34700 ** Not supplying an error message will have no adverse effect
34701 ** on SQLite. It is fine to have an implementation that never
34702 ** returns an error message:
34709 ** However if an error message is supplied, it will be incorporated
34778 ** This file implements an object that represents a fixed-length
34830 ** (an arbitrary prime)in the hash function provided
34838 ** A bitmap is an instance of the following structure.
34919 ** Set the i-th bit. Return 0 on success and an error code if
34924 ** that can go wrong with an insert, assuming p and i are valid.
35059 ** Let V[] be an array of unsigned characters sufficient to hold
35060 ** up to N bits. Let I be an integer between 0 and N. 0<=I<N.
35069 ** This routine runs an extensive test of the Bitvec code.
35071 ** The input is an array of integers that acts as a program
35094 ** an error is returned. If they are the same, zero is returned.
35192 ** A complete page cache is an instance of this structure.
35225 ** is not, either fail an assert or return zero. Otherwise, return
35301 ** being used for an in-memory database, this function is a no-op.
35721 ** Return the number of references to the page supplied as an argument.
35803 ** pages when they are under memory pressure. A PGroup is an instance of
35890 /* Each page cache is an instance of the following object. Every
35893 ** is an instance of this object.
35923 ** Each cache entry is represented by an instance of the following
35966 ** (2) even if an incorrect value is read, no great harm is done since this
35967 ** is really just an optimization. */
35983 ** an argument and returns a pointer to the associated block of szPage
36016 ** verb to sqlite3_config(). Parameter pBuf points to an allocation large
36084 ** Free an allocated buffer obtained from pcache1Alloc().
36350 ** Free an allocated buffer obtained from sqlite3PageMalloc().
36465 ** Remove the page supplied as an argument from the hash table
36653 ** For a non-purgeable cache (a cache used as the storage for an in-memory
36709 /* Step 1: Search the hash table for an existing entry. */
36724 ** local variable here. Delaying the initialization of pGroup is an
36812 /* It is an error to call this function if the page is already
36913 ** already provided an alternative.
37001 ** This module implements an object we call a "RowSet".
37004 ** are inserted into the RowSet in an arbitrary order. Inserts
37022 ** TEST checks to see if an element is already in the RowSet. SMALLEST
37026 ** allocated in chunks so most INSERTs do no allocation. There is an
37032 ** in the batch number. In other words, if an INSERT occurs between
37041 ** The cost of an INSERT is roughly constant. (Sometime new memory
37042 ** has to be allocated on an INSERT.) The cost of a TEST with a new
37048 ** There is an added cost of O(N) when switching between TEST and
37065 ** Each entry in a RowSet is an instance of the following object.
37085 ** A RowSet in an instance of the following structure.
37108 ** an assertion fault occurs.
37110 ** If N is larger than the minimum, use the surplus as an initial
37290 ** list contains too few elements, then construct an incomplete tree
37492 ** at an instant in time. sqlite3WalOpenSnapshot gets a read lock and
37513 /* Return an integer that records the current (uncommitted) write
37544 /* Tell the wal layer that an EXCLUSIVE lock has been obtained (or released)
37599 ** (3) Writes to the database file are an integer multiple of the page size
37603 ** an integer multiple of the page size in length or are taken from the
37664 ** associated file-descriptor is returned. FILEHANDLEID() takes an sqlite3_file
37757 ** If the connection is running with locking_mode=exclusive, an attempt
37758 ** is made to obtain an EXCLUSIVE lock on the database file.
37813 ** commit the transaction. If an error did occur, the caller will need
37818 ** The ERROR state is entered when an IO or disk-full error (including
37826 ** For example, if an IO error occurs while performing a rollback,
37827 ** the contents of the page-cache may be left in an inconsistent state.
37833 ** instead of READER following such an error.
37836 ** to read or write data returns an error. Eventually, once all
37864 ** automatically attempt a rollback, as it assumes that an error in a
37865 ** read-only statement cannot leave the pager in an internally inconsistent
37871 ** * The pager is not an in-memory pager.
37902 ** If the VFS xLock() or xUnlock() returns an error other than SQLITE_BUSY
37911 ** This is usually safe. If an xUnlock fails or appears to fail, there may
37919 ** fails at this point and the pager is left holding an EXCLUSIVE lock, this
37925 ** return true because the caller itself is holding an EXCLUSIVE lock (but
37927 ** a hot-journal may be mistaken for a journal being created by an active
37936 ** lock. Instead, it assumes a hot-journal exists and obtains an EXCLUSIVE
37963 ** such a system. This is currently an undocumented limit.
37993 ** A open page cache is an instance of struct Pager. A description of
38023 ** can only happen if an exclusive lock is held on the database file.
38024 ** It is cleared (set to false) whenever an exclusive lock is
38054 ** by PagerCommitPhaseTwo or PagerRollback). If an IO error prevents the
38079 ** is opened as an in-memory journal file. If false, then in-memory
38094 ** is not an integer multiple of the page-size, the value stored in
38251 ** file after power is restored. If an attempt is then made
38253 ** sanity checking data is an attempt to discover the garbage in the
38263 ** garbage data came from an obsolete journal file, the checksums might
38284 ** The macro MEMDB is true if we are dealing with an in-memory database.
38353 ** as if it has an exclusive lock on the database file. It never updates
38365 /* Check that MEMDB implies noSync. And an in-memory journal. Since
38366 ** this means an in-memory pager performs no IO at all, it cannot encounter
38370 ** is therefore not possible for an in-memory pager to enter the ERROR
38471 ** containing the state of the Pager object passed as an argument. This
38472 ** is intended to be used within debuggers. For example, as an alternative
38550 ** that is read in *pRes. Return SQLITE_OK if everything worked, or an
38572 ** on success or an error code is something goes wrong.
38587 ** UNKNOWN_LOCK for an explanation of this.
38613 ** See the comment above the #define of UNKNOWN_LOCK for an explanation
38640 ** an error to call this function if pPager is opened on an in-memory
38696 ** The CHECK_PAGE macro takes a PgHdr* as an argument. If SQLITE_CHECK_PAGES
38697 ** is defined, and NDEBUG is not defined, an assert() statement checks
38736 ** If an error occurs while reading from the journal file, an SQLite
38822 ** If an IO error occurs, abandon processing and return the IO error code.
38990 ** cannot be read from the journal file an error code is returned.
39017 ** SQLITE_DONE. If an IO error occurs, return an error code. Otherwise,
39032 ** of the transaction. Return an error code if anything goes wrong.
39152 ** an error occurs, return the error code to the caller.
39299 ** above the #define for UNKNOWN_LOCK for an explanation of why this
39335 ** This function is called whenever an IOERR or FULL error that requires
39371 ** after rollback of a hot-journal, or if an error occurs while opening
39389 ** Journal file descriptor is simply closed. This destroys an
39412 ** SQLITE_OK is returned if no error occurs. If an error occurs during
39425 /* Do nothing if the pager does not have an open write transaction
39433 ** 2. If a connection with locking_mode=exclusive holding an EXCLUSIVE
39469 ** the database file, it will do so using an in-memory journal.
39531 ** If the pager has not already entered the ERROR state, but an IO or
39559 ** Each byte is interpreted as an 8-bit unsigned integer.
39561 ** Changing the formula used to compute this checksum results in an
39615 ** and played back, then SQLITE_OK is returned. If an IO error occurs
39629 ** allocated by this function. If this is the case and an allocation fails,
39659 ** is in state OPEN and holds an EXCLUSIVE lock. Hot-journal rollback
39668 ** file. Return an error code to the caller if an IO error occurs.
39716 ** and a page is moved during an incremental vacuum then the page may
39735 ** database file without an entry in the rollback journal that can
39790 ** The solution is to add an in-memory page to the cache containing
39809 ** of an internal error resulting in an automatic call to
39824 ** back as part of a savepoint (or statement) rollback from an
39887 ** If an IO error within this function, an error code is returned. This
39888 ** function allocates memory by calling sqlite3Malloc(). If an allocation
40004 ** If successful, return SQLITE_OK. If an IO error occurs while modifying
40097 ** Each entry in the journal is an instance of the 8th item.
40120 ** If an I/O or malloc() error occurs, the journal-file is not deleted
40121 ** and an error code is returned.
40155 ** TODO: Technically the following is an error because it assumes that
40174 ** pager_playback_one_page() call returns SQLITE_DONE or an IO error
40278 /* If this playback is happening automatically as a result of an IO or
40328 ** If an IO error occurs, then the IO error is returned to the caller.
40368 ** For an encrypted database, the situation is more complex: bytes
40394 ** This is an unconditional update. See also the pager_incr_changecounter()
40423 ** return an SQLite error code. Otherwise, SQLITE_OK.
40582 ** in pages is stored in *pnPage. Otherwise, an error code (perhaps
40600 ** of the database file is not an integer multiple of the page-size,
40642 ** Return SQLITE_OK or an error code.
40645 ** function. Because an EXCLUSIVE lock on the db file is required to delete
40647 ** between the xAccess() below and an xDelete() being executed by some
40844 ** that an inopertune power failure could leave the journal
40861 ** an ordinary commit in NORMAL mode with WAL. FULL means that the WAL
40867 ** using fcntl(F_FULLFSYNC). SQLITE_SYNC_NORMAL means to do an
40949 ** or when trying to upgrade from a RESERVED lock to an EXCLUSIVE
40980 ** one of SQLITE_IOERR, an SQLITE_IOERR_xxx sub-code or SQLITE_FULL).
40989 ** * the database is either not an in-memory database or it is
40990 ** an in-memory database that currently consists of zero pages.
41011 ** At one point this function returned an error if the pager was in
41126 ** the Pager object. There has not been an opportunity to transition
41165 ** Return SQLITE_OK on success and an error code if we cannot obtain
41248 ** an SQLite error code.
41270 ** This function always succeeds. If a transaction is active an attempt
41271 ** is made to roll it back. If an error occurs during the rollback
41292 ** If this is not done, then an unsynced portion of the open journal
41296 ** If an error occurs while trying to sync the journal, shift the pager
41352 ** * If the journal file is an in-memory journal file, no action need
41375 ** page currently held in memory before returning SQLITE_OK. If an IO
41397 /* This block deals with an obscure problem. If the last connection
41493 ** be NULL, representing an empty list. In this case this function is
41498 ** is upgraded to an EXCLUSIVE lock. If the lock cannot be obtained,
41517 ** If everything is successful, SQLITE_OK is returned. If an IO error
41518 ** occurs, an IO error code is returned. Or, if the EXCLUSIVE lock cannot
41629 ** This function returns SQLITE_OK if everything is successful, an IO
41675 ** (cast as a void*). The pager is always 'purgeable' (not an in-memory
41686 ** SQLITE_OK returned. If an IO error occurs while trying to make the
41706 ** Spilling is also prohibited when in an error state since that could
41797 ** This can be used to implement an in-memory database.
41812 ** the new pager object. If an error occurs, *ppPager is set to NULL
41830 int memDb = 0; /* True if this is an in-memory file */
41844 ** is the maximum space required for an in-memory journal file handle
41856 /* Set the output variable to NULL in case an error occurs. */
41866 /* Compute and store the full pathname in an allocated buffer pointed
42003 ** This branch is also run for an in-memory database. An in-memory
42005 ** disk and uses an in-memory rollback journal.
42022 /* If an error occurred in either of the blocks above, free the
42104 ** exists, that is probably an old journal left over from a prior
42118 ** set to 0 and SQLITE_OK returned. If an IO error occurs while trying
42193 ** its has a zero header, that might be due to an I/O error, or
42198 ** with it under an EXCLUSIVE lock where we do not need to
42221 ** on the database file), then an attempt is made to obtain a
42231 ** then an attempt is made to clear the error state by discarding
42235 ** If everything is successful, SQLITE_OK is returned. If an IO error
42276 /* Get an EXCLUSIVE lock on the database file. At this point it is
42330 ** an inconsistent cache. Sync the hot journal before playing
42347 /* This branch is taken if an error occurs while trying to open
42348 ** or roll back a hot-journal while holding an EXCLUSIVE lock. The
42352 ** UNKNOWN_LOCK above for an explanation).
42389 ** detected. The chance of an undetected change is so small that
42464 ** choose not to allocate a new page object and may reuse an existing
42496 ** an appropriate error code is returned and *ppPage is set to NULL.
42502 ** has to go to disk, and could also playback an old journal if necessary.
42522 /* If the pager is in the error state, return an error immediately.
42531 /* Either the call to sqlite3PcacheFetch() returned an error or the
42541 /* In this case the pcache already contains an initialized copy of
42665 ** an IO error code if opening or writing the journal file fails.
42677 ** an error state. */
42739 ** an EXCLUSIVE lock. If such a lock is already held, no locking
42743 ** within this transaction will be opened as an in-memory file. This
42747 ** sub-journal is implemented in-memory if pPager is an in-memory database,
42761 /* If the pager is configured to use locking_mode=exclusive, and an
42773 ** PAGER_RESERVED state. Otherwise, return an error code to the caller.
42780 ** is true, then immediately upgrade this to an EXCLUSIVE lock. The
42794 ** when it has an open transaction, but never to DBMOD or FINISHED.
42838 /* If an error has been previously detected, report the same error
42854 ** an error might occur and the pager would end up in WRITER_LOCKED state
42872 /* The transaction journal now exists and we have a RESERVED or an
42892 /* Even if an IO or diskfull error occurs while journalling the
42896 ** in the database file. And if an IO error occurs while doing so,
42965 ** If an error occurs, SQLITE_NOMEM or an IO error code is returned
42995 ** an integer power of 2. It sets variable pg1 to the identifier
43102 ** See also the pager_write_changecounter() routine that does an
43113 ** by writing an updated version of page 1 using a call to the
43191 ** function returns SQLITE_OK. Otherwise, an IO error code is returned.
43208 ** Otherwise, if the connection does not already have an EXCLUSIVE lock on
43209 ** the database file, an attempt is made to obtain one.
43213 ** Otherwise, either SQLITE_BUSY or an SQLITE_IOERR_XXX error code is
43248 ** passed to an sqlite3PagerCommitPhaseOne() call.
43279 /* If this is an in-memory db, or no pages have been written to, or this
43456 ** If an error occurs, an IO error code is returned and the pager
43502 ** state if an error occurs.
43560 /* If an error occurs during a ROLLBACK, we can no longer trust the pager
43622 ** Return true if this is an in-memory pager.
43634 ** If a memory allocation fails, SQLITE_NOMEM is returned. If an error
43635 ** occurs while opening the sub-journal file, then an IO error code is
43709 ** In any case, all savepoints with an index greater than iSavepoint
43714 ** or an IO error code if an IO error occurs while rolling back a
43741 /* Only truncate if it is an in-memory sub-journal. */
43848 ** This function may return SQLITE_NOMEM or an IO error code if an error
43863 /* In order to be able to rollback, an in-memory database must journal
43924 /* Do not discard pages from an in-memory database since we might
43936 /* For an in-memory database, make sure the original page continues
44062 /* Do allow the journalmode of an in-memory database to be set to
44094 ** here is an optimization only.
44167 ** uses it opaquely as an argument to sqlite3BackupRestart() and
44208 ** Attempt to take an exclusive lock on the database file. If a PENDING lock
44227 ** exclusive-locking mode when this function is called, take an EXCLUSIVE
44247 ** (e.g. due to malloc() failure), return an error code.
44265 ** file (not a temp file or an in-memory database), and the WAL file
44266 ** is not already open, make an attempt to open it now. If successful,
44267 ** return SQLITE_OK. If an error occurs or the VFS used by the pager does
44268 ** not support the xShmXXX() methods, return an error code. *pbOpen is
44309 ** Before closing the log file, this function attempts to take an
44310 ** EXCLUSIVE lock on the database file. If this cannot be obtained, an
44336 /* Checkpoint and close the log. Because an EXCLUSIVE lock is held on
44394 ** transferred back into the database file in an operation called a
44446 ** an even number of unsigned 32-bit integers: x[0] through x[N]. The
44509 ** use an architecture-specific format; it does not have to be cross-platform.
44518 ** The wal-index consists of a header region, followed by an one or
44533 ** that allows readers to query an index block for a specific page number.
44534 ** The page-mapping is an array of HASHTABLE_NPAGE (or HASHTABLE_NPAGE_ONE
44558 ** prior to finding a match is 1. Each entry of the hash table is an
44559 ** 1-based index of an entry in the mapping section of the same
44573 ** reached) until an unused hash slot is found. Let the first unused slot
44576 ** the search is guaranteed to eventually hit an unused entry. Let
44602 ** slots in the hash table and so the first reader will get an answer as
44706 ** is holding an exclusive lock on WAL_READ_LOCK(K). Thus, the value of
44714 ** largest value and will increase an unused aReadMark[] to mxFrame if there
44715 ** is not already an aReadMark[] equal to mxFrame. The exception to the
44760 ** file are calculated by treating all data as an array of 32-bit
44776 ** An open write-ahead log file is represented by an instance of the
44817 ** an array of HASHTABLE_NSLOT elements of the following type.
44822 ** This structure is used to implement an iterator that loops through
44831 ** walIteratorNext() - Step an iterator,
44832 ** walIteratorFree() - Free an iterator.
44878 ** page and SQLITE_OK is returned. If an error (an OOM or VFS error) occurs,
44879 ** then an SQLite error code is returned and *ppPage is set to 0.
44949 ** Generate or extend an 8 byte checksum based on the data in
45112 ** a part of an ordinary build.
45331 ** Set an entry in the wal-index that will map database page number
45416 ** This routine first tries to establish an exclusive lock on the
45430 /* Obtain an exclusive lock on all byte in the locking range not already
45565 /* If more than one frame was recovered from the log file, report an
45584 ** Close an open wal-index.
45610 ** *ppWal is set to point to a new WAL handle. If an error occurs,
45611 ** an SQLite error code is returned and *ppWal is left unmodified.
45640 /* Allocate an instance of struct Wal to return. */
45857 ** Free an iterator allocated by walIteratorInit().
45869 ** return SQLITE_OK. Otherwise, return an error code. If this routine
45870 ** returns an error, the value of *pp is undefined.
45981 ** in response to an sqlite3_wal_checkpoint() request or the equivalent.
46130 /* If this is an SQLITE_CHECKPOINT_RESTART operation, and the entire wal
46166 /* If an EXCLUSIVE lock can be obtained on the database file (using the
46228 ** meaning it is possible that an inconsistent snapshot is read
46274 ** Otherwise an SQLite error code.
46282 ** wal-index header) is mapped. Return early if an error occurs here.
46348 ** On success return SQLITE_OK. On a permanent failure (such an
46349 ** I/O error or an SQLITE_BUSY because another process is running
46356 ** wal-index header has changed, *pChanged is set to 1 (as an indication
46364 ** race conditions after multiple WAL_RETRY returns, and after an excessive
46390 ** so it takes care to hold an exclusive lock on the corresponding
46414 ** is more of a scheduler yield than an actual delay. But on the 10th
46415 ** an subsequent retries, the delays start becoming longer and longer,
46508 /* There was once an "if" here. The extra "{" is to preserve indentation. */
46551 ** log-wrap (either of which would require an exclusive lock on
46632 ** in this case as an optimization. Likewise, if pWal->readLock==0,
46641 /* Search the hash table or tables for an entry matching page number
46807 ** Otherwise, if the callback function does not return an error, this
46827 ** (b) has an outstanding reference, then xUndo is either a no-op
46846 ** Argument aWalData must point to an array of WAL_SAVEPOINT_NDATA u32
46861 ** the values in the aWalData[] array. aWalData must point to an array
46900 ** if an error occurs.
47284 ** upgrade to exclusive-mode following such an error.
47383 ** bytes are stored on overflow pages. The payload for an entry
47393 ** Each page can be either a btree page, a freelist page, an overflow
47439 ** payload is spilled to overflow pages. Once an overflow page is allocated,
47602 ** As each page of the file is loaded into memory, an instance of the following
47665 ** A database connection contains a pointer to an instance of
47778 u8 isExclusive; /* True if pWriter has an EXCLUSIVE lock on the db */
47802 ** Maximum depth of an SQLite B-Tree structure. Any B-Tree deeper than
47843 u8 isIncrblobHandle; /* True if this cursor is an incr. io handle */
47869 ** A unrecoverable error (an I/O error or a malloc failure) has occurred
47871 ** cursor. The error has left the cache in an inconsistent state.
47921 ** PTRMAP_FREEPAGE: The database page is an unused (free) page. The page-number
47952 ** within an expression that is an argument to another macro
48274 ** Including a description of file format and an overview of operation.
48295 ** Extract a 2-byte big-endian integer from an array of unsigned bytes.
48359 **** This function is only used as part of an assert() statement. ***
48369 ** When writing to an index that resides in a sharable database, the
48383 int isIndex, /* True if iRoot is the root of an index b-tree */
48400 /* If the client is reading or writing an index and the schema is
48490 /* If requesting a write-lock, then the Btree must have an open write
48492 ** must be an open write transaction on the file itself.
48502 /* If some other connection is holding an exclusive lock, the
48573 /* First search the list for an existing lock on this table. */
48613 ** This function assumes that Btree p has an open read or write
48754 ** The BtShared.pHasContent bitvec exists to work around an obscure
48837 /* If this is an intKey table, then the above call to BtreeKeySize()
48839 ** all that is required. Otherwise, if pCur is not open on an intKey
48910 const void *pKey, /* Packed key if the btree is an index */
48971 ** This routine returns an error code if something goes wrong. The
49015 ** Write an entry into the pointer map.
49021 ** a no-op. If an error occurs, the appropriate error code is written
49070 ** Read an entry from the pointer map.
49202 ** way will result in an incompatible file format.
49245 ** cell. If SQLITE_DEBUG is defined, an assert() at the bottom of
49302 ** to an overflow page, insert an entry into the pointer-map
49406 ** an error code (usually SQLITE_CORRUPT).
49856 ** If an error occurs, then the value *ppPage is set to is undefined. It
49857 ** may remain unchanged, or it may be set to an invalid value.
49915 /* pPage might not be a btree page; it might be an overflow page
49940 ** then an ephemeral database is created. The ephemeral database might
49945 ** If zFilename is ":memory:" then an in-memory database is created
49955 ** and we are in shared cache mode, then the open will fail with an
49975 /* True if opening an ephemeral, temporary database */
49978 /* Set the variable isMemdb to true for an in-memory database, or
50021 ** If this Btree is a candidate for shared cache, try to find an
50115 /* If the magic name ":memory:" will create an in-memory database, then
50206 ** default value. Except, when opening on an existing shared pager-cache,
50261 ** Make sure pBt->pTmpSpace points to an allocation of
50279 ** Close an open database and invalidate all cursors.
50346 ** an abrupt power failure when synchronous is off, the database
50347 ** could be left in an inconsistent and unrecoverable state.
50679 ** 17 bytes long, 0 to N bytes of payload, and an optional 4 byte overflow
50718 ** If pBt points to an empty file then convert that empty file
50782 ** If an initial attempt to acquire the lock fails because of lock contention
50899 /* If the db-size header field is incorrect (as it may be if an old
50980 ** PTRMAP_OVERFLOW1: pPage is a btree-page. The pointer points at an overflow
50983 ** PTRMAP_OVERFLOW2: pPage is an overflow-page. The pointer points at the next
51077 ** If pDbPage is an overflow page, then the first 4 bytes may store a
51123 ** Perform a single step of an incremental-vacuum. If successful,
51133 ** it returns SQLITE_DONE or an error, and that nFin is the
51243 ** It performs a single unit of work towards an incremental vacuum.
51247 ** SQLITE_OK is returned. Otherwise an SQLite error code.
51271 ** is commited for an auto-vacuum database.
51434 ** Normally, if an error occurs while the pager layer is attempting to
51435 ** finalize the underlying journal file, this function returns an error and
51440 ** functions return code. So, even if an error occurs in the pager layer,
51547 ** in an error.
51562 ** trying to save cursor positions. If this is an automatic rollback (as
51613 ** A statement sub-transaction is implemented as an anonymous savepoint. The
51630 ** an index greater than all savepoints created explicitly using
51679 ** the caller is assumed to have an open write transaction.
51697 ** 4: There must be an active transaction.
51799 ** The cache is initialized to zero, indicating an invalid cache.
51947 ** to return an integer result code for historical reasons.
51958 ** Given the page number of an overflow page in the database (parameter
51963 ** If an error occurs an SQLite error code is returned. Otherwise:
52042 ** SQLITE_OK is returned on success, otherwise an error code.
52084 ** Once an overflow page-list cache has been allocated, it may be
52087 ** mode, the following events may invalidate an overflow page-list cache.
52091 ** * Creating a table (may require moving an overflow page).
52119 /* Trying to read or write past the end of the data is an error */
52233 ** Return SQLITE_OK on success or an error code if anything goes
52250 ** Return SQLITE_OK on success or an error code if anything goes
52282 ** This routine is an optimization. It is common for the entire key
52371 ** if an intkey page appears to be the parent of a non-intkey page, or
52402 ** Page pParent is an internal (non-leaf) tree page. This function
52462 ** structure the flags byte is set to 0x02 or 0x0A, indicating an index
52501 ** expected to open it on an index b-tree. Otherwise, if pKeyInfo is
52503 ** return an SQLITE_CORRUPT error. */
52652 /* Move the cursor so that it points to an entry near the key
52659 ** If an exact match is not found, then the cursor is always
52661 ** were present. The cursor might point to an entry that comes
52669 ** *pRes<0 The cursor is left pointing at an entry that
52673 ** *pRes==0 The cursor is left pointing at an entry that
52676 ** *pRes>0 The cursor is left pointing at an entry that
52768 ** the maximum number of record bytes stored on an index B-Tree
52858 ** Return TRUE if the cursor is not pointing at an entry of the table.
52866 ** have been deleted? This API will need to change to return an error code
53010 ** an error. *ppPage and *pPgno are undefined in the event of an error.
53011 ** Do not invoke sqlite3PagerUnref() on *ppPage if an error is returned.
53014 ** locate a page close to the page number "nearby". This can be used in an
53338 /* If the database supports auto-vacuum, write an entry in the pointer-map
53457 /* 0 is not a legal page number and page 1 cannot be an
53470 /* There is no reason any cursor should have an outstanding reference
53471 ** to an overflow page belonging to a cell that is being deleted/updated.
53473 ** must not really be an overflow page and the database must be corrupt.
53584 ** overflow page is being allocated, add an entry to the pointer-map
53718 ** nSkip is non-zero, then pCell may not point to an invalid memory location
53748 ** malformed cell from a leaf page to an interior page, if the cell size
53799 /* The cell may contain a pointer to an overflow page. If so, write
53921 /* If this is an auto-vacuum database, update the pointer map
53923 ** cell on the page to an overflow page. If either of these
53927 ** be marked as dirty. Returning an error code will cause a
54062 /* If this is an auto-vacuum database, update the pointer-map entries
54082 ** one or two in an effort to keep pages nearly full but not over full.
54104 ** size of a cell stored within an internal node is always less than 1/4
54383 ** This adjustment is more than an optimization. The packing above might
54555 ** Note that this can never happen in an SQLite data file, as all
54590 ** If this is an auto-vacuum database, the call to copyNodeContent()
54647 ** sibling page j. If the siblings are not leaf pages of an
54670 ** sibling page k. If the siblings are not leaf pages of an
54679 ** an overflow cell, or if the cell was located on a different sibling
54703 ** cause an assert() statement to fail. */
54735 ** page is then overwritten to make it an empty page with the right-child
54745 ** to call releasePage() on *ppChild exactly once. If an error occurs,
54746 ** an error code is returned and *ppChild is set to 0.
54921 ** For an INTKEY table, only the nKey value of the key is used. pKey is
54927 ** number if pCur points at an entry that is smaller than (pKey, nKey), or
54928 ** a positive value if pCur points at an etry that is larger than
54942 int appendBias, /* True if this is likely an append */
54965 ** expecting an index b-tree, then the caller should be inserting blob
54966 ** keys with no associated data. If the cursor was opened expecting an
54971 /* If this is an insert into a table b-tree, invalidate any incrblob
55037 /* If no error has occured and pPage has an overflow cell, call balance()
55049 ** multiple records into an intkey b-tree using a single cursor (as can
55050 ** happen while processing an "INSERT INTO ... SELECT" statement), it
55053 ** entry in the table, and the next row inserted has an integer key
55140 ** by the child-page of the cell that was just deleted from an internal
55167 ** Otherwise, if the entry deleted was on an internal node page, then
55223 /* Creating a new table may probably require moving an existing database
55225 ** out to be an overflow page, delete all overflow page-map caches
55257 ** the new table (assuming an error did not occur). But we were
55403 ** If pnChange is not NULL, then table iTable must be an intkey table. The
55457 ** root page. If an open cursor was using this page a problem would
55582 /* If auto-vacuum is disabled in this build and this is an auto-vacuum
55625 ** Otherwise, if an error is encountered (i.e. an IO error or database
55626 ** corruption) an SQLite error code is returned.
55638 /* Unless an error occurs, the following loop runs one iteration for each
55645 /* If this is a leaf page or the tree is not an int-key tree, then
55689 /* An error has occurred. Return an error code. */
55734 ** reference to the page, add an error message to pCheck->zErrMsg.
55756 ** page iParent, pointer type ptrType. If not, append an error message
55786 ** Check the integrity of the freelist or of an overflow page list.
56088 ** an array of pages numbers were each page number is the root page of
56095 ** allocation errors, an error message held in memory obtained from
56180 ** This is an internal consistency check; an integrity check
56241 ** Return SQLITE_LOCKED if this or any other connection has an open
56310 ** btree as the argument handle holds an exclusive lock on the
56351 ** Argument pCsr must be a cursor opened for writing on an
56380 ** (e) the cursor points at a valid row of an intKey table.
56527 ** a NULL pointer and write an error message to pErrorDb.
56530 ** function. If an error occurs while doing so, return 0 and write an
56576 ** Create an sqlite3_backup process to copy the contents of zSrcDb from
56580 ** If an error occurs, NULL is returned and an error code and error message
56629 /* One (or both) of the named databases did not exist or an OOM
56648 ** Argument rc is an SQLite error code. Return true if this error is
56680 /* Catch the case where the destination is an in-memory database and the
56743 ** Return SQLITE_OK if everything is successful, or an SQLite error
56744 ** code if an error occurs.
56987 ** Release all resources associated with an sqlite3_backup* handle.
57089 ** detects that the database has been modified by an external database
57121 /* Set up an sqlite3_backup object. sqlite3_backup.pDestDb must be set
57135 ** within a single call (unless an error occurs). The assert() statement
57137 ** or an error code.
57167 ** stores a single value in the VDBE. Mem is an opaque structure visible
57179 ** If pMem is an object with a valid string representation, this routine
57295 ** If the given Mem* has a zero-filled tail, turn it into an ordinary
57352 ** user and the later is an internal programming error.
57391 ** Memory cell pMem contains the context of an aggregate function.
57395 ** Return SQLITE_ERROR if the finalizer reports an error. SQLITE_OK
57420 ** invoking an external callback, free it now. Calling this function
57441 ** Release any memory held by the Mem. This may leave the Mem in an
57459 ** there are reports that windows throws an expection
57484 ** a very large positive number to an integer results in a very large
57496 ** at representing the value that *pMem describes as an integer.
57497 ** If pMem is an integer, then the value is exact. If pMem is
57499 ** If pMem is a string or blob, then we make an attempt to convert
57500 ** it into a integer and return that. If pMem represents an
57501 ** an SQL-NULL value, return 0.
57527 ** double. If pMem is already a double or an integer, return its
57561 /* Only mark the value as an integer if
57697 ** Delete any previous value and set the value of pMem to be an
57761 ** Make an shallow copy of pFrom into pTo. Prior contents of
57804 ** pFrom contains an SQL NULL when this routine returns.
57847 /* If z is a NULL pointer, set pMem to contain an SQL NULL. */
58043 ** to read from the disk) then the pMem is left in an inconsistent state.
58099 ** If that is the case, then the result must be aligned on an even byte
58269 ** Change the string value of an sqlite3_value object
58282 ** Free an sqlite3_value object
58320 ** a VDBE (or an "sqlite3_stmt" as it is known to the outside world.) Prior
58411 ** If an out-of-memory error occurs while resizing the array, return
58439 ** Use the sqlite3VdbeResolveLabel() function to fix an address and
58486 ** Add an opcode that includes the p4 value as a pointer.
58503 ** Add an OP_ParseSchema opcode. This routine is broken out from
58517 ** Add an opcode that includes the p4 value as an integer.
58525 int p4 /* The P4 operand as an integer */
58533 ** Create a new symbolic label for an instruction that has yet to be
58535 ** label can be used as the P2 value of an operation. Later, when
58655 ** throw an ABORT exception (causing the statement, but not entire transaction
58666 ** Then check that the value of Parse.mayAbort is true if an
58669 ** part of an assert statement in the compiler. Similar to:
58712 ** to an OP_Function, OP_AggStep or OP_VFilter opcode. This is used by
59036 /* Note: this cast is safe, because the origin data point was an int
59133 ** an OP_Trace instruction is always inserted by sqlite3VdbeGet() as soon as
59161 ** Compute a string that describes the P4 parameter for an opcode.
59287 ** that may be accessed by the VM passed as an argument. In doing so it also
59368 ** Release an array of N Mem elements
59384 /* This block is really an inlined version of sqlite3VdbeMemRelease()
59479 ** commandeer the 9th cell to use as storage for an array of pointers
59536 /* When an OP_Program opcode is encounter (the only opcode that has
59641 ** Print an IOTRACE message showing SQL content.
59761 ** the Vdbe becomes an independent entity and the Parse object can be
59804 ** an array to marshal SQL function arguments in.
59978 ** be called on an SQL statement before sqlite3_step().
60038 int nTrans = 0; /* Number of databases with an active write-transaction */
60052 ** required, as an xSync() callback may add an attached database
60060 ** one database file has an open write transaction, a master journal
60061 ** file is required for an atomic commit.
60103 ** If one of the BtreeCommitPhaseOne() calls fails, this indicates an
60157 ** master journal file. If an error occurs at this point close
60199 ** an error occurs here, do not delete the master journal file.
60236 ** may be lying around. Returning an error code won't help matters.
60260 ** This is an internal self-check only - it is not an essential processing
60318 ** If an IO error occurs, an SQLITE_IOERR_XXX error code is returned.
60327 ** is that an IO error may have occured, causing an emergency rollback.
60377 ** handle associated with the VM passed as an argument is about to be
60383 ** an error message to it. Then return SQLITE_ERROR.
60407 ** Return an error code. If the commit could not complete because of
60426 ** Then the internal cache might have been left in an inconsistent
60463 ** file as part of an effort to free up cache space (see function
60507 ** or hit an 'OR FAIL' constraint and there are no deferred foreign
60541 ** do so. If this operation returns an error, and the current statement
60560 /* If this was an INSERT, UPDATE or DELETE and no statement transaction
60632 /* If the VM did not run to completion or if it encountered an
60701 ** Clean up and delete a VDBE after execution. Return an integer which is
60760 ** Delete an entire VDBE.
60783 ** was last positioned. Return an error code if an OOM fault or I/O error
60834 ** 'serial-type' and a blob of data. The serial type is an 8-byte unsigned
60837 ** In an SQLite index record, the serial type is stored directly before
60922 ** If we are on an architecture with mixed-endian floating
60929 ** on ARM7 is an issue with GCC, not with the ARM7 chip. It seems
60937 ** Developers using SQLite on an ARM7 should compile and run their
61136 ** This routine is used to allocate sufficient space for an UnpackedRecord
61147 ** If an OOM error occurs, NULL is returned.
61238 ** an index key, and thus ends with a rowid value. The last byte
61347 ** pCur points at an index entry created using the OP_MakeRecord opcode.
61349 ** Return SQLITE_OK if everything works, or an error code otherwise.
61389 /* The last field of the index should be an integer - the ROWID.
61390 ** Verify that the last entry really is an integer. */
61489 ** sequences, or changing an authorization function are the types of
61507 ** Return a pointer to an sqlite3_value structure containing the value bound
61508 ** parameter iVar of VM v. Except, if the value is an SQL NULL, return
61565 ** Return TRUE (non-zero) of the statement supplied as an argument needs
61569 ** collating sequences are registered or if an authorizer function is
61580 ** an error and return true if it has been finalized (or is otherwise
61602 ** the sqlite3_compile() routine. The integer returned is an SQLITE_
61634 ** Terminate the current execution of an SQL statement and reset it
61839 /* Force an SQLITE_TOOBIG error. */
61878 ** statement is completely executed or an error occurs.
61895 ** This "automatic-reset" change is not technically an incompatibility,
61896 ** since any application that receives an SQLITE_MISUSE is broken by
61997 /* If this statement was prepared using sqlite3_prepare_v2(), and an
62038 /* This case occurs after failing to recompile an sql statement.
62086 ** The following is the implementation of an SQL function that always
62087 ** fails with an error message stating that the function is used in the
62246 ** value SQL NULL. Even though the Mem structure contains an element
62249 ** instead of an 8-byte one. This all works fine, except that when
62251 ** that a Mem structure is located on an 8-byte boundary. To prevent
62275 ** This function is called after invoking an sqlite3_value_XXX function on a
62276 ** column value (i.e. a value returned by evaluating an SQL expression in the
62294 /* If malloc() failed during an encoding conversion within an
62392 ** If the result is not a simple column reference (if it is an expression
62469 ** NULL is returned if the result column is an expression or constant or
62470 ** anything else which is not an unabiguous reference to a database column.
62485 ** NULL is returned if the result column is an expression or constant or
62486 ** anything else which is not an unabiguous reference to a database column.
62501 ** NULL is returned if the result column is an expression or constant or
62502 ** anything else which is not an unabiguous reference to a database column.
62608 ** Bind a blob value to an SQL statement variable.
62787 ** an SQLITE_ERROR is returned. Nothing else can go wrong, so otherwise
63026 ** In the external interface, an "sqlite3_stmt*" is an opaque pointer
63032 ** a linear sequence of operations. Each operation has an opcode
63034 ** is a null-terminated string. Operand P5 is an unsigned character.
63039 ** either an integer, a null-terminated string, a floating point
63083 ** in an ordinary build.
63152 ** This routine converts an ephemeral string into a dynamically allocated
63154 ** converts an MEM_Ephem string into an MEM_Dyn string.
63286 ** Try to convert pRec to an integer representation or a
63287 ** floating-point representation if an integer representation
63290 ** an integer representation is more space efficient on disk.
63304 /* Only attempt the conversion to TEXT if there is an integer or real
63585 ** This function is only called from within an assert() expression. It
63604 ** Transfer error message text from an sqlite3_vtab.zErrMsg (text stored
63628 ** If an attempt is made to open a locked database, then this routine
63632 ** If an error occurs, an error message is written to memory obtained
63656 u8 resetSchemaOnFault = 0; /* Reset schema after an error if positive */
63773 } an;
63883 int res; /* Result of an sqlite3BtreeLast() */
64146 /* Check to see if we need to simulate an interrupt. This only happens
64181 ** an undefined integer. Opcodes will either fill in the integer
64241 ** opcode and the opcodes.c file is filled with an array of strings where
64346 ** If P4 is not null then it is an error message string.
64348 ** There is an implied "Halt 0 0 0" instruction inserted at the very end of
64365 ** an IGNORE exception. In this case jump to the address specified
64435 ** into an OP_String before it is executed for the first time.
64530 ** left holding a NULL. It is an error for register ranges
64615 ** with an SQLITE_ROW return code and it sets up the sqlite3_stmt
64662 ** and have an assigned type. The results are de-ephemeralized as
64954 ** user function may have called an sqlite3_result_XXX() function
64962 /* If the function returned an error, throw an exception */
65071 ** The result is always an integer.
65073 ** To force any register to be an integer, just add 0.
65085 ** Force the value in register P1 to be an integer. If the value
65086 ** in P1 is not an integer and cannot be converted into an integer
65088 ** raise an SQLITE_MISMATCH exception.
65109 ** If register P1 holds an integer convert it to a real value.
65174 ** Force the value in register P1 to be numeric (either an
65176 ** If the value is text or blob, try to convert it to an using the
65191 ** Force the value in register P1 to be an integer. If
65193 ** If the value is text or blob, try to convert it to an integer using the
65210 ** If The value is currently an integer, convert it.
65211 ** If the value is text or blob, try to convert it to an integer using the
65235 ** The SQLITE_AFF_MASK portion of P5 must be an affinity character -
65545 ** Interpret the content of register P1 as an integer. Store the
65564 ** to an integer 1.
65800 /* Make sure a corrupt database has not given us an oversize header.
65801 ** Do this now to avoid an oversize memory allocation.
65815 ** to get u.am.nField type values. u.am.offset is an upper bound on this. But
65957 #if 0 /* local variables moved into u.an */
65960 #endif /* local variables moved into u.an */
65962 u.an.zAffinity = pOp->p4.z;
65963 assert( u.an.zAffinity!=0 );
65964 assert( u.an.zAffinity[pOp->p2]==0 );
65966 while( (u.an.cAff = *(u.an.zAffinity++))!=0 ){
65970 applyAffinity(pIn1, u.an.cAff, encoding);
65980 ** in an index. The OP_Column opcode can decode the record later.
66112 ** Store the number of entries (an integer value) in the table or index
66136 ** on the value of P1. To open a new savepoint, P1==0. To release (commit) an
66137 ** existing savepoint, P1==1, or to rollback an existing savepoint P1==2.
66208 /* Find the named savepoint. If there is no such savepoint, then an
66209 ** an error is returned to the user. */
66326 ** still running, and a transaction is active, return an error indicating
66334 ** return an error indicating that the other VMs must complete first.
66378 ** transaction might also be rolled back if an error is encountered.
66390 ** database. If P2 is 2 or greater then an EXCLUSIVE lock is also obtained
66395 ** throw an ABORT exception), a statement transaction may also be opened.
66399 ** VDBE to be rolled back after an error without having to roll back the
66458 ** must be started or there must be an open cursor) before
66482 ** Write the content of register P3 (interpreted as an integer)
66535 ** Either a transaction needs to have been started or an OP_Open needs
66563 ** If virtual-tables are in use, this is not just an optimization.
66588 ** database. Give the new cursor an identifier of P1. The P1
66590 ** It is an error for P1 to be negative.
66595 ** There will be a read lock on the database whenever there is an
66601 ** to get a read lock but fails, the script terminates with an
66604 ** The P4 value may be either an integer (P4_INT32) or a pointer to
66607 ** sequence of the index being opened. Otherwise, if P4 is an integer
66618 ** The P4 value may be either an integer (P4_INT32) or a pointer to
66621 ** sequence of the index being opened. Otherwise, if P4 is an integer
66767 ** automatically created table with root-page 1 (an BLOB_INTKEY table).
66795 ** tables using an external merge-sort algorithm.
66819 ** register P2. In other words, cursor P1 becomes an alias for the
66859 ** If cursor P1 refers to an SQL table (B-Tree that uses integer keys),
66861 ** to an SQL index, then P3 is the first in an array of P4 registers
66862 ** that are used as an unpacked index key.
66872 ** If cursor P1 refers to an SQL table (B-Tree that uses integer keys),
66874 ** to an SQL index, then P3 is the first in an array of P4 registers
66875 ** that are used as an unpacked index key.
66885 ** If cursor P1 refers to an SQL table (B-Tree that uses integer keys),
66887 ** to an SQL index, then P3 is the first in an array of P4 registers
66888 ** that are used as an unpacked index key.
66898 ** If cursor P1 refers to an SQL table (B-Tree that uses integer keys),
66900 ** to an SQL index, then P3 is the first in an array of P4 registers
66901 ** that are used as an unpacked index key.
66936 ** blob, or NULL. But it needs to be an integer before we can do
66943 /* If the P3 value could not be converted into an integer without
66957 /* The P3 value is too large in magnitude to be expressed as an
67065 ** P1 is an open table cursor and P2 is a rowid integer. Arrange
67095 ** P4>0 then register P3 is the first of P4 registers that form an unpacked
67098 ** Cursor P1 is on an index btree. If the record identified by P3 and P4
67105 ** P4>0 then register P3 is the first of P4 registers that form an unpacked
67108 ** Cursor P1 is on an index btree. If the record identified by P3 and P4
67110 ** does contain an entry whose prefix matches the P3/P4 record then control
67181 ** Cursor P1 is open on an index b-tree - that is to say, a btree which
67186 ** The P3 register contains an integer record number. Call this record
67188 ** that make up an unpacked index key that can be used with cursor P1.
67196 ** Otherwise, this instruction checks if cursor P1 contains an entry
67270 ** Use the content of register P3 as an integer key. If a record
67276 ** operation assumes the key is an integer and that P1 is a table whereas
67278 ** P1 is an index.
67313 /* This happens when an attempt to open a read cursor on the
67348 ** an SQLITE_FULL error is generated. The P3 register is updated with the '
67356 int res; /* Result of an sqlite3BtreeLast() */
67435 assert( (u.bf.pMem->flags & MEM_Int)!=0 ); /* mem(P3) holds an integer */
67455 ** an AUTOINCREMENT table. */
67491 ** Write an entry into the table of cursor P1. A new entry is
67492 ** created if it doesn't already exist or the data for an existing
67507 ** has already positioned the cursor correctly. This is an optimization
67510 ** If the OPFLAG_ISUPDATE flag is set, then this opcode is part of an
67512 ** is part of an INSERT operation. The difference is only important to
67610 ** a record from within an Next loop.
67644 /* The OP_Delete opcode always follows an OP_NotExists or OP_Last or
67812 ** Store in register P2 an integer which is the key of the table entry that
67815 ** P1 can be either an ordinary table or a virtual table. There used to
67920 ** it increments an undocumented global variable used for testing.
68057 ** Register P2 holds an SQL index key made using the
68062 ** insert is likely to be an append.
68109 ** an unpacked index key. This opcode removes that entry from the
68146 ** Write into register P2 an integer which is the last entry in the record at
68183 ** The P4 register values beginning with P3 form an unpacked index
68190 ** If P5 is non-zero then the key value is increased by an epsilon
68197 ** The P4 register values beginning with P3 form an unpacked index
68204 ** If P5 is non-zero then the key value is increased by an epsilon prior
68250 ** Delete an entire database table or index whose root page in the database
68318 ** If the P3 value is non-zero, then the table referred to must be an
68319 ** intkey table (an SQL table, not an index). In this case the row change
68350 ** auxiliary database file if P1==1 or in an attached database if
68354 ** The difference between a table and an index is this: A table must
68356 ** has an arbitrary key but no data.
68363 ** auxiliary database file if P1==1 or in an attached database if
68478 ** the index named P4 in database P1. This is called after an index
68503 ** Do an analysis of the currently open database. Store in
68504 ** register P1 the text of an error message describing any problems.
68569 ** An assertion fails if P2 is not an integer.
68643 ** delete it now and initialize P1 with an empty rowset
68675 ** cell in an array of values used as arguments to the sub-program. P2
68676 ** contains the address to jump to if the sub-program throws an IGNORE
68857 ** This instruction throws an error if the memory cell is not initially
68858 ** an integer.
68887 ** not contain an integer. An assertion fault will result if you try.
68903 ** not contain an integer. An assertion fault will result if you try.
68916 ** The register P1 must contain an integer. Add literal P3 to the
68920 ** not contain an integer. An assertion fault will result if you try.
68934 ** Execute the step function for an aggregate. The
68993 ** Execute the finalizer function for an aggregate. P1 is
69031 ** completes into mem[P3+2]. However on an error, mem[P3+1] and
69134 ** as an intermediate */
69204 ** fails with an error code of SQLITE_SCHEMA if it is ever executed
69232 ** used to generate an error message if the lock cannot be obtained.
69254 ** P4 may be a pointer to an sqlite3_vtab structure. If so, call the
69301 ** P4 is a pointer to a virtual table object, an sqlite3_vtab structure.
69341 ** P1 is a cursor opened using VOpen. P2 is an address to jump to if
69458 ** do this regardless of whether or not an error occurred to ensure any
69499 ** underlying implementation to return an error if one occurs during
69500 ** xNext(). Instead, if an error occurs, true is returned (indicating that
69523 ** P4 is a pointer to a virtual table object, an sqlite3_vtab structure.
69550 ** P4 is a pointer to a virtual table object, an sqlite3_vtab structure.
69556 ** The xUpdate method will do a DELETE or an INSERT or both.
69747 ** an error of some kind.
69849 ** If an error occurs, or if the specified row does not exist or does not
69851 ** blob handle was opened, then an error code is returned and *pzErr may
69852 ** be set to point to a buffer containing an error message. It is the
69856 ** If an error does occur, then the b-tree cursor is closed. All subsequent
69933 ** After seeking the cursor, the vdbe executes an OP_ResultRow.
69947 /* One of the following two instructions is replaced by an OP_Noop. */
70028 /* Check that the column is not part of an FK child key definition. It
70100 ** always return an SQL NULL. This is useful because it means
70237 ** Move an existing blob handle to point to a different row of the same
70240 ** If an error occurs, or if the specified row does not exist or does not
70241 ** contain a blob or text value, then an error code is returned and the
70315 ** The aIter[] array contains an iterator for each of the PMAs being merged.
70388 ** The following type is an iterator for a PMA. It caches the current key in
70429 ** no error occurs, or an SQLite error code if one does.
70447 /* This is an EOF condition */
70481 ** SQLITE_OK if successful, or an SQLite error code if some error occurs.
70505 ** successful, or an SQLite error code if some error occurs.
70511 ** set to the integer value read. If an error occurs, the final values of
70570 ** used by the comparison. If an error occurs, return an SQLite error code.
70580 ** has been allocated and contains an unpacked record that is used as key2.
70728 ** Otherwise, set *ppFile to 0 and return an SQLite error code.
70775 ** if successful, or an SQLite error code (i.e. SQLITE_NOMEM) if an error
70814 ** SQLITE_OK if successful, or an SQLite error code otherwise.
70864 /* This assert verifies that unless an error has occurred, the size of
71009 ** initialize an iterator for each of them and break out of the loop.
71141 ** If an error occurs, return an SQLite error code (i.e. SQLITE_NOMEM).
71181 ** the caller specifies a buffer size for an in-memory buffer to
71194 ** as an open file handle for journal files.
71415 ** This file contains code use to implement an in-memory rollback journal.
71460 ** is an instance of this class.
71595 ** Syncing an in-memory journal is a no-op. And, in fact, this routine
71648 ** Return true if the file-handle passed as an argument is
71649 ** an in-memory journal
71676 ** an SQL statement.
71683 ** Walk an expression tree. Invoke the callback once for each node
71722 ** an abort request is seen.
71781 ** there is an abort request.
71783 ** If the Walker does not have an xSelectCallback() then this routine
71822 ** Turn the pExpr expression into an alias for the iCol-th column of the
71826 ** makes an exact copy. But for any other kind of expression, this
71852 Expr *pExpr, /* Transform this into an alias to the result set */
71925 ** If the name cannot be resolved unambiguously, leave an error message
72090 ** might refer to an result-set alias. This happens, for example, when
72148 ** more matches. Either way, we have an error.
72206 ** Allocate and return a pointer to an expression to load the column iCol
72318 int is_agg = 0; /* True if is an aggregate function */
72413 ** a SELECT statement. pE is a term in an ORDER BY or GROUP BY clause.
72416 ** this routine return an integer between 1 and N where N is the number of
72445 ** pE is a pointer to an expression which is a single term in the
72450 ** ORDER BY term is not an integer index into the result set. That
72455 ** as an indication to the caller that it should sort by the i-th column.
72460 ** If there is no match, return 0. Return -1 if an error occurs.
72492 /* Try to match the ORDER BY expression against an expression
72493 ** in the result set. Return an 1-based index of the matching
72507 ** Generate an ORDER BY or GROUP BY term out-of-range error.
72525 ** ORDER BY terms that are already an integer between 1 and N are
72527 ** 1 through N generate an error. ORDER BY terms that are expressions
72622 ** If any errors are detected, add an error message to pParse and
72658 ** pOrderBy is an ORDER BY or GROUP BY clause in SELECT statement pSelect.
72662 ** This routine resolves each term of the clause into an expression.
72663 ** If the order-by term is an integer I between 1 and N (where N is the
72666 ** the order-by term is an identify that corresponds to the AS-name of
72672 ** an appropriate error message might be left in pParse. (OOM errors
72694 /* If an AS-name match is found, mark this ORDER BY column as being
72702 /* The ORDER BY term is an integer constant. Again, set the column
72713 /* Otherwise, treat the ORDER BY term as an ordinary expression */
72748 ** an expression, sqlite3ResolveExprNames() will be called without a
72768 ** are not allowed to refer to any names, so pass an empty NameContext.
72907 ** This routine walks an expression tree and resolves references to
72916 ** the symbolic name assigned to an ATTACH-ed database.
72933 ** size of an AS clause in the result-set of a SELECT. The Z expression
72946 ** If the function is an aggregate function, then the pNC->hasAgg is
72948 ** If an expression contains aggregate functions then the EP_Agg
73040 ** If pExpr is a column, a reference to a column via an 'AS' alias,
73046 ** have an affinity:
73079 ** Set the explicit collating sequence for an expression to the
73147 ** pExpr is an operand of a comparison operator. aff2 is the
73197 ** idx_affinity is the affinity of an indexed column. Return true
73284 ** expression depth allowed. If it is not, leave an error message in
73337 ** Set the Expr.nHeight variable in the structure passed as an
73358 ** leave an error in pParse.
73367 ** by the select statement passed as an argument.
73496 ** Expr node. Or, if an OOM error occurs, set pParse->db->mallocFailed,
73515 ** Join two expressions using an AND operator. If either expression is
73550 ** Assign a variable number to an expression that encodes a wildcard
73558 ** the SQL statement comes from an external source.
73582 /* Wildcard of the form "?nnn". Convert "nnn" to an integer and
73634 ** Recursively delete an expression tree.
73670 ** to store a copy of an expression or expression tree. They differ in
73994 ** Add a new element to the end of an expression list. If pList is
74043 ** pList might be NULL following an OOM error. But pName should never be
74068 ** pList might be NULL following an OOM error. But pSpan should never be
74091 ** leave an error message in pParse.
74107 ** Delete an entire expression list.
74126 ** to an integer. These routines are checking an expression to see
74184 ** Walk an expression tree. Return 1 if the expression is constant
74196 ** Walk an expression tree. Return 1 if the expression is constant
74199 ** an ON or USING clause.
74206 ** Walk an expression tree. Return 1 if the expression is constant
74221 ** in *pValue. If the expression is not an integer or if it is too big
74227 /* If an expression is an integer literal that fits in a signed 32-bit
74260 ** This routine is used as an optimization, to skip OP_IsNull opcodes
74265 ** will likely result in an incorrect answer. So when in doubt, return
74285 ** Generate an OP_IsNull instruction that tests register iReg and jumps
74416 ** through the set members, skipping any duplicates. In this case an
74418 ** to be unique - either because it is an INTEGER PRIMARY KEY or it
74422 ** for fast set membership tests. In this case an epheremal table must
74423 ** be used unless <column> is an INTEGER PRIMARY KEY or an index can
74427 ** needs to know whether or not the structure contains an SQL NULL
74458 /* Check to see if an existing table or index can be used to
74471 /* Code an OP_VerifyCookie and OP_TableLock for <table>. */
74494 /* The collation sequence used by the comparison. If an index is to
74533 /* Could not found an existing table or index to use as the RHS b-tree.
74534 ** We will have to generate an ephemeral table to do the job.
74571 ** to some integer key column of a table B-Tree. In this case, use an
74575 ** If rMayHaveNull is non-zero, that means that the operation is an IN
74588 ** result. For IN operators or if an error occurs, the return value is 0.
74607 ** * The right-hand side is an expression list containing variables
74641 /* Whether this is an 'x IN(SELECT...)' or an 'x IN(<exprlist>)'
74685 ** For each expression, build an index key from the evaluation and
74748 ** of the memory cell in iColumn. If this is an EXISTS, write
74749 ** an integer 0 (not exists) or 1 (exists) into a memory cell
74795 ** Generate code for an IN expression.
74801 ** is an array of zero or more values. The expression is true if the LHS is
74863 /* In this case, the RHS is an index b-tree.
74928 ** Duplicate an 8-byte value
74940 ** Generate an instruction that will put the floating point
74962 ** Generate an instruction that will put the integer describe by
75047 /* Find an empty slot and replace it */
75169 ** There must be an open cursor to pTab in iTable when this routine
75212 ** Record the fact that an affinity change has occurred on iCount
75712 ** The expression is implemented using an OP_Param opcode. The p1
75713 ** parameter is set to 0 for an old.rowid reference, or to (i+1)
75746 /* If the column has REAL affinity, it may currently be stored as an
75878 ** Generate code to evaluate an expression and store the results
75954 ** Return TRUE if pExpr is an constant expression that is appropriate
75965 ** We could factor them out, but then we would end up adding an
75995 ** up generating an OP_SCopy to move the value to the destination
76451 ** this routine is used, it does not hurt to get an extra 2 - that
76453 ** an incorrect 0 or 1 could lead to a malfunction.
76575 ** Make an entry for the column in pAggInfo->aCol[] if there
76576 ** is not an entry there already.
76614 /* There is now an entry for pExpr in pAggInfo->aCol[] (either
76705 ** Call sqlite3ExprAnalyzeAggregates() for every expression in an
76708 ** If an error is found, the analysis is cut short.
76839 /* Ran out of input before finding an opening bracket. Return NULL. */
76864 ** This C function implements an SQL user function that is used by SQL code
77106 ** pTab->zName if this function is being called to code part of an
77153 ** If the table is a system table, this function leaves an error message
77186 VTable *pVTab = 0; /* Non-zero if this is a v-tab with an xRename() */
77205 ** in database iDb. If so, this is an error.
77393 ** This function is called after an "ALTER TABLE ... ADD" statement
77434 ** for an SQL NULL default below.
77511 ** an "ALTER TABLE <table-name> ADD" statement is parsed. Argument
77547 /* Make sure this is not an attempt to ALTER a view. */
77561 ** the name by adding an "sqlite_altertab_" prefix. By adding this
77562 ** prefix, we insure that the name will not collide with an existing
77706 ** Generate code to do an analysis of all indices associated with
77830 ** initialized to contain an SQL NULL.
77894 ** below may be negative. Which causes an assert() to fail (or an
77985 ** Generate code that will do an analysis of an entire database
78008 ** Generate code that will do an analysis of a single table in
78033 ** when it recognizes an ANALYZE command.
78052 /* Read the database schema. If an error occurs, leave an error message
78202 ** If an OOM error occurs, this function always sets db->mallocFailed.
78344 ** Resolve an expression that was part of an ATTACH or DETACH statement. This
78379 ** An SQL user-function registered to do the work of an ATTACH statement. The
78380 ** three arguments to the function come directly from an attach statement:
78386 ** If the optional "KEY z" syntax is omitted, an SQL NULL is passed as the
78560 /* Return an error if we get here */
78569 ** An SQL user-function registered to do the work of an DETACH statement. The
78684 /* Code an OP_Expire. For an ATTACH statement, set P1 to true (expire this
78720 ** Called by the parser to compile an ATTACH statement.
78774 ** These routines are used to make sure that an index, trigger, or
78778 ** to an object in a different database, an error message is added to
78899 ** API. This facility is an optional feature of the library. Embedded
78948 ** will return with an error. SQLITE_IGNORE means that the SQL statement
78969 ** Write an error message into pParse->zErrMsg that explains that the
78970 ** user-supplied authorization function returned an illegal value.
78979 ** table zTab in database zDb. This function assumes that an authorization
78983 ** to an SQL NULL expression. Otherwise, if pExpr is NULL, then SQLITE_IGNORE
78984 ** is treated as SQLITE_DENY. In this case an error is left in pParse.
79017 ** then generate an error.
79071 ** Do an authorization check using the code and arguments given. Return
79108 ** Push an authorization context. After this routine is called, the
79124 ** Pop an authorization context that was previously pushed
79231 ** Code an OP_TableLock instruction for each table locked by the
79259 ** Note that if an error occurred, it might be the case that
79424 ** database containing the table. Return NULL if not found. Also leave an
79428 ** routine leaves an error message in pParse->zErrMsg where
79439 /* Read the database schema. If an error occurs, leave an error message
79489 ** Reclaim the memory used by an index
79744 ** of a database ("main", "temp" or the name of an attached db). This
79765 ** "temp" or the name of an attached db). This routine returns the
79934 /* Make sure the new table name does not collide with an existing
79935 ** index or table name in the same database. Issue an error message if
79937 ** to an sqlite3_declare_vtab() call. In that case only the column names
79957 sqlite3ErrorMsg(pParse, "there is already an index named %s", zName);
80053 /* If an error occurs, we jump here */
80222 ** Default value expressions must be constant. Raise an exception if this
80259 ** a primary key (and this is the second primary key) then create an
80268 ** If the key is not an INTEGER PRIMARY KEY, then create a unique
80315 sqlite3ErrorMsg(pParse, "AUTOINCREMENT is only allowed on an "
80372 ** then an index may have been created on this column before the
80397 ** another error occurs, NULL is returned and an error message written into
80402 ** and generates an error message.
80467 ** The first parameter is a pointer to an output buffer. The second
80468 ** parameter is a pointer to an integer that contains the offset at
80475 ** characters, does not begin with a digit and is not an SQL keyword,
80742 /* Check to see if we need to create an sqlite_sequence table for
80875 ** of errors. If an error is seen leave an error message in pParse->zErrMsg.
81036 ** erasing iTable (this can happen with an auto-vacuum database).
81044 /* OP_Destroy stores an in integer r1. If this integer
81064 ** is also added (this can happen with an auto-vacuum database).
81079 ** to be destroyed is relocated by an earlier OP_Destroy. i.e. if the
81432 ** This routine is called when an INITIALLY IMMEDIATE or INITIALLY DEFERRED
81451 ** content of an index in response to a REINDEX command.
81564 ** Create a new index for an SQL table. pName1.pName2 is the name of the index
81566 ** be NULL for a primary key or an index that is created to satisfy a
81597 Token nullId; /* Fake token for an empty ID list */
81727 /* Check for authorization to create an index.
81763 /* Either pColl!=0 or there was an OOM failure. But if an OOM
81811 ** load the column indices into the Index structure. Report an error
81817 ** same column more than once cannot be an error because that would
81839 ** must exist or else there must have been an OOM error. But if there
81840 ** was an OOM error, we would never reach this point. */
81866 /* This routine has been called to create an automatic index as a
81874 ** Either way, check to see if the table already has such an index. If
81909 ** ON CONFLICT clauses this is an error. Otherwise, use the
81979 /* A named index with an explicit CREATE INDEX statement */
81990 /* Add an entry in sqlite_master for this index
82002 /* Fill the index with data and reparse the schema. Code an OP_Expire
82014 /* When adding an index to the list of indices for a table, make
82054 ** Since we do not know, guess 1 million. aiRowEst[1] is an estimate of the
82056 ** first column of the index. aiRowEst[2] is an estimate of the number
82085 ** This routine will drop an existing named index. This routine
82153 ** pArray is a pointer to an array of objects. Each object in the
82227 ** Delete an IdList.
82323 ** A SrcList is returned, or NULL if there is an OOM error. The returned
82325 ** a new one. If an OOM error does occurs, then the prior value of pList
82328 ** If pDatabase is not null, it means that the table has an optional
82404 ** Delete an entire SrcList including all its substructure.
82480 ** Add an INDEXED BY or NOT INDEXED clause to the most recently added
82502 ** Shifts all join operators from left to right for an entire FROM
82592 ** release or rollback an SQL savepoint.
82652 ** The first time this routine is called, we code an OP_Goto that
82708 ** Generate VDBE code that prepares for doing an operation that
82731 ** If an abort occurs after some of these writes have completed, then it will
82751 ** particular, it prevents us from writing an effective
82761 ** Code an OP_Halt that causes the vdbe to return an SQLITE_CONSTRAINT
82858 /* Read the database schema. If an error occurs, leave an error message
82908 ** pointer. If an error occurs (out of memory or missing collation
83055 ** an equivalent collating sequence that uses a text encoding different
83076 ** Locate and return an entry from the db.aCollSeq hash table. If the entry
83080 ** Each pointer stored in the sqlite3.aCollSeq hash table contains an
83136 ** if necessary and generates an error message if the collating sequence
83319 /* If the createFlag parameter is true and the search did not reveal an
83418 ** the name of a single table, as one might find in an INSERT, DELETE,
83420 ** return a pointer. Set an error message and return NULL if the table
83447 ** writable, generate an error message and return 1. If it is
83459 ** In either case leave an error message in pParse and return non-zero.
83483 ** Evaluate a view and store its result in an ephemeral table. The
83484 ** pWhere argument is an optional WHERE clause that restricts the
83522 ** Generate an expression tree to implement the WHERE, ORDER BY,
83545 /* Check that there isn't an ORDER BY without a LIMIT clause.
83654 ** put in an SrcList structure because some of the subroutines we
83656 ** an SrcList* parameter instead of just a Table* parameter.
83785 ** because deleting an item can change the scan order. */
84003 ** Generate code that will assemble an index key and put it in register
84004 ** regOut. The key with be for index pIdx which is an index on pTab.
84185 ** abs(X) throws an integer overflow error since there is no
84351 ** raise an SQLITE_TOOBIG exception and return NULL.
84759 ** Otherwise, return an error.
84807 /* IMP: R-48699-48617 This function is an SQL wrapper around the
84823 /* IMP: R-24470-31136 This function is an SQL wrapper around the
84845 ** The result is an integer that identifies if the compiler option
84897 ** EXPERIMENTAL - This is not an official function. The interface may
85292 ** SUM might return an integer if it never encounters a floating point
85293 ** value. TOTAL never fails, but SUM might through an exception if
85294 ** it overflows an integer.
85524 ** pExpr points to an expression which implements a function. If
85684 ** If an immediate foreign key constraint is violated, SQLITE_CONSTRAINT
85694 ** time a statement is executed that removes an existing violation from
85742 ** If a delete caused by OR REPLACE violates an FK constraint, an exception
85750 ** and the statement transaction is rolled back. An exception is an INSERT
85752 ** instead of using a counter, an exception is thrown immediately if the
85754 ** an INSERT does not open a statement transaction.
85763 ** Before coding an UPDATE or DELETE row operation, the code-generator
85769 ** coding an INSERT operation. The functions used by the UPDATE/DELETE
85781 ** sqlite3FkDelete() - Delete an FKey structure.
85807 ** If successful, zero is returned. If the parent key is an INTEGER PRIMARY
85813 ** Otherwise, it is set to point to an allocated array of size N, where
85838 ** into pParse. If an OOM error occurs, non-zero is returned and the
85869 ** 1) There is an INTEGER PRIMARY KEY column and the FK is implicitly
85904 ** map to an explicit list of columns in table pParent. Check if this
85950 ** child table of foreign key constraint pFKey. If an SQL UPDATE is executed
86012 /* Invoke MustBeInt to coerce the child key value to an integer (i.e.
86021 ** to increment the constraint-counter (i.e. this is an INSERT operation),
86047 ** to increment the constraint-counter (i.e. this is an INSERT operation),
86082 /* Special case: If this is an INSERT statement that will insert exactly
86105 ** code for an SQL UPDATE operation, this function may be called twice -
86153 /* Create an Expr object representing an SQL expression like:
86220 ** clause. If the constraint is not deferred, throw an exception for
86247 ** Calling this function with table "t1" as an argument returns a pointer
86321 ** violations, halt the VDBE and return an error at this point, before
86341 ** first register in an array of (pTab->nCol+1) registers containing the
86346 ** For an INSERT operation, regOld is passed zero and regNew is passed the
86347 ** first register of an array of (pTab->nCol+1) registers containing the new
86350 ** For an UPDATE operation, this function is called twice. Once before
86389 ** schema items cannot be located, set an error in pParse and return
86403 ** If the parent table of an FK constraint on the current table is
86450 ** If the parent does not exist, removing the child row resolves an
86471 /* Inserting a single row into a parent table cannot cause an immediate
86498 ** on the parent table of this FK, then throw an exception
86543 ** parameter aChange is passed a NULL value. For an UPDATE, aChange points
86544 ** to an array of size N, where N is the number of columns in table pTab.
86567 /* This is an UPDATE. Foreign key processing is only required if the
86601 ** This function is called when an UPDATE or DELETE operation is being
86603 ** If the current operation is an UPDATE, then the pChanges parameter is
86821 ** refer to table pTab. If there is an action associated with the FK
87052 ** Locate or create an AutoincInfo structure associated with table pTab
87104 AutoincInfo *p; /* Information about an AUTOINCREMENT */
87138 ** Update the maximum rowid for an autoincrement calculation.
87154 ** Every statement that might do an INSERT into an autoincrement
87341 int appendFlag = 0; /* True if the insert is likely to be an append */
87439 /* If this is an AUTOINCREMENT table, look up the sequence number in the
87580 /* If the INSERT statement included an IDLIST term, then make sure
87584 ** If the table has an INTEGER PRIMARY KEY column and that column
87618 /* If there is no IDLIST term but the table has an integer primary
87692 /* build the NEW.* reference row. Note that if there is an INTEGER
87739 /* If this is an INSERT on a view with an INSTEAD OF INSERT trigger,
87758 ** except when the table has an INTEGER PRIMARY KEY column, in which
87944 ** Generate code to do constraint checks prior to an INSERT or an UPDATE.
87961 ** is false, indicating an INSERT statement, then a non-zero rowidChng
87964 ** computed automatically in an insert or that the rowid value is not
87965 ** modified by an update.
87995 ** the stack and there is an immediate jump
88005 ** CHECK REPLACE Illegal. The results in an exception.
88027 int ignoreDest, /* Jump to this label on an OE_Ignore resolution */
88111 /* If we have an INTEGER PRIMARY KEY, make sure the primary key
88113 ** is an UPDATE and the primary key is not changing, that is OK.
88215 /* Find out what action to take in case there is an indexing conflict */
88311 int appendBias, /* True if this is likely to be an append */
88422 ** for index pDest in an insert transfer optimization. The rules
88505 KeyInfo *pKey; /* Key information for an index */
88538 return 0; /* SELECT may not have an ORDER BY clause */
88541 ** there is no ORDER BY, we will get an error. */
88633 ** * We can always do the transfer if the table contains an
88634 ** an integer primary key
88650 /* If tables do not have an INTEGER PRIMARY KEY and there
88747 ** codes. Also write an error message into memory obtained from
88907 ** an SQLite instance. Shared libraries that intend to be loaded
89117 ** (part of the main SQLite library - not an extension) so that
89685 ** Attempt to load an SQLite extension library contained in the file
89692 ** If an error occurs and pzErrMsg is not 0, then fill *pzErrMsg with
89923 ** If anything goes wrong, set an error in the database connection.
89977 ** 1 for ON or NORMAL and 2 for FULL. Return 1 for an empty or
90030 ** Interpret the given string as an auto-vacuum mode value.
90190 ** compiler (eg. count_changes). So add an opcode to expire all
90374 /* Malloc may fail when setting the page-size, as there is an internal
90583 ** as an auto-vacuum capable db.
90590 ** that this really is an auto-vacuum capable database.
91020 /* Pragma "quick_check" is an experimental reduced version of
91058 /* Do an integrity check on each database file */
91071 /* Do an integrity check of the B-Tree
91194 ** is created. If an existing main database file is opened, then the
91506 ** Fill the InitData structure with an error message that indicates
91591 /* If the SQL column is blank it means this is an index that
91600 /* This can occur if there exists an index on a TEMP table which
91742 ** For an attached db, it is an error if the encoding is not the same
91754 /* If opening an attached database, the encoding much match ENC(db) */
91843 /* Jump here for an error that occurs after successfully allocating
91844 ** curMain and calling sqlite3BtreeEnter(). For an error that occurs
91863 ** created using ATTACH statements. Return a success code. If an
91864 ** error occurs, write an error message into *pzErrMsg.
92237 ** and the statement is automatically recompiled if an schema change
92317 ** and the statement is automatically recompiled if an schema change
92457 ** type of join. Return an integer constant that expresses that type
92469 ** If an illegal or unsupported join type is seen, then still return
92470 ** a join type, but put an error in the pParse structure.
92592 int isOuterJoin, /* True if this is an OUTER join */
92623 ** The EP_FromJoin property is used on terms of an expression to tell
92692 "an ON or USING clause", 0);
92717 ** an AND operator.
92729 ** Report an error if any column mentioned in the USING clause is
92850 ** Generate an error message when a SELECT is used within a subexpression
92864 "a SELECT that is part of an expression");
92929 /* If the destination is an EXISTS(...) expression, the actual
92996 /* If we are creating a set for an "expr IN (SELECT ...)" construct,
93027 /* If this is a scalar select that is part of an expression, then
93088 ** Given an expression list, generate a KeyInfo structure that records
93091 ** If the ExprList is an ORDER BY or GROUP BY clause then the resulting
93099 ** freed. Add the KeyInfo structure to the P4 field of an opcode using
93147 ** Unless an "EXPLAIN QUERY PLAN" command is being processed, this function
93181 ** Unless an "EXPLAIN QUERY PLAN" command is being processed, this function
93334 ** declaration type for a ROWID field is INTEGER. Exactly when an expression
93525 /* If this is an EXPLAIN, skip this step */
93578 ** Given a an expression list (which is really the list of expressions
93609 /* Get an appropriate name for the column
93615 /* If the column contains an "AS <name>" phrase, use <name> as the name */
93752 ** If an error occurs, return NULL and leave a message in pParse.
93821 pParse->nMem++; /* Allocate an extra register for limit+offset */
93918 ** the last (right-most) SELECT in the series may have an ORDER BY or LIMIT.
93962 /* Compound SELECTs that have an ORDER BY clause are handled separately.
94251 ** Code an output subroutine for a coroutine implementation of a
94302 /* Suppress the the first OFFSET entries if there is an OFFSET clause
94325 /* If we are creating a set for an "expr IN (SELECT ...)" construct,
94342 #if 0 /* Never occurs on an ORDER BY query */
94352 /* If this is a scalar select that is part of an expression, then
94409 ** is an ORDER BY clause.
94455 ** In the AltB, AeqB, and AgtB subroutines, an EOF on A following nextA
94456 ** causes an immediate jump to EofA and an EOF on B following nextB causes
94457 ** an immediate jump to EofB. Within EofA and EofB, and EOF on entry or
94963 ** (2) The subquery is not an aggregate or the outer query is not a join.
95000 ** (16) The outer query is not an aggregate or the subquery does
95009 ** * is not an aggregate or DISTINCT query, and
95024 ** an ORDER BY clause. Ticket #3773. We could relax this constraint
95106 ** not used as the right operand of an outer join. Examples of why this
95129 ** effectively converts the OUTER JOIN into an INNER JOIN.
95415 ** Analyze the SELECT statement passed as an argument to see if it
95446 ** The select statement passed as the first argument is an aggregate query.
95480 ** If the source-list item passed as an argument was augmented with an
95483 ** SQLITE_ERROR and leave an error in pParse. Otherwise, populate
95553 ** an entry of the FROM clause is a subquery instead of a table or view,
95771 ** If anything goes wrong, an error message is written into pParse.
95875 ** intermediate results while calculating an aggregate. This
95923 ** Update the accumulator memory cells for an aggregate based on
95985 ** values to an OP_Copy.
96051 ** SRT_EphemTab Create an temporary table pDest->iParm and store
96069 ** encountered, then an appropriate error message is left in
96093 int addrSortIndex; /* Address of an OP_OpenEphemeral instruction */
96094 int addrDistinctIndex; /* Address of an OP_OpenEphemeral instruction */
96164 ** an exact limit.
96177 /* Generate a subroutine that will fill an ephemeral table with
96248 /* If there is both a GROUP BY and an ORDER BY clause and they are
96251 ** an optimization - the correct answer should result regardless.
96260 /* If the query is DISTINCT with an ORDER BY but is not an aggregate, and
96273 ** BY and DISTINCT, and an index or separate temp-table for the other.
96284 /* If there is an ORDER BY clause, then this sorting
96287 ** OP_OpenEphemeral instruction will be changed to an OP_Noop once
96343 ** into an OP_Noop.
96369 /* Change the OP_OpenEphemeral coded earlier to an OP_Integer. The
96502 ** This might involve two separate loops with an OP_Sort in between, or
96503 ** it might be a single loop that uses an index to extract information
96687 ** is better to execute the op on an index, as indexes are almost
96701 ** there is such an index, and it has less columns than the table
96708 ** (2011-04-15) Do not do a full scan of an unordered index.
96740 ** as if there was an "ORDER ON x" or "ORDER ON x DESC" clause.
96805 /* If there is an ORDER BY clause, then we need to sort the results
96822 /* Control jumps to here if an error is encountered above, or upon
96966 char *zErrMsg; /* Error message text, if an error occurs */
97001 /* If this is the first row, then generate an extra row containing
97220 IdList *pColumns, /* column list if this is an UPDATE OF trigger */
97298 ** drop so the trigger cannot be dropped. This results in an
97440 /* Make an entry in the sqlite_master table */
97501 ** If an OOM error occurs, NULL is returned and db->mallocFailed is set.
97522 ** Build a trigger step out of an INSERT statement. Return a pointer
97525 ** The parser calls this routine when it sees an INSERT inside the
97557 ** Construct a trigger step that implements an UPDATE statement and return
97559 ** sees an UPDATE statement inside the body of a CREATE TRIGGER.
97754 ** pEList is the SET clause of an UPDATE statement. Each entry
97756 ** in pEList have an <id> which matches an identifier in pIdList,
97773 ** one trigger that must be fired when an operation of type 'op' is
97774 ** performed on the table, and, if that operation is an UPDATE, if at
97781 ExprList *pChanges, /* Columns that change in an UPDATE statement */
97853 ** to fire had an explicit ON CONFLICT, then use it. Otherwise, use
97930 ** (trigger program). If an error has occurred, transfer error information
97968 ** are freed if an error occurs, link them into the Parse.pTriggerPrg
98028 /* Insert an OP_Halt at the end of the sub-program. */
98072 ** process of being coded). If this is the case, then an entry with
98074 ** in the Parse.pTriggerPrg list. Search for such an entry. */
98080 /* If an existing TriggerPrg could not be located, create a new one. */
98127 ** This is called to code the required FOR EACH ROW triggers for an operation
98130 ** BEFORE or AFTER triggers are coded. If the operation is an UPDATE, then
98136 ** The reg argument is the address of the first in an array of registers
98156 ** are never accessed, and so are not allocated by the caller. So, for an
98164 ** raises an IGNORE exception.
98173 int reg, /* The first in an array of registers (see above) */
98208 ** old.* record into memory when executing an UPDATE or DELETE command.
98211 ** table may be accessed using an [old|new].<col> reference. Bit 1 is set if
98214 ** with an index greater than 32 may be accessed, 0xffffffff is returned.
98291 ** The most recently coded instruction was an OP_Column to retrieve the
98297 ** was created, or added later to the table definition by an ALTER TABLE
98304 ** Column definitions created by an ALTER TABLE command may only have
98315 ** If parameter iReg is not negative, code an OP_RealAffinity instruction
98316 ** on register iReg. This is used when an equivalent integer value is
98317 ** stored in place of an 8-byte floating point value in order to save
98342 ** Process an UPDATE statement.
98366 ** an expression for the i-th column of the table.
98651 /* If there are triggers on this table, populate an array of registers
98837 ** Generate code for an UPDATE of a virtual table.
98839 ** The strategy is that we create an ephemerial table that contains
98952 ** Finalize a prepared statement. If there was an error, store the
98965 ** Execute zSql on database db. Return an error code.
99098 /* A VACUUM cannot change the pagesize of an encrypted database. */
99155 ** an "INSERT INTO vacuum_db.xxx SELECT * FROM main.xxx;" to copy
99210 ** are an increment to apply to the meta value after the vacuum.
99253 /* Currently there is an SQL level transaction open on the vacuum
99296 ** sqlite3.pVtabCtx member variable is set to point to an instance of
99378 ** If an unlock is omitted, resources leaks will occur.
99435 ** above function sqlite3VtabUnlockList() for an explanation of why
99437 ** database connection that may have an entry in the p->pVTable list.
99642 ** The VM register number pParse->regRowid holds the rowid of an
99670 ** the first time the virtual table is used in an SQL statement. This
99691 ** of an argument to the module name in a CREATE VIRTUAL TABLE statement.
99701 ** in an argument to the module name in a CREATE VIRTUAL TABLE statement.
99822 ** of the virtual table pTab. If an error occurs, an error code is returned
99823 ** and an error left in pParse.
99893 ** If an error occurs, *pzErr is set to point an an English language
99894 ** description of the error and an SQLITE_XXX error code is returned.
99911 ** invoke it now. If the module has not been registered, return an
100058 ** sqlite3DbFree() containing an error message, if one is available.
100148 ** virtual tables that currently have an open transaction. Pass iSavepoint
100154 ** an open transaction is invoked.
100156 ** If any virtual table method returns an error code other than SQLITE_OK,
100198 ** table implementation have an opportunity to overload the function.
100269 ** array so that an OP_VBegin will get generated for it. Add pTab to the
100297 ** within an xUpdate method.
100388 ** The query generator uses an array of instances of this structure to
100588 #define WHERE_INDEXED 0x000f0000 /* Anything that uses an index */
100590 #define WHERE_IN_ABLE 0x000f1000 /* Able to support an IN operator */
100600 #define WHERE_TEMP_INDEX 0x20000000 /* Uses an ephemeral index */
100738 ** Initialize an expression mask set (a WhereMaskSet object)
100771 ** This routine walks (recursively) an expression tree and generates
100835 ** allowed for an indexable WHERE clause term. The allowed operators are
100838 ** IMPLEMENTATION-OF: R-59926-26393 To be usable by an index a term must be
100948 /* Figure out the collation sequence required from an index for
101021 ** be the name of an indexed column with TEXT affinity. */
101149 ** term that is an equivalent IN expression. In other words, if the term
101168 ** A subterm is also indexable if it is an AND of two or more
101174 ** potentially be used with an index if an appropriate index exists.
101298 ** that there is no possibility of transforming the OR clause into an
101306 ** might be possible to form an IN operator with either table1.column
101322 ** such table and column. Set okToChngToIN if an appropriate table
101339 ** or follwed by an inverted copy (t2.b==t1.a). Skip this term
101388 ** pTerm converted into an IN operator.
101432 ** The input to this routine is an WhereTerm structure with only the
101491 extraRight = x-1; /* ON clause terms may not be used with an index
101551 ** skipped. Or, if the children are satisfied by an index, the original
101578 ** an OR operator.
101689 /* When sqlite_stat2 histogram data is available an operator of the
101691 ** as "x>NULL" if x is not an INTEGER PRIMARY KEY. So construct a
101730 ** an index for tables to the left of the join.
101756 ** for an expression of type TK_COLUMN that refers to the same column and
101761 ** If such an expression is found, its index in pList->a[] is returned. If
101873 /* If any of the expressions is an IPK column on table iBase, then return
101916 ** pOrderBy is an ORDER BY clause from a SELECT statement. pTab is the
101918 ** the table has a cursor number of "base". pIdx is an index on pTab.
101954 ** or an index structure allocated on the stack by bestBtreeIndex() to
101976 /* Can not use an index sort on anything that is not a column in the
101999 /* If an index column that is constrained by == fails to match an
102007 /* If an index column fails to match and is not constrained by ==
102077 ** Two routines for printing the content of an sqlite3_index_info
102128 ** This routine attempts to find an scanning strategy that can be used
102129 ** to optimize an 'OR' expression that is part of a WHERE clause.
102194 /* If there is an ORDER BY clause, increase the scan cost to account
102221 ** could be used with an index to access pSrc, assuming an appropriate
102263 /* There is no point in building an automatic index for a single scan */
102315 ** Generate code to construct the Index object for an automatic index
102337 int regRecord; /* Register holding an index record */
102374 ** covering index. A "covering index" is an index that contains all
102468 ** Allocate and populate an sqlite3_index_info structure. It is the
102579 ** If an error occurs, pParse is populated with an error message and a
102583 ** Whether or not an error is returned, it is the responsibility of the
102612 "table %s: xBestIndex returned an invalid plan", pTab->zName);
102657 ** wsFlags in an uninitialized state, the caller may behave unpredictably.
102681 ** be a pointer to an sqlite3_vtab structure. Otherwise
102703 ** For each attempt at picking an index, the order of tables in the
102740 /* If there is an ORDER BY clause, and the selected virtual table index
102769 ** to optimize an OR expression within the WHERE clause.
102776 ** Argument pIdx is a pointer to an index structure that has an array of
102794 ** Or, if an OOM occurs while converting text values between encodings,
102890 ** an sqlite3_value structure containing the same value, with affinity
102896 ** is an SQL variable that currently has a non-NULL value bound to it,
102897 ** create an sqlite3_value structure containing this value, again with
102902 ** If an error occurs, return an error code. Otherwise, SQLITE_OK.
102925 ** by scanning an index for a range of values. The range may have an upper
102952 ** The returned value is an integer between 1 and 100, inclusive. A return
103045 ** an equality constraint x=VALUE and where that VALUE occurs in
103047 ** column of an index and sqlite_stat2 histogram data is available
103052 ** If unable to make an estimate, leave *pnRow unchanged and return
103103 ** an IN constraint where the right-hand side of the IN operator
103109 ** If unable to make an estimate, leave *pnRow unchanged and return
103184 ** The lowest cost plan wins. The cost is an estimate of the amount of
103196 ** If there was an INDEXED BY clause (pSrc->pIndex) attached to the table in
103232 ** use an index to satisfy IS NULL constraints on that table. This is
103296 ** The "in-multiplier". This is an estimate of how many seek operations
103302 ** SQLite must perform 9 lookups on an index on (a, b), so nInMul is
103327 ** space to 1/4rd its original size. So an x>? constraint reduces
103331 ** Boolean. True if there is an ORDER BY clause that will require an
103340 ** used by the SELECT statement are present in the index (such an
103416 /* If there is an ORDER BY clause and the index being considered will
103418 ** in wsFlags. Otherwise, if there is an ORDER BY clause but the index
103436 /* If currently calculating the cost of using an index (not the IPK
103458 ** Estimate the number of rows of output. For an "x IN (SELECT...)"
103495 ** records being an important factor. Both moves and searches are
103508 ** We add an additional 4x penalty to full table scans. This causes
103509 ** the cost function to err on the side of choosing an index over
103510 ** choosing a full scan. This 4x full-scan penalty is an arguable
103520 /* For an index lookup followed by a table lookup:
103565 ** the notReady mask. When computing an "optimal" index, the notReady
103570 ** might be selected even when there exists an optimal index that has
103638 /* If there was an INDEXED BY clause, then only that one index is
103651 ** SQLite outputs rows in in the absence of an ORDER BY clause. */
103722 ** of the join. Disabling is an optimization. When terms are satisfied
103745 ** Code an OP_Affinity opcode to apply the column affinity string zAff
103748 ** As an optimization, SQLITE_AFF_NONE entries (which are no-ops) at the
103850 ** Generate code that will evaluate all == and IN constraints for an
103856 ** example, the third "c" value is an inequality. So only two
103870 ** this routine allocates an additional nEq memory cells for internal
103906 /* This module is only called on query plans that use an index. */
103965 ** pStr holds the text of an expression that we are building up one term
103985 ** of the subset of table rows scanned by the strategy in the form of an
103992 ** is run and there is an index on (a, b), then this function returns a
104032 ** This function is a no-op unless currently processing an EXPLAIN QUERY PLAN
104033 ** command. If the query being compiled is an EXPLAIN QUERY PLAN, a single
104157 ** When there is an IN operator, we also have a "addrNxt" label that
104220 /* Case 1: We can directly reference a single row using an
104240 /* Case 2: We have an inequality comparison against the ROWID field.
104317 /* Case 3: A scan using an index.
104324 ** the right-most column can be an inequality - the rest must
104345 ** constraints but an index is selected anyway, in order
104346 ** to force the output order to conform to an ORDER BY.
104364 int isMinQuery = 0; /* If this is an optimized SELECT min(x).. */
104415 ** and store the values of those terms in an array of registers
104424 /* If we are doing a reverse order scan on an ascending index, or
104639 ** equivalent to an empty rowset.
104646 ** fall through to the next instruction, just as an OP_Next does if
104647 ** called on an uninitialized cursor.
104811 ** The return value is a pointer to an opaque structure that contains
104816 ** If an error occurs, this routine returns NULL.
104852 ** entire tables. Thus a three-way join is an O(N^3) operation. But if
104886 ** is called from an UPDATE or DELETE statement, then ppOrderBy is NULL.
104888 ** If an index can be used so that the natural output order of the table
104890 ** *ppOrderBy is set to NULL. This is an optimization that prevents an
104891 ** unnecessary sort of the result set if an index appropriate for the
104938 ** and the WhereMaskSet structure. Since WhereClause contains an 8-byte
104939 ** field (type Bitmask) it must be aligned on an 8-byte boundary on
104968 ** subexpression is separated by an AND operator.
105069 Bitmask notIndexed; /* Mask of tables that cannot use an index */
105081 ** to choose from. The first test looks for an "optimal" scan. In
105082 ** this context an optimal scan is one that uses the same strategy
105092 ** Note that the WhereCost.nRow parameter for an optimal scan might
105156 /* If an INDEXED BY clause is present, then the plan must use that
105172 ** the full-table-scan is an "optimal" plan as defined above.
105174 ** (3) All tables have an INDEXED BY clause or this table lacks an
105177 ** that a best-so-far is always selected even if an impossible
105232 /* Check that if the table scanned by this loop iteration had an
105235 ** Return an error.
105243 /* If an INDEXED BY clause is used, the bestIndex() function is
105245 ** if it find an index at all. */
105262 /* If the caller is an UPDATE or DELETE statement that is requesting
105490 /* If this scan uses an index, make code substitutions to read data
105634 /* Construct an expression node for a unary postfix operator
105659 /* Construct an expression node for a unary prefix operator
105776 ** functions that take a state number and lookahead value and return an
106298 ** the parse is retried before an error is thrown.
106393 /* The state of the parser is completely contained in an instance of
108170 /* When doing a nested parse, one can include terms in an expression
108809 ** <li> A pointer to the parser (an opaque structure.)
108828 int yyerrorhit = 0; /* True if yymajor has invoked an error */
108879 ** The response to an error depends upon whether or not the
108880 ** grammar defines an error token "ERROR".
108947 ** * Report an error message, and throw away the input token.
108984 ** This file contains C code that splits an SQL input string up into
108993 ** an upper-to-lower case map. On EBCDIC machines we also need
109024 ** The sqlite3KeywordCode function looks up an identifier to determine if
109043 ** or not a given identifier is really an SQL keyword. The same thing
109312 ** If X is a character that can be used in an identifier then
109316 ** allowed in an identifier. For 7-bit characters,
109625 ** passed in. An SQLITE_ status code is returned. If an error occurs
109626 ** then an and attempt is made to write an error message into
109638 int mxSqlLen; /* Max length of an SQL string */
109833 ** (1) START At the beginning or end of an SQL statement. This routine
109873 ** is look for a semicolon that is not part of an string or comment.
110192 ** returns an integer equal to SQLITE_VERSION_NUMBER.
110310 ** the pInitMutex mutex. Return an error in either case. */
110468 /* Specify an alternative mutex implementation */
110481 /* Specify an alternative malloc implementation */
110512 /* Specify an alternative page cache implementation */
110549 ** ENABLE_MEMSYS5 is defined, return an error.
110669 ** Configuration settings for an individual database connection
110835 ** Close an existing SQLite database
111002 /* SQLITE_OK */ "not an error",
111041 ** an integer number of milliseconds passed in as the first
111086 ** This routine is called when an operation failed with a lock.
111088 ** returns 0, the operation aborts with an SQLITE_BUSY error.
111103 ** This routine sets the busy callback for an Sqlite database to the
111121 ** This routine sets the progress callback for an Sqlite database to the
111171 ** that if a malloc() fails in sqlite3_create_function(), an error code
111225 /* Check if an existing function is being overridden or deleted. If so,
111248 /* If an older version of the function with a configured destructor is
111350 ** When virtual tables intend to provide an overloaded function, they
111473 ** is greater than sqlite3.pWalArg cast to an integer (the value configured by
111492 ** Configure an sqlite3_wal_hook() callback to automatically checkpoint
111554 /* Initialize the output variables to -1 in case an error occurs. */
111599 ** an error occurs while running the checkpoint, an SQLite error code is
111607 ** checkpointed. If an error is encountered it is returned immediately -
111745 ** Return the most recent error code generated by an SQLite routine. If NULL is
111800 /* Check if this call is removing or replacing an existing collation
111902 ** If an invalid limit index is supplied, report -1.
111966 ** If an error occurs, then an SQLite error code is returned and *pzErrMsg
111967 ** may be set to point to a buffer containing an English language error
112201 ** Throw an error if any non-sense combination is used. If we
112599 ** This function is now an anachronism. It used to be used to recover from a
112734 ** 2. The table is not a view and the column name identified an
112755 ** to whatever their local counterparts contain. If an error did occur,
112885 ** is an array of integers that defines the test. Return -1 on a
112886 ** memory allocation error, 0 on success, or non-zero for an error.
112920 ** an incompatible database file format. Changing the PENDING byte
113226 ** Register an unlock-notify callback.
113229 ** but has received an SQLITE_LOCKED error because another connection
113370 ** This is a difficult situation to handle. Returning an error
113371 ** code to the caller is insufficient, as even if an error code
113375 ** indefinitely for an unlock-notify callback that will never
113420 ** This is called when the database connection passed as an argument is
113446 ** This is an SQLite module implementing full-text search.
113452 ** * The FTS3 module is being built as an extension
113521 ** memory. A "position" is an index of a token in the token stream
113546 ** A bare doclist omits the position information, becoming an
113598 ** SegmentWriter creates new leaf nodes, or when an interior node
113615 ** Here, optional { X } means an optional element, while array { X }
113644 ** This could be either a leaf node or an interior node. If the top
113716 ** write an empty doclist (varint(docid) varint(POS_END)), for updates
113751 ** FTS4 is really an extension for FTS3. It is enabled using the
113753 ** the SQLITE_ENABLE_FTS4 macro to serve as an alisse for SQLITE_ENABLE_FTS3.
113798 ** an sqlite3_tokenizer_module containing pointers to the callback
113799 ** functions that make up an implementation.
113801 ** When an fts3 table is created, it passes any arguments passed to
113804 ** implementation. The xCreate() function in turn returns an
113808 ** To tokenize an input buffer, the sqlite3_tokenizer_module.xOpen()
113809 ** method is called. It returns an sqlite3_tokenizer_cursor object
113836 ** This method should return either SQLITE_OK (0), or an SQLite error
113849 ** Destroy an existing tokenizer. The fts3 module calls this method
113855 ** Create a tokenizer cursor to tokenize an input buffer. The caller
113866 ** Destroy an existing tokenizer cursor. The fts3 module calls this
113875 ** the end of the buffer has been reached, or an SQLite error code.
113947 /* A complete hash table is an instance of the following structure.
113967 /* Each element in the hash table is an instance of the following
114058 ** Macro to return the number of elements in an array. SQLite has a
114060 ** a collision when building an amalgamation with built-in FTS3.
114086 ** It is considered impossible for an index to use more than 1024 levels. In
114171 ** A connection to a fulltext index is an instance of the following
114172 ** structure. The xCreate and xConnect methods create an instance
114212 ** there is an entry in the aIndex[] array. Index 0 is an index of all the
114214 ** is an index of prefixes of a specific length.
114238 ** virtual table cursor (an instance of the following structure) using
114342 ** matchinfo data. If it is not NULL, it points to an array of size nCol*3,
114595 ** Convert an SQL-style quoted string into a normal string by removing
114740 ** Otherwise, return an SQLite error code.
114752 ** Otherwise, if an error occurs, an SQLite error code is stored in *pRc
114791 ** If the p->bHasDocsize boolean is true (indicating that this is an
114792 ** FTS4 table, not an FTS3 table) then also create the %_docsize and
114851 ** Otherwise, if an error occurs, an SQLite error code is stored in *pRc
114911 ** Append the output of a printf() style formatting to an existing string.
114972 ** being returned directly each column of text data is passed to an SQL
114983 ** a NULL pointer is returned). Otherwise, if an OOM error is encountered
115012 ** is preceded by zFunc and an open bracket, and followed by a closed
115022 ** a NULL pointer is returned). Otherwise, if an OOM error is encountered
115051 ** Only decimal digits ('0'..'9') may be part of an integer value.
115072 ** This function is called to allocate an array of Fts3Index structures
115083 ** array. If an error does occur, an SQLite error code is returned.
115085 ** Regardless of whether or not an error is returned, it is the responsibility
115208 /* Check if it is an FTS4 special argument. */
115369 /* If this is an xCreate call, create the underlying tables in the
115441 /* By default use a full table scan. This is an expensive option,
115466 ** it would lead to an "unable to use function MATCH in the requested
115511 /* Allocate a buffer large enough for an Fts3Cursor structure. If the
115584 ** If an OOM error occurs, SQLITE_NOMEM is returned. Otherwise, SQLITE_OK.
115607 ** varints from the buffer) does not risk an overread. If zNode is a
115686 ** The buffer pointed to by argument zNode (size nNode bytes) contains an
115704 ** If an error occurs, an error code other than SQLITE_OK is returned.
115782 /* The end of a position list is marked by a zero encoded as an FTS3
115847 ** Value used to signify the end of an position-list. This is safe because
115883 ** If parameter iCol is not 0, write an POS_COLUMN (1) byte followed by
115991 ** If isSaveLeft is 0, an entry is added to the output position list for
116116 ** position lists correspond to the left and right phrases of an expression
116254 ** This function does an "OR" merge of two doclists (output contains all
116260 ** If no error occurs, *paOut is set to point at an sqlite3_malloc'd buffer
116264 ** If an error occurs, an SQLite error code is returned. The output values
116415 ** If an OOM error occurs, return SQLITE_NOMEM. In this case it is
116461 ** as the first argument. The merge is an "OR" merge (see function
116470 ** This function returns SQLITE_OK if the merge is successful, or an
116471 ** SQLite error code (SQLITE_NOMEM) if an error occurs.
116553 ** This function returns SQLITE_OK if successful, or an SQLite error code
116572 ** made by an fts4aux module, not an FTS table. In this case calling
116646 /* "isScan" is only set to true by the ft4aux module, an ordinary
116661 ** SQLITE_OK is returned if no error occurs, otherwise an SQLite error code.
116673 ** Open an Fts3MultiSegReader to scan the doclist for term zTerm/nTerm. Or,
116677 ** an SQLite error code.
116682 ** SQLITE_OK is returned if no error occurs, otherwise an SQLite error code.
116683 ** Output parameter *ppSegcsr is set to 0 if an error occurs.
116698 int bFound = 0; /* True once an index has been found */
116737 ** Free an Fts3MultiSegReader allocated by fts3TermSegReaderCursor().
116828 ** subsequently to determine whether or not an EOF was hit.
116990 /* This call is a request for the "docid" column. Since "docid" is an
117102 ** output variable *ppCsr and SQLITE_OK is returned. Otherwise, an error
117194 ** where 't' is the name of an FTS3 table.
117284 ** Implementation of FTS3 xRename method. Rename an fts3 table.
117396 ** This function is registered as the module destructor (called when an
117509 ** Allocate an Fts3MultiSegReader for each token in the expression headed
117514 ** Fts3SegReader objects internally to provide an interface to seek or scan
117520 ** and merged incrementally. Otherwise, it has to be merged into an in-memory
117621 ** SQLITE_OK is returned if no error occurs, otherwise an SQLite error code.
117657 ** SQLITE_OK is returned if no error occurs, otherwise an SQLite error code.
117757 ** function has been called successfully on an Fts3Phrase, it may be
117764 ** SQLITE_OK is returned if no error occurs, otherwise an SQLite error code.
117858 ** If an error occurs, return an SQLite error code. Otherwise, return
117942 ** If an error occurs within this function, *pRc is set to an SQLite error
117991 ** This function is used to populate an allocated Fts3TokenAndCost array.
117994 ** Otherwise, if an error occurs during execution, *pRc is set to an
118038 ** an SQLite error code.
118042 ** of data that will fit on a single leaf page of an intkey table in
118104 ** called on each token to defer. Otherwise, an SQLite error code is
118342 ** If an error occurs, *pRc is set to an SQLite error code. Otherwise, if
118366 ** is advanced to the next row that contains an instance of "A * C",
118576 ** If an error occurs during execution of this function, *pRc is set to
118746 ** a no-op. If an error occurs within this function, *pRc is set to an
118828 ** populated. Otherwise, if an error occurs, an SQLite error code is returned.
118981 ** compression and is terminated by either an 0x01 or 0x00 byte. For example,
119135 /* The user should specify a single argument - the name of an fts3 table. */
119502 ** if successful or an error code if sqlite3_create_module() fails.
119573 ** than an implicit AND. When using the new, both implicity and explicit
119645 ** is defined to accept an argument of type int, its behaviour when passed
119646 ** an integer that falls outside of the range of the unsigned char type
119648 ** is defined to accept an argument of type char, and always returns 0 for
119670 ** and other information (column names etc.) in pParse. Create an Fts3Expr
119738 ** Enlarge a memory allocation. If an out-of-memory allocation occurs,
119751 ** that appeared as part of an fts3 query expression. Neither quote character
119753 ** input buffer and create an Fts3Expr structure of type FTSQUERY_PHRASE
119873 ** The output variable *ppExpr is populated with an allocated Fts3Expr
119876 ** Returns an SQLite error code. SQLITE_OK if everything works, SQLITE_NOMEM
119878 ** If SQLITE_ERROR is returned, pContext is populated with an error message.
119908 /* Skip over any whitespace before checking for a keyword, an open or
119932 /* If this is a "NEAR" keyword, check for an explicit nearness. */
119944 ** the next byte must contain either whitespace, an open or close
119968 /* Check for an open bracket. */
120006 ** interface. Before doing so, figure out if there is an explicit
120011 ** an implementation artifact or an intentional decision when fts3 was
120034 ** The argument is an Fts3Expr structure for a binary operator (any type
120035 ** except an FTSQUERY_PHRASE). Return an integer value representing the
120096 ** returns either when the end of the buffer is reached or an unmatched
120128 /* Create an implicit NOT operator. */
120147 ** an expression contained in parenthesis is required. If a
120158 /* Insert an implicit AND operator. */
120179 ** Return an error in either case.
120244 ** an fts3 query expression, respectively. This function attempts to parse the
120247 ** of the parsed expression tree and SQLITE_OK is returned. If an error
120356 ** sqlite3_free() to release the memory. If an OOM condition is encountered,
120525 ** * The FTS3 module is being built as an extension
120641 ** with types "const void*" and "int" and returns an "int".
120667 /* Link an element into the hash table
120719 /* This function (for internal use only) locates an element in an
120802 ** Attempt to locate an element of the hash table pH with a key
120813 /* Insert an element into the hash table pH. The key is pKey,nKey
120908 ** * The FTS3 module is being built as an extension
121063 ** In prose: A word is an optional consonant followed by zero or
121064 ** vowel-consonant pairs followed by an optional vowel. "m" is the
121073 ** for an instance of of a consonant followed by a vowel.
121548 ** This is part of an SQLite module implementing full-text search.
121555 ** * The FTS3 module is being built as an extension
121580 ** an error is returned.
121915 ** in the README.tokenizer file as an example, so it is important to
122045 ** * The FTS3 module is being built as an extension
122293 ** it is always safe to read up to two varints from it without risking an
122494 ** This function is used to obtain an SQLite prepared statement handle
122497 ** Otherwise, an SQLite error code is returned and *pp is set to 0.
122499 ** If argument apVal is not NULL, then it must point to an array with
122634 ** Returns SQLITE_OK if the statement is successfully executed, or an
122688 ** return SQLITE_OK. If an error occurs while preparing the statement,
122689 ** return an SQLite error code.
122736 ** if successful, or an SQLite error code otherwise.
122786 ** If an OOM error occurs, *pRc is set to SQLITE_NOMEM before returning.
122850 ** Add an entry to one of the pending-terms hash tables.
122888 ** If successful, SQLITE_OK is returned. Otherwise, an SQLite error code.
123001 ** This function is called by the xUpdate() method as part of an INSERT
123022 ** This function is called by the xUpdate() method for an INSERT operation.
123062 ** In FTS3, this is an error. It is an error to specify non-NULL values
123113 ** (an integer) of a row about to be deleted. Remove all terms from the
123167 ** returned. Otherwise, an SQLite error code is returned.
123218 ** If an error occurs, or the table does not contain the specified row,
123219 ** an SQLite error code is returned. Otherwise, SQLITE_OK is returned. If
123223 ** This function may leave an open sqlite3_blob* handle in the
123332 ** SQLITE_DONE. Otherwise, an SQLite error code.
123375 /* If iCurrentBlock>=iLeafEndBlock, this is an EOF condition. All leaf
123491 /* A pending-terms seg-reader for an FTS4 table that uses order=desc.
123511 /* Pointer p currently points at the first byte of an offset list. The
123666 ** an array of pending terms by term. This occurs as part of flushing
123684 ** This function is used to allocate an Fts3SegReader that iterates through
123817 ** version, it is assumed that each SegReader points to an entry in
123879 ** Argument apSegment is an array of nSegment elements. It is known that
124120 ** blocks were written to the db). Otherwise, an SQLite error code is
124190 ** If successful, SQLITE_OK is returned. Otherwise, an SQLite error code.
124328 ** returned. Otherwise, an SQLite error code.
124375 ** The first value in the apVal[] array is assumed to contain an integer.
124381 ** document pRowid, or false otherwise, and SQLITE_OK is returned. If an
124382 ** error occurs, an SQLite error code is returned.
124403 ** Return SQLITE_OK if successful, or an SQLite error code if not.
124438 ** SQLITE_OK is returned if successful, otherwise an SQLite error code.
124534 ** If successful, return SQLITE_OK. Otherwise, if an OOM error is encountered
124779 ** Similarly, if this is a search for an exact match, and the first term
124917 ** Otherwise, if successful, SQLITE_OK is returned. If an error occurs,
124918 ** an SQLite error code is returned.
125319 ** Add an entry for token pToken to the pCsr->pDeferred list.
125390 int isRemove = 0; /* True for an UPDATE or DELETE */
125420 /* If this is an INSERT operation, or an UPDATE that modifies the rowid
125442 ** the statement is either an INSERT or an UPDATE that modifies the
125451 ** be losslessly converted to an integer. In this case, the eventual
125455 ** docid=$pNewRowid if $pNewRowid is not an integer value).
125477 /* If this is an INSERT or UPDATE operation, insert the new record. */
125567 ** Used as an fts3ExprIterate() context when loading phrase doclists to
125611 ** This type is used as an fts3ExprIterate() context object while
125641 ** element of the list is represented by an FTS3 varint that takes the value
125653 ** When this function is called, *pp points to the start of an element of
125690 ** Iterate through all phrase nodes in an FTS3 query, except those that
125709 ** This is an fts3ExprIterate() callback used while loading the doclists
125885 ** This function is an fts3ExprIterate() callback used by fts3BestSnippet().
125886 ** Each invocation populates an element of the SnippetIter.aPhrase[] array.
126418 ** Advance the iterator passed as an argument to the next position. Return
126446 ** Otherwise, if an error occurs, an SQLite error code is returned and the
126516 ** Populate the buffer pInfo->aMatchinfo[] with an array of integers to
126528 ** Return SQLITE_OK if successful, or an SQLite error code if an error
126633 ** 'matchinfo' data is an array of 32-bit unsigned integers (C type u32).
126820 ** This function is an fts3ExprIterate() callback used by sqlite3Fts3Offsets().
126904 /* Retreive the text stored in column iCol. If an SQL NULL is stored
126906 ** If an OOM occurs while retrieving the data (this can happen if SQLite
127044 ** algorithms packaged as an SQLite virtual table module.
127062 ** an entry in the %_parent table associating the node with its parent.
127063 ** And for each row of data in the table, there is an entry in the %_rowid
127067 ** The root node of an r-tree always exists, even if the r-tree table is
127080 ** consists of a single 8-byte integer followed by an even number
127089 ** This file contains an implementation of a couple of different variants
127220 ** If an R*-tree "Reinsert" operation is required, the same number of
127231 ** 2^40 is greater than 2^64, an r-tree structure always has a depth of
127254 ** The argument is an RtreeCoord. Return the value stored within the RtreeCoord
127314 ** the right-hand-side of an SQL MATCH operator used to constrain an
127490 ** Obtain a reference to an r-tree node.
127691 ** an internal node, then the 64-bit integer is a child page number.
127918 ** Return SQLITE_OK if successful or an SQLite error code if an error
127970 ** Return SQLITE_OK if successful or an SQLite error code if an error
128196 ** *ppLeaf to 0 and return SQLITE_OK. If an error occurs, set *ppLeaf
128197 ** to zero and return an SQLite error code.
128307 ** can be cast into an RtreeMatchArg object. One created using
128308 ** an sqlite3_rtree_geometry_callback() SQL user function.
128397 /* We have an equality constraint on the rowid. Use strategy 1. */
128407 /* This strategy involves a two rowid lookups on an B-Tree structures
128408 ** and then a linear search of an R-Tree node. This should be
128410 ** sqlite uses an internal cost of 0.0).
129211 /* Allocate an array and populate it with a copy of pCell and
129331 ** This operation is required when a row is deleted (or updated - an update
129332 ** is implemented as a delete followed by an insert). SQLite provides the
129758 /* Constraint handling. A write operation on an r-tree table may return
129818 /* If azData[0] is not an SQL NULL value, it is the rowid of a
129883 rtreeConnect, /* xConnect - connect to an existing table */
129979 ** The second argument to this function contains the text of an SQL statement
129982 ** is written to *piVal and SQLITE_OK returned. Otherwise, an SQLite error
130004 ** Otherwise, an SQLite error code is returned.
130006 ** If this function is being called as part of an xConnect(), then the rtree
130010 ** Otherwise, for an xCreate(), use 64 bytes less than the database page-size.
130069 "Wrong number of columns for an rtree table", /* 1 */
130070 "Too few columns for an rtree table", /* 2 */
130071 "Too many columns for an rtree table" /* 3 */
130147 ** an r-tree node, and the number of dimensions the r-tree indexes.
130245 ** Each call to sqlite3_rtree_geometry_callback() creates an ordinary SQLite
130326 ** This file implements an integration between the ICU library
130327 ** ("International Components for Unicode", an open-source library
130400 ** 1. uPattern is an unescaped match-all character "%",
130401 ** 2. uPattern is an unescaped match-one character "_",
130402 ** 3. uPattern is an unescaped escape character, or
130403 ** 4. uPattern is to be handled as an ordinary character
130463 ** is implemented as like(B, A). If there is an escape character E,
130489 ** Otherwise, return an error.
130509 ** This function is called when an ICU function called from within
130510 ** the implementation of an SQL scalar function returns an error.
130513 ** loaded with an error message based on the following two args.
130539 ** argument is an SQL NULL, then NULL Is returned. Otherwise, the result
130602 ** leaving the regular expression object configured with an invalid
130628 ** of the locale to use. Passing an empty string ("") or SQL NULL value
130713 ** types to an SQLite database connection. It is intended to be called
130718 ** Where <locale> is a string containing an ICU locale identifier (i.e.