Home | History | Annotate | Download | only in dist

Lines Matching refs:FROM

2 ** This file is an amalgamation of many separate C source files from SQLite
236 ** if experience from use "in the wild" suggest such changes are prudent.
239 ** from comments in this file. This file is the authoritative source
252 ** Make sure we can call this stuff from C++.
312 ** be larger than the release from which it is derived. Either Y will
372 ** compile time. ^The SQLITE_ prefix may be omitted from the
379 ** prefix is omitted from any strings returned by
406 ** to use SQLite concurrently from more than one thread.
425 ** sqlite3_config(). In other words, the return value from sqlite3_threadsafe()
522 ** from [sqlite3_open()], [sqlite3_open16()], or
561 ** from [sqlite3_malloc()] and passed back through the 5th parameter.
575 ** callback is an array of pointers to strings obtained as if from
581 ** from [sqlite3_column_name()].
611 ** Many SQLite functions return an integer result code from the set shown
646 #define SQLITE_NOTICE 27 /* Notifications from sqlite3_log() */
647 #define SQLITE_WARNING 28 /* Warnings from sqlite3_log() */
1089 ** final bottom-level VFS are written into memory obtained from
1107 ** of the char** argument point to a string obtained from [sqlite3_mprintf()]
1141 ** written into memory obtained from [sqlite3_malloc()]. The caller should
1273 ** from xFullPathname() with an optional suffix added.
1386 ** varies from one VFS to another, and from one version of the same VFS to the
1389 ** from one release to the next. Applications must not attempt to access
1518 ** is not. The sqlite3_shutdown() interface must only be called from a
1649 ** order to verify that SQLite recovers gracefully from such
1653 ** malloc(), realloc() and free() functions from the standard C library.
1658 ** previously obtained from xMalloc or xRealloc. The allocated size
1678 ** xShutdown method is only called from [sqlite3_shutdown()] so it does
1711 ** should check the return code from [sqlite3_config()] to make sure that
1723 from its default
1796 ** aligned memory buffer from which the scratch allocations will be
1829 ** ^It is harmless, apart from the wasted memory,
1868 ** the entire mutexing subsystem is omitted from the build and hence calls to
1881 ** the entire mutexing subsystem is omitted from the build and hence calls to
2051 ** should check the return code from [sqlite3_db_config()] to make sure that
2255 ** ^It is safe to call this routine from a thread different from the
2309 ** then the return value from sqlite3_complete16() will be non-zero
2414 ** complete query results from one or more queries.
2463 ** After the application has finished with the result from sqlite3_get_table(),
2492 ** from the standard C library.
2495 ** Note that some of the more obscure formatting options from recent
2496 ** C-library standards are omitted from this implementation.
2499 ** results into memory obtained from [sqlite3_malloc()].
2505 ** ^(The sqlite3_snprintf() routine is similar to "snprintf()" from
2509 ** first two parameters is reversed from snprintf().)^ This is an
2532 ** string from the argument list. But %q also doubles every '\'' character.
2625 ** was not obtained from sqlite3_malloc() or sqlite3_realloc().
2647 ** ^If X is a memory allocation previously obtained from sqlite3_malloc(),
2677 ** must be either NULL or else pointers obtained from a prior
2732 ** seeded using randomness obtained from the xRandomness method of
2786 ** SQL statements from an untrusted source, to ensure that the SQL statements
2796 ** Applications that need to process SQL from untrusted sources
2838 ** returned from the [sqlite3_vtab_on_conflict()] interface.
2859 ** the access attempt or NULL if this access attempt is directly from
3070 ** with a '/' (meaning that the authority section is omitted from the URI)
3101 ** or writes from disk is used. ^It is an error to specify a value for
3260 ** then the return value from sqlite3_errcode() is undefined.
3444 ** The first argument, "db", is a [database connection] obtained from a
3455 ** number of bytes read from zSql. ^If nByte is zero, then no prepared
3570 ** SELECT eval('DELETE FROM t1') FROM t2;
3594 ** [SQLITE_DONE] from [sqlite3_step(S)]) nor
3623 ** protected sqlite3_value from an unprotected sqlite3_value.
3687 ** a pointer to the [sqlite3_stmt] object returned from
3738 ** from the encoding specified by the sixth parameter, then the behavior
3843 ** was prepared from UTF-16 text using [sqlite3_prepare16_v2()].
3892 ** (for example during a conversion from UTF-8 to UTF-16) then a
3897 ** then the name of the column is unspecified and may change from
3932 ** or column that query result column was extracted from.
3974 ** SELECT c1 + 1, c1 FROM t1;
4047 ** [sqlite3_reset()] would result in an [SQLITE_MISUSE] return from
4123 ** CAPI3REF: Result Values From A Query
4130 ** that was returned from [sqlite3_prepare_v2()] or one of its variants)
4145 ** are called from a different thread while any of these routines
4184 ** value from sqlite3_column_blob() for a zero-length BLOB is a NULL pointer.
4209 ** <tr><td> INTEGER <td> FLOAT <td> Convert from integer to float
4269 ** from [sqlite3_column_blob()], [sqlite3_column_text()], etc. into
4531 ** extract values from the [sqlite3_value] objects.
4555 ** from [sqlite3_value_blob()], [sqlite3_value_text()], or
4560 ** These routines must be called from the same thread as
4582 ** information can be used to pass a limited amount of context from
4587 ** from the result of one [application-defined SQL function] into the
4603 ** previously obtained from [sqlite3_value_dup()]. ^If V is a NULL pointer
4627 ** first time from within xFinal().)^
4649 ** This routine must be called from the same thread in which
4664 ** This routine must be called from the same thread in which
4704 ** calls to sqlite3_get_auxdata(C,N) return P from the most recent
4727 ** values and [parameters] and expressions composed from the same.)^
4729 ** These routines must be called from the same thread in which
4767 ** ^The sqlite3_result_blob() interface sets the result from
4776 ** ^The sqlite3_result_double() interface sets the result from
4785 ** message string from sqlite3_result_error() as UTF-8. ^SQLite
4786 ** interprets the string from sqlite3_result_error16() as UTF-16 in native
4792 ** bytes (not characters) from the 2nd parameter as the error message.
4827 ** ^SQLite takes the text result from the application from
4830 ** is negative, then SQLite takes result text from the 2nd parameter
4852 ** then SQLite makes a copy of the result into space obtained from
4853 ** from [sqlite3_malloc()] before it returns.
4865 ** If these routines are called from within the different thread
4897 ** the result from the [application-defined SQL function] with
4980 ** This is different from every other SQLite interface. The inconsistency
5111 ** requested from the operating system is returned.
5116 ** all, then the behavior of sqlite3_sleep() may deviate from the description
5131 ** Applications are strongly discouraged from using this global variable.
5148 ** it to point to memory obtained from [sqlite3_malloc]. ^Furthermore,
5150 ** that this variable points to is held in memory obtained from
5154 ** made NULL or made to point to memory obtained from [sqlite3_malloc]
5205 ** it to point to memory obtained from [sqlite3_malloc]. ^Furthermore,
5207 ** that this variable points to is held in memory obtained from
5211 ** made NULL or made to point to memory obtained from [sqlite3_malloc]
5313 ** return the P argument from the previous call of the same function
5332 ** ^The rollback hook is invoked on a rollback that results from a commit
5388 ** returns the P argument from the previous call
5458 ** memory as possible from database connection D. Unlike the
5480 ** ^The return value from sqlite3_soft_heap_limit64() is the size of
5499 ** <li> The page cache allocates from its own memory pool supplied
5501 ** from the heap.
5594 ** ^This function causes all database schemas to be read from disk and
5614 ** ^This interface loads an SQLite extension library from the named file.
5629 ** characters in the filename from the last "/" to the first following
5636 ** obtained from [sqlite3_malloc()]. The calling function
5648 const char *zProc, /* Entry point. Derived from zFile if 0 */
5690 ** point to an appropriate error message (obtained from [sqlite3_mprintf()])
5800 ** pass information into and receive the reply from the [xBestIndex]
5838 ** ^The orderByConsumed means that output from [xFilter]/[xNext] will occur in
5897 char *idxStr; /* String, possibly obtained from sqlite3_malloc */
5979 ** string obtained from [sqlite3_mprintf()] to zErrMsg. The method should
5988 char *zErrMsg; /* Error message from sqlite3_mprintf() */
6077 ** SELECT zColumn FROM zDb.zTable WHERE [rowid] = iRow;
6215 ** CAPI3REF: Read Data From A BLOB Incrementally
6218 ** ^(This function is used to read data from an open [BLOB handle] into a
6220 ** from the open BLOB, starting at offset iOffset.)^
6222 ** ^If offset iOffset is less than N bytes from the end of the BLOB,
6228 ** ^An attempt to read from an expired [BLOB handle] fails with an
6247 ** ^(This function is used to write data into an open [BLOB handle] from a
6248 ** caller-supplied buffer. N bytes of data are copied from the buffer Z
6263 ** ^If offset iOffset is less than N bytes from the end of the BLOB,
6556 ** The set of static mutexes may change from one SQLite release to the
6617 ** an incorrect zDbName and an SQLITE_ERROR return from the underlying
6639 ** operate consistently from one release to the next.
6793 ** New status parameters may be added from time to time.
6813 ** is an integer constant, taken from the set of
6839 ** might be discontinued. Applications should check the return code from
6948 ** ^(This interface is used to retrieve and reset counter values from
7076 ** xShutdown method is only called from [sqlite3_shutdown()] so it does
7155 ** then the page must be evicted from the cache.
7247 ** for copying in-memory databases to or from persistent files.
7256 ** preventing other database connections from
7310 ** from source to destination, then it returns [SQLITE_DONE].
7378 ** ^A return of [SQLITE_BUSY] or [SQLITE_LOCKED] from sqlite3_backup_step()
7403 ** from within other threads.
7465 ** callback is invoked from within the [sqlite3_step] or [sqlite3_close]
7472 ** from within the call to sqlite3_unlock_notify().)^
7489 ** any sqlite3_xxx API functions from within an unlock-notify callback, a
7597 ** nothing to prevent an application from calling sqlite3_log(), doing so
7668 ** from SQL.
7724 ** database writer and all readers are reading from the most recent database
7733 ** until all readers are reading from the database file only. ^This ensures
7734 ** that the next writer will restart the log file from the beginning.
7766 ** checkpoint operation proceeds from that point in the same way as
7793 ** from SQL.
7877 ** This function may only be called from within a call to the [xUpdate] method
7895 ** return value from the [sqlite3_set_authorizer()] callback and that
7927 ** query planner's estimate for the average number of rows output from each
7977 ** Loops are numbered starting from zero. ^If idx is out of range - less than
8058 ** SELECT ... FROM <rtree> WHERE <rtree col> MATCH $zGeom(... params ...)
8084 ** SELECT ... FROM <rtree> WHERE <rtree col> MATCH $zQueryFunc(... params ...)
8105 void *pContext; /* pContext from when function registered */
8236 ** are numbered starting from zero.
8245 ** Phrase matches are numbered starting from zero, so the iIdx argument
8262 ** ... FROM ftstable WHERE ftstable MATCH $p ORDER BY rowid
8322 ** SELECT count(*) FROM ftstable;
8430 ** or removed from the FTS table. The tokenizer is being invoked to
8431 ** determine the set of tokens to add to (or delete from) the
8454 ** of the first byte of and first byte immediately following the text from
8907 ** integers to pointers. The way you do this varies from one compiler
8914 ** that vary from one machine to the next.
8916 ** Ticket #3860: The llvm-gcc-4.2 compiler from Apple chokes on
9126 ** expressions could be omitted from the code completely. But they
9519 # define SQLITE_TEMP_STORE_xc 1 /* Exclude from ctime.c */
9794 # define SQLITE_MAX_MMAP_SIZE_xc 1 /* exclude from ctime.c */
9804 # define SQLITE_DEFAULT_MMAP_SIZE_xc 1 /* Exclude from ctime.c */
9842 ** callback is currently invoked only from within pager.c.
9885 ** pointer will work here as long as it is distinct from SQLITE_STATIC
9893 ** All variables must either be on the stack or dynamically allocated from
10378 #define P4_DYNAMIC (-1) /* Pointer to a string obtained from sqliteMalloc() */
10386 #define P4_MPRINTF (-11) /* P4 is a string obtained from sqlite3_mprintf() */
10858 #define PAGER_GET_NOCONTENT 0x01 /* Do not load data from disk */
11093 SQLITE_PRIVATE void sqlite3PcacheDrop(PgHdr*); /* Remove page from cache */
11110 /* Clear flags from pages of the page cache */
11146 /* Free up as much memory as possible from the page cache */
11337 ** A PENDING_LOCK is obtained by locking a designated byte different from
11349 ** SHARED_SIZE is the number of bytes available in the pool from which
11618 u8 bMalloced; /* True if pStart obtained from sqlite3_malloc() */
11879 ** than being distinct from one another.
12157 ** immediately. Instead, they are moved from the Table.pVTable list to
12197 LogEst nRowLogEst; /* Estimated rows in table - from sqlite_stat1 table */
12239 ** table support is omitted from the build.
12256 ** A foreign key is associated with two tables. The "from" table is
12266 ** For foreign key "fk1", the from-table is "ex1" and the to-table is "ex2".
12269 ** from-table == child-table
12273 ** which is attached to the from-table. The to-table need not exist when
12274 ** the from-table is created. The existence of the to-table is not checked.
12303 ** fails and any prior changes from that one operation are backed out,
12412 ** generate VDBE code (as opposed to parsing one read from an sqlite_master
12422 LogEst *aiRowLogEst; /* From ANALYZE: Est. rows selected by each column */
12512 ** from source tables rather than from accumulators */
12601 ** If the Expr is of type OP_Column, and the table it is selecting from
12682 #define EP_Static 0x008000 /* Held in memory not obtained from malloc() */
12744 ** form is used for name resolution with nested FROM clauses.
12803 ** Changing this from a 64-bit to a 32-bit type limits the number of
12821 ** The following structure describes the FROM clause of a SELECT statement.
12822 ** Each table or subquery in the FROM clause is a separate element of
12840 int nSrc; /* Number of tables or subqueries in the FROM clause */
12869 char *zIndexedBy; /* Identifier from "INDEXED BY <zIndex>" clause */
12908 /* Allowed return values from sqlite3WhereIsDistinct()
12919 ** be NULL. The pSrc corresponds to the FROM clause of a SELECT or
12992 SrcList *pSrc; /* The FROM clause */
13014 #define SF_HasTypeInfo 0x0040 /* FROM subqueries have Table metadata */
13016 #define SF_Values 0x0100 /* Synthesized from VALUES clause */
13018 #define SF_NestedFrom 0x0400 /* Part of a parenthesized FROM clause */
13033 ** SRT_Except Remove results from the temporary index pDest->iSDParm.
13090 #define SRT_Except 2 /* Remove result from a UNION index */
13163 Trigger *pTrigger; /* Trigger this program was coded from */
13209 int rc; /* Return code from execution */
13408 * zTarget -> Dequoted name of the table to delete from.
13455 char *zBase; /* A base allocation. Not from malloc. */
13467 ** from sqlite3Init and OP_ParseSchema into the sqlite3InitCallback.
13568 SrcList *pSrcList; /* FROM clause */
13581 ** Return code from the parse-tree walking primitives and their
13717 ** obtain space from malloc().
14398 ** Allowed return values from sqlite3FindInIndex()
14783 ** from the comments following the "case OP_xxxx:" statements in
15300 ** entries or retrieve the key or data from the entry that the cursor
15363 ** these values are copied back to the Vdbe from the VdbeFrame structure,
15384 i64 *anExec; /* Event counters from parent frame */
15466 #define MEM_Cleared 0x0100 /* NULL set by OP_Null, not from data */
15487 ** Clear any existing type flags from a Mem and replace them with f
16291 ** Convert from YYYY-MM-DD HH:MM:SS to julian day. We always assume
16426 ** Compute the Year, Month, and Day from the julian day number.
16452 ** Compute the Hour, Minute, and Seconds from the julian day number.
17248 ** from within OsOpen()), but some third-party implementations may.
17559 ** Unlink a VFS from the linked list
17925 ** Like free() but works for allocations obtained from sqlite3MemMalloc()
17944 ** Report the allocated size of a prior return from xMalloc()
17960 ** Like realloc(). Resize an allocation previously obtained from
18122 ** to back up from the allocation pointer to find the MemBlockHdr. The
18562 fprintf(out, "**** %lld bytes at %p from %s ****\n",
18620 ** before calling sqlite3_initialize() from which allocations
18747 ** Unlink the chunk at mem3.aPool[i] from list it is currently
18767 ** Unlink the chunk at index i from
19310 ** before calling sqlite3_initialize() from which allocations
19326 ** 3. New memory is allocated from the first available free block.
19437 ** Unlink the chunk at mem5.aPool[i] from list it is currently
19573 ** or retains a value from a previous allocation */
19660 ** The outer layer memory allocator prevents this routine from
19673 ** The outer layer memory allocator prevents this routine from
19676 ** nBytes is always a value obtained from a prior call to
19741 ** to prevent multiple threads from entering at the same time.
20514 ** separate processes cannot read different values from the same
20557 ** separate processes cannot read different values from the same
21262 ** first doing some #defines that prevent SQLite from building on Win98.
21396 ** being freed came from pScratch) and a pointer to the list of
21639 ** Each thread may only have a single outstanding allocation from
21707 /* Release memory from the SQLITE_CONFIG_SCRATCH allocation */
21738 ** TRUE if p is a lookaside memory allocation from db
21749 ** Return the size of a memory allocation previously obtained from
21780 ** Free memory previously obtained from sqlite3Malloc().
22037 ** Make a copy of a string in memory obtained from sqliteMalloc(). These
22116 ** The "printf" code that follows dates from the 1980's. It is in
22122 ** routines format strings much like the printf() from the standard C
22258 ** Extra argument values from a PrintfArguments object
22931 ** Append N bytes of text from z to the StrAccum object. Increase the
23010 ** Print into memory obtained from sqliteMalloc(). Use the internal
23029 ** Print into memory obtained from sqliteMalloc(). Use the internal
23042 ** Print into memory obtained from sqlite3_malloc(). Omit the internal
23066 ** Print into memory obtained from sqlite3_malloc()(). Omit the internal
23088 ** from the snprintf() standard. Unfortunately, it is too late to change
23119 ** We house it in a separate routine from sqlite3_log() to avoid using
23298 sqlite3TreeViewLine(pView, "FROM");
24212 const unsigned char **pz /* Pointer to string from which to read char */
24271 ** differently from the others.
24295 /* When converting from UTF-16, the maximum growth results from
24303 /* When converting from UTF-8 to UTF-16 the maximum growth is caused
24315 ** from sqlite3_malloc().
24477 ** Memory to hold the UTF-8 string is obtained from sqlite3_malloc and must
24524 ** This routine is called from the TCL test function "translate_selftest".
24656 ** point precision mode other than /fp:precise. From the MSDN
24783 ** brackets from around identifiers. For example: "[a-b-c]" becomes
24934 /* copy digits from after decimal to significand
25202 ** This is different from sqlite3Atoi64() which requires the
25260 ** Return a 32-bit integer value extracted from a string. If the
25349 ** Read a 64-bit variable-length integer from memory starting at p[0].
25393 /* CSE1 from below */
25471 /* CSE2 from below */
25512 ** Read a 32-bit variable-length integer from memory starting at p[0].
25714 ** binary value has been obtained from malloc and must be freed by
26008 /* Remove all entries from a hash table. Reclaim all memory.
26150 /* Remove a single entry from the hash table given a pointer to that
26155 HashElem* elem, /* The element to be removed from the pH */
26210 ** element corresponding to "key" is removed from the hash table.
26623 int lastErrno; /* The unix errno from last I/O error */
26644 unsigned fsFlags; /* cached details from statfs() */
26671 /* This variable holds the process id (pid) from when the xRandomness()
26672 ** method was called. If xOpen() is called from a different process id,
26680 #define UNIXFILE_EXCL 0x01 /* Connections from one process only */
26899 ** Define various macros that are missing from some systems.
26958 ** log if they come from non-root processes. So avoid calling fchown() if
27286 ** Helper function for printing out trace information from debugging
27618 ** But not so. Since both locks came from the same process, the
27744 ** errno and, if possible, the human-readable equivalent from strerror() or
27760 char *zErr; /* Message from strerror() or equivalent */
27816 ** So we don't even try to recover from an EINTR. Just log the error
28074 ** If the pFile was opened read/write from unix-excl, then the only lock
28128 ** transitions leaving the lock state different from what it started but
28154 ** byte'. If this is successful, a random byte from the 'shared byte
28177 ** locking a random byte from a range, concurrent SHARED locks may exist
28203 ** (1) We never move from unlocked to anything higher than shared lock.
28333 ** transitioning from a SHARED to a RESERVED lock. The change
28334 ** from SHARED to RESERVED marks the beginning of a normal
28438 int tErrno; /* Error code from system call errors */
28687 ** connections from reading or writing the database.
28752 ** transitions leaving the lock state different from what it started but
28976 ** transitions leaving the lock state different from what it started but
28988 ** above are really EXCLUSIVE locks and exclude all other processes from
29153 ** transitions leaving the lock state different from what it started but
29165 ** above are really EXCLUSIVE locks and exclude all other processes from
29403 ** transitions leaving the lock state different from what it started but
29438 ** (1) We never move from unlocked to anything higher than shared lock.
29772 ** be necessary to define _XOPEN_SOURCE to be 500. This varies from
29829 ** Read data from a file into a buffer. Return SQLITE_OK if all
29856 ** data from the memory mapping using memcpy(). */
29887 ** absolute offset iOff, then attempt to write nBuf bytes of data from
29895 const void *pBuf, /* Copy data from this buffer to the file */
29944 ** Write data from a buffer into a file. Return SQLITE_OK on success
29991 ** data from the memory mapping using memcpy(). */
30218 /* Unix cannot, but some systems may return SQLITE_FULL from here. This
30280 ** when restoring a database using the backup API from a zero-length
30291 ** use read() and write() to access data beyond this point from now on.
30587 /* full bitset of atomics from max sector size and smaller */
30595 /* full bitset of atomics from max sector size and smaller */
30742 ** Apply posix advisory locks for all bytes from ofst through ofst+n-1.
30880 ** from the database file is used, then differing access permissions
31011 ** the cover of the unixEnterMutex() mutex and the pointer from the
31034 ** are numbered starting from zero. Each shared-memory region is szRegion
31183 ** different here than in posix. In xShmLock(), one can go from unlocked
31184 ** to shared and back or from unlocked to exclusive and back. But one may
31185 ** not go from shared to exclusive or from exclusive to shared.
31332 /* Remove connection p from the set of connections associated
31605 ** strategy from that.
31617 ** from be cast into a function pointer.
32175 ** vxworks would not benefit from the change (it might, we're not sure),
32251 ** the path to the associated database file from zPath. This block handles
32764 /* We have to initialize zBuf to prevent valgrind from reporting
32803 ** requested from the underlying operating system, a number which
32974 ** actual proxy file name is generated from the name and path of the
33161 ** Create a new VFS file descriptor (stored in memory obtained from
33633 ** from the conch file or the path was allocated on the stack
33685 ** Store the conch filename in memory obtained from sqlite3_malloc64().
33984 ** transitions leaving the lock state different from what it started but
34094 ** should be the only routines in this file that are visible from other
34107 ** silly C90 rules prohibit a void* from being cast to a function pointer
34439 # error "WAL mode requires support from the Windows NT kernel, compile\
34444 # error "Memory mapped files require support from the Windows NT kernel,\
34659 DWORD lastErrno; /* The Windows errno from the last I/O error */
35649 ** being held by us, no other function (i.e. from another thread) should
36013 ** Space to hold the returned string is obtained from malloc.
36038 ** obtained from sqlite3_malloc().
36066 ** from sqlite3_malloc.
36095 ** Space to hold the returned string is obtained from
36122 ** returned string is obtained from sqlite3_malloc().
36139 ** returned string is obtained from sqlite3_malloc().
36278 ** error code and, if possible, the human-readable equivalent from
36464 /* Replace the backslashes from the filename and lowercase it
36908 ** Read data from a file into a buffer. Return SQLITE_OK if all
36913 sqlite3_file *id, /* File to read from */
36922 DWORD nRead; /* Number of bytes actually read from file */
36935 ** data from
36989 ** Write data from a buffer into a file. Return SQLITE_OK on success
37013 ** data from the memory mapping using memcpy(). */
37134 ** use read() and write() to access data beyond this point from now on.
37182 /* Unix cannot, but some systems may return SQLITE_FULL from here. This
37388 ** transitions leaving the lock state different from what it started but
37404 int rc = SQLITE_OK; /* Return code from subroutines */
37836 winFile hFile; /* File handle from winOpen */
37841 HANDLE hMap; /* File handle from CreateFileMapping */
37844 DWORD lastErrno; /* The Windows errno from the last I/O error */
38079 ** the cover of the winShmEnterMutex() mutex and the pointer from the
38119 /* Remove connection p from the set of connections associated
38267 ** are numbered starting from zero. Each shared-memory region is szRegion
38685 ** Convert a filename from whatever the underlying operating system
38687 ** obtained from malloc and must be freed by the calling function.
38707 ** is obtained from malloc and must be freed by the calling
39163 /* Reports from the internet are that performance is always
39492 ** non-zero is returned from this function, the calling function must simply
39621 ** character, discard the initial "/" from the pathname.
40363 ** There are 6 opcodes numbered from 0 through 5. 0 is the
40371 ** 5 N S X Set N bits from S increment X in array only, not in bitvec
40374 ** on both a Bitvec object and on a linear array of bits obtained from malloc.
40498 #define PCACHE_DIRTYLIST_REMOVE 1 /* Remove pPage from dirty list */
40505 ** remove pPage from the dirty list. The 0x02 means add pPage back to
40668 ** Try to obtain a page from the cache.
40692 PCache *pCache, /* Obtain the page from this cache */
40729 PCache *pCache, /* Obtain the page from this cache */
40778 PCache *pCache, /* Obtain the page from this cache */
40804 PCache *pCache, /* Obtain the page from this cache */
40848 ** Drop a page from the cache. There must be exactly one reference to the
40904 ** Clear the PGHDR_NEED_SYNC flag from all dirty pages.
41107 ** Free up as much memory as possible from the page cache.
41179 ** using a separate memory allocation from the database page content. This
41193 ** Memory for a page might come from any of three sources:
41236 u8 isBulkLocal; /* This page from bulk local storage */
41258 ** unused pages from other PCaches) but it also operates without a mutex,
41377 ** This routine is called from sqlite3_initialize() and so it is guaranteed
41440 ** Malloc function used within this file to allocate space from the buffer
41466 ** it from sqlite3Malloc instead.
41484 ** Free an allocated buffer obtained from pcache1Alloc().
41604 ** Malloc function used by SQLite to obtain space from the buffer configured
41613 ** Free an allocated buffer obtained from sqlite3PageMalloc().
41688 ** This function is used internally to remove the page pPage from the
41716 ** Remove the page supplied as an argument from the hash table
41759 ** Discard all pages from cache pCache with a page number (key value)
42081 ** then attempt to recycle a page from the LRU list. If it is the right
42409 ** extracts the least value from the RowSet.
42528 ** Deallocate all chunks from a RowSet. This frees all memory that
42696 ** node taken from the head of *ppList. A depth of 2 means a tree with
42699 ** Use as many entries from the input list as required and update the
42790 ** Extract the smallest element from the RowSet.
42901 ** is separate from the database file. The pager also implements file
42902 ** locking to prevent two processes from writing the same database
42903 ** file simultaneously, or one process from reading the database while
42982 /* Read a page from the write-ahead log, if it is present. */
43007 /* Copy pages from the log to the database file */
43092 ** (4) Reads from the database file are either aligned on a page boundary and
43093 ** an integer multiple of the page size in length or are taken from the
43120 ** of bytes from 24 through 39 inclusive will be changed prior to releasing
43220 ** a locking_mode=exclusive connection can transition from READER to OPEN
43234 ** The pager moves to this state from READER when a write-transaction
43263 ** A pager moves from WRITER_LOCKED state to this state when a page is
43276 ** The pager transitions from WRITER_CACHEMOD into WRITER_DBMOD state
43292 ** A rollback-mode pager changes to WRITER_FINISHED state from WRITER_DBMOD
43330 ** is reloaded from disk (and, if necessary, hot-journal rollback peformed)
43333 ** from the error.
43406 ** from ERROR to OPEN state. At this point there may be a hot-journal file
43418 ** transaction in another process, causing SQLite to read from the database
43552 ** journal file from being successfully finalized, the setMaster flag
43562 ** writing to the database from pagerStress() is disabled altogether.
43565 ** to allocate a new page to prevent the journal file from being written
43569 ** If the SPILLFLAG_NOSYNC bit is set, writing to the database from
43573 ** from happening in between the journalling of two pages on the same sector.
43665 ** or the journal_mode). From another view, these class members describe
43749 SQLITE_API int sqlite3_pager_readdb_count = 0; /* Number of full pages read from DB */
43761 ** was obtained from /dev/random. It is used only as a sanity check.
43778 ** garbage data came from an obsolete journal file, the checksums might
43944 ** a rollback transaction that switches from journal_mode=off
44077 ** Read a 32-bit integer from the given file descriptor. Store the integer
44244 ** This function attempts to read a master journal file name from the
44264 ** If an error occurs while reading from the journal file, an SQLite
44271 u32 cksum; /* MJ checksum value read from journal */
44471 ** the memory prevents valgrind from complaining, so we are willing to
44506 ** (JOURNAL_HDR_SZ bytes) is read from the current location in the journal
44514 ** is set to the value read from the journal header. SQLITE_OK is returned
44519 ** cannot be read from the journal file an error code is returned.
44525 u32 *pNRec, /* OUT: Value read from the nRec field */
44589 /* Check that the values read from the page-size and sector-size fields
44606 /* Update the page-size to match the value read from the journal.
44616 ** is being called from within pager_playback(). The local value
44806 ** out from under us.
44830 /* The pager state may be changed from PAGER_ERROR to PAGER_OPEN here
44948 int rc = SQLITE_OK; /* Error code from journal finalization operation */
44949 int rc2 = SQLITE_OK; /* Error code from db file unlock operation */
45160 ** Read a single page from either the journal file (if isMainJrnl==1) or
45161 ** from the sub-journal (if isMainJrnl==0) and playback that page.
45168 ** If the page number of the page record read from the (sub-)journal file
45178 ** If the page record is successfully read from the (sub-)journal file
45180 ** while reading the record from the (sub-)journal file or while writing
45182 ** is successfully read from the (sub-)journal file but appears to be
45187 ** * If the record is being rolled back from the main journal file
45224 ** only reads from the main journal, not the sub-journal.
45231 /* Read the page number and page data from the journal or sub-journal
45293 ** different from the page content at the start of the transaction.
45346 ** will be read from the database file, which may or may not be
45355 ** the data just read from the sub-journal. Mark the page as dirty
45381 /* If the contents of this page were just restored from the main
45388 ** back as part of a savepoint (or statement) rollback from an
45411 /* Decode the page just read from disk */
45448 ** no such child journal can be found, file zMaster is deleted from
45469 char *zMasterPtr; /* Space to hold MJ filename from a journal file */
45485 /* Load the entire master journal file into space obtained from
45488 ** journal files extracted from regular rollback-journals.
45666 ** number of page records from the journal size.
45683 ** Call the value from the second bullet "nRec". nRec is the number of
45685 ** value of nRec from the size of the journal file. But if a power
45689 ** the value of nRec computed from the file size would be too large. For
45693 ** from the file size. This value is used when the user selects the
45724 int nPlayback = 0; /* Total number of pages restored from journal */
45735 /* Read the master journal name from the journal, if it is present.
45763 /* Read the next journal header from the journal file. If there are
45805 /* If this is the first header read from the journal, truncate the
45898 sqlite3_log(SQLITE_NOTICE_RECOVER_ROLLBACK, "recovered %d pages from %s",
45917 ** the value read from the database file.
45933 /* Try to pull the page from the write-ahead log. */
46007 ** references, the page content is reloaded from the database. If the
46008 ** attempt to reload content from the database is required and fails,
46059 ** + Reload page content from the database (if refcount>0).
46105 ** They will never be read by any client. So remove them from the pDirty
46174 ** This function is called as part of the transition from PAGER_OPEN
46188 ** available from the WAL sub-system if the log file is empty or
46195 /* If the number of pages in the database is not available from the
46286 ** * Pages are played back from the main journal starting at byte
46292 ** back starting from the journal header immediately following
46295 ** * Pages are then played back from the sub-journal file, starting
46304 ** If pSavepoint is NULL, then pages are only played back from the main
46347 /* Begin by rolling back records from the main journal starting at
46394 /* Finally, rollback pages from the sub-journal. Page that were
46451 ** Free as much memory as possible from the pager.
46583 ** SQLITE_BUSY when trying to upgrade from no-lock to a SHARED lock,
46584 ** or when trying to upgrade from a RESERVED lock to an EXCLUSIVE
46585 ** lock. It does *not* invoke the busy handler when upgrading from
46586 ** SHARED to RESERVED, or when upgrading from SHARED to EXCLUSIVE
46650 ** function may be called from within PagerOpen(), before the state
46754 ** Read the first N bytes from the beginning of the file into memory
46763 ** If any IO error apart from SQLITE_IOERR_SHORT_READ is encountered,
46847 ** dirty page were to be discarded from the cache via the pagerStress()
46924 ** The new object will use the pointer pData, obtained from xFetch().
47149 ** byte to the start of it to prevent it from being recognized.
47829 /* Verify that the database file has not be deleted or renamed out from
47832 ** code from sqlite3OsAccess()) if the database has gone missing.
47855 ** This function is called after transitioning from PAGER_UNLOCK to
47867 ** exists, that is probably an old journal left over from a prior
47921 ** journal is a remnant from a prior database with the same name where
48007 /* This routine is only called from b-tree and only when there are no
48143 ** flush the cache. The hasHeldSharedLock flag prevents this from
48239 ** read from the database file. In some cases, the pcache module may
48257 ** a) When reading a free-list leaf page from the database, and
48261 ** from the savepoint journal.
48264 ** being read from the database. Additionally, the bits corresponding
48290 u32 iFrame = 0; /* Frame to read from WAL file */
48318 ** Otherwise, request the page from the PCache layer. */
48455 ** not read the page from disk. Return a pointer to the page,
48655 ** transactions may copy data from the sub-journal into the database
49378 ** current transaction are either expelled from the cache or reverted to
49379 ** their pre-transaction state by re-reading data from the database or
49786 ** the page we are moving from.
49836 ** from its hash chain. Also, if the PGHDR_NEED_SYNC flag was set for
49846 /* Do not discard pages from an in-memory database since we might
49990 /* This routine is only called from the OP_JournalMode opcode, and
50012 /* When transistioning from TRUNCATE or PERSIST to any other journal
50254 ** to switching from WAL to rollback mode.
50337 ** Each frame records the revised content of a single page from the
50347 ** frames can overwrite the old ones. A WAL always grows from beginning
50350 ** are leftovers from prior checkpoints.
50372 ** 8: Salt-1 (copied from the header)
50373 ** 12: Salt-2 (copied from the header)
50397 ** for i from 0 to n-1 step 2:
50414 ** value is randomized. This prevents old and new frames in the WAL from
50420 ** To read a page from the database (call it page number P), a reader
50425 ** frame or are followed by a commit frame, then page P is read from
50433 ** of the database from a single point in time. This technique allows
50454 ** be) reconstructed from the original WAL file. In fact, the VFS is required
50559 ** from the hash table at this point.
50629 u32 aSalt[2]; /* Two salt values copied from WAL header */
50639 ** back into the database. (We call the act of moving content from WAL to
50643 ** However, a WAL_WRITE_LOCK thread can move the value of nBackfill from
50653 ** directly from the database.
50660 ** The checkpointer may only transfer frames from WAL to database where
50669 ** get all their all content directly from the database file and ignore
50680 ** order to read from any aReadMark[] entries.
50692 ** from the region of the file on which locks are applied.
50793 int iPrior; /* Last result returned from the iterator */
50831 ** numbered from zero.
50855 /* Request a pointer to the required page from the VFS */
50894 ** architecture, it returns the u32 value that results from interpreting
50983 ** 8: Salt-1 (copied from the wal-header)
50984 ** 12: Salt-2 (copied from the wal-header)
51146 ** numbered starting from 0.
51193 ** are numbered starting from 0.
51218 ** Remove entries from the hash table that point to WAL slots greater
51321 ** Remove the remnants of that writers uncommitted transaction from
51374 ** wal-index to prevent other threads/processes from doing anything
51418 i64 iOffset; /* Next offset to read from log file */
51420 u32 magic; /* Magic value read from WAL header */
51421 u32 version; /* Magic value read from WAL header */
51476 /* Read all frames from the log file. */
51480 u32 nTruncate; /* dbsize field from frame header */
51524 /* If more than one frame was recovered from the log file, report an
51531 "recovered %d frames from WAL file %s",
51565 ** client from unlinking the WAL or wal-index file. If another process
51955 ** c) any existing readers are reading exclusively from the database
51956 ** file - there are no readers that may attempt to read a frame from
51965 ** one obtained from sqlite3_randomness()).
51983 ** Copy as much content as we can from the WAL back into the database file
51986 ** The amount of information copies from WAL to database might be limited
52051 ** cannot be backfilled from the WAL.
52281 ** If and only if the read is consistent and the header is different from
52299 ** from the file. If this happens, return non-zero.
52303 ** Memory barriers are used to prevent the compiler or the hardware from
52335 ** Read the wal-index header from the wal-index and into pWal->hdr.
52337 ** wal-index from the WAL before returning.
52450 ** completely and get all content directly from the database file.
52544 ** snapshot. Since holding READ_LOCK(0) prevents a checkpoint from
52564 ** the WAL to get at content from recent commits. The job now is
52621 ** to read any frames earlier than minFrame from the wal file - they
52622 ** can be safely read directly from the database file.
52634 ** that it can read version A from the database file. However, since
52706 u32 iRead = 0; /* If !=0, WAL frame to return data from */
52711 /* This routine is only be called from within a read transaction. */
52715 ** no data will be read from the wal under any circumstances. Return early
52731 ** table). This means the value just read from the hash
52799 ** Read the contents of frame iRead from the wal file into buffer pOut
52920 ** (if (a) is false) or simply expels the page from the cache (if (b)
53037 ** the next fsync should occur - passed from sqlite3WalFrames() into
53087 int rc; /* Result code from subfunctions */
53295 ** we can from WAL into the database.
53370 /* Copy data from the log to the database file. */
53421 ** If op is zero, then attempt to change from
53429 ** If op is one, then change from locking_mode=NORMAL into
53553 ** Finding a particular key requires reading O(log(M)) pages from the
53665 ** offsets from the beginning of the page to the cell content in the cell
53785 ** information about the page that is decoded from the raw file page.
53788 ** walk up the BTree from any leaf to the root. Care must be taken to
53835 ** Locks are added (or upgraded from READ_LOCK to WRITE_LOCK) when a cursor
53837 ** from this list when a transaction is committed or rolled back, or when
53882 Btree *pNext; /* List of other sharable Btrees from the same db */
53987 ** based on information extract from the raw disk page.
54052 MemPage *apPage[BTCURSOR_MAX_DEPTH]; /* Pages from root to current page */
54134 ** The purpose of the pointer map is to facility moving pages from one
54376 ** This routine is used only from within assert() statements.
54409 ** reset out from under us.
54478 ** If pSchema is not NULL, then iDb is computed from pSchema and
54557 ** Extract a 2-byte big-endian integer from an array of unsigned bytes.
54561 ** from the header of a btree page. If the page size is 65536 and the page
55041 ** 1) When all data is deleted from a page and the page becomes
55048 ** from the database or written to the journal file (why should it
55056 ** is extracted from the free-list and reused, then the original data
55062 ** set in the bitvec. Whenever a leaf page is extracted from the free-list,
55085 ** This function is called when a free-list leaf page is removed from the
55087 ** page from the pager layer with the 'no-content' flag set. True otherwise.
55228 ** broken out from its caller to avoid unnecessary stack pointer movement.
55335 ** Determine whether or not a cursor has moved from the position where
55338 ** from under them, for example. Cursor might also move if a btree
55353 ** a row having been deleted out from under the cursor).
55361 ** TRUE from sqlite3BtreeCursorHasMoved().
55421 int rc; /* Return code from subfunctions */
55462 ** Read an entry from the pointer map.
55827 ** EVIDENCE-OF: R-44582-60138 SQLite may from time to time reorganize a
55911 ** from the free-list.
55954 /* Remove the slot from the free-list. Update the number of
55973 ** Allocate nByte bytes of space from within the B-Tree page passed
56049 /* Allocate memory from the gap in between the cell pointer array
56250 u16 cellOffset; /* Offset from start of page to first cell pointer */
56400 ** Convert a DbPage obtained from the pager into a MemPage used by
56414 ** Get a page from the pager. Initialize the MemPage.pBt and
56442 ** Retrieve a page from the pager cache. If the requested page is not
56470 ** Get a page from the pager and initialize it.
56647 int rc = SQLITE_OK; /* Result code from this function */
56800 ** determined by the 2-byte integer located at an offset of 16 bytes from
56917 ** remove the BtShared structure from the sharing list. Return
56969 ** bytes of pTmpSpace, but that the first 4 bytes are copied from
57315 int rc; /* Result code from subfunctions */
57394 ** determined by the 2-byte integer located at an offset of 16 bytes from
57728 ** re-read the database size from page 1 if a savepoint or transaction
57892 /* Move page iDbPage from its current location to page number iFreePage */
57993 /* Remove the page from the files free-list. This is not required
58234 ** This function is called from both BtreeCommitPhaseTwo() and BtreeRollback()
58248 ** may still be reading from the database. */
58358 ** pages may be moved or deleted from the database altogether, making
58508 ** from a normal transaction rollback, as no locks are released and the
58863 ** Copy data from a buffer to a page, or from a page to a buffer.
58867 ** from pPayload to the buffer pointed at by pBuf. If eOp is true,
58869 ** of data are copied from the buffer pBuf to pPayload.
58877 int eOp, /* 0 -> copy from page, 1 -> copy to page */
58881 /* Copy data from buffer to page (a write operation) */
58888 /* Copy data from page to buffer (a read operation) */
58904 ** Data is read to or from the buffer pBuf.
58925 BtCursor *pCur, /* Cursor pointing to entry to read from */
58945 assert( eOp!=2 || offset==0 ); /* Always start from beginning for eOp==2 */
58959 /* Check if data must be read/written to/from the btree page itself. */
59062 ** 2) data is required from the start of this overflow page, and
59066 ** 6) all data from the page is being read.
59069 ** then data can be read directly from the database file into the
59166 ** Return a pointer to payload information from the entry that the
59185 BtCursor *pCur, /* Cursor pointing to entry to read from */
59211 ** including calls from other threads against the same cache.
59279 ** to the page we are coming from. If we are coming from the
59979 ** Allocate a new page from the database file.
60175 /* Extract a leaf from the trunk */
60245 ** Normally, new pages allocated by this block can be requested from the
60247 ** from trying to read the pages content from disk. However, if the
60274 TRACE(("ALLOCATE: %d from end of file (pointer-map page)\n", pBt->nPage));
60297 TRACE(("ALLOCATE: %d from end of file\n", *pPgno));
60565 ** buffer space that is separate from the pPage buffer area */
60658 ** wrong pages from the database.
60724 ** Remove the i-th cell from pPage. This routine effects pPage only.
60727 ** removes the reference to the cell from pPage.
60792 int *pRC /* Read and write return code from here */
60808 ** malformed cell from a leaf page to an interior page, if the cell size
61125 /* Remove cells from the start and end of the page */
61192 /* Unable to edit this page. Rebuild it from scratch instead. */
61271 ** with entries for the new page, and any pointer from the
61296 ** field. The second while(...) loop copies the key value from the
61394 /* Copy the b-tree node content from page pFrom to page pTo. */
61424 ** page are used in the balancing, though both siblings might come from one
61439 ** inserted into or removed from the parent page (pParent). Doing so
61513 ** is called (indirectly) from sqlite3BtreeDelete().
61524 ** either side of pPage. More siblings are taken from one side, however,
61528 ** This loop also drops the divider cells from the parent page. This
61573 /* Drop the cell from the parent page. apDiv[i] still points to
61629 ** into space obtained from aSpace1[]. The divider cells have already
61630 ** been removed from pParent.
61633 ** divider cells are stripped from the cells before they are copied
61740 ** in b.apCell[] of the cell that divides page i from page i+1.
61897 ** helps the operating system to deliver pages from the disk more rapidly.
62074 ** is important, as this code needs to avoid disrupting any page from which
62077 ** (1) If cells are moving left (from apNew[iPg] to apNew[iPg-1])
62081 ** (2) If cells are moving right (from apNew[iPg] to apNew[iPg+1])
62090 ** needs to be tested because (2) will always be true from the previous
62233 int rc; /* Return value from subprocedures */
62264 /* Copy the overflow cells from pRoot to pChild */
62566 ** from trying to save the current position of the cursor. */
62589 MemPage *pPage; /* Page to delete cell from */
62613 ** from the internal node. The 'previous' entry is used for this instead
62630 /* If this is a delete operation to remove a row from a table b-tree,
62660 ** itself from within the page. */
62669 ** by the child-page of the cell that was just deleted from an internal
62670 ** node. The cell from the leaf node needs to be moved to the internal
62696 ** pCur is pointing to the leaf page from which a cell was removed to
62697 ** replace the cell deleted from the internal node. This is slightly
62774 /* Read the value of meta[3] from the database to determine where the
62956 ** Delete all information from a single table in the database. iTable is
62988 ** Delete all information from the single table that pCur is open on.
63143 ** from the pager. The BTREE_DATA_VERSION value is not actually stored in the
63146 ** read it from this routine.
63404 "%d of %d pages missing from overflow list starting at %d",
63473 ** removes the root element from the heap (the minimum value in the heap)
63534 int rc; /* Result code from subroutine call */
63577 assert( rc==SQLITE_CORRUPT ); /* The only possible error from InitPage */
63736 ** The loop below pulls entries from the min-heap in order and compares
63786 ** allocation errors, an error message held in memory obtained from
64157 ** only used from within assert() statements
64317 ** Create an sqlite3_backup process to copy the contents of zSrcDb from
64327 sqlite3* pSrcDb, /* Database connection to read from */
64408 ** page iSrcPg from the source database. Copy this data into the
64480 /* Copy the data from the source page into the destination page.
64530 ** Copy nPage pages from the source b-tree to the destination.
64694 ** occurs, the original database will be reconstructed from the
64791 /* Detach this backup from the source pager. */
64941 ** from this function, not directly by the user.
65561 ** "aff". Casting is different from applying affinity in that a cast
65783 ** from sqlite3_value_dup() is used as the argument
65918 ** The data or key is taken from the entry that pCur is currently pointing
65924 ** pMem->zMalloc to hold the content from the btree, if possible. New
65930 ** to read from the disk) then the pMem is left in an inconsistent state.
65934 u32 offset, /* Offset from the start of data to return bytes from. */
65936 int key, /* If true, retrieve from the btree key, not data. */
65960 u32 offset, /* Offset from the start of data to return bytes from. */
65962 int key, /* If true, retrieve from the btree key, not data. */
65965 char *zData; /* Data from the btree layer */
66239 ** Extract a value from the supplied expression in the manner described
66450 ** Attempt to extract a value from pExpr and use it to construct *ppVal.
66469 Expr *pExpr, /* The expression to extract a value from */
66517 ** is 0 etc.) of the unpacked record with a value extracted from expression
66525 ** from the expression (i.e. the expression is a literal value).
66538 ** error if a value cannot be extracted from pExpr. If an error does
66545 Expr *pExpr, /* The expression to extract a value from */
66566 ** Attempt to extract a value from expression pExpr using the methods
66577 Expr *pExpr, /* The expression to extract a value from */
66585 ** Extract the iCol-th column from the nRec-byte record in pRec. Write
66993 ** Add an OP_ParseSchema opcode. This routine is broken out from
66997 ** The zWhere string must have been obtained from sqlite3_malloc().
67053 ** be inserted. The parameter "x" must have been obtained from
67199 ** from failing. */
67234 ** cases from this switch! */
67549 ** This routine is useful when a large program is loaded from a
67554 ** the string is made into memory obtained from sqlite3_malloc().
67677 ** after an OOM fault without having to check to see if the return from
68005 ** information from the vdbe.c source text */
68039 ** sqlite3MemRelease() were called from here. With -O2, this jumps
68317 ** Allocate space from a fixed size buffer and return a pointer to
68340 u8 **ppFrom, /* IN/OUT: Allocate from *ppFrom */
68407 ** the Vdbe from the Parse object that helped generate it so that the
68476 ** This two-pass approach that reuses as much memory as possible from
68514 p->aMem--; /* aMem[] goes from 1..nMem */
68515 p->nMem = nMem; /* not from 0..nMem-1 */
69072 ** This routine is the only way to move the state of a VM from
69113 int mrc; /* Primary error code from p->rc */
69340 ** virtual machine from VDBE_MAGIC_RUN or VDBE_MAGIC_HALT back to
69354 ** and error message from the VDBE into the main database structure. But
69378 /* Save profiling information from this VDBE run.
69444 ** from left to right), or
69473 ** VdbeDelete() also unlinks the Vdbe from the list of VMs associated with
69549 ** pointed to was deleted out from under it. Or maybe the btree was
69551 ** is supposed to be pointing. If the row was deleted out from under the
69566 ** if need be. Return any I/O error from the restore operation.
69578 ** prevents us from positioning the cursor to its correct position.
69582 ** deleted out from under the cursor and if it has, mark the row as
69586 ** not been deleted out from under the cursor, then this routine is a no-op.
69711 ** GCC might have just copying the problem from a prior compiler.
69820 const unsigned char *buf, /* Buffer to deserialize from */
69856 const unsigned char *buf, /* Buffer to deserialize from */
69941 ** The space is either allocated using sqlite3DbMallocRaw() or from within
69945 ** allocation comes from the pSpace/szSpace buffer, *ppFree is set to NULL
69995 u32 idx; /* Offset in aKey[] to read from */
70347 ** key must be a parsed key such as obtained from
70759 ** pCur might be pointing to text obtained from a corrupt database file.
70952 ** Transfer error message text from an sqlite3_vtab.zErrMsg (text stored
70953 from sqlite3_malloc) into a Vdbe.zErrMsg (text stored
70954 ** in memory obtained from sqlite3DbMalloc).
71077 ** back to its starting state so that it can be reused. A success code from
71125 ** The following routines extract information from a Mem or sqlite3_value
71237 /* Destroy an sqlite3_value object previously obtained from
71524 ** from interrupting a statement that has not yet started.
71606 int rc = SQLITE_OK; /* Result from sqlite3Step() */
71607 int rc2 = SQLITE_OK; /* Result from sqlite3Reprepare() */
71629 ** The error message from the SQL compiler has already been loaded
71631 ** from the database handle into the statement and sets the statement
71653 ** Extract the user data from a sqlite3_context structure and return a
71662 ** Extract the user data from a sqlite3_context structure and return a
71853 ** Return the number of values available from the current row of the
71872 ** these assert()s from failing, when building with SQLITE_DEBUG defined
71930 ** Specifically, this is called from within:
72030 ** 2 The name of the database that the column derives from
72031 ** 3 The name of the table that the column derives from
72032 ** 4 The name of the table column that the result column derives from
72118 ** Return the name of the database from which a result column derives.
72134 ** Return the name of the table from which a result column derives.
72150 ** Return the name of the table column from which a result column derives.
72455 ** Transfer all bindings from the first statement over to the second.
72476 ** It is misuse to call this routine with statements from different
72687 ** obtained from sqlite3DbMalloc(). If sqlite3.nVdbeExec is 1, then the
72846 ** in this file for details. If in doubt, do not deviate from existing
72858 ** be changed out from under the copy. This macro verifies that nothing
72948 ** iSrcLine is the source code line (from the __LINE__ macro) that
73417 ** This function is only called from within an assert() expression. It
73638 ** Do not deviate from the formatting style currently in use.
73646 ** the one at index P2 from the beginning of
73651 ** that this Goto is the bottom of a loop and that the lines from P2 down
74102 int p1; /* Register to copy from */
74334 ** Subtract the value in register P1 from the value in register P2
74360 u16 flags; /* Combined MEM_* flags from both inputs */
74470 ** defines the function) with P5 arguments taken from register P2 and
74488 ** from register P2 and successors. The result of the function is stored
74536 ** might change from one evaluation to the next. The next block of code
74706 ** This opcode is used when extracting information from a column that
74798 ** the SQLITE_NULLEQ flag were omitted from P5.
74811 ** the SQLITE_NULLEQ flag were omitted from P5.
75231 ** from this record. If there are less that (P2+1)
75266 u32 t; /* A type code from the record header */
75340 ** them, respectively. So the maximum header length results from a
75434 /* If after trying to extract new entries from the header, nHdrParsed is
75472 ** content from disk. NULL will work for the value for strings
75547 ** The mapping from character to affinity is given by the SQLITE_AFF_
75577 ** Data(0) is taken from register P1. Data(1) comes from register P1+1
75582 ** hdr-size field is also a varint which is the offset from the beginning
75894 ** VMs (apart from this one), then a ROLLBACK fails. A COMMIT fails if
75982 ** cookie in P3 differs from the schema cookie in the database header or
75983 ** if the schema generation counter in P4 differs from the current
75986 ** statement and rerun it from the beginning.
76053 /* If the schema-cookie from the database file matches the cookie
76055 ** not reload the schema from the database file.
76059 ** are queried from within xNext() and other v-table methods using
76063 ** to be invalidated whenever sqlite3_step() is called from within
76077 ** Read cookie number P3 from database P1 and write it into register P2.
76164 ** any other process from modifying the database. The read lock is
76270 /* The p2 value always comes from a prior OP_CreateTable opcode and
76437 ** row output from the sorter so that the row can be decomposed into
76503 ** from the beginning toward the end. In other words, the cursor is
76521 ** from the beginning toward the end. In other words, the cursor is
76539 ** from the end toward the beginning. In other words, the cursor is
76557 ** from the end toward the beginning. In other words, the cursor is
77210 ** no-op. As a result, in this case it is OK to delete a record from within a
77317 ** us from having to issue a separate NullRow instruction to clear that cache.
77500 ** from the end toward the beginning. In other words, the cursor is
77536 ** then rewinding that index and playing it back from beginning to
77560 ** from the beginning toward the end. In other words, the cursor is
77767 ** an unpacked index key. This opcode removes that entry from the
77825 ** out from under the cursor. That will never happend for an IdxRowid
77984 ** remove the table or index from the database file.
78020 ** Delete all contents from the ephemeral table or sorter
78091 ** Read and parse all entries from the SQLITE_MASTER table of database P1
78122 "SELECT name, rootpage, sql FROM '%q'.%s WHERE %s ORDER BY rowid",
78162 ** is dropped from disk (using the Destroy opcode) in order to keep
78175 ** is dropped from disk (using the Destroy opcode)
78188 ** is dropped from disk (using the Destroy opcode) in order to keep
78284 ** Extract the smallest value from boolean index P1 and put that value into
78300 /* A value was pulled from the index */
78565 ** different from the current frame if this instruction is being executed
78595 ** If the value of register P1 is 1 or greater, subtract P3 from the
78633 ** initially nonzero, then subtract P3 from the value in register P1 and
78687 ** The P5 arguments are taken from register P2 and its
78698 ** The P5 arguments are taken from register P2 and its
78739 ** might change from one evaluation to the next. The next block of code
78903 "cannot change %s wal mode from within a transaction",
78920 /* Cannot transition directly from MEMORY to WAL. Use mode OFF
78954 ** machines to be created and run. It may not be called from within
79046 ** Also, whether or not P4 is set, check that this is not being called from
79505 ** This opcode records information from the optimizer. It is the
79516 ** readability. From this point on down, the normal indentation rules are
80029 ** Read data from a blob handle.
80172 ** directly from main memory.
80207 ** incrementally as keys are retreived from the sorter by the VDBE. The
80214 ** begins reading keys from that PMA while the background thread proceeds
80222 ** First, T bytes of data from the first SORTER_MAX_MERGE_COUNT PMAs on
80223 ** disk are merged together. Then T bytes of data from the second set, and
80232 ** the main thread to read from.
80356 PmaReader *aReadr; /* Array of PmaReaders to merge data from */
80418 PmaReader *pReader; /* Readr data from here after Rewind() */
80451 sqlite3_file *pFd; /* File handle we are reading from */
80471 ** size. When the IncrMerger is initialized, it reads enough data from
80473 ** corresponding PmaReader object to read from that file and kicks off
80475 ** sorted record data from pMerger.
80480 ** sets the PmaReader fields to read from the new aFile[0] and kicks off
80489 ** keys from pMerger by the calling thread whenever the PmaReader runs out
80494 MergeEngine *pMerger; /* Merge engine thread reads data from */
80574 ** Read the next nByte bytes of data from the PMA p.
80583 PmaReader *p, /* PmaReader from which to take the blob */
80587 int iBuf; /* Offset within buffer to read from */
80598 /* If there is no more data to be read from the buffer, read the next
80599 ** p->nBuffer bytes of data from the file into it. Or, if there are less
80603 int nRead; /* Bytes to read from disk */
80614 /* Readr data from the file. Return early if an error occurs. */
80655 u8 *aNext; /* Pointer to buffer to copy data from */
80673 ** Read a varint from the stream of data accessed by p. Set *pnOut to
80729 SorterFile *pFile, /* Sorter file to read from */
80822 SorterFile *pFile, /* Sorter file to read from */
81008 ** to determine the number of fields that should be compared from the
81135 ** from the main thread. That only occurs SQLITE_MAX_WORKER_THREADS>0 */
81740 ** vdbeSorterCompare() from decoding pReadr2 again.
81742 ** If the two values were equal, then the value from the oldest
81744 ** is sorted from oldest to newest, so pReadr1 contains older values
81797 ** the background thread from a sub-tasks previous turn is still running,
81949 ** Read keys from pIncr->pMerger and populate pIncr->aFile[1]. The format
81951 ** except that the number-of-bytes varint is omitted from the start.
82015 ** aFile[0] such that the PmaReader should start rereading it from the
82019 ** keys from pIncr->pMerger and repopulating aFile[0].
82063 ** Allocate and return a new IncrMerger object to read data from pMerger.
82136 assert( pTask->pUnpacked!=0 ); /* from vdbeSortSubtaskMain() */
82171 ** function returns, the first key of merged data may be read from the
82175 ** objects attached to the PmaReader objects that the merger reads from have
82177 ** set the PmaReader objects up to read from it. In this case all that is
82206 ** reading from the same temp file this makes for more linear file IO.
82306 ** first results are ready from this merger object anyway.
82366 ** PMAs from pTask->file. If no error occurs, set *ppOut to point to
82371 ** first PMA to read from pTask->file. Assuming no error occurs, it is
82377 SortSubtask *pTask, /* Sorter task to read from */
82428 ** tree, counting from zero. This function adds pLeaf to the tree.
82499 ** MergeEngine here. This MergeEngine will read data from exactly
82658 ** from the in-memory list. */
82912 ** Read data from the file.
82915 sqlite3_file *pJfd, /* The journal file from which to read */
82937 const void *zBuf, /* Take data to be written from here */
83130 sqlite3_int64 iOffset; /* Offset from the beginning of the file */
83146 ** Read data from the in-memory journal file. This is the implementation
83150 sqlite3_file *pJfd, /* The journal file from which to read */
83196 const void *zBuf, /* Take data to be written from here */
83366 ** The return value from the callback should be one of the WRC_*
83377 ** The return value from this routine is WRC_Abort to abandon the tree walk
83417 ** any expr callbacks and SELECT callbacks that come from subqueries.
83433 ** FROM clause of SELECT statement p. Do not invoke the select
83434 ** callback on p, but do invoke it on each FROM clause subquery
83461 ** Invoke sqlite3WalkSelect() for subqueries in the FROM clause and
83465 ** the walk of the expressions and FROM clause. The xSelectCallback2()
83467 ** expressions and FROM clause.
83527 ** This needs to occur when copying a TK_AGG_FUNCTION node from an
83554 ** SELECT a+b, c+d FROM t1 ORDER BY 1 COLLATE nocase;
83558 ** SELECT a+b, c+d FROM t1 ORDER BY (a+b) COLLATE nocase;
83561 ** alias is removed from the original expression. The usual value is
83591 ** prevents ExprDelete() from deleting the Expr structure itself,
83664 ** from pSrcList.
83676 ** means that the form of the name is Z and that columns from any table
83878 ** SELECT a+b AS x FROM table WHERE x<10;
83959 /* If a column from a table in pSrcList is referenced, then record
83988 /* Increment the nRef value on all name contexts from TopNC up to
84004 ** from datasource iSrc in SrcList pSrc.
84095 ** column in the FROM clause. This is used by the LIMIT and ORDER BY
84342 int rc; /* Return code from subprocedures */
84762 /* If this is a converted compound query, move the ORDER BY clause from
84845 ** Y: The name of a table in a FROM clause. Or in a trigger
84865 ** SELECT a+b AS x, c+d AS y FROM t1 ORDER BY x;
84869 ** SELECT a+b AS x, c+d AS y FROM t1 ORDER BY a+b;
84874 ** set and the opcode is changed from TK_FUNCTION to TK_AGG_FUNCTION.
84939 ** subqueries in expressions, and subqueries used as FROM clause
85029 ** SELECT * FROM t1 WHERE a;
85030 ** SELECT a AS b FROM t1 WHERE b;
85031 ** SELECT * FROM t1 WHERE (select a from t1);
85375 ** Also propagate EP_Propagate flags up from Expr.x.pList to Expr.flags,
85396 ** Also propagate all EP_Propagate flags from the Expr.x.pList into
85416 ** Propagate all EP_Propagate flags from the Expr.x.pList into
85432 ** obtained from sqlite3DbMalloc(). The calling function
85493 ** Allocate a new expression node from a zero-terminated token that has
85643 ** the SQL statement comes from an external source.
85783 ** to reduce a pristine expression tree from the parser. The implementation
85833 ** descended from the Expr.x.pList or Expr.x.pSelect variables).
86013 ** If cursors, triggers, views and subqueries are all omitted from
86304 /* If pWalker->eCode is 2 then any term of the expression that comes from
86306 ** from being considered constant. */
86344 /* A bound parameter in a CREATE statement that originates from
86386 ** that does no originate from the ON or USING clauses of a join.
86387 ** Return 0 if it involves variables or function calls or terms from
86569 if( pSrc->nSrc!=1 ) return 0; /* Single term in FROM clause */
86570 if( pSrc->a[0].pSelect ) return 0; /* FROM is not a subquery or view */
86573 assert( pTab->pSelect==0 ); /* FROM clause is not a view */
86574 if( IsVirtual(pTab) ) return 0; /* FROM clause not a virtual table */
86650 ** SELECT <column> FROM <table>
86653 ** an ephemeral table might need to be generated from the RHS and then
86731 /* This function is only called from two places. In both cases the vdbe
86824 ** (SELECT a FROM b) -- subquery
86825 ** EXISTS (SELECT a FROM b) -- EXISTS subquery
86827 ** x IN (SELECT a FROM b) -- IN operator with subquery on the right
86896 ** from the SELECT or the <exprlist>.
86941 ** For each expression, build an index key from the evaluation and
87099 /* Figure out the affinity to use to create a key from the results
87105 /* Code the LHS, the <expr> from "<expr> IN (...)".
87301 ** Record in the column cache that a particular column from a
87367 ** Purge the range of registers from the column cache.
87397 ** Remove from the column cache any entries that were added since the
87483 ** Generate code that will extract the iColumn-th column from
87493 Table *pTab, /* Description of the table we are reading from */
87549 ** Generate code to move content from registers iFrom...iFrom+nReg-1
88081 ** floating point when extracting it from the record. */
88340 ** The SQLITE_ECEL_DUP flag prevents the arguments from being
88821 ** always differs from a non-NULL pointer.
88883 SrcList *pSrc; /* One particular FROM clause in a nested query */
88885 FROM clauses */
88983 /* Check to see if the column is in one of the tables in the FROM
88992 ** that is in the FROM clause of the aggregate query.
89222 ** ALTER TABLE logic from the build.
89484 ** constraints for which pTab is the parent table) from the sqlite_master
89499 ** temporary triggers on table pTab from the sqlite_temp_master table. If
89531 ** pTab from the database, including triggers and temporary triggers.
89533 ** the time the generated code is executed. This can be different from
89552 /* Drop any table triggers from the internal schema. */
89560 /* Drop the table and index from the internal schema. */
90097 ** must be separated from the last integer by a single space. If the
90124 ** S uniform buckets and the samples are the middle row from each bucket.
90148 ** binary encoding of a key from the index. The nEq column is a
90272 "DELETE FROM %Q.%s WHERE %s=%Q",
90537 ** the anEq[] array from pSample->anEq[pSample->iCol+1] onwards are valid.
90561 ** the anEq[] array from pSample->anEq[pSample->iCol] onwards are valid.
90588 ** remove the least desirable sample from p->a[] to make room.
90684 /* Check if any samples from the aBest[] array should be pushed
90735 ** C Index of left-most column to differ from previous row
91007 int jZeroRows = -1; /* Jump from here if number of rows is zero */
91448 ** Used to pass information from the analyzer reader through to the
91689 ** Load the content from either the sqlite_stat4 or sqlite_stat3 table
91696 ** zSql1: SELECT idx,count(*) FROM %Q.sqlite_stat4 GROUP BY idx
91697 ** zSql2: SELECT idx,neq,nlt,ndlt,sample FROM %Q.sqlite_stat4
91708 int rc; /* Result codes from subroutines */
91739 ** loaded from the stat4 table. In this case ignore stat3 data. */
91788 /* This next condition is true if data has already been loaded from
91805 ** a corrupt record. Adding the two 0x00 bytes prevents this from causing
91822 ** Load content from the sqlite_stat4 and sqlite_stat3 tables into
91826 int rc = SQLITE_OK; /* Result codes from subroutines */
91831 "SELECT idx,count(*) FROM %Q.sqlite_stat4 GROUP BY idx",
91832 "SELECT idx,neq,nlt,ndlt,sample FROM %Q.sqlite_stat4",
91839 "SELECT idx,count(*) FROM %Q.sqlite_stat3 GROUP BY idx",
91840 "SELECT idx,neq,nlt,ndlt,sqlite_record(sample) FROM %Q.sqlite_stat3",
91858 ** read from it.
91862 ** returned. However, in this case, data is read from the sqlite_stat1
91898 "SELECT tbl,idx,stat FROM %Q.sqlite_stat1", sInfo.zDatabase);
91907 /* Load the statistics from the sqlite_stat4 table. */
91951 ** is slightly different from resolving a normal SQL expression, because simple
91982 ** three arguments to the function come directly from an attach statement:
92124 /* No key specified. Use the key from the main database */
92136 ** remove the entry from the db->aDb[] array. i.e. put everything back the way
92186 ** three arguments to the function come directly from a detach statement:
92615 ** Invoke the authorization callback for permission to read column zCol from
92728 ** or if the parser is being invoked from within sqlite3_declare_vtab.
93243 ** unlike that index from its Table then remove the index from
93274 ** any have been closed, remove them from the list. Reallocate the
93330 ** Erase all schema information from all attached databases (including
93380 ** the table data structure from the hash table. But it does destroy
93441 ** Unlink the given table from the hash tables and the delete the
93462 ** is obtained from sqliteMalloc() and must be freed by the calling
94067 ** the expression given in its argument from a TK_STRING into a TK_ID
94344 ** from sqliteMalloc() and must be freed by the calling function.
94485 ** schema to the rootpage from the main table.
94541 ** Remove all redundant columns from the PRIMARY KEY. For example, change
94631 ** was called to create a table generated from a
94640 Select *pSelect /* Select from a "CREATE ... AS SELECT" */
94659 ** for the table from the db->init.newTnum field. (The page number
94946 Table *pSelTab; /* A fake table from which we get the result set */
94973 ** CREATE VIEW one AS SELECT * FROM two;
94974 ** CREATE VIEW two AS SELECT * FROM one;
94981 ** CREATE TEMP VIEW ex1 AS SELECT a FROM ex1;
94982 ** SELECT * FROM temp.ex1;
94993 ** to the elements of the FROM clause. But we do not want these changes
95045 ** Clear the column names from every VIEW in database idx.
95068 ** root-page of a table or index in database iDb has changed from iFrom
95108 ** Write code to erase the table with root-page iTable from database iDb.
95196 ** Remove entries from the sqlite_statN tables (for N in (1,2,3))
95212 "DELETE FROM %Q.%s WHERE %s=%Q",
95239 ** is generated to remove entries from sqlite_master and/or
95258 "DELETE FROM %Q.sqlite_sequence WHERE name=%Q",
95272 "DELETE FROM %Q.%s WHERE tbl_name=%Q and type!='trigger'",
95278 /* Remove the table entry from SQLite's internal schema and modify
95377 /* Generate code to remove the table from the master table
95548 ** the root page number of the index is taken from pIndex->tnum.
95747 /* Because the parser constructs pTblName from a single identifier,
95798 ** Exception: If we are reading the names of permanent indices from the
96213 ** Apart from that, we have little to go on besides intuition as to
96291 /* Generate code to remove the index and from the master table */
96296 "DELETE FROM %Q.%s WHERE name=%Q AND type='index'",
96484 ** come from pTable (if pDatabase is NULL) or from pDatabase.
96485 ** SrcList.a[].zDatabase is filled with the database name from pTable,
96578 ** end of a growing FROM clause. The "p" parameter is the part of
96579 ** the FROM clause that has already been constructed. "p" is NULL
96580 ** if this is the first term of the FROM clause. pTable and pDatabase
96581 ** are the name of the table and database named in the FROM clause term.
96589 ** Return a new SrcList which encodes is the FROM with the new
96594 SrcList *p, /* The left part of the FROM clause already seen */
96595 Token *pTable, /* Name of the table to add to the FROM clause */
96672 ** When building up a FROM clause in the parser, the join operator
96675 ** Shifts all join operators from left to right for an entire FROM
96891 ** particular, it prevents us from writing an effective
97336 ** from the main database is substituted, if one is available.
97354 ** Locate and return an entry from the db.aCollSeq hash table. If the entry
97407 ** for the encoding 'enc' from the database 'db'.
97708 ** in order to generate code for DELETE FROM statements.
97714 ** (as in the FROM clause of a SELECT statement) in this case it contains
97816 ** DELETE FROM table_wxyz WHERE a<5 ORDER BY a LIMIT 1;
97822 SrcList *pSrc, /* the FROM clause -- which tables to scan */
97833 SrcList *pSelectSrc = NULL; /* SELECT rowid FROM x ... (dup of pSrc) */
97854 ** DELETE FROM table_a WHERE col1=1 ORDER BY col2 LIMIT 1 OFFSET 1
97856 ** DELETE FROM table_a WHERE rowid IN (
97857 ** SELECT rowid FROM table_a WHERE col1=1 ORDER BY col2 LIMIT 1 OFFSET 1
97866 /* duplicate the FROM clause as it is needed by both the DELETE/UPDATE tree
97906 ** Generate code for a DELETE FROM statement.
97908 ** DELETE FROM table_wxyz WHERE a<5 AND b NOT NULL;
97914 SrcList *pTabList, /* The table from which we should delete things */
97918 Table *pTab; /* The table from which records will be deleted */
97948 int isView; /* True if attempting to delete from a view */
97969 ** deleted from is a view
98027 /* If we are trying to delete from a view, realize that view into
98170 ** deleting from and all its indices. If this is a view, then the
98304 ** that a search record formed from OP_MakeRecord is contained in the
98312 ** and nPk before reading from it.
98323 ** index cursor (from within array of cursors starting at iIdxCur) that
98330 int iDataCur, /* Cursor from which column data is extracted */
98466 int iIdxNoSeek /* Do not delete from this cursor */
98527 int iDataCur, /* Cursor number from which to take column data */
98847 ** If p1 is negative, then we begin abs(p1) from the end of x[].
98890 ** from 2009-02-02 for compatibility of applications that exploited the
99198 ** [...] Matches one character from the enclosed list of
99272 ** first matching character and recursively contine the match from
99535 /* Array for converting from half-bytes (nybbles) into ASCII hex
99729 ** from A by replacing every occurrence of B with C. The match
99897 /* IMP: R-25361-16150 This function is omitted from SQLite by default. It
100424 ** time a statement is executed that removes an existing violation from
100646 /* If the index uses a collation sequence that is different from
100684 ** This function is called when a row is inserted into or deleted from the
100692 ** or deleted from the child table. If the parent row can be found, no
100715 int *aiCol, /* Map from parent key columns to child table columns */
100899 ** from the parent table of foreign key constraint pFKey and, if pFKey is
100935 int *aiCol, /* Map from pIdx cols to child table cols */
100966 Expr *pLeft; /* Value from parent table row */
100983 ** to the WHERE clause that prevent this entry from being scanned.
100995 Expr *pLeft; /* Value from parent table row */
101063 ** The Trigger structure or any of its sub-components may be allocated from
101079 ** being dropped from the database. The SrcList passed as the second argument
101090 ** then the equivalent of "DELETE FROM <tbl>" is executed before dropping
101091 ** the table from the database. Triggers are disabled while running this
101232 ** of the row being deleted, from left to right. Parameter regNew is passed
101240 ** the original record is deleted from the table using the calling convention
101246 Table *pTab, /* Row is being deleted from this table */
101299 ** case SQLite runs a "DELETE FROM xxx" on the table being dropped
101331 ** values read from the parent table are NULL. */
101348 /* A row is being removed from the child table. Search for the parent.
101537 ** DELETE FROM c WHERE ck = old.pk;
101546 Table *pTab, /* Table being updated or deleted from */
101733 Table *pTab, /* Table being updated or deleted from */
101760 ** table pTab. Remove the deleted foreign keys from the Schema.fkeyHash
101770 /* Remove the FK from the fkeyHash hash table. */
102063 ** only called from the top-level */
102168 ** for a SELECT statement that omits the FROM clause and everything else
102173 ** insert with data coming from a single-row VALUES clause, the code executes
102186 ** If the SELECT clause is of the restricted form "SELECT * FROM <table2>" -
102187 ** in other words if the SELECT pulls all columns from a single table
102191 ** is invoked that copies raw records from <table2> over to <table1>.
102202 ** transfer all records from the read to the write cursors
102207 ** and the SELECT clause does not read from <table> at any time.
102221 ** insert the select result into <table> from R..R+n
102226 ** values from a SELECT but the data is being inserted into a table
102242 ** insert row from R..R+n into temp table
102271 int srcTab = 0; /* Data comes from this temporary cursor if >=0 */
102284 int regFromSelect = 0;/* Base register for data coming from SELECT */
102373 ** INSERT INTO <table1> SELECT * FROM <table2>;
102445 ** is coming from a SELECT statement, then generate a co-routine that
102450 /* Data is coming from a SELECT or from a multi-row VALUES clause.
102484 /* Invoke the coroutine to extract information from the SELECT
102486 ** here is from the 4th template:
102490 ** insert row from R..R+n into temp table
102512 /* This is the case if the data for the INSERT is coming from a
102596 ** insert the select result into <table> from R..R+n
102914 ** any ABORT Back out changes from the current command
103126 ** remove the conflicting row from the table. This will fire
103267 ** is different from old-rowid */
103275 /* Extract the PRIMARY KEY from the end of the index entry and
103289 ** different from the old.
103292 ** of the matched index row are different from the original PRIMARY
103578 ** INSERT INTO tab1 SELECT * FROM tab2;
103580 ** The xfer optimization transfers raw records from tab2 over to tab1.
103609 Table *pSrc; /* The table in the FROM clause of SELECT */
103614 int iSrc, iDest; /* Cursors from source and destination */
103629 ** error if pSelect reads from a CTE named "xxx". */
103644 assert(pSelect->pSrc); /* allocated even if there is no FROM clause */
103646 return 0; /* FROM clause must have exactly one term */
103649 return 0; /* FROM clause cannot contain a subquery */
103689 return 0; /* FROM clause does not contain a real table */
103920 ** codes. Also write an error message into memory obtained from
104610 ** excluded from a build of SQLite. Substitute a NULL pointer
105275 ** Cancel a prior call to sqlite3_auto_extension. Remove xInit from the
105903 ** the rest of the file if PRAGMAs are omitted from the build.
105957 ** from default, or when 'file' and the temp_store_directory has changed
105964 "from within a transaction");
106830 ** cid: Column id (numbered from left to right, starting at 0)
107011 "id", "seq", "table", "from", "to", "on_update", "on_delete",
107054 int regRow; /* Registers to hold a row from pTab */
107342 sqlite3VdbeLoadString(v, 4, " missing from index ");
107773 ** from disk.
107802 ** This routine is also called from the OP_ParseSchema opcode of the VDBE.
107837 TESTONLY(int rcp); /* Return code from sqlite3_prepare() */
108067 rc = SQLITE_CORRUPT_BKPT; // Android Change from "rc = SQLITE_ERROR;"
108086 "SELECT name, rootpage, sql FROM '%q'.%s ORDER BY rowid",
108225 Btree *pBt = db->aDb[iDb].pBt; /* Btree database to read cookie from */
108240 /* Read the schema cookie from the database. If it does not match the
108411 "selectid", "order", "from", "detail"
108757 SrcList *pSrc, /* the FROM clause -- which tables to scan */
108916 ** Search the first N tables in pSrc, from left to right, looking for a
108961 SrcList *pSrc, /* List of tables in FROM clause */
109009 ** SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.b AND t1.x=5
109040 ** The terms of a FROM clause are contained in the Select.pSrc structure.
109050 SrcList *pSrc; /* All tables in the FROM clause */
109140 ExprList *pList, /* Form the KeyInfo object from this ExprList */
109264 ** A jump to addrRepeat is made and the N+1 values are popped from the
109288 ** (example: "a IN (SELECT * FROM table)") but it has more than 1 result
109315 ** zero or more, then data is pulled from srcTab and pEList is used only
109322 int srcTab, /* Pull data from this table */
109463 /* Construct a record from the query result, but instead of
109464 ** saving that record, use it as a key to delete elements from
109710 ** Space to hold the KeyInfo structure is obtained from malloc. The calling
109716 ExprList *pList, /* Form the KeyInfo object from this ExprList */
109851 int iSortTab; /* Sorter cursor to read from */
109852 int nSortData; /* Trailing values to read from sorter */
109957 ** The declaration type is the exact datatype definition extracted from the
109964 ** SELECT col FROM tbl;
109965 ** SELECT (SELECT col FROM tbl;
109966 ** SELECT (SELECT col FROM tbl);
109967 ** SELECT abc FROM (SELECT col AS abc FROM tbl);
110003 ** extracted from in NameContext.pSrcList. This table may be real
110006 Table *pTab = 0; /* Table structure column is extracted from */
110007 Select *pS = 0; /* Select the column is extracted from */
110030 ** SELECT (SELECT t1.col) FROM FROM t1;
110045 /* The "table" is actually a sub-select or a view in the FROM clause
110248 ExprList *pEList, /* Expr list from which to derive column names */
110342 ** The column list presumably came from selectColumnNamesFromExprList().
110519 ** The collating sequence for the compound select is taken from the
110544 ** Space to hold the KeyInfo structure is obtained from malloc. The calling
110587 ** There is exactly one reference to the recursive-table in the FROM clause
110591 ** into a Queue table. Rows are extracted from the Queue table one by
110592 ** one. Each row extracted from Queue is output to pDest. Then the single
110595 ** is added back into the Queue table. Then another row is extracted from Queue
110619 SrcList *pSrc = p->pSrc; /* The FROM clause of the recursive query */
110688 /* Detach the ORDER BY clause from the compound SELECT */
110753 ** Handle the special case of a compound-select that originates from a
110758 ** Because the Select object originates from a VALUES clause:
110796 ** This routine is called to process a compound query form from
110809 ** SELECT a FROM t1 UNION SELECT b FROM t2 UNION SELECT c FROM t3
110813 ** SELECT c FROM t3
110815 ** `-----> SELECT b FROM t2
110817 ** `------> SELECT a FROM t1
110824 ** individual selects always group from left to right.
110831 int rc = SQLITE_OK; /* Success code from a subroutine */
111053 /* INTERSECT is different from the others since it requires
111363 ** AltB: Called when there is data from both coroutines and A<B.
111365 ** AeqB: Called when there is data from both coroutines and A==B.
111367 ** AgtB: Called when there is data from both coroutines and A>B.
111369 ** EofA: Called when data is exhausted from selectA.
111371 ** EofB: Called when data is exhausted from selectB.
111465 int *aPermute; /* Mapping from ORDER BY terms to result set columns */
111513 ** row of results comes from selectA or selectB. Also add explicit
111558 /* Separate the left and the right query from one another
111637 /* Generate a subroutine to run when the results from select A
111651 /* Generate a subroutine to run when the results from select B
111750 ** FROM clause of a SELECT such that the VDBE cursor assigned to that
111833 ** SELECT a FROM (SELECT x+y AS a FROM t1 WHERE z<100) WHERE a>5
111845 ** SELECT x+y AS a FROM t1 WHERE z<100 AND a>5
111858 ** FROM-clause subquery that is a candidate for flattening. (2b is
111859 ** due to ticket [2f7170d73bf9abf80] from 2015-02-09.)
111867 ** sub-queries that were excluded from this optimization. Restriction
111873 ** (7) The subquery has a FROM clause. TODO: For subqueries without
111874 ** A FROM clause, consider adding a FROM close with the special
111883 ** (**) Restriction (10) was removed from the code on 2005-02-05 but we
111891 ** a separate restriction deriving from ticket #350.
111951 ** "SELECT x FROM (SELECT max(y), x FROM t1)" would not necessarily
111976 SrcList *pSrc; /* The FROM clause of the outer query */
111977 SrcList *pSubSrc; /* The FROM clause of the subquery */
112062 ** t1 LEFT OUTER JOIN (SELECT * FROM t2 WHERE t2.x>0)
112116 SELECTTRACE(1,pParse,p,("flatten %s.%p from term %d\n",
112129 ** SELECT <expr-list> FROM (<sub-query>) <where-clause>
112139 ** SELECT a+1 FROM (
112140 ** SELECT x FROM tab
112142 ** SELECT y FROM tab
112144 ** SELECT abs(z*2) FROM
112149 ** SELECT x+1 FROM tab WHERE x+1!=5
112151 ** SELECT y+1 FROM tab WHERE y+1!=5
112153 ** SELECT abs(z*2)+1 FROM tab2 WHERE abs(z*2)+1!=5
112190 /* Begin flattening the iFrom-th entry of the FROM clause
112230 ** This loop moves all of the FROM elements of the subquery into the
112231 ** the FROM clause of the outer query. Before doing this, remember
112232 ** the cursor number for the original outer query FROM element in
112235 ** those references with expressions that resolve to the subquery FROM
112241 pSubSrc = pSub->pSrc; /* FROM clause of subquery */
112242 nSubSrc = pSubSrc->nSrc; /* Number of terms in subquery FROM clause */
112243 pSrc = pParent->pSrc; /* FROM clause of the outer query */
112257 /* The subquery uses a single slot of the FROM clause of the outer
112258 ** query. If the subquery has more than one element in its FROM clause,
112264 ** SELECT * FROM tabA, (SELECT * FROM sub1, sub2), tabB;
112266 ** The outer query has 3 slots in its FROM clause. One slot of the
112268 ** block of code will expand the outer query FROM clause to 4 slots.
112270 ** for the two elements in the FROM clause of the subquery.
112279 /* Transfer the FROM clause terms from the subquery into the
112294 ** SELECT a+5, b*10 FROM (SELECT x*3 AS a, y+10 AS b FROM t1) WHERE a>b;
112349 ** SELECT ... FROM (SELECT ... LIMIT a OFFSET b) LIMIT x OFFSET y;
112383 ** SELECT * FROM (SELECT a AS x, c-d AS y FROM t1) WHERE x=5 AND y=10;
112387 ** SELECT * FROM (SELECT a AS x, c-d AS y FROM t1 WHERE a=5 AND c-d=10)
112492 ** SELECT count(*) FROM <tbl>
112551 ** SELECT ... FROM t1 EXCEPT SELECT ... FROM t2 ORDER BY .. COLLATE ...
112555 ** SELECT * FROM (SELECT ... FROM t1 EXCEPT SELECT ... FROM t2)
112621 ** WITH contexts, from inner to outermost. If the table identified by
112622 ** FROM clause element pItem is really a common-table-expression (CTE)
112631 struct SrcList_item *pItem, /* FROM clause element to resolve */
112655 ** WITH clause will never be popped from the stack. In this case it
112792 ** clause, pop it from the stack stored as part of the Parse object.
112796 ** names and other FROM clause elements.
112815 ** element of the FROM clause.
112818 ** defines FROM clause. When views appear in the FROM clause,
112858 ** the FROM clause of the SELECT statement.
112862 /* Look up every table named in the FROM clause of the select. If
112863 ** an entry of the FROM clause is a subquery instead of a table or view,
112878 /* A sub-query in the FROM clause of a SELECT */
112893 /* An ordinary table or view name in the FROM clause */
113034 /* In a NATURAL join, omit the join columns from the
113040 ** using clause from the table on the right. */
113150 ** For each FROM-clause subquery, add Column.zType and Column.zColl
113174 /* A sub-query in the FROM clause of a SELECT */
113188 ** the Table structures of all FROM-clause subqueries in a
113209 ** * VDBE Cursor numbers are assigned to all FROM-clause terms.
113210 ** * Ephemeral Table objects are created for all FROM-clause subqueries.
113379 ** count(*) query ("SELECT count(*) FROM pTab").
113422 WhereInfo *pWInfo; /* Return from sqlite3WhereBegin() */
113426 SrcList *pTabList; /* List of tables to select from */
113430 int rc = 1; /* Value to return from this function */
113497 /* Try to flatten subqueries in the FROM clause up into the main query
113552 /* Generate code for all sub-queries in the FROM clause
113667 SELECTTRACE(0x400,pParse,p,("After all FROM-clause analysis:\n"));
113676 ** SELECT DISTINCT xyz FROM ... ORDER BY xyz
113680 ** SELECT xyz FROM ... GROUP BY xyz ORDER BY xyz
113692 /* Notice that even thought SF_Distinct has been cleared from p->selFlags,
113796 int groupBySort; /* Rows come from source in GROUP BY order */
113799 int sortOut = 0; /* Output register from the sorter */
113996 ** from the previous row currently stored in a0, a1, a2...
114101 ** SELECT count(*) FROM <tbl>
114158 ** SELECT min(x) FROM ...
114159 ** SELECT max(x) FROM ...
114300 ** This structure is used to pass data from sqlite3_get_table() through
114310 int rc; /* Return code from sqlite3_exec() */
114325 ** we need to remember from this invocation of the callback.
114388 ** from
114462 char **azResult /* Result returned from sqlite3_get_table() */
114926 Token *pTableName, /* The table from which rows are deleted */
114954 ** This function is called to drop a trigger from the database schema.
114956 ** This may be called directly from the parser and therefore identifies
115068 ** Remove a trigger from the hash tables of the sqlite* pointer.
115144 ** forming the SrcList. This prevents a trigger in one database from
115267 ** from pFrom to pTo.
115436 Table *pTab, /* The table to code triggers from */
115511 Table *pTab, /* The table to code triggers from */
115573 Table *pTab, /* The table to code triggers from */
115624 int *aXRef, /* Mapping from columns of pTab to entries in pChanges */
115640 ** from the P4 parameter of the OP_Column instruction, is returned instead.
116101 ** values for registers not modified by the UPDATE must be reloaded from
116310 int *aXRef, /* Mapping from columns of pTab to entries in pChanges */
116330 ** create and open the ephemeral table in which the records created from
116370 /* Create a record from the argument register contents and insert it into
116385 /* Extract arguments from the current row of the ephemeral table and
116489 ** (2) Copy all content from the database being vacuumed into
116491 ** (3) Copy content from the transient database back into the
116526 int rc = SQLITE_OK; /* Return code from service routines */
116540 sqlite3SetString(pzErrMsg, db, "cannot VACUUM from within a transaction");
116645 " FROM sqlite_master WHERE type='table' AND name!='sqlite_sequence'"
116651 " FROM sqlite_master WHERE sql LIKE 'CREATE INDEX %' ");
116655 " FROM sqlite_master WHERE sql LIKE 'CREATE UNIQUE INDEX %'");
116659 ** an "INSERT INTO vacuum_db.xxx SELECT * FROM main.xxx;" to copy
116666 "|| ' SELECT * FROM main.' || quote(name) || ';'"
116667 "FROM main.sqlite_master "
116678 "SELECT 'DELETE FROM vacuum_db.' || quote(name) || ';' "
116679 "FROM vacuum_db.sqlite_master WHERE name='sqlite_sequence' "
116684 "|| ' SELECT * FROM main.' || quote(name) || ';' "
116685 "FROM vacuum_db.sqlite_master WHERE name=='sqlite_sequence';"
116690 /* Copy the triggers, views, and virtual tables from the main database
116693 ** from the SQLITE_MASTER table.
116698 " FROM main.sqlite_master"
116807 ** are invoked only from within xCreate and xConnect methods.
116981 ** for table *p associated with database connection db from the linked
117043 ** Clear any and all virtual-table information from the Table record.
117346 ** If so, set the Column COLFLAG_HIDDEN flag and remove the token from
117508 ** valid to call this function from within the xCreate() or xConnect() of a
117600 /* Remove the sqlite3_vtab* from the aVTrans[] array, if applicable */
117697 ** than zero, then this function is being called from within a
117945 ** The results of this routine are undefined unless it is called from
117962 ** Call from within the xCreate() or xConnect() methods to provide
118015 ** This file was split off from where.c on 2015-06-06 in order to reduce the
118079 ** each term in the FROM clause (which is to say, for each of the
118096 u8 iFrom; /* Which entry in the FROM clause */
118111 Bitmask notReady; /* FROM entries not usable at this level */
118119 ** term of a join. Every term of the FROM clause will have at least
118122 ** FROM clause will have multiple WhereLoop objects, each describing a
118123 ** potential way of implementing that FROM-clause term, together with
118128 ** one WhereLoop object per FROM clause term, that satisfy all dependencies
118137 u8 iTab; /* Position in FROM clause of table for this loop */
118201 ** number of nodes in the FROM clause. The best (lowest cost) WherePath
118217 ** clause subexpression is separated from the others by AND operators,
118298 #define TERM_LIKEOPT 0x100 /* Virtual terms from the LIKE optimization */
118373 ** from the sparse cursor numbers into consecutive integers beginning
118473 int iFrom, /* Value for "from" column of output */
118482 SrcList *pSrclist, /* FROM clause pLvl reads data from */
118597 ** SELECT * FROM t1 WHERE a=1 AND b>2;
118644 int iFrom, /* Value for "from" column of output */
118745 ** implement level pLvl. Argument pSrclist is a pointer to the FROM
118746 ** clause that the scan reads data from.
118753 SrcList *pSrclist, /* FROM clause pLvl reads data from */
118778 ** (1) SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.x WHERE t2.z='ok'
118779 ** (2) SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.x AND t2.z='ok'
118780 ** (3) SELECT * FROM t1, t2 WHERE t1.a=t2.x AND t2.z='ok'
118887 WhereLevel *pLevel, /* The level of the FROM clause we are working on */
118994 ** SELECT ... FROM t1 AS t2, t1 WHERE t1.a = t2.b;
119004 WhereLevel *pLevel, /* Which nested loop of the FROM we are coding */
119066 ** Ex: CREATE INDEX i1 ON t1(a,b,a); SELECT * FROM t1 WHERE a=0 AND b=0; */
119102 ** that originated from the LIKE optimization, then change the P3 to be
119151 struct SrcList_item *pTabItem; /* FROM clause term being coded */
119194 /* Special case of a FROM clause subquery implemented as a co-routine */
119655 ** SELECT * FROM t1 WHERE a=5 OR b=7 OR (c=11 AND d=13)
119793 ** eliminating duplicates from other WHERE clauses, the action for each
119823 ** duplicate rows from prior sub-WHERE clauses, and record the
119881 ** current sub-WHERE row is a duplicate from prior sub-WHEREs. */
119885 ** contained one or more AND term from a notReady table. The
119886 ** terms from the notReady table could not be tested and will
120096 ** The new WhereTerm object is constructed from Expr p and with wtFlags.
120181 ** used by clearing the EP_Collate flag from Y. */
120202 ** Translate from TK_xx operator to WO_xx bitmask.
120415 SrcList *pSrc, /* the FROM clause */
120516 ** From another point of view, "indexable" means that the subterm could
120541 SrcList *pSrc, /* the FROM clause */
120689 ** current term is from the first iteration. So skip this term. */
120797 ** This is an optimization. No harm comes from returning 0. But if 1 is
120864 SrcList *pFrom, /* The FROM clause */
120865 Bitmask mPrereq, /* Bitmask of FROM clause terms referenced by pExpr */
120915 SrcList *pSrc, /* the FROM clause */
121222 /* Prevent ON clause terms of a LEFT JOIN from being used to drive
121342 SrcList *pTabList, /* the FROM clause */
121360 struct SrcList_item *pItem, /* The FROM clause term to process */
121424 ** Return the estimated number of output rows from a WHERE clause
121558 ** There is one cursor per table in the FROM clause. The number of
121559 ** tables in the FROM clause is limited by a test early in the
121813 SrcList *pTabList, /* The FROM clause */
121822 /* If there is more than one table or sub-select in the FROM clause of
121890 int iStart, /* Translate from this opcode to the end */
121997 struct SrcList_item *pSrc, /* The FROM clause term to get the next index */
122021 struct SrcList_item *pTabItem; /* FROM clause term being indexed */
122258 ** many fields that are declared "const" to prevent xBestIndex from
122595 ** SELECT * FROM t1 WHERE a=? AND c BETWEEN ? AND ?;
122605 ** extracted from pLower and pUpper with the corresponding column in each
122607 ** equal to the values extracted from pLower and pUpper respectively, and
122613 ** If pLower is NULL, or a value cannot be extracted from the term, L is
122614 ** set to zero. If pUpper is NULL, or a value cannot be extracted from it,
122618 ** if no value can be extracted from either pLower or pUpper (and so the
122641 sqlite3_value *p1 = 0; /* Value extracted from pLower */
122642 sqlite3_value *p2 = 0; /* Value extracted from pUpper */
122643 sqlite3_value *pVal = 0; /* Value extracted from record */
122704 ** ... FROM t1 WHERE a > ? AND a < ? ...
122717 ** ... FROM t1 WHERE a = ? AND b > ? AND b < ? ...
122722 ** ... FROM t1 WHERE a > ? AND a < ? ...
122764 ** Or, if pLower is NULL or $L cannot be extracted from it (because it
122810 int bOk; /* True if value is extracted from pExpr */
122825 int bOk; /* True if value is extracted from pExpr */
122842 /* TUNING: If both iUpper and iLower are derived from the same
122886 WHERETRACE(0x10,("Range scan lowers nOut from %d to %d\n",
123137 ** Transfer content from the second pLoop into the first.
123558 struct SrcList_item *pSrc, /* FROM clause term being analyzed */
123623 ** to mix with a lower range bound from some other source */
123674 /* Range contraints that come from the LIKE optimization are
123933 ** implicit "x IN (SELECT x FROM tbl)" terms are added for skip-scans.
123938 ** log(nRow) factor is omitted from a non-covering index scan in order to
123952 SrcList *pTabList; /* The FROM clause */
123953 struct SrcList_item *pSrc; /* The FROM clause btree term to add */
123995 ** NOT INDEXED qualifier is omitted from the FROM clause */
124144 ** mUnusable are set to 0. Otherwise, mExtra is a mask of all FROM clause
124145 ** entries that occur before the virtual table in the FROM clause and are
124146 ** separated from it by at least one LEFT or CROSS JOIN. Similarly, the
124147 ** mUnusable mask contains all FROM clause entries that occur after the
124148 ** virtual table and are separated from it by at least one LEFT or
124153 ** ... FROM t1, t2 LEFT JOIN t3, t4, vt CROSS JOIN t5, t6;
124172 struct SrcList_item *pSrc; /* The FROM clause term to search */
124298 ** (2) Multiple outputs from a single IN value will not merge
124482 /* Loop over the tables in the join, from left to right */
124490 /* This condition is true when pItem is the FROM clause term on the
124558 Expr *pOBExpr; /* An expression from the ORDER BY clause */
124559 CollSeq *pColl; /* COLLATE function from an ORDER BY clause term */
124575 ** We say the WhereLoop is "order-distinct" if the set of columns from
124769 } /* End the loop over all WhereLoops from outer-most down to inner-most */
124802 ** SELECT * FROM t1 GROUP BY x,y ORDER BY x,y; -- IsSorted()==1
124803 ** SELECT * FROM t1 GROUP BY y,x ORDER BY y,x; -- IsSorted()==0
124951 /* If nLoop is zero, then there are no FROM terms in the query. Since
125075 /* Discard the candidate path from further consideration */
125306 ** the FROM clause of a select. (INSERT and UPDATE statements are the
125307 ** same as a SELECT with only a single table in the FROM clause.) For
125310 ** SELECT * FROM t1, t2, t3 WHERE ...;
125323 ** appear in the FROM clause if a different order is better able to make
125336 ** data from the various tables of the loop.
125374 ** is called from an UPDATE or DELETE statement, then pOrderBy is NULL.
125386 SrcList *pTabList, /* FROM clause: A list of all tables to be scanned */
125426 /* The number of tables in the FROM clause is limited by the number of
125494 /* Special case: No FROM clause
125503 /* Assign a bit from the bitmask to every term in the FROM clause.
125505 ** The N-th term of the FROM clause is assigned a bitmask of 1<<N.
125611 /* Attempt to omit tables from the join that do not effect the result */
125949 ** from the index instead of from the table where possible. In some cases
125950 ** this optimization prevents the table from ever being read, which can
126096 /* Construct a new Expr object from a single identifier. Use the
126215 ** directly to the parser from the tokenizer.
126225 ** sqlite3ParserARG_FETCH Code to extract %extra_argument from yypParser
126985 "VALUES", "DISTINCT", "DOT", "FROM",
127005 "distinct", "selcollist", "from", "where_opt",
127144 /* 118 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt",
127159 /* 133 */ "from ::=",
127160 /* 134 */ "from ::= FROM seltablist",
127196 /* 170 */ "cmd ::= with DELETE FROM fullname indexed_opt where_opt",
127313 /* 287 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt",
127424 ** when the symbol is popped from the stack during a
127462 case 202: /* from */
127512 ** is popped from the stack, then call it.
127543 ** obtained from sqlite3ParserAlloc.
127545 ** from malloc.
128115 /* Silence complaints from purify about yygotominor being uninitialized
128126 ** from wireshark this week. Clearly they are stressing Lemon in ways
128487 case 118: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
128496 ** then extract the first few alphanumeric characters from within that
128580 case 133: /* from ::= */
128583 case 134: /* from ::= FROM seltablist */
128721 case 170: /* cmd ::= with DELETE FROM fullname indexed_opt where_opt */
128974 ** the semantics would be subtly different from IN or NOT IN.
129219 case 287: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt */
129451 ** The first argument is a pointer to a structure obtained from
129945 testcase( i==107 ); /* FROM */
130014 /* Make the IdChar function accessible from ctime.c */
130292 ** memory obtained from sqlite3_malloc() and to make *pzErrMsg point to that
130456 ** separating it out, the code will be automatically omitted from
130526 ** from the input. The following tokens are significant:
130610 case '-': { /* SQL-style comments from "--" to end of line */
130953 ** * Calls to this routine from Y must block until the outer-most
130956 ** * Recursive calls to this routine from thread X return immediately
131000 ** mutex must not require support from the malloc subsystem.
131147 ** to be NULL or point to memory that was obtained from sqlite3_malloc(),
131257 ** SQLITE_CONFIG_SCRATCH: A pointer an 8-byte aligned memory buffer from
131372 /* MSVC is picky about pulling func ptrs from va lists.
131470 ** space for the lookaside memory is obtained from sqlite3_malloc().
131544 ** Free up as much memory as we can from the given database
131643 ** strings byte by byte using the memcmp() function from
131975 /* The temp-database schema is allocated differently from the other schema
132581 ** Register a trace function. The pArg from the previously registered trace
132605 ** Register a profile function. The pArg from the previously registered
133180 ** from forming.
133487 char *zErrMsg = 0; /* Error message from sqlite3ParseUri() */
133533 /* Remove harmful bits from the flags parameter
133955 ** This function is now an anachronism. It used to be used to recover from a
134102 ** explicitly declared column. Copy meta information from *pCol.
134270 ** value from sqlite3FaultSim(0) becomes the return from
134274 /* MSVC is picky about pulling func ptrs from va lists.
134307 ** IMPORTANT: Changing the PENDING byte from 0x40000000 results in
134720 ** Remove connection db from the blocked connections list. If connection
134863 ** pUnlockConnection==0, remove the entry from the blocked connections
134910 ** allocate a larger array from the heap has failed.
134946 /* Remove connection p from the blocked connections list. */
134963 ** being closed. The connection is removed from the blocked list.
135003 ** structures are like b+trees in layout, but are constructed from the
135005 ** are built from the bottom up, things will be described from the
135048 ** varint docid; (delta from previous doclist)
135050 ** varint position; (2 more than the delta from previous position)
135056 ** varint position; (2 more than the delta from previous position)
135068 ** than the difference from the prior position, or the just the position plus
135098 ** varint iHeight; (height from leaf level, always 0)
135144 ** varint iHeight; (height from leaf level, always >0)
135173 ** INTERIOR_MIN_TERMS (default 7) keeps large terms from monopolizing
135222 ** After the merge, all segment blocks from the merged level are
135325 ** tokens from a particular input.
135413 ** Retrieve the next token from the tokenizer cursor pCursor. This
135636 ** from that used by SQLite, so the maximum length is 10, not 9.
135835 ** When the core wants to read from the virtual table, it creates a
135849 sqlite3_int64 iPrevId; /* Previous id read from aDoclist */
135874 ** SELECT docid FROM ex1 WHERE b MATCH 'one two three';
135951 ** "Length" field found in doclists stored on disk is omitted from this
136219 ** Read a 64-bit variable-length integer from memory starting at p[0].
136297 int iIn = 1; /* Index of next byte to read from input */
136317 ** Read a single varint from the doclist at *pp and advance *pp to point
136394 ** Construct one or more SQL statements from the format string given
136663 ** The pointer returned points to memory obtained from sqlite3_malloc(). It
136687 ** Return a list of comma separated SQL expressions and a FROM clause that
136690 ** SELECT <list of expressions> FROM %_content AS x ...
136693 ** from left to write. If parameter zFunc is not NULL, then instead of
136699 ** "docid, unzip(x.'a'), unzip(x.'b'), unzip(x.'c') FROM %_content AS x"
136738 fts3Appendf(pRc, &zRet, " FROM '%q'.'%q%s' AS x",
136918 zSql = sqlite3_mprintf("SELECT * FROM %Q.%Q", zDb, zTbl);
137167 ** TABLE statement, use all columns from the content table.
137180 ** column from the aCol[] array. */
137323 ** estimate the cost of loading large doclists from the database. */
137575 ** "SELECT <columns> FROM %_content WHERE rowid = ?"
137667 ** varints from the buffer) does not risk an overread. If zNode is a
137668 ** root node, then the buffer comes from a SELECT statement. SQLite does
137671 ** contents, or two zero bytes. Or, if the node is read from the %_segments
137714 /* Compare the term we are searching for with the term just loaded from
137716 ** to the term from the interior node, then all terms on the sub-tree
137786 char *zBlob = 0; /* Blob read from %_segments table */
137921 ** POSITION_LIST_END and return. Otherwise, read the next varint from *pp,
137933 sqlite3_int64 *pi /* IN/OUT: Value read from position-list */
137992 sqlite3_int64 i1 = 0; /* Last position from pp1 */
137993 sqlite3_int64 i2 = 0; /* Last position from pp2 */
138230 ** This function is used to read a single varint from a buffer. Parameter
138236 ** from *pp. *pp is then set to point 1 byte past the end of the read varint.
138239 ** If it is true, the value read is subtracted from *pVal before this
138243 char **pp, /* IN/OUT: Point to read varint from */
138351 ** read from. And each subsequent docid read from the same input list
138354 ** be a positive value less than or equal to the delta value read from
138356 ** read from the 'other' list. And to the contents of all position lists
138357 ** that will be copied and merged from the input to the output.
138360 ** then the encoding of the first docid from the 'other' input list may
138404 ** the output contains a copy of each position from the right-hand input
138416 int nDist, /* Distance from left to right (1=adjacent) */
138482 ** of the entries from pList at position 0, and terminated by an 0x00 byte.
138691 int iIndex, /* Index to search (from 0 to p->nIndex-1) */
138696 int isScan, /* True to scan from zTerm to EOF */
138765 int iIndex, /* Index to search (from 0 to p->nIndex-1) */
138770 int isScan, /* True to scan from zTerm to EOF */
138883 ** prefix) from the database.
138987 ** The following are copied from sqliteInt.h.
139163 ** This is the xColumn method, called by SQLite to request a value from
139174 sqlite3_vtab_cursor *pCursor, /* Cursor to retrieve value from */
139176 int iCol /* Index of column to read value from */
139253 ** of blocks from the segments table. But this is not considered overhead
139288 const char *zFmt ="SELECT 1 FROM %Q.sqlite_master WHERE tbl_name='%q_stat'";
139487 ** SELECT optimize(t) FROM t LIMIT 1;
140124 /* Determine if doclists may be loaded from disk incrementally. This is
140167 ** This function is used to iterate backwards (from the end to start)
140174 ** function iterates from the end of the doclist to the beginning.
140634 ** data from the %_stat table to calculate it.
140640 ** data stored in all rows of each column of the table, from left
140709 ** table actually contains the same data as the index. To prevent this from
140734 ** to retrieve the entire doclist for the token from the full-text index.
140742 ** After each token doclist is loaded, merge it with the others from the
140779 ** for-loop. Except, limit the value to 2^24 to prevent it from
140813 ** This function is called from within the xFilter method. It initializes
141660 Fts3Expr *p; /* Used to iterate from pExpr to root */
141664 /* Check if this phrase descends from an OR expression node. If not,
142275 sqlite3_vtab_cursor *pCursor, /* Cursor to retrieve value from */
142277 int iCol /* Index of column to read value from */
142316 sqlite3_vtab_cursor *pCursor, /* Cursor to retrieve value from */
142528 ** Extract the next token from buffer z (length n) using the tokenizer
142911 ** is defined), the order of the operators in precedence from highest to
142971 ** bytes read from buffer z. Otherwise, *ppExpr is set to 0 and SQLITE_NOMEM
143223 /* Remove pParent from the original tree. */
143377 ** of each column in the target fts3 table, in order from left to right.
143504 ** expression passed as the first argument. The buffer is obtained from
143745 /* Remove all entries from a hash table. Reclaim all memory.
143920 /* Remove a single entry from the hash table given a pointer to that
143925 Fts3HashElem* elem, /* The element to be removed from the pH */
143998 ** element corresponding to "key" is removed from the hash table.
144097 ** Class derived from sqlite3_tokenizer
144104 ** Class derived from sqlite3_tokenizer_cursor
144353 ** by taking 10 or 3 bytes from the beginning and end.
144389 ** a few bytes from the beginning and the end of the word. If the
144390 ** word contains digits, 3 bytes are taken from the beginning and
144391 ** 3 bytes from the end. For long words without digits, 10 bytes
144392 ** are taken from each end. US-ASCII case folding still applies.
144652 ** Extract the next token from a tokenization cursor. The cursor must
145294 /* TODO(shess) Delimiters need to remain the same from run to run,
145377 ** Extract the next token from a tokenization cursor. The cursor must
145494 ** token: A token from the input.
145838 sqlite3_vtab_cursor *pCursor, /* Cursor to retrieve value from */
145840 int iCol /* Index of column to read value from */
145870 sqlite3_vtab_cursor *pCursor, /* Cursor to retrieve value from */
145931 ** this file contains code to insert, update and delete rows from FTS3
145948 ** When full-text index nodes are loaded from disk, the buffer that they
145954 ** it is always safe to read up to two varints from it without risking an
146002 sqlite3_log(SQLITE_OK, "%d-way merge from level %d", nMerge, (int)iAbsLevel);
146072 ** by the caller. They are valid from the time SegmentReaderNew() returns
146112 char *aData; /* Pointer to block from malloc() */
146211 /* 0 */ "DELETE FROM %Q.'%q_content' WHERE rowid = ?",
146212 /* 1 */ "SELECT NOT EXISTS(SELECT docid FROM %Q.'%q_content' WHERE rowid!=?)",
146213 /* 2 */ "DELETE FROM %Q.'%q_content'",
146214 /* 3 */ "DELETE FROM %Q.'%q_segments'",
146215 /* 4 */ "DELETE FROM %Q.'%q_segdir'",
146216 /* 5 */ "DELETE FROM %Q.'%q_docsize'",
146217 /* 6 */ "DELETE FROM %Q.'%q_stat'",
146219 /* 8 */ "SELECT (SELECT max(idx) FROM %Q.'%q_segdir' WHERE level = ?) + 1",
146221 /* 10 */ "SELECT coalesce((SELECT max(blockid) FROM %Q.'%q_segments') + 1, 1)",
146224 /* Return segments in order from oldest to newest.*/
146226 "FROM %Q.'%q_segdir' WHERE level = ? ORDER BY idx ASC",
146228 "FROM %Q.'%q_segdir' WHERE level BETWEEN ? AND ?"
146231 /* 14 */ "SELECT count(*) FROM %Q.'%q_segdir' WHERE level = ?",
146232 /* 15 */ "SELECT max(level) FROM %Q.'%q_segdir' WHERE level BETWEEN ? AND ?",
146234 /* 16 */ "DELETE FROM %Q.'%q_segdir' WHERE level = ?",
146235 /* 17 */ "DELETE FROM %Q.'%q_segments' WHERE blockid BETWEEN ? AND ?",
146237 /* 19 */ "DELETE FROM %Q.'%q_docsize' WHERE docid = ?",
146239 /* 21 */ "SELECT size FROM %Q.'%q_docsize' WHERE docid=?",
146240 /* 22 */ "SELECT value FROM %Q.'%q_stat' WHERE id=?",
146245 /* 26 */ "DELETE FROM %Q.'%q_segdir' WHERE level BETWEEN ? AND ?",
146246 /* 27 */ "SELECT ? UNION SELECT level / (1024 * ?) FROM %Q.'%q_segdir'",
146248 /* This statement is used to determine which level to read the input from
146253 /* 28 */ "SELECT level FROM %Q.'%q_segdir' GROUP BY level HAVING count(*)>=?"
146257 ** created by merging the oldest :2 segments from absolute level :1. See
146260 " FROM %Q.'%q_segdir' WHERE level = ? AND idx < ?",
146264 /* 30 */ "DELETE FROM %Q.'%q_segdir' WHERE level = ? AND idx = ?",
146272 ** Read a single entry from the %_segdir table. The entry from absolute
146275 "FROM %Q.'%q_segdir' WHERE level = ? AND idx = ?",
146286 /* 34 */ "SELECT 1 FROM %Q.'%q_segments' WHERE blockid=? AND block IS NULL",
146290 /* 35 */ "SELECT idx FROM %Q.'%q_segdir' WHERE level=? ORDER BY 1 ASC",
146294 /* 36 */ "SELECT max( level %% 1024 ) FROM %Q.'%q_segdir'",
146296 /* Return segments in order from oldest to newest.*/
146298 "FROM %Q.'%q_segdir' WHERE level BETWEEN ? AND ? "
146349 sqlite3_stmt *pStmt = 0; /* Statement requested from fts3SqlStmt() */
146494 ** all rows in the %_segdir table, from oldest to newest. If successful,
146501 ** The statement returns the following columns from the %_segdir table:
146524 /* "SELECT * FROM %_segdir WHERE level BETWEEN ? AND ? ORDER BY ..." */
146533 /* "SELECT * FROM %_segdir WHERE level = ? ORDER BY ..." */
146938 ** Remove all data from the FTS3 table. Clear the hash table containing
146947 /* Delete everything from the shadow tables. Except, leave %_content as
146973 ** (an integer) of a row about to be deleted. Remove all terms from the
146978 Fts3Table *p, /* The FTS table to delete from */
147029 ** SELECT max(idx) FROM %_segdir WHERE level = :iLevel
147087 ** This function reads data from a single row of the %_segments table. The
147406 ** position. The exception is if this node is being loaded from disk
148306 ** are different from that integer. i.e. if deleting the document with docid
148352 ** SELECT max(level) FROM %Q.'%q_segdir' WHERE level BETWEEN ? AND ?
148380 ** SELECT max(level) FROM %Q.'%q_segdir' WHERE level BETWEEN ? AND ?
149257 int rc; /* Result code from subfunctions */
149305 int rc; /* Result code from subfunctions */
149577 ** An object of the following type is used to read data from a single
149630 int nPrefix = 0; /* Bytes to copy from previous term */
150082 ** * The first key read from the input (arguments zKey and nKey) is
150104 int rc2; /* Return code from sqlite3_reset() */
150267 Fts3MultiSegReader *pCsr, /* Cursor that data will be read from */
150318 ** Remove an entry from the %_segdir table. This involves running the
150321 ** DELETE FROM %_segdir WHERE level = :iAbsLevel AND idx = :iIdx
150330 sqlite3_int64 iAbsLevel, /* Absolute level to delete from */
150348 ** One or more segments have just been removed from absolute level iAbsLevel.
150350 ** the idx values are a contiguous sequence starting from 0.
150425 ** or greater than zTerm/nTerm (for internal nodes) from aNode/nNode.
150474 ** Remove all terms smaller than zTerm/nTerm from segment iIdx in absolute
150475 ** level iAbsLevel. This may involve deleting entries from the %_segments
150559 ** merge (or partially merge) two or more segments from absolute level
150562 ** Each input segment is either removed from the db completely (if all of
150597 /* The incremental merge did not copy all the data from this
150634 ** Load an incr-merge hint from the database. The incr-merge hint, if one
150637 ** If successful, populate blob *pHint with the value read from the %_stat
150691 ** Read the last entry (most recently pushed) from the hint blob *pHint
150732 Blob hint = {0, 0, 0}; /* Hint read from %_stat table */
150765 /* If the hint read from the %_stat table is not empty, check if the
150783 ** is removed from the hint blob. */
151487 ** should be deleted from the database before inserting the new row. Or,
151655 Fts3Cursor *pCsr; /* Cursor snippet is being generated from */
151656 int iCol; /* Extract snippet from this column */
151673 int iCol; /* Column snippet is extracted from */
151813 ** list is a list of unique integers, sorted from smallest to largest. Each
151906 ** indirectly descended from the right-hand-side of a NOT operator). If
152090 ** from column iCol that represent the "best" snippet. The best snippet
152106 int iCol, /* Index of column to create snippet from */
152242 Fts3Table *pTab, /* FTS3 table snippet comes from */
152245 const char *zDoc, /* Document text to extract snippet from */
152302 ** Extract the snippet text for fragment pFragment from cursor pCsr and
152318 const char *zDoc; /* Document text to extract snippet from */
152325 int iCol = pFragment->iCol+1; /* Query column to extract text from */
152531 int iPhrase, /* Phrase number (numbered from zero) */
152670 int iPhrase, /* Phrase number (numbered from zero) */
152998 int iCol, /* Extract snippet from this column */
153006 /* The returned text includes up to four fragments of text extracted from
153096 int iPos; /* Position just read from pList */
153097 int iOff; /* Offset of this term from read positions */
153187 ** no way that this operation can fail, so the return code from
153197 ** needs to transform the data from utf-16 to utf-8), return SQLITE_NOMEM
153335 ** from the sqlite3 source file utf.c. If this file is compiled as part
153613 ** Extract the next token from a tokenization cursor. The cursor must
154102 ** table that maps from the entries rowid to the id of the node that it
154172 ** various strategies. If possible, this estimate is loaded from the
154204 /* Statements to read/write/delete a record from xxx_node */
154209 /* Statements to read/write/delete a record from xxx_rowid */
154214 /* Statements to read/write/delete a record from xxx_parent */
154243 ** record intermediate results from the tree walk.
154265 ** cells are removed from the overfull node and reinserted into the tree.
154376 ** A single cell from a node, deserialized
154542 ** Remove node pNode from the node hash table.
154681 ** Remove the cell with index iCell from node pNode.
154776 RtreeNode *pNode, /* The node from which to extract the ID */
154777 int iCell /* The cell index from which to extract the ID */
154784 ** Return coordinate iCoord from cell iCell in node pNode.
154788 RtreeNode *pNode, /* The node from which to extract a coordinate */
154976 ** Convert raw bits from the on-disk RTree record into a coordinate value.
155706 ** table scan strategies to choose from (in order from most to
155736 ** is 'a', the second from the left 'b' etc.
155923 ** This function implements the ChooseLeaf algorithm from Gutman[84].
156037 ** nIdx. The aIdx array contains the set of integers from 0 to
156109 ** nIdx. The aIdx array contains the set of integers from 0 to
156175 ** Implementation of the R*-tree variant of SplitNode from Beckman[1990].
156315 ** all cells from node pLeft. Then zero the original node.
156510 /* Remove the node from the in-memory hash table and link it into
156557 /* Remove the cell from the node. This call just moves bytes around
156563 ** number of cells, remove it from the tree. Otherwise, update the
156760 ** Remove the entry with rowid=iDelete from the r-tree structure.
156779 /* Delete the cell in question from the leaf node. */
156824 /* Re-insert the contents of any underfull nodes removed from the tree. */
156847 #define RNDAWAY (1.0 + 1.0/8388608.0) /* Round away from zero */
156964 ** record to delete from the r-tree table. The following block does
157031 const char *zFmt = "SELECT stat FROM %Q.sqlite_stat1 WHERE tbl = '%q_rowid'";
157067 rtreeDisconnect, /* xDisconnect - Disconnect from a table */
157100 "SELECT data FROM '%q'.'%q_node' WHERE nodeno = :1",
157102 "DELETE FROM '%q'.'%q_node' WHERE nodeno = :1",
157105 "SELECT nodeno FROM '%q'.'%q_rowid' WHERE rowid = :1",
157107 "DELETE FROM '%q'.'%q_rowid' WHERE rowid = :1",
157110 "SELECT parentnode FROM '%q'.'%q_parent' WHERE nodeno = :1",
157112 "DELETE FROM '%q'.'%q_parent' WHERE nodeno = :1"
157185 ** This function is called from within the xConnect() or xCreate() method to
157221 "SELECT length(data) FROM '%q'.'%q_node' WHERE nodeno = 1",
157343 ** SELECT rtreenode(2, data) FROM rt_node;
157396 ** from the front of a blob that is an r-tree node. For example:
157398 ** SELECT rtreedepth(data) FROM rt_node WHERE nodeno=1;
157667 /* Read (and consume) the next character from the input pattern. */
157782 ** This function is called when an ICU function called from within
157978 assert(!"Unexpected return value from ucol_strcoll()");
158005 int rc; /* Return code from sqlite3_create_collation_x() */
158266 ** Extract the next token from a tokenization cursor.
158377 ** update, insert or delete from the target table.
158474 ** may be loaded from or written to the persistent media multiple times.
158494 ** to read from the original database snapshot. In other words, partially
158596 ** For each row to DELETE from the target database as part of the RBU
158603 ** For each row to UPDATE from the target database as part of the RBU
158659 ** However, RBU is more efficient if reading the rows in from each data_xxx
158694 ** resume the RBU update from where it left off.
158812 ** system recovery RBU may resume the update from the point at which the state
158813 ** was last saved. In other words, from the most recent successful call to
159010 ** A structure to store values read from the rbu_state table in memory.
159100 #define RBU_DELETE 2 /* Delete a row from a main table b-tree */
159101 #define RBU_IDX_DELETE 3 /* Delete a row from an aux. index b-tree */
159189 ** are lifted from the fossil source code (http://fossil-scm.org). They
159194 ** Read bytes from *pz and convert them into a positive integer. When
159375 ** End of code taken from fossil.
159673 "SELECT rbu_target_name(name) AS target, name FROM sqlite_master "
159681 " FROM main.sqlite_master "
159789 ** returns a copy of the string in memory obtained from sqlite3_malloc().
159877 ** 0) SELECT count(*) FROM sqlite_master where name=%Q AND IsVirtual(%Q)
159879 ** 2) SELECT count(*) FROM sqlite_master where name=%Q
159891 " FROM sqlite_master"
159914 "SELECT rootpage FROM sqlite_master WHERE name = %Q", zIdx
160021 sqlite3_mprintf("SELECT * FROM '%q'", pIter->zDataTbl)
160067 p->zErrmsg = sqlite3_mprintf("column missing from %q: %s",
160118 ** used to read from an data_xxx or rbu_tmp_xxx table while updating the
160299 "_rowid_ = (SELECT id FROM rbu_imposter2 WHERE %z)", zList
160336 ** The memory for the returned string is obtained from sqlite3_malloc().
160390 ** The memory for the returned string is obtained from sqlite3_malloc().
160500 "SELECT name FROM sqlite_master WHERE rootpage = ?"
160715 sqlite3_mprintf("DELETE FROM \"rbu_imp_%w\" WHERE %s", zTbl, zWhere)
160724 "SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' ORDER BY %s%s",
160730 "SELECT %s, rbu_control FROM '%q' "
160733 "SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' "
160779 "DELETE FROM \"%s%w\" WHERE %s", zWrite, zTbl, zWhere
160793 "SELECT *%s FROM '%q' WHERE 0;"
160832 /* Create the SELECT statement to read keys from data_xxx */
160836 "SELECT %s, rbu_control%s FROM '%q'%s",
160988 rbuMPrintfExec(p, p->dbMain, "SELECT * FROM sqlite_master");
161004 ** This routine is a copy of the sqlite3FileSuffix3() routine from the core.
161081 p->rc = sqlite3_exec(p->dbMain, "SELECT * FROM sqlite_master", 0, 0, 0);
161093 ** * Attempts to read from the *-wal file or write to the database file
161110 ** data from the wal file into the database file according to the
161134 ** Called when iAmt bytes are read from offset iOff of the wal file while
161177 ** a single frame of data from the wal file into the database file, as
161444 ** SELECT <cols>, rbu_control, rbu_rowid FROM ....
161577 "DELETE FROM %s.'rbu_tmp_%q'", p->zStateDb, pIter->zDataTbl
161692 sqlite3_mprintf("SELECT k, v FROM %s.rbu_state", p->zStateDb)
161749 ** considered equal, and NULL is considered distinct from all other values.
161761 ** things so that the next call to sqlite3rbu_step() continues on from
161929 ** level pager to use "journal_mode=off". This prevents it from
162122 ** from automatically checkpointing a *-wal (or *-oal) file from within
162182 ** Read and return an unsigned 32-bit big-endian integer from the buffer
162193 ** Read data from an rbuVfs-file.
162304 /* Do not allow EXCLUSIVE locks. Preventing SQLite from taking this
162305 ** prevents it from checkpointing the database from sqlite3_close(). */
162409 /* Magic number 1 is the WAL_CKPT_LOCK lock. Preventing SQLite from
162410 ** taking this lock also prevents any checkpoints from occurring.
162601 ** parameter from it. */
162896 ** information from an SQLite database in order to implement the
162911 ** The value of the 'path' column describes the path taken from the
162916 ** a b-tree is '/000/'. (Btrees store content ordered from left to right
162925 ** from. For example, the three overflow pages in a chain linked from
162942 " path INTEGER, /* Path to page from root */" \
163058 ** Disconnect from or destroy a statvfs virtual table.
163301 ** offset with actual values obtained from ZIPVFS.
163482 " FROM \"%w\".%s WHERE rootpage!=0"
163816 /* Append N bytes from zIn onto the end of the JsonString string.
164644 ** obtained from sqlite3_malloc().
164837 ** with the result from each path. Throw an error if the JSON or any PATH
164923 ** Remove the named elements from JSON and return the result. malformed
165750 ** are numbered starting from zero.
165759 ** Phrase matches are numbered starting from zero, so the iIdx argument
165776 ** ... FROM ftstable WHERE ftstable MATCH $p ORDER BY rowid
165836 ** SELECT count(*) FROM ftstable;
165944 ** or removed from the FTS table. The tokenizer is being invoked to
165945 ** determine the set of tokens to add to (or delete from) the
165968 ** of the first byte of and first byte immediately following the text from
166278 ** be gleaned from the CREATE VIRTUAL TABLE statement.
166280 ** And all information loaded from the %_config table.
166328 /* Values loaded from the %_config table */
166534 ** Insert or remove data to or from the index. Each time a document is
166535 ** added to or removed from the index, this function is called one or more
166547 const char *pToken, int nToken /* Token to add or remove to or from index */
166557 i64 iDocid /* Docid to add or remove data from */
166595 ** Return the total number of entries read from the %_data table by
166671 const char *pToken, int nToken /* Token to add or remove to or from index */
166708 #define FTS5_STMT_SCAN_ASC 0 /* SELECT rowid, * FROM ... ORDER BY 1 ASC */
166709 #define FTS5_STMT_SCAN_DESC 1 /* SELECT rowid, * FROM ... ORDER BY 1 DESC */
166710 #define FTS5_STMT_LOOKUP 2 /* SELECT rowid, * FROM ... WHERE rowid=? */
166963 ** directly to the parser from the tokenizer.
166973 ** sqlite3Fts5ParserARG_FETCH Code to extract %extra_argument from fts5yypParser
167331 ** when the symbol is popped from the stack during a
167376 ** is popped from the stack, then call it.
167407 ** obtained from sqlite3Fts5ParserAlloc.
167409 ** from malloc.
167674 /* Silence complaints from purify about fts5yygotominor being uninitialized
167685 ** from wireshark this week. Clearly they are stressing Lemon in ways
167887 ** The first argument is a pointer to a structure obtained from
168545 const double k1 = 1.2; /* Constant "k1" from BM25 formula */
168546 const double b = 0.75; /* Constant "b" from BM25 formula */
169273 ** Gobble up the first bareword or quoted word from the input buffer zIn.
169289 const char *zIn, /* Buffer to gobble string/bareword from */
169748 const char *zSelect = "SELECT k, v FROM %Q.'%q_config'";
169825 ** Functions generated by lemon from fts5parse.y.
169931 ** Read the first token from the nul-terminated string at *pz.
170288 const u8 *a, int n, /* Buffer to read position list from */
171360 Fts5ExprPhrase *pOrig; /* The phrase extracted from pExpr */
172242 const char *pToken, int nToken /* Token to add or remove to or from index */
172393 ** Extract all tokens from hash table iHash and link them into a list
172587 ** Then, for each level from 0 to nMax:
172591 ** + for each segment from oldest to newest:
172600 ** from left to right, the total number of tokens in the column for all
172728 ** sequentially starting from 1.
172756 ** Each time a blob is read from
172805 sqlite3_stmt *pDeleter; /* "DELETE FROM %_data ... id>=? AND id<=?" */
172807 sqlite3_stmt *pIdxDeleter; /* "DELETE FROM %_idx WHERE segid=? */
172885 ** segments that this object is merging data from. Both the aSeg[] and
172927 ** Leaf page number containing the last term read from the segment. And
172960 /* The page and offset from which the current term was read. The offset
173139 ** Retrieve a record from the %_data table.
173260 ** DELETE FROM %_data WHERE id BETWEEN $iFirst AND $iLast
173269 "DELETE FROM '%q'.'%q_data' WHERE id>=? AND id<=?",
173300 "DELETE FROM '%q'.'%q_idx' WHERE segid=?",
173360 /* Read the total number of levels and segments from the start of the
173996 u8 *a = pIter->pLeaf->p; /* Buffer to read data from */
174029 u8 *a = pIter->pLeaf->p; /* Buffer to read data from */
174425 ** doclist-index from disk and initialize an iterator at (pIter->pDlidx).
174609 "SELECT pgno FROM '%q'.'%q_idx' WHERE "
175123 ** is zero or greater, data from the first nSegment segments on level iLevel
175888 /* All keys from
175951 int iLvl, /* Level to read input from */
176002 /* Read input from all segments in the input level */
176047 /* Remove the redundant segments from the %_data table */
176052 /* Remove the redundant segments from the input level */
176090 /* Set iBestLvl to the level to read input segments from. */
176557 int iCol /* Column to extract from poslist */
176745 /* Copy entry from i1 */
176751 /* Copy entry from i2 */
176810 Fts5Index *p, /* Index to read from */
176828 Fts5IndexIter *p1 = 0; /* Iterator used to gather data from index */
177045 ** Insert or remove data to or from the index. Each time a document is
177046 ** added to or removed from the index, this function is called one or more
177058 const char *pToken, int nToken /* Token to add or remove to or from index */
177303 ** Read and decode the "averages" record from the database.
177339 ** Return the total number of blocks this module has read from the %_data
177418 int iSegid, /* Segment id to load from */
177528 ** a time, and the multi-iter loop from which this function is called
177653 "SELECT segid, term, (pgno>>1), (pgno&1) FROM %Q.'%q_idx' WHERE segid=%d",
177667 /* If the leaf in question has already been trimmed from the segment,
177815 ** variable cksum2) based on entries extracted from the full-text index
177827 i64 iPos = 0; /* Position read from poslist */
177889 ** Decode a segment-data rowid from the %_data table. This function is
177893 i64 iRowid, /* Rowid from %_data table */
178004 ** The return value is the number of bytes read from the input buffer.
178022 ** The return value is the number of bytes read from the input buffer.
178105 Fts5Buffer term; /* Current term read from page */
178108 int iPgidxPrev = 0; /* Previous value read from pgidx */
178360 Fts5Cursor *pSortCsr; /* Sort data from this cursor */
178373 ** SELECT rowid, <fts> FROM <fts> ORDER BY +rank;
178414 /* Zero from this point onwards on cursor reset */
178425 /* "rank" function. Populated on demand from vtab.xColumn(). */
178921 /* Remove the cursor from the Fts5Global.pCsr list */
179087 ** And since the statement required here reads from this very virtual
179092 "SELECT rowid, rank FROM %Q.%Q ORDER BY %s(%s%s%s) %s",
179699 (nArg>1 ? "UPDATE" : "DELETE from"), pConfig->zName
180290 ** as it can be derived from the total size of the blob.
180320 ** This is the xColumn method, called by SQLite to request a value from
180324 sqlite3_vtab_cursor *pCursor, /* Cursor to retrieve value from */
180326 int iCol /* Index of column to read value from */
180811 "SELECT %s FROM %s T WHERE T.%Q >= ? AND T.%Q <= ? ORDER BY T.%Q ASC",
180812 "SELECT %s FROM %s T WHERE T.%Q <= ? AND T.%Q >= ? ORDER BY T.%Q DESC",
180813 "SELECT %s FROM %s T WHERE T.%Q=?", /* LOOKUP */
180817 "DELETE FROM %Q.'%q_content' WHERE id=?", /* DELETE_CONTENT */
180819 "DELETE FROM %Q.'%q_docsize' WHERE id=?", /* DELETE_DOCSIZE */
180821 "SELECT sz FROM %Q.'%q_docsize' WHERE id=?", /* LOOKUP_DOCSIZE */
180824 "SELECT %s FROM %s AS T", /* SCAN */
181121 sqlite3_stmt *pSeek; /* SELECT to read row iDel from %_data */
181184 ** Load the contents of the "averages" record from disk into the
181229 ** Remove a row from the FTS table.
181335 "DELETE FROM %Q.'%q_data';"
181336 "DELETE FROM %Q.'%q_idx';",
181342 "DELETE FROM %Q.'%q_docsize';",
181545 zSql = sqlite3_mprintf("SELECT count(*) FROM %Q.'%q_%s'",
181687 ** Obtain an SQLite statement handle that may be used to read data from the
181733 const u8 *aBlob, int nBlob /* Record to read varints from */
182027 ** from the sqlite3 source file utf.c. If this file is compiled as part
182257 int iCode; /* non-ASCII codepoint read from input */
183465 ** This is a copy of the sqlite3GetVarint32() routine from the SQLite core.
183544 ** Read a 64-bit variable-length integer from memory starting at p[0].
183588 /* CSE1 from below */
183666 /* CSE2 from below */
184040 "SELECT t.%Q FROM %Q.%Q AS t WHERE t.%Q MATCH '*id'",
184136 i64 iPos = 0; /* 64-bit position read from poslist */
184210 sqlite3_vtab_cursor *pCursor, /* Cursor to retrieve value from */
184212 int iCol /* Index of column to read value from */