Lines Matching defs:by

74 ** Include the configuration header output by 'configure' if we're using the
143 ** some extent by SQLITE_MAX_SQL_LENGTH. But sometime you might
219 ** imposed by the use of 16-bit offsets within each page.
378 ** SQLITE_CONFIG_MEMSTATUS are available by default or not. This value can
569 ** notice, and should not be referenced by programs that use SQLite.
627 ** Ensure these symbols were not defined by some previous header file.
675 ** verify that values returned by these interfaces match the macros in
711 ** over the list of options that were defined at compile time by
714 ** prefix is omitted from any strings returned by
718 ** and sqlite3_compileoption_get() may be omitted by specifying the
748 ** This interface can be used by an application to make sure that the
754 ** SQLITE_THREADSAFE=1 or =2 then mutexes are enabled by default but
759 ** thread safety, not any run-time changes to that setting made by
761 ** is unchanged by calls to sqlite3_config().)^
771 ** Each open SQLite database is represented by a pointer to an instance of
907 ** <li> The application must not close [database connection] specified by
944 #define SQLITE_INTERRUPT 9 /* Operation terminated by sqlite3_interrupt()*/
1116 ** operating systems natively supported by SQLite, only Mac OSX
1129 ** want to subclass this object by appending additional fields
1142 ** Every file opened by the [sqlite3_vfs.xOpen] method populates an
1146 ** against the open file represented by the [sqlite3_file] object.
1268 ** The [SQLITE_FCNTL_SIZE_HINT] opcode is used by SQLite to give the VFS
1277 ** by the user. The fourth argument to [sqlite3_file_control()] should
1288 ** ^(The [SQLITE_FCNTL_SYNC_OMITTED] opcode is generated internally by
1304 ** by an additional 25 milliseconds with each subsequent retry. This
1368 ** structure used by this VFS. mxPathname is the maximum length of
1371 ** Registered sqlite3_vfs objects are kept on a linked list formed by
1392 ** consist of a single "-" character followed by no more than
1455 ** ^At least szOsFile bytes of memory are allocated by SQLite
1476 ** handled as a fatal error by SQLite, vfs implementations should endeavor
1477 ** to prevent this by setting mxPathname to a sufficiently large value.
1490 ** Day Number multiplied by 86400000 (the number of milliseconds in
1498 ** are not used by the SQLite core. These optional interfaces are provided
1499 ** by some VFSes to facilitate testing of the VFS code. By overriding
1562 ** The SQLITE_ACCESS_READWRITE constant is currently used only by the
1571 #define SQLITE_ACCESS_READWRITE 1 /* Used by PRAGMA temp_store_directory */
1578 ** allowed by the xShmLock method of [sqlite3_io_methods]. The
1617 ** deallocates any resources that were allocated by sqlite3_initialize().
1649 ** ^The sqlite3_initialize() routine is called internally by many other
1667 ** performed by these routines include allocation or deallocation
1675 ** interface is called automatically by sqlite3_initialize() and
1676 ** sqlite3_os_end() is called by sqlite3_shutdown(). Appropriate
1702 ** must insure that no other SQLite interfaces are invoked by other
1705 ** [sqlite3_initialize()] or after shutdown by [sqlite3_shutdown()].
1769 ** xRealloc is always a value returned by a prior call to xRoundup.
1785 ** structures. The xShutdown method is invoked (indirectly) by
1787 ** by xInit. The pAppData pointer is used as the only parameter to
1796 ** it is by default) and so the methods are automatically serialized.
1835 ** by a single thread. ^If SQLite is compiled with
1899 ** ^Memory allocation statistics are enabled by default unless SQLite is
1901 ** allocation statistics are disabled by default.
1917 ** scratch memory beyond what is provided by this configuration option, then
1933 ** ^SQLite will use the memory provided by the first argument to satisfy its
1935 ** page cache memory is needed beyond what is provided by this option, then
1944 ** for by [SQLITE_CONFIG_SCRATCH] and [SQLITE_CONFIG_PAGECACHE].
2008 ** invoked by [sqlite3_log()] to process each logging event. ^If the
2018 ** supplied by the application must not invoke any SQLite interface.
2032 ** disabled. The default value may be changed by compiling with the
2084 ** when the "current value" returned by
2122 ** codes are disabled by default for historical compatibility.
2132 ** names are not also used by explicitly declared columns. ^If
2147 ** by this routine reverts to what it was before the trigger or virtual
2151 ** successful [INSERT] and does not change the value returned by this
2169 ** then the value returned by [sqlite3_last_insert_rowid()] is
2179 ** or inserted or deleted by the most recently completed SQL statement
2180 ** on the [database connection] specified by the first parameter.
2181 ** ^(Only changes that are directly specified by the [INSERT], [UPDATE],
2182 ** or [DELETE] statement are counted. Auxiliary changes caused by
2185 ** including changes caused by triggers and foreign key actions.
2187 ** ^Changes to a view that are simulated by an [INSTEAD OF trigger]
2191 ** caused by an INSERT, DELETE, or UPDATE statement. Rows that
2193 ** rollback, ABORT processing, [DROP TABLE], or by any other
2218 ** caused by subtriggers since those have their own context.)^
2232 ** ^This function returns the number of row changes caused by [INSERT],
2234 ** ^(The count returned by sqlite3_total_changes() includes all changes
2235 ** from all [CREATE TRIGGER | trigger] contexts and changes made by
2284 ** not effected by the sqlite3_interrupt().
2317 ** automatically by sqlite3_complete16(). If that initialization fails,
2358 ** because it is blocked by the second and the second process cannot
2359 ** proceed because it is blocked by the first. If both processes
2422 ** Definition: A <b>result table</b> is memory data structure created by the
2436 ** string representation as returned by [sqlite3_column_text()].
2506 ** The strings returned by these two routines should be
2507 ** released by [sqlite3_free()]. ^Both routines return a
2513 ** buffer supplied as the second parameter whose size is given by
2613 ** by sqlite3_malloc() or sqlite3_realloc() releases that memory so
2636 ** by sqlite3_realloc() and the prior allocation is freed.
2640 ** ^The memory returned by sqlite3_malloc() and sqlite3_realloc()
2652 ** filenames between the UTF-8 encoding used by SQLite
2653 ** and whatever filename encoding is used by the particular Windows
2682 ** was last reset. ^The values returned by [sqlite3_memory_used()] and
2684 ** added by SQLite in its implementation of [sqlite3_malloc()],
2685 ** but not overhead added by the any underlying system library
2691 ** by [sqlite3_memory_highwater(1)] is the high-water mark
2708 ** ^The first time this routine is invoked (either internally or by
2723 ** by [sqlite3_prepare()] or its variants [sqlite3_prepare_v2()],
2765 ** SQL queries for evaluation by a database. But the application does
2778 ** previous call.)^ ^Disable the authorizer by installing a NULL callback.
2779 ** The authorizer is disabled by default.
2878 ** ^The callback function registered by sqlite3_trace() is invoked at
2879 ** various times when an SQL statement is being run by [sqlite3_step()].
2886 ** ^The callback function registered by sqlite3_profile() is invoked
2918 ** ^The progress handler is also disabled by setting N to a value less
2936 ** ^These routines open an SQLite database file as specified by the
2954 ** associated with the [database connection] handle should be released by
2972 ** only if the file is write protected by the operating system. In either
3022 ** [sqlite3_config()] method or by the [SQLITE_USE_URI] compile-time option.
3024 ** by default, but future releases of SQLite might enable URI filename
3025 ** interpretation by default. See "[URI filenames]" for additional
3044 ** either by SQLite itself, or by a [VFS | custom VFS implementation].
3053 ** present, then the VFS specified by the option takes precedence over
3066 ** less restrictive than that specified by the flags passed as the third
3075 ** a URI filename, its value overrides any behaviour requested by setting
3104 ** Regardless of whether or not shared-cache mode is enabled by
3114 ** percent sign - "%" - followed by exactly two hexadecimal digits
3117 ** hexadecimal escape sequences replaced by a single byte containing the
3178 ** However, the error string might be overwritten or deallocated by
3187 ** by invoking [sqlite3_mutex_enter]([sqlite3_db_mutex](D)) before beginning
3192 ** was invoked incorrectly by the application. In that case, the
3215 ** <li> Run the SQL by calling [sqlite3_step()] one or more times.
3230 ** on a connection by connection basis. The first parameter is the
3239 ** set at compile-time by a C preprocessor macro called
3252 ** by untrusted external sources. An example application might be a
3254 ** separate databases controlled by JavaScript applications downloaded
3256 ** large, default limits. Databases managed by external sources can
3260 ** created by an untrusted script can be contained using the
3353 ** performance advantage to be gained by passing an nByte parameter that
3510 ** ^The sqlite3_value object returned by
3539 ** literals may be replaced by a [parameter] that matches one of following
3604 ** ^Bindings are not cleared by the [sqlite3_reset()] routine.
3700 ** ^Return the number of columns in the result set returned by the
3720 ** is destroyed by [sqlite3_finalize()] or until the statement is automatically
3721 ** reprepared by the first call to [sqlite3_step()] for a particular run
3749 ** reprepared by the first call to [sqlite3_step()] for a particular run
3757 ** ^These functions return information about the Nth result column returned by
3761 ** ^If the Nth column returned by the statement is an expression or
3854 ** is returned each time a new row of data is ready for processing by the
3860 ** the VM. More information may be found by calling [sqlite3_errmsg()].
3863 ** can be obtained by calling [sqlite3_reset()] on the
3865 ** the more specific error code is returned directly by sqlite3_step().
3871 ** be the case that the same database connection is being used by two or
3883 ** is broken by definition. The [SQLITE_OMIT_AUTORESET] compile-time option
3896 ** by sqlite3_step(). The use of the "v2" interface is recommended.
3977 ** returned by sqlite3_column_type() is only meaningful if no type
3979 ** the value returned by sqlite3_column_type() is undefined. Future
4001 ** ^The values returned by [sqlite3_column_bytes()] and
4003 ** of the string. ^For clarity: the values returned by
4007 ** ^Strings returned by sqlite3_column_text() and sqlite3_column_text16(),
4011 ** ^The object returned by [sqlite3_column_value()] is an
4014 ** If the [unprotected sqlite3_value] object returned by
4054 ** Note that when type conversions occur, pointers returned by prior
4082 ** <li>sqlite3_column_text() followed by sqlite3_column_bytes()</li>
4083 ** <li>sqlite3_column_blob() followed by sqlite3_column_bytes()</li>
4084 ** <li>sqlite3_column_text16() followed by sqlite3_column_bytes16()</li>
4202 ** set by [sqlite3_limit]([SQLITE_LIMIT_FUNCTION_ARG]). If the third
4232 ** The destructor is invoked when the function is deleted, either by being
4253 ** ^Built-in functions may be overloaded by new application-defined functions.
4296 ** text encodings supported by SQLite.
4362 ** [sqlite3_value_text16()] can be invalidated by a subsequent call to
4404 ** ^(The amount of space allocated by sqlite3_aggregate_context(C,N) is
4405 ** determined by the N parameter on first successful call. Changing the
4410 ** ^SQLite automatically frees the memory allocated by
4451 ** The following two functions may be used by scalar SQL functions to
4463 ** associated by the sqlite3_set_auxdata() function with the Nth argument
4470 ** pointed to by its 3rd parameter as the metadata for the N-th
4475 ** function given by the 4th parameter to sqlite3_set_auxdata() on
4515 ** These routines are used by the xFunc or xFinal callbacks that
4526 ** to by the second parameter and which is N bytes long where N is the
4535 ** by its 2nd argument.
4539 ** ^SQLite uses the string pointed to by the
4555 ** returned by SQLite as a result of an error in a function. ^By default,
4587 ** pointed to by the 2nd parameter are taken as the application-defined
4605 ** [unprotected sqlite3_value] object specified by the 2nd parameter. ^The
4674 ** by the eTextRep argument. The collating function must return an
4698 ** ^Collating functions are deleted when they are overridden by later
4829 ** ^SQLite implements this interface by calling the xSleep()
4842 ** created by SQLite when using a built-in [sqlite3_vfs | VFS]
4874 ** respectively. ^Autocommit mode is on by default.
4875 ** ^Autocommit mode is disabled by a [BEGIN] statement.
4876 ** ^Autocommit mode is re-enabled by a [COMMIT] or [ROLLBACK].
4896 ** returned by sqlite3_db_handle is the same [database connection]
4923 ** ^Any callback set by a previous call to sqlite3_commit_hook()
4927 ** ^Any callback set by a previous call to sqlite3_rollback_hook()
4969 ** with the [database connection] identified by the first argument
4971 ** ^Any callback set by a previous call to this function
5030 ** ^(The cache sharing mode set by this interface effects all subsequent
5038 ** ^Shared cache is disabled by default. But this might change in
5050 ** of heap memory by deallocating non-essential memory allocations
5051 ** held by the database library. Memory used to cache database
5064 ** soft limit on the amount of heap memory that may be allocated by SQLite.
5066 ** limit by reducing the number of pages held in the page cache
5076 ** size of the soft heap limit can be determined by invoking
5092 ** by [sqlite3_config]([SQLITE_CONFIG_PAGECACHE],...) rather than
5101 ** when memory is allocated by the page cache. Testing suggests that because
5130 ** ^The column is identified by the second, third and fourth parameters to
5134 ** for the table using the same algorithm used by the database engine to
5141 ** ^Metadata is returned by writing to the memory locations passed as the 5th
5157 ** ^The memory pointed to by the character pointers returned for the
5214 ** should free this memory by calling [sqlite3_free()].
5237 ** ^Extension loading is off by default. See ticket #1863.
5299 ** Structures used by the virtual table interface
5314 ** ^A virtual table module is created by filling in a persistent
5317 ** ^The registration remains valid until it is replaced by a different
5393 ** is true, then the constraint is assumed to be fully handled by the
5394 ** virtual table and is not checked again by SQLite.)^
5460 ** by the first parameter. ^The name of the module is given by the
5501 ** ^Virtual tables methods can set an error message by assigning a
5503 ** take care that any prior string is freed by a call to [sqlite3_free()]
5506 ** freed by sqlite3_free() and the zErrMsg field will be zeroed.
5524 ** by the [sqlite3_module.xClose | xClose] method. Cursors are used
5525 ** by the [xFilter], [xNext], [xEof], [xColumn], and [xRowid] methods
5559 ** the new function is not good for anything by itself. Its only
5561 ** by a [virtual table].
5581 ** ^Objects of this type are created by [sqlite3_blob_open()]
5582 ** and destroyed by [sqlite3_blob_close()].
5594 ** in other words, the same BLOB that would be selected by:
5621 ** ^(If the row that a BLOB handle points to is modified by an
5622 ** [UPDATE], [DELETE], or by [ON CONFLICT] side-effects
5629 ** rolled back by the expiration of the BLOB. Such changes will eventually
5633 ** the opened blob. ^The size of a blob may not be changed by this
5643 ** be released by a call to [sqlite3_blob_close()].
5660 ** by the rowid value passed as the second argument. Only the row can be
5699 ** by a failed call to [sqlite3_blob_open()]) is a harmless no-op.
5712 ** by a prior successful call to [sqlite3_blob_open()] and which has not
5713 ** been closed by [sqlite3_blob_close()]. Passing any other pointer in
5738 ** by a prior successful call to [sqlite3_blob_open()] and which has not
5739 ** been closed by [sqlite3_blob_close()]. Passing any other pointer in
5767 ** before the [BLOB handle] expired are not rolled back by the
5769 ** have been overwritten by the statement that expired the BLOB handle
5770 ** or by other independent statements.
5776 ** by a prior successful call to [sqlite3_blob_open()] and which has not
5777 ** been closed by [sqlite3_blob_close()]. Passing any other pointer in
5822 ** use by SQLite, code that links against SQLite is
5882 ** used by the current version of SQLite. Future versions of SQLite
5884 ** use by SQLite only. Applications that use SQLite mutexes should
5885 ** use only the dynamic mutexes returned by SQLITE_MUTEX_FAST or
5906 ** SQLITE_MUTEX_RECURSIVE can be entered multiple times by the same thread.
5915 ** implemented by sqlite3_mutex_try(). On those systems, sqlite3_mutex_try()
5920 ** previously entered by the same thread. ^(The behavior
5921 ** is undefined if the mutex is not currently entered by the
5943 ** Usually, the default mutex implementations provided by SQLite are
5953 ** ^The xMutexInit method defined by this structure is invoked as
5954 ** part of system initialization by the sqlite3_initialize() function.
5955 ** ^The xMutexInit routine is called by SQLite exactly once for each
5958 ** ^The xMutexEnd method defined by this structure is invoked as
5959 ** part of system shutdown by the sqlite3_shutdown() function. The
5961 ** resources obtained by the mutex methods implementation, especially
5962 ** those obtained by the xMutexInit method. ^The xMutexEnd()
5965 ** ^(The remaining seven methods defined by this structure (xMutexAlloc,
5982 ** by this structure are not required to handle this case, the results
6028 ** is held or not held, respectively, by the calling thread.
6086 ** with a particular database identified by the second argument. ^The
6099 ** the space pointed to by the 4th parameter. ^The SQLITE_FCNTL_FILE_POINTER
6105 ** code is not remembered and will not be recalled by [sqlite3_errcode()]
6123 ** This interface is not for use by applications. It exists solely
6200 ** that can be returned by [sqlite3_status()].
6206 ** figure includes calls made to [sqlite3_malloc()] by the application
6207 ** and internal memory usage by the SQLite library. Scratch memory
6208 ** controlled by [SQLITE_CONFIG_SCRATCH] and auxiliary page-cache
6209 ** memory controlled by [SQLITE_CONFIG_PAGECACHE] is not included in
6211 ** sizes as reported by the xSize method in [sqlite3_mem_methods].</dd>)^
6233 ** allocation which could not be satisfied by the [SQLITE_CONFIG_PAGECACHE]
6256 ** allocation which could not be satisfied by the [SQLITE_CONFIG_SCRATCH]
6353 ** memory used by all pager caches associated with the database connection.)^
6360 ** ^The full amount of memory used by the schemas is reported, even if the
6367 ** and lookaside memory used by all prepared statements associated with
6432 ** improvement performance by adding permanent indices that do not
6444 ** The sqlite3_pcache type is opaque. It is implemented by
6447 ** sqlite3_pcache object except by holding and passing pointers
6459 ** register an alternative page cache implementation by passing in an
6461 ** In many applications, most of the heap memory allocated by
6465 ** the amount of memory consumed by SQLite, the way in which
6471 ** extreme measure that is only needed by the most demanding applications.
6475 ** internal buffer by SQLite within the call to [sqlite3_config]. Hence
6485 ** required by the custom page cache implementation.
6491 ** ^The xShutdown() method is called by [sqlite3_shutdown()].
6510 ** be allocated by the cache. ^szPage will not be a power of two. ^szPage
6531 ** ^(The xCachesize() method may be called at any time by SQLite to set the
6532 ** suggested maximum cache-size (number of pages stored by) the cache
6546 ** 8-byte boundary. The page to be fetched is determined by the key. ^The
6568 ** attempt to unpin one or more cache pages by spilling the content of
6572 ** ^xUnpin() is called by SQLite with a pointer to a currently pinned page
6598 ** ^The xDestroy() method is used to delete a cache allocated by xCreate().
6623 ** online backup operation. ^The sqlite3_backup object is created by
6624 ** a call to [sqlite3_backup_init()] and is destroyed by a call to
6690 ** the source and destination databases specified by [sqlite3_backup] object B.
6736 ** through the backup process. ^If the source database is modified by an
6738 ** used by the backup operation, then the backup will be automatically
6739 ** restarted by the next call to sqlite3_backup_step(). ^If the source
6740 ** database is modified by the using the same database connection as is used
6741 ** by the backup operation, then the backup database is automatically
6748 ** should destroy the [sqlite3_backup] by passing it to sqlite3_backup_finish().
6756 ** ^The value returned by sqlite3_backup_finish is [SQLITE_OK] if no
6776 ** ^The values returned by these functions are only updated by
6784 ** ^The source [database connection] may be used by the application for other
6791 ** [database connection] is not passed to any other API (by any thread) after
6800 ** guarantee that the shared cache used by the destination database
6803 ** backed up to is not accessed by any connection within the process,
6839 ** its current transaction, either by committing it or rolling it back.
6854 ** concluded its transaction by the time sqlite3_unlock_notify() is invoked.
6863 ** ^(There may be at most one unlock-notify callback registered by a
6869 ** unlock-notify callback may also be canceled by closing the blocked
6893 ** specified by the blocked connections bundled together into an array.
6933 ** by an sqlite3_step() call. ^(If there is a blocking connection, then the
6959 ** established by the [SQLITE_CONFIG_LOG] option to [sqlite3_config()].
6963 ** The sqlite3_log() interface is intended for use by extensions such as
6986 ** ^The callback is invoked by SQLite after the commit has taken place and
7030 ** ^The callback registered by this function replaces any existing callback
7033 ** configured by this function.
7068 ** handle db. The specific operation is determined by the value of the
7157 ** This function may be called by either the [xConnect] or [xCreate] method
7226 ** These constants are returned by [sqlite3_vtab_on_conflict()] to
7235 /* #define SQLITE_IGNORE 2 // Also used by sqlite3_authorizer() callback */
7301 void (*xDelUser)(void *); /* Called by SQLite to clean up pUser */
7340 ** directly. Change this structure only by using the routines below.
7353 ** by a linear search of the global list. For small tables, the
7372 ** be opaque because it is used by macros.
7606 ** to omit code used by TEMP tables without messy #ifndef statements.
7626 ** Determine whether triggers are recursive by default. This can be
7944 ** If defined as non-zero, auto-vacuum is enabled by default. Otherwise
8299 ** number of columns of data returned by the statement.
8326 ** header file that defines a number for each opcode used by the VDBE.
8629 ** Each open file is managed by a separate instance of the "Pager" structure.
8668 #define PAGER_JOURNALMODE_DELETE 0 /* Commit by deleting journal file */
8669 #define PAGER_JOURNALMODE_PERSIST 1 /* Commit by zeroing journal header */
8671 #define PAGER_JOURNALMODE_TRUNCATE 3 /* Commit by truncating journal */
8801 ** Every page in the cache is controlled by an instance of the following
8817 ** and should not be accessed by other modules.
8875 /* Change a page number. Used by incr-vacuum. */
8881 /* Get a list of all dirty pages in the cache, sorted by page number */
8915 ** the total number of pages cached by purgeable pager-caches to the sum
8924 /* Try to return memory used by the pcache module to the main memory heap */
8957 ** This header file is #include-ed by sqliteInt.h and thus ends up
8958 ** being included by every source file.
9058 ** Temporary files are named starting with this prefix followed by 16 random
9091 ** SHARED locks may be obtained by other processes.
9096 ** lock. This can be upgraded to an EXCLUSIVE lock by a subsequent call to
9112 ** LockFile() prevents not just writing but also reading by other processes.
9113 ** A SHARED_LOCK is obtained by locking a single randomly-chosen
9117 ** An EXCLUSIVE_LOCK is obtained by locking all bytes in the range.
9118 ** There can only be one writer. A RESERVED_LOCK is obtained by locking
9120 ** A PENDING_LOCK is obtained by locking a designated byte different from
9141 ** windows and unix. I'm guessing that isn't likely to happen, but by
9151 ** by setting PENDING_BYTE low and running the entire regression suite.
9302 ** Each database file to be accessed by the system is an instance
9321 ** In shared cache mode, a single Schema object can be shared by multiple
9325 ** references them is destroyed. The TEMP Schema is manually freed by
9336 Hash tblHash; /* All tables indexed by name */
9337 Hash idxHash; /* All (named) indices indexed by name */
9338 Hash trigHash; /* All triggers indexed by name */
9339 Hash fkeyHash; /* All foreign keys by referenced table name */
9340 Table *pSeqTab; /* The sqlite_sequence table used by AUTOINCREMENT */
9342 u8 enc; /* Text encoding used by this database */
9381 ** (approx 10%) by avoiding numerous malloc/free requests while parsing
9392 ** is shared by multiple database connections. Therefore, while parsing
9424 ** The sqlite.lastRowid records the last insert rowid generated by an
9433 ** The sqlite.lsChange represents the number of changes made by the last
9435 ** length of a statement and is then updated by OP_SetCounts. It keeps a
9467 int nChange; /* Value returned by sqlite3_changes() */
9468 int nTotalChange; /* Value returned by sqlite3_total_changes() */
9519 Hash aModule; /* populated by sqlite3_create_module() */
9538 /* The following variables are all protected by the STATIC_MASTER
9539 ** mutex, not by sqlite3.mutex. They are used by code in notify.c.
9546 ** held by Y.
9568 #define SQLITE_CountRows 0x00001000 /* Count rows changed by INSERT, */
9593 ** Bits of the sqlite3.flags field that are used by the
9620 ** Each SQL function is defined by an instance of the following
9676 ** implemented by C function xFunc that accepts nArg arguments. The
9682 ** Used to create an aggregate function definition implemented by
9689 ** that accepts nArg arguments and is implemented by a call to C
9710 ** opened savepoint. Savepoints are added to the list by the vdbe
9729 ** Each SQLite module (virtual table definition) is defined by an
9759 ** A "Collating Sequence" is defined by an instance of the following
9781 u8 enc; /* Text encoding handled by xCmp() */
9807 ** the speed a little by numbering the values consecutively.
9851 ** then be used by the virtual table implementation to access real tables
9857 ** database schema are initially stored in a linked-list pointed to by
9868 ** another linked list headed by the sqlite3.pDisconnect member of the
9876 ** The memory for objects of this type is always allocated by
9891 ** Each SQL table is represented in memory by an instance of the
10071 ** the key of an index. A blob encoding of a record is created by
10072 ** the OP_MakeRecord opcode of the VDBE and is disassembled by the
10082 i64 rowid; /* Used by UNPACKED_PREFIX_SEARCH */
10097 ** Each SQL index is represented in memory by an
10101 ** by the aiColumn[] field of this structure. For example, suppose
10124 int nColumn; /* Number of columns in the table used by this index */
10125 int *aiColumn; /* Which columns are used by this index. 1st is 0 */
10126 unsigned *aiRowEst; /* Result of ANALYZE: Est. rows selected by each column */
10130 u8 autoIndex; /* True if is automatically created (ex: by UNIQUE) */
10186 ExprList *pGroupBy; /* The group by clause */
10291 u8 op; /* Operation performed by this node */
10326 AggInfo *pAggInfo; /* Used by TK_AGG_COLUMN and TK_AGG_FUNCTION */
10329 int nHeight; /* Height of the tree headed by this node */
10381 ** Macros to determine the number of bytes required by a normal Expr
10419 ** An instance of this structure is used by the parser to record both
10458 ** of the library by 738 bytes on ix86.
10474 ** is modified by an INSERT, DELETE, or UPDATE statement. In standard SQL,
10476 ** now be identified by a database name, a dot, then the table name: ID.ID.
10553 ** access or modified by other modules.
10558 ** All the pIdxInfo pointers are freed by whereInfoFree() in where.c.
10578 int iCur; /* The VDBE cursor used by this IN operator */
10611 ** this structure is returned by the first half and passed
10618 u8 untestedTerms; /* Not all WHERE terms resolved by outer loop */
10639 ** to the table being operated on by INSERT, UPDATE, or DELETE. The
10659 int nRef; /* Number of names resolved by this context */
10749 int iParm; /* A parameter used by the eDest disposal method */
10793 ** a mask of new.* columns used by the program.
10824 ** used to store the set of table-locks required by the statement being
10873 int nMaxArg; /* Max args passed to user function by sub-program */
10899 Table *pNewTable; /* A table being constructed by CREATE TABLE */
10900 Trigger *pNewTrigger; /* Trigger under construct by a CREATE TRIGGER */
10949 * database). This allows Trigger structures to be retrieved by name.
10987 * using the "pNext" member) referenced by the "step_list" member of the
10992 * "SELECT" statement. The meanings of the other members is determined by the
11034 ** The following structure contains information used by the sqliteFix...
11107 sqlite3_mutex *pInitMutex; /* Mutex used by sqlite3_initialize() */
11178 ** needed by FTS3 when FTS3 is included in the amalgamation.
11750 /* Declarations for functions in fkey.c. All of these are replaced by
11858 ** allocations are properly tracked by the system.
11865 ** argument match the type set by the previous sqlite3MemdebugSetType().
11869 ** argument match the type set by the previous sqlite3MemdebugSetType().
11873 ** it might have been allocated by lookaside, except the allocation was
11875 ** that allocations that might have been satisfied by lookaside are not
11982 ** array. tolower() is used more often than toupper() by SQLite.
12097 ** for use by the VFS layers as space for managing file locks.
12116 ** created by mkopcodeh.awk during compilation. Data is obtained
12567 ** executed by a virtual machine. Each instruction is an instance
12577 /* Opaque type used by code in vdbesort.c */
12587 ** Every cursor that the virtual machine has open is represented by an
12593 KeyInfo *pKeyInfo; /* Info about index keys needed by index cursors */
12614 /* Result of last sqlite3BtreeMoveto() done by an OP_NotExists or
12644 ** The memory for a VdbeFrame object is allocated and managed by a memory
12706 char *zMalloc; /* Dynamic buffer allocated by sqlite3_malloc() */
12798 int isError; /* Error code returned by the function. */
12806 ** The "sqlite3_stmt" structure pointer that is returned by sqlite3_prepare()
12810 ** any virtual table method invocations made by the vdbe program. It is
12814 ** malloc failure when SQLite is invoked recursively by a virtual table
12857 int aCounter[3]; /* Counters used by sqlite3_stmt_status() */
12872 SubProgram *pProgram; /* Linked list of all sub-programs used by VM */
13115 ** by all pagers associated with the given database connection. The
13499 ** Set the time to the current time reported by the VFS
14064 ** Return a string described by FORMAT. Conversions as follows:
14568 ** error in sqlite3_os_init() by the upper layers can be tested.
14584 ** Locate a VFS by name. If no name is given, simply return the
14690 ** is completely recoverable simply by not carrying out the resize. The
14737 ** This (sqlite3EndBenignMalloc()) is called by SQLite code to indicate that
14851 ** cases of nByte<=0 will be intercepted and dealt with by higher level
14875 ** by higher-level routines.
14901 ** pPrior==0 while have been intercepted by higher-level routine and
14903 ** cases where nByte<=0 will have been intercepted by higher-level
15046 ** All of the static variables used by this module are collected
15513 ** allocation subsystem for use by SQLite.
15518 ** are made and returned by the xMalloc() and xRealloc()
15530 ** mean that the library will use a memory-pool by default, just that
15531 ** it is available. The mempool allocator is activated by calling
15564 ** We often identify a chunk by its index in mem3.aPool[]. When
15594 ** All of the static variables used by this module are collected
15602 ** (in Mem3Blocks) pointed to by aPool less 2.
15718 ** will already be held (obtained by code in malloc.c) if
15851 ** already held by the caller. Hence "Unsafe".
15889 ** Try to satisfy the allocation by carving a piece off of the end
15900 ** Then try again to satisfy the allocation by carving a piece off
15933 ** already held by the caller. Hence "Unsafe".
16169 ** This routine is only called by sqlite3_config(), and therefore
16202 ** allocation subsystem for use by SQLite.
16207 ** are made and returned by the xMalloc() and xRealloc()
16228 ** Let n be the size of the largest allocation divided by the minimum
16275 ** All of the static variables used by this module are collected
16375 ** will already be held (obtained by code in malloc.c) if
16495 /* Set iBlock to the index of the block pointed to by pOld in
16496 ** the array of mem5.szAtom byte blocks pointed to by mem5.zPool.
16607 ** the allocation is too large to be handled by this allocation system,
16610 ** All allocations must be a power of two and must be expressed by a
16646 u8 *zByte; /* Memory usable by this allocator */
16834 ** Shutdown the mutex system. This call frees resources allocated by
16901 ** entered by the same thread. The behavior is undefined if the mutex
17075 ** be entered multiple times by the same thread. In such cases the,
17094 ** previously entered by the same thread. The behavior
17215 ** used by the current version of SQLite. Future versions of SQLite
17217 ** use by SQLite only. Applications that use SQLite mutexes should
17218 ** use only the dynamic mutexes returned by SQLITE_MUTEX_FAST or
17350 ** be entered multiple times by the same thread. In such cases the,
17376 ** previously entered by the same thread. The behavior
17527 ** used by the current version of SQLite. Future versions of SQLite
17529 ** use by SQLite only. Applications that use SQLite mutexes should
17530 ** use only the dynamic mutexes returned by SQLITE_MUTEX_FAST or
17613 ** be entered multiple times by the same thread. In such cases the,
17713 ** previously entered by the same thread. The behavior
17937 ** used by the current version of SQLite. Future versions of SQLite
17939 ** use by SQLite only. Applications that use SQLite mutexes should
17940 ** use only the dynamic mutexes returned by SQLITE_MUTEX_FAST or
17998 ** be entered multiple times by the same thread. In such cases the,
18054 ** previously entered by the same thread. The behavior
18117 ** held by SQLite. An example of non-essential memory is memory used to
18167 ** True if heap is nearly "full" where "full" is defined by the
18294 ** words if the amount of heap used is close to the limit set by
18416 ** This version of the memory allocation is for use by the application.
18430 ** case by setting scratchAllocOut to 1 when an allocation
18622 ** argument to xRealloc is always a value returned by a prior call to
18748 ** Resize the block of memory pointed to by p to n bytes. If the
18859 ** then the connection error-code (the value returned by sqlite3_errcode())
18904 ** that would have been output by printf.
18917 ** is repeated by the number of times the precision specifies.
18932 ** Conversion types fall into various categories as defined by the
18947 NULL pointers replaced by SQL NULL. %Q */
18964 ** by an instance of the following structure
19028 ** multiply "*val" by 10.0 to renormalize.
19594 ** The text of the conversion is pointed to by "bufpt" and is
19676 ** Finish off a string by making sure it is zero-terminated.
19816 ** specified by some locales.
19923 ** Random numbers are used by some of the database backends in order
20095 ** The following constant value is used by the SQLITE_BIGENDIAN and
20253 ** This routine transforms the internal text encoding used by pMem to
20399 ** changed by this function.
20456 /* This test function is not currently used by the automated test-suite.
20489 ** be freed by the calling function.
20511 ** Convert a UTF-8 string to the UTF-16 encoding specified by parameter
20661 ** make use of it by compiling with -DSQLITE_HAVE_ISNAN. But we have
20669 ** This option [-ffast-math] should never be turned on by any
20761 ** stored by this function into the database handle using sqlite3Error().
20783 ** Convert an SQL-style quoted string into a normal string by removing
20917 ** (increase exponent by d to shift decimal left) */
20925 ** (decrease exponent by d to shift decimal right) */
20961 /* adjust exponent by d, and update sign */
21073 ** given by enc.
21267 ** Bitmasks used by sqlite3GetVarint(). These precomputed constants
21457 ** by the getVarin32() macro */
21503 ** rare larger cases can be handled by the slower 64-bit varint
21621 ** binary value has been obtained from malloc and must be freed by
21815 /* Turn bulk memory into a hash table object by initializing the
22312 ** This file should be #included by the os_*.c files only. It is not a
22518 int szChunk; /* Chunk size configured by FCNTL_CHUNK_SIZE */
22535 ** by the sqlite3_io_methods object.
22738 ** Lock the file with the lock specified by parameter locktype - one
22897 ** file by this or any other process. If such a lock is held, return
23053 ** Character set conversion objects used by conversion routines.
23228 ** Structure used internally by this VFS to record the state of an
23286 /* Access to the os2ShmNode object is serialized by the caller */
23325 ** by VFS shared-memory methods.
23352 /* Find node by it's shared memory base name */
23430 ** by VFS shared-memory methods.
23502 ** region has not been allocated (by any client, including one running in a
23505 ** been allocated, it is allocated by this function.
23507 ** If the shared-memory region has already been allocated or is allocated by
23680 u32 allMask = 0; /* Mask of locks held by siblings */
23702 u32 allShared = 0; /* Union of locks held by connections other than "p" */
23704 /* Find out which shared locks are already held by sibling connections.
23988 ** The handle should not be inherited by child processes and we don't
24181 /* Ordered by variation probability */
24299 ** strerror_r() on unix). After an error is returned by an OS
24323 ** by sqlite into the error message available to the user using
24403 ** * Unique file ID logic used by VxWorks.
24563 ** Sometimes, after a file handle is closed by SQLite, the file descriptor
24590 int szChunk; /* Configured by FCNTL_CHUNK_SIZE */
24607 ** one described by ticket #3584.
24654 ** This file should be #included by the os_*.c files only. It is not a
25087 ** vxworksFileId objects used by this file, all of which may be
25088 ** shared by multiple threads.
25134 ** platforms. Enable by compiling with the -DSQLITE_LOCK_TRACE
25220 ** will be handled by the "default:" case below.
25290 ** On most versions of unix, we can get a unique ID for a file by concatenating
25313 ** All unique filenames are held on a linked list headed by this
25320 ** by making the following changes:
25428 ** POSIX advisory locks are broken by design. ANSI STD 1003.1 (1996)
25431 ** by the same process. It does not explicitly say so, but this implies
25432 ** that it overrides locks set by the same process using a different
25454 ** specific inode of the database file (the inode is determined by the
25484 ** all locks on that file that are owned by the current process are
25497 ** not posix compliant. Under LinuxThreads, a lock created by thread
25498 ** A cannot be modified or overridden by a different thread B.
25501 ** on linux - with NPTL a lock created by thread A can override locks
25531 ** each inode opened by each thread.
25597 /* If STRERROR_R_CHAR_P (set by autoconf scripts) or __USE_GNU is defined,
25641 ** file descriptor might have already been reused by another thread.
25668 ** Release a unixInodeInfo structure previously allocated by findInodeInfo().
25736 ** we always increase the file size to 1 by writing a single byte
25790 ** file by this or any other process. If such a lock is held, set *pResOut
25836 ** described by pLock.
25851 ** to fcntl() fails. In this case, errno is set appropriately (by fcntl()).
25882 ** Lock the file with the lock specified by parameter eFileLock - one
25922 ** A RESERVED lock is implemented by grabbing a write-lock on the
25926 ** SHARED lock. A PENDING lock is implemented by obtaining a write-lock
25930 ** This property is used by the algorithm for rolling back a journal file
25934 ** implemented by obtaining a write-lock on the entire 'shared byte
26127 ** Add the file descriptor used by file handle pFile to the corresponding
26197 ** the lock in 2 blocks, so that part of the range will be covered by a
26198 ** write lock until the rest is covered by a read lock:
26341 ** even on VxWorks. A mutex will be acquired on VxWorks by the
26399 ** Of the various locking implementations available, this is by far the
26406 ** prevent simultaneous access of the same database by two or more
26453 ** Dotfile locking works by creating a file in the same directory as the
26467 ** file by this or any other process. If such a lock is held, set *pResOut
26500 ** Lock the file with the lock specified by parameter eFileLock - one
26639 ** fine-grain locking levels supported by SQLite are collapsed into
26666 ** file by this or any other process. If such a lock is held, set *pResOut
26724 ** Lock the file with the lock specified by parameter eFileLock - one
26856 ** file by this or any other process. If such a lock is held, set *pResOut
26900 ** Lock the file with the lock specified by parameter eFileLock - one
27100 ** file by this or any other process. If such a lock is held, set *pResOut
27151 ** Lock the file with the lock specified by parameter eFileLock - one
27532 ** any any form by default, we will not attempt to define _XOPEN_SOURCE.
27599 /* lastErrno set by seekAndRead */
27707 /* lastErrno set by seekAndWrite */
27893 ** has been created by fsync-ing the directory that contains the file.
28050 ** is the same technique used by glibc to implement posix_fallocate()
28207 ** Structure used internally by this VFS to record the state of an
28249 /* Access to the unixShmNode object is serialized by the caller */
28313 ** by VFS shared-memory methods.
28508 ** region has not been allocated (by any client, including one running in a
28511 ** been allocated, it is allocated by this function.
28513 ** If the shared-memory region has already been allocated or is allocated by
28547 struct stat sStat; /* Used by fstat() */
28658 u16 allMask = 0; /* Mask of locks held by siblings */
28680 u16 allShared = 0; /* Union of locks held by connections other than "p" */
28682 /* Find out which shared locks are already held by sibling connections.
29098 ** Initialize the contents of the unixFile structure pointed to by pId.
29184 ** descriptors on this file, then no malloc would be required by
29187 ** by doing so.
29317 ** by the calling process and must be big enough to hold at least
29359 ** Implementation in the proxy-lock division, but used by unixOpen()
29367 ** file (not a journal or master-journal file) identified by pathname
29424 ** This function is called by unixOpen() to determine the unix permissions
29431 ** the octal permissions 0600 (read/writable by owner only). If the file
29468 ** used by the test_multiplex.c module.
29517 int fd = -1; /* File descriptor returned by open() */
29603 ** they may be stored as part of the file handle and used by the
29695 ** not while other file descriptors opened by the same process on
29816 ** is stored as a nul-terminated string in the buffer pointed to by
29892 ** We initialize x by assigning it a pointer to the dlsym() function.
29925 ** errors. The reports issued by valgrind are incorrect - we would
29926 ** prefer that the randomness be increased by making use of the
30077 ** database file to coordinate safe, concurrent access by multiple readers
30098 ** address the requirements for concurrent database access by multiple
30103 ** changes the way database access is controlled by limiting access to a
30135 ** the above APIs (assuming the conch file is not being held by another
30151 ** by taking an sqlite-style shared lock on the conch file, reading the
30160 ** is held by another process (with a shared lock), the exclusive lock
30209 ** sqlite_file_control API is not affected by SQLITE_FORCE_PROXY_LOCKING).
30321 unixFile **ppFile, /* unixFile created and returned by ref */
30402 /* simulate multiple hosts by creating unique hostid file paths */
30433 /* simulate multiple hosts by creating unique hostid file paths */
30468 /* create a new path by replace the trailing '-conch' with '-break' */
30588 /* Takes the conch by taking a shared lock and read the contents conch, if
30628 /* I/O error: lastErrno set by seekAndRead */
30912 ** pFile is a file that has been opened by a prior xOpen call. dbPath
31101 ** file by this or any other process. If such a lock is held, set *pResOut
31121 ** Lock the file with the lock specified by parameter eFileLock - one
31244 ** This routine is called once during SQLite initialization and by a
31299 ** by the SQLite core when the VFS is registered. So the following
31431 ** This file should be #included by the os_*.c files only. It is not a
31672 int szChunk; /* Chunk size configured by FCNTL_CHUNK_SIZE */
31677 winceLock local; /* Locks obtained by this instance of winFile */
31711 ** The winMemData structure stores information required by the Win32-specific
31964 ** This routine is only called by sqlite3_config(), and therefore
32142 /* free the system buffer allocated by FormatMessage */
32162 /* free the system buffer allocated by FormatMessage */
32220 ** will be retried following a locking error - probably caused by
32316 ** Release a lock acquired by winceMutexAcquire()
32352 ** case-sensitive, take advantage of that by uppercasing the mutex name
32588 ** by the sqlite3_io_methods object.
32606 DWORD dwRet; /* Value returned by SetFilePointer() */
32733 DWORD nWrite; /* Bytes written by each WriteFile() call */
32817 ** Used when SQLITE_NO_SYNC is not defined and by the assert() and/or
32946 ** Lock the file with the lock specified by parameter locktype - one
33009 ** held by another reader process who will release it momentarily.
33091 ** file by this or any other process. If such a lock is held, return
33256 ** global mutex is used to protect the winLockInfo objects used by
33257 ** this file, all of which may be shared by multiple threads.
33331 ** Structure used internally by this VFS to record the state of an
33376 /* Access to the winShmNode object is serialized by the caller */
33417 ** by VFS shared-memory methods.
33644 u16 allMask = 0; /* Mask of locks held by siblings */
33666 u16 allShared = 0; /* Union of locks held by connections other than "p" */
33668 /* Find out which shared locks are already held by sibling connections.
33746 ** region has not been allocated (by any client, including one running in a
33749 ** been allocated, it is allocated by this function.
33751 ** If the shared-memory region has already been allocated or is allocated by
33913 ** is obtained from malloc and must be freed by the calling
34686 ** strerror_r() on unix). After an error is returned by an OS
34710 ** by sqlite into the error message available to the user using
34851 ** sub-bitmaps pointed to by Bitvec.u.apSub[]. Each subbitmap
34863 u32 iDivisor; /* Number of bits handled by each apSub[] entry. */
35073 ** by 0, 1, or 3 operands, depending on the opcode. Another
35080 ** 1 N S X Set N bits beginning with S and incrementing by X
35081 ** 2 N S X Clear N bits beginning with S and incrementing by X
35342 ** The caller discovers how much space needs to be allocated by
35494 ** Increase the reference count of a supplied page by 1.
35504 ** page pointed to by p is invalid.
35633 ** Merge two lists of pages connected by pDirty and in pgno order.
35661 ** Sort the list of pages in accending order by pgno. Pages are
35662 ** connected by pDirty pointers. The pDirtyPrev pointers are
35663 ** corrupted by this sort.
35666 ** there cannot be more than 31 buckets required by the merge sorter.
35703 ** Return a list of all dirty pages in the cache, sorted by page number.
35714 ** Return the total number of referenced pages held by the cache.
35840 ** currently used by members of the PGroup (i.e. 1024 bytes, 4096 bytes
35842 ** size requested by each pcache, which is the database page-size plus
35843 ** the various header structures used by the pcache, pager and btree layers.
35846 ** This size (pgsz+200) bytes is not allocated efficiently by some
35856 ** allocations can fit in the space returned by malloc(). This value may
35901 ** modified at any time by a call to the pcache1CacheSize() method.
35917 PgHdr1 **apHash; /* Hash table for fast lookup by key */
35923 ** Each cache entry is represented by an instance of the following
35945 ** Global data used by this cache.
35994 ** Blocks used by the SQLITE_PAGECACHE_BLOCKALLOC blocks to store/retrieve
36015 ** supplied to use for the page-cache by passing the SQLITE_CONFIG_PAGECACHE
36147 ** If there are no blocks in the list headed by pList, remove pList
36282 ** Free a page object allocated by pcache1AllocPage().
36341 ** Malloc function used by SQLite to obtain space from the buffer configured
36385 ** This function is used to resize the hash table used by the cache passed
36646 ** Fetch a page by key value.
36648 ** Whether or not a new page may be allocated by this function depends on
36671 ** (a) the number of pages pinned by the cache is greater than
36674 ** (b) the number of pages pinned by the cache is greater than
36721 /* The pGroup local variable will normally be initialized by the
36935 ** held by the pager system. Memory in use by any SQLite pager allocated
36936 ** by the current thread may be sqlite3_free()ed.
36966 ** This function is used by test procedures to inspect the internal state
37034 ** value added by the INSERT will not be visible to the second TEST.
37257 ** Convert this tree into a linked list connected by the pRight pointers
37283 ** Convert a sorted list of elements (connected by pRight) into a binary
37490 /* Used by readers to open (lock) and close (unlock) a snapshot. A
37545 ** by the pager layer on the database file.
37774 ** first modified by the upper layer. In rollback mode the journal file
37805 ** by finalizing the journal file. Once in WRITER_FINISHED state, it is
37861 ** Condition (3) is necessary because it can be triggered by a read-only
37899 ** This variable is kept up to date as locks are taken and released by
37918 ** transition, by the same pager or any other). If the call to xUnlock()
37924 ** lock held by this process or any others". So xCheckReservedLock may
37927 ** a hot-journal may be mistaken for a journal being created by an active
38043 ** finalized by overwriting the first journal header with zeroes. If
38045 ** by truncating it to zero bytes, just as if the connection were
38049 ** simply by overwriting the first journal-header with zeroes, as the
38054 ** by PagerCommitPhaseTwo or PagerRollback). If an IO error prevents the
38061 ** (calls made by the pcache module to the pagerStress() routine to
38068 ** while it is being traversed by code in pager_playback().
38072 ** by sqlite3PagerWrite() when the file-system sector-size is larger than
38082 ** This variable is updated by the upper layer each time a new
38093 ** 28 of the database header by the btree). If the size of the file
38223 Wal *pWal; /* Write-ahead log used by "journal_mode=wal" */
38264 ** be correct. But by initializing the checksum to random value which
38272 ** The size of the of each page record in the journal is given by
38634 ** (a) the value returned by OsDeviceCharacteristics() indicates that
38636 ** (b) the value returned by OsSectorSize() is less than or equal
38718 ** by the caller. See comments above writeMasterJournal() for the format
38721 ** zMaster must point to a buffer of at least nMaster bytes allocated by
38729 ** file, then it is copied into the buffer pointed to by zMaster. A
38869 ** - 4 bytes: Sector size used by the process that wrote this journal.
38872 ** Followed by (JOURNAL_HDR_SZ - 28) bytes of unused space.
38877 u32 nHeader = (u32)pPager->pageSize;/* Size of buffer pointed to by zHeader */
38950 ** Pager.journalOff variable by JOURNAL_HDR_SZ so that the next
38952 ** that will be implicitly filled in by the OS).
38978 ** file. The current location in the journal file is given by
39084 /* Update the assumed sector-size to match the value used by
39086 ** created by a process other than this one, then this routine
39259 ** is opened (by this or by any other connection).
39277 int rc; /* Error code returned by pagerUnlockDb() */
39338 ** the error-code about to be returned by a pager API function. The
39347 ** cannot be trusted. This state can be cleared by completely discarding
39369 ** This routine ends a transaction. A transaction is usually ended by
39383 ** transaction. Nor will it be considered to be a hot-journal by this
39533 ** the pager to enter the ERROR state. Which will be cleared by the
39629 ** allocated by this function. If this is the case and an allocation fails,
39697 /* If this page has already been played by before during the current
39781 ** problem. When the page is next fetched by the b-tree layer, it
39888 ** function allocates memory by calling sqlite3Malloc(). If an allocation
39922 ** sqlite3_malloc() and pointed to by zMasterJournal. Also obtain
39947 /* One of the journals pointed to by the master journal exists.
40042 ** pager based on the value returned by the xSectorSize method
40050 ** the value returned by the xSectorSize() method rounded up to 32 if
40137 int res = 1; /* Value returned by sqlite3OsAccess() */
40191 /* If nRec is 0xffffffff, then this journal was created by a process
40201 /* If nRec is 0 and this rollback is of a transaction created by this
40282 ** mode, then subsequent transactions performed by the connection will not
40312 ** back a journal created by a process with a different sector size
40396 ** needed, as determined by the pPager->changeCountDone state variable.
40484 ** the contents of the list of pages headed by pList (connected by pDirty),
40488 ** The list of pages passed into this routine is always sorted by page number.
40514 ** They will never be read by any client. So remove them from the pDirty
40550 ** that snapshot for use by the reader in spite of concurrently changes by
40633 ** Check if the *-wal file that corresponds to the database opened by pPager
40635 ** not exist (by deleting it) if the database file is empty.
40647 ** between the xAccess() below and an xDelete() being executed by some
40753 /* Begin by rolling back records from the main journal starting at
40835 ** or power failures by changing the number of syncs()s when writing
40919 ** by parameter vfsFlags ORed with the following:
40975 ** Change the page size used by the Pager object. The new page size
41056 ** by the pager. This is a buffer that is big enough to hold the
41077 assert( pPager->eState!=PAGER_OPEN ); /* Called only by OP_MaxPgcnt */
41125 /* This routine is only called by btree immediately after creating
41197 ** (as determined by function subjRequiresPage()).
41199 ** If the condition asserted by this function were not true, and the
41491 ** by the PgHdr.pDirty pointer. This function writes each one of the
41553 ** make the file smaller (presumably by auto-vacuum code). Do not write
41557 ** set (set by sqlite3PagerDontWrite()).
41673 ** This function is called by the pcache layer when it has reached some
41681 ** The job of this function is to make pPg clean by writing its contents
41689 ** is returned by sqlite3PcacheMakeClean() is not called.
41789 ** in *ppPager. The pager should eventually be freed by passing it
41867 ** to by zPathname, length nPathname. Or, if this is a temporary file,
41887 /* This branch is taken when the journal path required by
41960 int fout = 0; /* VFS flags returned by xOpen() */
41970 ** + The value returned by sqlite3OsSectorSize()
42149 ** be dealt with by the playback routine. Ticket #3883.
42218 ** The following operations are also performed by this function.
42225 ** rollback, the contents of the cache are validated by checking
42231 ** then an attempt is made to clear the error state by discarding
42382 ** Database changes is detected by looking at 15 bytes beginning
42660 ** Whether or not the journal file is opened by this function, the
42987 ** a journal header to be written between the pages journaled by
43105 ** If the isDirectMode flag is zero, then this is done by calling
43113 ** by writing an updated version of page 1 using a call to the
43359 ** being discarded by the truncation must be written to the journal
43406 ** xSync() call will be changed to a no-op by the OS anyhow.
43446 ** updated to reflect the changes made by the current transaction and
43451 ** This function finalizes the journal file, either by deleting,
43521 ** their pre-transaction state by re-reading data from the database or
43583 ** used by the pager and its associated cache.
43697 ** The savepoint to rollback or release is identified by parameter
43729 ** with any savepoints that are destroyed by this operation.
43832 ** in the rollback journal, it is not put there by by this routine.
43871 /* If the page being moved is dirty and has not been saved by the latest
43950 ** "is journaled" bitvec flag has been set. This needs to be remedied by
44042 /* The print_pager_state() routine is intended to be used by the debugger
44098 ** while it is in use by some other client.
44267 ** return SQLITE_OK. If an error occurs or the VFS used by the pager does
44352 ** This function is called by the wal module when writing page content
44388 ** A WAL file consists of a header followed by zero or more "frames".
44390 ** database file. All changes to the database are recorded by writing
44417 ** frame consists of a 24-byte frame-header followed by a <page-size> bytes
44445 ** the checksum. The checksum is computed by interpreting the input as
44474 ** last valid instance of page P that is a followed by a commit frame
44477 ** frame or are followed by a commit frame, then page P is read from
44518 ** The wal-index consists of a header region, followed by an one or
44548 ** can be found by scanning the page-mapping sections of each index block
44627 ** that may be interpreted by this version of SQLite.
44686 ** information used by checkpoint.
44691 ** WalIndexHdr.mxFrame. nBackfill can only be increased by threads
44701 ** to avoid having to offset aReadMark[] indexs by one. Readers holding
44705 ** The value of aReadMark[K] may only be changed by a thread that
44760 ** file are calculated by treating all data as an array of 32-bit
44761 ** big-endian words. Otherwise, they are calculated by interpreting
44776 ** An open write-ahead log file is represented by an instance of the
44828 ** The internals of this structure are only accessed by:
44834 ** This functionality is used by the checkpoint code (see walCheckpoint()).
44940 ** returns the value that would be produced by intepreting the 4 bytes
45021 ** supplied by the caller. A frame-header is made up of a series of
45193 ** number of the first frame indexed by this hash table. If a
45198 ** first frame indexed by the hash table, frame (*piZero+1).
45414 ** Recover the wal-index by reading the write-ahead log file.
45431 ** locked by the caller. The caller is guaranteed to have locked the
45567 ** problems caused by applications routinely shutting down without
45682 ** has not been returned by any prior invocation of this method on the
45857 ** Free an iterator allocated by walIteratorInit().
45881 ht_slot *aTmp; /* Temp space used by merge-sort */
45902 /* Allocate temporary space used by the merge-sort routine. This block
45952 ** Attempt to obtain the exclusive WAL lock defined by parameters lockIdx and
45973 ** Return the page-size in bytes used by the database.
45984 ** by active readers. This routine will never overwrite a database page
45989 ** checkpoints are always run by a background thread or background
46046 ** overwrite database pages that are in use by active readers and thus
46208 ** by verifying that both copies of the header are the same and also by
46270 ** changed by this opertion. If pWal->hdr is unchanged, set *pChanged
46294 ** being modified by another thread or process.
46376 ** access any database page that is modified by a WAL frame up to and
46443 ** xShmMap() implementation used by the default unix and win32 VFS
46541 ** that the log file may have been wrapped by a writer, or that frames
46543 ** copied into the database by a checkpointer. If either of these things
46575 ** that extra content is ignored by the current thread.
46633 ** then the WAL is ignored by the reader so return early, as if the
46743 ** A read transaction must have already been started by a prior call
46860 ** Move the write position of the WAL back to the point identified by
46863 ** by a call to WalSavepoint().
47107 ** be in use by existing readers is being overwritten.
47379 ** BTrees. Each BTree is identified by the index of its root page. The
47433 ** space in a page that can be consumed by a single cell for standard
47580 ** You can change this value at compile-time by specifying a
47585 ** databases generated by the standard tools and the standard tools
47586 ** will not be able to read databases created by your custom library.
47611 ** Access to all fields of this structure is controlled by the mutex
47713 ** A single database file can be in use as the same time by two
47738 ** 2) The number of locks held by other connections drops to zero.
47769 void *pSchema; /* Pointer to space allocated by sqlite3BtreeSchema() */
47816 ** The entry is identified by its MemPage and the index in
47819 ** A single database file can shared by two more database connections,
47970 Pager *pPager; /* The associated pager. Also accessible by pBt->pPager */
48031 ** by all database connections. The p->pNext is a list of other
48042 ** connected by pNext and pPrev should be in sorted order by
48130 ** Enter and leave a mutex on a Btree given a cursor owned by that
48131 ** Btree. These entry points are used by incremental I/O and can be
48152 ** Enter the mutexes in accending order by BtShared pointer address
48312 ** Access to this variable is protected by SQLITE_MUTEX_STATIC_MASTER.
48478 ** SQLITE_OK if the lock may be obtained (by calling
48538 ** by Btree handle p. Parameter eLock must be either READ_LOCK or
48564 ** by a connection in read-uncommitted mode is on the sqlite_master
48611 ** the setSharedCacheTableLock() procedure) held by Btree object p.
48648 ** that writer, then the number of locks held by connections other
48660 ** This function changes all write-locks held by Btree p into read-locks.
48755 ** bug caused by the interaction of two useful IO optimizations surrounding
48905 ** such as is generated by the OP_MakeRecord opcode. Unpack the
48940 ** saved position info stored by saveCursorPosition(), so there can be
49236 ** the space used by the cell pointer.
49243 /* The value returned by this function should always be the same as
49244 ** the (CellInfo.nSize) value found by doing a full parse of the
49472 ** for the portion used by the new allocation. */
49533 ** even though the freeblock list was checked by btreeInitPage(),
49783 ** Convert a DbPage obtained from the pager into a MemPage used by
49918 ** But no harm is done by this. And it is very important that
50076 ** The following asserts make sure that structures used by the btree are
50166 ** The list is kept in ascending order by pBt address.
50298 ** The call to sqlite3BtreeRollback() drops any table-locks held by
50348 ** Synchronous is on by default so database corruption is not
50458 ** sometimes used by extensions.
50503 ** determined by the SQLITE_DEFAULT_AUTOVACUUM macro.
50719 ** into a new empty database by initializing the first page of
50767 ** upgraded to exclusive by calling this routine a second time - the
50790 ** of A's read lock. A tries to promote to reserved but is blocked by B.
50981 ** page pointed to by one of the cells on pPage.
51119 /* Forward declaration required by incrVacuumStep(). */
51343 ** the database can be restored to its original state by playing back
51439 ** (by deleting a master journal file) and the caller will ignore this
51498 ** by having its state changed to CURSOR_FAULT.
51545 ** invalided by this operation. Any attempt to use a cursor
51642 ** savepoint identified by parameter iSavepoint, depending on the value
51692 ** the changes made by this write cursor would be visible to
51787 ** of run-time by skipping the initialization of those elements.
52038 ** from pPayload to the buffer pointed at by pBuf. If eOp is true,
52289 ** The pointer returned by this routine looks directly into the cached
52653 ** specified by pIdxKey or intKey. Return a success code.
52771 ** the entire cell by checking for the cases where the record is
52772 ** stored entirely within the b-tree page by inspecting the first
53020 ** is only used by auto-vacuum databases when allocating a new table.
53068 /* Decrement the free-list count by 1. Set iTrunk to the index of the
53139 /* The trunk page is required by the caller but it contains
53243 ** becomes a new pointer-map page, the second is used by the caller.
53299 ** its reference count is not altered by this function.
53831 /* Check that the page has just been zeroed by zeroPage() */
53886 ** byte page number followed by a variable length integer. In other
53925 ** of the parent page are still manipulated by thh code below.
54026 ** The performance of this function is not critical. It is only used by
54081 ** The number of siblings of the page might be increased or decreased by
54351 ** Values computed by this block:
54378 ** The packing computed by the previous block is biased toward the siblings
54587 ** b-tree structure by one. This is described as the "balance-shallower"
54607 ** be dealt with by this routine. Some of these have been set already, but
54617 ** page in any overflow chains used by new divider cells. These
54618 ** have also already been taken care of by the insertCell() code.
54624 ** overflow pages used by these cells may need to be updated
54631 ** Cases 1 and 2 are dealt with above by other code. The next
54874 ** A subsequent iteration of the do-loop will deal with this by
54878 ** has completed, it is safe to release the pSpace buffer used by
54887 ** by a previous call to balance_nonroot(). Its contents are
54916 ** Insert a new record into the BTree. The key is given by (pKey,nKey)
54917 ** and the data is given by (pData,nData). The cursor is used only to
55117 ** sub-tree headed by the child page of the cell being deleted. This makes
55140 ** by the child-page of the cell that was just deleted from an internal
55195 ** The type of type is determined by the flags parameter. Only the
55226 ** held by open cursors.
55259 ** by extending the file), the current page at position pgnoMove
55404 ** integer value pointed to by pnChange is incremented by the number of
55436 ** in the database file is moved into the slot formerly occupied by
55437 ** iTable and that last slot formerly occupied by the last root page
55444 ** meta[3] is updated by this procedure.
55456 ** need to move another root-page to fill a gap left by the deleted
55498 ** gap left by the deleted root-page.
55564 ** through meta[15] are available for use by higher layers. Meta[0]
56033 assert( contentOffset<=usableSize ); /* Enforced by btreeInitPage() */
56055 assert( i<=usableSize-4 ); /* Enforced by btreeInitPage() */
56057 assert( i+size<=usableSize ); /* Enforced by btreeInitPage() */
56060 assert( j==0 || j>i+size ); /* Enforced by btreeInitPage() */
56061 assert( j<=usableSize-4 ); /* Enforced by btreeInitPage() */
56279 ** a single shared-btree. The memory is used by client code for its own
56395 ** overflow list for the current row. This is used by cursors opened
56399 ** (stored in BtCursor.aOverflow[]) is allocated and used by function
56484 /* These two variables are set by every call to backup_step(). They are
56485 ** read by calls to backup_remaining() and backup_pagecount().
56506 ** invoked by the pager layer to report various state changes in
56529 ** If the "temp" database is requested, it may need to be opened by this
56609 ** EVIDENCE-OF: R-64852-21591 The sqlite3_backup object is created by a
56610 ** call to sqlite3_backup_init() and is destroyed by a call to
56707 /* This loop runs once for each destination page spanned by the source
56879 ** journalled by PagerCommitPhaseOne() before they are destroyed
56880 ** by the file truncation.
57028 /* EVIDENCE-OF: R-64852-21591 The sqlite3_backup object is created by a
57029 ** call to sqlite3_backup_init() and is destroyed by a call to
57071 ** has been modified by a transaction on the source pager. Copy
57089 ** detects that the database has been modified by an external database
57111 ** The size of file pTo may be reduced by this operation. If anything
57122 ** to 0. This is used by the implementations of sqlite3_backup_step()
57124 ** from this function, not directly by the user.
57419 ** If the memory cell contains a string value that must be freed by
57441 ** Release any memory held by the Mem. This may leave the Mem in an
57457 ** Most systems appear to do this simply by assigning
57735 ** This routine prepares a memory cell for modication by breaking
57736 ** its link to a shallow copy and by marking any current shallow
57823 ** string is copied into a (possibly existing) buffer managed by the
57915 ** Compare the values contained by the two memory cells, returning
57917 ** than pMem2. Sorting order is NULL's first, followed by numbers (integers
57918 ** and reals) sorted numerically, followed by text ordered by the collating
57919 ** sequence pColl and finally blob's ordered by memcmp().
57921 ** Two NULL values are considered equal by this function.
58094 ** except the data returned is in the encoding specified by the second
58158 ** the value by passing it to sqlite3ValueFree() later on. If the expression
58707 ** label by setting the P2 value to its correct non-zero value.
58712 ** to an OP_Function, OP_AggStep or OP_VFilter opcode. This is used by
59128 ** dummy will never be written to. This is verified by code inspection and
59129 ** by running with Valgrind.
59133 ** an OP_Trace instruction is always inserted by sqlite3VdbeGet() as soon as
59287 ** that may be accessed by the VM passed as an argument. In doing so it also
59325 ** Unlock all of the btrees previously locked by a call to sqlite3VdbeEnter().
59411 ** allocated by the OP_Program opcode in sqlite3VdbeExec().
59438 ** the trigger subprograms are listed one by one.
59486 ** initialized to a BLOB by the P4_SUBPROGRAM processing logic below */
59688 ** request, then increment *pnByte by the amount of the request.
59753 ** After the VDBE has be prepped, it can be executed by one or more
59793 ** cells (nMem+1-nCursor)..nMem, inclusive, will never be used by
59822 ** requirements by reusing the opcode array tail, then the second
59827 ** reduce the amount of memory held by a prepared statement.
59880 /* The pCx->pCursor will be close automatically, if it exists, by
59917 ** Also release any dynamic memory held by the VM in the Vdbe.aMem memory
59975 ** Set the number of result columns that will be returned by this SQL
59999 ** Set the name of the idx'th column to be returned by the SQL statement.
60006 ** to by zName will be freed by sqlite3DbFree() when the vdbe is destroyed.
60376 ** This function is called when a transaction opened by the database
60446 /* Lock all btrees used by the statement */
60597 ** by connection db have now been released. Call sqlite3ConnectionUnlocked()
60668 /* Reclaim all memory used by the VDBE
60946 ** 48-bits as required by the IEEE standard. (This is the
61039 ** Deserialize the data blob pointed to by buf as serial type serial_type
61143 ** be eventually freed by the caller using sqlite3DbFree(). Or, if the
61156 int nOff; /* Increment pSpace by nOff to align it */
61161 ** it by. If pSpace is already 8-byte aligned, nOff should be zero.
61182 ** UnpackedRecord structure indicated by the fourth argument with the
61221 ** specified by {nKey1, pKey1} and pPKey2. It returns a negative, zero
61224 ** created by th OP_MakeRecord opcode of the VDBE. The pPKey2
61262 /* mem1.flags = 0; // Will be initialized by sqlite3VdbeSerialGet() */
61263 VVA_ONLY( mem1.zMalloc = 0; ) /* Only needed by assert() statements */
61306 ** This is used by the OP_IsUnique opcode.
61328 ** flag is set, then break the tie by treating key2 as larger.
61465 ** This routine sets the value to be returned by subsequent calls to
61512 ** The returned value must be freed by the caller using sqlite3ValueFree().
61601 ** The following routine destroys a virtual machine that is created by
61606 ** This routine sets the error code and string returned by
61638 ** This routine sets the error code and string returned by
61729 ** The following routines are used by user-defined functions to specify
61882 ** schema change has occurred. That detail is handled by the
61896 ** since any application that receives an SQLITE_MISUSE is broken by
61901 ** returns, and the so were broken by the automatic-reset change. As a
62090 ** for name resolution but are actually overloaded by the xFindFunction
62137 ** the user-function defined by pCtx.
62152 ** argument to the user-function defined by pCtx. Any previous value is
62153 ** deleted by calling the delete function specified when it was set.
62276 ** column value (i.e. a value returned by evaluating an SQL expression in the
62426 ** Return the name of the Nth column of the result set returned by SQL
62867 ** (aka "wildcards") into the SQL text output by sqlite3_trace().
62911 ** the host parameter index is found by scanning the perpared
63029 ** The SQL parser generates a program which is then executed by
63043 ** Most of the code in this file is taken up by the sqlite3VdbeExec()
63046 ** a program instruction by instruction.
63068 ** moves, either by the OP_SeekXX, OP_Next, or OP_Prev opcodes. The test
63102 ** or MEM_Str that has been used by a VDBE opcode. The test procedures
63146 ** An ephemeral string value (signified by the MEM_Ephem flag) contains
63176 ** This routine sets the pMem->type variable used by the sqlite3_value_*()
63220 ** minimizes the number of malloc calls made by the system.
63224 ** cursor 1 is managed by memory cell (p->nMem-1), etc.
63281 ** Processing is determine by the affinity parameter:
63677 ** The following union is automatically generated by the
63679 ** reduce the amount of stack space required by this function.
63895 const char *zDb; /* database name - used by the update hook */
63896 const char *zTbl; /* Table name - used by the opdate hook */
63988 } by;
64231 ** indentation conventions, each case should be indented by 6 spaces. But
64238 ** generates two C files "opcodes.h" and "opcodes.c" by scanning this
64243 ** case statement is followed by a comment of the form "/# same as ... #/"
64251 ** Documentation about VDBE opcodes is generated by scanning this file
64338 ** P1 is the result code returned by sqlite3_exec(), sqlite3_reset(),
64508 ** The P4 value is used by sqlite3_bind_parameter_name().
64643 ** opened by this VM before returning control to the user. This is to
64742 ** Multiply the value in register P1 by the value in register P2
64754 ** Divide the value in register P1 by the value in register P2
64762 ** register P1 by the value in register P2 and store the result in P3.
64856 ** be returned. This is used by the built-in min(), max() and nullif()
64859 ** The interface used by the implementation of the aforementioned functions
64860 ** to retrieve the collation sequence set by this opcode is not available
64943 /* If any auxiliary data functions have been called by this user function,
65002 ** Shift the integer value in register P2 to the left by the
65003 ** number of bits specified by the integer in register P1.
65009 ** Shift the integer value in register P2 to the right by the
65010 ** number of bits specified by the integer in register P1.
65042 /* If shifting by a negative amount, shift in the other direction */
65133 ** A NULL value is not changed by this routine. It remains NULL.
65156 ** A NULL value is not changed by this routine. It remains NULL.
65180 ** A NULL value is not changed by this routine. It remains NULL.
65196 ** A NULL value is not changed by this routine. It remains NULL.
65214 ** A NULL value is not changed by this routine. It remains NULL.
65371 /* Undo any changes made by applyAffinity() to the input registers. */
65379 ** Set the permutation used by the OP_Compare operator to be the array
65397 ** the comparison for use by the next OP_Jump instruct.
65568 ** of "OP_If P1 P2", followed by "OP_Integer 1 P1".
65986 ** The mapping from character to affinity is given by the SQLITE_AFF_
66113 ** opened by cursor P1 in register P2
66135 ** Open, release or rollback the savepoint named by parameter P4, depending
66585 ** P2 in a database file. The database file is determined by P3.
66726 ** to a TEMP table at the SQL level, or to a table opened by
66739 ** by this opcode will be used for automatically created transient
66764 /* If a transient index is required, create it by calling
66822 ** A pseudo-table created by this opcode is used to hold a single
66827 ** P3 is the number of fields in the records that will be stored by
67066 ** for P1 to move so that it points to the rowid given by P2.
67094 ** If P4==0 then register P3 holds a blob constructed by MakeRecord. If
67098 ** Cursor P1 is on an index btree. If the record identified by P3 and P4
67104 ** If P4==0 then register P3 holds a blob constructed by MakeRecord. If
67108 ** Cursor P1 is on an index btree. If the record identified by P3 and P4
67182 ** no data and where the key are records generated by OP_MakeRecord with
67499 ** then rowid is stored for subsequent return by the
67508 ** that boosts performance by avoiding redundant seeks.
67542 const char *zDb; /* database name - used by the update hook */
67543 const char *zTbl; /* Table name - used by the opdate hook */
67640 assert( u.bh.pC->rowidIsValid ); /* lastRowid set by previous OP_NotFound */
67672 ** change counter (returned by subsequent calls to sqlite3_changes()).
67674 ** This is used by trigger programs.
67922 ** Sorting is accomplished by writing records into a sorting index,
68110 ** index opened by cursor P1.
68147 ** the end of the index key pointed to by cursor P1. This integer should be
68190 ** If P5 is non-zero then the key value is increased by an epsilon
68204 ** If P5 is non-zero then the key value is increased by an epsilon prior
68251 ** file is given by P1.
68311 ** in the database file is given by P1. But, unlike Destroy, do not
68320 ** count is incremented by the number of rows in the table being cleared.
68322 ** also incremented by the number of rows in the table being cleared.
68522 #if 0 /* local variables moved into u.by */
68529 #endif /* local variables moved into u.by */
68531 u.by.nRoot = pOp->p2;
68532 assert( u.by.nRoot>0 );
68533 u.by.aRoot = sqlite3DbMallocRaw(db, sizeof(int)*(u.by.nRoot+1) );
68534 if( u.by.aRoot==0 ) goto no_mem;
68536 u.by.pnErr = &aMem[pOp->p3];
68537 assert( (u.by.pnErr->flags & MEM_Int)!=0 );
68538 assert( (u.by.pnErr->flags & (MEM_Str|MEM_Blob))==0 );
68540 for(u.by.j=0; u.by.j<u.by.nRoot; u.by.j++){
68541 u.by.aRoot[u.by.j] = (int)sqlite3VdbeIntValue(&pIn1[u.by.j]);
68543 u.by.aRoot[u.by.j] = 0;
68546 u.by.z = sqlite3BtreeIntegrityCheck(db->aDb[pOp->p5].pBt, u.by.aRoot, u.by.nRoot,
68547 (int)u.by.pnErr->u.i, &u.by.nErr);
68548 sqlite3DbFree(db, u.by.aRoot);
68549 u.by.pnErr->u.i -= u.by.nErr;
68551 if( u.by.nErr==0 ){
68552 assert( u.by.z==0 );
68553 }else if( u.by.z==0 ){
68556 sqlite3VdbeMemSetStr(pIn1, u.by.z, -1, SQLITE_UTF8, sqlite3_free);
68566 ** Insert the integer value held by register P2 into a boolean index
68618 ** of values is identified by a unique P4 value. The first set
68679 ** memory required by the sub-vdbe at runtime.
68703 ** and cleared by the "PRAGMA recursive_triggers" command is clear).
68728 /* SubProgram.nMem is set to the number of memory cells used by the
68730 ** cell is required for each cursor used by the program. Set local
68791 ** address space. This is used by trigger programs to access the new.*
68794 ** The address of the cell in the parent frame is determined by adding
68814 ** Increment a "constraint counter" by P2 (P2 may be negative or positive).
68998 ** argument is not used by this opcode. It is only there to disambiguate
69344 ** P4 is either NULL or a string that was generated by the xBestIndex
69349 ** by P1. The integer query plan parameter to xFilter is stored in register
69568 ** is successful, then the value returned by sqlite3_last_insert_rowid()
69662 ** If tracing is enabled (by the sqlite3_trace()) interface, then
69706 ** by 6 spaces. But the left-most 6 spaces have been removed to improve the
69844 ** This function is used by both blob_open() and blob_reopen(). It seeks
69947 /* One of the following two instructions is replaced by an OP_Noop. */
70293 ** example, by CREATE INDEX statements on tables too large to fit in main
70352 ** The current element is "Apple" (the value of the key indicated by
70359 ** The contents of aTree[] are updated first by comparing the new iterator
70485 ** incremented by the number of bytes written.
70542 i64 *pnByte /* IN/OUT: Increment this value by PMA size */
70570 ** used by the comparison. If an error occurs, return an SQLite error code.
70703 ** Free any cursor components allocated by sqlite3VdbeSorterXXX routines.
70822 ** Each record consists of a varint followed by a blob of data (the
71098 ** Return a pointer to a buffer owned by the sorter that contains the
71176 ** by SQLite to create journal files if the atomic-write optimization
71193 ** A JournalFile object is a subclass of sqlite3_file used by
71529 ** access writes are not required by sqlite.
71598 ** part of SQLite causes Sync to be called by mistake.
71815 ** resolve all identifiers by associating them with a particular
71833 ** usable by indices within the WHERE clause processing logic.
71893 ** allowing it to be repopulated by the memcpy() on the following line.
72098 ** resolved by the time the WHERE clause is resolved.
72263 ** column in the FROM clause. This is used by the LIMIT and ORDER BY
72451 ** case is handled by the calling routine.
72455 ** as an indication to the caller that it should sort by the i-th column.
72618 ** result set expression (as determined by the ExprList.a.iCol field)
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
72704 ** order-by term to a copy of the result-set expression */
72841 ** expressions in the WHERE clause (etc.) can refer to expressions by
72934 ** is replaced by a copy of the left-hand side of the result-set expression.
72940 ** The "x" term of the order by is replaced by "a+b" to render:
73092 ** sequence named by pToken. Return a pointer to the revised expression.
73224 ** Return a pointer to the collation sequence that should be used by
73301 ** of any expression tree referenced by the structure passed as the
73305 ** to by pnHeight, the second parameter, then set *pnHeight to that
73367 ** by the select statement passed as an argument.
73688 ** The size of the structure can be found by masking the return value
73689 ** of this routine with 0xfff. The flags can be found by masking the
73693 ** (unreduced) Expr objects as they or originally constructed by the parser.
73740 ** itself and the buffer referred to by Expr.u.zToken, if any.
73743 ** space to duplicate all Expr nodes in the tree formed by Expr.pLeft
73764 ** portion of the buffer copied into by this function.
73786 ** by pNew. This is either EXPR_FULLSIZE, EXPR_REDUCEDSIZE or
73788 ** by the copy of the p->u.zToken string (if any).
73853 ** be deleted (by being passed to their respective ...Delete() routines)
73856 ** The expression list, ID, and source lists return by sqlite3ExprListDup(),
73858 ** by subsequent calls to sqlite*ListAppend() routines.
74287 ** was computed by pExpr. If we can look at pExpr at compile-time and
74304 ** unchanged by OP_Affinity with the affinity given in the second
74358 ** Where the SELECT... clause is as specified by the parameter to this
74396 ** This function is used by the implementation of the IN (...) operator.
74494 /* The collation sequence used by the comparison. If an index is to
74580 ** the register given by rMayHaveNull to NULL. Calling routines will take
74941 ** value described by z[0..n-1] into register iMem.
74962 ** Generate an instruction that will put the integer describe by
75554 u8 enc = ENC(db); /* The text encoding used by this database */
76191 if( NEVER(v==0) ) return; /* Existance of VDBE checked by caller */
76311 if( NEVER(v==0) ) return; /* Existance of VDBE checked by caller */
76442 ** by a COLLATE operator at the top level. Return 2 if there are differences
76693 ** analyzed by sqlite3ResolveExprNames().
76734 ** If a register is currently being used by the column cache, then
76802 ** This function is used by SQL generated to implement the
76834 ** is immediately followed by a TK_LP or TK_USING token.
76864 ** This C function implements an SQL user function that is used by SQL code
76865 ** generated by the ALTER TABLE ... RENAME command to modify the definition
76927 /* This function is used by SQL generated to implement the
76954 ** preceded by either TK_ON or TK_DOT and immediatedly followed by one
77263 ** of any resources used by the v-table implementation (including other
77264 ** SQLite tables) that are identified by the name of the virtual table.
77510 ** This function is called by the parser after the table-name in
77516 ** to it. Routines called by the parser as the column definition
77518 ** the copy. The copy of the Table structure is deleted by tokenize.c
77561 ** the name by adding an "sqlite_altertab_" prefix. By adding this
77929 ** If K>0 then it is always the case the D>0 so division by zero
78698 ** Called by the parser to compile a DETACH statement.
78720 ** Called by the parser to compile an ATTACH statement.
78772 ** must have been initialized by a prior call to sqlite3FixInit().
78900 ** systems that do not need this facility may omit it by recompiling
78905 ** All of the code in this file may be omitted by defining a single
79125 ** by sqlite3AuthContextPush
79149 ** This file contains C code routines that are called by the SQLite parser
79174 ** The TableLock structure is only used by the sqlite3TableLock() and
79191 ** code to make the lock occur is generated by a later call to
79231 ** Code an OP_TableLock instruction for each table locked by the
79232 ** statement (configured by calls to sqlite3TableLock()).
79271 /* Begin by generating some termination code at the end of the
79358 ** and finalization steps are omitted because those are handling by the
79489 ** Reclaim the memory used by an index
79548 /* Case 1: Reset the single schema identified by iDb */
79635 ** Table. No changes are made to disk by this routine.
79707 ** is obtained from sqliteMalloc() and must be freed by the calling
79977 /* If this is the magic sqlite_sequence table used by autoincrement,
80027 ** by the real entry in code generated at sqlite3EndTable().
80031 ** The rowid and root page number values are needed by the code that
80124 ** This routine is called by the parser while in the middle of
80198 ** This routine is called by the parser while in the middle of
80225 ** This routine is called by the parser while in the middle of
80241 ** is required by pragma table_info.
80388 ** encoding identified by the string zName, length nName.
80470 ** nul-terminated string pointed to by the third parameter, zSignedIdent,
80505 ** from sqliteMalloc() and must be freed by the calling function.
80637 ** should have been put there by the sqliteOpenCb routine.)
80680 ** Once the SELECT has been coded by sqlite3Select(), it is in a
80682 ** by the new table.
80991 ** This function is called by the VDBE to adjust the internal schema
80992 ** used by SQLite when the btree layer moves a table root page. The
81035 ** if a root-page of another table is moved by the btree-layer whilst
81063 ** in case a root-page belonging to another table is moved by the btree layer
81079 ** to be destroyed is relocated by an earlier OP_Destroy. i.e. if the
81087 ** database, then root page 5 would be moved to page 4 by the
81454 ** created. The register specified by memRootPage contains the
81463 int iSorter = iTab; /* Cursor opened by OpenSorter (if in use) */
81538 /* The registers accessed by the OP_IsUnique opcode were allocated
81569 ** currently being constructed by a CREATE TABLE statement.
81576 ** structure. This is used by sqlite3AddPrimaryKey() to mark the index
81816 ** the column will ever be used by the optimizer. Note that using the
81837 ** the way the "idxlist" non-terminal is constructed by the parser,
81985 /* An automatic index created by a PRIMARY KEY or UNIQUE constraint */
82253 ** Expand the space allocated for the given SrcList object by
82424 ** This routine is called by the parser to add a new term to the
82591 ** This function is called by the parser when it parses a command to create,
82743 ** sure that the statement is protected by a statement transaction.
83051 ** that have not been defined by sqlite3_create_collation() etc.
83077 ** specified by zName and nName is not found and parameter 'create' is
83340 ** Free all resources held by the schema structure. The void* argument points
83411 ** This file contains C code routines that are called by the parser
83576 /* duplicate the FROM clause as it is needed by both the DELETE/UPDATE tree
83639 int rcauth; /* Value returned by authorization callback */
83747 ** this optimization caused the row change count (the value returned by
83826 /* Update the sqlite_sequence table by storing the content of the
83892 /* Vdbe is guaranteed to have been allocated by this stage. */
83917 ** used by any BEFORE and AFTER triggers that exist. */
83938 ** are not violated by deleting this row. */
84010 ** block of registers has already been deallocated by the time
84591 ** in the list by making it the first character after '[' or '^'. A
85022 ** from A by replacing every occurance of B with C. The match
85190 /* IMP: R-25361-16150 This function is omitted from SQLite by default. It
85672 ** This file contains code used by the compiler to add foreign key
85742 ** If a delete caused by OR REPLACE violates an FK constraint, an exception
85766 ** row are required by the FK processing VDBE code (i.e. if FKs were
85768 ** accessed). No information is required by the code-generator before
85769 ** coding an INSERT operation. The functions used by the UPDATE/DELETE
85815 ** array is the index of the child table column that is mapped by the FK
85894 ** identified by the test (Index.autoIndex==2). */
85982 int nIncr, /* Increment constraint counter by this */
86108 ** The code generated by this function scans through the rows in the child
86137 int nIncr /* Amount to increment deferred counter by */
86143 WhereInfo *pWInfo; /* Context used by sqlite3WhereXXX() */
86195 ** row being deleted from the scan by adding ($rowid != rowid) to the WHERE
86222 ** deferred constraint counter by nIncr for each row selected. */
86259 ** The second argument is a Trigger structure allocated by the
86342 ** rowid of the row being deleted, followed by each of the column values
86545 ** If the i'th column is not modified by the UPDATE, then the corresponding
86608 ** equivalent to the ON UPDATE or ON DELETE action specified by pFKey.
86610 ** returned (these actions require no special handling by the triggers
86611 ** sub-system, code for them is created by fkScanChildren()).
86626 ** is eventually freed along with the rest of the foreign key object by
86893 ** This file contains C code routines that are called by the parser
86943 ** The column affinity string will eventually be deleted by
86968 ** for each column indexed by the index, according to the affinity of the
86984 ** The column affinity string will eventually be deleted by
87101 ** register used by the autoincrement tracker.
87469 ** (These output registers are allocated by sqlite3Select().) When
87506 ** of the tables being read by the SELECT statement. Also use a
87741 ** If this is a real table, attempt conversions as required by the
87757 ** record number is a randomly generate integer created by NewRowid
87902 /* Update the sqlite_sequence table by storing the content of the
87965 ** modified by an update.
87967 ** The code generated by this routine store new index entries into
87968 ** registers identified by aRegIdx[]. No index entry is created for
87998 ** NOT NULL REPLACE The NULL value is replace by the default
88007 ** Which action to take is determined by the overrideError parameter.
88023 int *aRegIdx, /* Register used by each index. 0 for unused indices */
88148 ** only. The table b-tree entry will be replaced by the new entry
88190 /* Test all UNIQUE constraints by creating entries for each UNIQUE
88297 ** that was started by a prior call to sqlite3GenerateConstraintChecks.
88309 int *aRegIdx, /* Register used by each index. 0 for unused indices */
88506 int regAutoinc; /* Memory register used by AUTOINC */
88740 ** other files are for internal use by SQLite and should not be
88741 ** accessed by users of the library.
88905 ** This header file defines the SQLite interface for use by
88908 ** as extensions by SQLite should #include this file instead of
89044 /* Added by 3.3.13 */
89048 /* Added by 3.4.1 */
89050 /* Added by 3.5.0 */
89116 ** This header file is also used by the loadext.c source file
89427 ** intend to use is supported by the library. Extensions should
89694 ** by calling sqlite3DbFree(db, ).
89713 ** ability to run load_extension is turned off by default. One
89804 ** Enable or disable extension loading. Extension loading is disabled by
89862 ** loaded by every new database connection.
90011 /* The sqlite3GetBoolean() function is used by other modules but the
90171 assert( v!=0 ); /* Already allocated by sqlite3Pragma() */
90189 /* Many of the flag-pragmas modify the code generated by the SQL
90256 ** a number that was preceded by a minus sign.
90321 ** is always on by default regardless of the sign of the default cache
91073 ** Begin by filling registers 2, 3, ... with the root pages numbers
91269 ** The schema-cookie is usually only manipulated internally by SQLite. It
91270 ** is incremented by SQLite whenever the database schema is modified (by
91271 ** creating or dropping a table or index). The schema version is used by
91275 ** Subverting this mechanism by using "PRAGMA schema_version" to modify
91279 ** The user-version is not used internally by SQLite. It may be used by
91602 ** the permanent table is hidden by the TEMP table, we can also
91616 ** database file is given by iDb. iDb==0 is used for the main
91985 ** created by a sub-select). In this case the return value of this
92235 ** and so if a schema change occurs, SQLITE_SCHEMA is returned by
92278 /* This function currently works by first transforming the UTF-16
92299 ** equivalent pointer into the UTF-16 string by counting the unicode
92315 ** and so if a schema change occurs, SQLITE_SCHEMA is returned by
92360 ** This file contains C code routines that are called by the parser
92575 ** This function is used to add terms implied by JOIN syntax to the
92716 /* Add the ON clause to the end of the WHERE clause, connected by
92859 int nExpr /* Number of result columns returned by SELECT */
92930 ** values returned by the SELECT are not required.
93154 ** is determined by the zUsage argument.
93330 ** expression pExpr. The string may be treated as static by the caller.
93337 ** considered a column by this function.
93778 ** a limit or offset is defined by pLimit and pOffset. iLimit and
93940 assert( v!=0 ); /* The VDBE already created by calling function */
94021 /* We can reuse a temporary table generated by a SELECT to our
94118 ** by allocating the tables we will need.
94190 /* Compute collating sequences used by
94194 ** This section is run by the right-most SELECT statement only.
94830 ** by the calling function */
94855 ** whose result set is defined by pEList appears as entry in the
94966 ** (Originally ticket #306. Strengthened by ticket #3300)
95017 ** ORDER by clause of the parent must be simple references to
95025 ** somewhat by saying that the terms of the ORDER BY clause must
95179 /* If the sub-query is a compound SELECT statement, then (by restrictions
95185 ** followed by any ORDER BY, LIMIT and/or OFFSET clauses. This block
95258 ** pSubitem->pTab is always non-NULL by test restrictions and tests above.
95314 ** outer query (the middle slot) is used by the subquery. The next
95599 /* Locate the index named by the INDEXED BY clause, if any. */
95632 ** in the result set and expand them one by one.
95772 ** The calling function can detect the problem by looking at pParse->nErr
95794 ** by selectExpander() but the type and collation information was omitted
95980 ** to pC->iMem. But by the time the value is used, the original register
96025 ** contents of the SelectDest structure pointed to by argument pDest
96064 ** SRT_Discard Throw the results away. This is used by SELECT
96095 AggInfo sAggInfo; /* Information used by aggregate queries */
96159 /* Increment Parse.nHeight by the height of the largest expression
96160 ** tree refered to by this, the parent select. The child select
96341 /* If sorting index that was created by a prior OP_OpenEphemeral
96463 KeyInfo *pKeyInfo; /* Keying information for the group by clause */
96484 /* Initialize memory locations used by GROUP BY aggregate processing
96510 /* The optimizer is able to deliver rows in group by order so
96599 ** Changes in the GROUP BY are detected by the previous code
96602 ** This code copies current group by terms in b0,b1,b2,...
96665 /* Generate a subroutine that will reset the group-by accumulator
96750 ** + If the query is a "SELECT min(x)", then the loop coded by
96784 VdbeComment((v, "%s() by index",
96806 ** and send them to the callback one by one.
97169 ** the table. The list is connected by Trigger.pNext pointers.
97207 ** This is called by the parser when it sees a CREATE TRIGGER statement
97274 ** exist, the error is caught by the block below.
97296 ** and the table is dropped by a different database connection, the
97619 ** the trigger by name. The sqlite3DropTriggerPtr() routine does the
98012 ** (or NULL) the sub-vdbe is immediately halted by jumping to the
98129 ** is given by the op paramater. The tr_tm parameter determines whether the
98153 ** never be accessed by the trigger program, so they are not allocated or
98154 ** populated by the caller (there is no data to populate them with anyway).
98156 ** are never accessed, and so are not allocated by the caller. So, for an
98206 ** old.* or new.* tables actually are used by triggers. This information
98207 ** may be used by the caller, for example, to avoid having to load the entire
98217 ** accessed by triggers. The caller must always assume that it is.
98223 ** and TRIGGER_AFTER bits set. Values accessed by BEFORE triggers are only
98225 ** tr_tm parameter. Similarly, values accessed by AFTER triggers are only
98272 ** This file contains C code routines that are called by the parser
98295 ** The default value of a column is specified by a DEFAULT clause in the
98296 ** column definition. This was either supplied by the user when the table
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
98382 int newmask; /* Mask of NEW.* columns accessed by BEFORE triggers */
98637 ** this record does not exist for some reason (deleted by a trigger,
98673 ** made by triggers.
98676 ** registers associated with columns that are (a) not modified by
98677 ** this UPDATE statement and (b) not accessed by new.* references. The
98678 ** values for registers not modified by the UPDATE must be reloaded from
98719 ** is deleted or renamed by a BEFORE trigger - is left undefined in the
98726 ** all columns not modified by the update statement into their
98784 ** all record selected by the WHERE clause have been updated.
98797 /* Update the sqlite_sequence table by storing the content of the
98946 ** Most of the code in this file may be omitted by defining the
99064 ** occurs anyway. The integrity of the database is maintained by a
99256 ** by manually setting the autoCommit flag to true and detaching the
99258 ** is closed by the DETACH.
99297 ** this struct allocated on the stack. It is used by the implementation of
99390 ** Return a pointer to the VTable object used by connection db to access
99434 ** that contains table p is held by the caller. See header comments
99465 ** shared b-tree databases opened using connection db are held by the
99479 ** by multiple threads. It is thread-safe.
99583 ** sqlite_master table, has already been made by sqlite3StartTable().
99644 ** by sqlite3StartTable().
99777 ** into the linked list headed by pTab->pVTable. Then loop through the
99821 ** This function is invoked by the parser to call the xConnect() method
99890 ** This function is invoked by the vdbe to call the xCreate method
99995 ** This function is invoked by the vdbe to call the xDestroy method
100027 ** called is identified by the second argument, "offset", which is
100390 ** clause subexpression is separated from the others by AND operators,
100391 ** usually, or sometimes subexpressions separated by OR.
100405 ** the <op> using a bitmask encoding defined by WO_xxx below. The
100409 ** A WhereTerm might also be two or more subterms connected by OR:
100434 ** The number of terms in a join is limited by the number of bits
100452 Bitmask prereqRight; /* Bitmask of tables used by pExpr->pRight */
100453 Bitmask prereqAll; /* Bitmask of tables referenced by pExpr */
100460 #define TERM_VIRTUAL 0x02 /* Added by the optimizer. Do not code */
100546 Bitmask used; /* Bitmask of cursors used by this plan */
100570 ** Value for wsFlags returned by bestIndex() and stored in
100672 ** for freeing the expression p is assumed by the WhereClause object pWC.
100677 ** calling this routine. Such pointers may be reinitialized by referencing
100711 ** each subexpression is separated by the AND operator or some other
100761 ** tables in the FROM clause is limited by a test early in the
100838 ** IMPLEMENTATION-OF: R-59926-26393 To be usable by an index a term must be
100917 ** the WO_xx operator codes specified by the op parameter.
101160 ** If all subterms are indexable by a single table T, then set
101187 ** Terms that satisfy case 2 are candidates for lookup by using
101339 ** or follwed by an inverted copy (t2.b==t1.a). Skip this term
101551 ** skipped. Or, if the children are satisfied by an index, the original
101577 /* Analyze a term that is composed of two or more subterms connected by
101620 ** LIKE on all candidate expressions by clearing the isComplete flag
101654 ** This information is used by the xBestIndex methods of
101954 ** or an index structure allocated on the stack by bestBtreeIndex() to
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 ==
102041 /* All terms of the ORDER BY clause are covered by this index so
102051 ** the order by clause is superfluous. Not that if the matching
102121 ** Required because bestIndex() is called by bestOrClauseIndex()
102332 int regIsInit; /* Register set by initialization */
102375 ** columns that are needed by the query. With a covering index, the
102470 ** by passing the pointer returned by this function to sqlite3_free().
102623 ** The best index is computed by the xBestIndex method of the virtual
102642 ExprList *pOrderBy, /* The order by clause */
102680 /* The module name must be defined. Also, by this point there must
102768 /* Try to find a more efficient access pattern by using multiple indexes
102892 ** caller to eventually release this structure by passing it to
102925 ** by scanning an index for a range of values. The range may have an upper
102927 ** and lower bounds are represented by pLower and pUpper respectively. For
102940 ** optimized by the proposed index scan. For example, assuming index p is
102954 ** approximately 1/100th (1%) of the rows selected by the nEq equality
102956 ** that the range scan will visit every row (100%) selected by the equality
102960 ** reduces the search space by 3/4ths. Hence a single constraint (x>?)
103129 int nSingle = 0; /* Histogram regions hit by a single value */
103340 ** used by the SELECT statement are present in the index (such an
103486 ** that are excluded by range constraints.
103520 /* For an index lookup followed by a table lookup:
103590 ** set size by a factor of 10 */
103600 ** set size by a factor of 3. Indexed range constraints reduce
103601 ** the search space by a larger factor: 4. We make indexed range
103608 /* Any other expression lowers the output row count by half */
103719 ** completely satisfied by indices.
103723 ** by indices, we disable them to prevent redundant tests in the inner
103967 ** Terms are separated by AND so add the "AND" text for second and subsequent
103985 ** of the subset of table rows scanned by the strategy in the form of an
104051 sqlite3_int64 nRow; /* Expected number of rows visited by scan */
104118 ** implementation described by pWInfo.
104544 ** WHERE clause terms made redundant by the index range scan.
104558 /* Case 4: Two or more separately indexed terms connected by OR
104569 ** In the example, there are three indexed terms connected by OR.
104577 ** Gosub opcode and jumps straight to the code generated by WhereEnd().
104617 ** by this loop in the a[0] slot and all notReady tables in a[1..] slots.
104770 ** by the most recent call to sqlite3WhereBegin(). Each call to WhereBegin
104828 ** foreach row2 in t2 do |-- by sqlite3WhereBegin()
104832 ** end |-- by sqlite3WhereEnd()
104919 /* The number of tables in the FROM clause is limited by the number of
104968 ** subexpression is separated by an AND operator.
105086 ** by waiting for other tables to run first. This "optimal" test works
105087 ** by first assuming that the FROM clause is on the inner loop and finding
105094 ** join. The nRow value can be reduced by WHERE clause constraints
105099 ** strategies were found by the first iteration. This second iteration
105176 ** index specified by its INDEXED BY clause. This rule ensures
105232 /* Check that if the table scanned by this loop iteration had an
105470 /* Close all of the cursors that were opened by sqlite3WhereBegin.
105543 ** This version of "lempar.c" is modified, slightly, for use by SQLite.
105547 ** specific grammar used by SQLite.
105672 /* Next is all token values, in a form suitable for use by makeheaders.
105676 ** These constants (all generated automatically by the parser generator)
105785 ** YYNSTATE <= N < YYNSTATE+YYNRULE Reduce by rule N-YYNSTATE.
106381 ** the information used by the action routines in the grammar.
106419 ** Turn parser tracing on by giving a stream to which to write the trace
106421 ** by making either argument NULL
107006 /* There is no mechanism by which the parser stack can be popped below
107572 int yyruleno /* Number of the rule by which to reduce */
108805 ** use by the action routines.
108985 ** individual tokens and sends those tokens one-by-one over to the
109028 ** The implementation of this routine was generated by a program,
109031 ** named keywordhash.h and then included into this source file by
109038 ** The code in this file has been automatically generated by
109045 ** But by using this automatically generated code, the size of the code
109555 ** internally by sqlite3NestedParse. */
109559 /* Fall through into the next case if the '#' is not followed by
109787 ** This code used to be part of the tokenizer.c source file. But by
109808 ** Token types used by the sqlite3_complete() routine. See the header
109844 ** statement, possibly preceeded by EXPLAIN and/or followed by
109848 ** ended by a semicolon, the keyword END, and another semicolon.
109856 ** Transitions between states above are determined by tokens extracted
109896 /* If triggers are not supported by this compile then the statement machine
109951 case '`': /* Grave-accent quoted symbols used by MySQL */
110071 ** other files are for internal use by SQLite and should not be
110072 ** accessed by users of the library.
110090 ** This header file is used by programs that want to link against the
110122 ** This header file is used by programs that want to link against the
110154 ** This header file is used by programs that want to link against the
110227 ** this routine will be called automatically by key routines such as
110243 ** thread. Then while the initial invocation of this routine by X is
110247 ** call by X completes.
110282 ** This operation is protected by the STATIC_MASTER mutex. Note that
110381 /* Do extra initialization steps requested by the SQLITE_EXTRA_INIT
111170 ** that it is designed to be called by internal code. The difference is
111344 ** Declare that a function has been overloaded by a virtual table.
111453 ** back by this database connection.
111471 ** The sqlite3_wal_hook() callback registered by sqlite3_wal_autocheckpoint().
111473 ** is greater than sqlite3.pWalArg cast to an integer (the value configured by
111497 ** The callback registered by this function replaces any existing callback
111500 ** configured by this function.
111518 ** into the write-ahead-log by this database connection.
111602 ** The mutex on database handle db should be held by the caller. The mutex
111603 ** associated with the specific b-tree being checkpointed is taken by
111745 ** Return the most recent error code generated by an SQLite routine. If NULL is
111813 /* If collation sequence pColl was created directly by a call to
111814 ** sqlite3_create_collation, and not generated by synthCollSeq(),
111815 ** then any copies made by synthCollSeq() need to be invalidated.
111915 ** there is a hard upper bound set at compile-time by a C preprocessor
111948 ** This function is used to parse both URIs and non-URI filenames passed by the
111969 ** this buffer by calling sqlite3_free().
112610 ** by default. Autocommit is disabled by a BEGIN statement and reenabled
112611 ** by the next COMMIT or ROLLBACK.
113020 ** If zWord is a keyword recognized by the parser, then return the
113133 ** Head of a linked list of all sqlite3 objects created by this process
113231 ** cache. pOther is found by looking at db->pBlockingConnection.
113307 ** the transaction opened by database db has just finished. Locks held
113308 ** by database connection db have been released.
113522 ** generated by the tokenizer. Note that POS_END and POS_COLUMN occur
113543 ** a document record consists of a docid followed by a position-list and
113550 ** Segment leaf nodes store terms and doclists, ordered by term. Leaf
113595 ** to describe what data is stored by the each subtree. Interior
113633 ** at a given height are naturally tracked by interior nodes at
113701 ** frequent terms (which are somewhat dominated by segment merge
113774 ** Defines the interface to tokenizers used by fulltext-search. There
113784 ** sqlite3_tokenizer_cursor is generated by a tokenizer to generate
113796 ** Structures used by the tokenizer interface. When a new tokenizer
113806 ** be used for the fts3 table (customized by the tokenizer clause arguments).
113811 ** the tokenization rules supplied by a specific sqlite3_tokenizer
113839 ** sqlite3_tokenizer.pModule variable should not be initialised by
113881 ** identified by the byte offsets returned in *piStartOffset and
113887 ** The buffer *ppToken is set to point at is managed by the tokenizer
113950 ** directly. Change this structure only by using the routines below.
113971 ** be opaque because it is used by macros.
114071 ** from that used by SQLite, so the maximum length is 10, not 9.
114094 ** The testcase() macro is only used by the amalgamation. If undefined,
114126 ** Internal types used by SQLite.
114178 sqlite3_vtab base; /* Base class used by SQLite core */
114186 /* Precompiled statements used by the implementation. Each of these
114242 sqlite3_vtab_cursor base; /* Base class used by SQLite core */
114246 sqlite3_stmt *pStmt; /* Prepared statement in use by the cursor */
114285 #define FTS3_DOCID_SEARCH 1 /* Lookup by rowid on %_content table */
114312 ** parsed (by code in fts3_expr.c). Below this point the variables are
114324 /* Variables below this point are populated by fts3_expr.c when parsing
114361 /* The following are used by the fts3_eval.c module. */
114411 /* Special values interpreted by sqlite3SegReaderCursor() */
114438 /* Used internally by sqlite3Fts3SegReaderXXX() calls */
114449 /* Used by fts3.c only. */
114595 ** Convert an SQL-style quoted string into a normal string by removing
114647 ** and sets *pVal by the varint value.
114788 ** required by the FTS3 table passed as the only argument. This is done
114793 ** %_stat tables required by FTS4.
114970 ** to return the docid, followed by each column of text data in order
114979 ** The pointer returned points to a buffer allocated by sqlite3_malloc(). It
114984 ** by this function, NULL is returned and *pRc is set to SQLITE_NOMEM. If
115012 ** is preceded by zFunc and an open bracket, and followed by a closed
115018 ** The pointer returned points to a buffer allocated by sqlite3_malloc(). It
115023 ** by this function, NULL is returned and *pRc is set to SQLITE_NOMEM. If
115073 ** representing the indexes maintained by the current FTS table. FTS tables
115183 /* Loop through all of the arguments passed by the user to the FTS3/4
115432 ** 1. Direct lookup by rowid or docid.
115656 ** headed by node iChild are smaller than zTerm. No need to search
115660 ** the tree headed by iChild may contain the specified term.
115686 ** The buffer pointed to by argument zNode (size nNode bytes) contains an
115688 ** contains a term. This function searches the sub-tree headed by the zNode
115782 /* The end of a position list is marked by a zero encoded as an FTS3
115783 ** varint. A single POS_END (0) byte. Except, if the 0 byte is preceded by
115788 ** immediately preceded by a byte with the 0x80 bit set. Then increments
115816 ** The column-list is terminated either by a POS_COLUMN varint (1) or
115829 /* A column-list is terminated by either a 0x01 or 0x00 byte that is
115861 ** increment the current value of *pi by the value read, and set *pp to
115883 ** If parameter iCol is not 0, write an POS_COLUMN (1) byte followed by
115941 ** incremented by 2 before being stored. Each list is terminated by a
116115 ** Merge two position-lists as required by the NEAR operator. The argument
116243 ** This macro is used by various functions that merge doclists. The two
116357 ** The right-hand input doclist is overwritten by this function.
116572 ** made by an fts4aux module, not an FTS table. In this case calling
116573 ** Fts3SegReaderPending might segfault, as the data structures used by
116592 /* Read the values returned by the SELECT into local variables. */
116646 /* "isScan" is only set to true by the ft4aux module, an ordinary
116679 ** It is the responsibility of the caller to free this object by eventually
116737 ** Free an Fts3MultiSegReader allocated by fts3TermSegReaderCursor().
116930 ** row by docid.
116974 ** This is the xColumn method, called by SQLite to request a value from
116986 /* The column value supplied by SQLite must be in range. */
117011 ** This function is the implementation of the xUpdate callback used by
117012 ** FTS3 virtual tables. It is invoked by SQLite each time a row is to be
117051 ** by fts3SyncMethod().
117066 ** hash-table. Any changes made to the database are reverted by SQLite.
117097 ** Helper function used by the implementation of the overloaded snippet(),
117413 ** to by the argument to point to the "simple" tokenizer implementation.
117424 ** of the sqlite library, then this function is called directly by
117426 ** function is called by the sqlite3_extension_init() entry point.
117510 ** by pExpr.
117795 ** through doclists. It is used by this module to iterate through phrase
117796 ** doclists in reverse and by the fts3_write.c module to iterate through
117914 ** edited in place by fts3EvalNearTrim(), then pIter may not actually
117916 ** with this case by advancing pIter past the zero-padding added by
117975 ** to phrases that are connected only by AND and NEAR operators (not OR or
118040 ** The average document size in pages is calculated by first calculating
118044 ** the number of overflow pages consumed by a record B bytes in size.
118117 int nOvfl = 0; /* Total overflow pages used by doclists */
118140 ** of the number of overflow pages that will be loaded by the pager layer
118144 ** a. The cheapest token in the entire query (i.e. the one visited by the
118382 int bDescDoclist = pCsr->bDesc; /* Used by DOCID_CMP() macro */
118697 ** earlier, by fts3EvalNextRow()).
118782 ** by pExpr, calling this function for each row. This function increments
118913 ** This function is used by the matchinfo() module to query a phrase
118936 ** tokens), count the potential occurrence identified by considering
118981 ** compression and is terminated by either an 0x01 or 0x00 byte. For example,
119027 ** Free all components of the Fts3Phrase structure that were allocated by
119031 ** * any Fts3MultiSegReader objects held by phrase tokens.
119086 sqlite3_vtab base; /* Base class used by SQLite core */
119091 sqlite3_vtab_cursor base; /* Base class used by SQLite core */
119130 int rc; /* value returned by declare_vtab() */
119561 ** traditionally used by fts3. Or, if SQLITE_ENABLE_FTS3_PARENTHESIS
119570 ** supported by the new syntax (it is replaced by the NOT operator).
119582 ** The following describes the syntax supported by the fts3 MATCH
119583 ** operator in a similar format to that used by the lemon parser
119624 ** This variable is used by function getNextNode(). When getNextNode() is
119675 ** Fts3Expr structure (if any) by passing it to sqlite3_free().
119786 ** Buffer p: Points to the Fts3Expr structure, followed by the Fts3Phrase
119787 ** structure, followed by the array of Fts3PhraseToken
119867 ** Function getNextNode(), which is called by fts3ExprParse(), may itself
120263 ** specified as part of the query string), or -1 if tokens may by default
120302 ** Free a parsed fts3 query expression allocated by sqlite3Fts3ExprParse().
120552 /* Turn bulk memory into a hash table object by initializing the
121006 ** Close a tokenization cursor previously opened by a call to
121033 ** is that 'y' is a consonant unless it is followed by another
121057 ** Let any sequence of one or more vowels be represented by V and let
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
121070 ** by a consonant.
121073 ** for an instance of of a consonant followed by a vowel.
121179 ** by taking 10 or 3 bytes from the beginning and end.
121214 ** Words that are longer than about 20 bytes are stemmed by retaining
121463 ** have been opened by a prior call to porterOpen().
121466 sqlite3_tokenizer_cursor *pCursor, /* Cursor returned by porterOpen */
121913 ** can be used as designed by the C-code in the queryTokenizer and
121962 ** the hash table pointed to by argument pHash. The hash table must
121964 ** of the key when a value is inserted. i.e. by a call similar to:
122167 ** Close a tokenization cursor previously opened by a call to
122179 ** have been opened by a prior call to simpleOpen().
122182 sqlite3_tokenizer_cursor *pCursor, /* Cursor returned by simpleOpen */
122276 ** of the sub-routines used to merge segments are also used by the query
122356 ** this structure are only manipulated by code in this file, opaque handles
122357 ** of type Fts3SegReader* are also used by code in fts3.c to iterate through
122385 /* Variables set by fts3SegReaderNext(). These may be read directly
122386 ** by the caller. They are valid from the time SegmentReaderNew() returns
122396 /* The following variables are used by fts3SegReaderNextDocid() to iterate
122409 ** database. The internal details of this type are only accessed by the
122430 ** Type SegmentNode is used by the following three functions to create
122432 ** the leaf nodes). These functions and type are only ever used by code
122495 ** for the statement identified by the second argument. If successful,
122631 ** array apVal[] to the SQL statement identified by eStmt, the statement
122843 ** Free a PendingList object allocated by fts3PendingListAppend().
122886 ** p->iPrevDocid, and the column is specified by argument iCol.
122971 ** we ordered the doclists by size and flushed the largest until the
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.
123023 ** The apVal parameter is passed a copy of the apVal argument passed by
123158 ** by:
123212 ** specific row is identified by the iBlockid parameter. If paBlob is not
123224 ** Fts3Table.pSegments variable. This handle is reused by subsequent calls
123225 ** to this function. The handle may be closed by calling the
123666 ** an array of pending terms by term. This occurs as part of flushing
123782 ** Compare the entries pointed to by two Fts3SegReader structures.
123853 ** points to with the term specified by arguments zTerm and nTerm.
123963 ** Return the size of the common prefix (if any) shared by zPrev and
124185 ** Add a term to the segment being constructed by the SegmentWriter object
124237 /* Figure out how many bytes are required by this new entry */
124300 ** If the isCopyTerm parameter is true, then the buffer pointed to by
124362 ** Release all memory held by the SegmentWriter object passed as the
125207 ** (allocated) by the sqlite3Fts3CacheDeferredDoclists() function.
125391 sqlite3_int64 iRemove = 0; /* Rowid removed by UPDATE or DELETE */
125612 ** accumulating the data returned by the matchinfo() function.
125641 ** element of the list is represented by an FTS3 varint that takes the value
125763 ** Advance the position list iterator specified by the first two
125846 u64 mCover = 0; /* Mask of phrases covered by this snippet */
125885 ** This function is an fts3ExprIterate() callback used by fts3BestSnippet().
125915 ** by adding:
126084 ** right. Otherwise, the snippet is shifted by the number of tokens
126088 int nShift; /* Number of tokens to shift snippet by */
126242 /* A column-list is terminated by either a 0x01 or 0x00. */
126258 ** of the matchinfo array that are constant for all rows returned by the
126293 ** array that are different for each row returned by the query.
126337 int nVal; /* Number of integers output by cArg */
126485 LcsIterator *pAdv = 0; /* The iterator to advance by one position */
126517 ** be returned by the matchinfo() function. Argument zArg contains the
126672 /* Determine the number of integers in the buffer returned by this call. */
126737 u64 mCovered = 0; /* Bitmask of phrases covered by snippet */
126738 u64 mSeen = 0; /* Bitmask of phrases seen by BestSnippet() */
126776 /* If all query phrases seen by fts3BestSnippet() are present in at least
126820 ** This function is an fts3ExprIterate() callback used by sqlite3Fts3Offsets().
127080 ** consists of a single 8-byte integer followed by an even number
127093 ** by defining the following symbols:
127187 ** headed by the node (leaf nodes have RtreeNode.iNode==0).
127328 ** as the context for the user-function created by by s_r_g_c(). The object
127329 ** is eventually deleted by the destructor mechanism provided by
127330 ** sqlite3_create_function_v2() (which is called by s_r_g_c() to create
127717 ** to by pCell with the results.
127914 ** Set *pbEof to true if the sub-tree headed by the cell is filtered
127915 ** (excluded) by the constraints in the pCursor->aConstraint[]
127965 ** would be filtered (excluded) by the constraints in the
127967 ** returning. If the cell is not filtered (excluded) by the constraints,
128125 /* This "scan" is a direct lookup by rowid. There is no next entry. */
128280 /* Special case - lookup by rowid. */
128356 ** 1 Unused Direct lookup by rowid.
128490 ** Return true if the area covered by p2 is a subset of the area covered
128491 ** by p1. False otherwise.
128509 ** Return the amount cell p would grow by if it were unioned with pCell.
128626 ** is inserted into it. Resolve ties by choosing the entry with
128889 ** The aSpare array is used as temporary working space by the
128955 ** The aSpare array is used as temporary working space by the
129253 /* Ensure both child nodes have node numbers assigned to them by calling
129255 ** by nodeNew() above. But node pLeft sometimes already has a node number.
129332 ** is implemented as a delete followed by an insert). SQLite provides the
129496 /* Allocate the buffers used by this operation. The allocation is
129556 ** the height of the sub-tree headed by the cell.
129629 ** the height of the sub-tree headed by the cell.
129699 ** reduce the tree height by one.
129767 ** conflict-handling mode specified by the user.
130002 ** determine the node-size used by the rtree table being created or connected
130007 ** table already exists. In this case the node-size is determined by inspecting
130155 ** list, containing the 8-byte rowid/pageno followed by the
130236 ** in two places - as the destructor for the blob value returned by the
130249 ** The scalar user functions return a blob that is interpreted by r-tree
130518 UErrorCode e /* Error code returned by ICU function */
130973 ** Close a tokenization cursor previously opened by a call to icuOpen().
130987 sqlite3_tokenizer_cursor *pCursor, /* Cursor returned by simpleOpen */