Home | History | Annotate | Download | only in orig

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.
26616 int lastErrno; /* The unix errno from last I/O error */
26637 unsigned fsFlags; /* cached details from statfs() */
26664 /* This variable holds the process id (pid) from when the xRandomness()
26665 ** method was called. If xOpen() is called from a different process id,
26673 #define UNIXFILE_EXCL 0x01 /* Connections from one process only */
26892 ** Define various macros that are missing from some systems.
26951 ** log if they come from non-root processes. So avoid calling fchown() if
27268 ** Helper function for printing out trace information from debugging
27600 ** But not so. Since both locks came from the same process, the
27726 ** errno and, if possible, the human-readable equivalent from strerror() or
27742 char *zErr; /* Message from strerror() or equivalent */
27798 ** So we don't even try to recover from an EINTR. Just log the error
28056 ** If the pFile was opened read/write from unix-excl, then the only lock
28110 ** transitions leaving the lock state different from what it started but
28136 ** byte'. If this is successful, a random byte from the 'shared byte
28159 ** locking a random byte from a range, concurrent SHARED locks may exist
28185 ** (1) We never move from unlocked to anything higher than shared lock.
28315 ** transitioning from a SHARED to a RESERVED lock. The change
28316 ** from SHARED to RESERVED marks the beginning of a normal
28420 int tErrno; /* Error code from system call errors */
28669 ** connections from reading or writing the database.
28734 ** transitions leaving the lock state different from what it started but
28958 ** transitions leaving the lock state different from what it started but
28970 ** above are really EXCLUSIVE locks and exclude all other processes from
29135 ** transitions leaving the lock state different from what it started but
29147 ** above are really EXCLUSIVE locks and exclude all other processes from
29385 ** transitions leaving the lock state different from what it started but
29420 ** (1) We never move from unlocked to anything higher than shared lock.
29754 ** be necessary to define _XOPEN_SOURCE to be 500. This varies from
29811 ** Read data from a file into a buffer. Return SQLITE_OK if all
29838 ** data from the memory mapping using memcpy(). */
29869 ** absolute offset iOff, then attempt to write nBuf bytes of data from
29877 const void *pBuf, /* Copy data from this buffer to the file */
29926 ** Write data from a buffer into a file. Return SQLITE_OK on success
29973 ** data from the memory mapping using memcpy(). */
30200 /* Unix cannot, but some systems may return SQLITE_FULL from here. This
30262 ** when restoring a database using the backup API from a zero-length
30273 ** use read() and write() to access data beyond this point from now on.
30569 /* full bitset of atomics from max sector size and smaller */
30577 /* full bitset of atomics from max sector size and smaller */
30724 ** Apply posix advisory locks for all bytes from ofst through ofst+n-1.
30862 ** from the database file is used, then differing access permissions
30993 ** the cover of the unixEnterMutex() mutex and the pointer from the
31016 ** are numbered starting from zero. Each shared-memory region is szRegion
31165 ** different here than in posix. In xShmLock(), one can go from unlocked
31166 ** to shared and back or from unlocked to exclusive and back. But one may
31167 ** not go from shared to exclusive or from exclusive to shared.
31314 /* Remove connection p from the set of connections associated
31587 ** strategy from that.
31599 ** from be cast into a function pointer.
32157 ** vxworks would not benefit from the change (it might, we're not sure),
32233 ** the path to the associated database file from zPath. This block handles
32746 /* We have to initialize zBuf to prevent valgrind from reporting
32785 ** requested from the underlying operating system, a number which
32956 ** actual proxy file name is generated from the name and path of the
33143 ** Create a new VFS file descriptor (stored in memory obtained from
33615 ** from the conch file or the path was allocated on the stack
33667 ** Store the conch filename in memory obtained from sqlite3_malloc64().
33966 ** transitions leaving the lock state different from what it started but
34076 ** should be the only routines in this file that are visible from other
34089 ** silly C90 rules prohibit a void* from being cast to a function pointer
34421 # error "WAL mode requires support from the Windows NT kernel, compile\
34426 # error "Memory mapped files require support from the Windows NT kernel,\
34641 DWORD lastErrno; /* The Windows errno from the last I/O error */
35631 ** being held by us, no other function (i.e. from another thread) should
35995 ** Space to hold the returned string is obtained from malloc.
36020 ** obtained from sqlite3_malloc().
36048 ** from sqlite3_malloc.
36077 ** Space to hold the returned string is obtained from
36104 ** returned string is obtained from sqlite3_malloc().
36121 ** returned string is obtained from sqlite3_malloc().
36260 ** error code and, if possible, the human-readable equivalent from
36446 /* Replace the backslashes from the filename and lowercase it
36890 ** Read data from a file into a buffer. Return SQLITE_OK if all
36895 sqlite3_file *id, /* File to read from */
36904 DWORD nRead; /* Number of bytes actually read from file */
36917 ** data from the memory mapping using memcpy(). */
36971 ** Write data from a buffer into a file. Return SQLITE_OK on success
36995 ** data from the memory mapping using memcpy(). */
37116 ** use read() and write() to access data beyond this point from now on.
37164 /* Unix cannot, but some systems may return SQLITE_FULL from here. This
37370 ** transitions leaving the lock state different from what it started but
37386 int rc = SQLITE_OK; /* Return code from subroutines */
37818 winFile hFile; /* File handle from winOpen */
37823 HANDLE hMap; /* File handle from CreateFileMapping */
37826 DWORD lastErrno; /* The Windows errno from the last I/O error */
38061 ** the cover of the winShmEnterMutex() mutex and the pointer from the
38101 /* Remove connection p from the set of connections associated
38249 ** are numbered starting from zero. Each shared-memory region is szRegion
38667 ** Convert a filename from whatever the underlying operating system
38669 ** obtained from malloc and must be freed by the calling function.
38689 ** is obtained from malloc and must be freed by the calling
39145 /* Reports from the internet are that performance is always
39474 ** non-zero is returned from this function, the calling function must simply
39603 ** character, discard the initial "/" from the pathname.
40345 ** There are 6 opcodes numbered from 0 through 5. 0 is the
40353 ** 5 N S X Set N bits from S increment X in array only, not in bitvec
40356 ** on both a Bitvec object and on a linear array of bits obtained from malloc.
40480 #define PCACHE_DIRTYLIST_REMOVE 1 /* Remove pPage from dirty list */
40487 ** remove pPage from the dirty list. The 0x02 means add pPage back to
40650 ** Try to obtain a page from the cache.
40674 PCache *pCache, /* Obtain the page from this cache */
40711 PCache *pCache, /* Obtain the page from this cache */
40760 PCache *pCache, /* Obtain the page from this cache */
40786 PCache *pCache, /* Obtain the page from this cache */
40830 ** Drop a page from the cache. There must be exactly one reference to the
40886 ** Clear the PGHDR_NEED_SYNC flag from all dirty pages.
41089 ** Free up as much memory as possible from the page cache.
41161 ** using a separate memory allocation from the database page content. This
41175 ** Memory for a page might come from any of three sources:
41218 u8 isBulkLocal; /* This page from bulk local storage */
41240 ** unused pages from other PCaches) but it also operates without a mutex,
41359 ** This routine is called from sqlite3_initialize() and so it is guaranteed
41422 ** Malloc function used within this file to allocate space from the buffer
41448 ** it from sqlite3Malloc instead.
41466 ** Free an allocated buffer obtained from pcache1Alloc().
41586 ** Malloc function used by SQLite to obtain space from the buffer configured
41595 ** Free an allocated buffer obtained from sqlite3PageMalloc().
41670 ** This function is used internally to remove the page pPage from the
41698 ** Remove the page supplied as an argument from the hash table
41741 ** Discard all pages from cache pCache with a page number (key value)
42063 ** then attempt to recycle a page from the LRU list. If it is the right
42391 ** extracts the least value from the RowSet.
42510 ** Deallocate all chunks from a RowSet. This frees all memory that
42678 ** node taken from the head of *ppList. A depth of 2 means a tree with
42681 ** Use as many entries from the input list as required and update the
42772 ** Extract the smallest element from the RowSet.
42883 ** is separate from the database file. The pager also implements file
42884 ** locking to prevent two processes from writing the same database
42885 ** file simultaneously, or one process from reading the database while
42964 /* Read a page from the write-ahead log, if it is present. */
42989 /* Copy pages from the log to the database file */
43074 ** (4) Reads from the database file are either aligned on a page boundary and
43075 ** an integer multiple of the page size in length or are taken from the
43102 ** of bytes from 24 through 39 inclusive will be changed prior to releasing
43202 ** a locking_mode=exclusive connection can transition from READER to OPEN
43216 ** The pager moves to this state from READER when a write-transaction
43245 ** A pager moves from WRITER_LOCKED state to this state when a page is
43258 ** The pager transitions from WRITER_CACHEMOD into WRITER_DBMOD state
43274 ** A rollback-mode pager changes to WRITER_FINISHED state from WRITER_DBMOD
43312 ** is reloaded from disk (and, if necessary, hot-journal rollback peformed)
43315 ** from the error.
43388 ** from ERROR to OPEN state. At this point there may be a hot-journal file
43400 ** transaction in another process, causing SQLite to read from the database
43534 ** journal file from being successfully finalized, the setMaster flag
43544 ** writing to the database from pagerStress() is disabled altogether.
43547 ** to allocate a new page to prevent the journal file from being written
43551 ** If the SPILLFLAG_NOSYNC bit is set, writing to the database from
43555 ** from happening in between the journalling of two pages on the same sector.
43647 ** or the journal_mode). From another view, these class members describe
43731 SQLITE_API int sqlite3_pager_readdb_count = 0; /* Number of full pages read from DB */
43743 ** was obtained from /dev/random. It is used only as a sanity check.
43760 ** garbage data came from an obsolete journal file, the checksums might
43926 ** a rollback transaction that switches from journal_mode=off
44059 ** Read a 32-bit integer from the given file descriptor. Store the integer
44226 ** This function attempts to read a master journal file name from the
44246 ** If an error occurs while reading from the journal file, an SQLite
44253 u32 cksum; /* MJ checksum value read from journal */
44453 ** the memory prevents valgrind from complaining, so we are willing to
44488 ** (JOURNAL_HDR_SZ bytes) is read from the current location in the journal
44496 ** is set to the value read from the journal header. SQLITE_OK is returned
44501 ** cannot be read from the journal file an error code is returned.
44507 u32 *pNRec, /* OUT: Value read from the nRec field */
44571 /* Check that the values read from the page-size and sector-size fields
44588 /* Update the page-size to match the value read from the journal.
44598 ** is being called from within pager_playback(). The local value
44788 ** out from under us.
44812 /* The pager state may be changed from PAGER_ERROR to PAGER_OPEN here
44930 int rc = SQLITE_OK; /* Error code from journal finalization operation */
44931 int rc2 = SQLITE_OK; /* Error code from db file unlock operation */
45142 ** Read a single page from either the journal file (if isMainJrnl==1) or
45143 ** from the sub-journal (if isMainJrnl==0) and playback that page.
45150 ** If the page number of the page record read from the (sub-)journal file
45160 ** If the page record is successfully read from the (sub-)journal file
45162 ** while reading the record from the (sub-)journal file or while writing
45164 ** is successfully read from the (sub-)journal file but appears to be
45169 ** * If the record is being rolled back from the main journal file
45206 ** only reads from the main journal, not the sub-journal.
45213 /* Read the page number and page data from the journal or sub-journal
45275 ** different from the page content at the start of the transaction.
45328 ** will be read from the database file, which may or may not be
45337 ** the data just read from the sub-journal. Mark the page as dirty
45363 /* If the contents of this page were just restored from the main
45370 ** back as part of a savepoint (or statement) rollback from an
45393 /* Decode the page just read from disk */
45430 ** no such child journal can be found, file zMaster is deleted from
45451 char *zMasterPtr; /* Space to hold MJ filename from a journal file */
45467 /* Load the entire master journal file into space obtained from
45470 ** journal files extracted from regular rollback-journals.
45648 ** number of page records from the journal size.
45665 ** Call the value from the second bullet "nRec". nRec is the number of
45667 ** value of nRec from the size of the journal file. But if a power
45671 ** the value of nRec computed from the file size would be too large. For
45675 ** from the file size. This value is used when the user selects the
45706 int nPlayback = 0; /* Total number of pages restored from journal */
45717 /* Read the master journal name from the journal, if it is present.
45745 /* Read the next journal header from the journal file. If there are
45787 /* If this is the first header read from the journal, truncate the
45880 sqlite3_log(SQLITE_NOTICE_RECOVER_ROLLBACK, "recovered %d pages from %s",
45899 ** the value read from the database file.
45915 /* Try to pull the page from the write-ahead log. */
45989 ** references, the page content is reloaded from the database. If the
45990 ** attempt to reload content from the database is required and fails,
46041 ** + Reload page content from the database (if refcount>0).
46087 ** They will never be read by any client. So remove them from the pDirty
46156 ** This function is called as part of the transition from PAGER_OPEN
46170 ** available from the WAL sub-system if the log file is empty or
46177 /* If the number of pages in the database is not available from the
46268 ** * Pages are played back from the main journal starting at byte
46274 ** back starting from the journal header immediately following
46277 ** * Pages are then played back from the sub-journal file, starting
46286 ** If pSavepoint is NULL, then pages are only played back from the main
46329 /* Begin by rolling back records from the main journal starting at
46376 /* Finally, rollback pages from the sub-journal. Page that were
46433 ** Free as much memory as possible from the pager.
46565 ** SQLITE_BUSY when trying to upgrade from no-lock to a SHARED lock,
46566 ** or when trying to upgrade from a RESERVED lock to an EXCLUSIVE
46567 ** lock. It does *not* invoke the busy handler when upgrading from
46568 ** SHARED to RESERVED, or when upgrading from SHARED to EXCLUSIVE
46632 ** function may be called from within PagerOpen(), before the state
46736 ** Read the first N bytes from the beginning of the file into memory
46745 ** If any IO error apart from SQLITE_IOERR_SHORT_READ is encountered,
46829 ** dirty page were to be discarded from the cache via the pagerStress()
46906 ** The new object will use the pointer pData, obtained from xFetch().
47131 ** byte to the start of it to prevent it from being recognized.
47811 /* Verify that the database file has not be deleted or renamed out from
47814 ** code from sqlite3OsAccess()) if the database has gone missing.
47837 ** This function is called after transitioning from PAGER_UNLOCK to
47849 ** exists, that is probably an old journal left over from a prior
47903 ** journal is a remnant from a prior database with the same name where
47989 /* This routine is only called from b-tree and only when there are no
48125 ** flush the cache. The hasHeldSharedLock flag prevents this from
48221 ** read from the database file. In some cases, the pcache module may
48239 ** a) When reading a free-list leaf page from the database, and
48243 ** from the savepoint journal.
48246 ** being read from the database. Additionally, the bits corresponding
48272 u32 iFrame = 0; /* Frame to read from WAL file */
48300 ** Otherwise, request the page from the PCache layer. */
48437 ** not read the page from disk. Return a pointer to the page,
48637 ** transactions may copy data from the sub-journal into the database
49360 ** current transaction are either expelled from the cache or reverted to
49361 ** their pre-transaction state by re-reading data from the database or
49768 ** the page we are moving from.
49818 ** from its hash chain. Also, if the PGHDR_NEED_SYNC flag was set for
49828 /* Do not discard pages from an in-memory database since we might
49972 /* This routine is only called from the OP_JournalMode opcode, and
49994 /* When transistioning from TRUNCATE or PERSIST to any other journal
50236 ** to switching from WAL to rollback mode.
50319 ** Each frame records the revised content of a single page from the
50329 ** frames can overwrite the old ones. A WAL always grows from beginning
50332 ** are leftovers from prior checkpoints.
50354 ** 8: Salt-1 (copied from the header)
50355 ** 12: Salt-2 (copied from the header)
50379 ** for i from 0 to n-1 step 2:
50396 ** value is randomized. This prevents old and new frames in the WAL from
50402 ** To read a page from the database (call it page number P), a reader
50407 ** frame or are followed by a commit frame, then page P is read from
50415 ** of the database from a single point in time. This technique allows
50436 ** be) reconstructed from the original WAL file. In fact, the VFS is required
50541 ** from the hash table at this point.
50611 u32 aSalt[2]; /* Two salt values copied from WAL header */
50621 ** back into the database. (We call the act of moving content from WAL to
50625 ** However, a WAL_WRITE_LOCK thread can move the value of nBackfill from
50635 ** directly from the database.
50642 ** The checkpointer may only transfer frames from WAL to database where
50651 ** get all their all content directly from the database file and ignore
50662 ** order to read from any aReadMark[] entries.
50674 ** from the region of the file on which locks are applied.
50775 int iPrior; /* Last result returned from
50813 ** numbered from zero.
50837 /* Request a pointer to the required page from the VFS */
50876 ** architecture, it returns the u32 value that results from interpreting
50965 ** 8: Salt-1 (copied from the wal-header)
50966 ** 12: Salt-2 (copied from the wal-header)
51128 ** numbered starting from 0.
51175 ** are numbered starting from 0.
51200 ** Remove entries from the hash table that point to WAL slots greater
51303 ** Remove the remnants of that writers uncommitted transaction from
51356 ** wal-index to prevent other threads/processes from doing anything
51400 i64 iOffset; /* Next offset to read from log file */
51402 u32 magic; /* Magic value read from WAL header */
51403 u32 version; /* Magic value read from WAL header */
51458 /* Read all frames from the log file. */
51462 u32 nTruncate; /* dbsize field from frame header */
51506 /* If more than one frame was recovered from the log file, report an
51513 "recovered %d frames from WAL file %s",
51547 ** client from unlinking the WAL or wal-index file. If another process
51937 ** c) any existing readers are reading exclusively from the database
51938 ** file - there are no readers that may attempt to read a frame from
51947 ** one obtained from sqlite3_randomness()).
51965 ** Copy as much content as we can from the WAL back into the database file
51968 ** The amount of information copies from WAL to database might be limited
52033 ** cannot be backfilled from the WAL.
52263 ** If and only if the read is consistent and the header is different from
52281 ** from the file. If this happens, return non-zero.
52285 ** Memory barriers are used to prevent the compiler or the hardware from
52317 ** Read the wal-index header from the wal-index and into pWal->hdr.
52319 ** wal-index from the WAL before returning.
52432 ** completely and get all content directly from the database file.
52526 ** snapshot. Since holding READ_LOCK(0) prevents a checkpoint from
52546 ** the WAL to get at content from recent commits. The job now is
52603 ** to read any frames earlier than minFrame from the wal file - they
52604 ** can be safely read directly from the database file.
52616 ** that it can read version A from the database file. However, since
52688 u32 iRead = 0; /* If !=0, WAL frame to return data from */
52693 /* This routine is only be called from within a read transaction. */
52697 ** no data will be read from the wal under any circumstances. Return early
52713 ** table). This means the value just read from the hash
52781 ** Read the contents of frame iRead from the wal file into buffer pOut
52902 ** (if (a) is false) or simply expels the page from the cache (if (b)
53019 ** the next fsync should occur - passed from sqlite3WalFrames() into
53069 int rc; /* Result code from subfunctions */
53277 ** we can from WAL into the database.
53352 /* Copy data from the log to the database file. */
53403 ** If op is zero, then attempt to change from locking_mode=EXCLUSIVE
53411 ** If op is one, then change from locking_mode=NORMAL into
53535 ** Finding a particular key requires reading O(log(M)) pages from the
53647 ** offsets from the beginning of the page to the cell content in the cell
53767 ** information about the page that is decoded from the raw file page.
53770 ** walk up the BTree from any leaf to the root. Care must be taken to
53817 ** Locks are added (or upgraded from READ_LOCK to WRITE_LOCK) when a cursor
53819 ** from this list when a transaction is committed or rolled back, or when
53864 Btree *pNext; /* List of other sharable Btrees from the same db */
53969 ** based on information extract from the raw disk page.
54034 MemPage *apPage[BTCURSOR_MAX_DEPTH]; /* Pages from root to current page */
54116 ** The purpose of the pointer map is to facility moving pages from one
54358 ** This routine is used only from within assert() statements.
54391 ** reset out from under us.
54460 ** If pSchema is not NULL, then iDb is computed from pSchema and
54539 ** Extract a 2-byte big-endian integer from an array of unsigned bytes.
54543 ** from the header of a btree page. If the page size is 65536 and the page
55023 ** 1) When all data is deleted from a page and the page becomes
55030 ** from the database or written to the journal file (why should it
55038 ** is extracted from the free-list and reused, then the original data
55044 ** set in the bitvec. Whenever a leaf page is extracted from the free-list,
55067 ** This function is called when a free-list leaf page is removed from the
55069 ** page from the pager layer with the 'no-content' flag set. True otherwise.
55210 ** broken out from its caller to avoid unnecessary stack pointer movement.
55317 ** Determine whether or not a cursor has moved from the position where
55320 ** from under them, for example. Cursor might also move if a btree
55335 ** a row having been deleted out from under the cursor).
55343 ** TRUE from sqlite3BtreeCursorHasMoved().
55403 int rc; /* Return code from subfunctions */
55444 ** Read an entry from the pointer map.
55809 ** EVIDENCE-OF: R-44582-60138 SQLite may from time to time reorganize a
55893 ** from the free-list.
55936 /* Remove the slot from the free-list. Update the number of
55955 ** Allocate nByte bytes of space from within the B-Tree page passed
56031 /* Allocate memory from the gap in between the cell pointer array
56232 u16 cellOffset; /* Offset from start of page to first cell pointer */
56382 ** Convert a DbPage obtained from the pager into a MemPage used by
56396 ** Get a page from the pager. Initialize the MemPage.pBt and
56424 ** Retrieve a page from the pager cache. If the requested page is not
56452 ** Get a page from the pager and initialize it.
56629 int rc = SQLITE_OK; /* Result code from this function */
56782 ** determined by the 2-byte integer located at an offset of 16 bytes from
56899 ** remove the BtShared structure from the sharing list. Return
56951 ** bytes of pTmpSpace, but that the first 4 bytes are copied from
57297 int rc; /* Result code from subfunctions */
57376 ** determined by the 2-byte integer located at an offset of 16 bytes from
57710 ** re-read the database size from page 1 if a savepoint or transaction
57874 /* Move page iDbPage from its current location to page number iFreePage */
57975 /* Remove the page from the files free-list. This is not required
58216 ** This function is called from both BtreeCommitPhaseTwo() and BtreeRollback()
58230 ** may still be reading from the database. */
58340 ** pages may be moved or deleted from the database altogether, making
58490 ** from a normal transaction rollback, as no locks are released and the
58845 ** Copy data from a buffer to a page, or from a page to a buffer.
58849 ** from pPayload to the buffer pointed at by pBuf. If eOp is true,
58851 ** of data are copied from the buffer pBuf to pPayload.
58859 int eOp, /* 0 -> copy from page, 1 -> copy to page */
58863 /* Copy data from buffer to page (a write operation) */
58870 /* Copy data from page to buffer (a read operation) */
58886 ** Data is read to or from the buffer pBuf.
58907 BtCursor *pCur, /* Cursor pointing to entry to read from */
58927 assert( eOp!=2 || offset==0 ); /* Always start from
58941 /* Check if data must be read/written to/from the btree page itself. */
59044 ** 2) data is required from the start of this overflow page, and
59048 ** 6) all data from the page is being read.
59051 ** then data can be read directly from the database file into the
59148 ** Return a pointer to payload information from the entry that the
59167 BtCursor *pCur, /* Cursor pointing to entry to read from */
59193 ** including calls from other threads against the same cache.
59261 ** to the page we are coming from. If we are coming from the
59961 ** Allocate a new page from the database file.
60157 /* Extract a leaf from the trunk */
60227 ** Normally, new pages allocated by this block can be requested from the
60229 ** from trying to read the pages content from disk. However, if the
60256 TRACE(("ALLOCATE: %d from end of file (pointer-map page)\n", pBt->nPage));
60279 TRACE(("ALLOCATE: %d from end of file\n", *pPgno));
60547 ** buffer space that is separate from the pPage buffer area */
60640 ** wrong pages from the database.
60706 ** Remove the i-th cell from pPage. This routine effects pPage only.
60709 ** removes the reference to the cell from pPage.
60774 int *pRC /* Read and write return code from here */
60790 ** malformed cell from a leaf page to an interior page, if the cell size
61107 /* Remove cells from the start and end of the page */
61174 /* Unable to edit this page. Rebuild it from scratch instead. */
61253 ** with entries for the new page, and any pointer from the
61278 ** field. The second while(...) loop copies the key value from the
61376 /* Copy the b-tree node content from page pFrom to page pTo. */
61406 ** page are used in the balancing, though both siblings might come from one
61421 ** inserted into or removed from the parent page (pParent). Doing so
61495 ** is called (indirectly) from sqlite3BtreeDelete().
61506 ** either side of pPage. More siblings are taken from one side, however,
61510 ** This loop also drops the divider cells from the parent page. This
61555 /* Drop the cell from the parent page. apDiv[i] still points to
61611 ** into space obtained from aSpace1[]. The divider cells have already
61612 ** been removed from pParent.
61615 from the cells before they are copied
61722 ** in b.apCell[] of the cell that divides page i from page i+1.
61879 ** helps the operating system to deliver pages from the disk more rapidly.
62056 ** is important, as this code needs to avoid disrupting any page from which
62059 ** (1) If cells are moving left (from apNew[iPg] to apNew[iPg-1])
62063 ** (2) If cells are moving right (from apNew[iPg] to apNew[iPg+1])
62072 ** needs to be tested because (2) will always be true from the previous
62215 int rc; /* Return value from subprocedures */
62246 /* Copy the overflow cells from pRoot to pChild */
62548 ** from trying to save the current position of the cursor. */
62571 MemPage *pPage; /* Page to delete cell from */
62595 ** from the internal node. The 'previous' entry is used for this instead
62612 /* If this is a delete operation to remove a row from a table b-tree,
62642 ** itself from within the page. */
62651 ** by the child-page of the cell that was just deleted from an internal
62652 ** node. The cell from the leaf node needs to be moved to the internal
62678 ** pCur is pointing to the leaf page from which a cell was removed to
62679 ** replace the cell deleted from the internal node. This is slightly
62756 /* Read the value of meta[3] from the database to determine where the
62938 ** Delete all information from a single table in the database. iTable is
62970 ** Delete all information from the single table that pCur is open on.
63125 ** from the pager. The BTREE_DATA_VERSION value is not actually stored in the
63128 ** read it from this routine.
63386 "%d of %d pages missing from overflow list starting at %d",
63455 ** removes the root element from the heap (the minimum value in the heap)
63516 int rc; /* Result code from subroutine call */
63559 assert( rc==SQLITE_CORRUPT ); /* The only possible error from InitPage */
63718 ** The loop below pulls entries from the min-heap in order and compares
63768 ** allocation errors, an error message held in memory obtained from
64139 ** only used from within assert() statements
64299 ** Create an sqlite3_backup process to copy the contents of zSrcDb from
64309 sqlite3* pSrcDb, /* Database connection to read from */
64390 ** page iSrcPg from the source database. Copy this data into the
64462 /* Copy the data from the source page into the destination page.
64512 ** Copy nPage pages from the source b-tree to the destination.
64676 ** occurs, the original database will be reconstructed from the
64773 /* Detach this backup from the source pager. */
64923 ** from this function, not directly by the user.
65543 ** "aff". Casting is different from applying affinity in that a cast
65765 ** from sqlite3_value_dup() is used as the argument
65900 ** The data or key is taken from the entry that pCur is currently pointing
65906 ** pMem->zMalloc to hold the content from the btree, if possible. New
65912 ** to read from the disk) then the pMem is left in an inconsistent state.
65916 u32 offset, /* Offset from the start of data to return bytes from. */
65918 int key, /* If true, retrieve from the btree key, not data. */
65942 u32 offset, /* Offset from the start of data to return bytes from. */
65944 int key, /* If true, retrieve from the btree key, not data. */
65947 char *zData; /* Data from the btree layer */
66221 ** Extract a value from the supplied expression in the manner described
66432 ** Attempt to extract a value from pExpr and use it to construct *ppVal.
66451 Expr *pExpr, /* The expression to extract a value from */
66499 ** is 0 etc.) of the unpacked record with a value extracted from expression
66507 ** from the expression (i.e. the expression is a literal value).
66520 ** error if a value cannot be extracted from pExpr. If an error does
66527 Expr *pExpr, /* The expression to extract a value from */
66548 ** Attempt to extract a value from expression pExpr using the methods
66559 Expr *pExpr, /* The expression to extract a value from */
66567 ** Extract the iCol-th column from the nRec-byte record in pRec. Write
66975 ** Add an OP_ParseSchema opcode. This routine is broken out from
66979 ** The zWhere string must have been obtained from sqlite3_malloc().
67035 ** be inserted. The parameter "x" must have been obtained from
67181 ** from failing. */
67216 ** cases from this switch! */
67531 ** This routine is useful when a large program is loaded from a
67536 ** the string is made into memory obtained from sqlite3_malloc().
67659 ** after an OOM fault without having to check to see if the return from
67987 ** information from the vdbe.c source text */
68021 ** sqlite3MemRelease() were called from here. With -O2, this jumps
68299 ** Allocate space from a fixed size buffer and return a pointer to
68322 u8 **ppFrom, /* IN/OUT: Allocate from *ppFrom */
68389 ** the Vdbe from the Parse object that helped generate it so that the
68458 ** This two-pass approach that reuses as much memory as possible from
68496 p->aMem--; /* aMem[] goes from 1..nMem */
68497 p->nMem = nMem; /* not from 0..nMem-1 */
69054 ** This routine is the only way to move the state of a VM from
69095 int mrc; /* Primary error code from p->rc */
69322 ** virtual machine from VDBE_MAGIC_RUN or VDBE_MAGIC_HALT back to
69336 ** and error message from the VDBE into the main database structure. But
69360 /* Save profiling information from this VDBE run.
69426 ** from left to right), or
69455 ** VdbeDelete() also unlinks the Vdbe from the list of VMs associated with
69531 ** pointed to was deleted out from under it. Or maybe the btree was
69533 ** is supposed to be pointing. If the row was deleted out from under the
69548 ** if need be. Return any I/O error from the restore operation.
69560 ** prevents us from positioning the cursor to its correct position.
69564 ** deleted out from under the cursor and if it has, mark the row as
69568 ** not been deleted out from under the cursor, then this routine is a no-op.
69693 ** GCC might have just copying the problem from a prior compiler.
69802 const unsigned char *buf, /* Buffer to deserialize from */
69838 const unsigned char *buf, /* Buffer to deserialize from */
69923 ** The space is either allocated using sqlite3DbMallocRaw() or from within
69927 ** allocation comes from the pSpace/szSpace buffer, *ppFree is set to NULL
69977 u32 idx; /* Offset in aKey[] to read from */
70329 ** key must be a parsed key such as obtained from
70741 ** pCur might be pointing to text obtained from a corrupt database file.
70934 ** Transfer error message text from an sqlite3_vtab.zErrMsg (text stored
70935 ** in memory obtained from sqlite3_malloc) into a Vdbe.zErrMsg (text stored
70936 ** in memory obtained from sqlite3DbMalloc).
71059 ** back to its starting state so that it can be reused. A success code from
71107 ** The following routines extract information from a Mem or sqlite3_value
71219 /* Destroy an sqlite3_value object previously obtained from
71506 ** from interrupting a statement that has not yet started.
71588 int rc = SQLITE_OK; /* Result from sqlite3Step() */
71589 int rc2 = SQLITE_OK; /* Result from sqlite3Reprepare() */
71611 ** The error message from the SQL compiler has already been loaded
71613 ** from the database handle into the statement and sets the statement
71635 ** Extract the user data from a sqlite3_context structure and return a
71644 ** Extract the user data from a sqlite3_context structure and return a
71835 ** Return the number of values available from the current row of the
71854 ** these assert()s from failing, when building with SQLITE_DEBUG defined
71912 ** Specifically, this is called from within:
72012 ** 2 The name of the database that the column derives from
72013 ** 3 The name of the table that the column derives from
72014 ** 4 The name of the table column that the result column derives from
72100 ** Return the name of the database from which a result column derives.
72116 ** Return the name of the table from which a result column derives.
72132 ** Return the name of the table column from which a result column derives.
72437 ** Transfer all bindings from the first statement over to the second.
72458 ** It is misuse to call this routine with statements from different
72669 ** obtained from sqlite3DbMalloc(). If sqlite3.nVdbeExec is 1, then the
72828 ** in this file for details. If in doubt, do not deviate from existing
72840 ** be changed out from under the copy. This macro verifies that nothing
72930 ** iSrcLine is the source code line (from the __LINE__ macro) that
73399 ** This function is only called from within an assert() expression. It
73620 ** Do not deviate from the formatting style currently in use.
73628 ** the one at index P2 from the beginning of
73633 ** that this Goto is the bottom of a loop and that the lines from P2 down
74084 int p1; /* Register to copy from */
74316 ** Subtract the value in register P1 from the value in register P2
74342 u16 flags; /* Combined MEM_* flags from both inputs */
74452 ** defines the function) with P5 arguments taken from register P2 and
74470 ** from register P2 and successors. The result of the function is stored
74518 ** might change from one evaluation to the next. The next block of code
74688 ** This opcode is used when extracting information from a column that
74780 ** the SQLITE_NULLEQ flag were omitted from P5.
74793 ** the SQLITE_NULLEQ flag were omitted from P5.
75213 ** from this record. If there are less that (P2+1)
75248 u32 t; /* A type code from the record header */
75322 ** them, respectively. So the maximum header length results from a
75416 /* If after trying to extract new entries from the header, nHdrParsed is
75454 ** content from disk. NULL will work for the value for strings
75529 ** The mapping from character to affinity is given by the SQLITE_AFF_
75559 ** Data(0) is taken from register P1. Data(1) comes from register P1+1
75564 ** hdr-size field is also a varint which is the offset from the beginning
75876 ** VMs (apart from this one), then a ROLLBACK fails. A COMMIT fails if
75964 ** cookie in P3 differs from the schema cookie in the database header or
75965 ** if the schema generation counter in P4 differs from the current
75968 ** statement and rerun it from the beginning.
76035 /* If the schema-cookie from the database file matches the cookie
76037 ** not reload the schema from the database file.
76041 ** are queried from within xNext() and other v-table methods using
76045 ** to be invalidated whenever sqlite3_step() is called from within
76059 ** Read cookie number P3 from database P1 and write it into register P2.
76146 ** any other process from modifying the database. The read lock is
76252 /* The p2 value always comes from a prior OP_CreateTable opcode and
76419 ** row output from the sorter so that the row can be decomposed into
76485 ** from the beginning toward the end. In other words, the cursor is
76503 ** from the beginning toward the end. In other words, the cursor is
76521 ** from the end toward the beginning. In other words, the cursor is
76539 ** from the end toward the beginning. In other words, the cursor is
77192 ** no-op. As a result, in this case it is OK to delete a record from within a
77299 ** us from having to issue a separate NullRow instruction to clear that cache.
77482 ** from the end toward the beginning. In other words, the cursor is
77518 ** then rewinding that index and playing it back from beginning to
77542 ** from the beginning toward the end. In other words, the cursor is
77749 ** an unpacked index key. This opcode removes that entry from the
77807 ** out from under the cursor. That will never happend for an IdxRowid
77966 ** remove the table or index from the database file.
78002 ** Delete all contents from the ephemeral table or sorter
78073 ** Read and parse all entries from the SQLITE_MASTER table of database P1
78104 "SELECT name, rootpage, sql FROM '%q'.%s WHERE %s ORDER BY rowid",
78144 ** is dropped from disk (using the Destroy opcode) in order to keep
78157 ** is dropped from disk (using the Destroy opcode)
78170 ** is dropped from disk (using the Destroy opcode) in order to keep
78266 ** Extract the smallest value from boolean index P1 and put that value into
78282 /* A value was pulled from the index */
78547 ** different from the current frame if this instruction is being executed
78577 ** If the value of register P1 is 1 or greater, subtract P3 from the
78615 ** initially nonzero, then subtract P3 from the value in register P1 and
78669 ** The P5 arguments are taken from register P2 and its
78680 ** The P5 arguments are taken from register P2 and its
78721 ** might change from one evaluation to the next. The next block of code
78885 "cannot change %s wal mode from within a transaction",
78902 /* Cannot transition directly from MEMORY to WAL. Use mode OFF
78936 ** machines to be created and run. It may not be called from within
79028 ** Also, whether or not P4 is set, check that this is not being called from
79487 ** This opcode records information from the optimizer. It is the
79498 ** readability. From this point on down, the normal indentation rules are
80011 ** Read data from a blob handle.
80154 ** directly from main memory.
80189 ** incrementally as keys are retreived from the sorter by the VDBE. The
80196 ** begins reading keys from that PMA while the background thread proceeds
80204 ** First, T bytes of data from the first SORTER_MAX_MERGE_COUNT PMAs on
80205 ** disk are merged together. Then T bytes of data from the second set, and
80214 ** the main thread to read from.
80338 PmaReader *aReadr; /* Array of PmaReaders to merge data from */
80400 PmaReader *pReader; /* Readr data from here after Rewind() */
80433 sqlite3_file *pFd; /* File handle we are reading from */
80453 ** size. When the IncrMerger is initialized, it reads enough data from
80455 ** corresponding PmaReader object to read from that file and kicks off
80457 ** sorted record data from pMerger.
80462 ** sets the PmaReader fields to read from the new aFile[0] and kicks off
80471 ** keys from pMerger by the calling thread whenever the PmaReader runs out
80476 MergeEngine *pMerger; /* Merge engine thread reads data from */
80556 ** Read the next nByte bytes of data from the PMA p.
80565 PmaReader *p, /* PmaReader from which to take the blob */
80569 int iBuf; /* Offset within buffer to read from */
80580 /* If there is no more data to be read from the buffer, read the next
80581 ** p->nBuffer bytes of data from the file into it. Or, if there are less
80585 int nRead; /* Bytes to read from disk */
80596 /* Readr data from the file. Return early if an error occurs. */
80637 u8 *aNext; /* Pointer to buffer to copy data from */
80655 ** Read a varint from the stream of data accessed by p. Set *pnOut to
80711 SorterFile *pFile, /* Sorter file to read from */
80804 SorterFile *pFile, /* Sorter file to read from */
80990 ** to determine the number of fields that should be compared from the
81117 ** from the main thread. That only occurs SQLITE_MAX_WORKER_THREADS>0 */
81722 ** vdbeSorterCompare() from decoding pReadr2 again.
81724 ** If the two values were equal, then the value from the oldest
81726 ** is sorted from oldest to newest, so pReadr1 contains older values
81779 ** the background thread from a sub-tasks previous turn is still running,
81931 ** Read keys from pIncr->pMerger and populate pIncr->aFile[1]. The format
81933 ** except that the number-of-bytes varint is omitted from the start.
81997 ** aFile[0] such that the PmaReader should start rereading it from the
82001 ** keys from pIncr->pMerger and repopulating aFile[0].
82045 ** Allocate and return a new IncrMerger object to read data from pMerger.
82118 assert( pTask->pUnpacked!=0 ); /* from vdbeSortSubtaskMain() */
82153 ** function returns, the first key of merged data may be read from the
82157 ** objects attached to the PmaReader objects that the merger reads from have
82159 ** set the PmaReader objects up to read from it. In this case all that is
82188 ** reading from the same temp file this makes for more linear file IO.
82288 ** first results are ready from this merger object anyway.
82348 ** PMAs from pTask->file. If no error occurs, set *ppOut to point to
82353 ** first PMA to read from pTask->file. Assuming no error occurs, it is
82359 SortSubtask *pTask, /* Sorter task to read from */
82410 ** tree, counting from zero. This function adds pLeaf to the tree.
82481 ** MergeEngine here. This MergeEngine will read data from exactly
82640 ** from the in-memory list. */
82894 ** Read data from the file.
82897 sqlite3_file *pJfd, /* The journal file from which to read */
82919 const void *zBuf, /* Take data to be written from here */
83112 sqlite3_int64 iOffset; /* Offset from the beginning of the file */
83128 ** Read data from the in-memory journal file. This is the implementation
83132 sqlite3_file *pJfd, /* The journal file from which to read */
83178 const void *zBuf, /* Take data to be written from here */
83348 ** The return value from the callback should be one of the WRC_*
83359 ** The return value from this routine is WRC_Abort to abandon the tree walk
83399 ** any expr callbacks and SELECT callbacks that come from subqueries.
83415 ** FROM clause of SELECT statement p. Do not invoke the select
83416 ** callback on p, but do invoke it on each FROM clause subquery
83443 ** Invoke sqlite3WalkSelect() for subqueries in the FROM clause and
83447 ** the walk of the expressions and FROM clause. The xSelectCallback2()
83449 ** expressions and FROM clause.
83509 ** This needs to occur when copying a TK_AGG_FUNCTION node from an
83536 ** SELECT a+b, c+d FROM t1 ORDER BY 1 COLLATE nocase;
83540 ** SELECT a+b, c+d FROM t1 ORDER BY (a+b) COLLATE nocase;
83543 ** alias is removed from the original expression. The usual value is
83573 ** prevents ExprDelete() from deleting the Expr structure itself,
83646 ** from pSrcList.
83658 ** means that the form of the name is Z and that columns from any table
83860 ** SELECT a+b AS x FROM table WHERE x<10;
83941 /* If a column from a table in pSrcList is referenced, then record
83970 /* Increment the nRef value on all name contexts from TopNC up to
83986 ** from datasource iSrc in SrcList pSrc.
84077 ** column in the FROM clause. This is used by the LIMIT and ORDER BY
84324 int rc; /* Return code from subprocedures */
84744 /* If this is a converted compound query, move the ORDER BY clause from
84827 ** Y: The name of a table in a FROM clause. Or in a trigger
84847 ** SELECT a+b AS x, c+d AS y FROM t1 ORDER BY x;
84851 ** SELECT a+b AS x, c+d AS y FROM t1 ORDER BY a+b;
84856 ** set and the opcode is changed from TK_FUNCTION to TK_AGG_FUNCTION.
84921 ** subqueries in expressions, and subqueries used as FROM clause
85011 ** SELECT * FROM t1 WHERE a;
85012 ** SELECT a AS b FROM t1 WHERE b;
85013 ** SELECT * FROM t1 WHERE (select a from t1);
85357 ** Also propagate EP_Propagate flags up from Expr.x.pList to Expr.flags,
85378 ** Also propagate all EP_Propagate flags from the Expr.x.pList into
85398 ** Propagate all EP_Propagate flags from the Expr.x.pList into
85414 ** obtained from sqlite3DbMalloc(). The calling function
85475 ** Allocate a new expression node from a zero-terminated token that has
85625 ** the SQL statement comes from an external source.
85765 ** to reduce a pristine expression tree from the parser. The implementation
85815 ** descended from the Expr.x.pList or Expr.x.pSelect variables).
85995 ** If cursors, triggers, views and subqueries are all omitted from
86286 /* If pWalker->eCode is 2 then any term of the expression that comes from
86288 ** from being considered constant. */
86326 /* A bound parameter in a CREATE statement that originates from
86368 ** that does no originate from the ON or USING clauses of a join.
86369 ** Return 0 if it involves variables or function calls or terms from
86551 if( pSrc->nSrc!=1 ) return 0; /* Single term in FROM clause */
86552 if( pSrc->a[0].pSelect ) return 0; /* FROM is not a subquery or view */
86555 assert( pTab->pSelect==0 ); /* FROM clause is not a view */
86556 if( IsVirtual(pTab) ) return 0; /* FROM clause not a virtual table */
86632 ** SELECT <column> FROM <table>
86635 ** an ephemeral table might need to be generated from the RHS and then
86713 /* This function is only called from two places. In both cases the vdbe
86806 ** (SELECT a FROM b) -- subquery
86807 ** EXISTS (SELECT a FROM b) -- EXISTS subquery
86809 ** x IN (SELECT a FROM b) -- IN operator with subquery on the right
86878 ** from the SELECT or the <exprlist>.
86923 ** For each expression, build an index key from the evaluation and
87081 /* Figure out the affinity to use to create a key from the results
87087 /* Code the LHS, the <expr> from "<expr> IN (...)".
87283 ** Record in the column cache that a particular column from a
87349 ** Purge the range of registers from the column cache.
87379 ** Remove from the column cache any entries that were added since the
87465 ** Generate code that will extract the iColumn-th column from
87475 Table *pTab, /* Description of the table we are reading from */
87531 ** Generate code to move content from registers iFrom...iFrom+nReg-1
88063 ** floating point when extracting it from the record. */
88322 ** The SQLITE_ECEL_DUP flag prevents the arguments from being
88803 ** always differs from a non-NULL pointer.
88865 SrcList *pSrc; /* One particular FROM clause in a nested query */
88867 int nOther; /* Number of references to columns in other FROM clauses */
88965 /* Check to see if the column is in one of the tables in the FROM
88974 ** that is in the FROM clause of the aggregate query.
89204 ** ALTER TABLE logic from the build.
89466 ** constraints for which pTab is the parent table) from the sqlite_master
89481 ** temporary triggers on table pTab from the sqlite_temp_master table. If
89513 ** pTab from the database, including triggers and temporary triggers.
89515 ** the time the generated code is executed. This can be different from
89534 /* Drop any table triggers from the internal schema. */
89542 /* Drop the table and index from the internal schema. */
90079 ** must be separated from the last integer by a single space. If the
90106 ** S uniform buckets and the samples are the middle row from each bucket.
90130 ** binary encoding of a key from the index. The nEq column is a
90254 "DELETE FROM %Q.%s WHERE %s=%Q",
90519 ** the anEq[] array from pSample->anEq[pSample->iCol+1] onwards are valid.
90543 ** the anEq[] array from pSample->anEq[pSample->iCol] onwards are valid.
90570 ** remove the least desirable sample from p->a[] to make room.
90666 /* Check if any samples from the aBest[] array should be pushed
90717 ** C Index of left-most column to differ from previous row
90989 int jZeroRows = -1; /* Jump from here if number of rows is zero */
91430 ** Used to pass information from the analyzer reader through to the
91671 ** Load the content from either the sqlite_stat4 or sqlite_stat3 table
91678 ** zSql1: SELECT idx,count(*) FROM %Q.sqlite_stat4 GROUP BY idx
91679 ** zSql2: SELECT idx,neq,nlt,ndlt,sample FROM %Q.sqlite_stat4
91690 int rc; /* Result codes from subroutines */
91721 ** loaded from the stat4 table. In this case ignore stat3 data. */
91770 /* This next condition is true if data has already been loaded from
91787 ** a corrupt record. Adding the two 0x00 bytes prevents this from causing
91804 ** Load content from the sqlite_stat4 and sqlite_stat3 tables into
91808 int rc = SQLITE_OK; /* Result codes from subroutines */
91813 "SELECT idx,count(*) FROM %Q.sqlite_stat4 GROUP BY idx",
91814 "SELECT idx,neq,nlt,ndlt,sample FROM %Q.sqlite_stat4",
91821 "SELECT idx,count(*) FROM %Q.sqlite_stat3 GROUP BY idx",
91822 "SELECT idx,neq,nlt,ndlt,sqlite_record(sample) FROM %Q.sqlite_stat3",
91840 ** read from it.
91844 ** returned. However, in this case, data is read from the sqlite_stat1
91880 "SELECT tbl,idx,stat FROM %Q.sqlite_stat1", sInfo.zDatabase);
91889 /* Load the statistics from the sqlite_stat4 table. */
91933 ** is slightly different from resolving a normal SQL expression, because simple
91964 ** three arguments to the function come directly from an attach statement:
92106 /* No key specified. Use the key from the main database */
92118 ** remove the entry from the db->aDb[] array. i.e. put everything back the way
92168 ** three arguments to the function come directly from a detach statement:
92597 ** Invoke the authorization callback for permission to read column zCol from
92710 ** or if the parser is being invoked from within sqlite3_declare_vtab.
93225 ** unlike that index from its Table then remove the index from
93256 ** any have been closed, remove them from the list. Reallocate the
93312 ** Erase all schema information from all attached databases (including
93362 ** the table data structure from the hash table. But it does destroy
93423 ** Unlink the given table from the hash tables and the delete the
93444 ** is obtained from sqliteMalloc() and must be freed by the calling
94049 ** the expression given in its argument from a TK_STRING into a TK_ID
94326 ** from sqliteMalloc() and must be freed by the calling function.
94467 ** schema to the rootpage from the main table.
94523 ** Remove all redundant columns from the PRIMARY KEY. For example, change
94613 ** was called to create a table generated from a
94622 Select *pSelect /* Select from a "CREATE ... AS SELECT" */
94641 ** for the table from the db->init.newTnum field. (The page number
94928 Table *pSelTab; /* A fake table from which we get the result set */
94955 ** CREATE VIEW one AS SELECT * FROM two;
94956 ** CREATE VIEW two AS SELECT * FROM one;
94963 ** CREATE TEMP VIEW ex1 AS SELECT a FROM ex1;
94964 ** SELECT * FROM temp.ex1;
94975 ** to the elements of the FROM clause. But we do not want these changes
95027 ** Clear the column names from every VIEW in database idx.
95050 ** root-page of a table or index in database iDb has changed from iFrom
95090 ** Write code to erase the table with root-page iTable from database iDb.
95178 ** Remove entries from the sqlite_statN tables (for N in (1,2,3))
95194 "DELETE FROM %Q.%s WHERE %s=%Q",
95221 ** is generated to remove entries from sqlite_master and/or
95240 "DELETE FROM %Q.sqlite_sequence WHERE name=%Q",
95254 "DELETE FROM %Q.%s WHERE tbl_name=%Q and type!='trigger'",
95260 /* Remove the table entry from SQLite's internal schema and modify
95359 /* Generate code to remove the table from the master table
95530 ** the root page number of the index is taken from pIndex->tnum.
95729 /* Because the parser constructs pTblName from a single identifier,
95780 ** Exception: If we are reading the names of permanent indices from the
96195 ** Apart from that, we have little to go on besides intuition as to
96273 /* Generate code to remove the index and from the master table */
96278 "DELETE FROM %Q.%s WHERE name=%Q AND type='index'",
96466 ** come from pTable (if pDatabase is NULL) or from pDatabase.
96467 ** SrcList.a[].zDatabase is filled with the database name from pTable,
96560 ** end of a growing FROM clause. The "p" parameter is the part of
96561 ** the FROM clause that has already been constructed. "p" is NULL
96562 ** if this is the first term of the FROM clause. pTable and pDatabase
96563 ** are the name of the table and database named in the FROM clause term.
96571 ** Return a new SrcList which encodes is the FROM with the new
96576 SrcList *p, /* The left part of the FROM clause already seen */
96577 Token *pTable, /* Name of the table to add to the FROM clause */
96654 ** When building up a FROM clause in the parser, the join operator
96657 ** Shifts all join operators from left to right for an entire FROM
96873 ** particular, it prevents us from writing an effective
97318 ** from the main database is substituted, if one is available.
97336 ** Locate and return an entry from the db.aCollSeq hash table. If the entry
97389 ** for the encoding 'enc' from the database 'db'.
97690 ** in order to generate code for DELETE FROM statements.
97696 ** (as in the FROM clause of a SELECT statement) in this case it contains
97798 ** DELETE FROM table_wxyz WHERE a<5 ORDER BY a LIMIT 1;
97804 SrcList *pSrc, /* the FROM clause -- which tables to scan */
97815 SrcList *pSelectSrc = NULL; /* SELECT rowid FROM x ... (dup of pSrc) */
97836 ** DELETE FROM table_a WHERE col1=1 ORDER BY col2 LIMIT 1 OFFSET 1
97838 ** DELETE FROM table_a WHERE rowid IN (
97839 ** SELECT rowid FROM table_a WHERE col1=1 ORDER BY col2 LIMIT 1 OFFSET 1
97848 /* duplicate the FROM clause as it is needed by both the DELETE/UPDATE tree
97888 ** Generate code for a DELETE FROM statement.
97890 ** DELETE FROM table_wxyz WHERE a<5 AND b NOT NULL;
97896 SrcList *pTabList, /* The table from which we should delete things */
97900 Table *pTab; /* The table from which records will be deleted */
97930 int isView; /* True if attempting to delete from a view */
97951 ** deleted from is a view
98009 /* If we are trying to delete from a view, realize that view into
98152 ** deleting from and all its indices. If this is a view, then the
98286 ** that a search record formed from OP_MakeRecord is contained in the
98294 ** and nPk before reading from it.
98305 ** index cursor (from within array of cursors starting at iIdxCur) that
98312 int iDataCur, /* Cursor from which column data is extracted */
98448 int iIdxNoSeek /* Do not delete from this cursor */
98509 int iDataCur, /* Cursor number from which to take column data */
98829 ** If p1 is negative, then we begin abs(p1) from the end of x[].
98872 ** from 2009-02-02 for compatibility of applications that exploited the
99180 ** [...] Matches one character from the enclosed list of
99254 ** first matching character and recursively contine the match from
99517 /* Array for converting from half-bytes (nybbles) into ASCII hex
99711 ** from A by replacing every occurrence of B with C. The match
99879 /* IMP: R-25361-16150 This function is omitted from SQLite by default. It
100406 ** time a statement is executed that removes an existing violation from
100628 /* If the index uses a collation sequence that is different from
100666 ** This function is called when a row is inserted into or deleted from the
100674 ** or deleted from the child table. If the parent row can be found, no
100697 int *aiCol, /* Map from parent key columns to child table columns */
100881 ** from the parent table of foreign key constraint pFKey and, if pFKey is
100917 int *aiCol, /* Map from pIdx cols to child table cols */
100948 Expr *pLeft; /* Value from parent table row */
100965 ** to the WHERE clause that prevent this entry from being scanned.
100977 Expr *pLeft; /* Value from parent table row */
101045 ** The Trigger structure or any of its sub-components may be allocated from
101061 ** being dropped from the database. The SrcList passed as the second argument
101072 ** then the equivalent of "DELETE FROM <tbl>" is executed before dropping
101073 ** the table from the database. Triggers are disabled while running this
101214 ** of the row being deleted, from left to right. Parameter regNew is passed
101222 ** the original record is deleted from the table using the calling convention
101228 Table *pTab, /* Row is being deleted from this table */
101281 ** case SQLite runs a "DELETE FROM xxx" on the table being dropped
101313 ** values read from the parent table are NULL. */
101330 /* A row is being removed from the child table. Search for the parent.
101519 ** DELETE FROM c WHERE ck = old.pk;
101528 Table *pTab, /* Table being updated or deleted from */
101715 Table *pTab, /* Table being updated or deleted from */
101742 ** table pTab. Remove the deleted foreign keys from the Schema.fkeyHash
101752 /* Remove the FK from the fkeyHash hash table. */
102045 ** only called from the top-level */
102150 ** for a SELECT statement that omits the FROM clause and everything else
102155 ** insert with data coming from a single-row VALUES clause, the code executes
102168 ** If the SELECT clause is of the restricted form "SELECT * FROM <table2>" -
102169 ** in other words if the SELECT pulls all columns from a single table
102173 ** is invoked that copies raw records from <table2> over to <table1>.
102184 ** transfer all records from the read to the write cursors
102189 ** and the SELECT clause does not read from <table> at any time.
102203 ** insert the select result into <table> from R..R+n
102208 ** values from a SELECT but the data is being inserted into a table
102224 ** insert row from R..R+n into temp table
102253 int srcTab = 0; /* Data comes from this temporary cursor if >=0 */
102266 int regFromSelect = 0;/* Base register for data coming from SELECT */
102355 ** INSERT INTO <table1> SELECT * FROM <table2>;
102427 ** is coming from a SELECT statement, then generate a co-routine that
102432 /* Data is coming from a SELECT or from a multi-row VALUES clause.
102466 /* Invoke the coroutine to extract information from the SELECT
102468 ** here is from the 4th template:
102472 ** insert row from R..R+n into temp table
102494 /* This is the case if the data for the INSERT is coming from a
102578 ** insert the select result into <table> from R..R+n
102896 ** any ABORT Back out changes from the current command
103108 ** remove the conflicting row from the table. This will fire
103249 ** is different from old-rowid */
103257 /* Extract the PRIMARY KEY from the end of the index entry and
103271 ** different from the old.
103274 ** of the matched index row are different from the original PRIMARY
103560 ** INSERT INTO tab1 SELECT * FROM tab2;
103562 ** The xfer optimization transfers raw records from tab2 over to tab1.
103591 Table *pSrc; /* The table in the FROM clause of SELECT */
103596 int iSrc, iDest; /* Cursors from source and destination */
103611 ** error if pSelect reads from a CTE named "xxx". */
103626 assert(pSelect->pSrc); /* allocated even if there is no FROM clause */
103628 return 0; /* FROM clause must have exactly one term */
103631 return 0; /* FROM clause cannot contain a subquery */
103671 return 0; /* FROM clause does not contain a real table */
103902 ** codes. Also write an error message into memory obtained from
104592 ** excluded from a build of SQLite. Substitute a NULL pointer
105257 ** Cancel a prior call to sqlite3_auto_extension. Remove xInit from the
105885 ** the rest of the file if PRAGMAs are omitted from the build.
105939 ** from default, or when 'file' and the temp_store_directory has changed
105946 "from within a transaction");
106812 ** cid: Column id (numbered from left to right, starting at 0)
106993 "id", "seq", "table", "from", "to", "on_update", "on_delete",
107036 int regRow; /* Registers to hold a row from pTab */
107324 sqlite3VdbeLoadString(v, 4, " missing from index ");
107755 ** from disk.
107784 ** This routine is also called from the OP_ParseSchema opcode of the VDBE.
107819 TESTONLY(int rcp); /* Return code from sqlite3_prepare() */
108068 "SELECT name, rootpage, sql FROM '%q'.%s ORDER BY rowid",
108207 Btree *pBt = db->aDb[iDb].pBt; /* Btree database to read cookie from */
108222 /* Read the schema cookie from the database. If it does not match the
108393 "selectid", "order", "from", "detail"
108739 SrcList *pSrc, /* the FROM clause -- which tables to scan */
108898 ** Search the first N tables in pSrc, from left to right, looking for a
108943 SrcList *pSrc, /* List of tables in FROM clause */
108991 ** SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.b AND t1.x=5
109022 ** The terms of a FROM clause are contained in the Select.pSrc structure.
109032 SrcList *pSrc; /* All tables in the FROM clause */
109122 ExprList *pList, /* Form the KeyInfo object from this ExprList */
109246 ** A jump to addrRepeat is made and the N+1 values are popped from the
109270 ** (example: "a IN (SELECT * FROM table)") but it has more than 1 result
109297 ** zero or more, then data is pulled from srcTab and pEList is used only
109304 int srcTab, /* Pull data from this table */
109445 /* Construct a record from the query result, but instead of
109446 ** saving that record, use it as a key to delete elements from
109692 ** Space to hold the KeyInfo structure is obtained from malloc. The calling
109698 ExprList *pList, /* Form the KeyInfo object from this ExprList */
109833 int iSortTab; /* Sorter cursor to read from */
109834 int nSortData; /* Trailing values to read from sorter */
109939 ** The declaration type is the exact datatype definition extracted from the
109946 ** SELECT col FROM tbl;
109947 ** SELECT (SELECT col FROM tbl;
109948 ** SELECT (SELECT col FROM tbl);
109949 ** SELECT abc FROM (SELECT col AS abc FROM tbl);
109985 ** extracted from in NameContext.pSrcList. This table may be real
109988 Table *pTab = 0; /* Table structure column is extracted from */
109989 Select *pS = 0; /* Select the column is extracted from */
110012 ** SELECT (SELECT t1.col) FROM FROM t1;
110027 /* The "table" is actually a sub-select or a view in the FROM clause
110230 ExprList *pEList, /* Expr list from which to derive column names */
110324 ** The column list presumably came from selectColumnNamesFromExprList().
110501 ** The collating sequence for the compound select is taken from the
110526 ** Space to hold the KeyInfo structure is obtained from malloc. The calling
110569 ** There is exactly one reference to the recursive-table in the FROM clause
110573 ** into a Queue table. Rows are extracted from the Queue table one by
110574 ** one. Each row extracted from Queue is output to pDest. Then the single
110577 ** is added back into the Queue table. Then another row is extracted from Queue
110601 SrcList *pSrc = p->pSrc; /* The FROM clause of the recursive query */
110670 /* Detach the ORDER BY clause from the compound SELECT */
110735 ** Handle the special case of a compound-select that originates from a
110740 ** Because the Select object originates from a VALUES clause:
110778 ** This routine is called to process a compound query form from
110791 ** SELECT a FROM t1 UNION SELECT b FROM t2 UNION SELECT c FROM t3
110795 ** SELECT c FROM t3
110797 ** `-----> SELECT b FROM t2
110799 ** `------> SELECT a FROM t1
110806 ** individual selects always group from left to right.
110813 int rc = SQLITE_OK; /* Success code from a subroutine */
111035 /* INTERSECT is different from the others since it requires
111345 ** AltB: Called when there is data from both coroutines and A<B.
111347 ** AeqB: Called when there is data from both coroutines and A==B.
111349 ** AgtB: Called when there is data from both coroutines and A>B.
111351 ** EofA: Called when data is exhausted from selectA.
111353 ** EofB: Called when data is exhausted from selectB.
111447 int *aPermute; /* Mapping from ORDER BY terms to result set columns */
111495 ** row of results comes from selectA or selectB. Also add explicit
111540 /* Separate the left and the right query from one another
111619 /* Generate a subroutine to run when the results from select A
111633 /* Generate a subroutine to run when the results from select B
111732 ** FROM clause of a SELECT such that the VDBE cursor assigned to that
111815 ** SELECT a FROM (SELECT x+y AS a FROM t1 WHERE z<100) WHERE a>5
111827 ** SELECT x+y AS a FROM t1 WHERE z<100 AND a>5
111840 ** FROM-clause subquery that is a candidate for flattening. (2b is
111841 ** due to ticket [2f7170d73bf9abf80] from 2015-02-09.)
111849 ** sub-queries that were excluded from this optimization. Restriction
111855 ** (7) The subquery has a FROM clause. TODO: For subqueries without
111856 ** A FROM clause, consider adding a FROM close with the special
111865 ** (**) Restriction (10) was removed from the code on 2005-02-05 but we
111873 ** a separate restriction deriving from ticket #350.
111933 ** "SELECT x FROM (SELECT max(y), x FROM t1)" would not necessarily
111958 SrcList *pSrc; /* The FROM clause of the outer query */
111959 SrcList *pSubSrc; /* The FROM clause of the subquery */
112044 ** t1 LEFT OUTER JOIN (SELECT * FROM t2 WHERE t2.x>0)
112098 SELECTTRACE(1,pParse,p,("flatten %s.%p from term %d\n",
112111 ** SELECT <expr-list> FROM (<sub-query>) <where-clause>
112121 ** SELECT a+1 FROM (
112122 ** SELECT x FROM tab
112124 ** SELECT y FROM tab
112126 ** SELECT abs(z*2) FROM tab2
112131 ** SELECT x+1 FROM tab WHERE x+1!=5
112133 ** SELECT y+1 FROM tab WHERE y+1!=5
112135 ** SELECT abs(z*2)+1 FROM tab2 WHERE abs(z*2)+1!=5
112172 /* Begin flattening the iFrom-th entry of the FROM clause
112212 ** This loop moves all of the FROM elements of the subquery into the
112213 ** the FROM clause of the outer query. Before doing this, remember
112214 ** the cursor number for the original outer query FROM element in
112217 ** those references with expressions that resolve to the subquery FROM
112223 pSubSrc = pSub->pSrc; /* FROM clause of subquery */
112224 nSubSrc = pSubSrc->nSrc; /* Number of terms in subquery FROM clause */
112225 pSrc = pParent->pSrc; /* FROM clause of the outer query */
112239 /* The subquery uses a single slot of the FROM clause of the outer
112240 ** query. If the subquery has more than one element in its FROM clause,
112246 ** SELECT * FROM tabA, (SELECT * FROM sub1, sub2), tabB;
112248 ** The outer query has 3 slots in its FROM clause. One slot of the
112250 ** block of code will expand the outer query FROM clause to 4 slots.
112252 ** for the two elements in the FROM clause of the subquery.
112261 /* Transfer the FROM clause terms from the subquery into the
112276 ** SELECT a+5, b*10 FROM (SELECT x*3 AS a, y+10 AS b FROM t1) WHERE a>b;
112331 ** SELECT ... FROM (SELECT ... LIMIT a OFFSET b) LIMIT x OFFSET y;
112365 ** SELECT * FROM (SELECT a AS x, c-d AS y FROM t1) WHERE x=5 AND y=10;
112369 ** SELECT * FROM (SELECT a AS x, c-d AS y FROM t1 WHERE a=5 AND c-d=10)
112474 ** SELECT count(*) FROM <tbl>
112533 ** SELECT ... FROM t1 EXCEPT SELECT ... FROM t2 ORDER BY .. COLLATE ...
112537 ** SELECT * FROM (SELECT ... FROM t1 EXCEPT SELECT ... FROM t2)
112603 ** WITH contexts, from inner to outermost. If the table identified by
112604 ** FROM clause element pItem is really a common-table-expression (CTE)
112613 struct SrcList_item *pItem, /* FROM clause element to resolve */
112637 ** WITH clause will never be popped from the stack. In this case it
112774 ** clause, pop it from the stack stored as part of the Parse object.
112778 ** names and other FROM clause elements.
112797 ** element of the FROM clause.
112800 ** defines FROM clause. When views appear in the FROM clause,
112840 ** the FROM clause of the SELECT statement.
112844 /* Look up every table named in the FROM clause of the select. If
112845 ** an entry of the FROM clause is a subquery instead of a table or view,
112860 /* A sub-query in the FROM clause of a SELECT */
112875 /* An ordinary table or view name in the FROM clause */
113016 /* In a NATURAL join, omit the join columns from the
113022 ** using clause from the table on the right. */
113132 ** For each FROM-clause subquery, add Column.zType and Column.zColl
113156 /* A sub-query in the FROM clause of a SELECT */
113170 ** the Table structures of all FROM-clause subqueries in a
113191 ** * VDBE Cursor numbers are assigned to all FROM-clause terms.
113192 ** * Ephemeral Table objects are created for all FROM-clause subqueries.
113361 ** count(*) query ("SELECT count(*) FROM pTab").
113404 WhereInfo *pWInfo; /* Return from sqlite3WhereBegin() */
113408 SrcList *pTabList; /* List of tables to select from */
113412 int rc = 1; /* Value to return from this function */
113479 /* Try to flatten subqueries in the FROM clause up into the main query
113534 /* Generate code for all sub-queries in the FROM clause
113649 SELECTTRACE(0x400,pParse,p,("After all FROM-clause analysis:\n"));
113658 ** SELECT DISTINCT xyz FROM ... ORDER BY xyz
113662 ** SELECT xyz FROM ... GROUP BY xyz ORDER BY xyz
113674 /* Notice that even thought SF_Distinct has been cleared from p->selFlags,
113778 int groupBySort; /* Rows come from source in GROUP BY order */
113781 int sortOut = 0; /* Output register from the sorter */
113978 ** from the previous row currently stored in a0, a1, a2...
114083 ** SELECT count(*) FROM <tbl>
114140 ** SELECT min(x) FROM ...
114141 ** SELECT max(x) FROM ...
114282 ** This structure is used to pass data from sqlite3_get_table() through
114292 int rc; /* Return code from sqlite3_exec() */
114307 ** we need to remember from this invocation of the callback.
114370 ** from malloc(). But the caller cannot free this memory directly.
114444 char **azResult /* Result returned from sqlite3_get_table() */
114908 Token *pTableName, /* The table from which rows are deleted */
114936 ** This function is called to drop a trigger from the database schema.
114938 ** This may be called directly from the parser and therefore identifies
115050 ** Remove a trigger from the hash tables of the sqlite* pointer.
115126 ** forming the SrcList. This prevents a trigger in one database from
115249 ** from pFrom to pTo.
115418 Table *pTab, /* The table to code triggers from */
115493 Table *pTab, /* The table to code triggers from */
115555 Table *pTab, /* The table to code triggers from */
115606 int *aXRef, /* Mapping from columns of pTab to entries in pChanges */
115622 ** from the P4 parameter of the OP_Column instruction, is returned instead.
116083 ** values for registers not modified by the UPDATE must be reloaded from
116292 int *aXRef, /* Mapping from columns of pTab to entries in pChanges */
116312 ** create and open the ephemeral table in which the records created from
116352 /* Create a record from the argument register contents and insert it into
116367 /* Extract arguments from the current row of the ephemeral table and
116471 ** (2) Copy all content from the database being vacuumed into
116473 ** (3) Copy content from the transient database back into the
116508 int rc = SQLITE_OK; /* Return code from service routines */
116522 sqlite3SetString(pzErrMsg, db, "cannot VACUUM from within a transaction");
116627 " FROM sqlite_master WHERE type='table' AND name!='sqlite_sequence'"
116633 " FROM sqlite_master WHERE sql LIKE 'CREATE INDEX %' ");
116637 " FROM sqlite_master WHERE sql LIKE 'CREATE UNIQUE INDEX %'");
116641 ** an "INSERT INTO vacuum_db.xxx SELECT * FROM main.xxx;" to copy
116648 "|| ' SELECT * FROM main.' || quote(name) || ';'"
116649 "FROM main.sqlite_master "
116660 "SELECT 'DELETE FROM vacuum_db.' || quote(name) || ';' "
116661 "FROM vacuum_db.sqlite_master WHERE name='sqlite_sequence' "
116666 "|| ' SELECT * FROM main.' || quote(name) || ';' "
116667 "FROM vacuum_db.sqlite_master WHERE name=='sqlite_sequence';"
116672 /* Copy the triggers, views, and virtual tables from the main database
116675 ** from the SQLITE_MASTER table.
116680 " FROM main.sqlite_master"
116789 ** are invoked only from within xCreate and xConnect methods.
116963 ** for table *p associated with database connection db from the linked
117025 ** Clear any and all virtual-table information from the Table record.
117328 ** If so, set the Column COLFLAG_HIDDEN flag and remove the token from
117490 ** valid to call this function from within the xCreate() or xConnect() of a
117582 /* Remove the sqlite3_vtab* from the aVTrans[] array, if applicable */
117679 ** than zero, then this function is being called from within a
117927 ** The results of this routine are undefined unless it is called from
117944 ** Call from within the xCreate() or xConnect() methods to provide
117997 ** This file was split off from where.c on 2015-06-06 in order to reduce the
118061 ** each term in the FROM clause (which is to say, for each of the
118078 u8 iFrom; /* Which entry in the FROM clause */
118093 Bitmask notReady; /* FROM entries not usable at this level */
118101 ** term of a join. Every term of the FROM clause will have at least
118104 ** FROM clause will have multiple WhereLoop objects, each describing a
118105 ** potential way of implementing that FROM-clause term, together with
118110 ** one WhereLoop object per FROM clause term, that satisfy all dependencies
118119 u8 iTab; /* Position in FROM clause of table for this loop */
118183 ** number of nodes in the FROM clause. The best (lowest cost) WherePath
118199 ** clause subexpression is separated from the others by AND operators,
118280 #define TERM_LIKEOPT 0x100 /* Virtual terms from the LIKE optimization */
118355 ** from the sparse cursor numbers into consecutive integers beginning
118455 int iFrom, /* Value for "from" column of output */
118464 SrcList *pSrclist, /* FROM clause pLvl reads data from */
118579 ** SELECT * FROM t1 WHERE a=1 AND b>2;
118626 int iFrom, /* Value for "from" column of output */
118727 ** implement level pLvl. Argument pSrclist is a pointer to the FROM
118728 ** clause that the scan reads data from.
118735 SrcList *pSrclist, /* FROM clause pLvl reads data from */
118760 ** (1) SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.x WHERE t2.z='ok'
118761 ** (2) SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.x AND t2.z='ok'
118762 ** (3) SELECT * FROM t1, t2 WHERE t1.a=t2.x AND t2.z='ok'
118869 WhereLevel *pLevel, /* The level of the FROM clause we are working on */
118976 ** SELECT ... FROM t1 AS t2, t1 WHERE t1.a = t2.b;
118986 WhereLevel *pLevel, /* Which nested loop of the FROM we are coding */
119048 ** Ex: CREATE INDEX i1 ON t1(a,b,a); SELECT * FROM t1 WHERE a=0 AND b=0; */
119084 ** that originated from the LIKE optimization, then change the P3 to be
119133 struct SrcList_item *pTabItem; /* FROM clause term being coded */
119176 /* Special case of a FROM clause subquery implemented as a co-routine */
119637 ** SELECT * FROM t1 WHERE a=5 OR b=7 OR (c=11 AND d=13)
119775 ** eliminating duplicates from other WHERE clauses, the action for each
119805 ** duplicate rows from prior sub-WHERE clauses, and record the
119863 ** current sub-WHERE row is a duplicate from prior sub-WHEREs. */
119867 ** contained one or more AND term from a notReady table. The
119868 ** terms from the notReady table could not be tested and will
120078 ** The new WhereTerm object is constructed from Expr p and with wtFlags.
120163 ** used by clearing the EP_Collate flag from Y. */
120184 ** Translate from TK_xx operator to WO_xx bitmask.
120397 SrcList *pSrc, /* the FROM clause */
120498 ** From another point of view, "indexable" means that the subterm could
120523 SrcList *pSrc, /* the FROM clause */
120671 ** current term is from the first iteration. So skip this term. */
120779 ** This is an optimization. No harm comes from returning 0. But if 1 is
120846 SrcList *pFrom, /* The FROM clause */
120847 Bitmask mPrereq, /* Bitmask of FROM clause terms referenced by pExpr */
120897 SrcList *pSrc, /* the FROM clause */
121204 /* Prevent ON clause terms of a LEFT JOIN from being used to drive
121324 SrcList *pTabList, /* the FROM clause */
121342 struct SrcList_item *pItem, /* The FROM clause term to process */
121406 ** Return the estimated number of output rows from a WHERE clause
121540 ** There is one cursor per table in the FROM clause. The number of
121541 ** tables in the FROM clause is limited by a test early in the
121795 SrcList *pTabList, /* The FROM clause */
121804 /* If there is more than one table or sub-select in the FROM clause of
121872 int iStart, /* Translate from this opcode to the end */
121979 struct SrcList_item *pSrc, /* The FROM clause term to get the next index */
122003 struct SrcList_item *pTabItem; /* FROM clause term being indexed */
122240 ** many fields that are declared "const" to prevent xBestIndex from
122577 ** SELECT * FROM t1 WHERE a=? AND c BETWEEN ? AND ?;
122587 ** extracted from pLower and pUpper with the corresponding column in each
122589 ** equal to the values extracted from pLower and pUpper respectively, and
122595 ** If pLower is NULL, or a value cannot be extracted from the term, L is
122596 ** set to zero. If pUpper is NULL, or a value cannot be extracted from it,
122600 ** if no value can be extracted from either pLower or pUpper (and so the
122623 sqlite3_value *p1 = 0; /* Value extracted from pLower */
122624 sqlite3_value *p2 = 0; /* Value extracted from pUpper */
122625 sqlite3_value *pVal = 0; /* Value extracted from record */
122686 ** ... FROM t1 WHERE a > ? AND a < ? ...
122699 ** ... FROM t1 WHERE a = ? AND b > ? AND b < ? ...
122704 ** ... FROM t1 WHERE a > ? AND a < ? ...
122746 ** Or, if pLower is NULL or $L cannot be extracted from it (because it
122792 int bOk; /* True if value is extracted from pExpr */
122807 int bOk; /* True if value is extracted from pExpr */
122824 /* TUNING: If both iUpper and iLower are derived from the same
122868 WHERETRACE(0x10,("Range scan lowers nOut from %d to %d\n",
123119 ** Transfer content from the second pLoop into the first.
123540 struct SrcList_item *pSrc, /* FROM clause term being analyzed */
123605 ** to mix with a lower range bound from some other source */
123656 /* Range contraints that come from the LIKE optimization are
123915 ** implicit "x IN (SELECT x FROM tbl)" terms are added for skip-scans.
123920 ** log(nRow) factor is omitted from a non-covering index scan in order to
123934 SrcList *pTabList; /* The FROM clause */
123935 struct SrcList_item *pSrc; /* The FROM clause btree term to add */
123977 ** NOT INDEXED qualifier is omitted from the FROM clause */
124126 ** mUnusable are set to 0. Otherwise, mExtra is a mask of all FROM clause
124127 ** entries that occur before the virtual table in the FROM clause and are
124128 ** separated from it by at least one LEFT or CROSS JOIN. Similarly, the
124129 ** mUnusable mask contains all FROM clause entries that occur after the
124130 ** virtual table and are separated from it by at least one LEFT or
124135 ** ... FROM t1, t2 LEFT JOIN t3, t4, vt CROSS JOIN t5, t6;
124154 struct SrcList_item *pSrc; /* The FROM clause term to search */
124280 ** (2) Multiple outputs from a single IN value will not merge
124464 /* Loop over the tables in the join, from left to right */
124472 /* This condition is true when pItem is the FROM clause term on the
124540 Expr *pOBExpr; /* An expression from the ORDER BY clause */
124541 CollSeq *pColl; /* COLLATE function from an ORDER BY clause term */
124557 ** We say the WhereLoop is "order-distinct" if the set of columns from
124751 } /* End the loop over all WhereLoops from outer-most down to inner-most */
124784 ** SELECT * FROM t1 GROUP BY x,y ORDER BY x,y; -- IsSorted()==1
124785 ** SELECT * FROM t1 GROUP BY y,x ORDER BY y,x; -- IsSorted()==0
124933 /* If nLoop is zero, then there are no FROM terms in the query. Since
125057 /* Discard the candidate path from further consideration */
125288 ** the FROM clause of a select. (INSERT and UPDATE statements are the
125289 ** same as a SELECT with only a single table in the FROM clause.) For
125292 ** SELECT * FROM t1, t2, t3 WHERE ...;
125305 ** appear in the FROM clause if a different order is better able to make
125318 ** data from the various tables of the loop.
125356 ** is called from an UPDATE or DELETE statement, then pOrderBy is NULL.
125368 SrcList *pTabList, /* FROM clause: A list of all tables to be scanned */
125408 /* The number of tables in the FROM clause is limited by the number of
125476 /* Special case: No FROM clause
125485 /* Assign a bit from the bitmask to every term in the FROM clause.
125487 ** The N-th term of the FROM clause is assigned a bitmask of 1<<N.
125593 /* Attempt to omit tables from the join that do not effect the result */
125931 ** from the index instead of from the table where possible. In some cases
125932 ** this optimization prevents the table from ever being read, which can
126078 /* Construct a new Expr object from a single identifier. Use the
126197 ** directly to the parser from the tokenizer.
126207 ** sqlite3ParserARG_FETCH Code to extract %extra_argument from yypParser
126967 "VALUES", "DISTINCT", "DOT", "FROM",
126987 "distinct", "selcollist", "from", "where_opt",
127126 /* 118 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt",
127141 /* 133 */ "from ::=",
127142 /* 134 */ "from ::= FROM seltablist",
127178 /* 170 */ "cmd ::= with DELETE FROM fullname indexed_opt where_opt",
127295 /* 287 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt",
127406 ** when the symbol is popped from the stack during a
127444 case 202: /* from */
127494 ** is popped from the stack, then call it.
127525 ** obtained from sqlite3ParserAlloc.
127527 ** from malloc.
128097 /* Silence complaints from purify about yygotominor being uninitialized
128108 ** from wireshark this week. Clearly they are stressing Lemon in ways
128469 case 118: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
128478 ** then extract the first few alphanumeric characters from within that
128562 case 133: /* from ::= */
128565 case 134: /* from ::= FROM seltablist */
128703 case 170: /* cmd ::= with DELETE FROM fullname indexed_opt where_opt */
128956 ** the semantics would be subtly different from IN or NOT IN.
129201 case 287: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt */
129433 ** The first argument is a pointer to a structure obtained from
129927 testcase( i==107 ); /* FROM */
129996 /* Make the IdChar function accessible from ctime.c */
130274 ** memory obtained from sqlite3_malloc() and to make *pzErrMsg point to that
130438 ** separating it out, the code will be automatically omitted from
130508 ** from the input. The following tokens are significant:
130592 case '-': { /* SQL-style comments from "--" to end of line */
130935 ** * Calls to this routine from Y must block until the outer-most
130938 ** * Recursive calls to this routine from thread X return immediately
130982 ** mutex must not require support from the malloc subsystem.
131129 ** to be NULL or point to memory that was obtained from sqlite3_malloc(),
131239 ** SQLITE_CONFIG_SCRATCH: A pointer an 8-byte aligned memory buffer from
131354 /* MSVC is picky about pulling func ptrs from va lists.
131452 ** space for the lookaside memory is obtained from sqlite3_malloc().
131526 ** Free up as much memory as we can from the given database
131625 ** strings byte by byte using the memcmp() function from the standard C
131957 /* The temp-database schema is allocated differently from the other schema
132563 ** Register a trace function. The pArg from the previously registered trace
132587 ** Register a profile function. The pArg from the previously registered
133162 ** from forming.
133469 char *zErrMsg = 0; /* Error message from sqlite3ParseUri() */
133515 /* Remove harmful bits from the flags parameter
133937 ** This function is now an anachronism. It used to be used to recover from a
134084 ** explicitly declared column. Copy meta information from *pCol.
134252 ** value from sqlite3FaultSim(0) becomes the return from
134256 /* MSVC is picky about pulling func ptrs from va lists.
134289 ** IMPORTANT: Changing the PENDING byte from 0x40000000 results in
134702 ** Remove connection db from the blocked connections list. If connection
134845 ** pUnlockConnection==0, remove the entry from the blocked connections
134892 ** allocate a larger array from the heap has failed.
134928 /* Remove connection p from the blocked connections list. */
134945 ** being closed. The connection is removed from the blocked list.
134985 ** structures are like b+trees in layout, but are constructed from the
134987 ** are built from the bottom up, things will be described from the
135030 ** varint docid; (delta from previous doclist)
135032 ** varint position; (2 more than the delta from previous position)
135038 ** varint position; (2 more than the delta from previous position)
135050 ** than the difference from the prior position, or the just the position plus
135080 ** varint iHeight; (height from leaf level, always 0)
135126 ** varint iHeight; (height from leaf level, always >0)
135155 ** INTERIOR_MIN_TERMS (default 7) keeps large terms from monopolizing
135204 ** After the merge, all segment blocks from the merged level are
135307 ** tokens from a particular input.
135395 ** Retrieve the next token from the tokenizer cursor pCursor. This
135618 ** from that used by SQLite, so the maximum length is 10, not 9.
135817 ** When the core wants to read from the virtual table, it creates a
135831 sqlite3_int64 iPrevId; /* Previous id read from aDoclist */
135856 ** SELECT docid FROM ex1 WHERE b MATCH 'one two three';
135933 ** "Length" field found in doclists stored on disk is omitted from this
136201 ** Read a 64-bit variable-length integer from memory starting at p[0].
136279 int iIn = 1; /* Index of next byte to read from input */
136299 ** Read a single varint from the doclist at *pp and advance *pp to point
136376 ** Construct one or more SQL statements from the format string given
136645 ** The pointer returned points to memory obtained from sqlite3_malloc(). It
136669 ** Return a list of comma separated SQL expressions and a FROM clause that
136672 ** SELECT <list of expressions> FROM %_content AS x ...
136675 ** from left to write. If parameter zFunc is not NULL, then instead of
136681 ** "docid, unzip(x.'a'), unzip(x.'b'), unzip(x.'c') FROM %_content AS x"
136720 fts3Appendf(pRc, &zRet, " FROM '%q'.'%q%s' AS x",
136900 zSql = sqlite3_mprintf("SELECT * FROM %Q.%Q", zDb, zTbl);
137149 ** TABLE statement, use all columns from the content table.
137162 ** column from the aCol[] array. */
137305 ** estimate the cost of loading large doclists from the database. */
137557 ** "SELECT <columns> FROM %_content WHERE rowid = ?"
137649 ** varints from the buffer) does not risk an overread. If zNode is a
137650 ** root node, then the buffer comes from a SELECT statement. SQLite does
137653 ** contents, or two zero bytes. Or, if the node is read from the %_segments
137696 /* Compare the term we are searching for with the term just loaded from
137698 ** to the term from the interior node, then all terms on the sub-tree
137768 char *zBlob = 0; /* Blob read from %_segments table */
137903 ** POSITION_LIST_END and return. Otherwise, read the next varint from *pp,
137915 sqlite3_int64 *pi /* IN/OUT: Value read from position-list */
137974 sqlite3_int64 i1 = 0; /* Last position from pp1 */
137975 sqlite3_int64 i2 = 0; /* Last position from pp2 */
138212 ** This function is used to read a single varint from a buffer. Parameter
138218 ** from *pp. *pp is then set to point 1 byte past the end of the read varint.
138221 ** If it is true, the value read is subtracted from *pVal before this
138225 char **pp, /* IN/OUT: Point to read varint from */
138333 ** read from. And each subsequent docid read from the same input list
138336 ** be a positive value less than or equal to the delta value read from
138338 ** read from the 'other' list. And to the contents of all position lists
138339 ** that will be copied and merged from the input to the output.
138342 ** then the encoding of the first docid from the 'other' input list may
138386 ** the output contains a copy of each position from the right-hand input
138398 int nDist, /* Distance from left to right (1=adjacent) */
138464 ** of the entries from pList at position 0, and terminated by an 0x00 byte.
138673 int iIndex, /* Index to search (from 0 to p->nIndex-1) */
138678 int isScan, /* True to scan from zTerm to EOF */
138747 int iIndex, /* Index to search (from 0 to p->nIndex-1) */
138752 int isScan, /* True to scan from zTerm to EOF */
138865 ** prefix) from the database.
138969 ** The following are copied from sqliteInt.h.
139145 ** This is the xColumn method, called by SQLite to request a value from
139156 sqlite3_vtab_cursor *pCursor, /* Cursor to retrieve value from */
139158 int iCol /* Index of column to read value from */
139235 ** of blocks from the segments table. But this is not considered overhead
139270 const char *zFmt ="SELECT 1 FROM %Q.sqlite_master WHERE tbl_name='%q_stat'";
139469 ** SELECT optimize(t) FROM t LIMIT 1;
140094 /* Determine if doclists may be loaded from disk incrementally. This is
140137 ** This function is used to iterate backwards (from the end to start)
140144 ** function iterates from the end of the doclist to the beginning.
140604 ** data from the %_stat table to calculate it.
140610 ** data stored in all rows of each column of the table, from left
140679 ** table actually contains the same data as the index. To prevent this from
140704 ** to retrieve the entire doclist for the token from the full-text index.
140712 ** After each token doclist is loaded, merge it with the others from the
140749 ** for-loop. Except, limit the value to 2^24 to prevent it from
140783 ** This function is called from within the xFilter method. It initializes
141630 Fts3Expr *p; /* Used to iterate from pExpr to root */
141634 /* Check if this phrase descends from an OR expression node. If not,
142245 sqlite3_vtab_cursor *pCursor, /* Cursor to retrieve value from */
142247 int iCol /* Index of column to read value from */
142286 sqlite3_vtab_cursor *pCursor, /* Cursor to retrieve value from */
142498 ** Extract the next token from buffer z (length n) using the tokenizer
142881 ** is defined), the order of the operators in precedence from highest to
142941 ** bytes read from buffer z. Otherwise, *ppExpr is set to 0 and SQLITE_NOMEM
143193 /* Remove pParent from the original tree. */
143347 ** of each column in the target fts3 table, in order from left to right.
143474 ** expression passed as the first argument. The buffer is obtained from
143715 /* Remove all entries from a hash table. Reclaim all memory.
143890 /* Remove a single entry from the hash table given a pointer to that
143895 Fts3HashElem* elem, /* The element to be removed from the pH */
143968 ** element corresponding to "key" is removed from the hash table.
144067 ** Class derived from sqlite3_tokenizer
144074 ** Class derived from sqlite3_tokenizer_cursor
144323 ** by taking 10 or 3 bytes from the beginning and end.
144359 ** a few bytes from the beginning and the end of the word. If the
144360 ** word contains digits, 3 bytes are taken from the beginning and
144361 ** 3 bytes from the end. For long words without digits, 10 bytes
144362 ** are taken from each end. US-ASCII case folding still applies.
144622 ** Extract the next token from a tokenization cursor. The cursor must
145264 /* TODO(shess) Delimiters need to remain the same from run to run,
145347 ** Extract the next token from a tokenization cursor. The cursor must
145464 ** token: A token from the input.
145808 sqlite3_vtab_cursor *pCursor, /* Cursor to retrieve value from */
145810 int iCol /* Index of column to read value from */
145840 sqlite3_vtab_cursor *pCursor, /* Cursor to retrieve value from */
145901 ** this file contains code to insert, update and delete rows from FTS3
145918 ** When full-text index nodes are loaded from disk, the buffer that they
145924 ** it is always safe to read up to two varints from it without risking an
145972 sqlite3_log(SQLITE_OK, "%d-way merge from level %d", nMerge, (int)iAbsLevel);
146042 ** by the caller. They are valid from the time SegmentReaderNew() returns
146082 char *aData; /* Pointer to block from malloc() */
146181 /* 0 */ "DELETE FROM %Q.'%q_content' WHERE rowid = ?",
146182 /* 1 */ "SELECT NOT EXISTS(SELECT docid FROM %Q.'%q_content' WHERE rowid!=?)",
146183 /* 2 */ "DELETE FROM %Q.'%q_content'",
146184 /* 3 */ "DELETE FROM %Q.'%q_segments'",
146185 /* 4 */ "DELETE FROM %Q.'%q_segdir'",
146186 /* 5 */ "DELETE FROM %Q.'%q_docsize'",
146187 /* 6 */ "DELETE FROM %Q.'%q_stat'",
146189 /* 8 */ "SELECT (SELECT max(idx) FROM %Q.'%q_segdir' WHERE level = ?) + 1",
146191 /* 10 */ "SELECT coalesce((SELECT max(blockid) FROM %Q.'%q_segments') + 1, 1)",
146194 /* Return segments in order from oldest to newest.*/
146196 "FROM %Q.'%q_segdir' WHERE level = ? ORDER BY idx ASC",
146198 "FROM %Q.'%q_segdir' WHERE level BETWEEN ? AND ?"
146201 /* 14 */ "SELECT count(*) FROM %Q.'%q_segdir' WHERE level = ?",
146202 /* 15 */ "SELECT max(level) FROM %Q.'%q_segdir' WHERE level BETWEEN ? AND ?",
146204 /* 16 */ "DELETE FROM %Q.'%q_segdir' WHERE level = ?",
146205 /* 17 */ "DELETE FROM %Q.'%q_segments' WHERE blockid BETWEEN ? AND ?",
146207 /* 19 */ "DELETE FROM %Q.'%q_docsize' WHERE docid = ?",
146209 /* 21 */ "SELECT size FROM %Q.'%q_docsize' WHERE docid=?",
146210 /* 22 */ "SELECT value FROM %Q.'%q_stat' WHERE id=?",
146215 /* 26 */ "DELETE FROM %Q.'%q_segdir' WHERE level BETWEEN ? AND ?",
146216 /* 27 */ "SELECT ? UNION SELECT level / (1024 * ?) FROM %Q.'%q_segdir'",
146218 /* This statement is used to determine which level to read the input from
146223 /* 28 */ "SELECT level FROM %Q.'%q_segdir' GROUP BY level HAVING count(*)>=?"
146227 ** created by merging the oldest :2 segments from absolute level :1. See
146230 " FROM %Q.'%q_segdir' WHERE level = ? AND idx < ?",
146234 /* 30 */ "DELETE FROM %Q.'%q_segdir' WHERE level = ? AND idx = ?",
146242 ** Read a single entry from the %_segdir table. The entry from absolute
146245 "FROM %Q.'%q_segdir' WHERE level = ? AND idx = ?",
146256 /* 34 */ "SELECT 1 FROM %Q.'%q_segments' WHERE blockid=? AND block IS NULL",
146260 /* 35 */ "SELECT idx FROM %Q.'%q_segdir' WHERE level=? ORDER BY 1 ASC",
146264 /* 36 */ "SELECT max( level %% 1024 ) FROM %Q.'%q_segdir'",
146266 /* Return segments in order from oldest to newest.*/
146268 "FROM %Q.'%q_segdir' WHERE level BETWEEN ? AND ? "
146319 sqlite3_stmt *pStmt = 0; /* Statement requested from fts3SqlStmt() */
146464 ** all rows in the %_segdir table, from oldest to newest. If successful,
146471 ** The statement returns the following columns from the %_segdir table:
146494 /* "SELECT * FROM %_segdir WHERE level BETWEEN ? AND ? ORDER BY ..." */
146503 /* "SELECT * FROM %_segdir WHERE level = ? ORDER BY ..." */
146908 ** Remove all data from the FTS3 table. Clear the hash table containing
146917 /* Delete everything from the shadow tables. Except, leave %_content as
146943 ** (an integer) of a row about to be deleted. Remove all terms from the
146948 Fts3Table *p, /* The FTS table to delete from */
146999 ** SELECT max(idx) FROM %_segdir WHERE level = :iLevel
147057 ** This function reads data from a single row of the %_segments table. The
147376 ** position. The exception is if this node is being loaded from disk
148276 ** are different from that integer. i.e. if deleting the document with docid
148322 ** SELECT max(level) FROM %Q.'%q_segdir' WHERE level BETWEEN ? AND ?
148350 ** SELECT max(level) FROM %Q.'%q_segdir' WHERE level BETWEEN ? AND ?
149227 int rc; /* Result code from subfunctions */
149275 int rc; /* Result code from subfunctions */
149547 ** An object of the following type is used to read data from a single
149600 int nPrefix = 0; /* Bytes to copy from previous term */
150052 ** * The first key read from the input (arguments zKey and nKey) is
150074 int rc2; /* Return code from sqlite3_reset() */
150237 Fts3MultiSegReader *pCsr, /* Cursor that data will be read from */
150288 ** Remove an entry from the %_segdir table. This involves running the
150291 ** DELETE FROM %_segdir WHERE level = :iAbsLevel AND idx = :iIdx
150300 sqlite3_int64 iAbsLevel, /* Absolute level to delete from */
150318 ** One or more segments have just been removed from absolute level iAbsLevel.
150320 ** the idx values are a contiguous sequence starting from 0.
150395 ** or greater than zTerm/nTerm (for internal nodes) from aNode/nNode.
150444 ** Remove all terms smaller than zTerm/nTerm from segment iIdx in absolute
150445 ** level iAbsLevel. This may involve deleting entries from the %_segments
150529 ** merge (or partially merge) two or more segments from absolute level
150532 ** Each input segment is either removed from the db completely (if all of
150567 /* The incremental merge did not copy all the data from this
150604 ** Load an incr-merge hint from the database. The incr-merge hint, if one
150607 ** If successful, populate blob *pHint with the value read from the %_stat
150661 ** Read the last entry (most recently pushed) from the hint blob *pHint
150702 Blob hint = {0, 0, 0}; /* Hint read from %_stat table */
150735 /* If the hint read from the %_stat table is not empty, check if the
150753 ** is removed from the hint blob. */
151457 ** should be deleted from the database before inserting the new row. Or,
151625 Fts3Cursor *pCsr; /* Cursor snippet is being generated from */
151626 int iCol; /* Extract snippet from this column */
151643 int iCol; /* Column snippet is extracted from */
151783 ** list is a list of unique integers, sorted from smallest to largest. Each
151876 ** indirectly descended from the right-hand-side of a NOT operator). If
152060 ** from column iCol that represent the "best" snippet. The best snippet
152076 int iCol, /* Index of column to create snippet from */
152212 Fts3Table *pTab, /* FTS3 table snippet comes from */
152215 const char *zDoc, /* Document text to extract snippet from */
152272 ** Extract the snippet text for fragment pFragment from cursor pCsr and
152288 const char *zDoc; /* Document text to extract snippet from */
152295 int iCol = pFragment->iCol+1; /* Query column to extract text from */
152501 int iPhrase, /* Phrase number (numbered from zero) */
152640 int iPhrase, /* Phrase number (numbered from zero) */
152968 int iCol, /* Extract snippet from this column */
152976 /* The returned text includes up to four fragments of text extracted from
153066 int iPos; /* Position just read from pList */
153067 int iOff; /* Offset of this term from read positions */
153157 ** no way that this operation can fail, so the return code from
153167 ** needs to transform the data from utf-16 to utf-8), return SQLITE_NOMEM
153305 ** from the sqlite3 source file utf.c. If this file is compiled as part
153583 ** Extract the next token from a tokenization cursor. The cursor must
154072 ** table that maps from the entries rowid to the id of the node that it
154142 ** various strategies. If possible, this estimate is loaded from the
154174 /* Statements to read/write/delete a record from xxx_node */
154179 /* Statements to read/write/delete a record from xxx_rowid */
154184 /* Statements to read/write/delete a record from xxx_parent */
154213 ** record intermediate results from the tree walk.
154235 ** cells are removed from the overfull node and reinserted into the tree.
154346 ** A single cell from a node, deserialized
154512 ** Remove node pNode from the node hash table.
154651 ** Remove the cell with index iCell from node pNode.
154746 RtreeNode *pNode, /* The node from which to extract the ID */
154747 int iCell /* The cell index from which to extract the ID */
154754 ** Return coordinate iCoord from cell iCell in node pNode.
154758 RtreeNode *pNode, /* The node from which to extract a coordinate */
154946 ** Convert raw bits from the on-disk RTree record into a coordinate value.
155676 ** table scan strategies to choose from (in order from most to
155706 ** is 'a', the second from the left 'b' etc.
155893 ** This function implements the ChooseLeaf algorithm from Gutman[84].
156007 ** nIdx. The aIdx array contains the set of integers from 0 to
156079 ** nIdx. The aIdx array contains the set of integers from 0 to
156145 ** Implementation of the R*-tree variant of SplitNode from Beckman[1990].
156285 ** all cells from node pLeft. Then zero the original node.
156480 /* Remove the node from the in-memory hash table and link it into
156527 /* Remove the cell from the node. This call just moves bytes around
156533 ** number of cells, remove it from the tree. Otherwise, update the
156730 ** Remove the entry with rowid=iDelete from the r-tree structure.
156749 /* Delete the cell in question from the leaf node. */
156794 /* Re-insert the contents of any underfull nodes removed from the tree. */
156817 #define RNDAWAY (1.0 + 1.0/8388608.0) /* Round away from zero */
156934 ** record to delete from the r-tree table. The following block does
157001 const char *zFmt = "SELECT stat FROM %Q.sqlite_stat1 WHERE tbl = '%q_rowid'";
157037 rtreeDisconnect, /* xDisconnect - Disconnect from a table */
157070 "SELECT data FROM '%q'.'%q_node' WHERE nodeno = :1",
157072 "DELETE FROM '%q'.'%q_node' WHERE nodeno = :1",
157075 "SELECT nodeno FROM '%q'.'%q_rowid' WHERE rowid = :1",
157077 "DELETE FROM '%q'.'%q_rowid' WHERE rowid = :1",
157080 "SELECT parentnode FROM '%q'.'%q_parent' WHERE nodeno = :1",
157082 "DELETE FROM '%q'.'%q_parent' WHERE nodeno = :1"
157155 ** This function is called from within the xConnect() or xCreate() method to
157191 "SELECT length(data) FROM '%q'.'%q_node' WHERE nodeno = 1",
157313 ** SELECT rtreenode(2, data) FROM rt_node;
157366 ** from the front of a blob that is an r-tree node. For example:
157368 ** SELECT rtreedepth(data) FROM rt_node WHERE nodeno=1;
157637 /* Read (and consume) the next character from the input pattern. */
157752 ** This function is called when an ICU function called from within
157948 assert(!"Unexpected return value from ucol_strcoll()");
157975 int rc; /* Return code from sqlite3_create_collation_x() */
158236 ** Extract the next token from a tokenization cursor.
158347 ** update, insert or delete from the target table.
158444 ** may be loaded from or written to the persistent media multiple times.
158464 ** to read from the original database snapshot. In other words, partially
158566 ** For each row to DELETE from the target database as part of the RBU
158573 ** For each row to UPDATE from the target database as part of the RBU
158629 ** However, RBU is more efficient if reading the rows in from each data_xxx
158664 ** resume the RBU update from where it left off.
158782 ** system recovery RBU may resume the update from the point at which the state
158783 ** was last saved. In other words, from the most recent successful call to
158980 ** A structure to store values read from the rbu_state table in memory.
159070 #define RBU_DELETE 2 /* Delete a row from a main table b-tree */
159071 #define RBU_IDX_DELETE 3 /* Delete a row from an aux. index b-tree */
159159 ** are lifted from the fossil source code (http://fossil-scm.org). They
159164 ** Read bytes from *pz and convert them into a positive integer. When
159345 ** End of code taken from fossil.
159643 "SELECT rbu_target_name(name) AS target, name FROM sqlite_master "
159651 " FROM main.sqlite_master "
159759 ** returns a copy of the string in memory obtained from sqlite3_malloc().
159847 ** 0) SELECT count(*) FROM sqlite_master where name=%Q AND IsVirtual(%Q)
159849 ** 2) SELECT count(*) FROM sqlite_master where name=%Q
159861 " FROM sqlite_master"
159884 "SELECT rootpage FROM sqlite_master WHERE name = %Q", zIdx
159991 sqlite3_mprintf("SELECT * FROM '%q'", pIter->zDataTbl)
160037 p->zErrmsg = sqlite3_mprintf("column missing from %q: %s",
160088 ** used to read from an data_xxx or rbu_tmp_xxx table while updating the
160269 "_rowid_ = (SELECT id FROM rbu_imposter2 WHERE %z)", zList
160306 ** The memory for the returned string is obtained from sqlite3_malloc().
160360 ** The memory for the returned string is obtained from sqlite3_malloc().
160470 "SELECT name FROM sqlite_master WHERE rootpage = ?"
160685 sqlite3_mprintf("DELETE FROM \"rbu_imp_%w\" WHERE %s", zTbl, zWhere)
160694 "SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' ORDER BY %s%s",
160700 "SELECT %s, rbu_control FROM '%q' "
160703 "SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' "
160749 "DELETE FROM \"%s%w\" WHERE %s", zWrite, zTbl, zWhere
160763 "SELECT *%s FROM '%q' WHERE 0;"
160802 /* Create the SELECT statement to read keys from data_xxx */
160806 "SELECT %s, rbu_control%s FROM '%q'%s",
160958 rbuMPrintfExec(p, p->dbMain, "SELECT * FROM sqlite_master");
160974 ** This routine is a copy of the sqlite3FileSuffix3() routine from the core.
161051 p->rc = sqlite3_exec(p->dbMain, "SELECT * FROM sqlite_master", 0, 0, 0);
161063 ** * Attempts to read from the *-wal file or write to the database file
161080 ** data from the wal file into the database file according to the
161104 ** Called when iAmt bytes are read from offset iOff of the wal file while
161147 ** a single frame of data from the wal file into the database file, as
161414 ** SELECT <cols>, rbu_control, rbu_rowid FROM ....
161547 "DELETE FROM %s.'rbu_tmp_%q'", p->zStateDb, pIter->zDataTbl
161662 sqlite3_mprintf("SELECT k, v FROM %s.rbu_state", p->zStateDb)
161719 ** considered equal, and NULL is considered distinct from all other values.
161731 ** things so that the next call to sqlite3rbu_step() continues on from
161899 ** level pager to use "journal_mode=off". This prevents it from
162092 ** from automatically checkpointing a *-wal (or *-oal) file from within
162152 ** Read and return an unsigned 32-bit big-endian integer from the buffer
162163 ** Read data from an rbuVfs-file.
162274 /* Do not allow EXCLUSIVE locks. Preventing SQLite from taking this
162275 ** prevents it from checkpointing the database from sqlite3_close(). */
162379 /* Magic number 1 is the WAL_CKPT_LOCK lock. Preventing SQLite from
162380 ** taking this lock also prevents any checkpoints from occurring.
162571 ** parameter from it. */
162866 ** information from an SQLite database in order to implement the
162881 from the
162886 ** a b-tree is '/000/'. (Btrees store content ordered from left to right
162895 ** from. For example, the three overflow pages in a chain linked from
162912 " path INTEGER, /* Path to page from root */" \
163028 ** Disconnect from or destroy a statvfs virtual table.
163271 ** offset with actual values obtained from ZIPVFS.
163452 " FROM \"%w\".%s WHERE rootpage!=0"
163786 /* Append N bytes from zIn onto the end of the JsonString string.
164614 ** obtained from sqlite3_malloc().
164807 ** with the result from each path. Throw an error if the JSON or any PATH
164893 ** Remove the named elements from JSON and return the result. malformed
165720 ** are numbered starting from zero.
165729 ** Phrase matches are numbered starting from zero, so the iIdx argument
165746 ** ... FROM ftstable WHERE ftstable MATCH $p ORDER BY rowid
165806 ** SELECT count(*) FROM ftstable;
165914 ** or removed from the FTS table. The tokenizer is being invoked to
165915 ** determine the set of tokens to add to (or delete from) the
165938 ** of the first byte of and first byte immediately following the text from
166248 ** be gleaned from the CREATE VIRTUAL TABLE statement.
166250 ** And all information loaded from the %_config table.
166298 /* Values loaded from the %_config table */
166504 ** Insert or remove data to or from the index. Each time a document is
166505 ** added to or removed from the index, this function is called one or more
166517 const char *pToken, int nToken /* Token to add or remove to or from index */
166527 i64 iDocid /* Docid to add or remove data from */
166565 ** Return the total number of entries read from the %_data table by
166641 const char *pToken, int nToken /* Token to add or remove to or from index */
166678 #define FTS5_STMT_SCAN_ASC 0 /* SELECT rowid, * FROM ... ORDER BY 1 ASC */
166679 #define FTS5_STMT_SCAN_DESC 1 /* SELECT rowid, * FROM ... ORDER BY 1 DESC */
166680 #define FTS5_STMT_LOOKUP 2 /* SELECT rowid, * FROM ... WHERE rowid=? */
166933 ** directly to the parser from the tokenizer.
166943 ** sqlite3Fts5ParserARG_FETCH Code to extract %extra_argument from fts5yypParser
167301 ** when the symbol is popped from the stack during a
167346 ** is popped from the stack, then call it.
167377 ** obtained from sqlite3Fts5ParserAlloc.
167379 ** from malloc.
167644 /* Silence complaints from purify about fts5yygotominor being uninitialized
167655 ** from wireshark this week. Clearly they are stressing Lemon in ways
167857 ** The first argument is a pointer to a structure obtained from
168515 const double k1 = 1.2; /* Constant "k1" from BM25 formula */
168516 const double b = 0.75; /* Constant "b" from BM25 formula */
169243 ** Gobble up the first bareword or quoted word from the input buffer zIn.
169259 const char *zIn, /* Buffer to gobble string/bareword from */
169718 const char *zSelect = "SELECT k, v FROM %Q.'%q_config'";
169795 ** Functions generated by lemon from fts5parse.y.
169901 ** Read the first token from the nul-terminated string at *pz.
170258 const u8 *a, int n, /* Buffer to read position list from */
171330 Fts5ExprPhrase *pOrig; /* The phrase extracted from pExpr */
172212 const char *pToken, int nToken /* Token to add or remove to or from index */
172363 ** Extract all tokens from hash table iHash and link them into a list
172557 ** Then, for each level from 0 to nMax:
172561 ** + for each segment from oldest to newest:
172570 ** from left to right, the total number of tokens in the column for all
172698 ** sequentially starting from 1.
172726 ** Each time a blob is read from the %_data table, it is padded with this
172775 sqlite3_stmt *pDeleter; /* "DELETE FROM %_data ... id>=? AND id<=?" */
172777 sqlite3_stmt *pIdxDeleter; /* "DELETE FROM %_idx WHERE segid=? */
172855 ** segments that this object is merging data from. Both the aSeg[] and
172897 ** Leaf page number containing the last term read from the segment. And
172930 /* The page and offset from which the current term was read. The offset
173109 ** Retrieve a record from the %_data table.
173230 ** DELETE FROM %_data WHERE id BETWEEN $iFirst AND $iLast
173239 "DELETE FROM '%q'.'%q_data' WHERE id>=? AND id<=?",
173270 "DELETE FROM '%q'.'%q_idx' WHERE segid=?",
173330 /* Read the total number of levels and segments from the start of the
173966 u8 *a = pIter->pLeaf->p; /* Buffer to read data from */
173999 u8 *a = pIter->pLeaf->p; /* Buffer to read data from */
174395 ** doclist-index from disk and initialize an iterator at (pIter->pDlidx).
174579 "SELECT pgno FROM '%q'.'%q_idx' WHERE "
175093 ** is zero or greater, data from the first nSegment segments on level iLevel
175858 /* All keys from this input segment have been transfered to the output.
175921 int iLvl, /* Level to read input from */
175972 /* Read input from all segments in the input level */
176017 /* Remove the redundant segments from the %_data table */
176022 /* Remove the redundant segments from the input level */
176060 /* Set iBestLvl to the level to read input segments from. */
176527 int iCol /* Column to extract from poslist */
176715 /* Copy entry from i1 */
176721 /* Copy entry from i2 */
176780 Fts5Index *p, /* Index to read from */
176798 Fts5IndexIter *p1 = 0; /* Iterator used to gather data from index */
177015 ** Insert or remove data to or from the index. Each time a document is
177016 ** added to or removed from the index, this function is called one or more
177028 const char *pToken, int nToken /* Token to add or remove to or from index */
177273 ** Read and decode the "averages" record from the database.
177309 ** Return the total number of blocks this module has read from the %_data
177388 int iSegid, /* Segment id to load from */
177498 ** a time, and the multi-iter loop from which this function is called
177623 "SELECT segid, term, (pgno>>1), (pgno&1) FROM %Q.'%q_idx' WHERE segid=%d",
177637 /* If the leaf in question has already been trimmed from the segment,
177785 ** variable cksum2) based on entries extracted from the full-text index
177797 i64 iPos = 0; /* Position read from poslist */
177859 ** Decode a segment-data rowid from the %_data table. This function is
177863 i64 iRowid, /* Rowid from %_data table */
177974 ** The return value is the number of bytes read from the input buffer.
177992 ** The return value is the number of bytes read from the input buffer.
178075 Fts5Buffer term; /* Current term read from page */
178078 int iPgidxPrev = 0; /* Previous value read from pgidx */
178330 Fts5Cursor *pSortCsr; /* Sort data from this cursor */
178343 ** SELECT rowid, <fts> FROM <fts> ORDER BY +rank;
178384 /* Zero from this point onwards on cursor reset */
178395 /* "rank" function. Populated on demand from vtab.xColumn(). */
178891 /* Remove the cursor from the Fts5Global.pCsr list */
179057 ** And since the statement required here reads from this very virtual
179062 "SELECT rowid, rank FROM %Q.%Q ORDER BY %s(%s%s%s) %s",
179669 (nArg>1 ? "UPDATE" : "DELETE from"), pConfig->zName
180260 ** as it can be derived from the total size of the blob.
180290 ** This is the xColumn method, called by SQLite to request a value from
180294 sqlite3_vtab_cursor *pCursor, /* Cursor to retrieve value from */
180296 int iCol /* Index of column to read value from */
180781 "SELECT %s FROM %s T WHERE T.%Q >= ? AND T.%Q <= ? ORDER BY T.%Q ASC",
180782 "SELECT %s FROM %s T WHERE T.%Q <= ? AND T.%Q >= ? ORDER BY T.%Q DESC",
180783 "SELECT %s FROM %s T WHERE T.%Q=?", /* LOOKUP */
180787 "DELETE FROM %Q.'%q_content' WHERE id=?", /* DELETE_CONTENT */
180789 "DELETE FROM %Q.'%q_docsize' WHERE id=?", /* DELETE_DOCSIZE */
180791 "SELECT sz FROM %Q.'%q_docsize' WHERE id=?", /* LOOKUP_DOCSIZE */
180794 "SELECT %s FROM %s AS T", /* SCAN */
181091 sqlite3_stmt *pSeek; /* SELECT to read row iDel from %_data */
181154 ** Load the contents of the "averages" record from disk into the
181199 ** Remove a row from the FTS table.
181305 "DELETE FROM %Q.'%q_data';"
181306 "DELETE FROM %Q.'%q_idx';",
181312 "DELETE FROM %Q.'%q_docsize';",
181515 zSql = sqlite3_mprintf("SELECT count(*) FROM %Q.'%q_%s'",
181657 ** Obtain an SQLite statement handle that may be used to read data from the
181703 const u8 *aBlob, int nBlob /* Record to read varints from */
181997 ** from the sqlite3 source file utf.c. If this file is compiled as part
182227 int iCode; /* non-ASCII codepoint read from input */
183435 ** This is a copy of the sqlite3GetVarint32() routine from the SQLite core.
183514 ** Read a 64-bit variable-length integer from memory starting at p[0].
183558 /* CSE1 from below */
183636 /* CSE2 from below */
184010 "SELECT t.%Q FROM %Q.%Q AS t WHERE t.%Q MATCH '*id'",
184106 i64 iPos = 0; /* 64-bit position read from poslist */
184180 sqlite3_vtab_cursor *pCursor, /* Cursor to retrieve value from */
184182 int iCol /* Index of column to read value from */