Lines Matching refs:iT
48 ** underlying operating system supports it. If the OS lacks
133 ** It used to be the case that setting this value to zero would
134 ** turn the limit off. That is no longer true. It is not possible
222 ** compile time. This is no longer permitted, on the grounds that it creates
327 ** if it is available, it requires an #include of specific headers
344 #else /* Generates a warning - but it always works */
378 ** It determines whether or not the features related to
400 ** pared it down to just these three.)
425 ** so it is omitted there. See ticket #2673.
428 ** implemented on some systems. So we avoid defining it at all
429 ** if it is already defined or if it is unneeded because we are
564 ** or constant definition does not appear in this file, then it is
617 ** that we have taken it all out and gone back to using simple
644 ** be larger than the release from which it is derived. Either Y will
737 ** the mutexes are omitted. Without the mutexes, it is not safe
741 ** So if speed is of utmost importance, it makes sense to disable
746 ** version of SQLite that it is linking against was compiled with
769 ** the opaque structure named "sqlite3". It is useful to think of an sqlite3
827 ** outstanding [prepared statements] or [BLOB handles], then it returns
844 ** This is legacy and deprecated. It is included for historical
861 ** sqlite3_exec() is not NULL, then it is invoked for each result row
983 ** The SQLITE_OK result code will never be extended. It will always
1087 ** argument to calls it makes to the xLock() and xUnlock() methods
1100 ** [sqlite3_io_methods] object it uses a combination of
1103 ** When the SQLITE_SYNC_DATAONLY flag is used, it means that the
1153 ** may be invoked even if the [sqlite3_vfs.xOpen] reported that it failed. The
1175 ** PENDING, or EXCLUSIVE lock on the file. It returns true
1226 ** If xRead() returns SQLITE_IOERR_SHORT_READ it must also fill
1274 ** current transaction. This hint is not guaranteed to be accurate but it
1303 ** that do require it.
1334 ** WAL mode. If the integer is -1, then it is overwritten with the current
1344 ** mode. If the integer is -1, then it is overwritten with the current
1349 ** a write transaction to indicate that, unless it is rolled back for some
1386 ** it is able to override built-in [PRAGMA] statements.
1409 ** at the internal representation of an [sqlite3_mutex]. It only
1455 ** ^If a suffix is added to the zFilename parameter, it will
1462 ** filename if it needs to remember the filename for some reason.
1465 ** xFilename parameter is NULL it will also be the case that the
1472 ** If xOpen() opens a file read-only then it sets *pOutFlags to
1490 ** change the way it deals with files. For example, an application
1506 ** deleted when it is closed. ^The [SQLITE_OPEN_DELETEONCLOSE]
1515 ** be created, and that it is an error if it already exists.
1516 ** It is <i>not</i> used to indicate the file should be opened
1522 ** allocate the structure; it should just fill it in. Note that
1631 ** currently unused, though it might be used in a future release of
1657 ** between unlocked and EXCLUSIVE. It cannot transition between SHARED
1686 ** A call to sqlite3_initialize() is an "effective" call if it is
1688 ** the process, or if it is the first time sqlite3_initialize() is invoked
1693 ** A call to sqlite3_shutdown() is an "effective" call if it is the first
1710 ** the library (perhaps it is unable to allocate a needed resource such
1711 ** as a mutex) it returns an [error code] other than [SQLITE_OK].
1717 ** initialized when [sqlite3_open()] is called if it has not be initialized
1722 ** it is recommended that applications always invoke sqlite3_initialize()
1742 ** are built into SQLite when it is compiled for Unix, Windows, or OS/2.
1762 ** applications and so this routine is usually not necessary. It is
1771 ** [sqlite3_shutdown()] then it will return SQLITE_MISUSE.
1816 ** and passing it to [sqlite3_config]([SQLITE_CONFIG_MALLOC])
1848 ** it might allocate any require mutexes or initialize internal data
1854 ** SQLite holds the [SQLITE_MUTEX_STATIC_MASTER] mutex when it invokes
1856 ** xShutdown method is only called from [sqlite3_shutdown()] so it does
1860 ** it is by default) and so the methods are automatically serialized.
1897 ** [threading mode] to Single-thread. In other words, it disables
1898 ** all mutexing and puts SQLite into a mode where it can only be used
1901 ** it is not possible to change the [threading mode] from its default
1908 ** [threading mode] to Multi-thread. In other words, it disables
1916 ** it is not possible to set the Multi-thread [threading mode] and
1932 ** it is not possible to set the Serialized [threading mode] and
1994 ** the host architecture. ^It is harmless, apart from the wasted memory,
1998 ** memory needs for the first N pages that it adds to cache. ^If additional
2061 ** object and uses it for page cache memory allocations.</dd>
2071 ** and a pointer to void. ^If the function pointer is not NULL, it is
2093 ** connection is opened. If it is globally disabled, filenames are
2151 ** SQLITE_DBCONFIG_LOOKASIDE is not a multiple of 8, it is internally
2218 ** by this routine reverts to what it was before the trigger or virtual
2226 ** encounters a constraint violation, it does not fail. The
2232 ** be successful even if it is subsequently rolled back.
2335 ** ^It is safe to call this routine from a thread different from the
2336 ** thread that is currently running the database operation. But it
2341 ** sqlite3_interrupt() is called, then it might not have an opportunity
2373 ** complete if it ends with a semicolon token and is not a prefix of a
2421 ** The presence of a busy handler does not guarantee that it will be invoked
2423 ** handler could result in a deadlock, it will go ahead and return [SQLITE_BUSY]
2426 ** it is trying to promote to a reserved lock and
2427 ** a second process is holding a reserved lock that it is trying
2429 ** because it is blocked by the second and the second process cannot
2430 ** proceed because it is blocked by the first. If both processes
2441 ** already hold a RESERVED lock on the database file, but it needs
2442 ** to promote this lock to EXCLUSIVE so that it can spill cache
2444 ** readers. ^If it is unable to promote the lock, then the in-memory
2510 ** It is not safe to pass a result table directly to [sqlite3_free()].
2545 ** it must pass the result table pointer to sqlite3_free_table() in order to
2553 ** to any internal data structures of SQLite. It uses only the public
2608 ** ^(The %q option works like %s in that it substitutes a nul-terminated
2611 ** character it escapes that character and allows it to be inserted into
2617 ** char *zText = "It's a happy day!";
2632 ** INSERT INTO table1 VALUES('It''s a happy day!')
2639 ** INSERT INTO table1 VALUES('It's a happy day!');
2645 ** ^(The %Q option works like %q except it also adds single quotes around
2679 ** memory, it returns a NULL pointer. ^If the parameter N to
2685 ** that it might be reused. ^The sqlite3_free() routine is
2716 ** In SQLite version 3.5.0 and 3.5.1, it was possible to define
2735 ** a block of memory after it has been released using
3024 ** Whether or not an error occurs when it is opened, resources
3026 ** passing it to [sqlite3_close()] when it is no longer required.
3029 ** except that it accepts two additional parameters for additional control
3048 ** it does not already exist. This is the behavior that is always used for
3067 ** participate in [shared cache mode] even if it is enabled.
3078 ** It is recommended that when a database filename actually does begin with
3091 ** set in the fourth argument to sqlite3_open_v2(), or if it has
3100 ** authority, then it must be either an empty string or the string
3107 ** then it is interpreted as an absolute path. ^If the path does not begin
3128 it to any other value is an error)^.
3136 ** used, it is an error to specify a value for the mode parameter that is
3141 ** "private". ^Setting it to "shared" is equivalent to setting the
3225 ** parameter if it exists or a NULL pointer if P does not appear as a
3265 ** interface is the same except that it always returns the
3276 ** When the serialized [threading mode] is in use, it might be the
3342 ** ^Hence, to find the current value of a limit without changing it,
3430 ** To execute an SQL query, it must first be compiled into a byte-code
3443 ** first zero terminator. ^If nByte is non-negative, then it is the maximum
3463 it has finished with it.
3479 ** ^If the database schema changes, instead of returning [SQLITE_SCHEMA] as it
3481 ** statement and try to run it again.
3601 ** for the values it stores. ^Values stored in sqlite3_value objects
3608 ** whether or not it requires a protected sqlite3_value.
3619 ** for maximum code portability it is recommended that applications
3701 ** string after SQLite has finished with it. ^The destructor is called
3713 ** (just an integer to hold its size) while it is being processed.
3964 ** database locks it needs to do its job. ^If the statement is a [COMMIT]
3990 ** Perhaps it was called on a [prepared statement] that has
3992 ** previously returned [SQLITE_ERROR] or [SQLITE_DONE]. Or it could
4035 ** where it always returns zero since each step of that multi-step
4177 ** and atof(). SQLite does not really use these functions. It has its
4203 ** of conversion are done in place when it is possible, but sometimes they
4267 ** resource leaks. It is a grievous error for the application to try to use
4268 ** a prepared statement after it has been finalized. Any use of a prepared
4269 ** statement after it has been finalized can result in undefined and
4359 ** then it is destructor for the application data pointer.
4364 ** ^When the destructor callback of the tenth parameter is invoked, it
4368 ** ^It is permitted to register multiple implementations of the same
4600 ** calls to sqlite3_get_auxdata() might return this data, if it has
4602 ** ^If it is not NULL, SQLite will invoke the destructor
4627 ** argument is SQLITE_STATIC, it means that the content pointer is constant
4628 ** and will never change. It does not need to be destroyed. ^The
4716 ** function result. If the 3rd parameter is non-negative, then it
4724 ** function as the destructor on the text or BLOB result when it has
4730 ** when it has finished using that result.
4734 ** from [sqlite3_malloc()] before it returns.
4839 ** themselves rather than expecting SQLite to deal with it for them.
4878 ** then it is passed the names of undefined collation sequences as strings
4921 ** encrypted, this routine will encrypt it. If pNew==0 or nNew==0, the
4980 ** It is not safe to read or modify this variable in more than one
4981 ** thread at a time. It is not safe to read or modify this variable
4984 ** It is intended that this variable be set once
4990 ** it to point to memory obtained from [sqlite3_malloc]. ^Furthermore,
4995 ** Hence, if this variable is modified directly, either it should be
5056 ** of connection D is read-only, 0 if it is read/write, or -1 if N is not
5068 ** satisfies the conditions of this routine, it returns NULL.
5112 ** hook returning non-zero, just as it would be with any other rollback.
5200 ** cache setting should set it explicitly.
5244 ** below the limit, it will exceed the limit rather than generate
5309 ** table or NULL. ^If it is NULL, then all attached databases are searched
5415 ** to turn extension loading on and call it with onoff==0 to turn
5416 ** it back off again.
5441 ** If the xEntryPoint routine encounters an error, it should make *pzErrMsg
5471 ** interface fixed, support it indefinitely, and remove this comment.
5493 ** ^The registration remains valid until it is replaced by a different
5495 ** of this structure must not change while it is registered with
5554 ** is usable) and false if it cannot.)^
5645 ** invoke the destructor function (if it is not NULL) when SQLite
5748 ** interface fixed, support it indefinitely, and remove this comment.
5777 ** and write access. ^If it is zero, the BLOB is opened for read access.
5778 ** ^It is not possible to open a column that is part of an index or primary
5779 ** key for writing. ^If [foreign key constraints] are enabled, it is
5794 ** way that makes it safe to invoke [sqlite3_blob_close()] on *ppBlob
5834 ** ^This function is used to move an existing blob handle so that it points
5842 ** it must exist and there must be either a blob or text value stored in
5844 ** it does not contain a blob or text value, or if another error occurs, an
5933 ** ^This function may only modify the contents of the BLOB; it is
5979 ** ^To make an existing VFS into the default VFS, register it again
6028 ** mutex and returns a pointer to it. ^If it returns NULL
6049 ** between SQLITE_MUTEX_RECURSIVE and SQLITE_MUTEX_FAST if it does
6051 ** cases where it really needs one. ^If a faster non-recursive mutex
6072 ** dynamic mutex that it allocates. The dynamic mutexes must not be in
6160 ** (i.e. it is acceptable to provide an implementation that segfaults if
6161 ** it is passed a NULL pointer).
6163 ** The xMutexInit() method must be threadsafe. ^It must be harmless to
6175 ** If xMutexInit fails in any way, it is expected to clean up after itself
6198 ** provides implementations for these routines when it is compiled
6208 ** versions of these routines, it should at least provide stubs that always
6213 ** clearly the mutex cannot be held if it does not exist. But
6299 ** This interface is not for use by applications. It exists solely
6363 ** and it is possible that another thread might change the parameter
6447 ** <dd>This parameter records the deepest parser stack. It is only
6578 ** of times it has performed specific operations.)^ These counters can
6633 ** The sqlite3_pcache type is opaque. It is implemented by
6697 ** It can be used to clean up
6703 ** xShutdown method is only called from [sqlite3_shutdown()] so it does
6724 ** false if it is used for an in-memory database. The cache implementation
6726 ** it is purely advisory. ^On a cache where bPurgeable is false, SQLite will
6739 ** value; it is advisory only.
6755 ** is 1. After it has been retrieved using xFetch, the page is considered
6762 ** parameter to help it determined what action to take:
6767 ** <tr><td> 1 <td> Allocate a new page if it easy and convenient to do so.
6795 ** previously contains an entry associated with newKey, it must be
6809 ** handle invalid, and will not use it with any other sqlite3_pcache_methods2
6813 ** ^SQLite invokes the xShrink() method when it wants the page cache to
6838 ** by sqlite3_pcache_methods2. This object is not used by SQLite. It is
6873 ** It is useful either for creating backups of databases or
6880 ** ^The source database is read-locked only while it is being read;
6881 ** it is not locked continuously for the entire backup operation.
6933 ** from source to destination, then it returns [SQLITE_DONE].
6986 ** should destroy the [sqlite3_backup] by passing it to sqlite3_backup_finish().
7048 ** same time as another thread is invoking sqlite3_backup_step() it is
7070 ** when the connection currently holding the required lock relinquishes it.
7077 ** its current transaction, either by committing it or rolling it back.
7083 ** application receives an SQLITE_LOCKED error, it may call the
7120 ** single void* pointer that is passed to the callback when it is invoked.
7122 ** it an array of void* context pointers. The first argument passed to
7130 ** multiple times, it is invoked once with the set of void* context pointers
7160 ** When a call to [sqlite3_step()] returns SQLITE_LOCKED, it is almost
7212 ** a few hundred characters, it will be truncated to the length of the
7229 ** ^The first parameter passed to the callback function when it is invoked
7241 ** callback returns [SQLITE_ROW] or [SQLITE_DONE], or if it returns a value
7320 ** snapshot. It then checkpoints all frames in the log file and syncs the
7321 ** database file. This call blocks database writers while it is running,
7326 ** checkpointing the log file it blocks (calls the busy-handler callback)
7329 ** from the beginning. This call blocks database writers while it is running,
7344 ** busy-handler configured, it will not be invoked in this case.
7348 ** immediately, and a busy-handler is configured, it is invoked and the writer
7429 ** that if [xUpdate] returns [SQLITE_CONSTRAINT], it will do so before
7443 ** return SQLITE_OK. Or, if this is not possible, it may return
7594 ** in the table, it is faster to do a linear search than to manage
7610 ** Again, this structure is intended to be opaque, but it can't really
7611 ** be opaque because it is used by macros.
7873 ** Provide a default value for SQLITE_TEMP_STORE in case it is not specified
7881 ** GCC does not define the offsetof() macro so we'll have to do it
7889 ** Check to see if this machine uses EBCDIC. (Yes, believe it or
8071 ** pointer will work here as long as it is distinct from SQLITE_STATIC
8077 ** When SQLITE_OMIT_WSD is defined, it means that the target platform does
8104 ** make it clear to human readers when a function parameter is deliberately
8109 ** if it knows that this is enforced elsewhere.
8112 ** it is generally named "NotUsed" or "NotUsed2" to make things even clearer.
8193 /* TODO: This definition is just included so other modules compile. It
8200 ** it must be turned on for each database using "PRAGMA auto_vacuum = 1".
8511 ** it takes up less space.
8544 ** argument is P4_KEYINFO_HANDOFF, the passed in pointer is used. It still
8545 ** gets freed when the Vdbe is finalized so it still should be obtained
8894 it is
8895 ** reserved for working around a windows/posix incompatibility). It is
9308 ** However, vs2005 does not set _WIN32_WINNT by default, as it ought to,
9327 it
9351 ** Mcafee started using SQLite in their anti-virus product and it
9438 ** file format. Depending on how it is changed, you might not notice
9524 ** The sqliteInt.h header #includes this file so that it is available
9525 ** to all source files. We break it out in an effort to keep the code
9807 ** unlock so that it can proceed.
9838 #define SQLITE_SqlTrace 0x00004000 /* Debug print SQL as it executes */
9914 ** count on this object is decremented. When it reaches 0, the destructor
10038 ** If both CollSeq.xCmp and CollSeq.xCmp16 are NULL, it means that the
10103 ** connection handle passed to it via the xConnect() or xCreate() method
10114 ** table, it searches the list for the VTable that corresponds to the
10127 ** explanation as to why it is safe to add an entry to an sqlite3.pDisconnect
10216 ** done as a macro so that it will be optimized out when virtual
10366 ** it means this is not a unique index. Otherwise it is a unique index
10469 ** Usually it is 16-bits. But if SQLITE_MAX_VARIABLE_NUMBER is greater
10470 ** than 32767 we have to make it 32-bit. 16-bit is preferred because
10471 ** it uses less memory in the Expr object, which is a big memory user
10515 ** it can be accessed after all aggregates are computed.
10527 ** If the Expr is of type OP_Column, and the table it is selecting from
10711 ** tables in a join to 32 instead of 64. But it also reduces the size
10783 ** It is included here only so that that compiler will know how big it
10789 ** is only used when wsFlags&WHERE_VIRTUALTABLE is true. It is never the
11183 ** to save the Parse.zAuthContext value so that it can be restored later.
11425 ** FTS4 is really an extension for FTS3. It is enabled using the
11434 ** The ctype.h header is needed for non-ASCII systems. It is also
11842 ** and decode of the integers in a record header. It is faster for the common
11843 ** case where the integer is a single byte. It is a little slower when the
11844 ** integer is two or more bytes. But overall it is faster.
12159 ** it might have been allocated by lookaside, except the allocation was
12160 ** too large or lookaside was already full. It is important to verify
12166 ** All of this is no-op for a production build. It only comes into
12381 ** the database page that contains the pending byte. It never attempts
12385 ** During testing, it is often desirable to move the pending byte to
12842 ** 6000 lines long) it was split up into several smaller files and
12910 ** aRow might point to (ephemeral) data for the current row, or it might
12927 ** restoring the state of the VM to as it was before the sub-program
12932 ** overwritten, the VdbeFrame object is not freed immediately. Instead, it
13078 ** This structure is defined inside of vdbeInt.h because it uses substructures
13111 ** any virtual table method invocations made by the vdbe program. It is
13340 It is assumed that the
13943 ** as part of the "Secure CRT". It is essentially equivalent to
14097 ** Assuming the current time value is UTC (a.k.a. GMT), shift it to
14611 sqlite3_int64 iT;
14620 if( sqlite3OsCurrentTimeInt64(db->pVfs, &iT) ) return;
14621 t = iT/1000 - 10000*(sqlite3_int64)21086676;
14773 ** really care if the VFS receives and understands the information since it
14988 ** Register a VFS with the system. It is harmless to register the same
15014 ** Unregister a VFS so that it is no longer accessible.
15137 ** This version of the memory allocator is the default. It is
15192 ** to obtain the memory it needs.
15210 ** option to rename it.
15223 ** This version of the memory allocator is the default. It is
15230 ** The MSVCRT has malloc_usable_size() but it is called _msize().
15280 ** so that we can find it later using sqlite3MemSize().
15473 ** to obtain the memory it needs while adding lots of additional debugging
15566 ** sqlite3MallocAllow() decrements it.
15607 ** if they are incorrect it asserts.
15796 ** higher level code is using pointer to the old allocation, it is
16019 ** it is available. The mempool allocator is activated by calling
16131 ** Unlink the chunk at mem3.aPool[i] from list it is currently
16205 ** If the STATIC_MEM mutex is not already held, obtain it now. The mutex
16294 ** If it sees a chunk that is larger than mem3.iMaster, it replaces
16658 ** is not required to be threadsafe (it is not).
16752 ** it is not actually possible to reach this limit.
16820 ** Unlink the chunk at mem5.aPool[i] from list it is currently
16821 ** on. It should be found on mem5.aiFreelist[iLogsize].
16862 ** If the STATIC_MEM mutex is not already held, obtain it now. The mutex
17240 ** linkage. It returns a pointer to a static sqlite3_mem_methods
17367 ** until it can be obtained.
17377 ** thread holds the mutex and it cannot be obtained, return SQLITE_BUSY.
17520 ** mutex and returns a pointer to it. If it returns NULL
17675 ** mutex and returns a pointer to it. If it returns NULL
17695 ** between SQLITE_MUTEX_RECURSIVE and SQLITE_MUTEX_FAST if it does
17697 ** cases where it really needs one. If a faster non-recursive mutex
17781 ** SQLite is careful to deallocate every mutex that it allocates.
17987 ** mutex and returns a pointer to it. If it returns NULL
18007 ** between SQLITE_MUTEX_RECURSIVE and SQLITE_MUTEX_FAST if it does
18009 ** cases where it really needs one. If a faster non-recursive mutex
18046 /* Use a recursive mutex if it is available */
18086 ** mutex that it allocates.
18112 ** is atomic - that it cannot be deceived into thinking self
18155 ** is atomic - that it cannot be deceived into thinking self
18298 ** API as long as we don't call it win running Win95/98/ME. A call to
18397 ** mutex and returns a pointer to it. If it returns NULL
18417 ** between SQLITE_MUTEX_RECURSIVE and SQLITE_MUTEX_FAST if it does
18419 ** cases where it really needs one. If a faster non-recursive mutex
18470 ** mutex that it allocates.
18513 ** The sqlite3_mutex_try() routine is very rarely used, and when it
18514 ** is used it is merely an optimization. So it is OK for it to always
18518 ** And some windows compilers complain if you try to use it without
18879 ** Allocate memory. This routine is like sqlite3_malloc() except that it
18920 ** is outstanding clearing it when the allocation is freed.
18929 ** This routine is similar to alloca() in that it is not intended
19185 ** failing, it fails consistently until mallocFailed is reset.
19193 ** In other words, if a subsequent malloc (ex: "b") worked, it is assumed
19368 ** The "printf" code that follows dates from the 1980's. It is in
19435 ** The following table is searched linearly, so it is good to put the
19784 /* It makes more sense to use 0.5 */
19903 it.
20106 ** Finish off a string by making sure it is zero-terminated.
20243 ** sqlite3_snprintf() works like snprintf() except that it ignores the
20249 ** from the snprintf() standard. Unfortunately, it is too late to change
20274 ** We house it in a separate routine from sqlite3_log() to avoid using
20277 ** sqlite3_log() must render into a static buffer. It cannot dynamically
20278 ** allocate memory because it might be called while the memory allocator
20308 ** and segfaults if you give it a long long int.
20375 ** subtle problems on some systems that could cause problems. It is hard
20627 ** 0xd800 and 0xe000 then it is rendered as 0xfffd.
20635 ** for unicode values 0x80 and greater. It do not change over-length
20684 ** desiredEnc. It is an error if the string is already of the desired
20824 ** UTF-16 string stored in *pMem. If one is present, it is removed and
20826 ** byte-swapping, it just sets Mem.enc appropriately.
20887 ** Hence it is only available in debug builds.
20944 ** arrange to call sqlite3DbFree() on the returned pointer when it is
20993 ** It checks that the primitives for serializing and deserializing
21091 ** make use of it by compiling with -DSQLITE_HAVE_ISNAN. But we have
21100 ** -O option since it can result in incorrect output for programs
21130 ** The value returned will never be negative. Nor will it ever be greater
21145 ** If it is not NULL, string zFormat specifies the format of the
21155 ** zFormat and any string tokens that follow it are assumed to be
21287 ** Convert this string to a double and write it into *pResult.
21304 ** returns FALSE but it still converts the prefix and writes the result
21546 ** than 19 digits (thus guaranteeing that it is too large) */
21549 /* Less than 19 digits, so we know that it fits in 64 bits */
21553 /* zNum is a 19-digit numbers. Compare it against 9223372036854775808. */
21556 /* zNum is less than 9223372036854775808 so it fits */
21560 /* zNum is greater than 9223372036854775808 so it overflows */
21651 ** bit clear. Except, if we get to the 9th byte, it stores the full
21813 /* we can skip this cause it was (effectively) done above in calc'ing s */
21961 ** slightly faster, but it is also larger and much harder to test.
22090 ** foolproof but it does provide some measure of protection against
22093 ** 1 it means that the db pointer is valid and 0 if it should not be
22329 /* Resize the hash table so that it cantains "new_size" buckets.
22347 ** a performance hit but it is not a fatal error. So mark the
22432 ** that matches pKey,nKey. Return the data for this element if it is
22700 ** embedded systems, and when it does the developers normally have bigger
22747 ** This file should be #included by the os_*.c files only. It is not a
22804 ** It uses the RDTSC opcode to read the cycle count value out of the
22861 ** of the debugging and testing utilities, but it should at
23074 ** file so that it consists of an integer number of chunks (i.e. the
23183 ** transitions leaving the lock state different from what it started but
23195 ** It is not possible to lower the locking level one step at a time. You
23303 ** release it now.
23377 ** It is not possible for this routine to fail if the second argument
23468 ** SQLite code assumes this function cannot fail. It also assumes that
23576 ** used only to set file locks. There will be no data written to it.
23759 ** This is not a VFS shared-memory method; it is a utility function called
23779 /* Allocate link object (we free it later in case of failure) */
23787 /* Find node by it's shared memory base name */
23864 ** This is not a VFS shared-memory method; it is a utility function called
23940 ** been allocated, it is allocated by this function.
23943 ** this call as described above, then it is mapped into this processes
23944 ** address space (if it is not already), *pp is set to point to the mapped
24266 /* It's odd to simulate an io-error here, but really this is just
24430 ** created. SQLite doesn't use it to indicate "exclusive access"
24431 ** as it is usually understood.
24434 /* Creates a new file, only if it does not already exist. */
24435 /* If the file exists, it fails. */
24438 /* Open existing file, or create if it doesn't exist */
24441 /* Opens a file, only if it exists. */
24530 ** as if it does not exist.
24742 ** it should be truncated. The return value of xGetLastError
24745 ** then it is not necessary to include the nul-terminator character
24749 ** on SQLite. It is fine to have an implementation that never
24757 ** However if an error message is supplied, it will be incorporated
24895 ** underlying operating system supports it. If the OS lacks
25002 ** opportunity to either close or reuse it.
25051 ** it is larger than the struct CrashFile defined in test6.c.
25095 ** This file should be #included by the os_*.c files only. It is not a
25152 ** It uses the RDTSC opcode to read the cycle count value out of the
25209 ** of the debugging and testing utilities, but it should at
25356 ** The DJGPP compiler environment looks mostly like Unix, but it
25359 ** DJGPP. But it is DOS - what did you expect?
25529 ** Invoke open(). Do so multiple times, until it either succeeds or
25532 ** If the file creation mode "m" is 0 then set it to the default for
25678 ** useful to the clients of the sqlite3 functions. Specifically, it is
25710 * introspection, in which it actually means what it says */
25738 * introspection, in which it actually means what it says */
25743 * it actually means what it says */
25775 ** The structure is reclaimed when the number of pointers to it drops to
25779 ** a performance-critical path, so it is sufficient to put these
25909 ** by the same process. It does not explicitly say so, but this implies
25910 ** that it overrides locks set by the same process using a different
25919 ** on fd2, it works. I would have expected the second lock to
25944 ** descriptor. It is now a structure that holds the integer file
25949 ** a reference count (so we will know when to delete it) and a "cnt"
26013 ** object keeps a count of the number of unixFile pointing to it.
26045 ** It is invoked after an error occurs in an OS function and errno has been
26046 ** set. It logs a message using sqlite3_log() containing the current value of
26078 ** may point to aErr[], or it may point to some static storage somewhere.
26082 ** If the code incorrectly assumes that it is the POSIX version that is
26113 ** We assume that close() almost always works, since it is only in a
26114 ** very sick application or on a very sick platform that it might fail.
26115 ** If it does fail, simply leak the file descriptor, but do log the
26118 ** Note that it is not safe to retry close() after EINTR since the
26213 ** around this problem (we consider it a bug in OS X, not SQLite)
26287 /* Otherwise see if some other process holds it.
26317 ** ever obtained is an exclusive lock, and it is obtained exactly once
26370 ** transitions leaving the lock state different from what it started but
26399 ** A process may only obtain a RESERVED lock after it has a SHARED lock.
26403 ** A process may only obtain a PENDING lock after it has obtained a
26546 /* The request was for a RESERVED or EXCLUSIVE lock. It is
26728 ** process is holding an incompatible lock. If it does, this
26731 ** SQLITE_BUSY would confuse the upper layer (in practice it causes
26801 ** common to all locking schemes. It closes the directory and file
26805 ** It is *not* necessary to hold the mutex when this routine is called,
26847 ** descriptor to pInode->pUnused list. It will be automatically closed
26869 ** (ex: databases that are burned into CD-ROM, for example.) It can
26936 ** In dotfile locking, either a lock exists or it does not. So in this
26975 ** transitions leaving the lock state different from what it started but
27027 /* got it, set the type and return ok */
27150 /* Otherwise see if some other process holds it. */
27155 /* got the lock, unlock it */
27169 /* someone else might have it reserved */
27200 ** transitions leaving the lock state different from what it started but
27224 /* if we already have a lock, it is exclusive.
27241 /* got it, set the type and return ok */
27313 ** Semaphore locking is like dot-lock and flock in that it really only
27340 /* Otherwise see if some other process holds it. */
27355 /* we could have it if we want it */
27376 ** transitions leaving the lock state different from what it started but
27400 /* if we already have a lock, it is exclusive.
27414 /* got it, set the type and return ok */
27591 /* Otherwise see if some other process holds it.
27597 /* if we succeeded in taking the reserved lock, unlock it to restore
27601 /* if we failed to get the lock then someone else must have it */
27627 ** transitions leaving the lock state different from what it started but
27757 It is
27934 ** descriptor to pInode->aPending. It will be automatically closed when
27995 ** NB: If you define USE_PREAD or USE_PREAD64, then it might also
28231 ** it work better.
28240 ** The idea behind dataOnly is that it should only write the file content
28249 ** So, we always use fdatasync() if it is available, regardless of
28256 ** the one below. It is replicated here solely to avoid cluttering
28291 ** It shouldn't be possible for fullfsync to fail on the local
28295 ** It'd be better to detect fullfsync support once and avoid
28301 /* fdatasync() on HFS+ doesn't yet flush the file size if it changed correctly
28335 ** told) so making it overrideable allows the chromium sandbox to
28337 ** a no-op, replace it with a stub that returns SQLITE_OK but leaves
28435 ** file so that it consists of an integer number of chunks (i.e. the
28483 ** layers, we need to report this file size as zero even though it is
28526 /* If the OS does not have posix_fallocate(), fake it. First use
28606 /* The pager calls this method to signal that it has done
28608 ** it hence it is OK for the transaction change counter to be
28631 ** SQLite code assumes this function cannot fail. It also assumes that
28652 ** available to turn it off and URI query parameter available to turn it off.
28819 ** This is not a VFS shared-memory method; it is a utility function called
28905 ** a new *-shm file is created, an attempt will be made to create it
29023 ** been allocated, it is allocated by this function.
29026 ** this call as described above, then it is mapped into this processes
29027 ** address space (if it is not already), *pp is set to point to the mapped
29042 /* If the shared-memory file has not yet been opened, open it now. */
29065 ** Check to see if it has been allocated (i.e. if the wal-index file is
29326 ** implement various file locking strategies. It also contains definitions
29455 ** The proxy locking method is a "super-method" in the sense that it
29457 ** it uses proxy, dot-file, AFP, and flock() locking methods on those
29495 ** for the database file "filePath". It then returns the sqlite3_io_methods
29561 ** for the database file "filePath". It then returns the sqlite3_io_methods
29690 ** findInodeInfo(). If this is the case, it is quite safe to close
29691 ** handle h - as it is guaranteed that no posix locks will be released
29706 /* AFP locking uses the file path so it needs to be included in
29733 /* Dotfile locking uses the file path so it needs to be included in
29751 /* Named semaphore locking uses the file path so it needs to be
29834 /* It's odd to simulate an io-error here, but really this is just
29844 ** name. If it is not, return SQLITE_ERROR.
29885 ** If a suitable file descriptor is found, then it is returned. If no
29892 ** vxworks would not benefit from the change (it might, we're not sure),
29893 ** but because no way to test it is currently available. It is better
29899 /* A stat() call may fail for various reasons. If this happens, it is
29901 ** For this reason, if an error occurs in the stat() call here, it is
30242 ** on that file that are currently holding advisory locks on it,
30379 /* It's odd to simulate an io-error here, but really this is just
30418 ** message is available, it is written to zBufOut. If no error message
30441 ** We initialize x by assigning it a pointer to the dlsym() function.
30477 ** some users. Rather than argue, it seems easier just to initialize
30603 ** in the core. So this routine is never called. For now, it is merely
30621 ** Proxy locking is a "uber-locking-method" in this sense: It uses the
30679 ** host ID in it, the proxy path in the conch file will be used, otherwise
30688 ** Once a lock proxy is configured for a database connection, it can not
30689 ** be removed, however it may be switched to a different proxy path via
30711 ** If the conch file does not exist, or it's contents do not match the
30723 ** Requesting the lock proxy does not immediately take the conch, it is
30726 ** opening a connection to a database file does not take a lock on it.
30774 ** and local proxy files in it
30924 return SQLITE_IOERR_LOCK; /* even though it is the conch */
30963 /* Not always defined in the headers as it ought to be */
31006 ** it back. The newly created file's file descriptor is assigned to the
31036 /* write it out to the temporary break file */
31229 /* if the conch isn't writable and doesn't match, we can't take it */
31468 ** This routine find the filename associated with pFile and writes it
31494 ** Takes an already filled in unix file and alters it so all file locking
31684 ** transitions leaving the lock state different from what it started but
31768 /* restore the original locking context and pMethod then close it */
31819 ** more than that; it looks at the filesystem type that hosts the
31948 ** This file should be #included by the os_*.c files only. It is not a
32005 ** It uses the RDTSC opcode to read the cycle count value out of the
32062 ** of the debugging and testing utilities, but it should at
32152 ** WinCE lacks native support for file locking so we have to fake it
32233 BOOL bOwned; /* Do we own the heap (i.e. destroy it on shutdown)? */
32268 ** thereafter. It records whether the operating system is Win9x
32820 ** API as long as we don't call it when running Win95/98/ME. A call to
33000 ** is not required to be threadsafe (it is not).
33172 /* FormatMessage returns 0 on failure. Otherwise it
33200 ** it's important to not reference them for WINCE builds.
33241 ** It logs a message using sqlite3_log() containing the current value of
33292 ** to see if it should be retried. Return TRUE to retry. Return FALSE
33393 /* Replace the backslashes from the filename and lowercase it
33421 /* Set a flag that indicates we're the first to create the memory so it
33429 /* If we succeeded in making the shared memory handle, map it. */
33433 /* If mapping failed, close the shared memory handle and erase it */
33537 /* If no pending lock has been acquired, then acquire it */
33675 ** containing the lower 32-bits of the new file-offset. Or, if it fails,
33676 ** it returns INVALID_SET_FILE_POINTER. However according to MSDN,
33678 ** whether an error has actually occured, it is also necessary to call
33697 ** It is reported that an attempt to close a handle might sometimes
33699 ** for being unreasonable so I do not doubt that it might happen. If
33846 ** file so that it consists of an integer number of chunks (i.e. the
33854 /* SetEndOfFile() returns non-zero when successful, or zero when it fails. */
34033 ** transitions leaving the lock state different from what it started but
34045 ** It is not possible to lower the locking level one step at a time. You
34089 ** copy this retry logic. It is a hack intended for Windows only.
34148 ** release it now.
34203 ** It is not possible for this routine to fail if the second argument
34323 ** SQLite code assumes this function cannot fail. It also assumes that
34514 ** This is not a VFS shared-memory method; it is a utility function called
34849 ** been allocated, it is allocated by this function.
34852 ** this call as described above, then it is mapped into this processes
34853 ** address space (if it is not already), *pp is set to point to the mapped
34886 ** Check to see if it has been allocated (i.e. if the wal-index file is
35046 /* It's odd to simulate an io-error here, but really this is just
35067 ** it's important to not reference them for WINCE builds.
35085 ** name. If it is not, return SQLITE_ERROR.
35221 ** created. SQLite doesn't use it to indicate "exclusive access"
35222 ** as it is usually understood.
35225 /* Creates a new file, only if it does not already exist. */
35226 /* If the file exists, it fails. */
35229 /* Open existing file, or create if it doesn't exist */
35232 /* Opens a file, only if it exists. */
35266 ** it's important to not reference them for WINCE builds.
35341 ** process has it open. Sometimes a virus scanner or indexing program
35342 ** will open a journal file shortly after it is created in order to do
35343 ** whatever it does. While this other process is holding the
35344 ** file open, we will be unable to delete it. To work around this
35373 ** it's important to not reference them for WINCE builds.
35423 ** as if it does not exist.
35444 ** it's important to not reference them for WINCE builds.
35508 /* It's odd to simulate an io-error here, but really this is just
35533 ** it's important to not reference them for WINCE builds.
35580 ** it's important to not reference them for WINCE builds.
35691 /* if SystemTimeToFileTime() fails, it
35738 ** it should be truncated. The return value of xGetLastError
35741 ** then it is not necessary to include the nul-terminator character
35745 ** on SQLite. It is fine to have an implementation that never
35753 ** However if an error message is supplied, it will be incorporated
35855 ** it will be aligned within the Bitvec struct. */
35998 /* completely fill the hash, then just add it without */
36007 /* there was a collision, check to see if it's already */
36008 /* in hash, if not, try to find a spot for it */
36014 /* we didn't find it in the hash. h points to the first */
36271 ** Check that the pCache->pSynced variable is set correctly. If it
36440 int createFlag, /* If true, create page if it does not exist already */
36452 ** allocate it now.
36537 ** reference count drops to 0, then it is made elible for recycling.
36565 ** page. This function deletes that reference, so after it returns the
36583 ** Make sure the page is marked as dirty. If it isn't dirty already,
36584 ** make it so.
36596 ** Make sure the page is marked as clean. If it isn't clean already,
36597 ** make it so.
36662 ** it must be that pgno==0.
36858 ** sqlite3_pcache interface). It also contains part of the implementation
36884 ** unused pages from other PCaches) but it also operates without a mutex,
37005 ** This routine is called from sqlite3_initialize() and so it is guaranteed
37031 ** such buffer exists or there is no space left in it, this function falls
37055 ** it from sqlite3Malloc instead.
37124 ** is because it may call sqlite3_release_memory(), which assumes that
37156 ** The pointer is allowed to be NULL, which is prudent. But it turns out
37192 ** Return true if it desirable to avoid allocating a new page cache
37197 ** it is desirable to avoid allocating a new page cache entry because
37203 ** under memory pressure, then again it is desirable to avoid
37263 ** PGroup LRU list, if is part of it. If pPage is not part of the PGroup
37300 ** (PCache1.apHash structure) that it is currently stored in.
37519 ** copy of the requested page. If one is found, it is returned.
37548 ** then attempt to recycle a page from the LRU list. If it is the right
37684 /* It is an error to call this function if the page is already
37884 ** After all inserts are finished, it is possible to extract the
37912 ** a non-zero batch number, it will see all prior INSERTs.
37983 ** It must be the case that N is sufficient to make a Rowset. If not
38199 ** as deep as it needs to be in order to contain the entire list.
38221 ** Convert the list in p->pEntry into a sorted list if it is not
38223 ** convert it into a list too and merge it into the p->pEntry list.
38302 ** The pager is used to access a database disk file. It implements
38374 ** snapshot is like a read-transaction. It is the state of the database
38383 /* Read a page from the write-ahead log, if it is present. */
38459 ** automatically as soon as it is written when PRAGMA synchronous=OFF.
38466 ** (a) The original content of the page as it was at the beginning of
38502 ** Definition: Two databases (or the same database at two points it time)
38514 ** is called to restore the database file to the same size it was at
38517 ** invoke it.)
38616 ** it opens a read-transaction on the database and returns to state
38629 ** * Even if a read-transaction is not open, it is guaranteed that
38665 ** is opened (if it is not already open) and a header written to the
38666 ** start of it. The database file on disk has not been modified.
38671 ** to it, but the header has not been synced to disk.
38677 ** when it modifies the contents of the database file. WAL connections
38690 ** It is not possible for a WAL connection to enter this state.
38695 ** by finalizing the journal file. Once in WRITER_FINISHED state, it is
38709 ** SQLITE_IOERR_NOMEM) occurs at a point in the code that makes it
38718 ** At this point it would be dangerous to change back to READER state
38725 ** Once it has entered the ERROR state, any attempt to use the pager
38751 ** Condition (3) is necessary because it can be triggered by a read-only
38754 ** automatically attempt a rollback, as it assumes that an error in a
38793 ** (i.e. one of the SQLITE_IOERR subtypes), it is not clear whether or not
38799 ** at the system level, but it is never set to a more exclusive value.
38816 ** doesn't know it because of a previous error in xUnlock). If this happens
38819 ** without rolling it back.
38822 ** database in the ERROR state, Pager.eLock is set to UNKNOWN_LOCK. It
38826 ** lock. Instead, it assumes a hot-journal exists and obtains an EXCLUSIVE
38827 ** lock on the database file before attempting to roll it back. See function
38899 ** logic into thinking that it already has all the locks it will ever
38912 ** It is set to true when the change-counter field is updated, which
38914 ** It is cleared (set to false) whenever an exclusive lock is
38916 ** The changeCountDone flag is inspected. If it is true, the work of
38925 ** When PagerCommitPhaseOne() is called to commit a transaction, it may
38927 ** journal file before it is synced to disk.
38932 ** If a journal file does not contain a master-journal pointer, it is
38934 ** it does contain a master-journal pointer the journal file is finalized
38935 ** by truncating it to zero bytes, just as if the connection were
38958 ** while it is being traversed by code in pager_playback().
38978 ** It is valid in PAGER_READER and higher states (all states except for
38997 ** variable at the start of the transaction. It is used during rollback,
39002 ** the file on disk in pages. It is set to a copy of dbSize when the
39011 ** to measure the database file on disk, and then truncates it if required.
39031 ** The Pager.errCode variable is only ever used in PAGER_ERROR state. It
39136 ** was obtained from /dev/random. It is used only as a sanity check.
39144 ** journal and ignore it.
39192 ** Return 0 if it is not open, or non-zero (but not 1) if it is.
39243 ** as if it has an exclusive lock on the database file. It never updates
39256 ** this means an in-memory pager performs no IO at all, it cannot encounter
39259 ** return SQLITE_IOERR_NOMEM while the journal file is being written). It
39307 /* It is possible that if journal_mode=wal here that neither the
39410 ** Return true if it is necessary to write page *pPg into the sub-journal.
39476 ** called, do not modify it. See the comment above the #define of
39502 ** called, do not modify it unless the new locking state is EXCLUSIVE_LOCK.
39529 ** The optimization is also always enabled for temporary files. It is
39533 ** If the optimization cannot be used, 0 is returned. If it can be used,
39534 ** then the value returned is the size of the journal file when it
39607 ** end of the file and, if successful, copies it into memory supplied
39619 ** file, then it is copied into the buffer pointed to by zMaster. A
39623 ** If it is determined that no master journal file name is present
39704 ** after writing or truncating it.
39735 ** space than that limit allows for, truncate it now. There is no need
39800 ** file it may contain some garbage data. There are two scenarios
39838 /* In theory, it is only necessary to write the 28 bytes that the
39844 ** However it has been discovered that on some systems this pattern can
40080 /* It is not possible for a call to PcacheFetch() with createFlag==0 to
40098 ** if it is open and the pager is not in exclusive mode.
40136 ** in the ERROR state. Otherwise, it switches the pager to PAGER_OPEN
40142 ** closed (if it is open).
40208 ** it can safely move back to PAGER_OPEN state. This happens in both
40241 ** it were a hot-journal).
40265 ** This routine is never called in PAGER_ERROR state. If it is called
40267 ** exclusive than a RESERVED lock, it is a no-op.
40271 ** If the journal file is open, then it is "finalized". Once a journal
40272 ** file has been finalized it is not possible to use it to roll back a
40273 ** transaction. Nor will it be considered to be a hot-journal by this
40320 ** 1. After a successful hot-journal rollback, it is called with
40359 ** the database file, it will do so using an in-memory journal.
40419 ** will roll it back.
40446 ** This is not a real checksum. It is really just the sum of the
40456 ** It is much less likely that the two ends of the journal record will be
40498 ** If pDone is not NULL, then it is a record of pages that have already
40548 ** a hot-journal rollback. If it is a hot-journal rollback, the pager
40569 ** it could cause invalid data to be written into the journal. We need to
40570 ** detect this invalid data (with high probability) and ignore it.
40588 ** rollback, then don't bother to play it back again.
40613 ** pager cache if it exists and the main file. The page is then marked
40615 ** a hot-journal rollback, it is guaranteed that the page-cache is empty
40632 ** 2008-04-14: When attempting to vacuum a corrupt database file, it
40671 ** problem. When the page is next fetched by the b-tree layer, it
40683 ** requiring a journal-sync before it is written.
40710 ** as clean, since there will be no need to write it out to the
40715 ** unsynced portion of the main journal file, then it is not safe
40720 ** again within this transaction, it will be marked as dirty but
40721 ** the PGHDR_NEED_SYNC flag will not be set. It could then potentially
40747 ** This routine checks if it is possible to delete the master journal file,
40748 ** and does so if it is.
40753 ** When a master journal file is created, it is populated with the names
40766 ** each child journal, it checks if:
40838 ** Open it and check if it points at the master journal. If
40886 ** xTruncate() method to truncate it.
40888 ** Or, it might might be the case that the file on disk is smaller than
40890 ** you try to truncate a file to some size that is larger than it
40908 /* TODO: Is it safe to use Pager.dbFileSize here? */
40940 ** it is less than 32, or rounded down to MAX_SECTOR_SIZE if it
40977 ** the state it was in before we started making changes.
41004 ** failure occurred while the journal was being written, it could be the
41006 ** the extra entries had not yet made it safely to disk. In such a case,
41010 ** If the nRec value is 0xffffffff it means that nRec should be computed
41026 ** that might be a hot journal. Or, it could be that the journal is
41052 /* Read the master journal name from the journal, if it is present.
41057 ** TODO: Technically the following is an error because it assumes that
41082 ** it is corrupted, then a process must have failed while writing it.
41104 ** process and if this is the final header in the journal, then it means
41113 ** the journal, it means that the journal might contain additional
41151 ** first place so it is OK to simply abandon the rollback. */
41207 ** see if it is possible to delete the master journal.
41215 ** value. Reset it to the correct value for this process.
41303 /* Increment the value just read and write it back to byte 24. */
41322 ** it is discarded. Otherwise, if there are one or more outstanding
41391 ** Hence, if page 1 appears anywhere on the list, it will be the first page.
41450 ** This routine used to be called "pagerOpenSnapshot()" because it essentially
41463 ** transaction in locking_mode=EXCLUSIVE. So call it now. If we
41501 ** determine it based on the size of the database file. If the size
41534 ** not exist (by deleting it) if the database file is empty.
41607 ** rolled back the first time it is encountered in either journal.
41613 ** is reset to the value that it held at the start of the savepoint
41615 ** is played back. If one is encountered it is simply skipped.
41634 /* Set the database size back to the value it was before the savepoint
41749 ** it is theoretically possible, though very unlikely,
41752 ** when it is rolled back.
41826 ** delete the temporary file when it is closed.
41860 ** lock. It does *not* invoke the busy handler when upgrading from
41872 ** retried. If it returns zero, then the SQLITE_BUSY error is
41888 ** If the pager is in the error state when this function is called, it
41899 ** * the database is either not an in-memory database or it is
41917 /* It is not possible to do a full assert_pager_state() here, as this
41969 ** occurs. But other modules are free to use it too, as long as
42053 ** the pager. It returns the total number of pages in the database.
42105 ** b) if the page content were written at this time, it would not
42117 ** database image would become corrupt. It is therefore fortunate that
42134 ** function does not actually modify the database file on disk. It
42147 ** This function is called before attempting a hot-journal rollback. It
42152 ** Syncing a hot-journal to disk before attempting to roll it back ensures
42181 ** is made to roll it back. If an error occurs during the rollback
42201 /* If it is open, sync the journal file before calling UnlockAndRollback.
42208 ** database and close the journal file without attempting to roll it
42209 ** back or finalize it. The next database user will have to do hot-journal
42268 ** been written following it. If the pager is operating in full-sync
42316 ** hot-journal rollback following recovery. It may roll back all
42318 ** out-of-date data that follows it. Database corruption.
42322 ** byte to the start of it to prevent it from being recognized.
42325 ** problematic header will occur, if it exists. aMagic is used
42349 ** it as a candidate for rollback.
42352 ** SAFE_APPEND property. Because in this case it is not possible
42412 ** is not yet open, it is created and opened before any data is
42417 ** a page is skipped if it meets either of the following criteria:
42439 /* If the file is a temp-file has not yet been opened, open it now. It
42512 ** Ensure that the sub-journal file is open. If it is already open, this
42533 ** It is the callers responsibility to use subjRequiresPage() to check
42534 ** that it is really required before calling this function.
42549 /* Open the sub-journal, if it has not already been opened */
42583 ** This function is called by the pcache layer when it has reached some
42617 ** lead to database corruption. In the current implementaton it
42619 ** while in the error state, hence it is impossible for this routine to
42648 ** the database image, it may need to be written to the sub-journal.
42665 ** data from the database file. This will be the copy of page X as it
42666 ** was when the transaction started, not as it was when "SAVEPOINT sp"
42670 ** sub-journal file now (if it is not already there), so that it will
42698 ** Allocate and initialize a new Pager object and put a pointer to it
42699 ** in *ppPager. The pager should eventually be freed by passing it
42706 ** all information is held in cache. It is never written to disk.
42714 ** operation of the pager. It should be passed some bitwise combination
42800 ** as it will not be possible to open the journal file or even
42909 /* If a temporary file is requested, it is not opened immediately.
43010 ** PAGER_SHARED state. It tests if there is a hot journal present in
43031 ** will not roll it back.
43072 /* Check the size of the database file. If it consists of 0 pages,
43092 ** it can be ignored.
43111 ** it might be due to the race condition described above and in
43113 ** This might be a false positive. But if it is, then the
43115 ** with it under an EXCLUSIVE lock where we do not need to
43131 ** It is illegal to call sqlite3PagerAcquire() until after this function
43133 ** this function is called, it is a no-op.
43181 ** database file, then it either needs to be played back or deleted.
43190 /* Get an EXCLUSIVE lock on the database file. At this point it is
43192 ** EXCLUSIVE lock. If it
43210 /* If it is not already open and the file exists on disk, open the
43217 ** If the journal does not exist, it usually means that some
43218 ** other connection managed to get in and roll it back before
43219 ** this connection obtained the exclusive lock above. Or, it
43245 ** it back since the process that crashed and left the hot journal
43246 ** probably did not sync it and we are required to always sync
43247 ** the journal before playing it back.
43273 ** assert_pager_state() would fail now, as it should not be possible
43304 ** it can be neglected.
43373 ** successfully obtained, it is copied to *ppPage and SQLITE_OK returned.
43375 ** If the requested page is already in the cache, it is returned.
43384 ** data is left as it was when the page object was last used.
43392 ** If noContent is true, it means that we do not care about the contents
43414 ** in memory, this routine goes to disk to read it in whereas Lookup()
43415 ** just returns 0. This routine acquires a read-lock the first time it
43417 ** Since Lookup() never goes to disk, it never has to deal with locks
43482 ** It merely means that we might do some extra work to journal a
43523 ** Acquire a page if it is already in the in-memory cache. Do
43565 ** to the start of it. If there are active savepoints, open the sub-journal
43567 ** opened to write a rollback log for a transaction. It is not used
43568 ** when opening a hot journal file to roll it back.
43570 ** If the journal file is already open (as it may be in exclusive mode),
43600 /* Open the journal file if it is not already open. */
43658 ** has no effect if the sub-journal is already opened (as it may be when
43676 ** exclusive lock on the database is not already held, obtain it now.
43689 ** holds the write-lock. If possible, the upper layer will call it.
43708 ** when it has an open transaction, but never to DBMOD or FINISHED.
43744 ** It is never called in the ERROR state.
43764 ** rollback journal might not yet be open. Open it now if this is the case.
43767 ** Otherwise, if it were done after calling sqlite3PcacheMakeDirty(), then
43788 ** the transaction journal if it is not there already.
43850 /* If the statement journal is open and the page is not in it,
43853 ** in that it omits the checksums and the header.
43909 ** an integer power of 2. It sets variable pg1 to the identifier
43949 ** starting at pg1, then it needs to be set for all of them. Because
43975 ** to sqlite3PagerWrite(). In other words, return TRUE if it is ok
43985 ** A call to this routine tells the pager that it is not necessary to
43993 ** that it does not get written to disk.
44041 ** to this function. Otherwise, it is always set to zero.
44104 ** If successful, or if called on a pager for which it is a no-op, this
44128 ** If the EXCLUSIVE lock is already held or the attempt to obtain it is
44197 ** function has already been called, it is mostly a no-op. However, any
44221 /* The following block updates the change-counter. Exactly how it
44279 ** that it took at the start of the transaction. Otherwise, the
44317 ** atomic-update optimization is used it is almost certain that the
44319 ** on a system under memory pressure it is just possible that this is
44320 ** not the case. In this case it is likely enough that the redundant
44363 ** though, and if a failure occurs at this point it will eventually
44367 ** truncating or partially zeroing it, so that it cannot be used
44378 ** But if (due to a coding error elsewhere in the system) it does get
44420 ** it returns Pager.errCode immediately. No work is performed in this case.
44424 ** 1) It rolls back the journal file, restoring all database file and
44428 ** 2) It finalizes the journal file, so that it is not used for hot
44592 ** malloc failure occurs while populating it in the for(...) loop below.
44634 ** If it is SAVEPOINT_RELEASE, then release and destroy the savepoint with
44635 ** index iSavepoint. If it is SAVEPOINT_ROLLBACK, then rollback all changes
44647 ** the transaction or unlock the database, it just restores the
44682 /* Only truncate if it is an in-memory sub-journal. */
44691 ** If this is a temp-file, it is possible that the journal file has
44773 ** in the rollback journal, it is not put there by by this routine.
44779 ** A transaction must be active when this routine is called. It used to be
44786 ** is being committed. In this case, it is guaranteed that the database page
44790 ** occurs. Otherwise, it returns SQLITE_OK.
44817 ** <journal page X, then modify it in memory>
44822 ** If page X were not written to the sub-journal here, it would not
44846 ** can be written to. The caller has already promised not to write to it.
44854 /* If the cache contains a page with page-number pgno, remove it
44856 ** page pgno before the 'move' operation, it needs to be retained
44879 ** as the original page since it has already been allocated.
44898 ** this transaction, it may be written to the database file before
44899 ** it is synced into the journal file. This way, it may end up in
44984 ** only. We invoke it once here to suppress a compiler warning. */
45033 /* In this case we would like to delete the journal file. If it is
45039 ** while it is in use by some other client.
45080 ** Return TRUE if the pager is in a state where it is OK to change the
45108 ** uses it opaquely as an argument to sqlite3BackupRestart() and
45159 ** is obtained instead, immediately release it.
45216 ** is not already open, make an attempt to open it now. If successful,
45270 ** it may need to be checkpointed before the connection can switch to
45271 ** rollback mode. Open it now so this can happen.
45405 ** magic number in the first 4 bytes of the WAL is 0x377f0683 and it
45436 ** To read a page from the database (call it page number P), a reader
45437 ** first checks the WAL to see if it contains page P. If so, then the
45448 ** and ignores the newly appended content, it will see a consistent snapshot
45472 ** connection to it closes. Because the wal-index is transient, it can
45473 ** use an architecture-specific format; it does not have to be cross-platform.
45630 ** Or it can be 1 to represent a 65536-byte page. The latter case was
45664 ** a special case; its value is never used and it exists as a place-holder
45907 ** architecture, it returns the u32 value that results from interpreting
45908 ** the 4 bytes as a big-endian value. On a big-endian architecture, it
45973 ** The checksum on pWal->hdr is updated before it is written.
45989 ** This function encodes a single frame header and writes it to a buffer
46025 ** in aData[] is valid. If it is a valid frame, fill *piPage and
46102 ** A lock cannot be moved directly between shared and exclusive - it must go
46163 ** slot in the hash table is set to N, it refers to frame number
46257 ** the entry that corresponds to frame pWal->hdr.mxFrame. It is guaranteed
46850 ** WalIterator object when it has finished with it.
46862 ** it only runs if there is actually content in the log (mxFrame>0).
46930 ** n. If the attempt fails and parameter xBusy is not NULL, then it is a
46931 ** busy-handler function. Invoke it and retry the lock until either the
46975 ** it safe to delete the WAL since the new content will persist in the
47132 ** it to exactly nMax bytes. If an error occurs while doing so, ignore it.
47219 ** read it, which might result in inconsistency. A dirty read is detected
47240 ** meaning it is possible that an inconsistent snapshot is read
47310 /* If the first attempt failed, it might have been due to a race
47326 ** a WRITE lock, it can only mean that the header is corrupted and
47350 ** This is the value that walTryBeginRead returns when it needs to
47357 ** other transient condition. When that happens, it returns WAL_RETRY to
47358 ** indicate to the caller that it is safe to retry immediately.
47365 ** the case where the WAL is bypassed because it has been completely
47382 ** possibility is so small that it can be safely neglected, we believe.
47401 ** update values of the aReadMark[] array in the header, but if it does
47402 ** so it takes care to hold an exclusive lock on the corresponding
47421 ** during the few nanoseconds that it is holding the lock. In that case,
47422 ** it might take longer than normal for the lock to free.
47475 /* The WAL has been completely backfilled (or it is empty).
47482 /* It is not safe to allow the reader to continue here if frames
47493 ** it finished. Leaving a corrupt image in the database file.
47505 /* If we get this far, it means that the reader will want to use
47550 ** It is necessary to check that the wal-index header did not change
47551 ** between the time it was read and when the shared-lock was obtained
47562 ** blocking writers. It only guarantees that a dangerous checkpoint or
47584 ** it takes a snapshot of the state of the WAL and wal-index for the current
47621 ** Read a page from the WAL, if it is present in the WAL and if the
47720 /* If iRead is non-zero, then it is the log frame number that contains the
47759 ** the read transaction was started, then it is not possible for this
47817 ** other than SQLITE_OK, it is not invoked again and the error code is
47829 /* Restore the clients cache of the wal-index header to the state it
47844 ** If the upper layer is doing a rollback, it is guaranteed that there
47906 ** file (see sqlite3WalFrames()). It checks to see if, instead of appending
47907 ** to the current log file, it is possible to overwrite the start of the
47909 ** it sets pWal->hdr.mxFrame to 0. Otherwise, pWal->hdr.mxFrame is left
47933 ** In theory it would be Ok to update the cache of the header only
48072 /* See if it is possible to write these frames into the start of the
48073 ** log file, instead of appending to it at pWal->hdr.mxFrame.
48187 /* Append data to the wal-index. It is not necessary to lock the
48231 ** If parameter xBusy is not NULL, it is a pointer to a busy-handler
48257 ** is already running a checkpoint, or maybe a recovery. But it might
48306 ** next time the pager opens a snapshot on this database it knows that
48354 ** not actually change anything. The pager uses this to see if it
48406 ** If the argument is not NULL, it points to a Wal object that holds a
48407 ** read-lock. This function returns the database page-size if it is known,
48408 ** or zero if it is not (or if pWal is NULL).
48434 ** big and we want to break it down some. This packaged seemed like
48539 ** except that it applies to leaf nodes in a LEAFDATA tree. The maximum
48540 ** payload fraction for a LEAFDATA tree is always 100% (or 255) and it
48763 ** this object for every database file that it has open. This structure
48770 ** has it own instance of this object. But each instance of this object
48812 ** sharing the same database file, each connection has it own
48820 ** may not be modified once it is initially set as long as nRef>0.
48910 ** If a tree that appears to be taller than this is encountered, it is
49056 ** if the database supports auto-vacuum or not. Because it is used
49058 ** (sqliteMallocRaw), it is not possible to use conditional compilation.
49283 ** no lock is ever required since it is not sharable.
49401 ** But if the value is zero, make it 65536.
49414 ** but the test harness needs to access it so we make it global for
49467 ** table with root page iRoot. Return 1 if it does and 0 if not.
49506 ** not loaded, then it is too difficult to actually check to see if
49516 ** written. For index b-trees, it is the root page of the associated
49551 ** Return true if it would be illegal for pBtree to write into the
49555 ** It is illegal for pBtree to write if some other Btree object that
49558 ** read-uncommitted flag set, then it is OK for the other object to
49673 /* This function should only be called on a sharable b-tree after it
49687 ** with table iTable, allocate one and link it into the list.
49719 ** transaction. If it does not, then the BTS_PENDING flag
49864 ** such a page is not even journalled (as it will not be modified,
49865 ** why bother journalling it?).
49868 ** from the database or written to the journal file (why should it
49869 ** be, if it is not at all meaningful?).
49875 ** it is moved to the free-list and it is also not journalled when it
49877 ** may be lost. In the event of a rollback, it may not be possible
49906 ** free-list for reuse. It returns false if it is safe to retrieve the
50041 ** Restore the cursor to the position it was in (or as close to as possible)
50070 ** Determine whether or not a cursor has moved from the position it
50121 ** so that it maps to type 'eType' and parent page number 'pgno'.
50551 ** the list that is large enough to accomadate it.
50636 ** freeblocks that overlapped cells. Nor does it detect when the
50684 /* If the cell content area begins with a freeblock, remove it. */
50740 ** guarantee that the page is well-formed. It only shows that
50788 ** returned if it does.
50852 ** Set up a raw page so that it looks like a database page holding
50906 ** If the noContent flag is set, it means that we do not care about
50958 ** Get a page from the pager and initialize it. This routine is just a
50962 ** If an error occurs, then the value *ppPage is set to is undefined. It
50963 ** may remain unchanged, or it may be set to an invalid value.
51021 /* pPage might not be a btree page; it might be an overflow page
51024 ** But no harm is done by this. And it is very important that
51047 ** be exclusively in memory, or it might use a disk-based memory cache.
51052 ** that is automatically destroyed when it is closed.
51328 ** Decrement the BtShared.nRef counter. When it reaches zero,
51331 ** false if it is still positive.
51418 ** it without having to hold the mutex.
51448 ** operate asynchronously - it will not stop to do fsync()s
51609 ** parameter is non-zero, then auto-vacuum mode is enabled. If zero, it
51710 ** in WAL mode. If the log is not already open, open it now. Then
51778 ** a cell. Make sure it is small enough so that at least minFanout
51917 /* If the btree is already in a write-transaction, or it
51968 ** reading page 1 it discovers that the page-size of the database
52016 /* If the db-size header field is incorrect (as it may be if an old
52017 ** client has been writing the database file), update it now. Doing
52036 ** the sub-journal is not already open, then it will be opened here.
52091 ** that it points to iTo. Parameter eType describes the type of pointer to
52190 /* If pDbPage was a btree-page, then it may have child pages and/or cells
52214 ** that it points at iFreePage. Also fix the pointer map entry for
52250 ** it returns SQLITE_DONE or an error, and that nFin is the
52252 ** process is complete. If nFin is zero, it is assumed that
52285 ** truncated to zero after this function returns, so it doesn't
52286 ** matter if it still contains some garbage entries.
52360 ** It performs a single unit of work towards an incremental vacuum.
52363 ** SQLITE_DONE is returned. If it is not finished, but no error occurred,
52413 /* It is not possible to create a database for which the final page
52458 ** causes a rollback journal to be created (if it does not already exist)
52563 ** are no active cursors, it also releases the read lock.
52609 ** in assert() expressions, so it is only compiled if NDEBUG is not
52640 ** or moved root pages, so it is not sufficient to
52668 ** are no active cursors, it also releases the read lock.
52744 ** SQL statements. It is illegal to open, release or rollback any
52791 ** iTable. If a read-only cursor is requested, it is assumed that
52815 ** root page of a b-tree. If it is not, then the cursor acquired
52818 ** It is assumed that the sqlite3BtreeCursorZero() has been called
52900 ** to zero. But it turns out that the apPage[] and aiIdx[] arrays
52970 ** BtCursor.info structure. If it is not already valid, call
52971 ** btreeParseCell() to fill it in.
53038 ** This routine cannot fail. It always returns SQLITE_OK.
53061 ** It might just as well be a procedure (returning void) but we continue
53075 ** linked list of overflow pages. If possible, it uses the auto-vacuum
53086 ** reference. It is the responsibility of the caller to call releasePage()
53184 ** buffer pBuf). If it is non-zero, a write (data copied from
53199 ** Once an overflow page-list cache has been allocated, it may be
53260 ** has not been allocated, allocate it now. The array is sized at
53269 /* nOvfl is always positive. If it were zero, fetchPayload would have
53278 ** directly to it.
53312 /* Need to read this page properly. It contains some of the
53426 ** the key if skipKey==0 and it points to the beginning of data if
53431 ** This routine is an optimization. It is common for the entire key
53436 ** the key/data and copy it into a preallocated buffer.
53583 /* UPDATE: It is actually possible for the condition tested by the assert
53585 ** one cursor has modified page pParent while a reference to it is held
53616 ** If this function returns successfully, it may be assumed that the
53660 ** expected to open it on an index b-tree. Otherwise, if pKeyInfo is
53672 ** if the assumption were not true, and it is not possible for the flags
53698 ** entry to which it is currently pointing.
53720 ** page to which it is currently pointing. Notice the difference
53811 /* Move the cursor so that it points to an entry near the key
53819 ** left pointing at a leaf page which would hold the entry if it
54067 /* If the database file is corrupt, it is possible for the value of idx
54069 ** the page while cursor pCur is holding a reference to it. Which can
54176 ** sqlite3PagerUnref() on the new page when it is done.
54188 ** anywhere on the free-list, then it is guarenteed to be returned. This
54245 ** is not true. Otherwise, it runs once for each trunk-page on the
54271 ** So extract the trunk page itself and use it as the newly
54290 ** to allocate, regardless of whether it has leaves.
54310 /* The trunk page is required by the caller but it contains
54462 ** It is assumed that the page is not already a part of the free-list.
54466 ** corresponding to page iPage handy, it may pass it as the second value.
54467 ** Otherwise, it may pass NULL.
54520 ** new free-list trunk page. Otherwise, it will become a leaf of the
54521 ** first trunk page in the current free-list. This block tests if it
54543 ** Note that the trunk page is not really full until it contains
54568 /* If control flows to this point, then it was not possible to add the
54643 ** So if there exists more than one reference to this page, then it
54645 ** It is helpful to detect this before calling freePage2(), as
54829 ** The cell content is not freed or deallocated. It is assumed that
54879 ** If the cell content will fit on the page, then put it there. If it
54882 ** in pPage->apOvfl[] and make it point to the cell content (either
54951 ** if it returns success */
55146 ** it is sometimes activated temporarily while debugging code responsible
55198 ** The performance of this function is not critical. It is only used by
55224 ** fairly obscure circumstances, even though it is a copy of initialized
55264 ** happens, it is the responsibility of the caller to invoke the correct
55267 ** If this routine fails for any reason, it might leave the database
55326 ** this overflow cell is present, it must be the cell with
55389 ** the cell within the parent, even though it has been dropped.
55391 ** four bytes of it, and this function does not need the first
55398 ** buffer. It will be copied out again as soon as the aSpace[] buffer
55588 ** in this procedure so there is no need to act upon it now.
55730 ** bytes, then it may actually be smaller than this
55732 ** any cell). But it is important to pass the correct size to
55736 ** cells are at least 4 bytes. It only happens in b-trees used
55775 ** (it must be, as it was just reconstructed using assemblePage()). This
55916 ** page is then overwritten to make it an empty page with the right-child
56003 ** and copy the current contents of the root-page to it. The
56060 ** but it doesn't deal with overflow cells - just moves them to a
56062 ** has completed, it is safe to release the pSpace buffer used by
56070 /* If pFree is not NULL, it points to the pSpace buffer used
56073 ** new pSpace buffer, so it may be safely freed here. */
56158 ** operation - if it is not, the following is a no-op). */
56168 ** integer key to use. It then calls this function to actually insert the
56170 ** that the cursor is already where it needs to be and returns without
56171 ** doing any work. To avoid thwarting these optimizations, it is important
56235 ** happen while processing an "INSERT INTO ... SELECT" statement), it
56239 ** larger than the largest existing key, it is possible to insert the
56359 ** been corrected, so be it. Otherwise, after balancing the leaf node,
56360 ** walk the cursor up the tree to the internal node and balance it as
56443 ** allocated pgnoMove. If required (i.e. if it was not allocated
56599 ** is the root of a table b-tree - if it is not, the following call is
56639 /* It is illegal to drop a table if any cursors are open on the
56841 /* pPage is a leaf node. This loop navigates the cursor so that it
56842 ** points to the first interior cell that it points to the parent of
57059 ** 8. Make sure this page is at least 33% full or else it is
57396 ** open so it is safe to access without the BtShared mutex.
57409 ** open so it is safe to access without the BtShared mutex.
57477 ** allocated, it is returned as normal.
57515 ** if it is false.
57542 ** Only the data content may only be modified, it is not possible to
57686 ** Once it has been created using backup_init(), a single sqlite3_backup
57718 ** If the "temp" database is requested, it may need to be opened by this
57781 ** handle is not locked in this routine, but it is locked in
57928 ** If pFile is currently larger than iSize bytes, then truncate it to
57989 /* Lock the destination database, if it is not locked already. */
57998 ** one now. If a transaction is opened here, then it will be closed
58065 ** fix the size of the file. However it is important to call
58204 /* If a transaction is still open on the Btree, roll it back. */
58250 ** It is assumed that the mutex associated with the BtShared object
58259 /* The backup process p has already copied page iPage. But now it
58283 ** It is assumed that the mutex associated with the BtShared object
58418 ** current content of the cell is preserved. Otherwise, it may
58422 ** It also clears MEM_Ephem and MEM_Static. If the preserve flag is
58464 ** Make the given Mem object MEM_Dyn. In other words, make it so
58493 ** If the given Mem* has a zero-filled tail, turn it into an ordinary
58573 ** FIX ME: It would be better if sqlite3_snprintf() could do UTF-16.
58618 ** invoking an external callback, free it now. Calling this function
58682 /* minInt is correct here - not maxInt. It turns out that assigning
58684 ** negative integer. This makes no sense, but it is what x86 hardware
58699 ** it into a integer and return that. If pMem represents an
58727 ** value. If it is a string or blob, try to convert it to a double.
58728 ** If it is a NULL, return 0.0.
58749 ** The MEM structure is already a MEM_Real. Try to also make it a
58769 ** true and could be omitted. But we leave it in because other
58798 ** Convert pMem so that it is of type MEM_Real.
58811 ** Convert pMem so that it has types MEM_Real or MEM_Int or both.
59032 ** If the string is too large (if it exceeds the SQLITE_LIMIT_LENGTH
59034 ** stored without allocating memory, then it is. If a memory allocation
59074 /* The following block sets the new values of Mem.z and Mem.xDel. It
59138 /* If one value is NULL, it is less than the other. If both values
59297 /* This function is only available internally, it is not part of the
59298 ** external API. It works in a similar way to sqlite3_value_text(),
59363 ** the value by passing it to sqlite3ValueFree() later on. If the expression
59497 ** that it uses the encoding "enc"
59525 ** a VDBE (or an "sqlite3_stmt" as it is known to the outside world.) Prior
59613 ** Resize the Vdbe.aOp array so that it is at least one op larger than
59614 ** it was.
59709 ** sqlite3VdbeAddOp4() since it needs to also needs to mark all btrees
59790 ** in a Vdbe main program and each of the sub-programs (triggers) it may
59791 ** invoke directly or indirectly. It should be used as follows:
59870 ** ABORT may be thrown, or false otherwise. Return true if it does
59973 ** the Vdbe passed as the first argument. It is the callers responsibility
60082 ** Change the P2 operand of instruction addr so that it points to
60092 ** If the input FuncDef structure is ephemeral, then free it. If
60154 ** opcodes contained within. If aOp is not NULL it is assumed to contain
60204 ** If n==P4_KEYINFO it means that zP4 is a pointer to a KeyInfo structure.
60209 ** caller should not free the allocation, it will be freed when the Vdbe is
60326 ** is readable but not writable, though it is cast to a writable value.
60491 ** that may be accessed by the VM passed as an argument. In doing so it also
60633 ** running the code, it invokes the callback once for each instruction.
60690 /* On the first call to sqlite3_step(), pSub will hold a NULL. It is
60881 ** NULL, it means that memory space has already been allocated and that
60917 ** running it.
60959 ** After the VDBE has be prepped, it can be executed by one or more
60966 ** the Vdbe from the Parse object that helped generate it so that the
60971 ** to its initial state after it has been run.
61091 /* The pCx->pCursor will be close automatically, if it exists, by
61168 ** sorters that were left open. It also deletes the values of
61220 ** or SQLITE_TRANSIENT. If it is SQLITE_DYNAMIC, then the buffer pointed
61247 ** db. If a transaction is active, commit it. If there is a
61303 ** string, it means the main database is :memory: or a temp file. In
61319 ** IO error while deleting or truncating a journal file. It is unlikely,
61433 ** master journal file will be orphaned. But we cannot delete it,
61490 ** This is an internal self-check only - it is not an essential processing
61517 ** close it now. Argument eOp must be either SAVEPOINT_ROLLBACK or
61518 ** SAVEPOINT_RELEASE. If it is SAVEPOINT_ROLLBACK, then the statement
61570 ** database handles deferred constraint counter to the value it had when
61587 ** an error message to it. Then return SQLITE_ERROR.
61608 ** SQLITE_MAGIC_RUN to SQLITE_MAGIC_HALT. It is harmless to
61612 ** lock contention, return SQLITE_BUSY. If SQLITE_BUSY is returned, it
61665 ** Even if the statement is read-only, it is important to perform
61844 ** To look at it another way, this routine resets the state of the
61852 /* If the VM did not run to completion or if it encountered an
61853 ** error, then it might not have been halted properly. So halt
61854 ** it now.
61997 ** Make sure the cursor p is ready to read or write the row to which it
62003 ** deleted out from under the cursor and if it has, mark the row as
62053 ** the blob of data that it corresponds to. In a table record, all serial
62143 ** (later): It is reported to me that the mixed-endian problem
62144 ** on ARM7 is an issue with GCC, not with the ARM7 chip. It seems
62191 ** buf. It is assumed that the caller has allocated sufficient space.
62371 int nOff; /* Increment pSpace by nOff to align it */
62374 /* We want to shift the pointer pSpace up such that it is 8-byte aligned.
62376 ** it by. If pSpace is already 8-byte aligned, nOff should be zero.
62436 ** specified by {nKey1, pKey1} and pPKey2. It returns a negative, zero
62472 ** We could initialize it, as shown here, to silence those complaints.
62524 ** the following assert(). If the assert() fails, it indicates a
62534 ** larger. As it happens, the pPKey2 will always be the longer
62551 ** Read the rowid (the last field in the record) and store it in *rowid.
62632 ** pUnpacked is either created without a rowid or is truncated so that it
62678 ** Set a flag in the vdbe to update the change counter when it is finalised
62712 ** 0 instead. Unless it is NULL, apply affinity aff (one of the SQLITE_AFF_*
62713 ** constants) to the value before returning it.
62735 ** Configure SQL variable iVar so that binding a new value to it signals
62782 ** Check on a Vdbe to make sure it has not been finalized. Log
62783 ** an error and return true if it has been finalized (or is otherwise
62784 ** invalid). Return false if it is ok.
62837 ** Terminate the current execution of an SQL statement and reset it
62838 ** back to its starting state so that it can be reused. A success code from
62936 ** result as a string or blob but if the string or blob is too large, it
63059 ** This function is called after a transaction has been committed. It
63121 /* Check that malloc() has not failed. If it has, return early. */
63266 ** pointer to it.
63275 ** pointer to it.
63356 ** deleted by calling the delete function specified when it was set.
63402 ** This function is deprecated. Do not use it for new code. It is
63434 ** it is, return a pointer to the Mem for the value of that column.
63589 ** 0 The column name as it should be displayed for output
63595 ** If the result is not a simple column reference (if it is an expression
64406 ** When this global variable is positive, it gets decremented once before
64407 ** each instruction in the VDBE. When it reaches zero, the u1.isInterrupted
64410 ** This facility is used for testing purposes only. It
64456 ** Test a register to see if it exceeds the current maximum blob size.
64457 ** If it does, record the new maximum blob size.
64466 ** Convert the given register into a string if it isn't one
64477 ** does not control the string, it might be deleted without the register
64478 ** knowing it.
64481 ** string that the register itself controls. In other words, it
64520 ** Allocate VdbeCursor number iCur. Return a pointer to it. Return NULL
64531 ** required for this VdbeCursor structure. It is convenient to use a
64582 ** looks like a number, convert it into a number. If it does not
64583 ** look like a number, leave it alone.
64647 ** is appropriate. But only do the conversion if it is possible without
64820 ** It uses the RDTSC opcode to read the cycle count value out of the
64877 ** of the debugging and testing utilities, but it should at
64893 ** sqlite3_interrupt() routine has been called. If it has been, then
64907 ** This function is only called from within an assert() expression. It
64951 ** will either invoke the busy callback (if there is one) or it will
65484 /* Call the progress callback if it is configured and the required number
65649 ** Check the value in register P3. If it is NULL then Halt using
65666 ** For errors, it can be some other value. If P1!=0 then P2 will determine
65672 ** If P4 is not null then it is an error message string.
65761 ** into an OP_String before it is executed for the first time.
65871 ** left holding a NULL. It is an error for register ranges
65956 ** with an SQLITE_ROW return code and it sets up the sqlite3_stmt
65971 ** transaction. It needs to be rolled back. */
66033 ** It is illegal for P1 and P3 to be the same register. Sometimes,
66200 ** If P1 is not zero, then it is a register that a subsequent min() or
66457 ** If register P1 holds an integer convert it to a real value.
66477 ** If the value is numeric, convert it to a string using the
66481 ** A NULL value is not changed by this routine. It remains NULL.
66500 ** If the value is numeric, convert it to a string first.
66504 ** A NULL value is not changed by this routine. It remains NULL.
66524 ** If the value is text or blob, try to convert it to an using the
66528 ** A NULL value is not changed by this routine. It remains NULL.
66541 ** If the value is text or blob, try to convert it to an integer using the
66544 ** A NULL value is not changed by this routine. It remains NULL.
66558 ** If The value is currently an integer, convert it.
66559 ** If the value is text or blob, try to convert it to an integer using the
66562 ** A NULL value is not changed by this routine. It remains NULL.
66613 ** If neither operand is NULL the result is the same as it would be if
66625 ** If neither operand is NULL the result is the same as it would be if
66928 ** is considered true if it is numeric and non-zero. If the value
66934 ** is considered false if it has a numeric value of zero. If the value
67043 ** u.an.zRec is set to be the complete text of the record if it is available.
67046 ** might be available in the u.an.pC->aRow cache. Or it might not be.
67072 ** payload size, so it is impossible for u.an.payloadSize64 to be
67196 /* Scan the header and use it to fill in the u.an.aType[] and u.an.aOffset[]
67426 ** sqlite3VdbeMemGrow() could clobber the value before it is used).
67524 ** If this is a transaction savepoint being opened, it is guaranteed
67569 /* It is not possible to release (commit) a savepoint if there are
67623 /* If it is a RELEASE, then destroy the savepoint being operated on
67624 ** too. If it is a ROLLBACK TO, then set the number of deferred
67801 ** Read cookie number P3 from database P1 and write it into register P2.
67874 ** schema version) and make sure it is equal to P2 and that the
67940 ** It is an error for P1 to be negative.
67955 ** a KeyInfo structure (P4_KEYINFO). If it is a pointer to a KeyInfo
67958 ** value, it is set to the number of columns in the table.
67969 ** a KeyInfo structure (P4_KEYINFO). If it is a pointer to a KeyInfo
67972 ** value, it is set to the number of columns in the table, or to the
67975 ** This instruction works just like OpenRead except that it opens the cursor
68049 /* Since it performs no memory allocation or IO, the only value that
68071 ** if P4 is not 0. If P4 is not NULL, it points to a KeyInfo structure
68087 ** This opcode works the same as OP_OpenEphemeral. It has a
68114 /* If a transient index is required, create it by calling
68116 ** opening it. If a transient table is required, just use the
68143 ** This opcode works like OP_OpenEphemeral except that it opens
68214 ** Reposition cursor P1 so that it points to the smallest entry that
68227 ** Reposition cursor P1 so that it points to the smallest entry that
68240 ** Reposition cursor P1 so that it points to the largest entry that
68253 ** Reposition cursor P1 so that it points to the largest entry that
68286 ** blob, or NULL. But it needs to be an integer before we can do
68287 ** the seek, so covert it. */
68416 ** for P1 to move so that it points to the rowid given by P2.
68623 ** pointing to the record if it exists.
68729 ** it already exists in the table. If it does not exist, we have
68803 ** it finds one that is not previously used. */
68842 ** created if it doesn't already exist or the data for an existing
68850 ** sqlite3_last_insert_rowid() function (otherwise it is unmodified).
68866 ** may be NULL. If it is not NULL, then the update-hook
68958 ** record in the table. If it is left pointing at the next record, then
68959 ** the next Next instruction will be a no-op. Hence it is OK to delete
68965 ** P1 must not be pseudo-table. It has to be a real table with
68968 ** If P4 is not NULL, then it is the name of the table that P1 is
68969 ** pointing to. The update hook will be invoked, if it exists.
68998 ** below is always a no-op and cannot fail. We will run it anyhow, though,
69079 ** It is just copied onto the P2 register exactly as
69080 ** it is found in the database file.
69090 ** it is found in the database file.
69124 ** a no-op and can never fail. But we leave it in place as a safety.
69269 ** it increments an undocumented global variable used for testing.
69272 ** then rewinding that index and playing it back from beginning to
69331 ** Advance cursor P1 so that it points to the next key/data pair in its
69348 ** Back up cursor P1 so that it points to the previous key/data pair in its
69542 ** the result is false whereas it would be true with IdxGT.
69606 ** If AUTOVACUUM is enabled then it is possible that another root page
69748 ** then runs the new virtual machine. It is thus a re-entrant opcode.
69974 ** the rowset object for P3, as it is guaranteed not to contain it,
69975 ** (b) when P4==-1 there is no need to insert the value, as it will
69978 ** previously inserted as part of set X (only if it was previously
69993 ** delete it now and initialize P1 with an empty rowset
70054 ** It is recursive invocation of triggers, at the SQL level, that is
70075 ** is already allocated. Otherwise, it must be initialized. */
70241 ** It is illegal to use this instruction on a register that does
70257 ** It is illegal to use this instruction on a register that does
70274 ** It is illegal to use this instruction on a register that does
70359 ** argument is not used by this opcode. It is only there to disambiguate
70529 ** machines to be created and run. It may not be called from within
70565 ** fails with an error code of SQLITE_SCHEMA if it is ever executed
70619 ** within a callback to a virtual table xSync() method. If it is, the error
70933 ** P1 is a boolean flag. If it is set to true and the xUpdate call
71062 ** This opcode records information from the optimizer. It is the
71091 ** of the program. It is only here for testing and debugging.
71092 ** On the other hand, it does burn CPU cycles every time through
71093 ** the evaluator loop. So we can leave it out when NDEBUG is defined.
71112 /* If we reach this point, it means that execution is finished with
71210 ** This function is used by both blob_open() and blob_reopen(). It seeks
71218 ** be set to point to a buffer containing an error message. It is the
71301 ** uses it to implement the blob_read(), blob_write() and
71386 ** column is not indexed, and that it is not part of a foreign key.
71387 ** It is against the rules to open a column to which either of these
71394 /* Check that the column is not part of an FK child key definition. It
71395 ** is not necessary to check if it is part of a parent key, as parent
71464 ** think that the table has one more column than it really
71466 ** always return an SQL NULL. This is useful because it means
71694 ** aTree element is set to the index of it.
71698 ** values), it doesn't matter which index is stored.
71754 ** The following type is an iterator for a PMA. It caches the current key in
71941 ** field. For the purposes of the comparison, ignore it. Also, if bOmitRowid
71942 ** is true and key1 contains even a single NULL value, it is considered to
71945 ** If pKey2 is passed a NULL pointer, then it is assumed that the pCsr->aSpace
72202 /* If the first temporary PMA file has not been opened, open it now. */
72389 /* Open the second temp file, if it is not already open. */
72575 ** If it does not already exists, create and populate the on-disk file
72749 ** file has not yet been created, create it now.
73121 ** callback on p, but do invoke it on each FROM clause subquery
73259 ** allowing it to be repopulated by the memcpy() on the following line.
73271 ** Return FALSE if the USING clause is NULL or if it does not contain
73305 ** value can be NULL if zDb is also NULL. If zTable is NULL it
73399 ** it is a new.* or old.* trigger argument reference
73504 ** Z is a string literal if it doesn't match any column names. In that
73786 ** to the AS-name of one of the terms of the expression list. If it is,
73826 ** as an indication to the caller that it should sort by the i-th column.
74216 ** re-evaluated for each reference to it.
74598 ** If the left hand expression has a collating sequence type, then it is
74604 ** it is not considered.
74655 ** expression depth allowed. If it is not, leave an error message in
74752 ** Construct a new expression node and return a pointer to it. Memory
74757 ** If dequote is true, then the token (if it exists) is dequoted.
74955 ** use it as the variable number */
75010 /* Sanity check: Assert that the IntValue is non-negative if it exists */
75068 ** off if the expression is reduced. Note also that it does not work to
75069 ** make a EXPRDUP_REDUCE copy of a reduced expression. It is only legal
75376 ** NULL is returned. If non-NULL is returned, then it is guaranteed
75503 ** if it is a constant. Set *Walker.u.pi to 0 if the expression is
75561 ** and 0 if it involves variables or function calls.
75574 ** Return 0 if it involves variables or function calls or terms from
75597 ** in *pValue. If the expression is not an integer or if it is too big
75664 ** determine that it can never generate a NULL, then the OP_IsNull operation
75782 ** It's job is to find or create a b-tree structure that may be used
75803 ** to be unique - either because it is an INTEGER PRIMARY KEY or it
75887 ** be used in place of a temp-table, it must be ordered according
75893 ** it is not, it is not possible to use any index.
75996 /* This code must be run in its entirety every time it is encountered
76034 ** expression it is handled the same way. An ephemeral table is
76078 ** store it
76110 /* Evaluate the expression and insert it into the temp table */
76266 /* This branch runs if it is known at compile time that the RHS
76426 #if 0 /* This code wold remove the entry from the cache if it existed */
76439 /* Find an empty slot and replace it */
76502 ** to the state it was in N Pushes ago.
76666 ** register if it is convenient to do so. The calling function
77001 ** see if it is a column in a virtual table. This is done because
77138 /* If the column has REAL affinity, it may currently be stored as an
77139 ** integer. Use OP_RealAffinity to make sure it is really real. */
77161 ** X (if it exists) is in pExpr->pLeft.
77316 ** and modify the expression so that the next time it is evaluated,
77331 ** no way for a TK_REGISTER to exist here. But it seems prudent to
77772 ** Code it as such, taking care to do the common subexpression
78101 ** this routine is used, it does not hurt to get an extra 2 - that
78194 ** This is the xExprCallback for a tree walker. It is used to
78218 /* If we reach this point, it means that pExpr refers to a table
78261 ** because it was there before or because we just created it).
78521 ** parent table. It is passed three arguments:
78527 ** It returns the new CREATE TABLE statement. For example:
78687 ** allocated using sqlite3DbMalloc(). It is the responsibility of the
78688 ** caller to ensure that it is eventually freed.
78867 /* Make sure it is not a system table being altered, or a reserved name
78975 ** it with the new table name.
79170 ** to it. Routines called by the parser as the column definition
79276 ** to help it make better decisions about how to perform queries.
79309 ** by the keyword "unordered". The "unordered" keyword, if it is present,
79340 ** version of SQLite does not support sqlite_stat2. It neither reads nor
79384 ** If the sqlite_stat1 tables does not previously exist, it is created.
79386 ** is compiled with SQLITE_ENABLE_STAT3 defined, it is created.
79389 ** or it may be a NULL pointer. If it is not NULL, then all entries in
79430 /* The sqlite_stat[12] table does not exist. Create it. Note that a
79433 ** because the OpenWrite opcode below will be needing it. */
79918 ** If K>0 then it is always the case the D>0 so division by zero
79999 ** a database. If pOnlyIdx is not NULL then it is a single index
80023 ** when it recognizes an ANALYZE command.
80318 ** read from it.
80323 ** table (if it is present) before returning.
80412 ** it treats the two expressions as literal strings 'abc' and 'def' instead of
80514 ** it to obtain the database schema. At this point the schema may
80590 ** we found it.
80745 ** statement only). For DETACH, set it to false (expire all existing
80960 ** systems that do not need this facility may omit it by recompiling
81006 ** SQLITE_OK is returned, it means that access is allowed. SQLITE_DENY
81072 ** is in pTabList or else it is the NEW or OLD table of a trigger.
81073 ** Check to see if it is OK to read this particular column.
81319 ** Note that if an error occurred, it might be the case that
81595 ** before the database closes. It is also called during a rollback
81697 ** This routine just deletes the data structure. It does not unlink
81698 ** the table data structure from the hash table. But it does destroy
81996 ** it does. The exception is if the statement being parsed was passed
82086 ** The record created does not contain anything yet. It will be replaced
82121 ** It is slightly faster than calling sqlite3StrICmp() directly, but
82124 ** WARNING: This macro is not compatible with the strcmp() family. It
82433 ** collation type was added. Correct this if it is the case.
82452 ** request it. If the collation factory does not supply such a sequence,
82489 ** changes. When a process first reads the schema it records the
82490 ** cookie. Thereafter, whenever it goes to access the database,
82491 ** it checks the cookie to make sure the schema has not changed
82492 ** since it was last read.
82494 ** This plan is not completely bullet-proof. It is possible for
82515 ** The estimate is conservative. It might be larger that what is
82536 ** then it is copied to the output buffer exactly as it is. Otherwise,
82537 ** it is quoted using double-quotes.
82641 ** it means we are reading the sqlite_master table because we just
82644 ** the sqlite_master table. We do not want to create it again.
82646 ** If the pSelect argument is not NULL, it means that this routine
82693 /* If the db->init.busy is 1 it means we are reading the SQL off the
82740 ** Once the SELECT has been coded by sqlite3Select(), it is in a
82745 ** as a schema-lock must have already been obtained to create it. Since
82961 ** a negative nCol, it means two or more views form a loop, like this:
82967 ** But the following test is still important as it does come up
82980 /* If we get this far, it means we need to compute the table names.
83104 ** is non-zero, then it is the root page number of a table moved to
83135 ** is not defined), then it is important to call OP_Destroy on the
83300 ** it is initialized.
83527 ** if memRootPage is not negative, it means that the index is newly
83624 ** since sqlite3ReleaseTempRange() was called, it is safe to do so.
83773 ** If pName==0 it means that we are
83825 /* If pList==0, it means this routine was called to make a primary
83904 ** break backwards compatibility - it needs to be a warning.
84039 ** we don't want to recreate it.
84041 ** If pTblName==0 it means this index is generated as a primary key
84043 ** has just been created, it contains no data and the index initialization
84144 ** of the index. And so forth. It must always be the case that
84250 ** might be the same as the pArray parameter or it might be a different
84341 ** After the call above it would contain: A, B, nil, nil, nil.
84403 ** SrcList might be the same as the SrcList that was input or it might be
84407 ** If pDatabase is not null, it means that the table has an optional
84664 ** This function is called by the parser when it parses a command to create,
84720 ** It is important that all schema cookies be verified and all
84767 ** attached database. Otherwise, invoke it for the database named zDb only.
84790 ** can be checked before any changes are made to the database, it is never
84804 ** If an abort occurs after some of these writes have completed, then it will
84813 ** The code generator calls this routine if is discovers that it is
84823 ** makes it more difficult to prove that the code is correct (in
84824 ** particular, it prevents us from writing an effective
84848 ** true if it does and false if it does not.
85085 ** If it is not NULL, then pColl must point to the database native encoding
85108 ** Call the collation factory to see if it can supply us with one.
85121 ** This routine is called on a collation sequence before it is used to
85122 ** check that it is defined. An undefined collation sequence exists when
85184 /* If a malloc() failure occurred in sqlite3HashInsert(), it will
85185 ** return the pColl pointer to be deleted (because it wasn't added
85373 ** install a new function. Whatever FuncDef structure is returned it will
85394 ** new entry to the hash table and return it.
85415 ** pointer itself, it just cleans up subsidiary resources (i.e. the contents
85490 ** (as in the FROM clause of a SELECT statement) in this case it contains
85519 ** Check to make sure the given table is writable. If it is not
85520 ** writable, generate an error message and return 1. If it is
85526 ** 1) It is a virtual table and no implementation of the xUpdate method
85528 ** 2) It is a system table (i.e. sqlite_master), this call is not
85546 sqlite3ErrorMsg(pParse,"cannot modify %s because it is a view",pTab->zName);
85648 /* duplicate the FROM clause as it is needed by both the DELETE/UPDATE tree
85748 /* If pTab is really a view, make sure it has been initialized.
85818 It is easier just to erase the whole table. Prior to version 3.6.5,
85968 ** (this can happen if a trigger program has already deleted it), do
85969 ** not attempt to delete it or fire any DELETE triggers. */
86002 /* Seek the cursor to the row to be deleted again. It may be that
86075 ** Generate code that will assemble an index key and put it in register
86669 ** in the list by making it the first character after '[' or '^'. A
86672 ** it the last character in the list.
87268 /* IMP: R-25361-16150 This function is omitted from SQLite by default. It
87368 ** that it returns NULL if it sums over no inputs. TOTAL returns
87370 ** SUM might return an integer if it never encounters a floating point
87372 ** it overflows an integer.
87443 ** sure it still operates correctly, verify that its count agrees with our
87480 ** sqlite3_user_data() function returns (void *)-1. For min() it
87606 ** it is appropriate to apply the LIKE optimization to that function
87782 ** or which row it is not satisfied for.
87787 ** Despite these problems, this approach is adopted as it seems simpler
87830 ** constraint counter is greater than zero, it returns SQLITE_CONSTRAINT
87894 ** Otherwise, it is set to point to an allocated array of size N, where
87939 /* If this is a non-composite (single column) foreign key, check if it
88036 ** Each time it is called, this function generates VDBE code to locate the
88097 ** will have INTEGER affinity applied to it, which may not be correct. */
88134 ** of the parent-key values are NULL (at this point it is known that
88367 ** (b) The table is the child table of a deferred FK constraint and it is
88483 ** before actually dropping it in order to check FK constraints.
88485 ** missing, behave as if it is empty. i.e. decrement the relevant
88685 ** passed a pointer to the list of columns being modified. If it is a
88688 ** It returns a pointer to a Trigger structure containing a trigger
88706 ** The returned pointer is cached as part of the foreign key object. It
88756 /* Create the expression "OLD.zToCol = zFromCol". It is important
88857 /* Re-enable the lookaside buffer, if it was disabled earlier. */
89016 ** is managed along with the rest of the Index structure. It will be
89022 ** required, it is allocated and populated here. It is then stored as
89063 ** is required, it is allocated and populated here. It is then
89193 /* This routine is never called during trigger-generation. It is
89482 /* If pTab is really a view, make sure it has been initialized.
89492 * (b) that if it is a view then ON INSERT triggers exist
89523 ** sqlite_sequence table and store it in memory cell regAutoinc.
89550 ** On each invocation of the co-routine, it puts a single row of the
89553 ** the SELECT completes, it sets the EOF flag stored in regEof.
89566 /* Resolve the expressions in the SELECT statement and execute it. */
89598 ** and add it to a transient table srcTab. The code generated
89670 ** the index of the primary key as it appears in IDLIST, not as
89797 /* Cannot have triggers on a virtual table. If it were possible,
90046 ** INSERT statement. If rowidChng is false, it means that the rowid is
90232 ** when it is inserted.
90482 ** is happening when it is suppose to.
90709 /* If we get this far, it means that the xfer optimization is at
90710 ** least a possibility, though it might only work if the destination
91220 ** it can get access to the sqlite3_api_routines structure
91531 ** not NULL before calling it.
92083 ** if the omitFull parameter it 1.
92192 ** If the TEMP database is open, close it and mark the database schema
92257 /* TODO: Maybe it shouldn't be possible to change the ReadUncommitted
92395 ** pragma, make sure it is open.
92416 ** connection. If it returns SQLITE_OK, then assume that the VFS
92726 ** creates the database file. It is important that it is created
92814 ** Note that it is possible for the library compile-time options to
93329 ** database. If the database is not initialized, it is initialized now.
93332 ** has not already been initialized. In this case it sets the default
93343 ** new database files created using this database handle. It is only
93375 ** will be overwritten when the schema is next loaded. If it does not
93376 ** already exists, it will be created to use the new encoding value.
93409 ** The schema-cookie is usually only manipulated internally by SQLite. It
93419 ** The user-version is not used internally by SQLite. It may be used by
93741 /* If the SQL column is blank it means this is an index that
93856 ** on the b-tree database, open one now. If a transaction is opened, it
93892 ** For an attached db, it is an error if the encoding is not the same
94099 ** on the b-tree database, open one now. If a transaction is opened, it
94110 /* Read the schema cookie from the database. If it does not match the
94145 ** statements too, but it never hurts to play the odds).
94187 /* Check to verify that it is possible to get a read lock on all
94200 ** of the sqlite3BtreeEnterAll() in sqlite3LockAndPrepare()) so it
94207 ** but it does *not* override schema lock detection, so this all still
94797 ** defer the handling of t1.x=5, it will be processed immediately
95008 ** (example: "a IN (SELECT * FROM table)") but it has more than 1 result
95122 ** saving that record, use it as a key to delete elements from
95305 ** is a no-op. Otherwise, it adds a single row of output to the EQP result,
95339 ** is a no-op. Otherwise, it adds a single row of output to the EQP result,
95349 ** false, or the second form if it is true.
95544 ** possible. However, it can still be true for statements like
95552 ** though it should really be "INTEGER".
95570 ** test case misc2.2.2) - it always evaluates to NULL.
95802 ** append a integer to the name so that it becomes unique.
96247 ** it is that we currently need.
96280 /* INTERSECT is different from the others since it requires
96281 ** two temporary tables. Hence it has its own case. Begin
96360 ** SELECT might also skip this part if it has no ORDER BY clause and
96425 ** If regPrev>0 then it is the first register in a vector that
96993 /* Reassembly the compound query so that it will be freed correctly
97022 ** changes to pExpr so that it refers directly to the source table
97098 ** This routine returns 1 if it makes changes and 0 if no flattening occurs.
97170 ** (17) The sub-query is not a compound select, or it is a UNION ALL
97192 ** (20) If the sub-query is a compound select, then it must not use
97309 /* Restriction 17: If the sub-query is a compound SELECT, then it must
97351 ** 17 and 18 above) it must be a UNION ALL and the parent query must
97477 ** then expand the outer query to make space for it to hold all elements
97586 ** Analyze the SELECT statement passed as an argument to see if it
97588 ** it is, or 0 otherwise. At present, a query is considered to be
97593 ** 2. There is a single expression in the result set, and it is
97785 ** with the TK_ALL operator for each "*" that it found in the column list.
97801 ** If we get here it means the result set contains one or more "*"
97856 ** for virtual tables), do not include it in the expanded
97935 ** For additional information on what it means to "expand" a SELECT
98238 ** results each time it is invoked. The entry point
98295 ** DISTINCT so it can be removed too. */
98653 ** implement it. Allocate that sorting index now. If it turns out
98654 ** that we do not need it after all, the OP_SorterOpen instruction
98683 ** it might be a single loop that uses an index to extract information
98783 ** over to a0,a1,a2. It then calls the output subroutine
98864 ** This statement is so common that it is optimized specially. The
98866 ** contains the data for table <tbl> or on one of its indexes. It
98881 ** there is such an index, and it has less columns than the table
98882 ** does, then we can assume that it consumes less space on disk and
98890 ** In practice the KeyInfo structure will not be used. It is only
98919 ** If it is, then ask the code in where.c to attempt to sort results
98936 ** satisfying the 'ORDER BY' clause than it does in other cases.
99231 ** the calling procedure is finished using it.
99357 ** To state it another way: This routine returns a list of all triggers
99387 ** This is called by the parser when it sees a CREATE TRIGGER statement
99547 ** INSTEAD OF trigger into a BEFORE trigger. It simplifies code
99662 ** The parser calls this routine when it finds a SELECT statement in
99705 ** The parser calls this routine when it sees an INSERT inside the
99738 ** a pointer to that trigger step. The parser calls this routine when it
99763 ** a pointer to that trigger step. The parser calls this routine when it
99800 ** same job as this routine except it takes a pointer to the trigger
99937 ** then return TRUE. If pIdList==NULL, then it is considered a
99939 ** it matches anything so always return true. Return false only
99990 ** trigger is in TEMP in which case it can refer to any other database it
100033 ** to fire had an explicit ON CONFLICT, then use it. Otherwise, use
100093 ** program. It is not used in production code, only for debugging.
100191 /* If one was specified, code the WHEN clause. If it evaluates to false
100252 /* It may be that this trigger has already been coded (or is in the
100368 ** or else it must be a TEMP trigger. */
100397 ** It is not possible to determine if the old.rowid or new.rowid column is
100398 ** accessed by triggers. The caller must always assume that it is.
100400 ** Parameter isNew must be either 1 or 0. If it is 0, then the mask returned
100487 ** complicated default expression value was provided, it is evaluated
100907 /* If it did not delete it, the row-trigger may still have modified
101037 ** it out of the ephemeral table before calling VUpdate.
101190 ** collapse free space, etc. It is modelled after the VACUUM command
101232 /* Save the current value of the database flags so that it can be
101247 ** can be set to 'off' for this file, as it is not recovered if a crash
101256 ** empty. Only the journal header is written. Apparently it takes more
101257 ** time to parse and run the PRAGMA to turn journalling off than it does
101276 ** to read the schema was concluded. Unlock it here so that this doesn't
101441 ** was committed at the btree level). So it safe to end the transaction
101483 ** this struct allocated on the stack. It is used by the implementation of
101562 ** Lock the virtual table so that it cannot be disconnected.
101622 ** this makes it safe to access the sqlite3.pDisconnect list of any
101658 ** 2) By function vtabDisconnectAll(), when it adds a VTable entry to
101665 ** by multiple threads. It is thread-safe.
101689 ** Since it is a virtual-table, the Table structure contains a pointer
101736 ** The parser calls this routine when it first sees a CREATE VIRTUAL TABLE
101782 it to the list of arguments on the
101877 ** The parser calls this routine when it sees the first token
102098 ** invoke it now. If the module has not been registered, return an
102109 ** create a valid sqlite3_vtab if it returns SQLITE_OK. */
102121 ** This function is used to set the schema of a virtual table. It is only
102299 ** virtual module xSync() callback. It is illegal to write to
102338 ** If op is SAVEPOINT_BEGIN, the xSavepoint method is invoked. If it is
102456 ** array so that an OP_VBegin will get generated for it. Add pTab to the
102457 ** array if it is missing. If pTab is already in the array, this routine
102483 ** The results of this routine are undefined unless it is called from
102576 ** help it analyze the subexpressions of the WHERE clause. Each WHERE
102717 ** If WhereMaskSet.ix[A]==B it means that The A-th bit of a Bitmask
102726 ** 57->5, 73->4. Or one of 719 other combinations might be used. It
102867 ** the db->mallocFailed flag so that higher-level functions can detect it.
103063 ** side of the comparison, it remains associated with the same side after
103150 ** it to be useful for optimising expression pX. Store this
103190 ** can be optimized using inequality constraints. Return TRUE if it is
103289 ** If it is then return TRUE. If not, return FALSE.
103367 ** A subterm is "indexable" if it is of the form
103370 ** A subterm is also indexable if it is an AND of two or more
103386 ** It might be the case that multiple tables are indexable. For example,
103470 /* Skip this term for now. We revisit it when we process the
103508 ** the all terms are of the form "table1.column=table2.column". It
103640 ** If the expression is of the form "<expr> <op> X" it gets commuted
103647 it's pExpr
103648 ** needs to be freed with the WhereClause) and TERM_VIRTUAL (because it
103820 ** wildcard. But if we increment '@', that will push it into the
103995 ** DISTINCT qualifier. In other words, it tests whether or not using this
104021 ** WHERE clause contains a "col=X" clause. If it does, the expression
104022 ** can be ignored. If it does not, and the column does not belong to the
104070 ** this query, then it will not be possible to show that the DISTINCT
104085 /* Loop through all indices on the table, checking each to see if it makes
104086 ** the DISTINCT qualifier redundant. It does so if:
104116 ** clause. If it can, it returns 1. If pIdx cannot satisfy the
104130 ** set to 1 if the ORDER BY clause is all DESC and it is set to 0 if
104266 ** complexity. Because N is just a guess, it is no great tragedy if
104428 ** Return TRUE if the WHERE clause term pTerm is of a form where it
104450 ** and indexing is allows (if there is no NOT INDEXED clause) and it
104487 /* The source is a correlated sub-query. No point in indexing it. */
104674 ** Allocate and populate an sqlite3_index_info structure. It is the
104789 ** Whether or not an error is returned, it is the responsibility of the
104840 ** everybody has finished with it.
104869 ** allocated and initialized, then allocate and initialize it now.
104882 ** details of pIdxInfo for the current invocation and pass it to
104907 ** on the current table. That way we only have to compute it once
104947 ** does not satisfy it, increase the cost of the scan accordingly. This
104956 ** inital value of lowestCost in this loop. If it is, then the
105146 ** aff applied to it, before returning. It is the responsibility of the
105147 ** caller to eventually release this structure by passing it to
105151 ** is an SQL variable that currently has a non-NULL value bound to it,
105153 ** affinity aff applied to it, instead.
105296 ** This routine can fail if it is unable to load a collating sequence
105345 ** This routine can fail if it is unable to load a collating sequence
105535 ** For other indexes, it is true unless all the columns of the table
105648 ** index for this query). If it is, set the WHERE_IDX_ONLY flag in
105679 ** data is available for column x, then it might be possible
105723 ** it seems to be working well enough at the moment.
105775 ** It is critical that the notValid mask be used here instead of
105916 ** if it controls a LEFT OUTER JOIN and it did not originate in the ON
105925 ** The t2.z='ok' is disabled in the in (2) because it originates
105926 ** in the ON clause. The term is disabled in (3) because it is not part
106074 ** The only thing it does is allocate the pLevel->iMem memory cell and
106209 ** It is the responsibility of the caller to free the buffer when it is
106473 ** seek opcodes. It depends on a particular ordering of TK_xx
106534 ** left-most columns of the index. It may also contain
106737 ** If it is, jump to the next iteration of the loop.
106791 ** into the RowSet. If it is already present, control skips the
106860 ** over the top of the loop into the body of it. In this case the
107088 ** the WHERE clause, it might result in additional nested loops for
107109 ** make it to the "..." in the middle of the loop. After each "foreach",
107189 ** field (type Bitmask) it must be aligned on an 8-byte boundary on
107235 ** When assigning bitmask values to FROM clause cursors, it must be
107246 ** the OR-to-IN transformation in exprAnalyzeOrTerm(). It is not helpful
107285 ** If it is, then set pDistinct to NULL and WhereInfo.eDistinct to
107343 ** not be as small as it would be if the table really were the innermost
107361 ** The best strategy is to iterate through table t1 first. However it
107407 ** index if it uses any index at all */
107484 ** INDEXED BY clause attached to it, that the named index is being
107496 ** if it find an index at all. */
107601 ** and the index used to access it (if any). If the table itself
107717 ** Set it.
108026 ** code the yytestcase() macro should be turned off. But it is useful
108061 ** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table
108560 ** but it does not parse, the type of the token is changed to ID and
108645 ** It is sometimes called the "minor" token.
109179 ** being destroyed before it is finished parsing.
109265 ** is popped from the stack, then call it.
109331 ** independent of the look-ahead. If it is, return the action, otherwise
109396 ** independent of the look-ahead. If it is, return the action, otherwise
109854 ** in some cases when it is copied into the stack after the following
109865 ** that it has not been previously stressed... (SQLite ticket #2172)
111179 ** it is legal to shift the error symbol, then shift
111317 ** it is a keyword. If it is a keyword, the token code of that keyword is
111605 ** IdChar(X) will be true. Otherwise it is false.
112080 ** separating it out, the code will be automatically omitted from
112081 ** static links that do not use it.
112126 ** returns 1 if it ends in the START state and 0 if it ends
112383 ** FTS3 library. All it does is declare the sqlite3Fts3Init() interface.
112415 ** RTREE library. All it does is declare the sqlite3RtreeInit() interface.
112447 ** ICU extension. All it does is declare the sqlite3IcuInit() interface.
112536 ** incomplete, it is required that:
112610 ** sqlite3_os_init() when it invokes sqlite3_vfs_register(), but other
112655 ** been compiled correctly. It is important to run this code, but
112656 ** we don't want to run it too often and soak up CPU cycles for no
112657 ** reason. So we run it once during initialization.
112690 ** routine is not threadsafe. But it is safe to invoke this routine
112733 /* sqlite3_config() shall return SQLITE_MISUSE if it is invoked while
112910 ** If pStart is not NULL then it is sz*cnt bytes of memory to use for
113128 ** database handle object, it does not close any savepoints that may be open
113144 ** if this is not the last copy of the function, do not invoke it. Multiple
113271 ** So it needs to be freed here. Todo: Why not roll the temp schema into
113425 ** If this routine returns non-zero, the lock is retried. If it
113508 ** that it is designed to be called by internal code. The difference is
113944 ** checkpointed. If an error is encountered it is returned immediately -
114242 ** It merely prevents new constructs that exceed the limit
114297 ** point to a buffer containing the name of the file to open. It is the
114303 ** message. It is the responsibility of the caller to eventually release
114537 ** do not block illegal combinations here, it could trigger
114674 ** database it is 'NONE'. This matches the pager layer defaults.
114933 ** This function is now an anachronism. It used to be used to recover from a
114943 ** mode. Return TRUE if it is and FALSE if not. Autocommit mode is on
114993 ** no-op. It is retained for historical compatibility.
115243 ** as it existing before this routine was called.
115291 ** hard-coded to true or else it asserts if its argument is false.
115418 ** parameter if it exists. If the parameter does not exist, this routine
115585 ** Add connection db to the blocked connections list. It is assumed
115586 ** that it is not already a part of the list.
115622 ** (call it pOther) in the same process was busy using the same shared
115685 ** to the user because it requires a lock that will not be available
115774 ** it means that instead of one callback with a large array of
115778 ** connections. But it is the best that can be done under the
115929 ** 234 at I is the next docid. It has one position 72 (72-2) and then
115975 ** making it efficient to directly access large doclists. The
115979 ** TODO(shess) It may be useful for blocking decisions to be more
115980 ** dynamic. For instance, it may make more sense to have a 2.5k leaf
116037 ** node requires more than ROOT_MAX bytes, it is flushed to %_segments
116039 ** within ROOT_MAX because it only needs space for 2 varints, the
116097 ** TODO(shess) That said, it would be nice to have a better query-side
116098 ** argument for MERGE_COUNT of 16. Also, it is possible/likely that
116111 ** will eventually overtake the earlier data and knock it out. The
116139 ** FTS4 is really an extension for FTS3. It is enabled using the
116189 ** When an fts3 table is created, it passes any arguments passed to
116197 ** method is called. It returns an sqlite3_tokenizer_cursor object
116276 ** implementation. It is only required to be valid until the next call
116333 ** used in SQLite. We've modified it slightly to serve as a standalone
116367 ** Again, this structure is intended to be opaque, but it can't really
116368 ** be opaque because it is used by macros.
116477 ** It is possible to determine which index a b+-tree belongs to based on the
116483 ** It is considered impossible for an index to use more than 1024 levels. In
116492 ** make it a no-op.
116644 ** When the core wants to read from the virtual table, it creates a
116751 ** matchinfo data. If it is not NULL, it points to an array of size nCol*3,
116759 ** The aMI array is allocated using sqlite3_malloc(). It should be freed
116987 ** 32-bit integer before it is returned.
117170 ** If *pRc is non-zero when this function is called, it is a no-op.
117280 ** If *pRc is non-zero when this function is called, it is a no-op.
117372 ** The pointer returned points to memory obtained from sqlite3_malloc(). It
117410 ** The pointer returned points to a buffer allocated by sqlite3_malloc(). It
117411 ** is the responsibility of the caller to eventually free it.
117413 ** If *pRc is not SQLITE_OK when this function is called, it is a no-op (and
117467 ** The pointer returned points to a buffer allocated by sqlite3_malloc(). It
117468 ** is the responsibility of the caller to eventually free it.
117470 ** If *pRc is not SQLITE_OK when this function is called, it is a no-op (and
117499 ** value. It reads the integer and sets *pnOut to the value read, then
117537 ** Regardless of whether or not an error is returned, it is the responsibility
117538 ** of the caller to call sqlite3_free() on the output array to free it.
117580 ** content=xxx option. It determines the number of and names of the columns
117595 ** and its contents are allocated using a single allocation. It
117747 /* Check if it is an FTS4 special argument. */
117960 ** database. TODO: For xConnect(), it could verify that said tables exist.
118060 ** it would lead to an "unable to use function MATCH in the requested
118115 ** allocation succeeds, zero it and return SQLITE_OK. Otherwise,
118150 ** it. If an error occurs, return an SQLite error code.
118169 ** Position the pCsr->pStmt statement so that it is on the row
118331 ** It is possible that the range of returned leaf nodes does not contain
118332 ** the specified term or any terms for which it is a prefix. However, if the
118335 ** never loads leaf nodes into memory), it is not possible to be sure.
118399 ** start of a position-list. After it returns, *ppPoslist points to the
118404 ** routine advances *ppPoslist so that it points to the next docid in
118417 ** a byte with the 0x80 bit set, then it is not a varint 0, but the tail
118422 ** pEnd once more so that it points to the byte immediately following the
118443 ** start of a column-list. After it returns, *ppPoslist points to the
118481 ** it is not possible to have a document with 2^31 terms.
118488 ** being parsed, or it may point to 1 byte past the end of the position-list
118521 ** returning (do not modify it if iCol==0). Return the total number of bytes
118610 ** This function is used to merge two position lists into one. When it is
118628 ** slots before it.
118712 ** iCol1 and iCol2) so that it points to either the 0x00 that marks the
118811 ** If it is true, the value read is subtracted from *pVal before this
118872 ** bDescDoclist is 0 when this macro is invoked, then it returns (i1-i2).
118875 ** Using this makes it easier to write code that can merge doclists that are
118884 ** should be false. If they are sorted in ascending order, it should be
118922 ** same number of bytes as it is in whichever of the input lists it is
118924 ** consumes either the same or less bytes as it did in the input (since
118925 ** the difference between it and the previous value in the output must
118933 ** be larger in the output than it was in the input (since the delta value
118978 ** exactly nDist tokens before it.
118982 ** order, it should be passed a non-zero value.
119039 ** a token in position 0 (of any column). If so, it writes argument iDelta
119092 ** If an OOM error occurs, return SQLITE_NOMEM. In this case it is
119142 ** a queried prefix. It merges all these doclists into one, the doclist
119252 ** fts4aux are not completely populated. So it's easiest to filter these
119363 ** It is the responsibility of the caller to free this object by eventually
119364 ** passing it to fts3SegReaderCursorFree()
119487 ** If the isPoslist argument is true, then it is assumed that the doclist
119488 ** contains a position-list following each docid. Otherwise, it is assumed
119572 /* In case the cursor has been used before, clear it now. */
119647 ** routine to find out if it has reached the end of a result set.
119723 ** FTS3 virtual tables. It is invoked by SQLite each time a row is to be
119791 ** moves *ppPoslist so that it instead points to the first byte of the
120005 /* As it happens, the pending terms table is always empty here. This is
120115 ** FTS3 enabled database connection is closed). It frees the memory
120236 ** segment b-tree (if the term is not a prefix or it is a prefix for which
120237 ** there exists prefix b-tree of the right length) then it may be traversed
120238 ** and merged incrementally. Otherwise, it has to be merged into an in-memory
120275 ** It is merged into the main doclist stored in p->doclist.aAll/nAll.
120369 ** any deferred tokens have been loaded into memory. It updates the phrases
120474 ** function has been called successfully on an Fts3Phrase, it may be
120513 ** through doclists. It is used by this module to iterate through phrase
120649 ** If *pRc is not SQLITE_OK when this function is called, it is a no-op.
120654 ** If parameter bOptOk is zero, then it is guaranteed that the
120711 ** If *pRc is not SQLITE_OK when this function is called, it is a no-op.
120766 ** this database, then the average docsize is 1. Otherwise, it is 1 plus
120773 ** data from the %_stat table to calculate it.
120847 ** option. The reason being that it is not guaranteed that the content
120881 ** After each token doclist is loaded, merge it with the others from the
120885 ** Let nOther be the number of other phrases for which it is certain that
120888 ** Then, for each token, defer it if loading the doclist would result in
120918 ** for-loop. Except, limit the value to 2^24 to prevent it from
120919 ** overflowing the 32-bit integer it is stored in. */
120923 /* Either this is the cheapest token in the entire query, or it is
120925 ** (eventually) be loaded into memory. It may as well be now. */
120948 ** This function is called from within the xFilter method. It initializes
121072 ** This function is a no-op if *pRc is other than SQLITE_OK when it is called.
121073 ** Otherwise, it advances the expression passed as the second argument to
121076 ** or descending if it is non-zero.
121091 ** It says above that this function advances the expression to the next
121095 ** entirely of deferred tokens, it is assumed to match every row in
121106 ** 2. NEAR is treated as AND. If the expression is "x NEAR y", it is
121130 /* LHS is entirely deferred. So we assume it matches every row.
121136 /* RHS is entirely deferred. So we assume it matches every row.
121226 ** Otherwise, it checks if the current row really does match the NEAR
121233 ** constraints. In this case it returns 1. If the NEAR expression does not
121258 ** no exceptions to this - it's the way the parser in fts3_expr.c works.
121310 ** Assuming no error occurs or has occurred, It returns non-zero if the
121312 ** currently points to, or zero if it does not.
121314 ** If *pRc is not SQLITE_OK when this function is called, it is a no-op.
121414 ** If *pRc is not SQLITE_OK when this function is called, it immediately
121415 ** returns 0. Otherwise, it tests whether or not after considering NEAR
121417 ** expression. It returns 1 if both of the following are true:
121422 ** it is determined that the row does *not* match the query.
121424 ** Or, if no error occurs and it seems the current row does match the FTS
121433 ** memory and scan it to determine the position list for each deferred
121484 ** If *pRc is other than SQLITE_OK when this function is called, it is
121561 ** If it is not already allocated and populated, this function allocates and
121563 ** of a NEAR expression, then it also allocates and populates the same array
121635 ** order. For this reason, even though it seems more defensive, the
122164 /* In case this cursor is being reused, close and zero it. */
122310 ** is defined, then it uses the new syntax. The differences between
122318 ** supported by the new syntax (it is replaced by the NOT operator).
122326 ** to zero causes the module to use the old syntax. If it is set to
122332 ** generator. This module does not use actually lemon, it uses a
122373 ** called, it sets ParseContext.isNot to true if the 'next node' is a
122374 ** FTSQUERY_PHRASE with a unary "-" attached to it. i.e. "mysql" in the
122394 ** The standard isspace() can be awkward to use safely, because although it
122408 ** zero the memory before returning a pointer to it. If unsuccessful,
122449 ** single token and set *ppExpr to point to it. If the end of the buffer is
122450 ** reached before a token is found, set *ppExpr to zero. It is the
122452 ** Fts3Expr structure (if any) by passing it to sqlite3_free().
122801 ** TODO: Strangely, it is not possible to associate a column specifier
122804 ** first implemented. Whichever it was, this module duplicates the
123152 ** sqlite3_malloc(). It is the responsibility of the caller to use
123201 ** expression parser. It should be called as follows:
123315 ** We've modified it slightly to serve as a standalone hash table
123357 ** false if it should just use the supplied pointer.
123490 /* Resize the hash table so that it cantains "new_size" buckets.
123600 ** that matches pKey,nKey. Return the data for this element if it is
123826 ** 'Y' is a consonant unless it follows another consonant,
123827 ** in which case it is a vowel.
123830 ** is that 'y' is a consonant unless it is followed by another
123974 ** than 20 bytes if it contains no digits or more than 6 bytes if
123975 ** it contains digits) then word is truncated to 20 or 6 bytes
124232 /* z[] is now the stemmed word in reverse order. Flip it back
124374 ** If the <pointer> argument is specified, it must be a blob value
124706 ** This function is used for testing only, it is not included in the
124712 ** in the README.tokenizer file as an example, so it is important to
125073 ** tables. It also contains code to merge FTS3 b-tree segments. Some
125087 ** of it. i.e. if a full-text index node is 900 bytes in size, then a buffer
125088 ** of 920 bytes is allocated for it.
125091 ** it is always safe to read up to two varints from it without risking an
125300 ** If argument apVal is not NULL, then it must point to an array with
125470 ** not what users expect when they get SQLITE_LOCKED_SHAREDCACHE. It can
125639 ** it is set to SQLITE_OK.
125798 /* Add the term to each of the prefix indexes that it is not too
125863 ** operation. It adds entries for each term in the new record to the
125945 ** In FTS3, this is an error. It is an error to specify non-NULL values
126122 ** paBlob is non-NULL, then it is the responsibility of the caller to
126186 ** Close the blob handle at p->pSegments, if it is open. See comments above
126421 ** following block advances it to point one byte past the end of
126594 ** non-zero, it iterates through each term and its prefixes. For example, if
126661 ** below, the "Fts3HashElem *pE" must be declared so that it is valid
126727 ** version, it is assumed that each SegReader points to an entry in
126789 ** Argument apSegment is an array of nSegment elements. It is known that
126893 ** Add term zTerm to the SegmentNode. It is guaranteed that zTerm is larger
126967 /* If control flows to here, it was not possible to append zTerm to the
126969 ** If this is the first node in the tree, the term is added to it.
126971 ** Otherwise, the term is not added to the new node, it is left empty for
127025 ** Except, if pTree is a root node, do not write it to the database. Instead,
127098 ** and return it via the input/output variable *ppWriter in this case.
127157 /* The current leaf node is full. Write it out to the database. */
127170 ** In other words, it must be the prefix of zTerm 1 byte longer than
127190 ** the buffer to make it large enough.
127209 /* Save the current term so that it can be used to prefix-compress the next.
127264 /* The entire tree fits on the root node. Write it to the segdir table. */
127352 ** it:
127560 ** for, then advance each segment iterator until it points to a term of
127608 /* Advance each segment iterator until it points to the term zTerm/nTerm. */
128156 ** the current contents of the xxx table. Otherwise, it is rebuilt based
128296 ** included, except that it only contains entries for a single row of the
128404 ** present in the FTS3 table. If it is, delete it and adjust the contents
128532 ** invoked, it will delete zero rows (since no row will have
128736 ** After it returns, *piPos contains the value of the next element of the
128814 ** pnToken is not NULL, then it is set to the number of tokens in all
128845 ** arguments so that it points to the first element with a value greater
129034 /* Now that it is known how many phrases there are, allocate and zero
129102 ** to grow the buffer until so that it is big enough to accomadate the
129205 ** append it to string buffer pOut.
129502 ** 1 if the iterator is at EOF or if it now points to the start of the
129607 ** If it is false, then assume that those fields that do not change between
130148 ** table that maps from the entries rowid to the id of the node that it
130166 ** of a record. For internal nodes it is the node number of a
130411 ** a single instance of the following structure is allocated. It is used
130521 ** to it. Otherwise, return 0.
130555 ** indicating that node has not yet been assigned a node number. It is
130588 ** increase its reference count and return it.
130721 ** If the node is dirty, write it out to the database.
130774 ** node pNode. If pNode is a leaf node, this is a rowid. If it is
131203 ** already at EOF. It is against the rules to call the xNext() method of
131594 ** Return the amount cell p would grow by if it were unioned with pCell.
131714 ** is inserted into it. Resolve ties by choosing the entry with
132300 /* Allocate an array and populate it with a copy of pCell and
132343 ** nodeWrite(). Node pRight always needs a node number, as it was created
132439 ** want to do this as it leads to a memory leak when trying to delete
132495 /* Remove the node from the in-memory hash table and link it into
132543 ** the in-memory node image, so it cannot fail.
132548 ** number of cells, remove it from the tree. Otherwise, update the
132549 ** cell in the parent node so that it tightly contains the updated
132787 ** it, schedule the contents of the child for reinsertion and
132883 /* If a rowid value was supplied, check if it is already present in
132907 /* If azData[0] is not an SQL NULL value, it is the rowid of a
133381 ** the context object when it is no longer required. */
133690 ** pointer. This is not really necessary, but it is tidier than
133802 ** types to an SQLite database connection. It is intended to be called