Lines Matching refs:from
2 ** This file is an amalgamation of many separate C source files from SQLite
332 ** if experience from use "in the wild" suggest such changes are prudent.
335 ** from comments in this file. This file is the authoritative source
348 ** Make sure we can call this stuff from C++.
440 ** be larger than the release from which it is derived. Either Y will
491 ** of the hash might be different from [SQLITE_SOURCE_ID].)^
505 ** compile time. ^The SQLITE_ prefix may be omitted from the
512 ** prefix is omitted from any strings returned by
542 ** to use SQLite concurrently from more than one thread.
561 ** sqlite3_config(). In other words, the return value from sqlite3_threadsafe()
658 ** from [sqlite3_open()], [sqlite3_open16()], or
697 ** from [sqlite3_malloc()] and passed back through the 5th parameter.
711 ** callback is an array of pointers to strings obtained as if from
717 ** from [sqlite3_column_name()].
747 ** Many SQLite functions return an integer result code from the set shown
782 #define SQLITE_NOTICE 27 /* Notifications from sqlite3_log() */
783 #define SQLITE_WARNING 28 /* Warnings from sqlite3_log() */
983 ** of an [sqlite3_io_methods] object. These values are ordered from
1300 ** final bottom-level VFS are written into memory obtained from
1327 ** of the char** argument point to a string obtained from [sqlite3_mprintf()]
1361 ** written into memory obtained from [sqlite3_malloc()]. The caller should
1479 ** The [SQLITE_FCNTL_CKPT_START] opcode is invoked from within a checkpoint
1480 ** in wal mode before the client starts to copy pages from the wal
1484 ** The [SQLITE_FCNTL_CKPT_DONE] opcode is invoked from within a checkpoint
1485 ** in wal mode after the client has finished copying pages from the wal
1620 ** of the sqlite3_vfs object changed in the transition from
1647 ** from xFullPathname() with an optional suffix added.
1766 ** varies from one VFS to another, and from one version of the same VFS to the
1769 ** from one release to the next. Applications must not attempt to access
1898 ** is not. The sqlite3_shutdown() interface must only be called from a
2029 ** order to verify that SQLite recovers gracefully from such
2033 ** malloc(), realloc() and free() functions from the standard C library.
2038 ** previously obtained from xMalloc or xRealloc. The allocated size
2058 ** xShutdown method is only called from [sqlite3_shutdown()] so it does
2091 ** should check the return code from [sqlite3_config()] to make sure that
2103 ** it is not possible to change the [threading mode] from its default
2200 ** ^It is harmless, apart from the wasted memory,
2211 ** from [sqlite3_malloc()] sufficient for N cache lines if N is positive or
2245 ** the entire mutexing subsystem is omitted from the build and hence calls to
2258 ** the entire mutexing subsystem is omitted from the build and hence calls to
2417 ** from the database as records are returned in sorted order. The default
2473 ** should check the return code from [sqlite3_db_config()] to make sure that
2590 ** <dd> Usually, when a database in wal mode is closed or detached from a
2709 ** takes additional defensive steps to protect the application from harm
2936 ** To detect changes against a database file from other database
2966 ** ^It is safe to call this routine from a thread different from the
3017 ** then the return value from sqlite3_complete16() will be non-zero
3122 ** complete query results from one or more queries.
3171 ** After the application has finished with the result from sqlite3_get_table(),
3200 ** from the standard C library.
3201 ** These routines understand most of the common formatting options from
3207 ** results into memory obtained from [sqlite3_malloc64()].
3213 ** ^(The sqlite3_snprintf() routine is similar to "snprintf()" from
3217 ** first two parameters is reversed from snprintf().)^ This is an
3269 ** was not obtained from sqlite3_malloc() or sqlite3_realloc().
3291 ** ^If X is a memory allocation previously obtained from sqlite3_malloc(),
3308 ** must be either NULL or else pointers obtained from a prior
3363 ** seeded using randomness obtained from the xRandomness method of
3417 ** extracted from that table (for example in a query like
3425 ** SQL statements from an untrusted source, to ensure that the SQL statements
3435 ** Applications that need to process SQL from untrusted sources
3477 ** returned from the [sqlite3_vtab_on_conflict()] interface.
3498 ** the access attempt or NULL if this access attempt is directly from
3646 ** mask M occur. ^The integer return value from the callback is currently
3779 ** capabilities may be omitted from many builds of SQLite. In such cases,
3851 ** with a '/' (meaning that the authority section is omitted from the URI)
3882 ** or writes from disk is used. ^It is an error to specify a value for
4001 ** <li> A filename obtained from [sqlite3_db_filename()], or
4073 ** obtained from [sqlite3_db_filename()], then sqlite3_filename_journal(F)
4078 ** filename obtained from [sqlite3_db_filename()], then
4083 ** filename passed into the VFS from the SQLite core and F is not the
4084 ** return value from [sqlite3_db_filename()], then the result is
4118 ** with N URI parameters key/values pairs in the array P. The result from
4131 ** return a NULL pointer. The memory obtained from sqlite3_create_filename(X)
4143 ** previously obtained from sqlite3_create_filename(). Invoking
4147 ** than a NULL pointer or a pointer previously acquired from
4427 ** The first argument, "db", is a [database connection] obtained from a
4439 ** number of bytes read from zSql. ^If nByte is zero, then no prepared
4501 ** <p>^sqlite3_prepare_v3() differs from sqlite3_prepare_v2() only in having
4587 ** is obtained from [sqlite3_malloc()] and must be freed by the application
4667 ** [SQLITE_DONE] from [sqlite3_step(S)]) nor
4696 ** protected sqlite3_value from an unprotected sqlite3_value.
4763 ** a pointer to the [sqlite3_stmt] object returned from
4829 ** object is to be copied prior to the return from sqlite3_bind_*(). ^The
4838 ** from the encoding specified by the sixth parameter, then the behavior
4953 ** was prepared from UTF-16 text using [sqlite3_prepare16_v2()] or
5007 ** (for example during a conversion from UTF-8 to UTF-16) then a
5012 ** then the name of the column is unspecified and may change from
5047 ** or column that query result column was extracted from.
5160 ** [sqlite3_reset()] would result in an [SQLITE_MISUSE] return from
5270 ** that was returned from [sqlite3_prepare_v2()] or one of its variants)
5285 ** are called from a different thread while any of these routines
5337 ** value from sqlite3_column_blob() for a zero-length BLOB is a NULL pointer.
5370 ** <tr><td> INTEGER <td> FLOAT <td> Convert from integer to float
5430 ** from [sqlite3_column_blob()], [sqlite3_column_text()], etc. into
5446 ** If an out-of-memory error occurs, then the return value from these
5448 ** Valid SQL NULL returns can be distinguished from out-of-memory errors
5576 ** flag, which if present prevents the function from being invoked from
5721 ** from top-level SQL, and cannot be used in VIEWs or TRIGGERs nor in
5819 ** <td>→ <td>True if value originated from a [bound parameter]
5824 ** These routines extract type, size, and content information from
5858 ** occurs is undefined and may change from one release of SQLite to the next.
5871 ** returns something other than SQLITE_TEXT, then the return value from
5876 ** thus change the return from subsequent calls to sqlite3_value_encoding(X).
5892 ** value X originated from one of the [sqlite3_bind_int|sqlite3_bind()]
5893 ** interfaces. ^If X comes from an SQL literal value, or a table column,
5897 ** from [sqlite3_value_blob()], [sqlite3_value_text()], or
5902 ** These routines must be called from the same thread as
5920 ** If an out-of-memory error occurs, then the return value from these
5922 ** Valid SQL NULL returns can be distinguished from out-of-memory errors
5950 ** information can be used to pass a limited amount of context from
5968 ** previously obtained from [sqlite3_value_dup()]. ^If V is a NULL pointer
5992 ** first time from within xFinal().)^
6014 ** This routine must be called from the same thread in which
6029 ** This routine must be called from the same thread in which
6070 ** calls to sqlite3_get_auxdata(C,N) return P from the most recent
6094 ** values and [parameters] and expressions composed from the same.)^
6100 ** These routines must be called from the same thread in which
6138 ** ^The sqlite3_result_blob() interface sets the result from
6147 ** ^The sqlite3_result_double() interface sets the result from
6156 ** message string from sqlite3_result_error() as UTF-8. ^SQLite
6157 ** interprets the string from sqlite3_result_error16() as UTF-16 using
6164 ** bytes (not characters) from the 2nd parameter as the error message.
6199 ** ^SQLite takes the text result from the application from
6226 ** from [sqlite3_malloc()] before it returns.
6231 ** byte-order mark (BOM, U+FEFF) then the BOM is removed from the
6268 ** If these routines are called from within the different thread
6301 ** the result from the [application-defined SQL function] with
6385 ** This is different from every other SQLite interface. The inconsistency
6509 ** requested from the operating system is returned.
6514 ** all, then the behavior of sqlite3_sleep() may deviate from the description
6529 ** Applications are strongly discouraged from using this global variable.
6546 ** it to point to memory obtained from [sqlite3_malloc]. ^Furthermore,
6548 ** that this variable points to is held in memory obtained from
6552 ** made NULL or made to point to memory obtained from [sqlite3_malloc]
6603 ** it to point to memory obtained from [sqlite3_malloc]. ^Furthermore,
6605 ** that this variable points to is held in memory obtained from
6609 ** made NULL or made to point to memory obtained from [sqlite3_malloc]
6622 ** a non-NULL value will be copied into memory obtained from [sqlite3_malloc]
6769 ** CAPI3REF: Allowed return values from [sqlite3_txn_state()]
6784 ** in a read transaction. Content has been read from the database file
6834 ** return the P argument from the previous call of the same function
6853 ** ^The rollback hook is invoked on a rollback that results from a commit
6902 ** from sqlite3_autovacuum_pages() is normally SQLITE_OK, but might
6975 ** returns the P argument from the previous call
7055 ** memory as possible from database connection D. Unlike the
7086 ** ^The return value from both sqlite3_soft_heap_limit64() and
7120 ** <li> The page cache allocates from its own memory pool supplied
7122 ** from the heap.
7208 ** ^This function causes all database schemas to be read from disk and
7228 ** ^This interface loads an SQLite extension library from the named file.
7243 ** characters in the filename from the last "/" to the first following
7250 ** obtained from [sqlite3_malloc()]. The calling function
7263 ** disabled and prevent SQL injections from giving attackers
7271 const char *zProc, /* Entry point. Derived from zFile if 0 */
7297 ** remains disabled. This will prevent SQL injections from giving attackers
7324 ** point to an appropriate error message (obtained from [sqlite3_mprintf()])
7437 ** pass information into and receive the reply from the [xBestIndex]
7464 ** required by the current scan. Virtual table columns are numbered from
7492 ** ^The orderByConsumed means that output from [xFilter]/[xNext] will occur in
7553 char *idxStr; /* String, possibly obtained from sqlite3_malloc */
7590 ** All operator values from SQLITE_INDEX_CONSTRAINT_FUNCTION through
7681 ** table modules from database connection D except those named on list L.
7689 sqlite3 *db, /* Remove modules from this connection */
7705 ** string obtained from [sqlite3_mprintf()] to zErrMsg. The method should
7714 char *zErrMsg; /* Error message from sqlite3_mprintf() */
7954 ** ^(This function is used to read data from an open [BLOB handle] into a
7956 ** from the open BLOB, starting at offset iOffset.)^
7958 ** ^If offset iOffset is less than N bytes from the end of the BLOB,
7964 ** ^An attempt to read from an expired [BLOB handle] fails with an
7983 ** ^(This function is used to write data into an open [BLOB handle] from a
7984 ** caller-supplied buffer. N bytes of data are copied from the buffer Z
7999 ** ^If offset iOffset is less than N bytes from the end of the BLOB,
8292 ** The set of static mutexes may change from one SQLite release to the
8358 ** from the pager.
8365 ** an incorrect zDbName and an SQLITE_ERROR return from the underlying
8387 ** operate consistently from one release to the next.
8517 ** silently reject new text, always return SQLITE_NOMEM from
8519 ** [sqlite3_str_length()], and always return NULL from
8537 ** and returns a pointer to a memory buffer obtained from [sqlite3_malloc64()]
8552 ** from [sqlite3_str_new()].
8559 ** ^The [sqlite3_str_append(X,S,N)] method appends exactly N bytes from string S
8719 ** New status parameters may be added from time to time.
8739 ** is an integer constant, taken from the set of
8765 ** might be discontinued. Applications should check the return code from
8897 ** ^(This interface is used to retrieve and reset counter values from
9058 ** xShutdown method is only called from [sqlite3_shutdown()] so it does
9137 ** then the page must be evicted from the cache.
9229 ** for copying in-memory databases to or from persistent files.
9238 ** preventing other database connections from
9292 ** from source to destination, then it returns [SQLITE_DONE].
9360 ** ^A return of [SQLITE_BUSY] or [SQLITE_LOCKED] from sqlite3_backup_step()
9385 ** from within other threads.
9447 ** callback is invoked from within the [sqlite3_step] or [sqlite3_close]
9454 ** from within the call to sqlite3_unlock_notify().)^
9471 ** any sqlite3_xxx API functions from within an unlock-notify callback, a
9604 ** nothing to prevent an application from calling sqlite3_log(), doing so
9647 ** a copy of the third parameter from the previous call, if any, or 0.
9676 ** from SQL.
9732 ** database writer and all readers are reading from the most recent database
9741 ** until all readers are reading from the database file only. ^This ensures
9742 ** that the next writer will restart the log file from the beginning.
9774 ** checkpoint operation proceeds from that point in the same way as
9801 ** from SQL.
9889 ** [sqlite3_vtab_config](db,SQLITE_VTAB_DIRECTONLY) from within the
9891 ** prohibits that virtual table from being used from within triggers and
9897 ** [sqlite3_vtab_config](db,SQLITE_VTAB_INNOCUOUS) from within the
9899 ** identify that virtual table as being safe to use from within triggers
9914 ** This function may only be called from within a call to the [xUpdate] method
9974 ** This function may only be called from within a call to the [xBestIndex]
9992 ** <li><p> If the constraint comes from a WHERE clause expression that contains
10009 ** This API may only be used from within an [xBestIndex|xBestIndex method]
10011 ** interface from outside of xBestIndex() is undefined and probably harmful.
10027 ** the return value from sqlite3_vtab_distinct().
10081 ** This interface may only be used from within an
10083 ** The result of invoking this interface from any other context is
10095 ** only sees a single value from the right-hand side of the IN operator
10122 ** the return value from sqlite3_vtab_in(P,N,F) will always be the same
10154 ** These interfaces are only useful from within the
10156 ** The result of invoking these interfaces from any other context
10193 ** method from which these routines were called. If the virtual table
10204 ** This API may only be used from within the [xBestIndex|xBestIndex method]
10206 ** from outside of an xBestIndex method are undefined and probably harmful.
10208 ** ^When the sqlite3_vtab_rhs_value(P,J,V) interface is invoked from within
10251 ** return value from the [sqlite3_set_authorizer()] callback and that
10283 ** query planner's estimate for the average number of rows output from each
10333 ** Loops are numbered starting from zero. ^If idx is out of range - less than
10371 ** active SQL statement is reading from it, or if it is page 1 of a database
10444 ** may only be called from within a preupdate callback. Invoking any of
10445 ** these routines from outside of a preupdate callback or with a
10446 ** [database connection] pointer that is different from the one supplied
10474 ** triggers; or 2 for changes resulting from triggers called by top-level
10534 ** Subsequent changes to the database from other connections are not seen
10582 ** The [sqlite3_snapshot] object returned from a successful call to
10688 ** CAPI3REF: Recover snapshots from a wal file
10726 ** the database into memory obtained from [sqlite3_malloc64()] and returns
10742 ** SQLITE_SERIALIZE_NOCOPY bit is omitted from argument F if a memory
10775 ** [database connection] D to disconnect from database S and then
10820 ** in the P argument is held in memory obtained from [sqlite3_malloc64()]
10936 void *pContext; /* pContext from when function registered */
10976 ** Make sure we can call this stuff from C++.
11296 ** modified from their original values, an UPDATE change is added to
11370 ** used to update the table in database zFrom (call this the "from-table")
11376 ** the from-table, an INSERT record is added to the session object.
11379 ** the from-table, a DELETE record is added to the session object.
11417 ** <li> The original values of any modified fields are omitted from
11649 ** sqlite3_value object containing the iVal'th value from the vector of
11651 ** returns SQLITE_OK. The name of the function comes from the fact that this
11680 ** sqlite3_value object containing the iVal'th value from the vector of
11684 ** SQLITE_OK returned. The name of the function comes from the fact that
11712 ** sqlite3_value object containing the iVal'th value from the
11722 sqlite3_value **ppValue /* OUT: Value from conflicting row */
11925 ** The existing INSERT is removed from the changegroup. The DELETE is
11940 ** new change differ from those in the row deleted by the existing
12067 ** the changeset the row is deleted from the target database.
12070 ** the non-primary key fields contains a value different from the original
12115 ** the modified non-primary key fields contains a value different from an
12135 ** table that the callback related to, from within the xConflict callback.
12140 ** If any other error (aside from a constraint failure when attempting to
12302 ** handler, then the conflicting row is removed from the database and a
12322 ** on S0 is received from another site (the "remote" changeset) and
12337 ** removed from the local changeset (it was overridden). Or, if the
12363 ** from the update change are filled in using the old.* values from
12365 ** the UPDATE change is simply omitted from the rebased changeset.
12389 ** Note that conflict resolutions from multiple remote changesets are
12402 ** <li> The new object is configured with the rebase buffer obtained from
12432 ** bytes), which must have been obtained from a previous call to
12684 ** Make sure we can call this stuff from C++.
12795 ** are numbered starting from zero.
12809 ** Phrase matches are numbered starting from zero, so the iIdx argument
13042 ** or removed from the FTS table. The tokenizer is being invoked to
13043 ** determine the set of tokens to add to (or delete from) the
13066 ** of the first byte of and first byte immediately following the text from
13542 ** integers to pointers. The way you do this varies from one compiler
13549 ** that vary from one machine to the next.
13551 ** Ticket #3860: The llvm-gcc-4.2 compiler from Apple chokes on
13776 ** expressions could be omitted from the code completely. But they
14636 ** callback is currently invoked only from within pager.c.
14695 ** pointer will work here as long as it is distinct from SQLITE_STATIC
14703 ** All variables must either be on the stack or dynamically allocated from
14810 ** Changing this from a 64-bit to a 32-bit type limits the number of
15056 ** A PENDING_LOCK is obtained by locking a designated byte different from
15068 ** SHARED_SIZE is the number of bytes available in the pool from which
15256 #define PAGER_GET_NOCONTENT 0x01 /* Do not load data from disk */
15603 ** to prefetch content from remote machines - to provide those
15960 #define P4_DYNAMIC (-6) /* Pointer to memory from sqliteMalloc() */
16578 SQLITE_PRIVATE void sqlite3PcacheDrop(PgHdr*); /* Remove page from cache */
16596 /* Clear flags from pages of the page cache */
16644 /* Free up as much memory as possible from the page cache */
16762 ** from the SQLITE_DEFAULT_SYNCHRONOUS value by 1.
16887 ** allocations on the pInit list from the total number of allocations.
16895 ** (1200-byte) slots. Allocations are filled from the small-pool first,
16905 u8 bMalloced; /* True if pStart obtained from sqlite3_malloc() */
16937 ** functions use a regular table table from hash.h.)
17026 int iSysErrno; /* Errno value from last system error */
17271 #define SQLITE_IndexedExpr 0x01000000 /* Pull exprs from index when able */
17354 ** SQLITE_FUNC_CONSTANT == SQLITE_DETERMINISTIC from the API
17355 ** SQLITE_FUNC_DIRECT == SQLITE_DIRECTONLY from the API
17717 ** immediately. Instead, they are moved from the Table.pVTable list to
17764 LogEst nRowLogEst; /* Estimated rows in table - from sqlite_stat1 table */
17810 #define TF_HasStat1 0x00000010 /* nRowLogEst set from sqlite_stat1 */
17839 ** table support is omitted from the build.
17875 ** A foreign key is associated with two tables. The "from" table is
17885 ** For foreign key "fk1", the from-table is "ex1" and the to-table is "ex2".
17888 ** from-table == child-table
17892 ** which is attached to the from-table. The to-table need not exist when
17893 ** the from-table is created. The existence of the to-table is not checked.
17922 ** fails and any prior changes from that one operation are backed out,
17943 ** conflict resolution algorthm is required from context.
18078 ** generate VDBE code (as opposed to parsing one read from an sqlite_schema
18108 unsigned hasStat1:1; /* aiRowLogEst values come from sqlite_stat1 */
18194 ** from source tables rather than from accumulators */
18285 ** If the Expr is of type OP_Column, and the table it is selecting from
18353 int iOfst; /* else: start of token from start of statement */
18400 #define EP_Static 0x8000000 /* Held in memory not obtained from malloc() */
18403 #define EP_FromDDL 0x40000000 /* Originates from sqlite_schema */
18514 unsigned bUsingTerm:1; /* Term from the USING clause of a NestedFrom */
18609 unsigned fromDDL :1; /* Comes from sqlite_schema */
18614 unsigned isSynthUsing :1; /* u3.pUsing is synthensized from NATURAL */
18624 char *zIndexedBy; /* Identifier from "INDEXED BY <zIndex>" clause */
18694 /* Allowed return values from sqlite3WhereIsDistinct()
18728 Upsert *pUpsert; /* ON CONFLICT clause information from an upsert */
18766 #define NC_FromDDL 0x040000 /* SQL text comes from sqlite_schema */
18787 ExprList *pUpsertSet; /* The SET clause from an ON CONFLICT UPDATE */
18796 ** information from the INSERT processing down into the UPDATE processing
18865 #define SF_Values 0x0000200 /* Synthesized from VALUES clause */
18896 ** SRT_Except Remove results from the temporary index pDest->iSDParm.
18958 #define SRT_Except 2 /* Remove result from a UNION index */
19031 Trigger *pTrigger; /* Trigger this program was coded from */
19060 ** the value of the expression can simply be read from the index, then
19065 ** is read from the index rather than being recomputed.
19110 int rc; /* Return code from execution */
19358 ** zTarget -> Dequoted name of the table to delete from.
19429 ** from sqlite3Init and OP_ParseSchema into the sqlite3InitCallback.
19624 ** Return code from the parse-tree walking primitives and their
19901 ** obtain space from malloc().
20847 ** Allowed return values from sqlite3FindInIndex()
22349 ** from the comments following the "case OP_xxxx:" statements in
22501 u32 *aAltMap; /* Mapping from table to index column numbers */
22519 VdbeCursor *pAltCursor; /* Associated index cursor from which to read */
22561 ** these values are copied back to the Vdbe from the VdbeFrame structure,
22582 i64 *anExec; /* Event counters from parent frame */
22703 #define MEM_FromBind 0x0040 /* Value originates from sqlite3_bind() */
22705 #define MEM_Cleared 0x0100 /* NULL set by OP_Null, not from data */
22726 ** Clear any existing type flags from a Mem and replace them with f
22921 VdbeCursor *pCsr; /* Cursor to read old values from */
23749 ** Convert from YYYY-MM-DD HH:MM:SS to julian day. We always assume
23920 ** Compute the Year, Month, and Day from the julian day number.
23949 ** Compute the Hour, Minute, and Seconds from the julian day number.
24906 ** from within OsOpen()), but some third-party implementations may.
25247 ** Unlink a VFS from the linked list
25620 ** Like free() but works for allocations obtained from sqlite3MemMalloc()
25639 ** Report the allocated size of a prior return from xMalloc()
25656 ** Like realloc(). Resize an allocation previously obtained from
25809 ** to back up from the allocation pointer to find the MemBlockHdr. The
26249 fprintf(out, "**** %lld bytes at %p from %s ****\n",
26307 ** before calling sqlite3_initialize() from which allocations
26434 ** Unlink the chunk at mem3.aPool[i] from list it is currently
26454 ** Unlink the chunk at index i from
26997 ** before calling sqlite3_initialize() from which allocations
27013 ** 3. New memory is allocated from the first available free block.
27126 ** Unlink the chunk at mem5.aPool[i] from list it is currently
27259 ** or retains a value from a previous allocation */
27349 ** The outer layer memory allocator prevents this routine from
27362 ** The outer layer memory allocator prevents this routine from
27365 ** nBytes is always a value obtained from a prior call to
27437 ** to prevent multiple threads from entering at the same time.
28411 ** separate processes cannot read different values from the same
28454 ** separate processes cannot read different values from the same
28960 ** first doing some #defines that prevent SQLite from building on Win98.
29373 ** TRUE if p is a lookaside memory allocation from db
29384 ** Return the size of a memory allocation previously obtained from
29432 ** Free memory previously obtained from sqlite3Malloc().
29798 ** Make a copy of a string in memory obtained from sqliteMalloc(). These
29941 ** The "printf" code that follows dates from the 1980's. It is in
29947 ** routines format strings much like the printf() from the standard C
30095 ** Extra argument values from a PrintfArguments object
30116 ** SQL from requesting large allocations using the precision or width
30190 /* pAccum never starts out with an empty buffer that was obtained from
30759 ** characters if the ! flags is present) to use from the input.
30987 ** Append N bytes of text from z to the StrAccum object. Increase the
31146 ** Print into memory obtained from sqliteMalloc(). Use the internal
31166 ** Print into memory obtained from sqliteMalloc(). Use the internal
31179 ** Print into memory obtained from sqlite3_malloc(). Omit the internal
31203 ** Print into memory obtained from sqlite3_malloc()(). Omit the internal
31225 ** from the snprintf() standard. Unfortunately, it is too late to change
31257 ** We house it in a separate routine from sqlite3_log() to avoid using
32591 ** parameters. These variants are intended to be used from a symbolic
33208 const unsigned char **pz /* Pointer to string from which to read char */
33269 ** differently from the others.
33293 /* When converting from UTF-16, the maximum growth results from
33301 /* When converting from UTF-8 to UTF-16 the maximum growth is caused
33313 ** from sqlite3_malloc().
33525 ** Memory to hold the UTF-8 string is obtained from sqlite3_malloc and must
33569 ** This routine is called from the TCL test function "translate_selftest".
33639 ** should have a unique code. To prevent legacy testing applications from
33840 ** brackets from around identifiers. For example: "[a-b-c]" becomes
33895 ** Generate a Token object from a string
34102 /* copy digits from after decimal to significand
34345 ** from clang and -fsanitize=undefined. This test and assignment make
34346 ** the code a little larger and slower, and no harm comes from omitting
34434 ** This is different from sqlite3Atoi64() which requires the
34493 ** Return a 32-bit integer value extracted from a string. If the
34600 ** Read a 64-bit variable-length integer from memory starting at p[0].
34634 /* CSE1 from below */
34713 /* CSE2 from below */
34754 ** Read a 32-bit variable-length integer from memory starting at p[0].
34953 ** binary value has been obtained from malloc and must be freed by
35348 /* Remove all entries from a hash table. Reclaim all memory.
35496 /* Remove a single entry from the hash table given a pointer to that
35501 HashElem* elem, /* The element to be removed from the pH */
35552 ** element corresponding to "key" is removed from the hash table.
36009 /* Delete a key (with its corresponding data) from the key/value
36021 /* Read the value associated with a zKey from the key/value namespace given
36295 ** Read from the -journal file.
36327 ** Read from the database file.
36996 int lastErrno; /* The unix errno from last I/O error */
37015 unsigned fsFlags; /* cached details from statfs() */
37045 /* This variable holds the process id (pid) from when the xRandomness()
37046 ** method was called. If xOpen() is called from a different process id,
37054 #define UNIXFILE_EXCL 0x01 /* Connections from one process only */
37073 ** Define various macros that are missing from some systems.
37370 ** log if they come from non-root processes. So avoid calling fchown() if
37573 ** Helper function for printing out trace information from debugging
37862 ** But not so. Since both locks came from the same process, the
38030 ** errno and, if possible, the human-readable equivalent from strerror() or
38046 char *zErr; /* Message from strerror() or equivalent */
38102 ** So we don't even try to recover from an EINTR. Just log the error
38420 ** If the pFile was opened read/write from unix-excl, then the only lock
38472 ** transitions leaving the lock state different from what it started but
38502 ** single randomly selected by from the 'shared byte range' is locked.
38548 ** (1) We never move from unlocked to anything higher than shared lock.
38678 ** transitioning from a SHARED to a RESERVED lock. The change
38679 ** from SHARED to RESERVED marks the beginning of a normal
38784 int tErrno; /* Error code from system call errors */
39036 ** connections from reading or writing the database.
39091 ** transitions leaving the lock state different from what it started but
39308 ** transitions leaving the lock state different from what it started but
39320 ** above are really EXCLUSIVE locks and exclude all other processes from
39485 ** transitions leaving the lock state different from what it started but
39497 ** above are really EXCLUSIVE locks and exclude all other processes from
39735 ** transitions leaving the lock state different from what it started but
39770 ** (1) We never move from unlocked to anything higher than shared lock.
40109 ** be necessary to define _XOPEN_SOURCE to be 500. This varies from
40162 ** Read data from a file into a buffer. Return SQLITE_OK if all
40189 ** data from the memory mapping using memcpy(). */
40243 ** absolute offset iOff, then attempt to write nBuf bytes of data from
40251 const void *pBuf, /* Copy data from this buffer to the file */
40300 ** Write data from a buffer into a file. Return SQLITE_OK on success
40347 ** data from the memory mapping using memcpy(). */
40601 /* Unix cannot, but some systems may return SQLITE_FULL from here. This
40664 ** when restoring a database using the backup API from a zero-length
40675 ** use read() and write() to access data beyond this point from now on.
41053 /* full bitset of atomics from max sector size and smaller */
41061 /* full bitset of atomics from max sector size and smaller */
41252 ** Apply posix advisory locks for all bytes from ofst through ofst+n-1.
41456 ** from the database file is used, then differing access permissions
41582 ** the cover of the unixEnterMutex() mutex and the pointer from the
41605 ** are numbered starting from zero. Each shared-memory region is szRegion
41792 ** different here than in posix. In xShmLock(), one can go from unlocked
41793 ** to shared and back or from unlocked to exclusive and back. But one may
41794 ** not go from shared to exclusive or from exclusive to shared.
41980 /* Remove connection p from the set of connections associated
42250 ** strategy from that.
42262 ** from be cast into a function pointer.
42818 ** vxworks would not benefit from the change (it might, we're not sure),
42919 ** the path to the associated database file from zPath. This block handles
42951 ** its value as a filename and try to copy the mode, uid and gid from
43583 /* We have to initialize zBuf to prevent valgrind from reporting
43622 ** requested from the underlying operating system, a number which
43794 ** actual proxy file name is generated from the name and path of the
43984 ** Create a new VFS file descriptor (stored in memory obtained from
44466 ** from the conch file or the path was allocated on the stack
44518 ** Store the conch filename in memory obtained from sqlite3_malloc64().
44817 ** transitions leaving the lock state different from what it started but
44927 ** should be the only routines in this file that are visible from other
44940 ** silly C90 rules prohibit a void* from being cast to a function pointer
45106 # error "WAL mode requires support from the Windows NT kernel, compile\
45111 # error "Memory mapped files require support from the Windows NT kernel,\
45343 DWORD lastErrno; /* The Windows errno from the last I/O error */
46377 ** being held by us, no other function (i.e. from another thread) should
46747 ** Space to hold the returned string is obtained from sqlite3_malloc().
46773 ** Space to hold the returned string is obtained from sqlite3_malloc().
46800 ** Space to hold the returned string is obtained from sqlite3_malloc().
46829 ** Space to hold the returned string is obtained from sqlite3_malloc().
46856 ** Space to hold the returned string is obtained from sqlite3_malloc().
46874 ** Space to hold the returned string is obtained from sqlite3_malloc().
47149 ** error code and, if possible, the human-readable equivalent from
47340 /* Replace the backslashes from the filename and lowercase it
47789 ** Read data from a file into a buffer. Return SQLITE_OK if all
47794 sqlite3_file *id, /* File to read from */
47803 DWORD nRead; /* Number of bytes actually read from file */
47816 ** data from the memory mapping using memcpy(). */
47870 ** Write data from a buffer into a file. Return SQLITE_OK on success
47894 ** data from the memory mapping using memcpy(). */
47991 ** the file, and that might delete memory out from under existing cursors.
48095 /* Unix cannot, but some systems may return SQLITE_FULL from here. This
48301 ** transitions leaving the lock state different from what it started but
48317 int rc = SQLITE_OK; /* Return code from subroutines */
48802 winFile hFile; /* File handle from winOpen */
48810 HANDLE hMap; /* File handle from CreateFileMapping */
48813 DWORD lastErrno; /* The Windows errno from the last I/O error */
49077 ** the cover of the winShmEnterMutex() mutex and the pointer from the
49117 /* Remove connection p from the set of connections associated
49269 ** are numbered starting from zero. Each shared-memory region is szRegion
49740 ** Convert a filename from whatever the underlying operating system
49742 ** obtained from malloc and must be freed by the calling function.
49762 ** is obtained from malloc and must be freed by the calling
50247 /* Reports from the internet are that performance is always
50614 ** non-zero is returned from this function, the calling function must simply
50667 ** alphabetic character, discard the initial "/" from the pathname.
51521 ** Read data from an memdb-file.
52510 ** There are 6 opcodes numbered from 0 through 5. 0 is the
52518 ** 5 N S X Set N bits from S increment X in array only, not in bitvec
52521 ** on both a Bitvec object and on a linear array of bits obtained from malloc.
52642 ** page to eject from the cache mid-transaction. It is better to eject
52781 #define PCACHE_DIRTYLIST_REMOVE 1 /* Remove pPage from dirty list */
52788 ** remove pPage from the dirty list. The 0x02 means add pPage back to
52817 ** searching for a dirty page to eject from the cache when it might
52976 ** Try to obtain a page from the cache.
53000 PCache *pCache, /* Obtain the page from this cache */
53042 PCache *pCache, /* Obtain the page from this cache */
53098 PCache *pCache, /* Obtain the page from this cache */
53124 PCache *pCache, /* Obtain the page from this cache */
53170 ** Drop a page from the cache. There must be exactly one reference to the
53234 ** Clear the PGHDR_NEED_SYNC and PGHDR_WRITEABLE flag from all dirty pages.
53246 ** Clear the PGHDR_NEED_SYNC flag from all dirty pages.
53485 ** Free up as much memory as possible from the page cache.
53578 ** allocation from the PgHdr1. This was intended to avoid clownshoe memory
53592 ** Memory for a page might come from any of three sources:
53654 u16 isBulkLocal; /* This page from bulk local storage */
53684 ** unused pages from other PCaches) but it also operates without a mutex,
53806 ** This routine is called from sqlite3_initialize() and so it is guaranteed
53870 ** Malloc function used within this file to allocate space from the buffer
53896 ** it from sqlite3Malloc instead.
53914 ** Free an allocated buffer obtained from pcache1Alloc().
54021 ** Malloc function used by SQLite to obtain space from the buffer configured
54031 ** Free an allocated buffer obtained from sqlite3PageMalloc().
54106 ** This function is used internally to remove the page pPage from the
54131 ** Remove the page supplied as an argument from the hash table
54174 ** Discard all pages from cache pCache with a page number (key value)
54525 ** then attempt to recycle a page from the LRU list. If it is the right
54852 ** extracts the least value from the RowSet.
54965 ** Deallocate all chunks from a RowSet. This frees all memory that
54985 ** Deallocate all chunks from a RowSet. This frees all memory that
55006 ** is more efficient to pull a preallocated entry from the pool */
55147 ** node taken from the head of *ppList. A depth of 2 means a tree with
55150 ** Use as many entries from the input list as required and update the
55213 ** Extract the smallest element from the RowSet.
55338 ** is separate from the database file. The pager also implements file
55339 ** locking to prevent two processes from writing the same database
55340 ** file simultaneously, or one process from reading the database while
55420 /* Read a page from the write-ahead log, if it is present. */
55445 /* Copy pages from the log to the database file */
55547 ** (4) Reads from the database file are either aligned on a page boundary and
55548 ** an integer multiple of the page size in length or are taken from the
55575 ** of bytes from 24 through 39 inclusive will be changed prior to releasing
55675 ** a locking_mode=exclusive connection can transition from READER to OPEN
55689 ** The pager moves to this state from READER when a write-transaction
55718 ** A pager moves from WRITER_LOCKED state to this state when a page is
55731 ** The pager transitions from WRITER_CACHEMOD into WRITER_DBMOD state
55747 ** A rollback-mode pager changes to WRITER_FINISHED state from WRITER_DBMOD
55785 ** is reloaded from disk (and, if necessary, hot-journal rollback peformed)
55788 ** from the error.
55861 ** from ERROR to OPEN state. At this point there may be a hot-journal file
55873 ** transaction in another process, causing SQLite to read from the database
56009 ** journal file from being successfully finalized, the setSuper flag
56019 ** writing to the database from pagerStress() is disabled altogether.
56022 ** to allocate a new page to prevent the journal file from being written
56026 ** If the SPILLFLAG_NOSYNC bit is set, writing to the database from
56030 ** from happening in between the journalling of two pages on the same sector.
56222 SQLITE_API int sqlite3_pager_readdb_count = 0; /* Number of full pages read from DB */
56234 ** was obtained from /dev/random. It is used only as a sanity check.
56251 ** garbage data came from an obsolete journal file, the checksums might
56309 ** Return true if page pgno can be read directly from the database file
56434 ** a rollback transaction that switches from journal_mode=off
56549 ** content from the pager.
56603 ** Read a 32-bit integer from the given file descriptor. Store the integer
56786 ** This function attempts to read a super-journal file name from the
56806 ** If an error occurs while reading from the journal file, an SQLite
56813 u32 cksum; /* MJ checksum value read from journal */
57016 ** the memory prevents valgrind from complaining, so we are willing to
57051 ** (JOURNAL_HDR_SZ bytes) is read from the current location in the journal
57059 ** is set to the value read from the journal header. SQLITE_OK is returned
57064 ** cannot be read from the journal file an error code is returned.
57070 u32 *pNRec, /* OUT: Value read from the nRec field */
57134 /* Check that the values read from the page-size and sector-size fields
57151 /* Update the page-size to match the value read from the journal.
57161 ** is being called from within pager_playback(). The local value
57350 ** out from under us.
57374 /* The pager state may be changed from PAGER_ERROR to PAGER_OPEN here
57520 int rc = SQLITE_OK; /* Error code from journal finalization operation */
57521 int rc2 = SQLITE_OK; /* Error code from db file unlock operation */
57740 ** Read a single page from either the journal file (if isMainJrnl==1) or
57741 ** from the sub-journal (if isMainJrnl==0) and playback that page.
57748 ** If the page number of the page record read from the (sub-)journal file
57758 ** If the page record is successfully read from the (sub-)journal file
57760 ** while reading the record from the (sub-)journal file or while writing
57762 ** is successfully read from the (sub-)journal file but appears to be
57767 ** * If the record is being rolled back from the main journal file
57809 ** only reads from the main journal, not the sub-journal.
57816 /* Read the page number and page data from the journal or sub-journal
57877 ** different from the page content at the start of the transaction.
57918 /* Write the data read from the journal back into the database file.
57921 ** is if the data was just read from an in-memory sub-journal. In that
57950 ** will be read from the database file, which may or may not be
57959 ** the data just read from the sub-journal. Mark the page as dirty
57995 /* Decode the page just read from disk */
58034 ** no such child journal can be found, file zSuper is deleted from
58073 /* Load the entire super-journal file into space obtained from
58076 ** files extracted from regular rollback-journals.
58261 ** number of page records from the journal size.
58278 ** Call the value from the second bullet "nRec". nRec is the number of
58280 ** value of nRec from the size of the journal file. But if a power
58284 ** the value of nRec computed from the file size would be too large. For
58288 ** from the file size. This value is used when the user selects the
58319 int nPlayback = 0; /* Total number of pages restored from journal */
58331 /* Read the super-journal name from the journal, if it is present.
58359 /* Read the next journal header from the journal file. If there are
58401 /* If this is the first header read from the journal, truncate the
58504 sqlite3_log(SQLITE_NOTICE_RECOVER_ROLLBACK, "recovered %d pages from %s",
58524 ** the value read from the database file.
58618 ** references, the page content is reloaded from the database. If the
58619 ** attempt to reload content from the database is required and fails,
58666 ** + Reload page content from the database (if refcount>0).
58712 ** They will never be read by any client. So remove them from the pDirty
58781 ** This function is called as part of the transition from PAGER_OPEN
58795 ** available from the WAL sub-system if the log file is empty or
58804 /* If the number of pages in the database is not available from the
58890 ** * Pages are played back from the main journal starting at byte
58896 ** back starting from the journal header immediately following
58899 ** * Pages are then played back from the sub-journal file, starting
58908 ** If pSavepoint is NULL, then pages are only played back from the main
58951 /* Begin by rolling back records from the main journal starting at
58998 /* Finally, rollback pages from the sub-journal. Page that were
59065 ** Free as much memory as possible from the pager.
59205 ** SQLITE_BUSY when trying to upgrade from no-lock to a SHARED lock,
59206 ** or when trying to upgrade from a RESERVED lock to an EXCLUSIVE
59207 ** lock. It does *not* invoke the busy handler when upgrading from
59208 ** SHARED to RESERVED, or when upgrading from SHARED to EXCLUSIVE
59270 ** function may be called from within PagerOpen(), before the state
59383 ** Read the first N bytes from the beginning of the file into memory
59392 ** If any IO error apart from SQLITE_IOERR_SHORT_READ is encountered,
59475 ** dirty page were to be discarded from the cache via the pagerStress()
59561 ** The new object will use the pointer pData, obtained from xFetch().
59635 /* Verify that the database file has not be deleted or renamed out from
59638 ** code from sqlite3OsAccess()) if the database has gone missing.
59821 ** byte to the start of it to prevent it from being recognized.
60626 ** This function is called after transitioning from PAGER_UNLOCK to
60638 ** exists, that is probably an old journal left over from a prior
60693 ** journal is a remnant from a prior database with the same name where
60779 /* This routine is only called from b-tree and only when there are no
60915 ** flush the cache. The hasHeldSharedLock flag prevents this from
61014 ** read from the database file. In some cases, the pcache module may
61032 ** a) When reading a free-list leaf page from the database, and
61036 ** from the savepoint journal.
61039 ** of being read from the database. Additionally, the bits corresponding
61167 u32 iFrame = 0; /* Frame to read from WAL file */
61259 ** not read the page from disk. Return a pointer to the page,
61475 ** transactions may copy data from the sub-journal into the database
62264 ** current transaction are either expelled from the cache or reverted to
62265 ** their pre-transaction state by re-reading data from the database or
62709 ** the page we are moving from.
62760 ** from its hash chain. Also, if the PGHDR_NEED_SYNC flag was set for
62774 /* Do not discard pages from an in-memory database since we might
62910 /* This routine is only called from the OP_JournalMode opcode, and
62932 /* When transistioning from TRUNCATE or PERSIST to any other journal
63194 ** to switching from WAL to rollback mode.
63280 ** read transaction is opened, attempt to read from the snapshot it
63380 ** Each frame records the revised content of a single page from the
63390 ** frames can overwrite the old ones. A WAL always grows from beginning
63393 ** are leftovers from prior checkpoints.
63415 ** 8: Salt-1 (copied from the header)
63416 ** 12: Salt-2 (copied from the header)
63440 ** for i from 0 to n-1 step 2:
63457 ** value is randomized. This prevents old and new frames in the WAL from
63463 ** To read a page from the database (call it page number P), a reader
63468 ** frame or are followed by a commit frame, then page P is read from
63476 ** of the database from a single point in time. This technique allows
63501 ** be) reconstructed from the original WAL file. In fact, the VFS is required
63609 ** from the hash table at this point.
63692 u32 aSalt[2]; /* Two salt values copied from WAL header */
63702 ** back into the database. (We call the act of moving content from WAL to
63706 ** However, a WAL_WRITE_LOCK thread can move the value of nBackfill from
63726 ** directly from the database.
63733 ** The checkpointer may only transfer frames from WAL to database where
63742 ** get all their all content directly from the database file and ignore
63753 ** order to read from any aReadMark[] entries.
63832 ** from the region of the file on which locks are applied.
63889 u32 iReCksum; /* On commit, recalculate checksums from here */
63939 u32 iPrior; /* Last result returned from the iterator */
63977 ** numbered from zero.
64014 /* Request a pointer to the required page from the VFS */
64070 ** architecture, it returns the u32 value that results from interpreting
64130 ** from multiple threads and/or processes, then do a memory barrier.
64178 ** 8: Salt-1 (copied from the wal-header)
64179 ** 12: Salt-2 (copied from the wal-header)
64344 ** from walHashGet().
64356 ** numbered starting from 0.
64395 ** are numbered starting from 0.
64421 ** Remove entries from the hash table that point to WAL slots greater
64523 ** Remove the remnants of that writers uncommitted transaction from
64577 ** wal-index to prevent other threads/processes from doing anything
64621 u32 magic; /* Magic value read from WAL header */
64622 u32 version; /* Magic value read from WAL header */
64680 /* Read all frames from the log file. */
64696 u32 nTruncate; /* dbsize field from frame header */
64784 /* If more than one frame was recovered from the log file, report an
64791 "recovered %d frames from WAL file %s",
64826 ** client from unlinking the WAL or wal-index file. If another process
64883 ** For that matter, if the lock offset ever changes from its initial design
65337 ** c) any existing readers are reading exclusively from the database
65338 ** file - there are no readers that may attempt to read a frame from
65347 ** one obtained from sqlite3_randomness()).
65368 ** Copy as much content as we can from the WAL back into the database file
65371 ** The amount of information copies from WAL to database might be limited
65430 ** cannot be backfilled from the WAL.
65677 ** If and only if the read is consistent and the header is different from
65695 ** from the file. If this happens, return non-zero.
65700 ** Memory barriers are used to prevent the compiler or the hardware from
65743 ** Read the wal-index header from the wal-index and into pWal->hdr.
65745 ** wal-index from the WAL before returning.
65784 ** is zero, which prevents the SHM from growing */
65841 ** writer truncated the WAL out from under it. If that happens, it
65873 ** the caller should retry opening the read transaction from the
65894 ** writers from running a checkpoint, but does not stop them
65895 ** from running recovery. */
65939 ** from under us, then disconnected, while we were not looking.
65992 u32 nTruncate; /* dbsize field from frame header */
66062 ** completely and get all content directly from the database file.
66176 ** snapshot. Since holding READ_LOCK(0) prevents a checkpoint from
66196 ** the WAL to get at content from recent commits. The job now is
66258 ** to read any frames earlier than minFrame from the wal file - they
66259 ** can be safely read directly from the database file.
66271 ** that it can read version A from the database file. However, since
66293 ** through all wal frames from nBackfillAttempted to (nBackfill+1),
66461 ** from the start of the wal file. This is because, for a system
66509 u32 iRead = 0; /* If !=0, WAL frame to return data from */
66514 /* This routine is only be called from within a read transaction. */
66518 ** no data will be read from the wal under any circumstances. Return early
66534 ** table). This means the value just read from the hash
66604 ** Read the contents of frame iRead from the wal file into buffer pOut
66737 ** (if (a) is false) or simply expels the page from the cache (if (b)
66854 ** the next fsync should occur - passed from sqlite3WalFrames() into
66904 int rc; /* Result code from subfunctions */
66935 u8 *aBuf; /* Buffer to load data from wal file into */
66937 u32 iRead; /* Next frame to read from wal file */
66945 ** transaction restarted the wal file), these values must be read from the
66946 ** wal-file header. Otherwise, read them from the frame header of the
67220 ** we can from WAL into the database.
67303 /* Copy data from the log to the database file. */
67369 ** If op is zero, then attempt to change from locking_mode=EXCLUSIVE
67377 ** If op is one, then change from locking_mode=NORMAL into
67598 ** Finding a particular key requires reading O(log(M)) pages from the
67710 ** offsets from the beginning of the page to the cell content in the cell
67830 ** is derived from the raw on-disk page content.
67874 ** Locks are added (or upgraded from READ_LOCK to WRITE_LOCK) when a cursor
67876 ** from this list when a transaction is committed or rolled back, or when
67921 Btree *pNext; /* List of other sharable Btrees from the same db */
68044 ** based on information extract from the raw disk page.
68199 ** The purpose of the pointer map is to facility moving pages from one
68441 ** This routine is used only from within assert() statements.
68459 ** reset out from under us.
68531 ** If pSchema is not NULL, then iDb is computed from pSchema and
68630 ** Extract a 2-byte big-endian integer from an array of unsigned bytes.
68634 ** from the header of a btree page. If the page size is 65536 and the page
69195 ** 1) When all data is deleted from a page and the page becomes
69202 ** from the database or written to the journal file (why should it
69210 ** is extracted from the free-list and reused, then the original data
69216 ** set in the bitvec. Whenever a leaf page is extracted from the free-list,
69239 ** This function is called when a free-list leaf page is removed from the
69241 ** page from the pager layer with the 'no-content' flag set. True otherwise.
69391 ** broken out from its caller to avoid unnecessary stack pointer movement.
69498 ** Determine whether or not a cursor has moved from the position where
69501 ** from under them, for example. Cursor might also move if a btree
69531 ** a row having been deleted out from under the cursor).
69539 ** TRUE from sqlite3BtreeCursorHasMoved().
69618 int rc; /* Return code from subfunctions */
69666 ** Read an entry from the pointer map.
70108 ** EVIDENCE-OF: R-44582-60138 SQLite may from time to time reorganize a
70236 ** from the free-list.
70272 /* Remove the slot from the free-list. Update the number of
70307 ** Allocate nByte bytes of space from within the B-Tree page passed
70391 /* Allocate memory from the gap in between the cell pointer array
70812 ** Convert a DbPage obtained from the pager into a MemPage used by
70829 ** Get a page from the pager. Initialize the MemPage.pBt and
70857 ** Retrieve a page from the pager cache. If the requested page is not
70884 ** Get a page from the pager and initialize it.
71081 int rc = SQLITE_OK; /* Result code from this function */
71240 ** determined by the 2-byte integer located at an offset of 16 bytes from
71364 ** remove the BtShared structure from the sharing list. Return
71426 ** bytes of pTmpSpace, but that the first 4 bytes are copied from
71813 int rc; /* Result code from subfunctions */
71899 ** determined by the 2-byte integer located at an offset of 16 bytes from
72196 /* If transitioning from no transaction directly to a write transaction,
72269 ** re-read the database size from page 1 if a savepoint or transaction
72435 /* Move page iDbPage from its current location to page number iFreePage */
72536 /* Remove the page from the files free-list. This is not required
72809 ** This function is called from both BtreeCommitPhaseTwo() and BtreeRollback()
72823 ** may still be reading from the database. */
72933 ** pages may be moved or deleted from the database altogether, making
73087 ** from a normal transaction rollback, as no locks are released and the
73520 ** Copy data from a buffer to a page, or from a page to a buffer.
73524 ** from pPayload to the buffer pointed at by pBuf. If eOp is true,
73526 ** of data are copied from the buffer pBuf to pPayload.
73534 int eOp, /* 0 -> copy from page, 1 -> copy to page */
73538 /* Copy data from buffer to page (a write operation) */
73545 /* Copy data from page to buffer (a read operation) */
73560 ** Data is read to or from the buffer pBuf.
73581 BtCursor *pCur, /* Cursor pointing to entry to read from */
73618 /* Check if data must be read/written to/from the btree page itself. */
73711 ** 2) data is required from the start of this overflow page, and
73717 ** then data can be read directly from the database file into the
73822 ** Return a pointer to payload information from the entry that the
73841 BtCursor *pCur, /* Cursor pointing to entry to read from */
73872 ** including calls from other threads against the same cache.
73937 ** to the page we are coming from. If we are coming from the
74858 ** Allocate a new page from the database file.
75054 /* Extract a leaf from the trunk */
75124 ** Normally, new pages allocated by this block can be requested from the
75126 ** from trying to read the pages content from disk. However, if the
75153 TRACE(("ALLOCATE: %d from end of file (pointer-map page)\n", pBt->nPage));
75176 TRACE(("ALLOCATE: %d from end of file\n", *pPgno));
75459 ** buffer space that is separate from the pPage buffer area */
75584 ** wrong pages from the database.
75622 ** Remove the i-th cell from pPage. This routine effects pPage only.
75625 ** removes the reference to the cell from pPage.
75694 int *pRC /* Read and write return code from here */
75803 ** The cells in this array are the divider cell or cells from the pParent
75817 ** The cells come from as many as four different pages:
75830 ** 1. All cells from Child-1 in order
75831 ** 2. The first divider cell from Parent
75832 ** 3. All cells from Child-2 in order
75833 ** 4. The second divider cell from Parent
75834 ** 5. All cells from Child-3 in order
75929 int i = iFirst; /* Which cell to copy from pCArray*/
76155 /* Remove cells from the start and end of the page */
76232 /* Unable to edit this page. Rebuild it from scratch instead. */
76307 ** with entries for the new page, and any pointer from the
76332 ** field. The second while(...) loop copies the key value from the
76432 /* Copy the b-tree node content from page pFrom to page pTo. */
76463 ** page are used in the balancing, though both siblings might come from one
76478 ** inserted into or removed from the parent page (pParent). Doing so
76542 ** is called (indirectly) from sqlite3BtreeDelete().
76554 ** either side of pPage. More siblings are taken from one side, however,
76558 ** This loop also drops the divider cells from the parent page. This
76612 /* Drop the cell from the parent page. apDiv[i] still points to
76664 ** into space obtained from aSpace1[]. The divider cells have already
76665 ** been removed from pParent.
76668 ** divider cells are stripped from the cells before they are copied
76780 ** in b.apCell[] of the cell that divides page i from page i+1.
76952 ** helps the operating system to deliver pages from the disk more rapidly.
77135 ** is important, as this code needs to avoid disrupting any page from which
77138 ** (1) If cells are moving left (from apNew[iPg] to apNew[iPg-1])
77142 ** (2) If cells are moving right (from apNew[iPg] to apNew[iPg+1])
77151 ** needs to be tested because (2) will always be true from the previous
77292 int rc; /* Return value from subprocedures */
77323 /* Copy the overflow cells from pRoot to pChild */
77346 ** rebalance, that can change content out from under the cursor on the
77503 /* Overwrite content from pX into pDest. Only do the write if the
77504 ** content is different from what is already there.
77903 ** from trying to save the current position of the cursor. */
77928 ** This function is used as part of copying the current row from cursor
78060 MemPage *pPage; /* Page to delete cell from */
78131 ** from the internal node. The 'previous' entry is used for this instead
78148 /* If this is a delete operation to remove a row from a table b-tree,
78156 ** itself from within the page. */
78165 ** by the child-page of the cell that was just deleted from an internal
78166 ** node. The cell from the leaf node needs to be moved to the internal
78203 ** pCur is pointing to the leaf page from which a cell was removed to
78204 ** replace the cell deleted from the internal node. This is slightly
78294 /* Read the value of meta[3] from the database to determine where the
78479 ** Delete all information from a single table in the database. iTable is
78512 ** Delete all information from the single table that pCur is open on.
78649 ** from the pager. The BTREE_DATA_VERSION value is not actually stored in the
78652 ** read it from this routine.
78974 ** removes the root element from the heap (the minimum value in the heap)
79035 int rc; /* Result code from subroutine call */
79078 assert( rc==SQLITE_CORRUPT ); /* The only possible error from InitPage */
79243 ** The loop below pulls entries from the min-heap in order and compares
79293 ** allocation errors, an error message held in memory obtained from
79697 ** only used from within assert() statements
79879 ** Create an sqlite3_backup process to copy the contents of zSrcDb from
79889 sqlite3* pSrcDb, /* Database connection to read from */
79969 ** page iSrcPg from the source database. Copy this data into the
80039 /* Copy the data from the source page into the destination page.
80089 ** Copy nPage pages from the source b-tree to the destination.
80262 ** occurs, the original database will be reconstructed from the
80359 /* Detach this backup from the source pager. */
80511 ** from this function, not directly by the user.
80689 ** derived from the numeric value, not the other way around, to ensure
80696 ** been derived from the numeric and not the other way around. It returns
81287 ** This function assumes that i was obtained by assignment from r1.
81302 ** from UBSAN.
81346 ** "aff". Casting is different from applying affinity in that a cast
81782 ** The data is payload from the entry that pCur is currently pointing
81787 ** pMem->zMalloc to hold the content from the btree, if possible. New
81793 ** to read from the disk) then the pMem is left in an inconsistent state.
81797 u32 offset, /* Offset from the start of data to return bytes from. */
82093 ** Extract a value from the supplied expression in the manner described
82269 ** Attempt to extract a value from pExpr and use it to construct *ppVal.
82288 Expr *pExpr, /* The expression to extract a value from */
82333 ** record starting with field iVal (fields are numbered from left to
82341 ** from the expression (i.e. the expression is a literal value).
82358 ** error if a value cannot be extracted from pExpr. If an error does
82365 Expr *pExpr, /* The expression to extract a value from */
82397 ** Attempt to extract a value from expression pExpr using the methods
82408 Expr *pExpr, /* The expression to extract a value from */
82416 ** Extract the iCol-th column from the nRec-byte record in pRec. Write
82888 ** The eCallCtx argument is information (typically taken from Expr.op2)
83011 ** Add an OP_ParseSchema opcode. This routine is broken out from
83015 ** The zWhere string must have been obtained from sqlite3_malloc().
83092 ** be inserted. The parameter "x" must have been obtained from
83290 ** from failing. */
83362 ** cases from this switch! */
83528 ** fail due to a OOM fault and hence that the return value from
83910 ** This routine is useful when a large program is loaded from a
83915 ** the string is made into memory obtained from sqlite3_malloc().
84068 ** after an OOM fault without having to check to see if the return from
84496 ** information from the vdbe.c source text */
84567 ** sqlite3MemRelease() were called from here. With -O2, this jumps
84924 ** from the ReusableSpace object. Return a pointer to the allocated
85007 ** the Vdbe from the Parse object that helped generate it so that the
85091 ** This two-pass approach that reuses as much memory as possible from
85676 ** This routine is the only way to move the sqlite3eOpenState of a VM from
85714 int mrc; /* Primary error code from p->rc */
85949 ** virtual machine from VDBE_RUN_STATE or VDBE_HALT_STATE back to
85967 ** and error message from the VDBE into the main database structure. But
85999 /* Save profiling information from this VDBE run.
86065 ** from left to right), or
86095 ** VdbeDelete() also unlinks the Vdbe from the list of VMs associated with
86186 ** pointed to was deleted out from under it. Or maybe the btree was
86188 ** is supposed to be pointing. If the row was deleted out from under the
86204 ** if need be. Return any I/O error from the restore operation.
86378 ** GCC might have just copying the problem from a prior compiler.
86436 const unsigned char *buf, /* Buffer to deserialize from */
86471 const unsigned char *buf, /* Buffer to deserialize from */
86567 ** The space is either allocated using sqlite3DbMallocRaw() or from within
86571 ** allocation comes from the pSpace/szSpace buffer, *ppFree is set to NULL
86604 u32 idx; /* Offset in aKey[] to read from */
86632 ** warnings from MSAN. */
87048 ** key must be a parsed key such as obtained from
87506 ** pCur might be pointing to text obtained from a corrupt database file.
87717 ** Cause a function to throw an error if it was call from OP_PureFunc
87752 ** Transfer error message text from an sqlite3_vtab.zErrMsg (text stored
87753 ** in memory obtained from sqlite3_malloc) into a Vdbe.zErrMsg (text stored
87754 ** in memory obtained from sqlite3DbMalloc).
87795 ** the required value will be read from the row the cursor points to.
87799 VdbeCursor *pCsr, /* Cursor to grab old.* values from */
87984 ** back to its starting state so that it can be reused. A success code from
88033 ** The following routines extract information from a Mem or sqlite3_value
88192 /* Return true if a parameter value originated from an sqlite3_bind() */
88222 /* Destroy an sqlite3_value object previously obtained from
88254 /* The only errors possible from sqlite3VdbeMemSetStr are
88533 ** from interrupting a statement that has not yet started.
88636 /* There are only a limited number of result codes allowed from the
88660 int rc = SQLITE_OK; /* Result from sqlite3Step() */
88683 ** The error message from the SQL compiler has already been loaded
88685 ** from the database handle into the statement and sets the statement
88740 ** Extract the user data from a sqlite3_context structure and return a
88749 ** Extract the user data from a sqlite3_context structure and return a
88764 ** If this routine is invoked from within an xColumn method of a virtual
88769 ** If this routine is called from any context other than within the
88788 sqlite3_value **ppOut, /* Store the next value from the list here */
89012 ** Return the number of values available from the current row of the
89031 ** these assert()s from failing, when building with SQLITE_DEBUG defined
89088 ** Specifically, this is called from within:
89190 ** 2 The name of the database that the column derives from
89191 ** 3 The name of the table that the column derives from
89192 ** 4 The name of the table column that the result column derives from
89281 ** Return the name of the database from which a result column derives.
89295 ** Return the name of the table from which a result column derives.
89309 ** Return the name of the table column from which a result column derives.
89619 ** Transfer all bindings from the first statement over to the second.
89640 ** It is misuse to call this routine with statements from different
89767 ** obtained from sqlite3_malloc(). The caller is responsible for
89827 ** This function is called from within a pre-update callback to retrieve
89835 /* Test that this call is being made from within an SQLITE_DELETE or
89891 ** This function is called from within a pre-update callback to retrieve
89902 ** This function is designed to be called from within a pre-update callback
89920 ** This function is designed to be called from within a pre-update callback
89931 ** This function is called from within a pre-update callback to retrieve
90125 ** obtained from sqlite3DbMalloc(). If sqlite3.nVdbeExec is 1, then the
90288 ** in this file for details. If in doubt, do not deviate from existing
90300 ** be changed out from under the copy. This macro verifies that nothing
90430 ** iSrcLine is the source code line (from the __LINE__ macro) that
90456 /* Transform I from a integer [0,1,2] into a bitmask of [1,2,4] */
90530 ** The memory cell for cursor 0 is aMem[0]. The rest are allocated from
90902 ** This function is only called from within an assert() expression. It
90999 ** Compute a bloom filter hash using pOp->p4.i registers from aMem[] beginning
91232 ** Do not deviate from the formatting style currently in use.
91240 ** the one at index P2 from the beginning of
91245 ** that this Goto is the bottom of a loop and that the lines from P2 down
91318 ** register, then this accomplishes a return from a subroutine.
91331 ** formatter in the CLI will indent all opcodes from the P2 opcode up
91333 ** in the subroutine from which this opcode is returning. Thus the P2
91779 int p1; /* Register to copy from */
92079 ** Subtract the value in register P1 from the value in register P2
92337 ** This opcode is used when extracting information from a column that
92417 ** the SQLITE_NULLEQ flag were omitted from P5.
92984 ** from the value in that register.
93154 ** from this record. If there are less than (P2+1)
93183 u32 t; /* A type code from the record header */
93263 ** them, respectively. So the maximum header length results from a
93356 /* If after trying to extract new entries from the header, nHdrParsed is
93425 ** content from disk.
93427 ** Although sqlite3VdbeSerialGet() may read at most 8 bytes from the
93462 ** Take the affinities from the Table object in P4. If any value
93620 ** The mapping from character to affinity is given by the SQLITE_AFF_
93659 ** Data(0) is taken from register P1. Data(1) comes from register P1+1
93664 ** hdr-size field is also a varint which is the offset from the beginning
93701 /* NULLs can be safely trimmed from the end of the record, as long as
94165 ** VMs (apart from this one), then a ROLLBACK fails. A COMMIT fails if
94253 ** cookie in P3 differs from the schema cookie in the database header or
94254 ** if the schema generation counter in P4 differs from the current
94257 ** statement and rerun it from the beginning.
94332 /* If the schema-cookie from the database file matches the cookie
94334 ** not reload the schema from the database file.
94338 ** are queried from within xNext() and other v-table methods using
94342 ** to be invalidated whenever sqlite3_step() is called from within
94352 ** from being modified in sqlite3VdbeHalt(). If this statement is
94362 ** Read cookie number P3 from database P1 and write it into register P2.
94404 ** from the database schema version, resulting in a schema reset.
94584 /* The p2 value always comes from a prior OP_CreateBtree opcode and
94723 /* If the ephermeral table is already open and has no duplicates from
94827 ** row output from the sorter so that the row can be decomposed into
94907 ** from the beginning toward the end. In other words, the cursor is
94925 ** from the beginning toward the end. In other words, the cursor is
94943 ** from the end toward the beginning. In other words, the cursor is
94961 ** from the end toward the beginning. In other words, the cursor is
95220 ** Possible outcomes from this opcode:<ol>
95375 printf("seekHit changes from %d to %d\n", pC->seekHit, pOp->p2);
95382 printf("seekHit changes from %d to %d\n", pC->seekHit, pOp->p3);
95470 ** opcode. The opcode name comes from the fact that the
95942 /* Prevent post-update hook from running in cases when it should not */
95984 ** the current row from P2 into P1. If the cursors are opened on intkey
95993 VdbeCursor *pSrc; /* Cursor to read from */
96015 ** it is ok to delete a record from within a Next loop. If
96198 ** us from having to issue a separate NullRow instruction to clear that cache.
96388 ** from the end toward the beginning. In other words, the cursor is
96469 ** then rewinding that index and playing it back from beginning to
96494 ** from the beginning toward the end. In other words, the cursor is
96725 ** an unpacked index key. This opcode removes that entry from the
96783 ** is non-zero, then reading column a(i)-1 from cursor P3 is
96785 ** from P1. This information is stored in P3 and used to redirect
97055 ** remove the table or index from the database file.
97090 ** Delete all contents from the ephemeral table or sorter
97156 ** Read and parse all entries from the schema table of database P1
97253 ** is dropped from disk (using the Destroy opcode) in order to keep
97267 ** is dropped from disk (using the Destroy opcode)
97281 ** is dropped from disk (using the Destroy opcode) in order to keep
97371 ** Extract the smallest value from the RowSet object in P1
97389 /* A value was pulled from the index */
97585 ** try to reuse register values from the first use. */
97671 ** different from the current frame if this instruction is being executed
97701 ** If the value of register P1 is 1 or greater, subtract P3 from the
97816 ** The P5 arguments are taken from register P2 and its
97827 ** The P5 arguments are taken from register P2 and its
97838 ** The P5 arguments are taken from register P2 and its
97901 ** might change from one evaluation to the next. The next block of code
98099 "cannot change %s wal mode from within a transaction",
98116 /* Cannot transition directly from MEMORY to WAL. Use mode OFF
98287 ** Also, whether or not P4 is set, check that this is not being called from
98746 ** from register P2 and successors. The number of arguments is in
98765 ** from register P2 and successors. The number of arguments is in
98796 ** might change from one evaluation to the next. The next block of code
98843 ** Clear the subtype from register P1.
98890 ** answer. However, an incorrect answer may well arise from a
99062 ** Release registers from service. Any content that was in the
99115 ** This opcode records information from the optimizer. It is the
99708 ** Read data from a blob handle.
99852 ** directly from main memory.
99887 ** incrementally as keys are retreived from the sorter by the VDBE. The
99894 ** begins reading keys from that PMA while the background thread proceeds
99902 ** First, T bytes of data from the first SORTER_MAX_MERGE_COUNT PMAs on
99903 ** disk are merged together. Then T bytes of data from the second set, and
99912 ** the main thread to read from.
100036 PmaReader *aReadr; /* Array of PmaReaders to merge data from */
100098 PmaReader *pReader; /* Readr data from here after Rewind() */
100131 sqlite3_file *pFd; /* File handle we are reading from */
100151 ** size. When the IncrMerger is initialized, it reads enough data from
100153 ** corresponding PmaReader object to read from that file and kicks off
100155 ** sorted record data from pMerger.
100160 ** sets the PmaReader fields to read from the new aFile[0] and kicks off
100169 ** keys from pMerger by the calling thread whenever the PmaReader runs out
100174 MergeEngine *pMerger; /* Merge engine thread reads data from */
100254 ** Read the next nByte bytes of data from the PMA p.
100263 PmaReader *p, /* PmaReader from which to take the blob */
100267 int iBuf; /* Offset within buffer to read from */
100278 /* If there is no more data to be read from the buffer, read the next
100279 ** p->nBuffer bytes of data from the file into it. Or, if there are less
100283 int nRead; /* Bytes to read from disk */
100294 /* Readr data from the file. Return early if an error occurs. */
100335 u8 *aNext; /* Pointer to buffer to copy data from */
100353 ** Read a varint from the stream of data accessed by p. Set *pnOut to
100409 SorterFile *pFile, /* Sorter file to read from */
100502 SorterFile *pFile, /* Sorter file to read from */
100689 ** to determine the number of fields that should be compared from the
100827 ** from the main thread. That only occurs SQLITE_MAX_WORKER_THREADS>0 */
101433 ** vdbeSorterCompare() from decoding pReadr2 again.
101435 ** If the two values were equal, then the value from the oldest
101437 ** is sorted from oldest to newest, so pReadr1 contains older values
101490 ** the background thread from a sub-tasks previous turn is still running,
101651 ** Read keys from pIncr->pMerger and populate pIncr->aFile[1]. The format
101653 ** except that the number-of-bytes varint is omitted from the start.
101717 ** aFile[0] such that the PmaReader should start rereading it from the
101721 ** keys from pIncr->pMerger and repopulating aFile[0].
101765 ** Allocate and return a new IncrMerger object to read data from pMerger.
101839 assert( pTask->pUnpacked!=0 ); /* from vdbeSortSubtaskMain() */
101874 ** function returns, the first key of merged data may be read from the
101878 ** objects attached to the PmaReader objects that the merger reads from have
101880 ** set the PmaReader objects up to read from it. In this case all that is
101914 ** reading from the same temp file this makes for more linear file IO.
102014 ** first results are ready from this merger object anyway.
102074 ** PMAs from pTask->file. If no error occurs, set *ppOut to point to
102079 ** first PMA to read from pTask->file. Assuming no error occurs, it is
102085 SortSubtask *pTask, /* Sorter task to read from */
102136 ** tree, counting from zero. This function adds pLeaf to the tree.
102207 ** MergeEngine here. This MergeEngine will read data from exactly
102368 ** from the in-memory list. */
102667 ** Clear all internal content from a bytecodevtab cursor.
103032 sqlite3_int64 iOffset; /* Offset from the beginning of the file */
103055 ** Read data from the in-memory journal file. This is the implementation
103059 sqlite3_file *pJfd, /* The journal file from which to read */
103161 const void *zBuf, /* Take data to be written from here */
103465 ** The return value from the callback should be one of the WRC_*
103474 ** return from the top-level walk call.
103476 ** The return value from this routine is WRC_Abort to abandon the tree walk
103543 ** any expr callbacks and SELECT callbacks that come from subqueries.
103702 ** This needs to occur when copying a TK_AGG_FUNCTION node from an
103738 ** alias is removed from the original expression. The usual value is
103889 ** from pSrcList.
103901 ** means that the form of the name is Z and that columns from any table
103982 /* In this case, pItem is a subquery that has been formed from a
104106 ** maybe it is an excluded.* from an upsert. Or maybe it is
104382 /* Remove all substructure from pExpr */
104391 /* If a column from a table in pSrcList is referenced, then record
104420 /* Increment the nRef value on all name contexts from TopNC up to
104436 ** from datasource iSrc in SrcList pSrc.
104580 ** resolved. This prevents "column" from being counted as having been
104581 ** referenced, which might prevent a SELECT from being erroneously
105040 int rc; /* Return code from subprocedures */
105263 ** Remove any Window objects owned by the expression pExpr from the
105348 ** objects belonging to the expression from the Select.pWin list. */
105527 /* If this is a converted compound query, move the ORDER BY clause from
105641 ** set and the opcode is changed from TK_FUNCTION to TK_AGG_FUNCTION.
105856 ** SELECT * FROM t1 WHERE (select a from t1);
106391 Expr *pVector, /* Vector to extract element from */
106392 int iField, /* Field to extract from pVector */
106577 ** Also propagate EP_Propagate flags up from Expr.x.pList to Expr.flags,
106599 ** Also propagate all EP_Propagate flags from the Expr.x.pList into
106619 ** Propagate all EP_Propagate flags from the Expr.x.pList into
106636 ** obtained from sqlite3DbMalloc(). The calling function
106696 ** Allocate a new expression node from a zero-terminated token that has
106914 ** SQLITE_FUNC_DIRECT - Only usable from top-level SQL
106916 ** SQLITE_FUNC_UNSAFE - Usable if TRUSTED_SCHEMA or from
106953 ** the SQL statement comes from an external source.
107154 ** to reduce a pristine expression tree from the parser. The implementation
107207 ** descended from the Expr.x.pList or Expr.x.pSelect variables).
107230 u8 *zAlloc; /* Memory space from which to build Expr object */
107231 u32 staticFlag; /* EP_Static if space not obtained from malloc */
107459 ** If cursors, triggers, views and subqueries are all omitted from
107593 ** obtained from a prior call to sqlite3ExprListAppend(). This routine
107594 ** may not be used with an ExprList obtained from sqlite3ExprListDup().
107597 ** but is not necessarily true from the return value of sqlite3ExprListDup().
107994 /* If pWalker->eCode is 2 then any term of the expression that comes from
107996 ** from being considered constant. */
108052 /* A bound parameter in a CREATE statement that originates from
108132 ** (4a) pExpr must come from an ON clause..
108136 ** operand of a RIGHT JOIN, then pExpr must be from the WHERE
108218 ** isInit is true when parsing from sqlite_schema. isInit is false when
108497 ** an ephemeral table might need to be generated from the RHS and then
108558 int *aiMap, /* Mapping from Index fields to RHS fields */
108984 ** For each expression, build an index key from the evaluation and
109239 int *aiMap = 0; /* Map from vector field to index column */
109288 /* Code the LHS, the <expr> from "<expr> IN (...)". If the LHS is a
109294 ** aiMap[] array contains a mapping from the original LHS field order to
109643 ** Generate code that will extract the iColumn-th column from
109651 Table *pTab, /* Description of the table we are reading from */
109667 ** Generate code to move content from registers iFrom...iFrom+nReg-1
109854 ** If it is, then resolve the expression by reading from the index and
109877 ** cannot extract the value from the index. The value must be
110520 ** floating point when extracting it from the record. */
110534 ** that derive from the right-hand table of a LEFT JOIN. The
110560 ** really constant because they originate from the right-hand side
110846 ** The SQLITE_ECEL_DUP flag prevents the arguments from being
110854 ** in registers at srcReg, and so the value can be copied from there.
110856 ** are simply omitted rather than being copied from srcReg.
110967 /* Mark the expression is being from the ON or USING clause of a join
111499 ** always differs from a non-NULL pointer.
111762 ** Terms of p that are marked with EP_OuterON (and hence that come from
111763 ** the ON or USING clauses of OUTER JOINS) are excluded from the analysis.
111853 i64 nExclude; /* Number of tables to exclude from the search */
111854 int *aiExclude; /* Cursor IDs for tables to exclude from the search */
111863 ** When leaving the subquery, remove those entries from the exclude list.
112293 ** that might be invoked from other parts of the code, to ensure that
112304 ** iFirst..iLast, inclusive. This routine is only call from within assert()
112345 ** ALTER TABLE logic from the build.
112757 ** from less than 3 to 4, as that will corrupt any preexisting DESC
112901 (bDrop ? "drop column from" : "rename columns of"),
113231 ** Remove all nodes that are part of expression pExpr from the rename list.
113246 ** Remove all nodes that are part of expression-list pEList from the
113283 ** RenameToken object is found, remove it from the Parse object and add it to
113354 ** RenameToken in the RenameCtx and remove that RenameToken from the
113356 ** the input SQL is parsed from left to right. Repeated calls to this routine
113403 ** corresponding rename-token from Parse object pParse and add it
113429 ** from Parse object pParse and add it to the RenameCtx pCtx.
113458 int bTemp /* True if SQL is from temp schema */
113609 ** it was read from the schema of database zDb. Return SQLITE_OK if
113776 ** 8. bTemp: True if zSql comes from temp schema
113779 ** The iCol-th column (left-most is 0) of table zTable is renamed from zCol
113784 ** not reachable from ordinary SQL passed into sqlite3_prepare() unless the
114005 ** 6: True if the schema statement comes from the temp db.
114299 ** 4: True if object is from temp schema.
114665 ** must be separated from the last integer by a single space. If the
114692 ** S uniform buckets and the samples are the middle row from each bucket.
114716 ** binary encoding of a key from the index. The nEq column is a
115114 ** the anEq[] array from pSample->anEq[pSample->iCol+1] onwards are valid.
115138 ** the anEq[] array from pSample->anEq[pSample->iCol] onwards are valid.
115161 ** remove the least desirable sample from p->a[] to make room.
115258 /* Check if any samples from the aBest[] array should be pushed
115293 ** C Index of left-most column to differ from previous row
115298 ** samples from the index being analyzed into the StatAccum object.
115590 int jZeroRows = -1; /* Jump from here if number of rows is zero */
116055 ** Used to pass information from the analyzer reader through to the
116303 ** Load the content from either the sqlite_stat4
116320 int rc; /* Result codes from subroutines */
116397 /* This next condition is true if data has already been loaded from
116413 ** a corrupt record. Adding the two 0x00 bytes prevents this from causing
116432 ** Load content from the sqlite_stat4 table into
116436 int rc = SQLITE_OK; /* Result codes from subroutines */
116462 ** read from it.
116466 ** returned. However, in this case, data is read from the sqlite_stat1
116522 /* Load the statistics from the sqlite_stat4 table. */
116565 ** is slightly different from resolving a normal SQL expression, because simple
116607 ** three arguments to the function come directly from an attach statement:
116652 ** from sqlite3_deserialize() to close database db->init.iDb and
116769 /* No key specified. Use the key from URI filename, or if none,
116770 ** use the key from the main database. */
116785 ** remove the entry from the db->aDb[] array. i.e. put everything back the
116842 ** three arguments to the function come directly from a detach statement:
117282 ** Invoke the authorization callback for permission to read column zCol from
117394 ** or if the parser is being invoked from within sqlite3_declare_vtab.
117772 /* This can result either from an OOM or because the formatted string
118033 ** unlike that index from its Table then remove the index from
118064 ** any have been closed, remove them from the list. Reallocate the
118118 ** Erase all schema information from all attached databases (including
118260 ** the table data structure from the hash table. But it does destroy
118338 ** Unlink the given table from the hash tables and the delete the
118375 ** is obtained from sqliteMalloc() and must be freed by the calling
118620 ** Then the mapping from this function is as follows:
119258 ** the expression given in its argument from a TK_STRING into a TK_ID
119579 ** from sqliteMalloc() and must be freed by the calling function.
119724 ** This routine differs from hasColumn() in that both the column and the
119792 ** (2) Convert P3 parameter of the OP_CreateBtree from BTREE_INTKEY
119798 ** schema to the rootpage from the main table.
119830 /* Convert the P3 operand of the OP_CreateBtree opcode from BTREE_INTKEY
119872 ** Remove all redundant columns from the PRIMARY KEY. For example, change
120084 ** was called to create a table generated from a
120093 Select *pSelect /* Select from a "CREATE ... AS SELECT" */
120113 ** for the table from the db->init.newTnum field. (The page number
120216 ** on the expression from inserting extra parts into the expression
120217 ** tree that have been allocated from lookaside memory, which is
120523 Table *pSelTab; /* A fake table from which we get the result set */
120605 ** The names of the columns in the table are taken from
120621 ** the column names from the SELECT statement that defines the view.
120655 ** Clear the column names from every VIEW in database idx.
120676 ** root-page of a table or index in database iDb has changed from iFrom
120716 ** Write code to erase the table with root-page iTable from database iDb.
120797 ** Remove entries from the sqlite_statN tables (for N in (1,2,3))
120840 ** is generated to remove entries from sqlite_schema and/or
120880 /* Remove the table entry from SQLite's internal schema and modify
121018 /* Generate code to remove the table from the schema table
121204 ** the root page number of the index is taken from pIndex->tnum.
121289 ** a different order from the main table.
121447 /* Because the parser constructs pTblName from a single identifier,
121498 ** Exception: If we are reading the names of permanent indices from the
121541 /* Automatic index names generated from within sqlite3_declare_vtab()
121542 ** must have names that are distinct from normal automatic index names.
121982 ** Apart from that, we have little to go on besides intuition as to
122001 ** 2020-05-27: If some of the stat data is coming from the sqlite_stat1
122077 /* Generate code to remove the index and from the schema table */
122293 ** come from pTable (if pDatabase is NULL) or from pDatabase.
122294 ** SrcList.a[].zDatabase is filled with the database name from pTable,
122540 ** Shifts all join operators from left to right for an entire FROM
122773 ** particular, it prevents us from writing an effective
123071 ** Clear information from a Cte object, but do not deallocate storage
123232 ** from the main database is substituted, if one is available.
123250 ** Locate and return an entry from the db.aCollSeq hash table. If the entry
123302 ** for the encoding 'enc' from the database 'db'.
123976 SrcList *pTabList, /* The table from which we should delete things */
123982 Table *pTab; /* The table from which records will be deleted */
124013 int isView; /* True if attempting to delete from a view */
124035 ** deleted from is a view
124110 /* If we are trying to delete from a view, realize that view into
124273 ** deleting from and all its indices. If this is a view, then the
124406 ** that a search record formed from OP_MakeRecord is contained in the
124414 ** and nPk before reading from it.
124425 ** then it identifies an index cursor (from within array of cursors
124434 int iDataCur, /* Cursor from which column data is extracted */
124588 int iIdxNoSeek /* Do not delete from this cursor */
124650 int iDataCur, /* Cursor number from which to take column data */
125023 ** If p1 is negative, then we begin abs(p1) from the end of x[].
125066 ** from 2009-02-02 for compatibility of applications that exploited the
125364 ** Possible error returns from patternMatch()
125384 ** [...] Matches one character from the enclosed list of
125452 ** first matching character and recursively continue the match from
125762 /* Array for converting from half-bytes (nybbles) into ASCII hex
125965 ** from A by replacing every occurrence of B with C. The match
126163 /* IMP: R-25361-16150 This function is omitted from SQLite by default. It
126838 /* Convert from natural logarithm to log base 10 */
126842 /* Convert from natural logarithm to log base 2 */
127159 ** time a statement is executed that removes an existing violation from
127383 /* If the index uses a collation sequence that is different from
127419 ** This function is called when a row is inserted into or deleted from the
127427 ** or deleted from the child table. If the parent row can be found, no
127450 int *aiCol, /* Map from parent key columns to child table columns */
127645 ** from the parent table of foreign key constraint pFKey and, if pFKey is
127677 int *aiCol, /* Map from pIdx cols to child table cols */
127708 Expr *pLeft; /* Value from parent table row */
127725 ** to the WHERE clause that prevent this entry from being scanned.
127740 Expr *pLeft; /* Value from parent table row */
127809 ** The Trigger structure or any of its sub-components may be allocated from
127844 ** being dropped from the database. The SrcList passed as the second argument
127856 ** the table from the database. Triggers are disabled while running this
127999 ** of the row being deleted, from left to right. Parameter regNew is passed
128007 ** the original record is deleted from the table using the calling convention
128013 Table *pTab, /* Row is being deleted from this table */
128101 ** values read from the parent table are NULL. */
128118 /* A row is being removed from the child table. Search for the parent.
128334 Table *pTab, /* Table being updated or deleted from */
128531 Table *pTab, /* Table being updated or deleted from */
128558 ** table pTab. Remove the deleted foreign keys from the Schema.fkeyHash
128570 /* Remove the FK from the fkeyHash hash table. */
128717 ** from sqlite3DbMalloc(). The caller is responsible for freeing
129063 ** only called from the top-level */
129207 ** insert with data coming from a single-row VALUES clause, the code executes
129221 ** in other words if the SELECT pulls all columns from a single table
129225 ** is invoked that copies raw records from <table2> over to <table1>.
129236 ** transfer all records from the read to the write cursors
129241 ** and the SELECT clause does not read from <table> at any time.
129255 ** insert the select result into <table> from R..R+n
129260 ** values from a SELECT but the data is being inserted into a table
129276 ** insert row from R..R+n into temp table
129304 int srcTab = 0; /* Data comes from this temporary cursor if >=0 */
129317 int regFromSelect = 0;/* Base register for data coming from SELECT */
129507 ** is coming from a SELECT statement, then generate a co-routine that
129512 /* Data is coming from a SELECT or from a multi-row VALUES clause.
129548 /* Invoke the coroutine to extract information from the SELECT
129550 ** here is from the 4th template:
129554 ** insert row from R..R+n into temp table
129576 /* This is the case if the data for the INSERT is coming from a
129715 ** insert the select result into <table> from R..R+n
129924 ** is derived from the INTEGER PRIMARY KEY. */
130057 /* This is the Walker callback from sqlite3ExprReferencesUpdatedColumn().
130128 int i; /* Index of the current item from the list */
130160 /* Return the next index from the list. Return NULL when out of indexes */
130239 ** any ABORT Back out changes from the current command
130583 ** used to link together these tests which are separated from each other
130689 ** remove the conflicting row from the table. This will fire
130895 ** is different from old-rowid */
130903 /* Extract the PRIMARY KEY from the end of the index entry and
130917 ** different from the old. See TH3 withoutrowid04.test.
130920 ** of the matched index row are different from the original PRIMARY
131009 /* Copy the constraint check code from above, except change
131362 ** The xfer optimization transfers raw records from tab2 over to tab1.
131396 int iSrc, iDest; /* Cursors from source and destination */
131409 ** error if pSelect reads from a CTE named "xxx". */
131484 return 0; /* Cannot feed from a non-strict into a strict table */
131507 ** to do a bulk transfer all of the content from t1 over to t2.
131785 ** codes. Also write an error message into memory obtained from
132645 ** excluded from a build of SQLite. Substitute a NULL pointer
133436 ** Cancel a prior call to sqlite3_auto_extension. Remove xInit from the
133633 ** result column is different from the name of the pragma
133639 /* 3 */ "from",
134313 ** the rest of the file if PRAGMAs are omitted from the build.
134367 ** from default, or when 'file' and the temp_store_directory has changed
134376 "from within a transaction");
135412 ** cid: Column id (numbered from left to right, starting at 0)
135758 int regRow; /* Registers to hold a row from pTab */
136036 /* Fetch the right-most column from the table. This will cause
136226 sqlite3VdbeLoadString(v, 4, " missing from index ");
136549 ** information from the current session in the
136605 /* If table pTab has not been used in a way that would benefit from
136975 /* Clear all content from pragma virtual table cursor. */
137068 /* The xColumn method simply returns the corresponding column from
137101 pragmaVtabDisconnect, /* xDisconnect - Disconnect from a table */
137157 ** from disk.
137227 ** This routine is also called from the OP_ParseSchema opcode of the VDBE.
137273 TESTONLY(int rcp); /* Return code from sqlite3_prepare() */
137644 Btree *pBt = db->aDb[iDb].pBt; /* Btree database to read cookie from */
137660 /* Read the schema cookie from the database. If it does not match the
138090 /* EVIDENCE-OF: R-56861-42673 sqlite3_prepare_v3() differs from
138251 ** retrieve the associated "bigblob" values directly from table t1 as the
138252 ** 10 smallest "a" values are extracted from the sorter.
138256 ** extracted from the sorter.
138442 ** This routine makes as much sense at it can from the nonsense join
138644 ** just clear every EP_OuterON and EP_InnerON mark from the expression tree.
138925 ** (3) Some output columns are omitted from the sort record due to
138929 ** regOrigData is 0 to prevent this routine from trying to copy
139215 ** storing values read from that column in the sorter records, the PK of
139216 ** the row from table t1 is stored instead. Then, as records are extracted from
139218 ** retrieved directly from table t1. If the values are very large, this
139296 ** zero or more, then data is pulled from srcTab and p->pEList is used only
139302 int srcTab, /* Pull data from this table if non-negative */
139322 ** from this array. In this case regOrig is set to zero. */
139399 ** This allows the p->pEList field to be omitted from the sorted record,
139425 ** from the sorter by the optimizations in this branch */
139506 /* Construct a record from the query result, but instead of
139507 ** saving that record, use it as a key to delete elements from
139784 ** Space to hold the KeyInfo structure is obtained from malloc. The calling
139790 ExprList *pList, /* Form the KeyInfo object from this ExprList */
139883 int iSortTab; /* Sorter cursor to read from */
140081 ** The declaration type is the exact datatype definition extracted from the
140127 ** extracted from in NameContext.pSrcList. This table may be real
140130 Table *pTab = 0; /* Table structure column is extracted from */
140131 Select *pS = 0; /* Select the column is extracted from */
140416 ExprList *pEList, /* Expr list from which to derive column names */
140523 ** The column list presumably came from selectColumnNamesFromExprList().
140708 ** The collating sequence for the compound select is taken from the
140733 ** Space to hold the KeyInfo structure is obtained from malloc. The calling
140780 ** into a Queue table. Rows are extracted from the Queue table one by
140781 ** one. Each row extracted from Queue is output to pDest. Then the single
140784 ** is added back into the Queue table. Then another row is extracted from Queue
140885 /* Detach the ORDER BY clause from the compound SELECT */
140964 ** Handle the special case of a compound-select that originates from a
140969 ** Because the Select object originates from a VALUES clause:
141022 ** This routine is called to process a compound query form from
141050 ** individual selects always group from left to right.
141057 int rc = SQLITE_OK; /* Success code from a subroutine */
141265 /* INTERSECT is different from the others since it requires
141582 ** AltB: Called when there is data from both coroutines and A<B.
141584 ** AeqB: Called when there is data from both coroutines and A==B.
141586 ** AgtB: Called when there is data from both coroutines and A>B.
141588 ** EofA: Called when data is exhausted from selectA.
141590 ** EofB: Called when data is exhausted from selectB.
141686 u32 *aPermute; /* Mapping from ORDER BY terms to result set columns */
141730 ** row of results comes from selectA or selectB. Also add explicit
141772 /* Separate the left and the right query from one another
141869 /* Generate a subroutine to run when the results from select A
141883 /* Generate a subroutine to run when the results from select B
142341 ** from 2015-02-09.)
142355 ** sub-queries that were excluded from this optimization. Restriction
142370 ** (**) Restriction (10) was removed from the code on 2005-02-05 but we
142378 ** a separate restriction deriving from ticket #350.
142648 SELECTTRACE(1,pParse,p,("flatten %u.%p from term %d\n",
142807 /* Transfer the FROM clause terms from the subquery into the
142928 u32 mExcludeOn; /* Which ON expressions to exclude from considertion.
143059 ** This is a Walker expression callback. pExpr is a node from the WHERE
143099 ** part of a ON clause from a LEFT JOIN, then throughout the query
143123 ** To work around this, the expression tree is not actually changed from
143247 ** expression to be pushed down does not come from the ON clause
143616 ** WITH contexts, from inner to outermost. If the table identified by
143651 ** WITH clause will never be popped from the stack but should instead
143718 /* The FROM term is specifically excluded from matching a CTE.
143872 ** clause, pop it from the stack stored as part of the Parse object.
143993 /* Renumber selId because it has been copied from a view */
144219 /* If a column is marked as 'hidden', omit it from the expanded
144241 ** using clause from the table on the right. */
144671 ** column from an outer aggregate query, or an aggregate function that
144695 ** Transfer eligible terms from the HAVING clause of a query, which is
144901 WhereInfo *pWInfo; /* Return from sqlite3WhereBegin() */
144905 SrcList *pTabList; /* List of tables to select from */
144910 int rc = 1; /* Value to return from this function */
145208 ** tables that are referenced but from which no values are extracted.
145407 /* Notice that even thought SF_Distinct has been cleared from p->selFlags,
145570 int groupBySort; /* Rows come from source in GROUP BY order */
145573 int sortOut = 0; /* Output register from the sorter */
145857 ** from the previous row currently stored in a0, a1, a2...
146185 ** This structure is used to pass data from sqlite3_get_table() through
146195 int rc; /* Return code from sqlite3_exec() */
146210 ** we need to remember from this invocation of the callback.
146273 ** from malloc(). But the caller cannot free this memory directly.
146347 char **azResult /* Result returned from sqlite3_get_table() */
146774 ** Duplicate a range of text from an SQL statement, then convert all
146935 Token *pTableName, /* The table from which rows are deleted */
146971 ** This function is called to drop a trigger from the database schema.
146973 ** This may be called directly from the parser and therefore identifies
147064 ** Remove a trigger from the hash tables of the sqlite* pointer.
147209 ** forming the SrcList. This prevents a trigger in one database from
147249 ** Return true if the pExpr term from the RETURNING clause argument
147267 /* The input list pList is the list of result set terms from a RETURNING
147268 ** clause. The table that we are returning from is pTab.
147271 ** any "*" wildcards to be the complete set of columns from pTab.
147319 Table *pTab, /* The table to code triggers from */
147494 ** from pFrom to pTo.
147664 Table *pTab, /* The table to code triggers from */
147739 Table *pTab, /* The table to code triggers from */
147809 Table *pTab, /* The table to code triggers from */
147865 int *aXRef, /* Mapping from columns of pTab to entries in pChanges */
147881 ** from the P4 parameter of the OP_Column instruction, is returned instead.
148032 SrcList *pTabList, /* List of tables to select from */
148160 int eOnePass; /* ONEPASS_XXX value from where.c */
148763 ** values for registers not modified by the UPDATE must be reloaded from
148900 ** value is copied from memory cell (regNewRowid+1+iCol), where iCol
149030 int *aXRef, /* Mapping from columns of pTab to entries in pChanges */
149050 ** create and open the ephemeral table in which the records created from
149143 /* Create a record from the argument register contents and insert it into
149167 /* Extract arguments from the current row of the ephemeral table and
149591 ** (2) Copy all content from the database being vacuumed into
149593 ** (3) Copy content from the transient database back into the
149659 int rc = SQLITE_OK; /* Return code from service routines */
149677 sqlite3SetString(pzErrMsg, db, "cannot VACUUM from within a transaction");
149832 /* Copy the triggers, views, and virtual tables from the main database
149835 ** from the schema table.
149958 ** are invoked only from within xCreate and xConnect methods.
150202 ** for table *p associated with database connection db from the linked
150264 ** Clear any and all virtual-table information from the Table record.
150580 ** If so, set the Column COLFLAG_HIDDEN flag and remove the token from
150740 ** valid to call this function from within the xCreate() or xConnect() of a
150860 /* Remove the sqlite3_vtab* from the aVTrans[] array, if applicable */
150958 ** than zero, then this function is being called from within a
151219 ** The results of this routine are undefined unless it is called from
151236 ** Call from within the xCreate() or xConnect() methods to provide
151299 ** This file was split off from where.c on 2015-06-06 in order to reduce the
151525 ** clause subexpression is separated from the others by AND operators,
151606 #define TERM_LIKEOPT 0x0100 /* Virtual terms from the LIKE optimization */
151691 ** from the sparse cursor numbers into consecutive integers beginning
151844 SrcList *pSrclist, /* FROM clause pLvl reads data from */
151971 Index *pIdx, /* Index to read column names from */
152208 ** clause that the scan reads data from.
152215 SrcList *pSrclist, /* FROM clause pLvl reads data from */
152392 ** The reduced pX is different from the original (obviously) and thus is
152770 ** from the RHS of an "? IN (SELECT ...)" expression. The
152799 ** (a string literal) that originated from the LIKE optimization, then
152836 ** Information is passed from codeCursorHint() down to individual nodes of
152907 ** from the newly populated register.
152930 ** be a correlated sub-query, and expression pExpr is an aggregate from
152979 ** from the cursor-hint.
153050 ** a rowid value just read from cursor iIdxCur, open on index pIdx. This
153187 ** from being checked a second time when the inner loop is evaluated.
153974 ** terms from the query that must be true due to the WHERE clause of
154149 ** is invoked from a different OR branch that uses a different index, such
154173 ** prevents sqlite3PExpr() from applying the AND short-circuit
154180 ** eliminating duplicates from other WHERE clauses, the action for each
154217 ** duplicate rows from prior sub-WHERE clauses, and record the
154272 ** current sub-WHERE row is a duplicate from prior sub-WHEREs. */
154276 ** contained one or more AND term from a notReady table. The
154277 ** terms from the notReady table could not be tested and will
154740 ** The new WhereTerm object is constructed from Expr p and with wtFlags.
154829 ** Translate from TK_xx operator to WO_xx bitmask.
154935 /* Get the pattern prefix. Remove all escapes from the prefix. */
155494 ** current term is from the first iteration. So skip this term. */
155607 ** This is an optimization. No harm comes from returning 0. But if 1 is
156194 /* Prevent ON clause terms of a LEFT JOIN from being used to drive
156290 ** 3. The SELECT statement has exactly one object in its from clause, and
156577 ** This object is not an API and can be changed from one release to the
156585 int eDistinct; /* Value to return from sqlite3_vtab_distinct() */
156597 ** Return the estimated number of output rows from a WHERE clause
157219 int iStart, /* Translate from this opcode to the end */
157594 ** from the loop, but the regFilter value is set to a register that implements
157601 ** the loop would benefit from a Bloom filter, and the WHERE_BLOOMFILTER bit
157935 ** appropriate error code is returned. A return of SQLITE_CONSTRAINT from
158219 ** extracted from pLower and pUpper with the corresponding column in each
158221 ** equal to the values extracted from pLower and pUpper respectively, and
158227 ** If pLower is NULL, or a value cannot be extracted from the term, L is
158228 ** set to zero. If pUpper is NULL, or a value cannot be extracted from it,
158232 ** if no value can be extracted from either pLower or pUpper (and so the
158255 sqlite3_value *p1 = 0; /* Value extracted from pLower */
158256 sqlite3_value *p2 = 0; /* Value extracted from pUpper */
158257 sqlite3_value *pVal = 0; /* Value extracted from record */
158381 ** Or, if pLower is NULL or $L cannot be extracted from it (because it
158426 int n; /* Values extracted from pExpr */
158443 int n; /* Values extracted from pExpr */
158462 /* TUNING: If both iUpper and iLower are derived from the same
158506 WHERETRACE(0x10,("Range scan lowers nOut from %d to %d\n",
158799 ** Transfer content from the second pLoop into the first.
158937 ** In other words if pTemplate ought to be dropped from further consideration.
159409 ** to mix with a lower range bound from some other source */
159470 ** from the index lookup and instead do a scan of the M elements,
159536 /* Range constraints that come from the LIKE optimization are
159773 Expr *pWhere /* The WHERE clause from the partial index */
159843 ** pWInfo->pSelect (columns from 0 through 62). But there are columns
159872 /* pIdx does not index any columns greater than 62, but we know from
159919 ** log(nRow) factor is omitted from a non-covering index scan in order to
159977 ** NOT INDEXED qualifier is omitted from the FROM clause */
160334 ** (2) Multiple outputs from a single IN value will not merge
160449 ** This interface is callable from within the xBestIndex callback only.
160527 ** separated from it by at least one LEFT or CROSS JOIN. Similarly, the
160529 ** virtual table and are separated from it by at least one LEFT or
160820 /* Loop over the tables in the join, from left to right */
160840 ** prevents the right operand of a RIGHT JOIN from being swapped with
160844 ** prevent FROM-clause terms from moving from the right side of
160929 Expr *pOBExpr; /* An expression from the ORDER BY clause */
160930 CollSeq *pColl; /* COLLATE function from an ORDER BY clause term */
160946 ** We say the WhereLoop is "order-distinct" if the set of columns from
161217 } /* End the loop over all WhereLoops from outer-most down to inner-most */
161561 /* Discard the candidate path from further consideration */
161868 /* Attempt to omit tables from a join that do not affect the result.
161877 ** from its own USING or ON clause.
161885 ** then table t2 can be omitted from the following:
161891 ** or from:
161959 ** Check to see if there are any SEARCH loops that might benefit from
162123 ** data from the various tables of the loop.
162161 ** is called from an UPDATE or DELETE statement, then pOrderBy is NULL.
162292 /* Assign a bit from the bitmask to every term in the FROM clause.
162458 /* Attempt to omit tables from a join that do not affect the result.
162462 ** procedure to keep the sqlite3WhereBegin() procedure from becoming
162464 ** some C-compiler optimizers from in-lining the
162479 /* Check to see if there are any SEARCH loops that might benefit from
163003 ** from the index instead of from the table where possible. In some cases
163004 ** this optimization prevents the table from ever being read, which can
163174 ** * Terminals from each of the expression trees that make up the
163880 /* If this function is being called from within a scalar sub-select
164128 ** redundant, remove the ORDER BY from the parent SELECT. */
164203 ** of sqlite3DbMallocRawNN() called from
164244 ** Unlink the Window object from the Select to which it is attached,
164395 ** Window *pWin has just been created from a WINDOW clause. Tokne pBase
164396 ** is the base window. Earlier windows from the same WINDOW clause are
164681 ** variable indicates when rows may be removed from the temp table (in
164715 ** read from the corresponding cursor.
164737 ** Generate VM code to read the window frames peer values from cursor csr into
164768 ** the arguments are extracted from the current row of csr into the
164772 ** already populated with all columns from the current row of the sub-query.
164780 int csr, /* Read arguments from this cursor */
165239 /* Read the peer-value from each cursor into a register */
165304 /* Register reg1 currently contains csr1.peerVal (the peer-value from csr1).
165306 ** from it. Or, if reg1 is not numeric (it is a NULL, a text value or a blob),
165315 ** then the arithmetic is performed, but since adding or subtracting from
165624 ** with arguments read from the current row of cursor csrEnd, then
165632 ** functions with arguments read from the current row of cursor
165636 ** differently from the above - "BETWEEN <expr> PRECEDING AND <expr> PRECEDING"
165712 ** conditions that are always true are omitted from the VM code. The only
165834 ** or <expr PRECEDING) read from cursor csr.
165956 /* Figure out when rows may be deleted from the ephemeral table. There
165988 /* Allocate registers for the array of values from the sub-query, the
166233 /* This file is automatically generated by Lemon from input grammar
166279 ** engine can be allocated from stack. In that case, only the
166386 /* Construct a new Expr object from a single token */
166684 ** sqlite3ParserARG_FETCH Code to extract %extra_argument from yypParser
167972 /* 245 */ "from",
168145 /* 92 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt",
168146 /* 93 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt",
168158 /* 105 */ "from ::=",
168159 /* 106 */ "from ::= FROM seltablist",
168210 /* 157 */ "cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret",
168326 /* 273 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt",
168485 fprintf(yyTraceFILE,"%sStack grows from %d to %d entries.\n",
168561 ** deletions is derived from the %destructor and/or %token_destructor
168574 ** when the symbol is popped from the stack during a
168624 case 245: /* from */
168685 ** is popped from the stack, then call it.
168703 ** Clear all secondary memory allocations from the parser
169056 240, /* (92) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
169057 240, /* (93) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */
169069 245, /* (105) from ::= */
169070 245, /* (106) from ::= FROM seltablist */
169121 190, /* (157) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */
169237 291, /* (273) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
169466 -9, /* (92) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
169467 -10, /* (93) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */
169479 0, /* (105) from ::= */
169480 -2, /* (106) from ::= FROM seltablist */
169531 -9, /* (157) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */
169647 -9, /* (273) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
169790 ** only called from one place, optimizing compilers will in-line it, which
170168 case 92: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
170173 case 93: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */
170243 case 105: /* from ::= */
170247 case 106: /* from ::= FROM seltablist */
170445 case 157: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */
170985 case 273: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
171432 ** The first argument is a pointer to a structure obtained from
172353 /* Make the IdChar function accessible from ctime.c and alter.c */
172898 ** the normalization in space obtained from sqlite3DbMalloc(). Or return
173036 ** separating it out, the code will be automatically omitted from
173106 ** from the input. The following tokens are significant:
173190 case '-': { /* SQL-style comments from "--" to end of line */
173521 ** the hash might be different from SQLITE_SOURCE_ID.
173601 ** * Calls to this routine from Y must block until the outer-most
173604 ** * Recursive calls to this routine from thread X return immediately
173651 ** mutex must not require support from the malloc subsystem.
173809 ** to be NULL or point to memory that was obtained from sqlite3_malloc(),
174029 /* MSVC is picky about pulling func ptrs from va lists.
174150 ** space for the lookaside memory is obtained from sqlite3_malloc().
174266 ** Free up as much memory as we can from the given database
174431 ** strings byte by byte using the memcmp() function from the standard C
174829 /* The temp-database schema is allocated differently from the other schema
175559 ** Register a trace function. The pArg from the previously registered trace
175611 ** Register a profile function. The pArg from the previously registered
176263 ** from forming.
176571 ** This routine does the core work of extracting URI parameters from a
176637 char *zErrMsg = 0; /* Error message from sqlite3ParseUri() */
176665 /* Remove harmful bits from the flags parameter
177157 ** This function is now an anachronism. It used to be used to recover from a
177317 ** explicitly declared column. Copy meta information from *pCol.
177527 ** value from sqlite3FaultSim(0) becomes the return from
177531 /* A bug in MSVC prevents it from understanding pointers to functions
177568 ** IMPORTANT: Changing the PENDING byte from 0x40000000 results in
177962 ** This only works if the filename passed in was obtained from the Pager.
178022 ** Free memory obtained from sqlite3_create_filename(). It is a severe
178024 ** previously obtained from sqlite3_create_filename() or a NULL pointer.
178094 ** passed into the VFS from the SQLite core. Doing so is similar to
178095 ** passing free() a pointer that was not obtained from malloc() - it is
178275 ** Recover as many snapshots as possible from the wal file associated with
178307 ** Free a snapshot handle obtained from sqlite3_snapshot_get().
178447 ** Remove connection db from the blocked connections list. If connection
178590 ** pUnlockConnection==0, remove the entry from the blocked connections
178637 ** allocate a larger array from the heap has failed.
178673 /* Remove connection p from the blocked connections list. */
178690 ** being closed. The connection is removed from the blocked list.
178730 ** structures are like b+trees in layout, but are constructed from the
178732 ** are built from the bottom up, things will be described from the
178775 ** varint docid; (delta from previous doclist)
178777 ** varint position; (2 more than the delta from previous position)
178783 ** varint position; (2 more than the delta from previous position)
178795 ** than the difference from the prior position, or the just the position plus
178825 ** varint iHeight; (height from leaf level, always 0)
178871 ** varint iHeight; (height from leaf level, always >0)
178900 ** INTERIOR_MIN_TERMS (default 7) keeps large terms from monopolizing
178949 ** After the merge, all segment blocks from the merged level are
179058 ** tokens from a particular input.
179146 ** Retrieve the next token from the tokenizer cursor pCursor. This
179369 ** from that used by SQLite, so the maximum length is 10, not 9.
179600 ** When the core wants to read from the virtual table, it creates a
179615 sqlite3_int64 iPrevId; /* Previous id read from aDoclist */
179717 ** "Length" field found in doclists stored on disk is omitted from this
180020 ** Read a 64-bit variable-length integer from memory starting at p[0].
180029 ** Read a 64-bit variable-length integer from memory starting at p[0] and
180110 int iIn = 1; /* Index of next byte to read from input */
180130 ** Read a single varint from the doclist at *pp and advance *pp to point
180208 ** Construct one or more SQL statements from the format string given
180482 ** The pointer returned points to memory obtained from sqlite3_malloc(). It
180512 ** from left to write. If parameter zFunc is not NULL, then instead of
181001 ** TABLE statement, use all columns from the content table.
181014 ** column from the aCol[] array. */
181159 ** estimate the cost of loading large doclists from the database. */
181550 ** varints from the buffer) does not risk an overread. If zNode is a
181551 ** root node, then the buffer comes from a SELECT statement. SQLite does
181554 ** contents, or two zero bytes. Or, if the node is read from the %_segments
181601 /* Compare the term we are searching for with the term just loaded from
181603 ** to the term from the interior node, then all terms on the sub-tree
181673 char *zBlob = 0; /* Blob read from %_segments table */
181815 ** POSITION_LIST_END and return. Otherwise, read the next varint from *pp,
181827 sqlite3_int64 *pi /* IN/OUT: Value read from position-list */
181894 sqlite3_int64 i1 = 0; /* Last position from pp1 */
181895 sqlite3_int64 i2 = 0; /* Last position from pp2 */
182135 ** This function is used to read a single varint from a buffer. Parameter
182141 ** from *pp. *pp is then set to point 1 byte past the end of the read varint.
182144 ** If it is true, the value read is subtracted from *pVal before this
182148 char **pp, /* IN/OUT: Point to read varint from */
182260 ** read from. And each subsequent docid read from the same input list
182263 ** be a positive value less than or equal to the delta value read from
182265 ** read from the 'other' list. And to the contents of all position lists
182266 ** that will be copied and merged from the input to the output.
182269 ** then the encoding of the first docid from the 'other' input list may
182322 ** the output contains a copy of each position from the right-hand input
182334 int nDist, /* Distance from left to right (1=adjacent) */
182400 ** of the entries from pList at position 0, and terminated by an 0x00 byte.
182610 int iIndex, /* Index to search (from 0 to p->nIndex-1) */
182615 int isScan, /* True to scan from zTerm to EOF */
182684 int iIndex, /* Index to search (from 0 to p->nIndex-1) */
182689 int isScan, /* True to scan from zTerm to EOF */
182802 ** prefix) from the database.
183082 ** This is the xColumn method, called by SQLite to request a value from
183093 sqlite3_vtab_cursor *pCursor, /* Cursor to retrieve value from */
183095 int iCol /* Index of column to read value from */
183176 ** of blocks from the segments table. But this is not considered overhead
184068 /* Determine if doclists may be loaded from disk incrementally. This is
184111 ** This function is used to iterate backwards (from the end to start)
184118 ** function iterates from the end of the doclist to the beginning.
184581 ** data from the %_stat table to calculate it.
184587 ** data stored in all rows of each column of the table, from left
184655 ** table actually contains the same data as the index. To prevent this from
184680 ** to retrieve the entire doclist for the token from the full-text index.
184688 ** After each token doclist is loaded, merge it with the others from the
184725 ** for-loop. Except, limit the value to 2^24 to prevent it from
184759 ** This function is called from within the xFilter method. It initializes
185607 Fts3Expr *p; /* Used to iterate from pExpr to root */
185611 /* Check if this phrase descends from an OR expression node. If not,
186230 sqlite3_vtab_cursor *pCursor, /* Cursor to retrieve value from */
186232 int iCol /* Index of column to read value from */
186271 sqlite3_vtab_cursor *pCursor, /* Cursor to retrieve value from */
186484 ** Extract the next token from buffer z (length n) using the tokenizer
186868 ** is defined), the order of the operators in precedence from highest to
186928 ** bytes read from buffer z. Otherwise, *ppExpr is set to 0 and SQLITE_NOMEM
187180 /* Remove pParent from the original tree. */
187334 ** of each column in the target fts3 table, in order from left to right.
187433 ** expression passed as the first argument. The buffer is obtained from
187685 /* Remove all entries from a hash table. Reclaim all memory.
187860 /* Remove a single entry from the hash table given a pointer to that
187865 Fts3HashElem* elem, /* The element to be removed from the pH */
187938 ** element corresponding to "key" is removed from the hash table.
188037 ** Class derived from sqlite3_tokenizer
188044 ** Class derived from sqlite3_tokenizer_cursor
188293 ** by taking 10 or 3 bytes from the beginning and end.
188329 ** a few bytes from the beginning and the end of the word. If the
188330 ** word contains digits, 3 bytes are taken from the beginning and
188331 ** 3 bytes from the end. For long words without digits, 10 bytes
188332 ** are taken from each end. US-ASCII case folding still applies.
188592 ** Extract the next token from a tokenization cursor. The cursor must
189260 /* TODO(shess) Delimiters need to remain the same from run to run,
189343 ** Extract the next token from a tokenization cursor. The cursor must
189460 ** token: A token from the input.
189805 sqlite3_vtab_cursor *pCursor, /* Cursor to retrieve value from */
189807 int iCol /* Index of column to read value from */
189837 sqlite3_vtab_cursor *pCursor, /* Cursor to retrieve value from */
189901 ** this file contains code to insert, update and delete rows from FTS3
189918 ** When full-text index nodes are loaded from disk, the buffer that they
189924 ** it is always safe to read up to two varints from it without risking an
189972 sqlite3_log(SQLITE_OK, "%d-way merge from level %d", nMerge, (int)iAbsLevel);
190042 ** by the caller. They are valid from the time SegmentReaderNew() returns
190082 char *aData; /* Pointer to block from malloc() */
190194 /* Return segments in order from oldest to newest.*/
190218 /* This statement is used to determine which level to read the input from
190228 ** created by merging the oldest :2 segments from absolute level :1. See
190245 ** Read a single entry from the %_segdir table. The entry from absolute
190269 /* Return segments in order from oldest to newest.*/
190324 sqlite3_stmt *pStmt = 0; /* Statement requested from fts3SqlStmt() */
190469 ** all rows in the %_segdir table, from oldest to newest. If successful,
190476 ** The statement returns the following columns from the %_segdir table:
190913 ** Remove all data from the FTS3 table. Clear the hash table containing
190922 /* Delete everything from the shadow tables. Except, leave %_content as
190948 ** (an integer) of a row about to be deleted. Remove all terms from the
190953 Fts3Table *p, /* The FTS table to delete from */
191062 ** This function reads data from a single row of the %_segments table. The
191400 ** position. The exception is if this node is being loaded from disk
192320 ** are different from that integer. i.e. if deleting the document with docid
193288 int rc; /* Result code from subfunctions */
193336 int rc; /* Result code from subfunctions */
193611 ** An object of the following type is used to read data from a single
193664 int nPrefix = 0; /* Bytes to copy from previous term */
194130 ** * The first key read from the input (arguments zKey and nKey) is
194152 int rc2; /* Return code from sqlite3_reset() */
194334 Fts3MultiSegReader *pCsr, /* Cursor that data will be read from */
194385 ** Remove an entry from the %_segdir table. This involves running the
194397 sqlite3_int64 iAbsLevel, /* Absolute level to delete from */
194415 ** One or more segments have just been removed from absolute level iAbsLevel.
194417 ** the idx values are a contiguous sequence starting from 0.
194492 ** or greater than zTerm/nTerm (for internal nodes) from aNode/nNode.
194544 ** Remove all terms smaller than zTerm/nTerm from segment iIdx in absolute
194545 ** level iAbsLevel. This may involve deleting entries from the %_segments
194630 ** merge (or partially merge) two or more segments from absolute level
194633 ** Each input segment is either removed from the db completely (if all of
194668 /* The incremental merge did not copy all the data from this
194706 ** Load an incr-merge hint from the database. The incr-merge hint, if one
194709 ** If successful, populate blob *pHint with the value read from the %_stat
194763 ** Read the last entry (most recently pushed) from the hint blob *pHint
194808 Blob hint = {0, 0, 0}; /* Hint read from %_stat table */
194842 /* If the hint read from the %_stat table is not empty, check if the
194866 ** is removed from the hint blob. */
195596 ** should be deleted from the database before inserting the new row. Or,
195767 Fts3Cursor *pCsr; /* Cursor snippet is being generated from */
195768 int iCol; /* Extract snippet from this column */
195785 int iCol; /* Column snippet is extracted from */
195926 ** list is a list of unique integers, sorted from smallest to largest. Each
196019 ** indirectly descended from the right-hand-side of a NOT operator). If
196207 ** from column iCol that represent the "best" snippet. The best snippet
196223 int iCol, /* Index of column to create snippet from */
196358 Fts3Table *pTab, /* FTS3 table snippet comes from */
196361 const char *zDoc, /* Document text to extract snippet from */
196419 ** Extract the snippet text for fragment pFragment from cursor pCsr and
196435 const char *zDoc; /* Document text to extract snippet from */
196442 int iCol = pFragment->iCol+1; /* Query column to extract text from */
196652 int iPhrase, /* Phrase number (numbered from zero) */
196803 int iPhrase, /* Phrase number (numbered from zero) */
197147 int iCol, /* Extract snippet from this column */
197155 /* The returned text includes up to four fragments of text extracted from
197249 i64 iPos; /* Position just read from pList */
197250 i64 iOff; /* Offset of this term from read positions */
197350 ** needs to transform the data from utf-16 to utf-8), return SQLITE_NOMEM
197488 ** from the sqlite3 source file utf.c. If this file is compiled as part
197770 ** Extract the next token from a tokenization cursor. The cursor must
198460 /* Append N bytes from zIn onto the end of the JsonString string.
198626 ** Free a JsonParse object that was obtained from sqlite3_malloc().
199518 ** obtained from sqlite3_malloc().
200015 ** Remove the named elements from JSON and return the result. malformed
200727 ** initialized to to discourage the query planner from selecting this
200979 ** table that maps from the entries rowid to the id of the node that it
201080 ** various strategies. If possible, this estimate is loaded from the
201127 /* Statements to read/write/delete a record from xxx_node */
201131 /* Statements to read/write/delete a record from xxx_rowid */
201136 /* Statements to read/write/delete a record from xxx_parent */
201177 ** record intermediate results from the tree walk.
201199 ** cells are removed from the overfull node and reinserted into the tree.
201318 ** A single cell from a node, deserialized
201595 ** Remove node pNode from the node hash table.
201771 ** Remove the cell with index iCell from node pNode.
201869 RtreeNode *pNode, /* The node from which to extract the ID */
201870 int iCell /* The cell index from which to extract the ID */
201877 ** Return coordinate iCoord from cell iCell in node pNode.
201881 RtreeNode *pNode, /* The node from which to extract a coordinate */
202091 ** Convert raw bits from the on-disk RTree record into a coordinate value.
202899 ** table scan strategies to choose from (in order from most to
202929 ** is 'a', the second from the left 'b' etc.
203140 ** This function implements the ChooseLeaf algorithm from Gutman[84].
203263 ** nIdx. The aIdx array contains the set of integers from 0 to
203335 ** nIdx. The aIdx array contains the set of integers from 0 to
203401 ** Implementation of the R*-tree variant of SplitNode from Beckman[1990].
203546 ** all cells from node pLeft. Then zero the original node.
203746 /* Remove the node from the in-memory hash table and link it into
203793 /* Remove the cell from the node. This call just moves bytes around
203799 ** number of cells, remove it from the tree. Otherwise, update the
203996 ** Remove the entry with rowid=iDelete from the r-tree structure.
204019 /* Delete the cell in question from the leaf node. */
204064 /* Re-insert the contents of any underfull nodes removed from the tree. */
204088 #define RNDAWAY (1.0 + 1.0/8388608.0) /* Round away from zero */
204176 /* Unable to write to the btree while another cursor is reading from it,
204259 ** record to delete from the r-tree table. The following block does
204431 rtreeDisconnect, /* xDisconnect - Disconnect from a table */
204602 ** This function is called from within the xConnect() or xCreate() method to
204854 ** from the front of a blob that is an r-tree node. For example:
204972 ** Otherwise, the contents of rtree table node iNode are loaded from
204973 ** the database and copied into a buffer obtained from sqlite3_malloc().
205006 rtreeCheckAppendMsg(pCheck, "Node %lld missing from database", iNode);
205050 rtreeCheckAppendMsg(pCheck, "Mapping (%lld -> %lld) missing from %s table",
205305 ** %_parent table mapping from the cell's child node to the
205444 ** segment between each pair of vertexes, and one final segment from
205445 ** the last vertex back to the first. (This differs from the GeoJSON
205458 ** warnings coming from some compiler (notably, clang). In reality, the size
205973 ** If pPoly is NULL but aCoord is not NULL, then compute a new GeoPoly from
206293 GeoPoly *pPoly, /* Take all segments from this polygon */
206812 ** table scan strategies to choose from (in order from most to
206946 /* Unable to write to the btree while another cursor is reading from it,
206994 ** record to delete from the r-tree table. The following block does
207093 rtreeDisconnect, /* xDisconnect - Disconnect from a table */
207400 ** This function is called when an ICU function called from within
207436 ** a multi-byte UTF8 character. It is copied here from SQLite source
207483 /* Read (and consume) the next character from the input pattern. */
207794 assert(!"Unexpected return value from ucol_strcoll()");
207821 int rc; /* Return code from sqlite3_create_collation_x() */
208082 ** Extract the next token from a tokenization cursor.
208193 ** update, insert or delete from the target table.
208290 ** may be loaded from or written to the persistent media multiple times.
208310 ** to read from the original database snapshot. In other words, partially
208412 ** For each row to DELETE from the target database as part of the RBU
208419 ** For each row to UPDATE from the target database as part of the RBU
208475 ** However, RBU is more efficient if reading the rows in from each data_xxx
208510 ** resume the RBU update from where it left off.
208695 ** system recovery RBU may resume the update from the point at which the state
208696 ** was last saved. In other words, from the most recent successful call to
208791 ** sqlite3rbu_step() will copy a page of data from the *-wal file into
209025 ** A structure to store values read from the rbu_state table in memory.
209069 ** from the partial indexes.
209131 #define RBU_DELETE 2 /* Delete a row from a main table b-tree */
209133 #define RBU_IDX_DELETE 4 /* Delete a row from an aux. index b-tree */
209286 ** are lifted from the fossil source code (http://fossil-scm.org). They
209291 ** Read bytes from *pz and convert them into a positive integer. When
209474 ** End of code taken from fossil.
209913 ** returns a copy of the string in memory obtained from sqlite3_malloc().
210209 p->zErrmsg = sqlite3_mprintf("column missing from %q: %s",
210298 ** rows from the source table. For a rowid table, the WHERE clause
210360 ** clause to select the remaining required rows from the source table.
210375 ** rows from the sourct table, just as it does for an RBU update operation.
210471 ** used to read from an data_xxx or rbu_tmp_xxx table while updating the
210699 ** The memory for the returned string is obtained from sqlite3_malloc().
210753 ** The memory for the returned string is obtained from sqlite3_malloc().
211332 /* Create the SELECT statement to read keys from data_xxx */
211744 ** This routine is a copy of the sqlite3FileSuffix3() routine from the core.
211833 ** * Attempts to read from the *-wal file or write to the database file
211850 ** data from the wal file into the database file according to the
211893 ** Called when iAmt bytes are read from offset iOff of the wal file while
211936 ** a single frame of data from the wal file into the database file, as
212386 ** In short, it copies the value of the specified PRAGMA setting from
212550 /* At one point the following block copied a single frame from the
212588 ** considered equal, and NULL is considered distinct from all other values.
212600 ** things so that the next call to sqlite3rbu_step() continues on from
212900 ** level pager to use "journal_mode=off". This prevents it from
213046 ** vacuum from scratch. */
213279 ** from automatically checkpointing a *-wal (or *-oal) file from within
213347 ** Remove an item from the main-db lists.
213415 ** Read and return an unsigned 32-bit big-endian integer from the buffer
213442 ** Read data from an rbuVfs-file.
213609 /* Do not allow EXCLUSIVE locks. Preventing SQLite from taking this
213610 ** prevents it from checkpointing the database from sqlite3_close(). */
213725 /* Prevent SQLite from taking a shm-lock on the target file when it
213770 ** from start to finish. */
214200 ** information from an SQLite database in order to implement the
214224 ** The value of the 'path' column describes the path taken from the
214229 ** a b-tree is '/000/'. (Btrees store content ordered from left to right
214238 ** from. For example, the three overflow pages in a chain linked from
214255 " path TEXT," /* 1 Path to page from root (NULL for agg) */
214288 u8 *aPg; /* Page buffer from sqlite3_malloc() */
214381 ** Disconnect from or destroy the DBSTAT virtual table.
214700 ** offset from ZIPVFS.
214720 Btree *pBt, /* Load page from this b-tree */
214830 ** an entire btree, this is the exit point from this function */
215182 ** Disconnect from or destroy a dbpagevfs virtual table.
215366 ** request this page from the page is an SQLITE_CORRUPT error. */
215712 ** the i'th column of the table, counting from left to right in the order
215718 ** from the database. In the changeset format, the records that are part
215753 ** table column, counting from left to right within the CREATE TABLE
215799 ** record is a copy of the old.* record from the original changeset. If it
215835 ** Read a varint value from aBuf[] into *piVal. Return the number of
215846 ** Read a 64-bit big-endian integer value from buffer aRec[]. Return
216020 ** This function may only be called from within a pre-update callback.
216110 ** The bPkOnly argument is non-zero if the record at aRecord[] is from
216200 ** aRight record contains a value for the column, copy the value from
216214 int iCol; /* Used to iterate from 0 to nCol */
216356 ** This function is only called from within a pre-update-hook callback.
216377 int rc; /* Error code from preupdate_new/old */
216378 int eType = *a++; /* Type of value from change record */
216382 ** time control flows to here they have already been called once from
216629 ** This function is only called from within a pre-update handler for a
216672 ** blob each time a NULL value is read from the "idx" column of the
216808 ** This function is only called from with a pre-update-hook reporting a
217414 /* Unlink the session from the linked list of sessions attached to the
217523 /* The value of SESSION_MAX_BUFFER_SZ is copied from the implementation
217690 int iCol, /* Column to read value from */
217899 ** Formulate and prepare a SELECT statement to retrieve a row from table
217954 ** Bind the PRIMARY KEY values from the change passed in argument pChange
217962 sqlite3_stmt *pSelect, /* SELECT from sessionSelectStmt() */
218498 ** Deserialize a single record from a buffer in memory. See "RECORD FORMAT"
218510 ** from the corresponding position in the record. If that value is not
218834 ** is currently completely empty. This block shifts the PK fields from
218915 ** from a changeset iterator. It may only be called after changeset_next()
219026 sqlite3_value **ppValue /* OUT: Value from conflicting row */
219178 /* Write the new old.* record. Consists of the PK columns from the
219179 ** original old.* record, and the other values from the original
219187 ** from the original old.* record, except for the PK columns, which
219466 ** Formulate a statement to DELETE a row from database db. Assuming a table
219640 ** sqlite3_value_text() or sqlite3_value_blob() (perhaps from within
219649 ** transfers new.* values from the current iterator entry to statement
219652 ** New.* value $i from the iterator is bound to variable ($i+1) of
219653 ** statement pStmt. If parameter abPK is NULL, all values from 0 to (nCol-1)
219656 ** which abPK[$i] is true are read from the iterator and bound to the
219662 sqlite3_changeset_iter *pIter, /* Iterator to read values from */
219695 ** This function binds the primary key values from the change that changeset
219706 ** If the iterator currently points to an INSERT record, bind values from the
219708 ** UPDATE, bind values from the old.* record.
219714 sqlite3_stmt *pSelect /* SELECT statement from sessionSelectRow() */
219736 ** This function is called from within sqlite3changeset_apply_v2() when
220052 sqlite3_changeset_iter *pIter, /* Changeset iterator to read change from */
220663 sqlite3_changeset_iter *pIter, /* Iterator to read from */
220734 /* Search for existing entry. If found, remove it from the hash table.
220986 ** each field that is undefined in a1[], swap in the field from a2[].
221456 ** are numbered starting from zero.
221470 ** Phrase matches are numbered starting from zero, so the iIdx argument
221703 ** or removed from the FTS table. The tokenizer is being invoked to
221704 ** determine the set of tokens to add to (or delete from) the
221727 ** of the first byte of and first byte immediately following the text from
222077 ** be gleaned from the CREATE VIRTUAL TABLE statement.
222079 ** And all information loaded from the %_config table.
222130 /* Values loaded from the %_config table */
222385 ** Insert or remove data to or from the index. Each time a document is
222386 ** added to or removed from the index, this function is called one or more
222398 const char *pToken, int nToken /* Token to add or remove to or from index */
222408 i64 iDocid /* Docid to add or remove data from */
222445 ** Return the total number of entries read from the %_data table by
222533 const char *pToken, int nToken /* Token to add or remove to or from index */
222804 /* This file is automatically generated by Lemon from input grammar
222823 ** the value of the %name directive from the grammar. Otherwise, the content
222827 ** The following is the concatenation of all %include directives from the
222830 /************ Begin %include sections from the grammar ************************/
222915 ** sqlite3Fts5ParserARG_FETCH Code to extract %extra_argument from fts5yypParser
223285 fprintf(fts5yyTraceFILE,"%sStack grows from %d to %d entries.\n",
223361 ** deletions is derived from the %destructor and/or %token_destructor
223374 ** when the symbol is popped from the stack during a
223421 ** is popped from the stack, then call it.
223439 ** Clear all secondary memory allocations from the parser
223772 ** only called from one place, optimizing compilers will in-line it, which
224038 ** The first argument is a pointer to a structure obtained from
224923 const double k1 = 1.2; /* Constant "k1" from BM25 formula */
224924 const double b = 0.75; /* Constant "b" from BM25 formula */
225252 int rc = 0; /* Initialized only to suppress erroneous warning from Clang */
225810 ** Gobble up the first bareword or quoted word from the input buffer zIn.
225826 const char *zIn, /* Buffer to gobble string/bareword from */
226402 ** Functions generated by lemon from fts5parse.y.
226522 ** Read the first token from the nul-terminated string at *pz.
227016 const u8 *a, int n, /* Buffer to read position list from */
228199 Fts5ExprPhrase *pOrig; /* The phrase extracted from pExpr */
228432 ** Otherwise, a copy of (*pOrig) is made into memory obtained from
228451 ** Remove from colset pColset any columns that are not also in colset pMerge.
229691 const char *pToken, int nToken /* Token to add or remove to or from index */
229879 ** Extract all tokens from hash table iHash and link them into a list
230089 ** Then, for each level from 0 to nMax:
230093 ** + for each segment from oldest to newest:
230102 ** from left to right, the total number of tokens in the column for all
230230 ** sequentially starting from 1.
230253 ** Each time a blob is read from the %_data table, it is padded with this
230408 ** Leaf page number containing the last term read from the segment. And
230444 /* The page and offset from which the current term was read. The offset
230493 ** segments that this object is merging data from. Both the aSeg[] and
230634 ** Retrieve a record from the %_data table.
230915 /* Read the total number of levels and segments from the start of the
231676 u8 *a = pIter->pLeaf->p; /* Buffer to read data from */
231709 u8 *a = pIter->pLeaf->p; /* Buffer to read data from */
232251 ** doclist-index from disk and initialize an iterator at (pIter->pDlidx).
233321 ** and there are 100 or more columns. Also called as a fallback from
233445 ** is zero or greater, data from the first nSegment segments on level iLevel
234223 /* All keys from this input segment have been transfered to the output.
234295 int iLvl, /* Level to read input from */
234349 /* Read input from all segments in the input level */
234409 /* Remove the redundant segments from the %_data table */
234414 /* Remove the redundant segments from the input level */
234456 /* Set iBestLvl to the level to read input segments from. */
234784 /* Iterate through all segments, from oldest to newest. Add them to
235111 /* Merge data from two or more poslists */
235189 /* Copy poslist from pHead to output */
235206 Fts5Index *p, /* Index to read from */
235240 Fts5Iter *p1 = 0; /* Iterator used to gather data from index */
235513 ** Insert or remove data to or from the index. Each time a document is
235514 ** added to or removed from the index, this function is called one or more
235526 const char *pToken, int nToken /* Token to add or remove to or from index */
235710 ** Read and decode the "averages" record from the database.
235746 ** Return the total number of blocks this module has read from the %_data
235825 int iSegid, /* Segment id to load from */
235968 ** a time, and the multi-iter loop from which this function is called
236114 /* If the leaf in question has already been trimmed from the segment,
236267 ** variable cksum2) based on entries extracted from the full-text index
236279 i64 iPos = 0; /* Position read from poslist */
236324 ** Decode a segment-data rowid from the %_data table. This function is
236328 i64 iRowid, /* Rowid from %_data table */
236449 ** The return value is the number of bytes read from the input buffer.
236469 ** The return value is the number of bytes read from the input buffer.
236514 const u8 *pData, int nData /* Data to decode list-of-rowids from */
236599 Fts5Buffer term; /* Current term read from page */
236647 Fts5Buffer term; /* Current term read from page */
236650 int iPgidxPrev = 0; /* Previous value read from pgidx */
236944 Fts5Table p; /* Public class members from fts5Int.h */
236947 Fts5Cursor *pSortCsr; /* Sort data from this cursor */
237001 /* Zero from this point onwards on cursor reset */
237012 /* "rank" function. Populated on demand from vtab.xColumn(). */
237338 ** idxStr is used to encode data from the WHERE clause. For each argument
237619 /* Remove the cursor from the Fts5Global.pCsr list */
237831 ** And since the statement required here reads from this very virtual
238507 (nArg>1 ? "UPDATE" : "DELETE from"), pConfig->zName
239240 ** as it can be derived from the total size of the blob.
239296 ** This is the xColumn method, called by SQLite to request a value from
239300 sqlite3_vtab_cursor *pCursor, /* Cursor to retrieve value from */
239302 int iCol /* Index of column to read value from */
240153 sqlite3_stmt *pSeek = 0; /* SELECT to read row iDel from %_data */
240237 ** Load the contents of the "averages" record from disk into the
240282 ** Remove a row from the FTS table.
240748 ** Obtain an SQLite statement handle that may be used to read data from the
240794 const u8 *aBlob, int nBlob /* Record to read varints from */
240865 ** rows. However this function is only called from the xRowCount() API,
241105 ** from the sqlite3 source file utf.c. If this file is compiled as part
241386 u32 iCode; /* non-ASCII codepoint read from input */
243139 ** This is a copy of the sqlite3GetVarint32() routine from the SQLite core.
243218 ** Read a 64-bit variable-length integer from memory starting at p[0].
243262 /* CSE1 from below */
243340 /* CSE2 from below */
243984 i64 iPos = 0; /* 64-bit position read from poslist */
244145 sqlite3_vtab_cursor *pCursor, /* Cursor to retrieve value from */
244147 int iCol /* Index of column to read value from */