Fossil SCM
Merge the latest SQLite enhancements from upstream, for testing.
Commit
bcbf150dc26ed3a67252e069eeaa7e42802a93e1f6cfc08d8b43d6547ad96005
Parent
cdaec3a43126625…
2 files changed
+220
-75
+43
-43
+220
-75
| --- extsrc/sqlite3.c | ||
| +++ extsrc/sqlite3.c | ||
| @@ -16,11 +16,11 @@ | ||
| 16 | 16 | ** if you want a wrapper to interface SQLite with your choice of programming |
| 17 | 17 | ** language. The code for the "sqlite3" command-line shell is also in a |
| 18 | 18 | ** separate file. This file contains only code for the core SQLite library. |
| 19 | 19 | ** |
| 20 | 20 | ** The content in this amalgamation comes from Fossil check-in |
| 21 | -** 5508b56fd24016c13981ec280ecdd833007c with changes in files: | |
| 21 | +** 0083d5169a46104a25355bdd9d5a2f4027b0 with changes in files: | |
| 22 | 22 | ** |
| 23 | 23 | ** |
| 24 | 24 | */ |
| 25 | 25 | #ifndef SQLITE_AMALGAMATION |
| 26 | 26 | #define SQLITE_CORE 1 |
| @@ -465,11 +465,11 @@ | ||
| 465 | 465 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 466 | 466 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 467 | 467 | */ |
| 468 | 468 | #define SQLITE_VERSION "3.51.0" |
| 469 | 469 | #define SQLITE_VERSION_NUMBER 3051000 |
| 470 | -#define SQLITE_SOURCE_ID "2025-06-27 19:02:21 5508b56fd24016c13981ec280ecdd833007c9d8dd595edb295b984c2b487b5c8" | |
| 470 | +#define SQLITE_SOURCE_ID "2025-06-30 16:41:40 0083d5169a46104a25355bdd9d5a2f4027b049191ebda571dd228477ec217296" | |
| 471 | 471 | |
| 472 | 472 | /* |
| 473 | 473 | ** CAPI3REF: Run-Time Library Version Numbers |
| 474 | 474 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 475 | 475 | ** |
| @@ -9375,48 +9375,48 @@ | ||
| 9375 | 9375 | ** careful use of indices.</dd> |
| 9376 | 9376 | ** |
| 9377 | 9377 | ** [[SQLITE_STMTSTATUS_SORT]] <dt>SQLITE_STMTSTATUS_SORT</dt> |
| 9378 | 9378 | ** <dd>^This is the number of sort operations that have occurred. |
| 9379 | 9379 | ** A non-zero value in this counter may indicate an opportunity to |
| 9380 | -** improvement performance through careful use of indices.</dd> | |
| 9380 | +** improve performance through careful use of indices.</dd> | |
| 9381 | 9381 | ** |
| 9382 | 9382 | ** [[SQLITE_STMTSTATUS_AUTOINDEX]] <dt>SQLITE_STMTSTATUS_AUTOINDEX</dt> |
| 9383 | 9383 | ** <dd>^This is the number of rows inserted into transient indices that |
| 9384 | 9384 | ** were created automatically in order to help joins run faster. |
| 9385 | 9385 | ** A non-zero value in this counter may indicate an opportunity to |
| 9386 | -** improvement performance by adding permanent indices that do not | |
| 9386 | +** improve performance by adding permanent indices that do not | |
| 9387 | 9387 | ** need to be reinitialized each time the statement is run.</dd> |
| 9388 | 9388 | ** |
| 9389 | 9389 | ** [[SQLITE_STMTSTATUS_VM_STEP]] <dt>SQLITE_STMTSTATUS_VM_STEP</dt> |
| 9390 | 9390 | ** <dd>^This is the number of virtual machine operations executed |
| 9391 | 9391 | ** by the prepared statement if that number is less than or equal |
| 9392 | 9392 | ** to 2147483647. The number of virtual machine operations can be |
| 9393 | 9393 | ** used as a proxy for the total work done by the prepared statement. |
| 9394 | 9394 | ** If the number of virtual machine operations exceeds 2147483647 |
| 9395 | -** then the value returned by this statement status code is undefined. | |
| 9395 | +** then the value returned by this statement status code is undefined.</dd> | |
| 9396 | 9396 | ** |
| 9397 | 9397 | ** [[SQLITE_STMTSTATUS_REPREPARE]] <dt>SQLITE_STMTSTATUS_REPREPARE</dt> |
| 9398 | 9398 | ** <dd>^This is the number of times that the prepare statement has been |
| 9399 | 9399 | ** automatically regenerated due to schema changes or changes to |
| 9400 | -** [bound parameters] that might affect the query plan. | |
| 9400 | +** [bound parameters] that might affect the query plan.</dd> | |
| 9401 | 9401 | ** |
| 9402 | 9402 | ** [[SQLITE_STMTSTATUS_RUN]] <dt>SQLITE_STMTSTATUS_RUN</dt> |
| 9403 | 9403 | ** <dd>^This is the number of times that the prepared statement has |
| 9404 | 9404 | ** been run. A single "run" for the purposes of this counter is one |
| 9405 | 9405 | ** or more calls to [sqlite3_step()] followed by a call to [sqlite3_reset()]. |
| 9406 | 9406 | ** The counter is incremented on the first [sqlite3_step()] call of each |
| 9407 | -** cycle. | |
| 9407 | +** cycle.</dd> | |
| 9408 | 9408 | ** |
| 9409 | 9409 | ** [[SQLITE_STMTSTATUS_FILTER_MISS]] |
| 9410 | 9410 | ** [[SQLITE_STMTSTATUS_FILTER HIT]] |
| 9411 | 9411 | ** <dt>SQLITE_STMTSTATUS_FILTER_HIT<br> |
| 9412 | 9412 | ** SQLITE_STMTSTATUS_FILTER_MISS</dt> |
| 9413 | 9413 | ** <dd>^SQLITE_STMTSTATUS_FILTER_HIT is the number of times that a join |
| 9414 | 9414 | ** step was bypassed because a Bloom filter returned not-found. The |
| 9415 | 9415 | ** corresponding SQLITE_STMTSTATUS_FILTER_MISS value is the number of |
| 9416 | 9416 | ** times that the Bloom filter returned a find, and thus the join step |
| 9417 | -** had to be processed as normal. | |
| 9417 | +** had to be processed as normal.</dd> | |
| 9418 | 9418 | ** |
| 9419 | 9419 | ** [[SQLITE_STMTSTATUS_MEMUSED]] <dt>SQLITE_STMTSTATUS_MEMUSED</dt> |
| 9420 | 9420 | ** <dd>^This is the approximate number of bytes of heap memory |
| 9421 | 9421 | ** used to store the prepared statement. ^This value is not actually |
| 9422 | 9422 | ** a counter, and so the resetFlg parameter to sqlite3_stmt_status() |
| @@ -9517,31 +9517,31 @@ | ||
| 9517 | 9517 | ** [[the xCreate() page cache methods]] |
| 9518 | 9518 | ** ^SQLite invokes the xCreate() method to construct a new cache instance. |
| 9519 | 9519 | ** SQLite will typically create one cache instance for each open database file, |
| 9520 | 9520 | ** though this is not guaranteed. ^The |
| 9521 | 9521 | ** first parameter, szPage, is the size in bytes of the pages that must |
| 9522 | -** be allocated by the cache. ^szPage will always a power of two. ^The | |
| 9522 | +** be allocated by the cache. ^szPage will always be a power of two. ^The | |
| 9523 | 9523 | ** second parameter szExtra is a number of bytes of extra storage |
| 9524 | -** associated with each page cache entry. ^The szExtra parameter will | |
| 9524 | +** associated with each page cache entry. ^The szExtra parameter will be | |
| 9525 | 9525 | ** a number less than 250. SQLite will use the |
| 9526 | 9526 | ** extra szExtra bytes on each page to store metadata about the underlying |
| 9527 | 9527 | ** database page on disk. The value passed into szExtra depends |
| 9528 | 9528 | ** on the SQLite version, the target platform, and how SQLite was compiled. |
| 9529 | 9529 | ** ^The third argument to xCreate(), bPurgeable, is true if the cache being |
| 9530 | 9530 | ** created will be used to cache database pages of a file stored on disk, or |
| 9531 | 9531 | ** false if it is used for an in-memory database. The cache implementation |
| 9532 | -** does not have to do anything special based with the value of bPurgeable; | |
| 9532 | +** does not have to do anything special based upon the value of bPurgeable; | |
| 9533 | 9533 | ** it is purely advisory. ^On a cache where bPurgeable is false, SQLite will |
| 9534 | 9534 | ** never invoke xUnpin() except to deliberately delete a page. |
| 9535 | 9535 | ** ^In other words, calls to xUnpin() on a cache with bPurgeable set to |
| 9536 | 9536 | ** false will always have the "discard" flag set to true. |
| 9537 | -** ^Hence, a cache created with bPurgeable false will | |
| 9537 | +** ^Hence, a cache created with bPurgeable set to false will | |
| 9538 | 9538 | ** never contain any unpinned pages. |
| 9539 | 9539 | ** |
| 9540 | 9540 | ** [[the xCachesize() page cache method]] |
| 9541 | 9541 | ** ^(The xCachesize() method may be called at any time by SQLite to set the |
| 9542 | -** suggested maximum cache-size (number of pages stored by) the cache | |
| 9542 | +** suggested maximum cache-size (number of pages stored) for the cache | |
| 9543 | 9543 | ** instance passed as the first argument. This is the value configured using |
| 9544 | 9544 | ** the SQLite "[PRAGMA cache_size]" command.)^ As with the bPurgeable |
| 9545 | 9545 | ** parameter, the implementation is not required to do anything with this |
| 9546 | 9546 | ** value; it is advisory only. |
| 9547 | 9547 | ** |
| @@ -9564,16 +9564,16 @@ | ||
| 9564 | 9564 | ** |
| 9565 | 9565 | ** If the requested page is already in the page cache, then the page cache |
| 9566 | 9566 | ** implementation must return a pointer to the page buffer with its content |
| 9567 | 9567 | ** intact. If the requested page is not already in the cache, then the |
| 9568 | 9568 | ** cache implementation should use the value of the createFlag |
| 9569 | -** parameter to help it determined what action to take: | |
| 9569 | +** parameter to help it determine what action to take: | |
| 9570 | 9570 | ** |
| 9571 | 9571 | ** <table border=1 width=85% align=center> |
| 9572 | 9572 | ** <tr><th> createFlag <th> Behavior when page is not already in cache |
| 9573 | 9573 | ** <tr><td> 0 <td> Do not allocate a new page. Return NULL. |
| 9574 | -** <tr><td> 1 <td> Allocate a new page if it easy and convenient to do so. | |
| 9574 | +** <tr><td> 1 <td> Allocate a new page if it is easy and convenient to do so. | |
| 9575 | 9575 | ** Otherwise return NULL. |
| 9576 | 9576 | ** <tr><td> 2 <td> Make every effort to allocate a new page. Only return |
| 9577 | 9577 | ** NULL if allocating a new page is effectively impossible. |
| 9578 | 9578 | ** </table> |
| 9579 | 9579 | ** |
| @@ -9586,11 +9586,11 @@ | ||
| 9586 | 9586 | ** [[the xUnpin() page cache method]] |
| 9587 | 9587 | ** ^xUnpin() is called by SQLite with a pointer to a currently pinned page |
| 9588 | 9588 | ** as its second argument. If the third parameter, discard, is non-zero, |
| 9589 | 9589 | ** then the page must be evicted from the cache. |
| 9590 | 9590 | ** ^If the discard parameter is |
| 9591 | -** zero, then the page may be discarded or retained at the discretion of | |
| 9591 | +** zero, then the page may be discarded or retained at the discretion of the | |
| 9592 | 9592 | ** page cache implementation. ^The page cache implementation |
| 9593 | 9593 | ** may choose to evict unpinned pages at any time. |
| 9594 | 9594 | ** |
| 9595 | 9595 | ** The cache must not perform any reference counting. A single |
| 9596 | 9596 | ** call to xUnpin() unpins the page regardless of the number of prior calls |
| @@ -9604,11 +9604,11 @@ | ||
| 9604 | 9604 | ** to be pinned. |
| 9605 | 9605 | ** |
| 9606 | 9606 | ** When SQLite calls the xTruncate() method, the cache must discard all |
| 9607 | 9607 | ** existing cache entries with page numbers (keys) greater than or equal |
| 9608 | 9608 | ** to the value of the iLimit parameter passed to xTruncate(). If any |
| 9609 | -** of these pages are pinned, they are implicitly unpinned, meaning that | |
| 9609 | +** of these pages are pinned, they become implicitly unpinned, meaning that | |
| 9610 | 9610 | ** they can be safely discarded. |
| 9611 | 9611 | ** |
| 9612 | 9612 | ** [[the xDestroy() page cache method]] |
| 9613 | 9613 | ** ^The xDestroy() method is used to delete a cache allocated by xCreate(). |
| 9614 | 9614 | ** All resources associated with the specified cache should be freed. ^After |
| @@ -9903,11 +9903,11 @@ | ||
| 9903 | 9903 | ** identity of the database connection (the blocking connection) that |
| 9904 | 9904 | ** has locked the required resource is stored internally. ^After an |
| 9905 | 9905 | ** application receives an SQLITE_LOCKED error, it may call the |
| 9906 | 9906 | ** sqlite3_unlock_notify() method with the blocked connection handle as |
| 9907 | 9907 | ** the first argument to register for a callback that will be invoked |
| 9908 | -** when the blocking connections current transaction is concluded. ^The | |
| 9908 | +** when the blocking connection's current transaction is concluded. ^The | |
| 9909 | 9909 | ** callback is invoked from within the [sqlite3_step] or [sqlite3_close] |
| 9910 | 9910 | ** call that concludes the blocking connection's transaction. |
| 9911 | 9911 | ** |
| 9912 | 9912 | ** ^(If sqlite3_unlock_notify() is called in a multi-threaded application, |
| 9913 | 9913 | ** there is a chance that the blocking connection will have already |
| @@ -9923,11 +9923,11 @@ | ||
| 9923 | 9923 | ** ^(There may be at most one unlock-notify callback registered by a |
| 9924 | 9924 | ** blocked connection. If sqlite3_unlock_notify() is called when the |
| 9925 | 9925 | ** blocked connection already has a registered unlock-notify callback, |
| 9926 | 9926 | ** then the new callback replaces the old.)^ ^If sqlite3_unlock_notify() is |
| 9927 | 9927 | ** called with a NULL pointer as its second argument, then any existing |
| 9928 | -** unlock-notify callback is canceled. ^The blocked connections | |
| 9928 | +** unlock-notify callback is canceled. ^The blocked connection's | |
| 9929 | 9929 | ** unlock-notify callback may also be canceled by closing the blocked |
| 9930 | 9930 | ** connection using [sqlite3_close()]. |
| 9931 | 9931 | ** |
| 9932 | 9932 | ** The unlock-notify callback is not reentrant. If an application invokes |
| 9933 | 9933 | ** any sqlite3_xxx API functions from within an unlock-notify callback, a |
| @@ -10321,11 +10321,11 @@ | ||
| 10321 | 10321 | ** where X is an integer. If X is zero, then the [virtual table] whose |
| 10322 | 10322 | ** [xCreate] or [xConnect] method invoked [sqlite3_vtab_config()] does not |
| 10323 | 10323 | ** support constraints. In this configuration (which is the default) if |
| 10324 | 10324 | ** a call to the [xUpdate] method returns [SQLITE_CONSTRAINT], then the entire |
| 10325 | 10325 | ** statement is rolled back as if [ON CONFLICT | OR ABORT] had been |
| 10326 | -** specified as part of the users SQL statement, regardless of the actual | |
| 10326 | +** specified as part of the user's SQL statement, regardless of the actual | |
| 10327 | 10327 | ** ON CONFLICT mode specified. |
| 10328 | 10328 | ** |
| 10329 | 10329 | ** If X is non-zero, then the virtual table implementation guarantees |
| 10330 | 10330 | ** that if [xUpdate] returns [SQLITE_CONSTRAINT], it will do so before |
| 10331 | 10331 | ** any modifications to internal or persistent data structures have been made. |
| @@ -10355,11 +10355,11 @@ | ||
| 10355 | 10355 | ** </dd> |
| 10356 | 10356 | ** |
| 10357 | 10357 | ** [[SQLITE_VTAB_INNOCUOUS]]<dt>SQLITE_VTAB_INNOCUOUS</dt> |
| 10358 | 10358 | ** <dd>Calls of the form |
| 10359 | 10359 | ** [sqlite3_vtab_config](db,SQLITE_VTAB_INNOCUOUS) from within the |
| 10360 | -** the [xConnect] or [xCreate] methods of a [virtual table] implementation | |
| 10360 | +** [xConnect] or [xCreate] methods of a [virtual table] implementation | |
| 10361 | 10361 | ** identify that virtual table as being safe to use from within triggers |
| 10362 | 10362 | ** and views. Conceptually, the SQLITE_VTAB_INNOCUOUS tag means that the |
| 10363 | 10363 | ** virtual table can do no serious harm even if it is controlled by a |
| 10364 | 10364 | ** malicious hacker. Developers should avoid setting the SQLITE_VTAB_INNOCUOUS |
| 10365 | 10365 | ** flag unless absolutely necessary. |
| @@ -10523,21 +10523,21 @@ | ||
| 10523 | 10523 | ** <tr><td>2<td>no<td>yes<td>yes |
| 10524 | 10524 | ** <tr><td>3<td>yes<td>yes<td>yes |
| 10525 | 10525 | ** </table> |
| 10526 | 10526 | ** |
| 10527 | 10527 | ** ^For the purposes of comparing virtual table output values to see if the |
| 10528 | -** values are same value for sorting purposes, two NULL values are considered | |
| 10528 | +** values are the same value for sorting purposes, two NULL values are considered | |
| 10529 | 10529 | ** to be the same. In other words, the comparison operator is "IS" |
| 10530 | 10530 | ** (or "IS NOT DISTINCT FROM") and not "==". |
| 10531 | 10531 | ** |
| 10532 | 10532 | ** If a virtual table implementation is unable to meet the requirements |
| 10533 | 10533 | ** specified above, then it must not set the "orderByConsumed" flag in the |
| 10534 | 10534 | ** [sqlite3_index_info] object or an incorrect answer may result. |
| 10535 | 10535 | ** |
| 10536 | 10536 | ** ^A virtual table implementation is always free to return rows in any order |
| 10537 | 10537 | ** it wants, as long as the "orderByConsumed" flag is not set. ^When the |
| 10538 | -** the "orderByConsumed" flag is unset, the query planner will add extra | |
| 10538 | +** "orderByConsumed" flag is unset, the query planner will add extra | |
| 10539 | 10539 | ** [bytecode] to ensure that the final results returned by the SQL query are |
| 10540 | 10540 | ** ordered correctly. The use of the "orderByConsumed" flag and the |
| 10541 | 10541 | ** sqlite3_vtab_distinct() interface is merely an optimization. ^Careful |
| 10542 | 10542 | ** use of the sqlite3_vtab_distinct() interface and the "orderByConsumed" |
| 10543 | 10543 | ** flag might help queries against a virtual table to run faster. Being |
| @@ -10630,11 +10630,11 @@ | ||
| 10630 | 10630 | ** |
| 10631 | 10631 | ** The X parameter in a call to sqlite3_vtab_in_first(X,P) or |
| 10632 | 10632 | ** sqlite3_vtab_in_next(X,P) should be one of the parameters to the |
| 10633 | 10633 | ** xFilter method which invokes these routines, and specifically |
| 10634 | 10634 | ** a parameter that was previously selected for all-at-once IN constraint |
| 10635 | -** processing use the [sqlite3_vtab_in()] interface in the | |
| 10635 | +** processing using the [sqlite3_vtab_in()] interface in the | |
| 10636 | 10636 | ** [xBestIndex|xBestIndex method]. ^(If the X parameter is not |
| 10637 | 10637 | ** an xFilter argument that was selected for all-at-once IN constraint |
| 10638 | 10638 | ** processing, then these routines return [SQLITE_ERROR].)^ |
| 10639 | 10639 | ** |
| 10640 | 10640 | ** ^(Use these routines to access all values on the right-hand side |
| @@ -10685,11 +10685,11 @@ | ||
| 10685 | 10685 | ** right-hand operand is not known, then *V is set to a NULL pointer. |
| 10686 | 10686 | ** ^The sqlite3_vtab_rhs_value(P,J,V) interface returns SQLITE_OK if |
| 10687 | 10687 | ** and only if *V is set to a value. ^The sqlite3_vtab_rhs_value(P,J,V) |
| 10688 | 10688 | ** inteface returns SQLITE_NOTFOUND if the right-hand side of the J-th |
| 10689 | 10689 | ** constraint is not available. ^The sqlite3_vtab_rhs_value() interface |
| 10690 | -** can return an result code other than SQLITE_OK or SQLITE_NOTFOUND if | |
| 10690 | +** can return a result code other than SQLITE_OK or SQLITE_NOTFOUND if | |
| 10691 | 10691 | ** something goes wrong. |
| 10692 | 10692 | ** |
| 10693 | 10693 | ** The sqlite3_vtab_rhs_value() interface is usually only successful if |
| 10694 | 10694 | ** the right-hand operand of a constraint is a literal value in the original |
| 10695 | 10695 | ** SQL statement. If the right-hand operand is an expression or a reference |
| @@ -10713,12 +10713,12 @@ | ||
| 10713 | 10713 | /* |
| 10714 | 10714 | ** CAPI3REF: Conflict resolution modes |
| 10715 | 10715 | ** KEYWORDS: {conflict resolution mode} |
| 10716 | 10716 | ** |
| 10717 | 10717 | ** These constants are returned by [sqlite3_vtab_on_conflict()] to |
| 10718 | -** inform a [virtual table] implementation what the [ON CONFLICT] mode | |
| 10719 | -** is for the SQL statement being evaluated. | |
| 10718 | +** inform a [virtual table] implementation of the [ON CONFLICT] mode | |
| 10719 | +** for the SQL statement being evaluated. | |
| 10720 | 10720 | ** |
| 10721 | 10721 | ** Note that the [SQLITE_IGNORE] constant is also used as a potential |
| 10722 | 10722 | ** return value from the [sqlite3_set_authorizer()] callback and that |
| 10723 | 10723 | ** [SQLITE_ABORT] is also a [result code]. |
| 10724 | 10724 | */ |
| @@ -10754,43 +10754,43 @@ | ||
| 10754 | 10754 | ** to the total number of rows examined by all iterations of the X-th loop.</dd> |
| 10755 | 10755 | ** |
| 10756 | 10756 | ** [[SQLITE_SCANSTAT_EST]] <dt>SQLITE_SCANSTAT_EST</dt> |
| 10757 | 10757 | ** <dd>^The "double" variable pointed to by the V parameter will be set to the |
| 10758 | 10758 | ** query planner's estimate for the average number of rows output from each |
| 10759 | -** iteration of the X-th loop. If the query planner's estimates was accurate, | |
| 10759 | +** iteration of the X-th loop. If the query planner's estimate was accurate, | |
| 10760 | 10760 | ** then this value will approximate the quotient NVISIT/NLOOP and the |
| 10761 | 10761 | ** product of this value for all prior loops with the same SELECTID will |
| 10762 | -** be the NLOOP value for the current loop. | |
| 10762 | +** be the NLOOP value for the current loop.</dd> | |
| 10763 | 10763 | ** |
| 10764 | 10764 | ** [[SQLITE_SCANSTAT_NAME]] <dt>SQLITE_SCANSTAT_NAME</dt> |
| 10765 | 10765 | ** <dd>^The "const char *" variable pointed to by the V parameter will be set |
| 10766 | 10766 | ** to a zero-terminated UTF-8 string containing the name of the index or table |
| 10767 | -** used for the X-th loop. | |
| 10767 | +** used for the X-th loop.</dd> | |
| 10768 | 10768 | ** |
| 10769 | 10769 | ** [[SQLITE_SCANSTAT_EXPLAIN]] <dt>SQLITE_SCANSTAT_EXPLAIN</dt> |
| 10770 | 10770 | ** <dd>^The "const char *" variable pointed to by the V parameter will be set |
| 10771 | 10771 | ** to a zero-terminated UTF-8 string containing the [EXPLAIN QUERY PLAN] |
| 10772 | -** description for the X-th loop. | |
| 10772 | +** description for the X-th loop.</dd> | |
| 10773 | 10773 | ** |
| 10774 | 10774 | ** [[SQLITE_SCANSTAT_SELECTID]] <dt>SQLITE_SCANSTAT_SELECTID</dt> |
| 10775 | 10775 | ** <dd>^The "int" variable pointed to by the V parameter will be set to the |
| 10776 | 10776 | ** id for the X-th query plan element. The id value is unique within the |
| 10777 | 10777 | ** statement. The select-id is the same value as is output in the first |
| 10778 | -** column of an [EXPLAIN QUERY PLAN] query. | |
| 10778 | +** column of an [EXPLAIN QUERY PLAN] query.</dd> | |
| 10779 | 10779 | ** |
| 10780 | 10780 | ** [[SQLITE_SCANSTAT_PARENTID]] <dt>SQLITE_SCANSTAT_PARENTID</dt> |
| 10781 | 10781 | ** <dd>The "int" variable pointed to by the V parameter will be set to the |
| 10782 | -** the id of the parent of the current query element, if applicable, or | |
| 10782 | +** id of the parent of the current query element, if applicable, or | |
| 10783 | 10783 | ** to zero if the query element has no parent. This is the same value as |
| 10784 | -** returned in the second column of an [EXPLAIN QUERY PLAN] query. | |
| 10784 | +** returned in the second column of an [EXPLAIN QUERY PLAN] query.</dd> | |
| 10785 | 10785 | ** |
| 10786 | 10786 | ** [[SQLITE_SCANSTAT_NCYCLE]] <dt>SQLITE_SCANSTAT_NCYCLE</dt> |
| 10787 | 10787 | ** <dd>The sqlite3_int64 output value is set to the number of cycles, |
| 10788 | 10788 | ** according to the processor time-stamp counter, that elapsed while the |
| 10789 | 10789 | ** query element was being processed. This value is not available for |
| 10790 | 10790 | ** all query elements - if it is unavailable the output variable is |
| 10791 | -** set to -1. | |
| 10791 | +** set to -1.</dd> | |
| 10792 | 10792 | ** </dl> |
| 10793 | 10793 | */ |
| 10794 | 10794 | #define SQLITE_SCANSTAT_NLOOP 0 |
| 10795 | 10795 | #define SQLITE_SCANSTAT_NVISIT 1 |
| 10796 | 10796 | #define SQLITE_SCANSTAT_EST 2 |
| @@ -10827,12 +10827,12 @@ | ||
| 10827 | 10827 | ** the EXPLAIN QUERY PLAN output) are available. Invoking API |
| 10828 | 10828 | ** sqlite3_stmt_scanstatus() is equivalent to calling |
| 10829 | 10829 | ** sqlite3_stmt_scanstatus_v2() with a zeroed flags parameter. |
| 10830 | 10830 | ** |
| 10831 | 10831 | ** Parameter "idx" identifies the specific query element to retrieve statistics |
| 10832 | -** for. Query elements are numbered starting from zero. A value of -1 may be | |
| 10833 | -** to query for statistics regarding the entire query. ^If idx is out of range | |
| 10832 | +** for. Query elements are numbered starting from zero. A value of -1 may | |
| 10833 | +** retrieve statistics for the entire query. ^If idx is out of range | |
| 10834 | 10834 | ** - less than -1 or greater than or equal to the total number of query |
| 10835 | 10835 | ** elements used to implement the statement - a non-zero value is returned and |
| 10836 | 10836 | ** the variable that pOut points to is unchanged. |
| 10837 | 10837 | ** |
| 10838 | 10838 | ** See also: [sqlite3_stmt_scanstatus_reset()] |
| @@ -10985,12 +10985,12 @@ | ||
| 10985 | 10985 | ** operation; or 1 for inserts, updates, or deletes invoked by top-level |
| 10986 | 10986 | ** triggers; or 2 for changes resulting from triggers called by top-level |
| 10987 | 10987 | ** triggers; and so forth. |
| 10988 | 10988 | ** |
| 10989 | 10989 | ** When the [sqlite3_blob_write()] API is used to update a blob column, |
| 10990 | -** the pre-update hook is invoked with SQLITE_DELETE. This is because the | |
| 10991 | -** in this case the new values are not available. In this case, when a | |
| 10990 | +** the pre-update hook is invoked with SQLITE_DELETE, because | |
| 10991 | +** the new values are not yet available. In this case, when a | |
| 10992 | 10992 | ** callback made with op==SQLITE_DELETE is actually a write using the |
| 10993 | 10993 | ** sqlite3_blob_write() API, the [sqlite3_preupdate_blobwrite()] returns |
| 10994 | 10994 | ** the index of the column being written. In other cases, where the |
| 10995 | 10995 | ** pre-update hook is being invoked for some other reason, including a |
| 10996 | 10996 | ** regular DELETE, sqlite3_preupdate_blobwrite() returns -1. |
| @@ -11239,20 +11239,20 @@ | ||
| 11239 | 11239 | ** is written into *P. |
| 11240 | 11240 | ** |
| 11241 | 11241 | ** For an ordinary on-disk database file, the serialization is just a |
| 11242 | 11242 | ** copy of the disk file. For an in-memory database or a "TEMP" database, |
| 11243 | 11243 | ** the serialization is the same sequence of bytes which would be written |
| 11244 | -** to disk if that database where backed up to disk. | |
| 11244 | +** to disk if that database were backed up to disk. | |
| 11245 | 11245 | ** |
| 11246 | 11246 | ** The usual case is that sqlite3_serialize() copies the serialization of |
| 11247 | 11247 | ** the database into memory obtained from [sqlite3_malloc64()] and returns |
| 11248 | 11248 | ** a pointer to that memory. The caller is responsible for freeing the |
| 11249 | 11249 | ** returned value to avoid a memory leak. However, if the F argument |
| 11250 | 11250 | ** contains the SQLITE_SERIALIZE_NOCOPY bit, then no memory allocations |
| 11251 | 11251 | ** are made, and the sqlite3_serialize() function will return a pointer |
| 11252 | 11252 | ** to the contiguous memory representation of the database that SQLite |
| 11253 | -** is currently using for that database, or NULL if the no such contiguous | |
| 11253 | +** is currently using for that database, or NULL if no such contiguous | |
| 11254 | 11254 | ** memory representation of the database exists. A contiguous memory |
| 11255 | 11255 | ** representation of the database will usually only exist if there has |
| 11256 | 11256 | ** been a prior call to [sqlite3_deserialize(D,S,...)] with the same |
| 11257 | 11257 | ** values of D and S. |
| 11258 | 11258 | ** The size of the database is written into *P even if the |
| @@ -11319,11 +11319,11 @@ | ||
| 11319 | 11319 | ** |
| 11320 | 11320 | ** The sqlite3_deserialize() interface will fail with SQLITE_BUSY if the |
| 11321 | 11321 | ** database is currently in a read transaction or is involved in a backup |
| 11322 | 11322 | ** operation. |
| 11323 | 11323 | ** |
| 11324 | -** It is not possible to deserialized into the TEMP database. If the | |
| 11324 | +** It is not possible to deserialize into the TEMP database. If the | |
| 11325 | 11325 | ** S argument to sqlite3_deserialize(D,S,P,N,M,F) is "temp" then the |
| 11326 | 11326 | ** function returns SQLITE_ERROR. |
| 11327 | 11327 | ** |
| 11328 | 11328 | ** The deserialized database should not be in [WAL mode]. If the database |
| 11329 | 11329 | ** is in WAL mode, then any attempt to use the database file will result |
| @@ -11341,19 +11341,19 @@ | ||
| 11341 | 11341 | */ |
| 11342 | 11342 | SQLITE_API int sqlite3_deserialize( |
| 11343 | 11343 | sqlite3 *db, /* The database connection */ |
| 11344 | 11344 | const char *zSchema, /* Which DB to reopen with the deserialization */ |
| 11345 | 11345 | unsigned char *pData, /* The serialized database content */ |
| 11346 | - sqlite3_int64 szDb, /* Number bytes in the deserialization */ | |
| 11346 | + sqlite3_int64 szDb, /* Number of bytes in the deserialization */ | |
| 11347 | 11347 | sqlite3_int64 szBuf, /* Total size of buffer pData[] */ |
| 11348 | 11348 | unsigned mFlags /* Zero or more SQLITE_DESERIALIZE_* flags */ |
| 11349 | 11349 | ); |
| 11350 | 11350 | |
| 11351 | 11351 | /* |
| 11352 | 11352 | ** CAPI3REF: Flags for sqlite3_deserialize() |
| 11353 | 11353 | ** |
| 11354 | -** The following are allowed values for 6th argument (the F argument) to | |
| 11354 | +** The following are allowed values for the 6th argument (the F argument) to | |
| 11355 | 11355 | ** the [sqlite3_deserialize(D,S,P,N,M,F)] interface. |
| 11356 | 11356 | ** |
| 11357 | 11357 | ** The SQLITE_DESERIALIZE_FREEONCLOSE means that the database serialization |
| 11358 | 11358 | ** in the P argument is held in memory obtained from [sqlite3_malloc64()] |
| 11359 | 11359 | ** and that SQLite should take ownership of this memory and automatically |
| @@ -112888,10 +112888,85 @@ | ||
| 112888 | 112888 | pExpr = pExpr->op==TK_AND ? pLeft : pRight; |
| 112889 | 112889 | } |
| 112890 | 112890 | } |
| 112891 | 112891 | return pExpr; |
| 112892 | 112892 | } |
| 112893 | + | |
| 112894 | +/* | |
| 112895 | +** Return true if it might be advantageous to compute the right operand | |
| 112896 | +** of expression pExpr first, before the left operand. | |
| 112897 | +** | |
| 112898 | +** Normally the left operand is computed before the right operand. But if | |
| 112899 | +** the left operand contains a subquery and the right does not, then it | |
| 112900 | +** might be more efficient to compute the right operand first. | |
| 112901 | +*/ | |
| 112902 | +static int exprEvalRhsFirst(Expr *pExpr){ | |
| 112903 | + if( ExprHasProperty(pExpr->pLeft, EP_Subquery) | |
| 112904 | + && !ExprHasProperty(pExpr->pRight, EP_Subquery) | |
| 112905 | + ){ | |
| 112906 | + return 1; | |
| 112907 | + }else{ | |
| 112908 | + return 0; | |
| 112909 | + } | |
| 112910 | +} | |
| 112911 | + | |
| 112912 | +/* | |
| 112913 | +** Compute the two operands of a binary operator. | |
| 112914 | +** | |
| 112915 | +** If either operand contains a subquery, then the code strives to | |
| 112916 | +** compute the operand containing the subquery second. If the other | |
| 112917 | +** operand evalutes to NULL, then a jump is made. The address of the | |
| 112918 | +** IsNull operand that does this jump is returned. The caller can use | |
| 112919 | +** this to optimize the computation so as to avoid doing the potentially | |
| 112920 | +** expensive subquery. | |
| 112921 | +** | |
| 112922 | +** If no optimization opportunities exist, return 0. | |
| 112923 | +*/ | |
| 112924 | +static int exprComputeOperands( | |
| 112925 | + Parse *pParse, /* Parsing context */ | |
| 112926 | + Expr *pExpr, /* The comparison expression */ | |
| 112927 | + int *pR1, /* OUT: Register holding the left operand */ | |
| 112928 | + int *pR2, /* OUT: Register holding the right operand */ | |
| 112929 | + int *pFree1, /* OUT: Temp register to free if not zero */ | |
| 112930 | + int *pFree2 /* OUT: Another temp register to free if not zero */ | |
| 112931 | +){ | |
| 112932 | + int addrIsNull; | |
| 112933 | + int r1, r2; | |
| 112934 | + Vdbe *v = pParse->pVdbe; | |
| 112935 | + | |
| 112936 | + assert( v!=0 ); | |
| 112937 | + /* | |
| 112938 | + ** If the left operand contains a (possibly expensive) subquery and the | |
| 112939 | + ** right operand does not and the right operation might be NULL, | |
| 112940 | + ** then compute the right operand first and do an IsNull jump if the | |
| 112941 | + ** right operand evalutes to NULL. | |
| 112942 | + */ | |
| 112943 | + if( exprEvalRhsFirst(pExpr) && sqlite3ExprCanBeNull(pExpr->pRight) ){ | |
| 112944 | + r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, pFree2); | |
| 112945 | + addrIsNull = sqlite3VdbeAddOp1(v, OP_IsNull, r2); VdbeCoverage(v); | |
| 112946 | + }else{ | |
| 112947 | + addrIsNull = 0; | |
| 112948 | + } | |
| 112949 | + r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, pFree1); | |
| 112950 | + if( addrIsNull==0 ){ | |
| 112951 | + /* | |
| 112952 | + ** If the right operand contains a subquery and the left operand does not | |
| 112953 | + ** and the left operand might be NULL, then check the left operand do | |
| 112954 | + ** an IsNull check on the left operand before computing the right | |
| 112955 | + ** operand. | |
| 112956 | + */ | |
| 112957 | + if( ExprHasProperty(pExpr->pRight, EP_Subquery) | |
| 112958 | + && sqlite3ExprCanBeNull(pExpr->pLeft) | |
| 112959 | + ){ | |
| 112960 | + addrIsNull = sqlite3VdbeAddOp1(v, OP_IsNull, r1); VdbeCoverage(v); | |
| 112961 | + } | |
| 112962 | + r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, pFree2); | |
| 112963 | + } | |
| 112964 | + *pR1 = r1; | |
| 112965 | + *pR2 = r2; | |
| 112966 | + return addrIsNull; | |
| 112967 | +} | |
| 112893 | 112968 | |
| 112894 | 112969 | /* |
| 112895 | 112970 | ** pExpr is a TK_FUNCTION node. Try to determine whether or not the |
| 112896 | 112971 | ** function is a constant function. A function is constant if all of |
| 112897 | 112972 | ** the following are true: |
| @@ -115477,15 +115552,21 @@ | ||
| 115477 | 115552 | case TK_GT: |
| 115478 | 115553 | case TK_GE: |
| 115479 | 115554 | case TK_NE: |
| 115480 | 115555 | case TK_EQ: { |
| 115481 | 115556 | Expr *pLeft = pExpr->pLeft; |
| 115557 | + int addrIsNull = 0; | |
| 115482 | 115558 | if( sqlite3ExprIsVector(pLeft) ){ |
| 115483 | 115559 | codeVectorCompare(pParse, pExpr, target, op, p5); |
| 115484 | 115560 | }else{ |
| 115485 | - r1 = sqlite3ExprCodeTemp(pParse, pLeft, ®Free1); | |
| 115486 | - r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, ®Free2); | |
| 115561 | + if( ExprHasProperty(pExpr, EP_Subquery) && p5!=SQLITE_NULLEQ ){ | |
| 115562 | + addrIsNull = exprComputeOperands(pParse, pExpr, | |
| 115563 | + &r1, &r2, ®Free1, ®Free2); | |
| 115564 | + }else{ | |
| 115565 | + r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free1); | |
| 115566 | + r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, ®Free2); | |
| 115567 | + } | |
| 115487 | 115568 | sqlite3VdbeAddOp2(v, OP_Integer, 1, inReg); |
| 115488 | 115569 | codeCompare(pParse, pLeft, pExpr->pRight, op, r1, r2, |
| 115489 | 115570 | sqlite3VdbeCurrentAddr(v)+2, p5, |
| 115490 | 115571 | ExprHasProperty(pExpr,EP_Commuted)); |
| 115491 | 115572 | assert(TK_LT==OP_Lt); testcase(op==OP_Lt); VdbeCoverageIf(v,op==OP_Lt); |
| @@ -115496,13 +115577,19 @@ | ||
| 115496 | 115577 | assert(TK_NE==OP_Ne); testcase(op==OP_Ne); VdbeCoverageIf(v,op==OP_Ne); |
| 115497 | 115578 | if( p5==SQLITE_NULLEQ ){ |
| 115498 | 115579 | sqlite3VdbeAddOp2(v, OP_Integer, 0, inReg); |
| 115499 | 115580 | }else{ |
| 115500 | 115581 | sqlite3VdbeAddOp3(v, OP_ZeroOrNull, r1, inReg, r2); |
| 115582 | + if( addrIsNull ){ | |
| 115583 | + sqlite3VdbeAddOp2(v, OP_Goto, 0, sqlite3VdbeCurrentAddr(v)+2); | |
| 115584 | + sqlite3VdbeJumpHere(v, addrIsNull); | |
| 115585 | + sqlite3VdbeAddOp2(v, OP_Null, 0, inReg); | |
| 115586 | + } | |
| 115501 | 115587 | } |
| 115502 | 115588 | testcase( regFree1==0 ); |
| 115503 | 115589 | testcase( regFree2==0 ); |
| 115590 | + | |
| 115504 | 115591 | } |
| 115505 | 115592 | break; |
| 115506 | 115593 | } |
| 115507 | 115594 | case TK_AND: |
| 115508 | 115595 | case TK_OR: |
| @@ -115514,10 +115601,11 @@ | ||
| 115514 | 115601 | case TK_BITOR: |
| 115515 | 115602 | case TK_SLASH: |
| 115516 | 115603 | case TK_LSHIFT: |
| 115517 | 115604 | case TK_RSHIFT: |
| 115518 | 115605 | case TK_CONCAT: { |
| 115606 | + int addrIsNull; | |
| 115519 | 115607 | assert( TK_AND==OP_And ); testcase( op==TK_AND ); |
| 115520 | 115608 | assert( TK_OR==OP_Or ); testcase( op==TK_OR ); |
| 115521 | 115609 | assert( TK_PLUS==OP_Add ); testcase( op==TK_PLUS ); |
| 115522 | 115610 | assert( TK_MINUS==OP_Subtract ); testcase( op==TK_MINUS ); |
| 115523 | 115611 | assert( TK_REM==OP_Remainder ); testcase( op==TK_REM ); |
| @@ -115525,15 +115613,26 @@ | ||
| 115525 | 115613 | assert( TK_BITOR==OP_BitOr ); testcase( op==TK_BITOR ); |
| 115526 | 115614 | assert( TK_SLASH==OP_Divide ); testcase( op==TK_SLASH ); |
| 115527 | 115615 | assert( TK_LSHIFT==OP_ShiftLeft ); testcase( op==TK_LSHIFT ); |
| 115528 | 115616 | assert( TK_RSHIFT==OP_ShiftRight ); testcase( op==TK_RSHIFT ); |
| 115529 | 115617 | assert( TK_CONCAT==OP_Concat ); testcase( op==TK_CONCAT ); |
| 115530 | - r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free1); | |
| 115531 | - r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, ®Free2); | |
| 115618 | + if( ExprHasProperty(pExpr, EP_Subquery) ){ | |
| 115619 | + addrIsNull = exprComputeOperands(pParse, pExpr, | |
| 115620 | + &r1, &r2, ®Free1, ®Free2); | |
| 115621 | + }else{ | |
| 115622 | + r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free1); | |
| 115623 | + r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, ®Free2); | |
| 115624 | + addrIsNull = 0; | |
| 115625 | + } | |
| 115532 | 115626 | sqlite3VdbeAddOp3(v, op, r2, r1, target); |
| 115533 | 115627 | testcase( regFree1==0 ); |
| 115534 | 115628 | testcase( regFree2==0 ); |
| 115629 | + if( addrIsNull ){ | |
| 115630 | + sqlite3VdbeAddOp2(v, OP_Goto, 0, sqlite3VdbeCurrentAddr(v)+2); | |
| 115631 | + sqlite3VdbeJumpHere(v, addrIsNull); | |
| 115632 | + sqlite3VdbeAddOp2(v, OP_Null, 0, target); | |
| 115633 | + } | |
| 115535 | 115634 | break; |
| 115536 | 115635 | } |
| 115537 | 115636 | case TK_UMINUS: { |
| 115538 | 115637 | Expr *pLeft = pExpr->pLeft; |
| 115539 | 115638 | assert( pLeft ); |
| @@ -116378,21 +116477,31 @@ | ||
| 116378 | 116477 | case TK_AND: |
| 116379 | 116478 | case TK_OR: { |
| 116380 | 116479 | Expr *pAlt = sqlite3ExprSimplifiedAndOr(pExpr); |
| 116381 | 116480 | if( pAlt!=pExpr ){ |
| 116382 | 116481 | sqlite3ExprIfTrue(pParse, pAlt, dest, jumpIfNull); |
| 116383 | - }else if( op==TK_AND ){ | |
| 116384 | - int d2 = sqlite3VdbeMakeLabel(pParse); | |
| 116385 | - testcase( jumpIfNull==0 ); | |
| 116386 | - sqlite3ExprIfFalse(pParse, pExpr->pLeft, d2, | |
| 116387 | - jumpIfNull^SQLITE_JUMPIFNULL); | |
| 116388 | - sqlite3ExprIfTrue(pParse, pExpr->pRight, dest, jumpIfNull); | |
| 116389 | - sqlite3VdbeResolveLabel(v, d2); | |
| 116390 | 116482 | }else{ |
| 116391 | - testcase( jumpIfNull==0 ); | |
| 116392 | - sqlite3ExprIfTrue(pParse, pExpr->pLeft, dest, jumpIfNull); | |
| 116393 | - sqlite3ExprIfTrue(pParse, pExpr->pRight, dest, jumpIfNull); | |
| 116483 | + Expr *pFirst, *pSecond; | |
| 116484 | + if( exprEvalRhsFirst(pExpr) ){ | |
| 116485 | + pFirst = pExpr->pRight; | |
| 116486 | + pSecond = pExpr->pLeft; | |
| 116487 | + }else{ | |
| 116488 | + pFirst = pExpr->pLeft; | |
| 116489 | + pSecond = pExpr->pRight; | |
| 116490 | + } | |
| 116491 | + if( op==TK_AND ){ | |
| 116492 | + int d2 = sqlite3VdbeMakeLabel(pParse); | |
| 116493 | + testcase( jumpIfNull==0 ); | |
| 116494 | + sqlite3ExprIfFalse(pParse, pFirst, d2, | |
| 116495 | + jumpIfNull^SQLITE_JUMPIFNULL); | |
| 116496 | + sqlite3ExprIfTrue(pParse, pSecond, dest, jumpIfNull); | |
| 116497 | + sqlite3VdbeResolveLabel(v, d2); | |
| 116498 | + }else{ | |
| 116499 | + testcase( jumpIfNull==0 ); | |
| 116500 | + sqlite3ExprIfTrue(pParse, pFirst, dest, jumpIfNull); | |
| 116501 | + sqlite3ExprIfTrue(pParse, pSecond, dest, jumpIfNull); | |
| 116502 | + } | |
| 116394 | 116503 | } |
| 116395 | 116504 | break; |
| 116396 | 116505 | } |
| 116397 | 116506 | case TK_NOT: { |
| 116398 | 116507 | testcase( jumpIfNull==0 ); |
| @@ -116427,14 +116536,20 @@ | ||
| 116427 | 116536 | case TK_LE: |
| 116428 | 116537 | case TK_GT: |
| 116429 | 116538 | case TK_GE: |
| 116430 | 116539 | case TK_NE: |
| 116431 | 116540 | case TK_EQ: { |
| 116541 | + int addrIsNull; | |
| 116432 | 116542 | if( sqlite3ExprIsVector(pExpr->pLeft) ) goto default_expr; |
| 116433 | - testcase( jumpIfNull==0 ); | |
| 116434 | - r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free1); | |
| 116435 | - r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, ®Free2); | |
| 116543 | + if( ExprHasProperty(pExpr, EP_Subquery) && jumpIfNull!=SQLITE_NULLEQ ){ | |
| 116544 | + addrIsNull = exprComputeOperands(pParse, pExpr, | |
| 116545 | + &r1, &r2, ®Free1, ®Free2); | |
| 116546 | + }else{ | |
| 116547 | + r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free1); | |
| 116548 | + r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, ®Free2); | |
| 116549 | + addrIsNull = 0; | |
| 116550 | + } | |
| 116436 | 116551 | codeCompare(pParse, pExpr->pLeft, pExpr->pRight, op, |
| 116437 | 116552 | r1, r2, dest, jumpIfNull, ExprHasProperty(pExpr,EP_Commuted)); |
| 116438 | 116553 | assert(TK_LT==OP_Lt); testcase(op==OP_Lt); VdbeCoverageIf(v,op==OP_Lt); |
| 116439 | 116554 | assert(TK_LE==OP_Le); testcase(op==OP_Le); VdbeCoverageIf(v,op==OP_Le); |
| 116440 | 116555 | assert(TK_GT==OP_Gt); testcase(op==OP_Gt); VdbeCoverageIf(v,op==OP_Gt); |
| @@ -116445,10 +116560,17 @@ | ||
| 116445 | 116560 | assert(TK_NE==OP_Ne); testcase(op==OP_Ne); |
| 116446 | 116561 | VdbeCoverageIf(v, op==OP_Ne && jumpIfNull==SQLITE_NULLEQ); |
| 116447 | 116562 | VdbeCoverageIf(v, op==OP_Ne && jumpIfNull!=SQLITE_NULLEQ); |
| 116448 | 116563 | testcase( regFree1==0 ); |
| 116449 | 116564 | testcase( regFree2==0 ); |
| 116565 | + if( addrIsNull ){ | |
| 116566 | + if( jumpIfNull ){ | |
| 116567 | + sqlite3VdbeChangeP2(v, addrIsNull, dest); | |
| 116568 | + }else{ | |
| 116569 | + sqlite3VdbeJumpHere(v, addrIsNull); | |
| 116570 | + } | |
| 116571 | + } | |
| 116450 | 116572 | break; |
| 116451 | 116573 | } |
| 116452 | 116574 | case TK_ISNULL: |
| 116453 | 116575 | case TK_NOTNULL: { |
| 116454 | 116576 | assert( TK_ISNULL==OP_IsNull ); testcase( op==TK_ISNULL ); |
| @@ -116552,21 +116674,31 @@ | ||
| 116552 | 116674 | case TK_AND: |
| 116553 | 116675 | case TK_OR: { |
| 116554 | 116676 | Expr *pAlt = sqlite3ExprSimplifiedAndOr(pExpr); |
| 116555 | 116677 | if( pAlt!=pExpr ){ |
| 116556 | 116678 | sqlite3ExprIfFalse(pParse, pAlt, dest, jumpIfNull); |
| 116557 | - }else if( pExpr->op==TK_AND ){ | |
| 116558 | - testcase( jumpIfNull==0 ); | |
| 116559 | - sqlite3ExprIfFalse(pParse, pExpr->pLeft, dest, jumpIfNull); | |
| 116560 | - sqlite3ExprIfFalse(pParse, pExpr->pRight, dest, jumpIfNull); | |
| 116561 | 116679 | }else{ |
| 116562 | - int d2 = sqlite3VdbeMakeLabel(pParse); | |
| 116563 | - testcase( jumpIfNull==0 ); | |
| 116564 | - sqlite3ExprIfTrue(pParse, pExpr->pLeft, d2, | |
| 116565 | - jumpIfNull^SQLITE_JUMPIFNULL); | |
| 116566 | - sqlite3ExprIfFalse(pParse, pExpr->pRight, dest, jumpIfNull); | |
| 116567 | - sqlite3VdbeResolveLabel(v, d2); | |
| 116680 | + Expr *pFirst, *pSecond; | |
| 116681 | + if( exprEvalRhsFirst(pExpr) ){ | |
| 116682 | + pFirst = pExpr->pRight; | |
| 116683 | + pSecond = pExpr->pLeft; | |
| 116684 | + }else{ | |
| 116685 | + pFirst = pExpr->pLeft; | |
| 116686 | + pSecond = pExpr->pRight; | |
| 116687 | + } | |
| 116688 | + if( pExpr->op==TK_AND ){ | |
| 116689 | + testcase( jumpIfNull==0 ); | |
| 116690 | + sqlite3ExprIfFalse(pParse, pFirst, dest, jumpIfNull); | |
| 116691 | + sqlite3ExprIfFalse(pParse, pSecond, dest, jumpIfNull); | |
| 116692 | + }else{ | |
| 116693 | + int d2 = sqlite3VdbeMakeLabel(pParse); | |
| 116694 | + testcase( jumpIfNull==0 ); | |
| 116695 | + sqlite3ExprIfTrue(pParse, pFirst, d2, | |
| 116696 | + jumpIfNull^SQLITE_JUMPIFNULL); | |
| 116697 | + sqlite3ExprIfFalse(pParse, pSecond, dest, jumpIfNull); | |
| 116698 | + sqlite3VdbeResolveLabel(v, d2); | |
| 116699 | + } | |
| 116568 | 116700 | } |
| 116569 | 116701 | break; |
| 116570 | 116702 | } |
| 116571 | 116703 | case TK_NOT: { |
| 116572 | 116704 | testcase( jumpIfNull==0 ); |
| @@ -116604,14 +116736,20 @@ | ||
| 116604 | 116736 | case TK_LE: |
| 116605 | 116737 | case TK_GT: |
| 116606 | 116738 | case TK_GE: |
| 116607 | 116739 | case TK_NE: |
| 116608 | 116740 | case TK_EQ: { |
| 116741 | + int addrIsNull; | |
| 116609 | 116742 | if( sqlite3ExprIsVector(pExpr->pLeft) ) goto default_expr; |
| 116610 | - testcase( jumpIfNull==0 ); | |
| 116611 | - r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free1); | |
| 116612 | - r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, ®Free2); | |
| 116743 | + if( ExprHasProperty(pExpr, EP_Subquery) && jumpIfNull!=SQLITE_NULLEQ ){ | |
| 116744 | + addrIsNull = exprComputeOperands(pParse, pExpr, | |
| 116745 | + &r1, &r2, ®Free1, ®Free2); | |
| 116746 | + }else{ | |
| 116747 | + r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free1); | |
| 116748 | + r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, ®Free2); | |
| 116749 | + addrIsNull = 0; | |
| 116750 | + } | |
| 116613 | 116751 | codeCompare(pParse, pExpr->pLeft, pExpr->pRight, op, |
| 116614 | 116752 | r1, r2, dest, jumpIfNull,ExprHasProperty(pExpr,EP_Commuted)); |
| 116615 | 116753 | assert(TK_LT==OP_Lt); testcase(op==OP_Lt); VdbeCoverageIf(v,op==OP_Lt); |
| 116616 | 116754 | assert(TK_LE==OP_Le); testcase(op==OP_Le); VdbeCoverageIf(v,op==OP_Le); |
| 116617 | 116755 | assert(TK_GT==OP_Gt); testcase(op==OP_Gt); VdbeCoverageIf(v,op==OP_Gt); |
| @@ -116622,10 +116760,17 @@ | ||
| 116622 | 116760 | assert(TK_NE==OP_Ne); testcase(op==OP_Ne); |
| 116623 | 116761 | VdbeCoverageIf(v, op==OP_Ne && jumpIfNull!=SQLITE_NULLEQ); |
| 116624 | 116762 | VdbeCoverageIf(v, op==OP_Ne && jumpIfNull==SQLITE_NULLEQ); |
| 116625 | 116763 | testcase( regFree1==0 ); |
| 116626 | 116764 | testcase( regFree2==0 ); |
| 116765 | + if( addrIsNull ){ | |
| 116766 | + if( jumpIfNull ){ | |
| 116767 | + sqlite3VdbeChangeP2(v, addrIsNull, dest); | |
| 116768 | + }else{ | |
| 116769 | + sqlite3VdbeJumpHere(v, addrIsNull); | |
| 116770 | + } | |
| 116771 | + } | |
| 116627 | 116772 | break; |
| 116628 | 116773 | } |
| 116629 | 116774 | case TK_ISNULL: |
| 116630 | 116775 | case TK_NOTNULL: { |
| 116631 | 116776 | r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free1); |
| @@ -257503,11 +257648,11 @@ | ||
| 257503 | 257648 | int nArg, /* Number of args */ |
| 257504 | 257649 | sqlite3_value **apUnused /* Function arguments */ |
| 257505 | 257650 | ){ |
| 257506 | 257651 | assert( nArg==0 ); |
| 257507 | 257652 | UNUSED_PARAM2(nArg, apUnused); |
| 257508 | - sqlite3_result_text(pCtx, "fts5: 2025-06-27 19:02:21 5508b56fd24016c13981ec280ecdd833007c9d8dd595edb295b984c2b487b5c8", -1, SQLITE_TRANSIENT); | |
| 257653 | + sqlite3_result_text(pCtx, "fts5: 2025-06-30 16:41:40 0083d5169a46104a25355bdd9d5a2f4027b049191ebda571dd228477ec217296", -1, SQLITE_TRANSIENT); | |
| 257509 | 257654 | } |
| 257510 | 257655 | |
| 257511 | 257656 | /* |
| 257512 | 257657 | ** Implementation of fts5_locale(LOCALE, TEXT) function. |
| 257513 | 257658 | ** |
| 257514 | 257659 |
| --- extsrc/sqlite3.c | |
| +++ extsrc/sqlite3.c | |
| @@ -16,11 +16,11 @@ | |
| 16 | ** if you want a wrapper to interface SQLite with your choice of programming |
| 17 | ** language. The code for the "sqlite3" command-line shell is also in a |
| 18 | ** separate file. This file contains only code for the core SQLite library. |
| 19 | ** |
| 20 | ** The content in this amalgamation comes from Fossil check-in |
| 21 | ** 5508b56fd24016c13981ec280ecdd833007c with changes in files: |
| 22 | ** |
| 23 | ** |
| 24 | */ |
| 25 | #ifndef SQLITE_AMALGAMATION |
| 26 | #define SQLITE_CORE 1 |
| @@ -465,11 +465,11 @@ | |
| 465 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 466 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 467 | */ |
| 468 | #define SQLITE_VERSION "3.51.0" |
| 469 | #define SQLITE_VERSION_NUMBER 3051000 |
| 470 | #define SQLITE_SOURCE_ID "2025-06-27 19:02:21 5508b56fd24016c13981ec280ecdd833007c9d8dd595edb295b984c2b487b5c8" |
| 471 | |
| 472 | /* |
| 473 | ** CAPI3REF: Run-Time Library Version Numbers |
| 474 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 475 | ** |
| @@ -9375,48 +9375,48 @@ | |
| 9375 | ** careful use of indices.</dd> |
| 9376 | ** |
| 9377 | ** [[SQLITE_STMTSTATUS_SORT]] <dt>SQLITE_STMTSTATUS_SORT</dt> |
| 9378 | ** <dd>^This is the number of sort operations that have occurred. |
| 9379 | ** A non-zero value in this counter may indicate an opportunity to |
| 9380 | ** improvement performance through careful use of indices.</dd> |
| 9381 | ** |
| 9382 | ** [[SQLITE_STMTSTATUS_AUTOINDEX]] <dt>SQLITE_STMTSTATUS_AUTOINDEX</dt> |
| 9383 | ** <dd>^This is the number of rows inserted into transient indices that |
| 9384 | ** were created automatically in order to help joins run faster. |
| 9385 | ** A non-zero value in this counter may indicate an opportunity to |
| 9386 | ** improvement performance by adding permanent indices that do not |
| 9387 | ** need to be reinitialized each time the statement is run.</dd> |
| 9388 | ** |
| 9389 | ** [[SQLITE_STMTSTATUS_VM_STEP]] <dt>SQLITE_STMTSTATUS_VM_STEP</dt> |
| 9390 | ** <dd>^This is the number of virtual machine operations executed |
| 9391 | ** by the prepared statement if that number is less than or equal |
| 9392 | ** to 2147483647. The number of virtual machine operations can be |
| 9393 | ** used as a proxy for the total work done by the prepared statement. |
| 9394 | ** If the number of virtual machine operations exceeds 2147483647 |
| 9395 | ** then the value returned by this statement status code is undefined. |
| 9396 | ** |
| 9397 | ** [[SQLITE_STMTSTATUS_REPREPARE]] <dt>SQLITE_STMTSTATUS_REPREPARE</dt> |
| 9398 | ** <dd>^This is the number of times that the prepare statement has been |
| 9399 | ** automatically regenerated due to schema changes or changes to |
| 9400 | ** [bound parameters] that might affect the query plan. |
| 9401 | ** |
| 9402 | ** [[SQLITE_STMTSTATUS_RUN]] <dt>SQLITE_STMTSTATUS_RUN</dt> |
| 9403 | ** <dd>^This is the number of times that the prepared statement has |
| 9404 | ** been run. A single "run" for the purposes of this counter is one |
| 9405 | ** or more calls to [sqlite3_step()] followed by a call to [sqlite3_reset()]. |
| 9406 | ** The counter is incremented on the first [sqlite3_step()] call of each |
| 9407 | ** cycle. |
| 9408 | ** |
| 9409 | ** [[SQLITE_STMTSTATUS_FILTER_MISS]] |
| 9410 | ** [[SQLITE_STMTSTATUS_FILTER HIT]] |
| 9411 | ** <dt>SQLITE_STMTSTATUS_FILTER_HIT<br> |
| 9412 | ** SQLITE_STMTSTATUS_FILTER_MISS</dt> |
| 9413 | ** <dd>^SQLITE_STMTSTATUS_FILTER_HIT is the number of times that a join |
| 9414 | ** step was bypassed because a Bloom filter returned not-found. The |
| 9415 | ** corresponding SQLITE_STMTSTATUS_FILTER_MISS value is the number of |
| 9416 | ** times that the Bloom filter returned a find, and thus the join step |
| 9417 | ** had to be processed as normal. |
| 9418 | ** |
| 9419 | ** [[SQLITE_STMTSTATUS_MEMUSED]] <dt>SQLITE_STMTSTATUS_MEMUSED</dt> |
| 9420 | ** <dd>^This is the approximate number of bytes of heap memory |
| 9421 | ** used to store the prepared statement. ^This value is not actually |
| 9422 | ** a counter, and so the resetFlg parameter to sqlite3_stmt_status() |
| @@ -9517,31 +9517,31 @@ | |
| 9517 | ** [[the xCreate() page cache methods]] |
| 9518 | ** ^SQLite invokes the xCreate() method to construct a new cache instance. |
| 9519 | ** SQLite will typically create one cache instance for each open database file, |
| 9520 | ** though this is not guaranteed. ^The |
| 9521 | ** first parameter, szPage, is the size in bytes of the pages that must |
| 9522 | ** be allocated by the cache. ^szPage will always a power of two. ^The |
| 9523 | ** second parameter szExtra is a number of bytes of extra storage |
| 9524 | ** associated with each page cache entry. ^The szExtra parameter will |
| 9525 | ** a number less than 250. SQLite will use the |
| 9526 | ** extra szExtra bytes on each page to store metadata about the underlying |
| 9527 | ** database page on disk. The value passed into szExtra depends |
| 9528 | ** on the SQLite version, the target platform, and how SQLite was compiled. |
| 9529 | ** ^The third argument to xCreate(), bPurgeable, is true if the cache being |
| 9530 | ** created will be used to cache database pages of a file stored on disk, or |
| 9531 | ** false if it is used for an in-memory database. The cache implementation |
| 9532 | ** does not have to do anything special based with the value of bPurgeable; |
| 9533 | ** it is purely advisory. ^On a cache where bPurgeable is false, SQLite will |
| 9534 | ** never invoke xUnpin() except to deliberately delete a page. |
| 9535 | ** ^In other words, calls to xUnpin() on a cache with bPurgeable set to |
| 9536 | ** false will always have the "discard" flag set to true. |
| 9537 | ** ^Hence, a cache created with bPurgeable false will |
| 9538 | ** never contain any unpinned pages. |
| 9539 | ** |
| 9540 | ** [[the xCachesize() page cache method]] |
| 9541 | ** ^(The xCachesize() method may be called at any time by SQLite to set the |
| 9542 | ** suggested maximum cache-size (number of pages stored by) the cache |
| 9543 | ** instance passed as the first argument. This is the value configured using |
| 9544 | ** the SQLite "[PRAGMA cache_size]" command.)^ As with the bPurgeable |
| 9545 | ** parameter, the implementation is not required to do anything with this |
| 9546 | ** value; it is advisory only. |
| 9547 | ** |
| @@ -9564,16 +9564,16 @@ | |
| 9564 | ** |
| 9565 | ** If the requested page is already in the page cache, then the page cache |
| 9566 | ** implementation must return a pointer to the page buffer with its content |
| 9567 | ** intact. If the requested page is not already in the cache, then the |
| 9568 | ** cache implementation should use the value of the createFlag |
| 9569 | ** parameter to help it determined what action to take: |
| 9570 | ** |
| 9571 | ** <table border=1 width=85% align=center> |
| 9572 | ** <tr><th> createFlag <th> Behavior when page is not already in cache |
| 9573 | ** <tr><td> 0 <td> Do not allocate a new page. Return NULL. |
| 9574 | ** <tr><td> 1 <td> Allocate a new page if it easy and convenient to do so. |
| 9575 | ** Otherwise return NULL. |
| 9576 | ** <tr><td> 2 <td> Make every effort to allocate a new page. Only return |
| 9577 | ** NULL if allocating a new page is effectively impossible. |
| 9578 | ** </table> |
| 9579 | ** |
| @@ -9586,11 +9586,11 @@ | |
| 9586 | ** [[the xUnpin() page cache method]] |
| 9587 | ** ^xUnpin() is called by SQLite with a pointer to a currently pinned page |
| 9588 | ** as its second argument. If the third parameter, discard, is non-zero, |
| 9589 | ** then the page must be evicted from the cache. |
| 9590 | ** ^If the discard parameter is |
| 9591 | ** zero, then the page may be discarded or retained at the discretion of |
| 9592 | ** page cache implementation. ^The page cache implementation |
| 9593 | ** may choose to evict unpinned pages at any time. |
| 9594 | ** |
| 9595 | ** The cache must not perform any reference counting. A single |
| 9596 | ** call to xUnpin() unpins the page regardless of the number of prior calls |
| @@ -9604,11 +9604,11 @@ | |
| 9604 | ** to be pinned. |
| 9605 | ** |
| 9606 | ** When SQLite calls the xTruncate() method, the cache must discard all |
| 9607 | ** existing cache entries with page numbers (keys) greater than or equal |
| 9608 | ** to the value of the iLimit parameter passed to xTruncate(). If any |
| 9609 | ** of these pages are pinned, they are implicitly unpinned, meaning that |
| 9610 | ** they can be safely discarded. |
| 9611 | ** |
| 9612 | ** [[the xDestroy() page cache method]] |
| 9613 | ** ^The xDestroy() method is used to delete a cache allocated by xCreate(). |
| 9614 | ** All resources associated with the specified cache should be freed. ^After |
| @@ -9903,11 +9903,11 @@ | |
| 9903 | ** identity of the database connection (the blocking connection) that |
| 9904 | ** has locked the required resource is stored internally. ^After an |
| 9905 | ** application receives an SQLITE_LOCKED error, it may call the |
| 9906 | ** sqlite3_unlock_notify() method with the blocked connection handle as |
| 9907 | ** the first argument to register for a callback that will be invoked |
| 9908 | ** when the blocking connections current transaction is concluded. ^The |
| 9909 | ** callback is invoked from within the [sqlite3_step] or [sqlite3_close] |
| 9910 | ** call that concludes the blocking connection's transaction. |
| 9911 | ** |
| 9912 | ** ^(If sqlite3_unlock_notify() is called in a multi-threaded application, |
| 9913 | ** there is a chance that the blocking connection will have already |
| @@ -9923,11 +9923,11 @@ | |
| 9923 | ** ^(There may be at most one unlock-notify callback registered by a |
| 9924 | ** blocked connection. If sqlite3_unlock_notify() is called when the |
| 9925 | ** blocked connection already has a registered unlock-notify callback, |
| 9926 | ** then the new callback replaces the old.)^ ^If sqlite3_unlock_notify() is |
| 9927 | ** called with a NULL pointer as its second argument, then any existing |
| 9928 | ** unlock-notify callback is canceled. ^The blocked connections |
| 9929 | ** unlock-notify callback may also be canceled by closing the blocked |
| 9930 | ** connection using [sqlite3_close()]. |
| 9931 | ** |
| 9932 | ** The unlock-notify callback is not reentrant. If an application invokes |
| 9933 | ** any sqlite3_xxx API functions from within an unlock-notify callback, a |
| @@ -10321,11 +10321,11 @@ | |
| 10321 | ** where X is an integer. If X is zero, then the [virtual table] whose |
| 10322 | ** [xCreate] or [xConnect] method invoked [sqlite3_vtab_config()] does not |
| 10323 | ** support constraints. In this configuration (which is the default) if |
| 10324 | ** a call to the [xUpdate] method returns [SQLITE_CONSTRAINT], then the entire |
| 10325 | ** statement is rolled back as if [ON CONFLICT | OR ABORT] had been |
| 10326 | ** specified as part of the users SQL statement, regardless of the actual |
| 10327 | ** ON CONFLICT mode specified. |
| 10328 | ** |
| 10329 | ** If X is non-zero, then the virtual table implementation guarantees |
| 10330 | ** that if [xUpdate] returns [SQLITE_CONSTRAINT], it will do so before |
| 10331 | ** any modifications to internal or persistent data structures have been made. |
| @@ -10355,11 +10355,11 @@ | |
| 10355 | ** </dd> |
| 10356 | ** |
| 10357 | ** [[SQLITE_VTAB_INNOCUOUS]]<dt>SQLITE_VTAB_INNOCUOUS</dt> |
| 10358 | ** <dd>Calls of the form |
| 10359 | ** [sqlite3_vtab_config](db,SQLITE_VTAB_INNOCUOUS) from within the |
| 10360 | ** the [xConnect] or [xCreate] methods of a [virtual table] implementation |
| 10361 | ** identify that virtual table as being safe to use from within triggers |
| 10362 | ** and views. Conceptually, the SQLITE_VTAB_INNOCUOUS tag means that the |
| 10363 | ** virtual table can do no serious harm even if it is controlled by a |
| 10364 | ** malicious hacker. Developers should avoid setting the SQLITE_VTAB_INNOCUOUS |
| 10365 | ** flag unless absolutely necessary. |
| @@ -10523,21 +10523,21 @@ | |
| 10523 | ** <tr><td>2<td>no<td>yes<td>yes |
| 10524 | ** <tr><td>3<td>yes<td>yes<td>yes |
| 10525 | ** </table> |
| 10526 | ** |
| 10527 | ** ^For the purposes of comparing virtual table output values to see if the |
| 10528 | ** values are same value for sorting purposes, two NULL values are considered |
| 10529 | ** to be the same. In other words, the comparison operator is "IS" |
| 10530 | ** (or "IS NOT DISTINCT FROM") and not "==". |
| 10531 | ** |
| 10532 | ** If a virtual table implementation is unable to meet the requirements |
| 10533 | ** specified above, then it must not set the "orderByConsumed" flag in the |
| 10534 | ** [sqlite3_index_info] object or an incorrect answer may result. |
| 10535 | ** |
| 10536 | ** ^A virtual table implementation is always free to return rows in any order |
| 10537 | ** it wants, as long as the "orderByConsumed" flag is not set. ^When the |
| 10538 | ** the "orderByConsumed" flag is unset, the query planner will add extra |
| 10539 | ** [bytecode] to ensure that the final results returned by the SQL query are |
| 10540 | ** ordered correctly. The use of the "orderByConsumed" flag and the |
| 10541 | ** sqlite3_vtab_distinct() interface is merely an optimization. ^Careful |
| 10542 | ** use of the sqlite3_vtab_distinct() interface and the "orderByConsumed" |
| 10543 | ** flag might help queries against a virtual table to run faster. Being |
| @@ -10630,11 +10630,11 @@ | |
| 10630 | ** |
| 10631 | ** The X parameter in a call to sqlite3_vtab_in_first(X,P) or |
| 10632 | ** sqlite3_vtab_in_next(X,P) should be one of the parameters to the |
| 10633 | ** xFilter method which invokes these routines, and specifically |
| 10634 | ** a parameter that was previously selected for all-at-once IN constraint |
| 10635 | ** processing use the [sqlite3_vtab_in()] interface in the |
| 10636 | ** [xBestIndex|xBestIndex method]. ^(If the X parameter is not |
| 10637 | ** an xFilter argument that was selected for all-at-once IN constraint |
| 10638 | ** processing, then these routines return [SQLITE_ERROR].)^ |
| 10639 | ** |
| 10640 | ** ^(Use these routines to access all values on the right-hand side |
| @@ -10685,11 +10685,11 @@ | |
| 10685 | ** right-hand operand is not known, then *V is set to a NULL pointer. |
| 10686 | ** ^The sqlite3_vtab_rhs_value(P,J,V) interface returns SQLITE_OK if |
| 10687 | ** and only if *V is set to a value. ^The sqlite3_vtab_rhs_value(P,J,V) |
| 10688 | ** inteface returns SQLITE_NOTFOUND if the right-hand side of the J-th |
| 10689 | ** constraint is not available. ^The sqlite3_vtab_rhs_value() interface |
| 10690 | ** can return an result code other than SQLITE_OK or SQLITE_NOTFOUND if |
| 10691 | ** something goes wrong. |
| 10692 | ** |
| 10693 | ** The sqlite3_vtab_rhs_value() interface is usually only successful if |
| 10694 | ** the right-hand operand of a constraint is a literal value in the original |
| 10695 | ** SQL statement. If the right-hand operand is an expression or a reference |
| @@ -10713,12 +10713,12 @@ | |
| 10713 | /* |
| 10714 | ** CAPI3REF: Conflict resolution modes |
| 10715 | ** KEYWORDS: {conflict resolution mode} |
| 10716 | ** |
| 10717 | ** These constants are returned by [sqlite3_vtab_on_conflict()] to |
| 10718 | ** inform a [virtual table] implementation what the [ON CONFLICT] mode |
| 10719 | ** is for the SQL statement being evaluated. |
| 10720 | ** |
| 10721 | ** Note that the [SQLITE_IGNORE] constant is also used as a potential |
| 10722 | ** return value from the [sqlite3_set_authorizer()] callback and that |
| 10723 | ** [SQLITE_ABORT] is also a [result code]. |
| 10724 | */ |
| @@ -10754,43 +10754,43 @@ | |
| 10754 | ** to the total number of rows examined by all iterations of the X-th loop.</dd> |
| 10755 | ** |
| 10756 | ** [[SQLITE_SCANSTAT_EST]] <dt>SQLITE_SCANSTAT_EST</dt> |
| 10757 | ** <dd>^The "double" variable pointed to by the V parameter will be set to the |
| 10758 | ** query planner's estimate for the average number of rows output from each |
| 10759 | ** iteration of the X-th loop. If the query planner's estimates was accurate, |
| 10760 | ** then this value will approximate the quotient NVISIT/NLOOP and the |
| 10761 | ** product of this value for all prior loops with the same SELECTID will |
| 10762 | ** be the NLOOP value for the current loop. |
| 10763 | ** |
| 10764 | ** [[SQLITE_SCANSTAT_NAME]] <dt>SQLITE_SCANSTAT_NAME</dt> |
| 10765 | ** <dd>^The "const char *" variable pointed to by the V parameter will be set |
| 10766 | ** to a zero-terminated UTF-8 string containing the name of the index or table |
| 10767 | ** used for the X-th loop. |
| 10768 | ** |
| 10769 | ** [[SQLITE_SCANSTAT_EXPLAIN]] <dt>SQLITE_SCANSTAT_EXPLAIN</dt> |
| 10770 | ** <dd>^The "const char *" variable pointed to by the V parameter will be set |
| 10771 | ** to a zero-terminated UTF-8 string containing the [EXPLAIN QUERY PLAN] |
| 10772 | ** description for the X-th loop. |
| 10773 | ** |
| 10774 | ** [[SQLITE_SCANSTAT_SELECTID]] <dt>SQLITE_SCANSTAT_SELECTID</dt> |
| 10775 | ** <dd>^The "int" variable pointed to by the V parameter will be set to the |
| 10776 | ** id for the X-th query plan element. The id value is unique within the |
| 10777 | ** statement. The select-id is the same value as is output in the first |
| 10778 | ** column of an [EXPLAIN QUERY PLAN] query. |
| 10779 | ** |
| 10780 | ** [[SQLITE_SCANSTAT_PARENTID]] <dt>SQLITE_SCANSTAT_PARENTID</dt> |
| 10781 | ** <dd>The "int" variable pointed to by the V parameter will be set to the |
| 10782 | ** the id of the parent of the current query element, if applicable, or |
| 10783 | ** to zero if the query element has no parent. This is the same value as |
| 10784 | ** returned in the second column of an [EXPLAIN QUERY PLAN] query. |
| 10785 | ** |
| 10786 | ** [[SQLITE_SCANSTAT_NCYCLE]] <dt>SQLITE_SCANSTAT_NCYCLE</dt> |
| 10787 | ** <dd>The sqlite3_int64 output value is set to the number of cycles, |
| 10788 | ** according to the processor time-stamp counter, that elapsed while the |
| 10789 | ** query element was being processed. This value is not available for |
| 10790 | ** all query elements - if it is unavailable the output variable is |
| 10791 | ** set to -1. |
| 10792 | ** </dl> |
| 10793 | */ |
| 10794 | #define SQLITE_SCANSTAT_NLOOP 0 |
| 10795 | #define SQLITE_SCANSTAT_NVISIT 1 |
| 10796 | #define SQLITE_SCANSTAT_EST 2 |
| @@ -10827,12 +10827,12 @@ | |
| 10827 | ** the EXPLAIN QUERY PLAN output) are available. Invoking API |
| 10828 | ** sqlite3_stmt_scanstatus() is equivalent to calling |
| 10829 | ** sqlite3_stmt_scanstatus_v2() with a zeroed flags parameter. |
| 10830 | ** |
| 10831 | ** Parameter "idx" identifies the specific query element to retrieve statistics |
| 10832 | ** for. Query elements are numbered starting from zero. A value of -1 may be |
| 10833 | ** to query for statistics regarding the entire query. ^If idx is out of range |
| 10834 | ** - less than -1 or greater than or equal to the total number of query |
| 10835 | ** elements used to implement the statement - a non-zero value is returned and |
| 10836 | ** the variable that pOut points to is unchanged. |
| 10837 | ** |
| 10838 | ** See also: [sqlite3_stmt_scanstatus_reset()] |
| @@ -10985,12 +10985,12 @@ | |
| 10985 | ** operation; or 1 for inserts, updates, or deletes invoked by top-level |
| 10986 | ** triggers; or 2 for changes resulting from triggers called by top-level |
| 10987 | ** triggers; and so forth. |
| 10988 | ** |
| 10989 | ** When the [sqlite3_blob_write()] API is used to update a blob column, |
| 10990 | ** the pre-update hook is invoked with SQLITE_DELETE. This is because the |
| 10991 | ** in this case the new values are not available. In this case, when a |
| 10992 | ** callback made with op==SQLITE_DELETE is actually a write using the |
| 10993 | ** sqlite3_blob_write() API, the [sqlite3_preupdate_blobwrite()] returns |
| 10994 | ** the index of the column being written. In other cases, where the |
| 10995 | ** pre-update hook is being invoked for some other reason, including a |
| 10996 | ** regular DELETE, sqlite3_preupdate_blobwrite() returns -1. |
| @@ -11239,20 +11239,20 @@ | |
| 11239 | ** is written into *P. |
| 11240 | ** |
| 11241 | ** For an ordinary on-disk database file, the serialization is just a |
| 11242 | ** copy of the disk file. For an in-memory database or a "TEMP" database, |
| 11243 | ** the serialization is the same sequence of bytes which would be written |
| 11244 | ** to disk if that database where backed up to disk. |
| 11245 | ** |
| 11246 | ** The usual case is that sqlite3_serialize() copies the serialization of |
| 11247 | ** the database into memory obtained from [sqlite3_malloc64()] and returns |
| 11248 | ** a pointer to that memory. The caller is responsible for freeing the |
| 11249 | ** returned value to avoid a memory leak. However, if the F argument |
| 11250 | ** contains the SQLITE_SERIALIZE_NOCOPY bit, then no memory allocations |
| 11251 | ** are made, and the sqlite3_serialize() function will return a pointer |
| 11252 | ** to the contiguous memory representation of the database that SQLite |
| 11253 | ** is currently using for that database, or NULL if the no such contiguous |
| 11254 | ** memory representation of the database exists. A contiguous memory |
| 11255 | ** representation of the database will usually only exist if there has |
| 11256 | ** been a prior call to [sqlite3_deserialize(D,S,...)] with the same |
| 11257 | ** values of D and S. |
| 11258 | ** The size of the database is written into *P even if the |
| @@ -11319,11 +11319,11 @@ | |
| 11319 | ** |
| 11320 | ** The sqlite3_deserialize() interface will fail with SQLITE_BUSY if the |
| 11321 | ** database is currently in a read transaction or is involved in a backup |
| 11322 | ** operation. |
| 11323 | ** |
| 11324 | ** It is not possible to deserialized into the TEMP database. If the |
| 11325 | ** S argument to sqlite3_deserialize(D,S,P,N,M,F) is "temp" then the |
| 11326 | ** function returns SQLITE_ERROR. |
| 11327 | ** |
| 11328 | ** The deserialized database should not be in [WAL mode]. If the database |
| 11329 | ** is in WAL mode, then any attempt to use the database file will result |
| @@ -11341,19 +11341,19 @@ | |
| 11341 | */ |
| 11342 | SQLITE_API int sqlite3_deserialize( |
| 11343 | sqlite3 *db, /* The database connection */ |
| 11344 | const char *zSchema, /* Which DB to reopen with the deserialization */ |
| 11345 | unsigned char *pData, /* The serialized database content */ |
| 11346 | sqlite3_int64 szDb, /* Number bytes in the deserialization */ |
| 11347 | sqlite3_int64 szBuf, /* Total size of buffer pData[] */ |
| 11348 | unsigned mFlags /* Zero or more SQLITE_DESERIALIZE_* flags */ |
| 11349 | ); |
| 11350 | |
| 11351 | /* |
| 11352 | ** CAPI3REF: Flags for sqlite3_deserialize() |
| 11353 | ** |
| 11354 | ** The following are allowed values for 6th argument (the F argument) to |
| 11355 | ** the [sqlite3_deserialize(D,S,P,N,M,F)] interface. |
| 11356 | ** |
| 11357 | ** The SQLITE_DESERIALIZE_FREEONCLOSE means that the database serialization |
| 11358 | ** in the P argument is held in memory obtained from [sqlite3_malloc64()] |
| 11359 | ** and that SQLite should take ownership of this memory and automatically |
| @@ -112888,10 +112888,85 @@ | |
| 112888 | pExpr = pExpr->op==TK_AND ? pLeft : pRight; |
| 112889 | } |
| 112890 | } |
| 112891 | return pExpr; |
| 112892 | } |
| 112893 | |
| 112894 | /* |
| 112895 | ** pExpr is a TK_FUNCTION node. Try to determine whether or not the |
| 112896 | ** function is a constant function. A function is constant if all of |
| 112897 | ** the following are true: |
| @@ -115477,15 +115552,21 @@ | |
| 115477 | case TK_GT: |
| 115478 | case TK_GE: |
| 115479 | case TK_NE: |
| 115480 | case TK_EQ: { |
| 115481 | Expr *pLeft = pExpr->pLeft; |
| 115482 | if( sqlite3ExprIsVector(pLeft) ){ |
| 115483 | codeVectorCompare(pParse, pExpr, target, op, p5); |
| 115484 | }else{ |
| 115485 | r1 = sqlite3ExprCodeTemp(pParse, pLeft, ®Free1); |
| 115486 | r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, ®Free2); |
| 115487 | sqlite3VdbeAddOp2(v, OP_Integer, 1, inReg); |
| 115488 | codeCompare(pParse, pLeft, pExpr->pRight, op, r1, r2, |
| 115489 | sqlite3VdbeCurrentAddr(v)+2, p5, |
| 115490 | ExprHasProperty(pExpr,EP_Commuted)); |
| 115491 | assert(TK_LT==OP_Lt); testcase(op==OP_Lt); VdbeCoverageIf(v,op==OP_Lt); |
| @@ -115496,13 +115577,19 @@ | |
| 115496 | assert(TK_NE==OP_Ne); testcase(op==OP_Ne); VdbeCoverageIf(v,op==OP_Ne); |
| 115497 | if( p5==SQLITE_NULLEQ ){ |
| 115498 | sqlite3VdbeAddOp2(v, OP_Integer, 0, inReg); |
| 115499 | }else{ |
| 115500 | sqlite3VdbeAddOp3(v, OP_ZeroOrNull, r1, inReg, r2); |
| 115501 | } |
| 115502 | testcase( regFree1==0 ); |
| 115503 | testcase( regFree2==0 ); |
| 115504 | } |
| 115505 | break; |
| 115506 | } |
| 115507 | case TK_AND: |
| 115508 | case TK_OR: |
| @@ -115514,10 +115601,11 @@ | |
| 115514 | case TK_BITOR: |
| 115515 | case TK_SLASH: |
| 115516 | case TK_LSHIFT: |
| 115517 | case TK_RSHIFT: |
| 115518 | case TK_CONCAT: { |
| 115519 | assert( TK_AND==OP_And ); testcase( op==TK_AND ); |
| 115520 | assert( TK_OR==OP_Or ); testcase( op==TK_OR ); |
| 115521 | assert( TK_PLUS==OP_Add ); testcase( op==TK_PLUS ); |
| 115522 | assert( TK_MINUS==OP_Subtract ); testcase( op==TK_MINUS ); |
| 115523 | assert( TK_REM==OP_Remainder ); testcase( op==TK_REM ); |
| @@ -115525,15 +115613,26 @@ | |
| 115525 | assert( TK_BITOR==OP_BitOr ); testcase( op==TK_BITOR ); |
| 115526 | assert( TK_SLASH==OP_Divide ); testcase( op==TK_SLASH ); |
| 115527 | assert( TK_LSHIFT==OP_ShiftLeft ); testcase( op==TK_LSHIFT ); |
| 115528 | assert( TK_RSHIFT==OP_ShiftRight ); testcase( op==TK_RSHIFT ); |
| 115529 | assert( TK_CONCAT==OP_Concat ); testcase( op==TK_CONCAT ); |
| 115530 | r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free1); |
| 115531 | r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, ®Free2); |
| 115532 | sqlite3VdbeAddOp3(v, op, r2, r1, target); |
| 115533 | testcase( regFree1==0 ); |
| 115534 | testcase( regFree2==0 ); |
| 115535 | break; |
| 115536 | } |
| 115537 | case TK_UMINUS: { |
| 115538 | Expr *pLeft = pExpr->pLeft; |
| 115539 | assert( pLeft ); |
| @@ -116378,21 +116477,31 @@ | |
| 116378 | case TK_AND: |
| 116379 | case TK_OR: { |
| 116380 | Expr *pAlt = sqlite3ExprSimplifiedAndOr(pExpr); |
| 116381 | if( pAlt!=pExpr ){ |
| 116382 | sqlite3ExprIfTrue(pParse, pAlt, dest, jumpIfNull); |
| 116383 | }else if( op==TK_AND ){ |
| 116384 | int d2 = sqlite3VdbeMakeLabel(pParse); |
| 116385 | testcase( jumpIfNull==0 ); |
| 116386 | sqlite3ExprIfFalse(pParse, pExpr->pLeft, d2, |
| 116387 | jumpIfNull^SQLITE_JUMPIFNULL); |
| 116388 | sqlite3ExprIfTrue(pParse, pExpr->pRight, dest, jumpIfNull); |
| 116389 | sqlite3VdbeResolveLabel(v, d2); |
| 116390 | }else{ |
| 116391 | testcase( jumpIfNull==0 ); |
| 116392 | sqlite3ExprIfTrue(pParse, pExpr->pLeft, dest, jumpIfNull); |
| 116393 | sqlite3ExprIfTrue(pParse, pExpr->pRight, dest, jumpIfNull); |
| 116394 | } |
| 116395 | break; |
| 116396 | } |
| 116397 | case TK_NOT: { |
| 116398 | testcase( jumpIfNull==0 ); |
| @@ -116427,14 +116536,20 @@ | |
| 116427 | case TK_LE: |
| 116428 | case TK_GT: |
| 116429 | case TK_GE: |
| 116430 | case TK_NE: |
| 116431 | case TK_EQ: { |
| 116432 | if( sqlite3ExprIsVector(pExpr->pLeft) ) goto default_expr; |
| 116433 | testcase( jumpIfNull==0 ); |
| 116434 | r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free1); |
| 116435 | r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, ®Free2); |
| 116436 | codeCompare(pParse, pExpr->pLeft, pExpr->pRight, op, |
| 116437 | r1, r2, dest, jumpIfNull, ExprHasProperty(pExpr,EP_Commuted)); |
| 116438 | assert(TK_LT==OP_Lt); testcase(op==OP_Lt); VdbeCoverageIf(v,op==OP_Lt); |
| 116439 | assert(TK_LE==OP_Le); testcase(op==OP_Le); VdbeCoverageIf(v,op==OP_Le); |
| 116440 | assert(TK_GT==OP_Gt); testcase(op==OP_Gt); VdbeCoverageIf(v,op==OP_Gt); |
| @@ -116445,10 +116560,17 @@ | |
| 116445 | assert(TK_NE==OP_Ne); testcase(op==OP_Ne); |
| 116446 | VdbeCoverageIf(v, op==OP_Ne && jumpIfNull==SQLITE_NULLEQ); |
| 116447 | VdbeCoverageIf(v, op==OP_Ne && jumpIfNull!=SQLITE_NULLEQ); |
| 116448 | testcase( regFree1==0 ); |
| 116449 | testcase( regFree2==0 ); |
| 116450 | break; |
| 116451 | } |
| 116452 | case TK_ISNULL: |
| 116453 | case TK_NOTNULL: { |
| 116454 | assert( TK_ISNULL==OP_IsNull ); testcase( op==TK_ISNULL ); |
| @@ -116552,21 +116674,31 @@ | |
| 116552 | case TK_AND: |
| 116553 | case TK_OR: { |
| 116554 | Expr *pAlt = sqlite3ExprSimplifiedAndOr(pExpr); |
| 116555 | if( pAlt!=pExpr ){ |
| 116556 | sqlite3ExprIfFalse(pParse, pAlt, dest, jumpIfNull); |
| 116557 | }else if( pExpr->op==TK_AND ){ |
| 116558 | testcase( jumpIfNull==0 ); |
| 116559 | sqlite3ExprIfFalse(pParse, pExpr->pLeft, dest, jumpIfNull); |
| 116560 | sqlite3ExprIfFalse(pParse, pExpr->pRight, dest, jumpIfNull); |
| 116561 | }else{ |
| 116562 | int d2 = sqlite3VdbeMakeLabel(pParse); |
| 116563 | testcase( jumpIfNull==0 ); |
| 116564 | sqlite3ExprIfTrue(pParse, pExpr->pLeft, d2, |
| 116565 | jumpIfNull^SQLITE_JUMPIFNULL); |
| 116566 | sqlite3ExprIfFalse(pParse, pExpr->pRight, dest, jumpIfNull); |
| 116567 | sqlite3VdbeResolveLabel(v, d2); |
| 116568 | } |
| 116569 | break; |
| 116570 | } |
| 116571 | case TK_NOT: { |
| 116572 | testcase( jumpIfNull==0 ); |
| @@ -116604,14 +116736,20 @@ | |
| 116604 | case TK_LE: |
| 116605 | case TK_GT: |
| 116606 | case TK_GE: |
| 116607 | case TK_NE: |
| 116608 | case TK_EQ: { |
| 116609 | if( sqlite3ExprIsVector(pExpr->pLeft) ) goto default_expr; |
| 116610 | testcase( jumpIfNull==0 ); |
| 116611 | r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free1); |
| 116612 | r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, ®Free2); |
| 116613 | codeCompare(pParse, pExpr->pLeft, pExpr->pRight, op, |
| 116614 | r1, r2, dest, jumpIfNull,ExprHasProperty(pExpr,EP_Commuted)); |
| 116615 | assert(TK_LT==OP_Lt); testcase(op==OP_Lt); VdbeCoverageIf(v,op==OP_Lt); |
| 116616 | assert(TK_LE==OP_Le); testcase(op==OP_Le); VdbeCoverageIf(v,op==OP_Le); |
| 116617 | assert(TK_GT==OP_Gt); testcase(op==OP_Gt); VdbeCoverageIf(v,op==OP_Gt); |
| @@ -116622,10 +116760,17 @@ | |
| 116622 | assert(TK_NE==OP_Ne); testcase(op==OP_Ne); |
| 116623 | VdbeCoverageIf(v, op==OP_Ne && jumpIfNull!=SQLITE_NULLEQ); |
| 116624 | VdbeCoverageIf(v, op==OP_Ne && jumpIfNull==SQLITE_NULLEQ); |
| 116625 | testcase( regFree1==0 ); |
| 116626 | testcase( regFree2==0 ); |
| 116627 | break; |
| 116628 | } |
| 116629 | case TK_ISNULL: |
| 116630 | case TK_NOTNULL: { |
| 116631 | r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free1); |
| @@ -257503,11 +257648,11 @@ | |
| 257503 | int nArg, /* Number of args */ |
| 257504 | sqlite3_value **apUnused /* Function arguments */ |
| 257505 | ){ |
| 257506 | assert( nArg==0 ); |
| 257507 | UNUSED_PARAM2(nArg, apUnused); |
| 257508 | sqlite3_result_text(pCtx, "fts5: 2025-06-27 19:02:21 5508b56fd24016c13981ec280ecdd833007c9d8dd595edb295b984c2b487b5c8", -1, SQLITE_TRANSIENT); |
| 257509 | } |
| 257510 | |
| 257511 | /* |
| 257512 | ** Implementation of fts5_locale(LOCALE, TEXT) function. |
| 257513 | ** |
| 257514 |
| --- extsrc/sqlite3.c | |
| +++ extsrc/sqlite3.c | |
| @@ -16,11 +16,11 @@ | |
| 16 | ** if you want a wrapper to interface SQLite with your choice of programming |
| 17 | ** language. The code for the "sqlite3" command-line shell is also in a |
| 18 | ** separate file. This file contains only code for the core SQLite library. |
| 19 | ** |
| 20 | ** The content in this amalgamation comes from Fossil check-in |
| 21 | ** 0083d5169a46104a25355bdd9d5a2f4027b0 with changes in files: |
| 22 | ** |
| 23 | ** |
| 24 | */ |
| 25 | #ifndef SQLITE_AMALGAMATION |
| 26 | #define SQLITE_CORE 1 |
| @@ -465,11 +465,11 @@ | |
| 465 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 466 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 467 | */ |
| 468 | #define SQLITE_VERSION "3.51.0" |
| 469 | #define SQLITE_VERSION_NUMBER 3051000 |
| 470 | #define SQLITE_SOURCE_ID "2025-06-30 16:41:40 0083d5169a46104a25355bdd9d5a2f4027b049191ebda571dd228477ec217296" |
| 471 | |
| 472 | /* |
| 473 | ** CAPI3REF: Run-Time Library Version Numbers |
| 474 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 475 | ** |
| @@ -9375,48 +9375,48 @@ | |
| 9375 | ** careful use of indices.</dd> |
| 9376 | ** |
| 9377 | ** [[SQLITE_STMTSTATUS_SORT]] <dt>SQLITE_STMTSTATUS_SORT</dt> |
| 9378 | ** <dd>^This is the number of sort operations that have occurred. |
| 9379 | ** A non-zero value in this counter may indicate an opportunity to |
| 9380 | ** improve performance through careful use of indices.</dd> |
| 9381 | ** |
| 9382 | ** [[SQLITE_STMTSTATUS_AUTOINDEX]] <dt>SQLITE_STMTSTATUS_AUTOINDEX</dt> |
| 9383 | ** <dd>^This is the number of rows inserted into transient indices that |
| 9384 | ** were created automatically in order to help joins run faster. |
| 9385 | ** A non-zero value in this counter may indicate an opportunity to |
| 9386 | ** improve performance by adding permanent indices that do not |
| 9387 | ** need to be reinitialized each time the statement is run.</dd> |
| 9388 | ** |
| 9389 | ** [[SQLITE_STMTSTATUS_VM_STEP]] <dt>SQLITE_STMTSTATUS_VM_STEP</dt> |
| 9390 | ** <dd>^This is the number of virtual machine operations executed |
| 9391 | ** by the prepared statement if that number is less than or equal |
| 9392 | ** to 2147483647. The number of virtual machine operations can be |
| 9393 | ** used as a proxy for the total work done by the prepared statement. |
| 9394 | ** If the number of virtual machine operations exceeds 2147483647 |
| 9395 | ** then the value returned by this statement status code is undefined.</dd> |
| 9396 | ** |
| 9397 | ** [[SQLITE_STMTSTATUS_REPREPARE]] <dt>SQLITE_STMTSTATUS_REPREPARE</dt> |
| 9398 | ** <dd>^This is the number of times that the prepare statement has been |
| 9399 | ** automatically regenerated due to schema changes or changes to |
| 9400 | ** [bound parameters] that might affect the query plan.</dd> |
| 9401 | ** |
| 9402 | ** [[SQLITE_STMTSTATUS_RUN]] <dt>SQLITE_STMTSTATUS_RUN</dt> |
| 9403 | ** <dd>^This is the number of times that the prepared statement has |
| 9404 | ** been run. A single "run" for the purposes of this counter is one |
| 9405 | ** or more calls to [sqlite3_step()] followed by a call to [sqlite3_reset()]. |
| 9406 | ** The counter is incremented on the first [sqlite3_step()] call of each |
| 9407 | ** cycle.</dd> |
| 9408 | ** |
| 9409 | ** [[SQLITE_STMTSTATUS_FILTER_MISS]] |
| 9410 | ** [[SQLITE_STMTSTATUS_FILTER HIT]] |
| 9411 | ** <dt>SQLITE_STMTSTATUS_FILTER_HIT<br> |
| 9412 | ** SQLITE_STMTSTATUS_FILTER_MISS</dt> |
| 9413 | ** <dd>^SQLITE_STMTSTATUS_FILTER_HIT is the number of times that a join |
| 9414 | ** step was bypassed because a Bloom filter returned not-found. The |
| 9415 | ** corresponding SQLITE_STMTSTATUS_FILTER_MISS value is the number of |
| 9416 | ** times that the Bloom filter returned a find, and thus the join step |
| 9417 | ** had to be processed as normal.</dd> |
| 9418 | ** |
| 9419 | ** [[SQLITE_STMTSTATUS_MEMUSED]] <dt>SQLITE_STMTSTATUS_MEMUSED</dt> |
| 9420 | ** <dd>^This is the approximate number of bytes of heap memory |
| 9421 | ** used to store the prepared statement. ^This value is not actually |
| 9422 | ** a counter, and so the resetFlg parameter to sqlite3_stmt_status() |
| @@ -9517,31 +9517,31 @@ | |
| 9517 | ** [[the xCreate() page cache methods]] |
| 9518 | ** ^SQLite invokes the xCreate() method to construct a new cache instance. |
| 9519 | ** SQLite will typically create one cache instance for each open database file, |
| 9520 | ** though this is not guaranteed. ^The |
| 9521 | ** first parameter, szPage, is the size in bytes of the pages that must |
| 9522 | ** be allocated by the cache. ^szPage will always be a power of two. ^The |
| 9523 | ** second parameter szExtra is a number of bytes of extra storage |
| 9524 | ** associated with each page cache entry. ^The szExtra parameter will be |
| 9525 | ** a number less than 250. SQLite will use the |
| 9526 | ** extra szExtra bytes on each page to store metadata about the underlying |
| 9527 | ** database page on disk. The value passed into szExtra depends |
| 9528 | ** on the SQLite version, the target platform, and how SQLite was compiled. |
| 9529 | ** ^The third argument to xCreate(), bPurgeable, is true if the cache being |
| 9530 | ** created will be used to cache database pages of a file stored on disk, or |
| 9531 | ** false if it is used for an in-memory database. The cache implementation |
| 9532 | ** does not have to do anything special based upon the value of bPurgeable; |
| 9533 | ** it is purely advisory. ^On a cache where bPurgeable is false, SQLite will |
| 9534 | ** never invoke xUnpin() except to deliberately delete a page. |
| 9535 | ** ^In other words, calls to xUnpin() on a cache with bPurgeable set to |
| 9536 | ** false will always have the "discard" flag set to true. |
| 9537 | ** ^Hence, a cache created with bPurgeable set to false will |
| 9538 | ** never contain any unpinned pages. |
| 9539 | ** |
| 9540 | ** [[the xCachesize() page cache method]] |
| 9541 | ** ^(The xCachesize() method may be called at any time by SQLite to set the |
| 9542 | ** suggested maximum cache-size (number of pages stored) for the cache |
| 9543 | ** instance passed as the first argument. This is the value configured using |
| 9544 | ** the SQLite "[PRAGMA cache_size]" command.)^ As with the bPurgeable |
| 9545 | ** parameter, the implementation is not required to do anything with this |
| 9546 | ** value; it is advisory only. |
| 9547 | ** |
| @@ -9564,16 +9564,16 @@ | |
| 9564 | ** |
| 9565 | ** If the requested page is already in the page cache, then the page cache |
| 9566 | ** implementation must return a pointer to the page buffer with its content |
| 9567 | ** intact. If the requested page is not already in the cache, then the |
| 9568 | ** cache implementation should use the value of the createFlag |
| 9569 | ** parameter to help it determine what action to take: |
| 9570 | ** |
| 9571 | ** <table border=1 width=85% align=center> |
| 9572 | ** <tr><th> createFlag <th> Behavior when page is not already in cache |
| 9573 | ** <tr><td> 0 <td> Do not allocate a new page. Return NULL. |
| 9574 | ** <tr><td> 1 <td> Allocate a new page if it is easy and convenient to do so. |
| 9575 | ** Otherwise return NULL. |
| 9576 | ** <tr><td> 2 <td> Make every effort to allocate a new page. Only return |
| 9577 | ** NULL if allocating a new page is effectively impossible. |
| 9578 | ** </table> |
| 9579 | ** |
| @@ -9586,11 +9586,11 @@ | |
| 9586 | ** [[the xUnpin() page cache method]] |
| 9587 | ** ^xUnpin() is called by SQLite with a pointer to a currently pinned page |
| 9588 | ** as its second argument. If the third parameter, discard, is non-zero, |
| 9589 | ** then the page must be evicted from the cache. |
| 9590 | ** ^If the discard parameter is |
| 9591 | ** zero, then the page may be discarded or retained at the discretion of the |
| 9592 | ** page cache implementation. ^The page cache implementation |
| 9593 | ** may choose to evict unpinned pages at any time. |
| 9594 | ** |
| 9595 | ** The cache must not perform any reference counting. A single |
| 9596 | ** call to xUnpin() unpins the page regardless of the number of prior calls |
| @@ -9604,11 +9604,11 @@ | |
| 9604 | ** to be pinned. |
| 9605 | ** |
| 9606 | ** When SQLite calls the xTruncate() method, the cache must discard all |
| 9607 | ** existing cache entries with page numbers (keys) greater than or equal |
| 9608 | ** to the value of the iLimit parameter passed to xTruncate(). If any |
| 9609 | ** of these pages are pinned, they become implicitly unpinned, meaning that |
| 9610 | ** they can be safely discarded. |
| 9611 | ** |
| 9612 | ** [[the xDestroy() page cache method]] |
| 9613 | ** ^The xDestroy() method is used to delete a cache allocated by xCreate(). |
| 9614 | ** All resources associated with the specified cache should be freed. ^After |
| @@ -9903,11 +9903,11 @@ | |
| 9903 | ** identity of the database connection (the blocking connection) that |
| 9904 | ** has locked the required resource is stored internally. ^After an |
| 9905 | ** application receives an SQLITE_LOCKED error, it may call the |
| 9906 | ** sqlite3_unlock_notify() method with the blocked connection handle as |
| 9907 | ** the first argument to register for a callback that will be invoked |
| 9908 | ** when the blocking connection's current transaction is concluded. ^The |
| 9909 | ** callback is invoked from within the [sqlite3_step] or [sqlite3_close] |
| 9910 | ** call that concludes the blocking connection's transaction. |
| 9911 | ** |
| 9912 | ** ^(If sqlite3_unlock_notify() is called in a multi-threaded application, |
| 9913 | ** there is a chance that the blocking connection will have already |
| @@ -9923,11 +9923,11 @@ | |
| 9923 | ** ^(There may be at most one unlock-notify callback registered by a |
| 9924 | ** blocked connection. If sqlite3_unlock_notify() is called when the |
| 9925 | ** blocked connection already has a registered unlock-notify callback, |
| 9926 | ** then the new callback replaces the old.)^ ^If sqlite3_unlock_notify() is |
| 9927 | ** called with a NULL pointer as its second argument, then any existing |
| 9928 | ** unlock-notify callback is canceled. ^The blocked connection's |
| 9929 | ** unlock-notify callback may also be canceled by closing the blocked |
| 9930 | ** connection using [sqlite3_close()]. |
| 9931 | ** |
| 9932 | ** The unlock-notify callback is not reentrant. If an application invokes |
| 9933 | ** any sqlite3_xxx API functions from within an unlock-notify callback, a |
| @@ -10321,11 +10321,11 @@ | |
| 10321 | ** where X is an integer. If X is zero, then the [virtual table] whose |
| 10322 | ** [xCreate] or [xConnect] method invoked [sqlite3_vtab_config()] does not |
| 10323 | ** support constraints. In this configuration (which is the default) if |
| 10324 | ** a call to the [xUpdate] method returns [SQLITE_CONSTRAINT], then the entire |
| 10325 | ** statement is rolled back as if [ON CONFLICT | OR ABORT] had been |
| 10326 | ** specified as part of the user's SQL statement, regardless of the actual |
| 10327 | ** ON CONFLICT mode specified. |
| 10328 | ** |
| 10329 | ** If X is non-zero, then the virtual table implementation guarantees |
| 10330 | ** that if [xUpdate] returns [SQLITE_CONSTRAINT], it will do so before |
| 10331 | ** any modifications to internal or persistent data structures have been made. |
| @@ -10355,11 +10355,11 @@ | |
| 10355 | ** </dd> |
| 10356 | ** |
| 10357 | ** [[SQLITE_VTAB_INNOCUOUS]]<dt>SQLITE_VTAB_INNOCUOUS</dt> |
| 10358 | ** <dd>Calls of the form |
| 10359 | ** [sqlite3_vtab_config](db,SQLITE_VTAB_INNOCUOUS) from within the |
| 10360 | ** [xConnect] or [xCreate] methods of a [virtual table] implementation |
| 10361 | ** identify that virtual table as being safe to use from within triggers |
| 10362 | ** and views. Conceptually, the SQLITE_VTAB_INNOCUOUS tag means that the |
| 10363 | ** virtual table can do no serious harm even if it is controlled by a |
| 10364 | ** malicious hacker. Developers should avoid setting the SQLITE_VTAB_INNOCUOUS |
| 10365 | ** flag unless absolutely necessary. |
| @@ -10523,21 +10523,21 @@ | |
| 10523 | ** <tr><td>2<td>no<td>yes<td>yes |
| 10524 | ** <tr><td>3<td>yes<td>yes<td>yes |
| 10525 | ** </table> |
| 10526 | ** |
| 10527 | ** ^For the purposes of comparing virtual table output values to see if the |
| 10528 | ** values are the same value for sorting purposes, two NULL values are considered |
| 10529 | ** to be the same. In other words, the comparison operator is "IS" |
| 10530 | ** (or "IS NOT DISTINCT FROM") and not "==". |
| 10531 | ** |
| 10532 | ** If a virtual table implementation is unable to meet the requirements |
| 10533 | ** specified above, then it must not set the "orderByConsumed" flag in the |
| 10534 | ** [sqlite3_index_info] object or an incorrect answer may result. |
| 10535 | ** |
| 10536 | ** ^A virtual table implementation is always free to return rows in any order |
| 10537 | ** it wants, as long as the "orderByConsumed" flag is not set. ^When the |
| 10538 | ** "orderByConsumed" flag is unset, the query planner will add extra |
| 10539 | ** [bytecode] to ensure that the final results returned by the SQL query are |
| 10540 | ** ordered correctly. The use of the "orderByConsumed" flag and the |
| 10541 | ** sqlite3_vtab_distinct() interface is merely an optimization. ^Careful |
| 10542 | ** use of the sqlite3_vtab_distinct() interface and the "orderByConsumed" |
| 10543 | ** flag might help queries against a virtual table to run faster. Being |
| @@ -10630,11 +10630,11 @@ | |
| 10630 | ** |
| 10631 | ** The X parameter in a call to sqlite3_vtab_in_first(X,P) or |
| 10632 | ** sqlite3_vtab_in_next(X,P) should be one of the parameters to the |
| 10633 | ** xFilter method which invokes these routines, and specifically |
| 10634 | ** a parameter that was previously selected for all-at-once IN constraint |
| 10635 | ** processing using the [sqlite3_vtab_in()] interface in the |
| 10636 | ** [xBestIndex|xBestIndex method]. ^(If the X parameter is not |
| 10637 | ** an xFilter argument that was selected for all-at-once IN constraint |
| 10638 | ** processing, then these routines return [SQLITE_ERROR].)^ |
| 10639 | ** |
| 10640 | ** ^(Use these routines to access all values on the right-hand side |
| @@ -10685,11 +10685,11 @@ | |
| 10685 | ** right-hand operand is not known, then *V is set to a NULL pointer. |
| 10686 | ** ^The sqlite3_vtab_rhs_value(P,J,V) interface returns SQLITE_OK if |
| 10687 | ** and only if *V is set to a value. ^The sqlite3_vtab_rhs_value(P,J,V) |
| 10688 | ** inteface returns SQLITE_NOTFOUND if the right-hand side of the J-th |
| 10689 | ** constraint is not available. ^The sqlite3_vtab_rhs_value() interface |
| 10690 | ** can return a result code other than SQLITE_OK or SQLITE_NOTFOUND if |
| 10691 | ** something goes wrong. |
| 10692 | ** |
| 10693 | ** The sqlite3_vtab_rhs_value() interface is usually only successful if |
| 10694 | ** the right-hand operand of a constraint is a literal value in the original |
| 10695 | ** SQL statement. If the right-hand operand is an expression or a reference |
| @@ -10713,12 +10713,12 @@ | |
| 10713 | /* |
| 10714 | ** CAPI3REF: Conflict resolution modes |
| 10715 | ** KEYWORDS: {conflict resolution mode} |
| 10716 | ** |
| 10717 | ** These constants are returned by [sqlite3_vtab_on_conflict()] to |
| 10718 | ** inform a [virtual table] implementation of the [ON CONFLICT] mode |
| 10719 | ** for the SQL statement being evaluated. |
| 10720 | ** |
| 10721 | ** Note that the [SQLITE_IGNORE] constant is also used as a potential |
| 10722 | ** return value from the [sqlite3_set_authorizer()] callback and that |
| 10723 | ** [SQLITE_ABORT] is also a [result code]. |
| 10724 | */ |
| @@ -10754,43 +10754,43 @@ | |
| 10754 | ** to the total number of rows examined by all iterations of the X-th loop.</dd> |
| 10755 | ** |
| 10756 | ** [[SQLITE_SCANSTAT_EST]] <dt>SQLITE_SCANSTAT_EST</dt> |
| 10757 | ** <dd>^The "double" variable pointed to by the V parameter will be set to the |
| 10758 | ** query planner's estimate for the average number of rows output from each |
| 10759 | ** iteration of the X-th loop. If the query planner's estimate was accurate, |
| 10760 | ** then this value will approximate the quotient NVISIT/NLOOP and the |
| 10761 | ** product of this value for all prior loops with the same SELECTID will |
| 10762 | ** be the NLOOP value for the current loop.</dd> |
| 10763 | ** |
| 10764 | ** [[SQLITE_SCANSTAT_NAME]] <dt>SQLITE_SCANSTAT_NAME</dt> |
| 10765 | ** <dd>^The "const char *" variable pointed to by the V parameter will be set |
| 10766 | ** to a zero-terminated UTF-8 string containing the name of the index or table |
| 10767 | ** used for the X-th loop.</dd> |
| 10768 | ** |
| 10769 | ** [[SQLITE_SCANSTAT_EXPLAIN]] <dt>SQLITE_SCANSTAT_EXPLAIN</dt> |
| 10770 | ** <dd>^The "const char *" variable pointed to by the V parameter will be set |
| 10771 | ** to a zero-terminated UTF-8 string containing the [EXPLAIN QUERY PLAN] |
| 10772 | ** description for the X-th loop.</dd> |
| 10773 | ** |
| 10774 | ** [[SQLITE_SCANSTAT_SELECTID]] <dt>SQLITE_SCANSTAT_SELECTID</dt> |
| 10775 | ** <dd>^The "int" variable pointed to by the V parameter will be set to the |
| 10776 | ** id for the X-th query plan element. The id value is unique within the |
| 10777 | ** statement. The select-id is the same value as is output in the first |
| 10778 | ** column of an [EXPLAIN QUERY PLAN] query.</dd> |
| 10779 | ** |
| 10780 | ** [[SQLITE_SCANSTAT_PARENTID]] <dt>SQLITE_SCANSTAT_PARENTID</dt> |
| 10781 | ** <dd>The "int" variable pointed to by the V parameter will be set to the |
| 10782 | ** id of the parent of the current query element, if applicable, or |
| 10783 | ** to zero if the query element has no parent. This is the same value as |
| 10784 | ** returned in the second column of an [EXPLAIN QUERY PLAN] query.</dd> |
| 10785 | ** |
| 10786 | ** [[SQLITE_SCANSTAT_NCYCLE]] <dt>SQLITE_SCANSTAT_NCYCLE</dt> |
| 10787 | ** <dd>The sqlite3_int64 output value is set to the number of cycles, |
| 10788 | ** according to the processor time-stamp counter, that elapsed while the |
| 10789 | ** query element was being processed. This value is not available for |
| 10790 | ** all query elements - if it is unavailable the output variable is |
| 10791 | ** set to -1.</dd> |
| 10792 | ** </dl> |
| 10793 | */ |
| 10794 | #define SQLITE_SCANSTAT_NLOOP 0 |
| 10795 | #define SQLITE_SCANSTAT_NVISIT 1 |
| 10796 | #define SQLITE_SCANSTAT_EST 2 |
| @@ -10827,12 +10827,12 @@ | |
| 10827 | ** the EXPLAIN QUERY PLAN output) are available. Invoking API |
| 10828 | ** sqlite3_stmt_scanstatus() is equivalent to calling |
| 10829 | ** sqlite3_stmt_scanstatus_v2() with a zeroed flags parameter. |
| 10830 | ** |
| 10831 | ** Parameter "idx" identifies the specific query element to retrieve statistics |
| 10832 | ** for. Query elements are numbered starting from zero. A value of -1 may |
| 10833 | ** retrieve statistics for the entire query. ^If idx is out of range |
| 10834 | ** - less than -1 or greater than or equal to the total number of query |
| 10835 | ** elements used to implement the statement - a non-zero value is returned and |
| 10836 | ** the variable that pOut points to is unchanged. |
| 10837 | ** |
| 10838 | ** See also: [sqlite3_stmt_scanstatus_reset()] |
| @@ -10985,12 +10985,12 @@ | |
| 10985 | ** operation; or 1 for inserts, updates, or deletes invoked by top-level |
| 10986 | ** triggers; or 2 for changes resulting from triggers called by top-level |
| 10987 | ** triggers; and so forth. |
| 10988 | ** |
| 10989 | ** When the [sqlite3_blob_write()] API is used to update a blob column, |
| 10990 | ** the pre-update hook is invoked with SQLITE_DELETE, because |
| 10991 | ** the new values are not yet available. In this case, when a |
| 10992 | ** callback made with op==SQLITE_DELETE is actually a write using the |
| 10993 | ** sqlite3_blob_write() API, the [sqlite3_preupdate_blobwrite()] returns |
| 10994 | ** the index of the column being written. In other cases, where the |
| 10995 | ** pre-update hook is being invoked for some other reason, including a |
| 10996 | ** regular DELETE, sqlite3_preupdate_blobwrite() returns -1. |
| @@ -11239,20 +11239,20 @@ | |
| 11239 | ** is written into *P. |
| 11240 | ** |
| 11241 | ** For an ordinary on-disk database file, the serialization is just a |
| 11242 | ** copy of the disk file. For an in-memory database or a "TEMP" database, |
| 11243 | ** the serialization is the same sequence of bytes which would be written |
| 11244 | ** to disk if that database were backed up to disk. |
| 11245 | ** |
| 11246 | ** The usual case is that sqlite3_serialize() copies the serialization of |
| 11247 | ** the database into memory obtained from [sqlite3_malloc64()] and returns |
| 11248 | ** a pointer to that memory. The caller is responsible for freeing the |
| 11249 | ** returned value to avoid a memory leak. However, if the F argument |
| 11250 | ** contains the SQLITE_SERIALIZE_NOCOPY bit, then no memory allocations |
| 11251 | ** are made, and the sqlite3_serialize() function will return a pointer |
| 11252 | ** to the contiguous memory representation of the database that SQLite |
| 11253 | ** is currently using for that database, or NULL if no such contiguous |
| 11254 | ** memory representation of the database exists. A contiguous memory |
| 11255 | ** representation of the database will usually only exist if there has |
| 11256 | ** been a prior call to [sqlite3_deserialize(D,S,...)] with the same |
| 11257 | ** values of D and S. |
| 11258 | ** The size of the database is written into *P even if the |
| @@ -11319,11 +11319,11 @@ | |
| 11319 | ** |
| 11320 | ** The sqlite3_deserialize() interface will fail with SQLITE_BUSY if the |
| 11321 | ** database is currently in a read transaction or is involved in a backup |
| 11322 | ** operation. |
| 11323 | ** |
| 11324 | ** It is not possible to deserialize into the TEMP database. If the |
| 11325 | ** S argument to sqlite3_deserialize(D,S,P,N,M,F) is "temp" then the |
| 11326 | ** function returns SQLITE_ERROR. |
| 11327 | ** |
| 11328 | ** The deserialized database should not be in [WAL mode]. If the database |
| 11329 | ** is in WAL mode, then any attempt to use the database file will result |
| @@ -11341,19 +11341,19 @@ | |
| 11341 | */ |
| 11342 | SQLITE_API int sqlite3_deserialize( |
| 11343 | sqlite3 *db, /* The database connection */ |
| 11344 | const char *zSchema, /* Which DB to reopen with the deserialization */ |
| 11345 | unsigned char *pData, /* The serialized database content */ |
| 11346 | sqlite3_int64 szDb, /* Number of bytes in the deserialization */ |
| 11347 | sqlite3_int64 szBuf, /* Total size of buffer pData[] */ |
| 11348 | unsigned mFlags /* Zero or more SQLITE_DESERIALIZE_* flags */ |
| 11349 | ); |
| 11350 | |
| 11351 | /* |
| 11352 | ** CAPI3REF: Flags for sqlite3_deserialize() |
| 11353 | ** |
| 11354 | ** The following are allowed values for the 6th argument (the F argument) to |
| 11355 | ** the [sqlite3_deserialize(D,S,P,N,M,F)] interface. |
| 11356 | ** |
| 11357 | ** The SQLITE_DESERIALIZE_FREEONCLOSE means that the database serialization |
| 11358 | ** in the P argument is held in memory obtained from [sqlite3_malloc64()] |
| 11359 | ** and that SQLite should take ownership of this memory and automatically |
| @@ -112888,10 +112888,85 @@ | |
| 112888 | pExpr = pExpr->op==TK_AND ? pLeft : pRight; |
| 112889 | } |
| 112890 | } |
| 112891 | return pExpr; |
| 112892 | } |
| 112893 | |
| 112894 | /* |
| 112895 | ** Return true if it might be advantageous to compute the right operand |
| 112896 | ** of expression pExpr first, before the left operand. |
| 112897 | ** |
| 112898 | ** Normally the left operand is computed before the right operand. But if |
| 112899 | ** the left operand contains a subquery and the right does not, then it |
| 112900 | ** might be more efficient to compute the right operand first. |
| 112901 | */ |
| 112902 | static int exprEvalRhsFirst(Expr *pExpr){ |
| 112903 | if( ExprHasProperty(pExpr->pLeft, EP_Subquery) |
| 112904 | && !ExprHasProperty(pExpr->pRight, EP_Subquery) |
| 112905 | ){ |
| 112906 | return 1; |
| 112907 | }else{ |
| 112908 | return 0; |
| 112909 | } |
| 112910 | } |
| 112911 | |
| 112912 | /* |
| 112913 | ** Compute the two operands of a binary operator. |
| 112914 | ** |
| 112915 | ** If either operand contains a subquery, then the code strives to |
| 112916 | ** compute the operand containing the subquery second. If the other |
| 112917 | ** operand evalutes to NULL, then a jump is made. The address of the |
| 112918 | ** IsNull operand that does this jump is returned. The caller can use |
| 112919 | ** this to optimize the computation so as to avoid doing the potentially |
| 112920 | ** expensive subquery. |
| 112921 | ** |
| 112922 | ** If no optimization opportunities exist, return 0. |
| 112923 | */ |
| 112924 | static int exprComputeOperands( |
| 112925 | Parse *pParse, /* Parsing context */ |
| 112926 | Expr *pExpr, /* The comparison expression */ |
| 112927 | int *pR1, /* OUT: Register holding the left operand */ |
| 112928 | int *pR2, /* OUT: Register holding the right operand */ |
| 112929 | int *pFree1, /* OUT: Temp register to free if not zero */ |
| 112930 | int *pFree2 /* OUT: Another temp register to free if not zero */ |
| 112931 | ){ |
| 112932 | int addrIsNull; |
| 112933 | int r1, r2; |
| 112934 | Vdbe *v = pParse->pVdbe; |
| 112935 | |
| 112936 | assert( v!=0 ); |
| 112937 | /* |
| 112938 | ** If the left operand contains a (possibly expensive) subquery and the |
| 112939 | ** right operand does not and the right operation might be NULL, |
| 112940 | ** then compute the right operand first and do an IsNull jump if the |
| 112941 | ** right operand evalutes to NULL. |
| 112942 | */ |
| 112943 | if( exprEvalRhsFirst(pExpr) && sqlite3ExprCanBeNull(pExpr->pRight) ){ |
| 112944 | r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, pFree2); |
| 112945 | addrIsNull = sqlite3VdbeAddOp1(v, OP_IsNull, r2); VdbeCoverage(v); |
| 112946 | }else{ |
| 112947 | addrIsNull = 0; |
| 112948 | } |
| 112949 | r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, pFree1); |
| 112950 | if( addrIsNull==0 ){ |
| 112951 | /* |
| 112952 | ** If the right operand contains a subquery and the left operand does not |
| 112953 | ** and the left operand might be NULL, then check the left operand do |
| 112954 | ** an IsNull check on the left operand before computing the right |
| 112955 | ** operand. |
| 112956 | */ |
| 112957 | if( ExprHasProperty(pExpr->pRight, EP_Subquery) |
| 112958 | && sqlite3ExprCanBeNull(pExpr->pLeft) |
| 112959 | ){ |
| 112960 | addrIsNull = sqlite3VdbeAddOp1(v, OP_IsNull, r1); VdbeCoverage(v); |
| 112961 | } |
| 112962 | r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, pFree2); |
| 112963 | } |
| 112964 | *pR1 = r1; |
| 112965 | *pR2 = r2; |
| 112966 | return addrIsNull; |
| 112967 | } |
| 112968 | |
| 112969 | /* |
| 112970 | ** pExpr is a TK_FUNCTION node. Try to determine whether or not the |
| 112971 | ** function is a constant function. A function is constant if all of |
| 112972 | ** the following are true: |
| @@ -115477,15 +115552,21 @@ | |
| 115552 | case TK_GT: |
| 115553 | case TK_GE: |
| 115554 | case TK_NE: |
| 115555 | case TK_EQ: { |
| 115556 | Expr *pLeft = pExpr->pLeft; |
| 115557 | int addrIsNull = 0; |
| 115558 | if( sqlite3ExprIsVector(pLeft) ){ |
| 115559 | codeVectorCompare(pParse, pExpr, target, op, p5); |
| 115560 | }else{ |
| 115561 | if( ExprHasProperty(pExpr, EP_Subquery) && p5!=SQLITE_NULLEQ ){ |
| 115562 | addrIsNull = exprComputeOperands(pParse, pExpr, |
| 115563 | &r1, &r2, ®Free1, ®Free2); |
| 115564 | }else{ |
| 115565 | r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free1); |
| 115566 | r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, ®Free2); |
| 115567 | } |
| 115568 | sqlite3VdbeAddOp2(v, OP_Integer, 1, inReg); |
| 115569 | codeCompare(pParse, pLeft, pExpr->pRight, op, r1, r2, |
| 115570 | sqlite3VdbeCurrentAddr(v)+2, p5, |
| 115571 | ExprHasProperty(pExpr,EP_Commuted)); |
| 115572 | assert(TK_LT==OP_Lt); testcase(op==OP_Lt); VdbeCoverageIf(v,op==OP_Lt); |
| @@ -115496,13 +115577,19 @@ | |
| 115577 | assert(TK_NE==OP_Ne); testcase(op==OP_Ne); VdbeCoverageIf(v,op==OP_Ne); |
| 115578 | if( p5==SQLITE_NULLEQ ){ |
| 115579 | sqlite3VdbeAddOp2(v, OP_Integer, 0, inReg); |
| 115580 | }else{ |
| 115581 | sqlite3VdbeAddOp3(v, OP_ZeroOrNull, r1, inReg, r2); |
| 115582 | if( addrIsNull ){ |
| 115583 | sqlite3VdbeAddOp2(v, OP_Goto, 0, sqlite3VdbeCurrentAddr(v)+2); |
| 115584 | sqlite3VdbeJumpHere(v, addrIsNull); |
| 115585 | sqlite3VdbeAddOp2(v, OP_Null, 0, inReg); |
| 115586 | } |
| 115587 | } |
| 115588 | testcase( regFree1==0 ); |
| 115589 | testcase( regFree2==0 ); |
| 115590 | |
| 115591 | } |
| 115592 | break; |
| 115593 | } |
| 115594 | case TK_AND: |
| 115595 | case TK_OR: |
| @@ -115514,10 +115601,11 @@ | |
| 115601 | case TK_BITOR: |
| 115602 | case TK_SLASH: |
| 115603 | case TK_LSHIFT: |
| 115604 | case TK_RSHIFT: |
| 115605 | case TK_CONCAT: { |
| 115606 | int addrIsNull; |
| 115607 | assert( TK_AND==OP_And ); testcase( op==TK_AND ); |
| 115608 | assert( TK_OR==OP_Or ); testcase( op==TK_OR ); |
| 115609 | assert( TK_PLUS==OP_Add ); testcase( op==TK_PLUS ); |
| 115610 | assert( TK_MINUS==OP_Subtract ); testcase( op==TK_MINUS ); |
| 115611 | assert( TK_REM==OP_Remainder ); testcase( op==TK_REM ); |
| @@ -115525,15 +115613,26 @@ | |
| 115613 | assert( TK_BITOR==OP_BitOr ); testcase( op==TK_BITOR ); |
| 115614 | assert( TK_SLASH==OP_Divide ); testcase( op==TK_SLASH ); |
| 115615 | assert( TK_LSHIFT==OP_ShiftLeft ); testcase( op==TK_LSHIFT ); |
| 115616 | assert( TK_RSHIFT==OP_ShiftRight ); testcase( op==TK_RSHIFT ); |
| 115617 | assert( TK_CONCAT==OP_Concat ); testcase( op==TK_CONCAT ); |
| 115618 | if( ExprHasProperty(pExpr, EP_Subquery) ){ |
| 115619 | addrIsNull = exprComputeOperands(pParse, pExpr, |
| 115620 | &r1, &r2, ®Free1, ®Free2); |
| 115621 | }else{ |
| 115622 | r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free1); |
| 115623 | r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, ®Free2); |
| 115624 | addrIsNull = 0; |
| 115625 | } |
| 115626 | sqlite3VdbeAddOp3(v, op, r2, r1, target); |
| 115627 | testcase( regFree1==0 ); |
| 115628 | testcase( regFree2==0 ); |
| 115629 | if( addrIsNull ){ |
| 115630 | sqlite3VdbeAddOp2(v, OP_Goto, 0, sqlite3VdbeCurrentAddr(v)+2); |
| 115631 | sqlite3VdbeJumpHere(v, addrIsNull); |
| 115632 | sqlite3VdbeAddOp2(v, OP_Null, 0, target); |
| 115633 | } |
| 115634 | break; |
| 115635 | } |
| 115636 | case TK_UMINUS: { |
| 115637 | Expr *pLeft = pExpr->pLeft; |
| 115638 | assert( pLeft ); |
| @@ -116378,21 +116477,31 @@ | |
| 116477 | case TK_AND: |
| 116478 | case TK_OR: { |
| 116479 | Expr *pAlt = sqlite3ExprSimplifiedAndOr(pExpr); |
| 116480 | if( pAlt!=pExpr ){ |
| 116481 | sqlite3ExprIfTrue(pParse, pAlt, dest, jumpIfNull); |
| 116482 | }else{ |
| 116483 | Expr *pFirst, *pSecond; |
| 116484 | if( exprEvalRhsFirst(pExpr) ){ |
| 116485 | pFirst = pExpr->pRight; |
| 116486 | pSecond = pExpr->pLeft; |
| 116487 | }else{ |
| 116488 | pFirst = pExpr->pLeft; |
| 116489 | pSecond = pExpr->pRight; |
| 116490 | } |
| 116491 | if( op==TK_AND ){ |
| 116492 | int d2 = sqlite3VdbeMakeLabel(pParse); |
| 116493 | testcase( jumpIfNull==0 ); |
| 116494 | sqlite3ExprIfFalse(pParse, pFirst, d2, |
| 116495 | jumpIfNull^SQLITE_JUMPIFNULL); |
| 116496 | sqlite3ExprIfTrue(pParse, pSecond, dest, jumpIfNull); |
| 116497 | sqlite3VdbeResolveLabel(v, d2); |
| 116498 | }else{ |
| 116499 | testcase( jumpIfNull==0 ); |
| 116500 | sqlite3ExprIfTrue(pParse, pFirst, dest, jumpIfNull); |
| 116501 | sqlite3ExprIfTrue(pParse, pSecond, dest, jumpIfNull); |
| 116502 | } |
| 116503 | } |
| 116504 | break; |
| 116505 | } |
| 116506 | case TK_NOT: { |
| 116507 | testcase( jumpIfNull==0 ); |
| @@ -116427,14 +116536,20 @@ | |
| 116536 | case TK_LE: |
| 116537 | case TK_GT: |
| 116538 | case TK_GE: |
| 116539 | case TK_NE: |
| 116540 | case TK_EQ: { |
| 116541 | int addrIsNull; |
| 116542 | if( sqlite3ExprIsVector(pExpr->pLeft) ) goto default_expr; |
| 116543 | if( ExprHasProperty(pExpr, EP_Subquery) && jumpIfNull!=SQLITE_NULLEQ ){ |
| 116544 | addrIsNull = exprComputeOperands(pParse, pExpr, |
| 116545 | &r1, &r2, ®Free1, ®Free2); |
| 116546 | }else{ |
| 116547 | r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free1); |
| 116548 | r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, ®Free2); |
| 116549 | addrIsNull = 0; |
| 116550 | } |
| 116551 | codeCompare(pParse, pExpr->pLeft, pExpr->pRight, op, |
| 116552 | r1, r2, dest, jumpIfNull, ExprHasProperty(pExpr,EP_Commuted)); |
| 116553 | assert(TK_LT==OP_Lt); testcase(op==OP_Lt); VdbeCoverageIf(v,op==OP_Lt); |
| 116554 | assert(TK_LE==OP_Le); testcase(op==OP_Le); VdbeCoverageIf(v,op==OP_Le); |
| 116555 | assert(TK_GT==OP_Gt); testcase(op==OP_Gt); VdbeCoverageIf(v,op==OP_Gt); |
| @@ -116445,10 +116560,17 @@ | |
| 116560 | assert(TK_NE==OP_Ne); testcase(op==OP_Ne); |
| 116561 | VdbeCoverageIf(v, op==OP_Ne && jumpIfNull==SQLITE_NULLEQ); |
| 116562 | VdbeCoverageIf(v, op==OP_Ne && jumpIfNull!=SQLITE_NULLEQ); |
| 116563 | testcase( regFree1==0 ); |
| 116564 | testcase( regFree2==0 ); |
| 116565 | if( addrIsNull ){ |
| 116566 | if( jumpIfNull ){ |
| 116567 | sqlite3VdbeChangeP2(v, addrIsNull, dest); |
| 116568 | }else{ |
| 116569 | sqlite3VdbeJumpHere(v, addrIsNull); |
| 116570 | } |
| 116571 | } |
| 116572 | break; |
| 116573 | } |
| 116574 | case TK_ISNULL: |
| 116575 | case TK_NOTNULL: { |
| 116576 | assert( TK_ISNULL==OP_IsNull ); testcase( op==TK_ISNULL ); |
| @@ -116552,21 +116674,31 @@ | |
| 116674 | case TK_AND: |
| 116675 | case TK_OR: { |
| 116676 | Expr *pAlt = sqlite3ExprSimplifiedAndOr(pExpr); |
| 116677 | if( pAlt!=pExpr ){ |
| 116678 | sqlite3ExprIfFalse(pParse, pAlt, dest, jumpIfNull); |
| 116679 | }else{ |
| 116680 | Expr *pFirst, *pSecond; |
| 116681 | if( exprEvalRhsFirst(pExpr) ){ |
| 116682 | pFirst = pExpr->pRight; |
| 116683 | pSecond = pExpr->pLeft; |
| 116684 | }else{ |
| 116685 | pFirst = pExpr->pLeft; |
| 116686 | pSecond = pExpr->pRight; |
| 116687 | } |
| 116688 | if( pExpr->op==TK_AND ){ |
| 116689 | testcase( jumpIfNull==0 ); |
| 116690 | sqlite3ExprIfFalse(pParse, pFirst, dest, jumpIfNull); |
| 116691 | sqlite3ExprIfFalse(pParse, pSecond, dest, jumpIfNull); |
| 116692 | }else{ |
| 116693 | int d2 = sqlite3VdbeMakeLabel(pParse); |
| 116694 | testcase( jumpIfNull==0 ); |
| 116695 | sqlite3ExprIfTrue(pParse, pFirst, d2, |
| 116696 | jumpIfNull^SQLITE_JUMPIFNULL); |
| 116697 | sqlite3ExprIfFalse(pParse, pSecond, dest, jumpIfNull); |
| 116698 | sqlite3VdbeResolveLabel(v, d2); |
| 116699 | } |
| 116700 | } |
| 116701 | break; |
| 116702 | } |
| 116703 | case TK_NOT: { |
| 116704 | testcase( jumpIfNull==0 ); |
| @@ -116604,14 +116736,20 @@ | |
| 116736 | case TK_LE: |
| 116737 | case TK_GT: |
| 116738 | case TK_GE: |
| 116739 | case TK_NE: |
| 116740 | case TK_EQ: { |
| 116741 | int addrIsNull; |
| 116742 | if( sqlite3ExprIsVector(pExpr->pLeft) ) goto default_expr; |
| 116743 | if( ExprHasProperty(pExpr, EP_Subquery) && jumpIfNull!=SQLITE_NULLEQ ){ |
| 116744 | addrIsNull = exprComputeOperands(pParse, pExpr, |
| 116745 | &r1, &r2, ®Free1, ®Free2); |
| 116746 | }else{ |
| 116747 | r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free1); |
| 116748 | r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, ®Free2); |
| 116749 | addrIsNull = 0; |
| 116750 | } |
| 116751 | codeCompare(pParse, pExpr->pLeft, pExpr->pRight, op, |
| 116752 | r1, r2, dest, jumpIfNull,ExprHasProperty(pExpr,EP_Commuted)); |
| 116753 | assert(TK_LT==OP_Lt); testcase(op==OP_Lt); VdbeCoverageIf(v,op==OP_Lt); |
| 116754 | assert(TK_LE==OP_Le); testcase(op==OP_Le); VdbeCoverageIf(v,op==OP_Le); |
| 116755 | assert(TK_GT==OP_Gt); testcase(op==OP_Gt); VdbeCoverageIf(v,op==OP_Gt); |
| @@ -116622,10 +116760,17 @@ | |
| 116760 | assert(TK_NE==OP_Ne); testcase(op==OP_Ne); |
| 116761 | VdbeCoverageIf(v, op==OP_Ne && jumpIfNull!=SQLITE_NULLEQ); |
| 116762 | VdbeCoverageIf(v, op==OP_Ne && jumpIfNull==SQLITE_NULLEQ); |
| 116763 | testcase( regFree1==0 ); |
| 116764 | testcase( regFree2==0 ); |
| 116765 | if( addrIsNull ){ |
| 116766 | if( jumpIfNull ){ |
| 116767 | sqlite3VdbeChangeP2(v, addrIsNull, dest); |
| 116768 | }else{ |
| 116769 | sqlite3VdbeJumpHere(v, addrIsNull); |
| 116770 | } |
| 116771 | } |
| 116772 | break; |
| 116773 | } |
| 116774 | case TK_ISNULL: |
| 116775 | case TK_NOTNULL: { |
| 116776 | r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free1); |
| @@ -257503,11 +257648,11 @@ | |
| 257648 | int nArg, /* Number of args */ |
| 257649 | sqlite3_value **apUnused /* Function arguments */ |
| 257650 | ){ |
| 257651 | assert( nArg==0 ); |
| 257652 | UNUSED_PARAM2(nArg, apUnused); |
| 257653 | sqlite3_result_text(pCtx, "fts5: 2025-06-30 16:41:40 0083d5169a46104a25355bdd9d5a2f4027b049191ebda571dd228477ec217296", -1, SQLITE_TRANSIENT); |
| 257654 | } |
| 257655 | |
| 257656 | /* |
| 257657 | ** Implementation of fts5_locale(LOCALE, TEXT) function. |
| 257658 | ** |
| 257659 |
+43
-43
| --- extsrc/sqlite3.h | ||
| +++ extsrc/sqlite3.h | ||
| @@ -146,11 +146,11 @@ | ||
| 146 | 146 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 147 | 147 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 148 | 148 | */ |
| 149 | 149 | #define SQLITE_VERSION "3.51.0" |
| 150 | 150 | #define SQLITE_VERSION_NUMBER 3051000 |
| 151 | -#define SQLITE_SOURCE_ID "2025-06-27 19:02:21 5508b56fd24016c13981ec280ecdd833007c9d8dd595edb295b984c2b487b5c8" | |
| 151 | +#define SQLITE_SOURCE_ID "2025-06-30 16:41:40 0083d5169a46104a25355bdd9d5a2f4027b049191ebda571dd228477ec217296" | |
| 152 | 152 | |
| 153 | 153 | /* |
| 154 | 154 | ** CAPI3REF: Run-Time Library Version Numbers |
| 155 | 155 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 156 | 156 | ** |
| @@ -9056,48 +9056,48 @@ | ||
| 9056 | 9056 | ** careful use of indices.</dd> |
| 9057 | 9057 | ** |
| 9058 | 9058 | ** [[SQLITE_STMTSTATUS_SORT]] <dt>SQLITE_STMTSTATUS_SORT</dt> |
| 9059 | 9059 | ** <dd>^This is the number of sort operations that have occurred. |
| 9060 | 9060 | ** A non-zero value in this counter may indicate an opportunity to |
| 9061 | -** improvement performance through careful use of indices.</dd> | |
| 9061 | +** improve performance through careful use of indices.</dd> | |
| 9062 | 9062 | ** |
| 9063 | 9063 | ** [[SQLITE_STMTSTATUS_AUTOINDEX]] <dt>SQLITE_STMTSTATUS_AUTOINDEX</dt> |
| 9064 | 9064 | ** <dd>^This is the number of rows inserted into transient indices that |
| 9065 | 9065 | ** were created automatically in order to help joins run faster. |
| 9066 | 9066 | ** A non-zero value in this counter may indicate an opportunity to |
| 9067 | -** improvement performance by adding permanent indices that do not | |
| 9067 | +** improve performance by adding permanent indices that do not | |
| 9068 | 9068 | ** need to be reinitialized each time the statement is run.</dd> |
| 9069 | 9069 | ** |
| 9070 | 9070 | ** [[SQLITE_STMTSTATUS_VM_STEP]] <dt>SQLITE_STMTSTATUS_VM_STEP</dt> |
| 9071 | 9071 | ** <dd>^This is the number of virtual machine operations executed |
| 9072 | 9072 | ** by the prepared statement if that number is less than or equal |
| 9073 | 9073 | ** to 2147483647. The number of virtual machine operations can be |
| 9074 | 9074 | ** used as a proxy for the total work done by the prepared statement. |
| 9075 | 9075 | ** If the number of virtual machine operations exceeds 2147483647 |
| 9076 | -** then the value returned by this statement status code is undefined. | |
| 9076 | +** then the value returned by this statement status code is undefined.</dd> | |
| 9077 | 9077 | ** |
| 9078 | 9078 | ** [[SQLITE_STMTSTATUS_REPREPARE]] <dt>SQLITE_STMTSTATUS_REPREPARE</dt> |
| 9079 | 9079 | ** <dd>^This is the number of times that the prepare statement has been |
| 9080 | 9080 | ** automatically regenerated due to schema changes or changes to |
| 9081 | -** [bound parameters] that might affect the query plan. | |
| 9081 | +** [bound parameters] that might affect the query plan.</dd> | |
| 9082 | 9082 | ** |
| 9083 | 9083 | ** [[SQLITE_STMTSTATUS_RUN]] <dt>SQLITE_STMTSTATUS_RUN</dt> |
| 9084 | 9084 | ** <dd>^This is the number of times that the prepared statement has |
| 9085 | 9085 | ** been run. A single "run" for the purposes of this counter is one |
| 9086 | 9086 | ** or more calls to [sqlite3_step()] followed by a call to [sqlite3_reset()]. |
| 9087 | 9087 | ** The counter is incremented on the first [sqlite3_step()] call of each |
| 9088 | -** cycle. | |
| 9088 | +** cycle.</dd> | |
| 9089 | 9089 | ** |
| 9090 | 9090 | ** [[SQLITE_STMTSTATUS_FILTER_MISS]] |
| 9091 | 9091 | ** [[SQLITE_STMTSTATUS_FILTER HIT]] |
| 9092 | 9092 | ** <dt>SQLITE_STMTSTATUS_FILTER_HIT<br> |
| 9093 | 9093 | ** SQLITE_STMTSTATUS_FILTER_MISS</dt> |
| 9094 | 9094 | ** <dd>^SQLITE_STMTSTATUS_FILTER_HIT is the number of times that a join |
| 9095 | 9095 | ** step was bypassed because a Bloom filter returned not-found. The |
| 9096 | 9096 | ** corresponding SQLITE_STMTSTATUS_FILTER_MISS value is the number of |
| 9097 | 9097 | ** times that the Bloom filter returned a find, and thus the join step |
| 9098 | -** had to be processed as normal. | |
| 9098 | +** had to be processed as normal.</dd> | |
| 9099 | 9099 | ** |
| 9100 | 9100 | ** [[SQLITE_STMTSTATUS_MEMUSED]] <dt>SQLITE_STMTSTATUS_MEMUSED</dt> |
| 9101 | 9101 | ** <dd>^This is the approximate number of bytes of heap memory |
| 9102 | 9102 | ** used to store the prepared statement. ^This value is not actually |
| 9103 | 9103 | ** a counter, and so the resetFlg parameter to sqlite3_stmt_status() |
| @@ -9198,31 +9198,31 @@ | ||
| 9198 | 9198 | ** [[the xCreate() page cache methods]] |
| 9199 | 9199 | ** ^SQLite invokes the xCreate() method to construct a new cache instance. |
| 9200 | 9200 | ** SQLite will typically create one cache instance for each open database file, |
| 9201 | 9201 | ** though this is not guaranteed. ^The |
| 9202 | 9202 | ** first parameter, szPage, is the size in bytes of the pages that must |
| 9203 | -** be allocated by the cache. ^szPage will always a power of two. ^The | |
| 9203 | +** be allocated by the cache. ^szPage will always be a power of two. ^The | |
| 9204 | 9204 | ** second parameter szExtra is a number of bytes of extra storage |
| 9205 | -** associated with each page cache entry. ^The szExtra parameter will | |
| 9205 | +** associated with each page cache entry. ^The szExtra parameter will be | |
| 9206 | 9206 | ** a number less than 250. SQLite will use the |
| 9207 | 9207 | ** extra szExtra bytes on each page to store metadata about the underlying |
| 9208 | 9208 | ** database page on disk. The value passed into szExtra depends |
| 9209 | 9209 | ** on the SQLite version, the target platform, and how SQLite was compiled. |
| 9210 | 9210 | ** ^The third argument to xCreate(), bPurgeable, is true if the cache being |
| 9211 | 9211 | ** created will be used to cache database pages of a file stored on disk, or |
| 9212 | 9212 | ** false if it is used for an in-memory database. The cache implementation |
| 9213 | -** does not have to do anything special based with the value of bPurgeable; | |
| 9213 | +** does not have to do anything special based upon the value of bPurgeable; | |
| 9214 | 9214 | ** it is purely advisory. ^On a cache where bPurgeable is false, SQLite will |
| 9215 | 9215 | ** never invoke xUnpin() except to deliberately delete a page. |
| 9216 | 9216 | ** ^In other words, calls to xUnpin() on a cache with bPurgeable set to |
| 9217 | 9217 | ** false will always have the "discard" flag set to true. |
| 9218 | -** ^Hence, a cache created with bPurgeable false will | |
| 9218 | +** ^Hence, a cache created with bPurgeable set to false will | |
| 9219 | 9219 | ** never contain any unpinned pages. |
| 9220 | 9220 | ** |
| 9221 | 9221 | ** [[the xCachesize() page cache method]] |
| 9222 | 9222 | ** ^(The xCachesize() method may be called at any time by SQLite to set the |
| 9223 | -** suggested maximum cache-size (number of pages stored by) the cache | |
| 9223 | +** suggested maximum cache-size (number of pages stored) for the cache | |
| 9224 | 9224 | ** instance passed as the first argument. This is the value configured using |
| 9225 | 9225 | ** the SQLite "[PRAGMA cache_size]" command.)^ As with the bPurgeable |
| 9226 | 9226 | ** parameter, the implementation is not required to do anything with this |
| 9227 | 9227 | ** value; it is advisory only. |
| 9228 | 9228 | ** |
| @@ -9245,16 +9245,16 @@ | ||
| 9245 | 9245 | ** |
| 9246 | 9246 | ** If the requested page is already in the page cache, then the page cache |
| 9247 | 9247 | ** implementation must return a pointer to the page buffer with its content |
| 9248 | 9248 | ** intact. If the requested page is not already in the cache, then the |
| 9249 | 9249 | ** cache implementation should use the value of the createFlag |
| 9250 | -** parameter to help it determined what action to take: | |
| 9250 | +** parameter to help it determine what action to take: | |
| 9251 | 9251 | ** |
| 9252 | 9252 | ** <table border=1 width=85% align=center> |
| 9253 | 9253 | ** <tr><th> createFlag <th> Behavior when page is not already in cache |
| 9254 | 9254 | ** <tr><td> 0 <td> Do not allocate a new page. Return NULL. |
| 9255 | -** <tr><td> 1 <td> Allocate a new page if it easy and convenient to do so. | |
| 9255 | +** <tr><td> 1 <td> Allocate a new page if it is easy and convenient to do so. | |
| 9256 | 9256 | ** Otherwise return NULL. |
| 9257 | 9257 | ** <tr><td> 2 <td> Make every effort to allocate a new page. Only return |
| 9258 | 9258 | ** NULL if allocating a new page is effectively impossible. |
| 9259 | 9259 | ** </table> |
| 9260 | 9260 | ** |
| @@ -9267,11 +9267,11 @@ | ||
| 9267 | 9267 | ** [[the xUnpin() page cache method]] |
| 9268 | 9268 | ** ^xUnpin() is called by SQLite with a pointer to a currently pinned page |
| 9269 | 9269 | ** as its second argument. If the third parameter, discard, is non-zero, |
| 9270 | 9270 | ** then the page must be evicted from the cache. |
| 9271 | 9271 | ** ^If the discard parameter is |
| 9272 | -** zero, then the page may be discarded or retained at the discretion of | |
| 9272 | +** zero, then the page may be discarded or retained at the discretion of the | |
| 9273 | 9273 | ** page cache implementation. ^The page cache implementation |
| 9274 | 9274 | ** may choose to evict unpinned pages at any time. |
| 9275 | 9275 | ** |
| 9276 | 9276 | ** The cache must not perform any reference counting. A single |
| 9277 | 9277 | ** call to xUnpin() unpins the page regardless of the number of prior calls |
| @@ -9285,11 +9285,11 @@ | ||
| 9285 | 9285 | ** to be pinned. |
| 9286 | 9286 | ** |
| 9287 | 9287 | ** When SQLite calls the xTruncate() method, the cache must discard all |
| 9288 | 9288 | ** existing cache entries with page numbers (keys) greater than or equal |
| 9289 | 9289 | ** to the value of the iLimit parameter passed to xTruncate(). If any |
| 9290 | -** of these pages are pinned, they are implicitly unpinned, meaning that | |
| 9290 | +** of these pages are pinned, they become implicitly unpinned, meaning that | |
| 9291 | 9291 | ** they can be safely discarded. |
| 9292 | 9292 | ** |
| 9293 | 9293 | ** [[the xDestroy() page cache method]] |
| 9294 | 9294 | ** ^The xDestroy() method is used to delete a cache allocated by xCreate(). |
| 9295 | 9295 | ** All resources associated with the specified cache should be freed. ^After |
| @@ -9584,11 +9584,11 @@ | ||
| 9584 | 9584 | ** identity of the database connection (the blocking connection) that |
| 9585 | 9585 | ** has locked the required resource is stored internally. ^After an |
| 9586 | 9586 | ** application receives an SQLITE_LOCKED error, it may call the |
| 9587 | 9587 | ** sqlite3_unlock_notify() method with the blocked connection handle as |
| 9588 | 9588 | ** the first argument to register for a callback that will be invoked |
| 9589 | -** when the blocking connections current transaction is concluded. ^The | |
| 9589 | +** when the blocking connection's current transaction is concluded. ^The | |
| 9590 | 9590 | ** callback is invoked from within the [sqlite3_step] or [sqlite3_close] |
| 9591 | 9591 | ** call that concludes the blocking connection's transaction. |
| 9592 | 9592 | ** |
| 9593 | 9593 | ** ^(If sqlite3_unlock_notify() is called in a multi-threaded application, |
| 9594 | 9594 | ** there is a chance that the blocking connection will have already |
| @@ -9604,11 +9604,11 @@ | ||
| 9604 | 9604 | ** ^(There may be at most one unlock-notify callback registered by a |
| 9605 | 9605 | ** blocked connection. If sqlite3_unlock_notify() is called when the |
| 9606 | 9606 | ** blocked connection already has a registered unlock-notify callback, |
| 9607 | 9607 | ** then the new callback replaces the old.)^ ^If sqlite3_unlock_notify() is |
| 9608 | 9608 | ** called with a NULL pointer as its second argument, then any existing |
| 9609 | -** unlock-notify callback is canceled. ^The blocked connections | |
| 9609 | +** unlock-notify callback is canceled. ^The blocked connection's | |
| 9610 | 9610 | ** unlock-notify callback may also be canceled by closing the blocked |
| 9611 | 9611 | ** connection using [sqlite3_close()]. |
| 9612 | 9612 | ** |
| 9613 | 9613 | ** The unlock-notify callback is not reentrant. If an application invokes |
| 9614 | 9614 | ** any sqlite3_xxx API functions from within an unlock-notify callback, a |
| @@ -10002,11 +10002,11 @@ | ||
| 10002 | 10002 | ** where X is an integer. If X is zero, then the [virtual table] whose |
| 10003 | 10003 | ** [xCreate] or [xConnect] method invoked [sqlite3_vtab_config()] does not |
| 10004 | 10004 | ** support constraints. In this configuration (which is the default) if |
| 10005 | 10005 | ** a call to the [xUpdate] method returns [SQLITE_CONSTRAINT], then the entire |
| 10006 | 10006 | ** statement is rolled back as if [ON CONFLICT | OR ABORT] had been |
| 10007 | -** specified as part of the users SQL statement, regardless of the actual | |
| 10007 | +** specified as part of the user's SQL statement, regardless of the actual | |
| 10008 | 10008 | ** ON CONFLICT mode specified. |
| 10009 | 10009 | ** |
| 10010 | 10010 | ** If X is non-zero, then the virtual table implementation guarantees |
| 10011 | 10011 | ** that if [xUpdate] returns [SQLITE_CONSTRAINT], it will do so before |
| 10012 | 10012 | ** any modifications to internal or persistent data structures have been made. |
| @@ -10036,11 +10036,11 @@ | ||
| 10036 | 10036 | ** </dd> |
| 10037 | 10037 | ** |
| 10038 | 10038 | ** [[SQLITE_VTAB_INNOCUOUS]]<dt>SQLITE_VTAB_INNOCUOUS</dt> |
| 10039 | 10039 | ** <dd>Calls of the form |
| 10040 | 10040 | ** [sqlite3_vtab_config](db,SQLITE_VTAB_INNOCUOUS) from within the |
| 10041 | -** the [xConnect] or [xCreate] methods of a [virtual table] implementation | |
| 10041 | +** [xConnect] or [xCreate] methods of a [virtual table] implementation | |
| 10042 | 10042 | ** identify that virtual table as being safe to use from within triggers |
| 10043 | 10043 | ** and views. Conceptually, the SQLITE_VTAB_INNOCUOUS tag means that the |
| 10044 | 10044 | ** virtual table can do no serious harm even if it is controlled by a |
| 10045 | 10045 | ** malicious hacker. Developers should avoid setting the SQLITE_VTAB_INNOCUOUS |
| 10046 | 10046 | ** flag unless absolutely necessary. |
| @@ -10204,21 +10204,21 @@ | ||
| 10204 | 10204 | ** <tr><td>2<td>no<td>yes<td>yes |
| 10205 | 10205 | ** <tr><td>3<td>yes<td>yes<td>yes |
| 10206 | 10206 | ** </table> |
| 10207 | 10207 | ** |
| 10208 | 10208 | ** ^For the purposes of comparing virtual table output values to see if the |
| 10209 | -** values are same value for sorting purposes, two NULL values are considered | |
| 10209 | +** values are the same value for sorting purposes, two NULL values are considered | |
| 10210 | 10210 | ** to be the same. In other words, the comparison operator is "IS" |
| 10211 | 10211 | ** (or "IS NOT DISTINCT FROM") and not "==". |
| 10212 | 10212 | ** |
| 10213 | 10213 | ** If a virtual table implementation is unable to meet the requirements |
| 10214 | 10214 | ** specified above, then it must not set the "orderByConsumed" flag in the |
| 10215 | 10215 | ** [sqlite3_index_info] object or an incorrect answer may result. |
| 10216 | 10216 | ** |
| 10217 | 10217 | ** ^A virtual table implementation is always free to return rows in any order |
| 10218 | 10218 | ** it wants, as long as the "orderByConsumed" flag is not set. ^When the |
| 10219 | -** the "orderByConsumed" flag is unset, the query planner will add extra | |
| 10219 | +** "orderByConsumed" flag is unset, the query planner will add extra | |
| 10220 | 10220 | ** [bytecode] to ensure that the final results returned by the SQL query are |
| 10221 | 10221 | ** ordered correctly. The use of the "orderByConsumed" flag and the |
| 10222 | 10222 | ** sqlite3_vtab_distinct() interface is merely an optimization. ^Careful |
| 10223 | 10223 | ** use of the sqlite3_vtab_distinct() interface and the "orderByConsumed" |
| 10224 | 10224 | ** flag might help queries against a virtual table to run faster. Being |
| @@ -10311,11 +10311,11 @@ | ||
| 10311 | 10311 | ** |
| 10312 | 10312 | ** The X parameter in a call to sqlite3_vtab_in_first(X,P) or |
| 10313 | 10313 | ** sqlite3_vtab_in_next(X,P) should be one of the parameters to the |
| 10314 | 10314 | ** xFilter method which invokes these routines, and specifically |
| 10315 | 10315 | ** a parameter that was previously selected for all-at-once IN constraint |
| 10316 | -** processing use the [sqlite3_vtab_in()] interface in the | |
| 10316 | +** processing using the [sqlite3_vtab_in()] interface in the | |
| 10317 | 10317 | ** [xBestIndex|xBestIndex method]. ^(If the X parameter is not |
| 10318 | 10318 | ** an xFilter argument that was selected for all-at-once IN constraint |
| 10319 | 10319 | ** processing, then these routines return [SQLITE_ERROR].)^ |
| 10320 | 10320 | ** |
| 10321 | 10321 | ** ^(Use these routines to access all values on the right-hand side |
| @@ -10366,11 +10366,11 @@ | ||
| 10366 | 10366 | ** right-hand operand is not known, then *V is set to a NULL pointer. |
| 10367 | 10367 | ** ^The sqlite3_vtab_rhs_value(P,J,V) interface returns SQLITE_OK if |
| 10368 | 10368 | ** and only if *V is set to a value. ^The sqlite3_vtab_rhs_value(P,J,V) |
| 10369 | 10369 | ** inteface returns SQLITE_NOTFOUND if the right-hand side of the J-th |
| 10370 | 10370 | ** constraint is not available. ^The sqlite3_vtab_rhs_value() interface |
| 10371 | -** can return an result code other than SQLITE_OK or SQLITE_NOTFOUND if | |
| 10371 | +** can return a result code other than SQLITE_OK or SQLITE_NOTFOUND if | |
| 10372 | 10372 | ** something goes wrong. |
| 10373 | 10373 | ** |
| 10374 | 10374 | ** The sqlite3_vtab_rhs_value() interface is usually only successful if |
| 10375 | 10375 | ** the right-hand operand of a constraint is a literal value in the original |
| 10376 | 10376 | ** SQL statement. If the right-hand operand is an expression or a reference |
| @@ -10394,12 +10394,12 @@ | ||
| 10394 | 10394 | /* |
| 10395 | 10395 | ** CAPI3REF: Conflict resolution modes |
| 10396 | 10396 | ** KEYWORDS: {conflict resolution mode} |
| 10397 | 10397 | ** |
| 10398 | 10398 | ** These constants are returned by [sqlite3_vtab_on_conflict()] to |
| 10399 | -** inform a [virtual table] implementation what the [ON CONFLICT] mode | |
| 10400 | -** is for the SQL statement being evaluated. | |
| 10399 | +** inform a [virtual table] implementation of the [ON CONFLICT] mode | |
| 10400 | +** for the SQL statement being evaluated. | |
| 10401 | 10401 | ** |
| 10402 | 10402 | ** Note that the [SQLITE_IGNORE] constant is also used as a potential |
| 10403 | 10403 | ** return value from the [sqlite3_set_authorizer()] callback and that |
| 10404 | 10404 | ** [SQLITE_ABORT] is also a [result code]. |
| 10405 | 10405 | */ |
| @@ -10435,43 +10435,43 @@ | ||
| 10435 | 10435 | ** to the total number of rows examined by all iterations of the X-th loop.</dd> |
| 10436 | 10436 | ** |
| 10437 | 10437 | ** [[SQLITE_SCANSTAT_EST]] <dt>SQLITE_SCANSTAT_EST</dt> |
| 10438 | 10438 | ** <dd>^The "double" variable pointed to by the V parameter will be set to the |
| 10439 | 10439 | ** query planner's estimate for the average number of rows output from each |
| 10440 | -** iteration of the X-th loop. If the query planner's estimates was accurate, | |
| 10440 | +** iteration of the X-th loop. If the query planner's estimate was accurate, | |
| 10441 | 10441 | ** then this value will approximate the quotient NVISIT/NLOOP and the |
| 10442 | 10442 | ** product of this value for all prior loops with the same SELECTID will |
| 10443 | -** be the NLOOP value for the current loop. | |
| 10443 | +** be the NLOOP value for the current loop.</dd> | |
| 10444 | 10444 | ** |
| 10445 | 10445 | ** [[SQLITE_SCANSTAT_NAME]] <dt>SQLITE_SCANSTAT_NAME</dt> |
| 10446 | 10446 | ** <dd>^The "const char *" variable pointed to by the V parameter will be set |
| 10447 | 10447 | ** to a zero-terminated UTF-8 string containing the name of the index or table |
| 10448 | -** used for the X-th loop. | |
| 10448 | +** used for the X-th loop.</dd> | |
| 10449 | 10449 | ** |
| 10450 | 10450 | ** [[SQLITE_SCANSTAT_EXPLAIN]] <dt>SQLITE_SCANSTAT_EXPLAIN</dt> |
| 10451 | 10451 | ** <dd>^The "const char *" variable pointed to by the V parameter will be set |
| 10452 | 10452 | ** to a zero-terminated UTF-8 string containing the [EXPLAIN QUERY PLAN] |
| 10453 | -** description for the X-th loop. | |
| 10453 | +** description for the X-th loop.</dd> | |
| 10454 | 10454 | ** |
| 10455 | 10455 | ** [[SQLITE_SCANSTAT_SELECTID]] <dt>SQLITE_SCANSTAT_SELECTID</dt> |
| 10456 | 10456 | ** <dd>^The "int" variable pointed to by the V parameter will be set to the |
| 10457 | 10457 | ** id for the X-th query plan element. The id value is unique within the |
| 10458 | 10458 | ** statement. The select-id is the same value as is output in the first |
| 10459 | -** column of an [EXPLAIN QUERY PLAN] query. | |
| 10459 | +** column of an [EXPLAIN QUERY PLAN] query.</dd> | |
| 10460 | 10460 | ** |
| 10461 | 10461 | ** [[SQLITE_SCANSTAT_PARENTID]] <dt>SQLITE_SCANSTAT_PARENTID</dt> |
| 10462 | 10462 | ** <dd>The "int" variable pointed to by the V parameter will be set to the |
| 10463 | -** the id of the parent of the current query element, if applicable, or | |
| 10463 | +** id of the parent of the current query element, if applicable, or | |
| 10464 | 10464 | ** to zero if the query element has no parent. This is the same value as |
| 10465 | -** returned in the second column of an [EXPLAIN QUERY PLAN] query. | |
| 10465 | +** returned in the second column of an [EXPLAIN QUERY PLAN] query.</dd> | |
| 10466 | 10466 | ** |
| 10467 | 10467 | ** [[SQLITE_SCANSTAT_NCYCLE]] <dt>SQLITE_SCANSTAT_NCYCLE</dt> |
| 10468 | 10468 | ** <dd>The sqlite3_int64 output value is set to the number of cycles, |
| 10469 | 10469 | ** according to the processor time-stamp counter, that elapsed while the |
| 10470 | 10470 | ** query element was being processed. This value is not available for |
| 10471 | 10471 | ** all query elements - if it is unavailable the output variable is |
| 10472 | -** set to -1. | |
| 10472 | +** set to -1.</dd> | |
| 10473 | 10473 | ** </dl> |
| 10474 | 10474 | */ |
| 10475 | 10475 | #define SQLITE_SCANSTAT_NLOOP 0 |
| 10476 | 10476 | #define SQLITE_SCANSTAT_NVISIT 1 |
| 10477 | 10477 | #define SQLITE_SCANSTAT_EST 2 |
| @@ -10508,12 +10508,12 @@ | ||
| 10508 | 10508 | ** the EXPLAIN QUERY PLAN output) are available. Invoking API |
| 10509 | 10509 | ** sqlite3_stmt_scanstatus() is equivalent to calling |
| 10510 | 10510 | ** sqlite3_stmt_scanstatus_v2() with a zeroed flags parameter. |
| 10511 | 10511 | ** |
| 10512 | 10512 | ** Parameter "idx" identifies the specific query element to retrieve statistics |
| 10513 | -** for. Query elements are numbered starting from zero. A value of -1 may be | |
| 10514 | -** to query for statistics regarding the entire query. ^If idx is out of range | |
| 10513 | +** for. Query elements are numbered starting from zero. A value of -1 may | |
| 10514 | +** retrieve statistics for the entire query. ^If idx is out of range | |
| 10515 | 10515 | ** - less than -1 or greater than or equal to the total number of query |
| 10516 | 10516 | ** elements used to implement the statement - a non-zero value is returned and |
| 10517 | 10517 | ** the variable that pOut points to is unchanged. |
| 10518 | 10518 | ** |
| 10519 | 10519 | ** See also: [sqlite3_stmt_scanstatus_reset()] |
| @@ -10666,12 +10666,12 @@ | ||
| 10666 | 10666 | ** operation; or 1 for inserts, updates, or deletes invoked by top-level |
| 10667 | 10667 | ** triggers; or 2 for changes resulting from triggers called by top-level |
| 10668 | 10668 | ** triggers; and so forth. |
| 10669 | 10669 | ** |
| 10670 | 10670 | ** When the [sqlite3_blob_write()] API is used to update a blob column, |
| 10671 | -** the pre-update hook is invoked with SQLITE_DELETE. This is because the | |
| 10672 | -** in this case the new values are not available. In this case, when a | |
| 10671 | +** the pre-update hook is invoked with SQLITE_DELETE, because | |
| 10672 | +** the new values are not yet available. In this case, when a | |
| 10673 | 10673 | ** callback made with op==SQLITE_DELETE is actually a write using the |
| 10674 | 10674 | ** sqlite3_blob_write() API, the [sqlite3_preupdate_blobwrite()] returns |
| 10675 | 10675 | ** the index of the column being written. In other cases, where the |
| 10676 | 10676 | ** pre-update hook is being invoked for some other reason, including a |
| 10677 | 10677 | ** regular DELETE, sqlite3_preupdate_blobwrite() returns -1. |
| @@ -10920,20 +10920,20 @@ | ||
| 10920 | 10920 | ** is written into *P. |
| 10921 | 10921 | ** |
| 10922 | 10922 | ** For an ordinary on-disk database file, the serialization is just a |
| 10923 | 10923 | ** copy of the disk file. For an in-memory database or a "TEMP" database, |
| 10924 | 10924 | ** the serialization is the same sequence of bytes which would be written |
| 10925 | -** to disk if that database where backed up to disk. | |
| 10925 | +** to disk if that database were backed up to disk. | |
| 10926 | 10926 | ** |
| 10927 | 10927 | ** The usual case is that sqlite3_serialize() copies the serialization of |
| 10928 | 10928 | ** the database into memory obtained from [sqlite3_malloc64()] and returns |
| 10929 | 10929 | ** a pointer to that memory. The caller is responsible for freeing the |
| 10930 | 10930 | ** returned value to avoid a memory leak. However, if the F argument |
| 10931 | 10931 | ** contains the SQLITE_SERIALIZE_NOCOPY bit, then no memory allocations |
| 10932 | 10932 | ** are made, and the sqlite3_serialize() function will return a pointer |
| 10933 | 10933 | ** to the contiguous memory representation of the database that SQLite |
| 10934 | -** is currently using for that database, or NULL if the no such contiguous | |
| 10934 | +** is currently using for that database, or NULL if no such contiguous | |
| 10935 | 10935 | ** memory representation of the database exists. A contiguous memory |
| 10936 | 10936 | ** representation of the database will usually only exist if there has |
| 10937 | 10937 | ** been a prior call to [sqlite3_deserialize(D,S,...)] with the same |
| 10938 | 10938 | ** values of D and S. |
| 10939 | 10939 | ** The size of the database is written into *P even if the |
| @@ -11000,11 +11000,11 @@ | ||
| 11000 | 11000 | ** |
| 11001 | 11001 | ** The sqlite3_deserialize() interface will fail with SQLITE_BUSY if the |
| 11002 | 11002 | ** database is currently in a read transaction or is involved in a backup |
| 11003 | 11003 | ** operation. |
| 11004 | 11004 | ** |
| 11005 | -** It is not possible to deserialized into the TEMP database. If the | |
| 11005 | +** It is not possible to deserialize into the TEMP database. If the | |
| 11006 | 11006 | ** S argument to sqlite3_deserialize(D,S,P,N,M,F) is "temp" then the |
| 11007 | 11007 | ** function returns SQLITE_ERROR. |
| 11008 | 11008 | ** |
| 11009 | 11009 | ** The deserialized database should not be in [WAL mode]. If the database |
| 11010 | 11010 | ** is in WAL mode, then any attempt to use the database file will result |
| @@ -11022,19 +11022,19 @@ | ||
| 11022 | 11022 | */ |
| 11023 | 11023 | SQLITE_API int sqlite3_deserialize( |
| 11024 | 11024 | sqlite3 *db, /* The database connection */ |
| 11025 | 11025 | const char *zSchema, /* Which DB to reopen with the deserialization */ |
| 11026 | 11026 | unsigned char *pData, /* The serialized database content */ |
| 11027 | - sqlite3_int64 szDb, /* Number bytes in the deserialization */ | |
| 11027 | + sqlite3_int64 szDb, /* Number of bytes in the deserialization */ | |
| 11028 | 11028 | sqlite3_int64 szBuf, /* Total size of buffer pData[] */ |
| 11029 | 11029 | unsigned mFlags /* Zero or more SQLITE_DESERIALIZE_* flags */ |
| 11030 | 11030 | ); |
| 11031 | 11031 | |
| 11032 | 11032 | /* |
| 11033 | 11033 | ** CAPI3REF: Flags for sqlite3_deserialize() |
| 11034 | 11034 | ** |
| 11035 | -** The following are allowed values for 6th argument (the F argument) to | |
| 11035 | +** The following are allowed values for the 6th argument (the F argument) to | |
| 11036 | 11036 | ** the [sqlite3_deserialize(D,S,P,N,M,F)] interface. |
| 11037 | 11037 | ** |
| 11038 | 11038 | ** The SQLITE_DESERIALIZE_FREEONCLOSE means that the database serialization |
| 11039 | 11039 | ** in the P argument is held in memory obtained from [sqlite3_malloc64()] |
| 11040 | 11040 | ** and that SQLite should take ownership of this memory and automatically |
| 11041 | 11041 |
| --- extsrc/sqlite3.h | |
| +++ extsrc/sqlite3.h | |
| @@ -146,11 +146,11 @@ | |
| 146 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 147 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 148 | */ |
| 149 | #define SQLITE_VERSION "3.51.0" |
| 150 | #define SQLITE_VERSION_NUMBER 3051000 |
| 151 | #define SQLITE_SOURCE_ID "2025-06-27 19:02:21 5508b56fd24016c13981ec280ecdd833007c9d8dd595edb295b984c2b487b5c8" |
| 152 | |
| 153 | /* |
| 154 | ** CAPI3REF: Run-Time Library Version Numbers |
| 155 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 156 | ** |
| @@ -9056,48 +9056,48 @@ | |
| 9056 | ** careful use of indices.</dd> |
| 9057 | ** |
| 9058 | ** [[SQLITE_STMTSTATUS_SORT]] <dt>SQLITE_STMTSTATUS_SORT</dt> |
| 9059 | ** <dd>^This is the number of sort operations that have occurred. |
| 9060 | ** A non-zero value in this counter may indicate an opportunity to |
| 9061 | ** improvement performance through careful use of indices.</dd> |
| 9062 | ** |
| 9063 | ** [[SQLITE_STMTSTATUS_AUTOINDEX]] <dt>SQLITE_STMTSTATUS_AUTOINDEX</dt> |
| 9064 | ** <dd>^This is the number of rows inserted into transient indices that |
| 9065 | ** were created automatically in order to help joins run faster. |
| 9066 | ** A non-zero value in this counter may indicate an opportunity to |
| 9067 | ** improvement performance by adding permanent indices that do not |
| 9068 | ** need to be reinitialized each time the statement is run.</dd> |
| 9069 | ** |
| 9070 | ** [[SQLITE_STMTSTATUS_VM_STEP]] <dt>SQLITE_STMTSTATUS_VM_STEP</dt> |
| 9071 | ** <dd>^This is the number of virtual machine operations executed |
| 9072 | ** by the prepared statement if that number is less than or equal |
| 9073 | ** to 2147483647. The number of virtual machine operations can be |
| 9074 | ** used as a proxy for the total work done by the prepared statement. |
| 9075 | ** If the number of virtual machine operations exceeds 2147483647 |
| 9076 | ** then the value returned by this statement status code is undefined. |
| 9077 | ** |
| 9078 | ** [[SQLITE_STMTSTATUS_REPREPARE]] <dt>SQLITE_STMTSTATUS_REPREPARE</dt> |
| 9079 | ** <dd>^This is the number of times that the prepare statement has been |
| 9080 | ** automatically regenerated due to schema changes or changes to |
| 9081 | ** [bound parameters] that might affect the query plan. |
| 9082 | ** |
| 9083 | ** [[SQLITE_STMTSTATUS_RUN]] <dt>SQLITE_STMTSTATUS_RUN</dt> |
| 9084 | ** <dd>^This is the number of times that the prepared statement has |
| 9085 | ** been run. A single "run" for the purposes of this counter is one |
| 9086 | ** or more calls to [sqlite3_step()] followed by a call to [sqlite3_reset()]. |
| 9087 | ** The counter is incremented on the first [sqlite3_step()] call of each |
| 9088 | ** cycle. |
| 9089 | ** |
| 9090 | ** [[SQLITE_STMTSTATUS_FILTER_MISS]] |
| 9091 | ** [[SQLITE_STMTSTATUS_FILTER HIT]] |
| 9092 | ** <dt>SQLITE_STMTSTATUS_FILTER_HIT<br> |
| 9093 | ** SQLITE_STMTSTATUS_FILTER_MISS</dt> |
| 9094 | ** <dd>^SQLITE_STMTSTATUS_FILTER_HIT is the number of times that a join |
| 9095 | ** step was bypassed because a Bloom filter returned not-found. The |
| 9096 | ** corresponding SQLITE_STMTSTATUS_FILTER_MISS value is the number of |
| 9097 | ** times that the Bloom filter returned a find, and thus the join step |
| 9098 | ** had to be processed as normal. |
| 9099 | ** |
| 9100 | ** [[SQLITE_STMTSTATUS_MEMUSED]] <dt>SQLITE_STMTSTATUS_MEMUSED</dt> |
| 9101 | ** <dd>^This is the approximate number of bytes of heap memory |
| 9102 | ** used to store the prepared statement. ^This value is not actually |
| 9103 | ** a counter, and so the resetFlg parameter to sqlite3_stmt_status() |
| @@ -9198,31 +9198,31 @@ | |
| 9198 | ** [[the xCreate() page cache methods]] |
| 9199 | ** ^SQLite invokes the xCreate() method to construct a new cache instance. |
| 9200 | ** SQLite will typically create one cache instance for each open database file, |
| 9201 | ** though this is not guaranteed. ^The |
| 9202 | ** first parameter, szPage, is the size in bytes of the pages that must |
| 9203 | ** be allocated by the cache. ^szPage will always a power of two. ^The |
| 9204 | ** second parameter szExtra is a number of bytes of extra storage |
| 9205 | ** associated with each page cache entry. ^The szExtra parameter will |
| 9206 | ** a number less than 250. SQLite will use the |
| 9207 | ** extra szExtra bytes on each page to store metadata about the underlying |
| 9208 | ** database page on disk. The value passed into szExtra depends |
| 9209 | ** on the SQLite version, the target platform, and how SQLite was compiled. |
| 9210 | ** ^The third argument to xCreate(), bPurgeable, is true if the cache being |
| 9211 | ** created will be used to cache database pages of a file stored on disk, or |
| 9212 | ** false if it is used for an in-memory database. The cache implementation |
| 9213 | ** does not have to do anything special based with the value of bPurgeable; |
| 9214 | ** it is purely advisory. ^On a cache where bPurgeable is false, SQLite will |
| 9215 | ** never invoke xUnpin() except to deliberately delete a page. |
| 9216 | ** ^In other words, calls to xUnpin() on a cache with bPurgeable set to |
| 9217 | ** false will always have the "discard" flag set to true. |
| 9218 | ** ^Hence, a cache created with bPurgeable false will |
| 9219 | ** never contain any unpinned pages. |
| 9220 | ** |
| 9221 | ** [[the xCachesize() page cache method]] |
| 9222 | ** ^(The xCachesize() method may be called at any time by SQLite to set the |
| 9223 | ** suggested maximum cache-size (number of pages stored by) the cache |
| 9224 | ** instance passed as the first argument. This is the value configured using |
| 9225 | ** the SQLite "[PRAGMA cache_size]" command.)^ As with the bPurgeable |
| 9226 | ** parameter, the implementation is not required to do anything with this |
| 9227 | ** value; it is advisory only. |
| 9228 | ** |
| @@ -9245,16 +9245,16 @@ | |
| 9245 | ** |
| 9246 | ** If the requested page is already in the page cache, then the page cache |
| 9247 | ** implementation must return a pointer to the page buffer with its content |
| 9248 | ** intact. If the requested page is not already in the cache, then the |
| 9249 | ** cache implementation should use the value of the createFlag |
| 9250 | ** parameter to help it determined what action to take: |
| 9251 | ** |
| 9252 | ** <table border=1 width=85% align=center> |
| 9253 | ** <tr><th> createFlag <th> Behavior when page is not already in cache |
| 9254 | ** <tr><td> 0 <td> Do not allocate a new page. Return NULL. |
| 9255 | ** <tr><td> 1 <td> Allocate a new page if it easy and convenient to do so. |
| 9256 | ** Otherwise return NULL. |
| 9257 | ** <tr><td> 2 <td> Make every effort to allocate a new page. Only return |
| 9258 | ** NULL if allocating a new page is effectively impossible. |
| 9259 | ** </table> |
| 9260 | ** |
| @@ -9267,11 +9267,11 @@ | |
| 9267 | ** [[the xUnpin() page cache method]] |
| 9268 | ** ^xUnpin() is called by SQLite with a pointer to a currently pinned page |
| 9269 | ** as its second argument. If the third parameter, discard, is non-zero, |
| 9270 | ** then the page must be evicted from the cache. |
| 9271 | ** ^If the discard parameter is |
| 9272 | ** zero, then the page may be discarded or retained at the discretion of |
| 9273 | ** page cache implementation. ^The page cache implementation |
| 9274 | ** may choose to evict unpinned pages at any time. |
| 9275 | ** |
| 9276 | ** The cache must not perform any reference counting. A single |
| 9277 | ** call to xUnpin() unpins the page regardless of the number of prior calls |
| @@ -9285,11 +9285,11 @@ | |
| 9285 | ** to be pinned. |
| 9286 | ** |
| 9287 | ** When SQLite calls the xTruncate() method, the cache must discard all |
| 9288 | ** existing cache entries with page numbers (keys) greater than or equal |
| 9289 | ** to the value of the iLimit parameter passed to xTruncate(). If any |
| 9290 | ** of these pages are pinned, they are implicitly unpinned, meaning that |
| 9291 | ** they can be safely discarded. |
| 9292 | ** |
| 9293 | ** [[the xDestroy() page cache method]] |
| 9294 | ** ^The xDestroy() method is used to delete a cache allocated by xCreate(). |
| 9295 | ** All resources associated with the specified cache should be freed. ^After |
| @@ -9584,11 +9584,11 @@ | |
| 9584 | ** identity of the database connection (the blocking connection) that |
| 9585 | ** has locked the required resource is stored internally. ^After an |
| 9586 | ** application receives an SQLITE_LOCKED error, it may call the |
| 9587 | ** sqlite3_unlock_notify() method with the blocked connection handle as |
| 9588 | ** the first argument to register for a callback that will be invoked |
| 9589 | ** when the blocking connections current transaction is concluded. ^The |
| 9590 | ** callback is invoked from within the [sqlite3_step] or [sqlite3_close] |
| 9591 | ** call that concludes the blocking connection's transaction. |
| 9592 | ** |
| 9593 | ** ^(If sqlite3_unlock_notify() is called in a multi-threaded application, |
| 9594 | ** there is a chance that the blocking connection will have already |
| @@ -9604,11 +9604,11 @@ | |
| 9604 | ** ^(There may be at most one unlock-notify callback registered by a |
| 9605 | ** blocked connection. If sqlite3_unlock_notify() is called when the |
| 9606 | ** blocked connection already has a registered unlock-notify callback, |
| 9607 | ** then the new callback replaces the old.)^ ^If sqlite3_unlock_notify() is |
| 9608 | ** called with a NULL pointer as its second argument, then any existing |
| 9609 | ** unlock-notify callback is canceled. ^The blocked connections |
| 9610 | ** unlock-notify callback may also be canceled by closing the blocked |
| 9611 | ** connection using [sqlite3_close()]. |
| 9612 | ** |
| 9613 | ** The unlock-notify callback is not reentrant. If an application invokes |
| 9614 | ** any sqlite3_xxx API functions from within an unlock-notify callback, a |
| @@ -10002,11 +10002,11 @@ | |
| 10002 | ** where X is an integer. If X is zero, then the [virtual table] whose |
| 10003 | ** [xCreate] or [xConnect] method invoked [sqlite3_vtab_config()] does not |
| 10004 | ** support constraints. In this configuration (which is the default) if |
| 10005 | ** a call to the [xUpdate] method returns [SQLITE_CONSTRAINT], then the entire |
| 10006 | ** statement is rolled back as if [ON CONFLICT | OR ABORT] had been |
| 10007 | ** specified as part of the users SQL statement, regardless of the actual |
| 10008 | ** ON CONFLICT mode specified. |
| 10009 | ** |
| 10010 | ** If X is non-zero, then the virtual table implementation guarantees |
| 10011 | ** that if [xUpdate] returns [SQLITE_CONSTRAINT], it will do so before |
| 10012 | ** any modifications to internal or persistent data structures have been made. |
| @@ -10036,11 +10036,11 @@ | |
| 10036 | ** </dd> |
| 10037 | ** |
| 10038 | ** [[SQLITE_VTAB_INNOCUOUS]]<dt>SQLITE_VTAB_INNOCUOUS</dt> |
| 10039 | ** <dd>Calls of the form |
| 10040 | ** [sqlite3_vtab_config](db,SQLITE_VTAB_INNOCUOUS) from within the |
| 10041 | ** the [xConnect] or [xCreate] methods of a [virtual table] implementation |
| 10042 | ** identify that virtual table as being safe to use from within triggers |
| 10043 | ** and views. Conceptually, the SQLITE_VTAB_INNOCUOUS tag means that the |
| 10044 | ** virtual table can do no serious harm even if it is controlled by a |
| 10045 | ** malicious hacker. Developers should avoid setting the SQLITE_VTAB_INNOCUOUS |
| 10046 | ** flag unless absolutely necessary. |
| @@ -10204,21 +10204,21 @@ | |
| 10204 | ** <tr><td>2<td>no<td>yes<td>yes |
| 10205 | ** <tr><td>3<td>yes<td>yes<td>yes |
| 10206 | ** </table> |
| 10207 | ** |
| 10208 | ** ^For the purposes of comparing virtual table output values to see if the |
| 10209 | ** values are same value for sorting purposes, two NULL values are considered |
| 10210 | ** to be the same. In other words, the comparison operator is "IS" |
| 10211 | ** (or "IS NOT DISTINCT FROM") and not "==". |
| 10212 | ** |
| 10213 | ** If a virtual table implementation is unable to meet the requirements |
| 10214 | ** specified above, then it must not set the "orderByConsumed" flag in the |
| 10215 | ** [sqlite3_index_info] object or an incorrect answer may result. |
| 10216 | ** |
| 10217 | ** ^A virtual table implementation is always free to return rows in any order |
| 10218 | ** it wants, as long as the "orderByConsumed" flag is not set. ^When the |
| 10219 | ** the "orderByConsumed" flag is unset, the query planner will add extra |
| 10220 | ** [bytecode] to ensure that the final results returned by the SQL query are |
| 10221 | ** ordered correctly. The use of the "orderByConsumed" flag and the |
| 10222 | ** sqlite3_vtab_distinct() interface is merely an optimization. ^Careful |
| 10223 | ** use of the sqlite3_vtab_distinct() interface and the "orderByConsumed" |
| 10224 | ** flag might help queries against a virtual table to run faster. Being |
| @@ -10311,11 +10311,11 @@ | |
| 10311 | ** |
| 10312 | ** The X parameter in a call to sqlite3_vtab_in_first(X,P) or |
| 10313 | ** sqlite3_vtab_in_next(X,P) should be one of the parameters to the |
| 10314 | ** xFilter method which invokes these routines, and specifically |
| 10315 | ** a parameter that was previously selected for all-at-once IN constraint |
| 10316 | ** processing use the [sqlite3_vtab_in()] interface in the |
| 10317 | ** [xBestIndex|xBestIndex method]. ^(If the X parameter is not |
| 10318 | ** an xFilter argument that was selected for all-at-once IN constraint |
| 10319 | ** processing, then these routines return [SQLITE_ERROR].)^ |
| 10320 | ** |
| 10321 | ** ^(Use these routines to access all values on the right-hand side |
| @@ -10366,11 +10366,11 @@ | |
| 10366 | ** right-hand operand is not known, then *V is set to a NULL pointer. |
| 10367 | ** ^The sqlite3_vtab_rhs_value(P,J,V) interface returns SQLITE_OK if |
| 10368 | ** and only if *V is set to a value. ^The sqlite3_vtab_rhs_value(P,J,V) |
| 10369 | ** inteface returns SQLITE_NOTFOUND if the right-hand side of the J-th |
| 10370 | ** constraint is not available. ^The sqlite3_vtab_rhs_value() interface |
| 10371 | ** can return an result code other than SQLITE_OK or SQLITE_NOTFOUND if |
| 10372 | ** something goes wrong. |
| 10373 | ** |
| 10374 | ** The sqlite3_vtab_rhs_value() interface is usually only successful if |
| 10375 | ** the right-hand operand of a constraint is a literal value in the original |
| 10376 | ** SQL statement. If the right-hand operand is an expression or a reference |
| @@ -10394,12 +10394,12 @@ | |
| 10394 | /* |
| 10395 | ** CAPI3REF: Conflict resolution modes |
| 10396 | ** KEYWORDS: {conflict resolution mode} |
| 10397 | ** |
| 10398 | ** These constants are returned by [sqlite3_vtab_on_conflict()] to |
| 10399 | ** inform a [virtual table] implementation what the [ON CONFLICT] mode |
| 10400 | ** is for the SQL statement being evaluated. |
| 10401 | ** |
| 10402 | ** Note that the [SQLITE_IGNORE] constant is also used as a potential |
| 10403 | ** return value from the [sqlite3_set_authorizer()] callback and that |
| 10404 | ** [SQLITE_ABORT] is also a [result code]. |
| 10405 | */ |
| @@ -10435,43 +10435,43 @@ | |
| 10435 | ** to the total number of rows examined by all iterations of the X-th loop.</dd> |
| 10436 | ** |
| 10437 | ** [[SQLITE_SCANSTAT_EST]] <dt>SQLITE_SCANSTAT_EST</dt> |
| 10438 | ** <dd>^The "double" variable pointed to by the V parameter will be set to the |
| 10439 | ** query planner's estimate for the average number of rows output from each |
| 10440 | ** iteration of the X-th loop. If the query planner's estimates was accurate, |
| 10441 | ** then this value will approximate the quotient NVISIT/NLOOP and the |
| 10442 | ** product of this value for all prior loops with the same SELECTID will |
| 10443 | ** be the NLOOP value for the current loop. |
| 10444 | ** |
| 10445 | ** [[SQLITE_SCANSTAT_NAME]] <dt>SQLITE_SCANSTAT_NAME</dt> |
| 10446 | ** <dd>^The "const char *" variable pointed to by the V parameter will be set |
| 10447 | ** to a zero-terminated UTF-8 string containing the name of the index or table |
| 10448 | ** used for the X-th loop. |
| 10449 | ** |
| 10450 | ** [[SQLITE_SCANSTAT_EXPLAIN]] <dt>SQLITE_SCANSTAT_EXPLAIN</dt> |
| 10451 | ** <dd>^The "const char *" variable pointed to by the V parameter will be set |
| 10452 | ** to a zero-terminated UTF-8 string containing the [EXPLAIN QUERY PLAN] |
| 10453 | ** description for the X-th loop. |
| 10454 | ** |
| 10455 | ** [[SQLITE_SCANSTAT_SELECTID]] <dt>SQLITE_SCANSTAT_SELECTID</dt> |
| 10456 | ** <dd>^The "int" variable pointed to by the V parameter will be set to the |
| 10457 | ** id for the X-th query plan element. The id value is unique within the |
| 10458 | ** statement. The select-id is the same value as is output in the first |
| 10459 | ** column of an [EXPLAIN QUERY PLAN] query. |
| 10460 | ** |
| 10461 | ** [[SQLITE_SCANSTAT_PARENTID]] <dt>SQLITE_SCANSTAT_PARENTID</dt> |
| 10462 | ** <dd>The "int" variable pointed to by the V parameter will be set to the |
| 10463 | ** the id of the parent of the current query element, if applicable, or |
| 10464 | ** to zero if the query element has no parent. This is the same value as |
| 10465 | ** returned in the second column of an [EXPLAIN QUERY PLAN] query. |
| 10466 | ** |
| 10467 | ** [[SQLITE_SCANSTAT_NCYCLE]] <dt>SQLITE_SCANSTAT_NCYCLE</dt> |
| 10468 | ** <dd>The sqlite3_int64 output value is set to the number of cycles, |
| 10469 | ** according to the processor time-stamp counter, that elapsed while the |
| 10470 | ** query element was being processed. This value is not available for |
| 10471 | ** all query elements - if it is unavailable the output variable is |
| 10472 | ** set to -1. |
| 10473 | ** </dl> |
| 10474 | */ |
| 10475 | #define SQLITE_SCANSTAT_NLOOP 0 |
| 10476 | #define SQLITE_SCANSTAT_NVISIT 1 |
| 10477 | #define SQLITE_SCANSTAT_EST 2 |
| @@ -10508,12 +10508,12 @@ | |
| 10508 | ** the EXPLAIN QUERY PLAN output) are available. Invoking API |
| 10509 | ** sqlite3_stmt_scanstatus() is equivalent to calling |
| 10510 | ** sqlite3_stmt_scanstatus_v2() with a zeroed flags parameter. |
| 10511 | ** |
| 10512 | ** Parameter "idx" identifies the specific query element to retrieve statistics |
| 10513 | ** for. Query elements are numbered starting from zero. A value of -1 may be |
| 10514 | ** to query for statistics regarding the entire query. ^If idx is out of range |
| 10515 | ** - less than -1 or greater than or equal to the total number of query |
| 10516 | ** elements used to implement the statement - a non-zero value is returned and |
| 10517 | ** the variable that pOut points to is unchanged. |
| 10518 | ** |
| 10519 | ** See also: [sqlite3_stmt_scanstatus_reset()] |
| @@ -10666,12 +10666,12 @@ | |
| 10666 | ** operation; or 1 for inserts, updates, or deletes invoked by top-level |
| 10667 | ** triggers; or 2 for changes resulting from triggers called by top-level |
| 10668 | ** triggers; and so forth. |
| 10669 | ** |
| 10670 | ** When the [sqlite3_blob_write()] API is used to update a blob column, |
| 10671 | ** the pre-update hook is invoked with SQLITE_DELETE. This is because the |
| 10672 | ** in this case the new values are not available. In this case, when a |
| 10673 | ** callback made with op==SQLITE_DELETE is actually a write using the |
| 10674 | ** sqlite3_blob_write() API, the [sqlite3_preupdate_blobwrite()] returns |
| 10675 | ** the index of the column being written. In other cases, where the |
| 10676 | ** pre-update hook is being invoked for some other reason, including a |
| 10677 | ** regular DELETE, sqlite3_preupdate_blobwrite() returns -1. |
| @@ -10920,20 +10920,20 @@ | |
| 10920 | ** is written into *P. |
| 10921 | ** |
| 10922 | ** For an ordinary on-disk database file, the serialization is just a |
| 10923 | ** copy of the disk file. For an in-memory database or a "TEMP" database, |
| 10924 | ** the serialization is the same sequence of bytes which would be written |
| 10925 | ** to disk if that database where backed up to disk. |
| 10926 | ** |
| 10927 | ** The usual case is that sqlite3_serialize() copies the serialization of |
| 10928 | ** the database into memory obtained from [sqlite3_malloc64()] and returns |
| 10929 | ** a pointer to that memory. The caller is responsible for freeing the |
| 10930 | ** returned value to avoid a memory leak. However, if the F argument |
| 10931 | ** contains the SQLITE_SERIALIZE_NOCOPY bit, then no memory allocations |
| 10932 | ** are made, and the sqlite3_serialize() function will return a pointer |
| 10933 | ** to the contiguous memory representation of the database that SQLite |
| 10934 | ** is currently using for that database, or NULL if the no such contiguous |
| 10935 | ** memory representation of the database exists. A contiguous memory |
| 10936 | ** representation of the database will usually only exist if there has |
| 10937 | ** been a prior call to [sqlite3_deserialize(D,S,...)] with the same |
| 10938 | ** values of D and S. |
| 10939 | ** The size of the database is written into *P even if the |
| @@ -11000,11 +11000,11 @@ | |
| 11000 | ** |
| 11001 | ** The sqlite3_deserialize() interface will fail with SQLITE_BUSY if the |
| 11002 | ** database is currently in a read transaction or is involved in a backup |
| 11003 | ** operation. |
| 11004 | ** |
| 11005 | ** It is not possible to deserialized into the TEMP database. If the |
| 11006 | ** S argument to sqlite3_deserialize(D,S,P,N,M,F) is "temp" then the |
| 11007 | ** function returns SQLITE_ERROR. |
| 11008 | ** |
| 11009 | ** The deserialized database should not be in [WAL mode]. If the database |
| 11010 | ** is in WAL mode, then any attempt to use the database file will result |
| @@ -11022,19 +11022,19 @@ | |
| 11022 | */ |
| 11023 | SQLITE_API int sqlite3_deserialize( |
| 11024 | sqlite3 *db, /* The database connection */ |
| 11025 | const char *zSchema, /* Which DB to reopen with the deserialization */ |
| 11026 | unsigned char *pData, /* The serialized database content */ |
| 11027 | sqlite3_int64 szDb, /* Number bytes in the deserialization */ |
| 11028 | sqlite3_int64 szBuf, /* Total size of buffer pData[] */ |
| 11029 | unsigned mFlags /* Zero or more SQLITE_DESERIALIZE_* flags */ |
| 11030 | ); |
| 11031 | |
| 11032 | /* |
| 11033 | ** CAPI3REF: Flags for sqlite3_deserialize() |
| 11034 | ** |
| 11035 | ** The following are allowed values for 6th argument (the F argument) to |
| 11036 | ** the [sqlite3_deserialize(D,S,P,N,M,F)] interface. |
| 11037 | ** |
| 11038 | ** The SQLITE_DESERIALIZE_FREEONCLOSE means that the database serialization |
| 11039 | ** in the P argument is held in memory obtained from [sqlite3_malloc64()] |
| 11040 | ** and that SQLite should take ownership of this memory and automatically |
| 11041 |
| --- extsrc/sqlite3.h | |
| +++ extsrc/sqlite3.h | |
| @@ -146,11 +146,11 @@ | |
| 146 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 147 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 148 | */ |
| 149 | #define SQLITE_VERSION "3.51.0" |
| 150 | #define SQLITE_VERSION_NUMBER 3051000 |
| 151 | #define SQLITE_SOURCE_ID "2025-06-30 16:41:40 0083d5169a46104a25355bdd9d5a2f4027b049191ebda571dd228477ec217296" |
| 152 | |
| 153 | /* |
| 154 | ** CAPI3REF: Run-Time Library Version Numbers |
| 155 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 156 | ** |
| @@ -9056,48 +9056,48 @@ | |
| 9056 | ** careful use of indices.</dd> |
| 9057 | ** |
| 9058 | ** [[SQLITE_STMTSTATUS_SORT]] <dt>SQLITE_STMTSTATUS_SORT</dt> |
| 9059 | ** <dd>^This is the number of sort operations that have occurred. |
| 9060 | ** A non-zero value in this counter may indicate an opportunity to |
| 9061 | ** improve performance through careful use of indices.</dd> |
| 9062 | ** |
| 9063 | ** [[SQLITE_STMTSTATUS_AUTOINDEX]] <dt>SQLITE_STMTSTATUS_AUTOINDEX</dt> |
| 9064 | ** <dd>^This is the number of rows inserted into transient indices that |
| 9065 | ** were created automatically in order to help joins run faster. |
| 9066 | ** A non-zero value in this counter may indicate an opportunity to |
| 9067 | ** improve performance by adding permanent indices that do not |
| 9068 | ** need to be reinitialized each time the statement is run.</dd> |
| 9069 | ** |
| 9070 | ** [[SQLITE_STMTSTATUS_VM_STEP]] <dt>SQLITE_STMTSTATUS_VM_STEP</dt> |
| 9071 | ** <dd>^This is the number of virtual machine operations executed |
| 9072 | ** by the prepared statement if that number is less than or equal |
| 9073 | ** to 2147483647. The number of virtual machine operations can be |
| 9074 | ** used as a proxy for the total work done by the prepared statement. |
| 9075 | ** If the number of virtual machine operations exceeds 2147483647 |
| 9076 | ** then the value returned by this statement status code is undefined.</dd> |
| 9077 | ** |
| 9078 | ** [[SQLITE_STMTSTATUS_REPREPARE]] <dt>SQLITE_STMTSTATUS_REPREPARE</dt> |
| 9079 | ** <dd>^This is the number of times that the prepare statement has been |
| 9080 | ** automatically regenerated due to schema changes or changes to |
| 9081 | ** [bound parameters] that might affect the query plan.</dd> |
| 9082 | ** |
| 9083 | ** [[SQLITE_STMTSTATUS_RUN]] <dt>SQLITE_STMTSTATUS_RUN</dt> |
| 9084 | ** <dd>^This is the number of times that the prepared statement has |
| 9085 | ** been run. A single "run" for the purposes of this counter is one |
| 9086 | ** or more calls to [sqlite3_step()] followed by a call to [sqlite3_reset()]. |
| 9087 | ** The counter is incremented on the first [sqlite3_step()] call of each |
| 9088 | ** cycle.</dd> |
| 9089 | ** |
| 9090 | ** [[SQLITE_STMTSTATUS_FILTER_MISS]] |
| 9091 | ** [[SQLITE_STMTSTATUS_FILTER HIT]] |
| 9092 | ** <dt>SQLITE_STMTSTATUS_FILTER_HIT<br> |
| 9093 | ** SQLITE_STMTSTATUS_FILTER_MISS</dt> |
| 9094 | ** <dd>^SQLITE_STMTSTATUS_FILTER_HIT is the number of times that a join |
| 9095 | ** step was bypassed because a Bloom filter returned not-found. The |
| 9096 | ** corresponding SQLITE_STMTSTATUS_FILTER_MISS value is the number of |
| 9097 | ** times that the Bloom filter returned a find, and thus the join step |
| 9098 | ** had to be processed as normal.</dd> |
| 9099 | ** |
| 9100 | ** [[SQLITE_STMTSTATUS_MEMUSED]] <dt>SQLITE_STMTSTATUS_MEMUSED</dt> |
| 9101 | ** <dd>^This is the approximate number of bytes of heap memory |
| 9102 | ** used to store the prepared statement. ^This value is not actually |
| 9103 | ** a counter, and so the resetFlg parameter to sqlite3_stmt_status() |
| @@ -9198,31 +9198,31 @@ | |
| 9198 | ** [[the xCreate() page cache methods]] |
| 9199 | ** ^SQLite invokes the xCreate() method to construct a new cache instance. |
| 9200 | ** SQLite will typically create one cache instance for each open database file, |
| 9201 | ** though this is not guaranteed. ^The |
| 9202 | ** first parameter, szPage, is the size in bytes of the pages that must |
| 9203 | ** be allocated by the cache. ^szPage will always be a power of two. ^The |
| 9204 | ** second parameter szExtra is a number of bytes of extra storage |
| 9205 | ** associated with each page cache entry. ^The szExtra parameter will be |
| 9206 | ** a number less than 250. SQLite will use the |
| 9207 | ** extra szExtra bytes on each page to store metadata about the underlying |
| 9208 | ** database page on disk. The value passed into szExtra depends |
| 9209 | ** on the SQLite version, the target platform, and how SQLite was compiled. |
| 9210 | ** ^The third argument to xCreate(), bPurgeable, is true if the cache being |
| 9211 | ** created will be used to cache database pages of a file stored on disk, or |
| 9212 | ** false if it is used for an in-memory database. The cache implementation |
| 9213 | ** does not have to do anything special based upon the value of bPurgeable; |
| 9214 | ** it is purely advisory. ^On a cache where bPurgeable is false, SQLite will |
| 9215 | ** never invoke xUnpin() except to deliberately delete a page. |
| 9216 | ** ^In other words, calls to xUnpin() on a cache with bPurgeable set to |
| 9217 | ** false will always have the "discard" flag set to true. |
| 9218 | ** ^Hence, a cache created with bPurgeable set to false will |
| 9219 | ** never contain any unpinned pages. |
| 9220 | ** |
| 9221 | ** [[the xCachesize() page cache method]] |
| 9222 | ** ^(The xCachesize() method may be called at any time by SQLite to set the |
| 9223 | ** suggested maximum cache-size (number of pages stored) for the cache |
| 9224 | ** instance passed as the first argument. This is the value configured using |
| 9225 | ** the SQLite "[PRAGMA cache_size]" command.)^ As with the bPurgeable |
| 9226 | ** parameter, the implementation is not required to do anything with this |
| 9227 | ** value; it is advisory only. |
| 9228 | ** |
| @@ -9245,16 +9245,16 @@ | |
| 9245 | ** |
| 9246 | ** If the requested page is already in the page cache, then the page cache |
| 9247 | ** implementation must return a pointer to the page buffer with its content |
| 9248 | ** intact. If the requested page is not already in the cache, then the |
| 9249 | ** cache implementation should use the value of the createFlag |
| 9250 | ** parameter to help it determine what action to take: |
| 9251 | ** |
| 9252 | ** <table border=1 width=85% align=center> |
| 9253 | ** <tr><th> createFlag <th> Behavior when page is not already in cache |
| 9254 | ** <tr><td> 0 <td> Do not allocate a new page. Return NULL. |
| 9255 | ** <tr><td> 1 <td> Allocate a new page if it is easy and convenient to do so. |
| 9256 | ** Otherwise return NULL. |
| 9257 | ** <tr><td> 2 <td> Make every effort to allocate a new page. Only return |
| 9258 | ** NULL if allocating a new page is effectively impossible. |
| 9259 | ** </table> |
| 9260 | ** |
| @@ -9267,11 +9267,11 @@ | |
| 9267 | ** [[the xUnpin() page cache method]] |
| 9268 | ** ^xUnpin() is called by SQLite with a pointer to a currently pinned page |
| 9269 | ** as its second argument. If the third parameter, discard, is non-zero, |
| 9270 | ** then the page must be evicted from the cache. |
| 9271 | ** ^If the discard parameter is |
| 9272 | ** zero, then the page may be discarded or retained at the discretion of the |
| 9273 | ** page cache implementation. ^The page cache implementation |
| 9274 | ** may choose to evict unpinned pages at any time. |
| 9275 | ** |
| 9276 | ** The cache must not perform any reference counting. A single |
| 9277 | ** call to xUnpin() unpins the page regardless of the number of prior calls |
| @@ -9285,11 +9285,11 @@ | |
| 9285 | ** to be pinned. |
| 9286 | ** |
| 9287 | ** When SQLite calls the xTruncate() method, the cache must discard all |
| 9288 | ** existing cache entries with page numbers (keys) greater than or equal |
| 9289 | ** to the value of the iLimit parameter passed to xTruncate(). If any |
| 9290 | ** of these pages are pinned, they become implicitly unpinned, meaning that |
| 9291 | ** they can be safely discarded. |
| 9292 | ** |
| 9293 | ** [[the xDestroy() page cache method]] |
| 9294 | ** ^The xDestroy() method is used to delete a cache allocated by xCreate(). |
| 9295 | ** All resources associated with the specified cache should be freed. ^After |
| @@ -9584,11 +9584,11 @@ | |
| 9584 | ** identity of the database connection (the blocking connection) that |
| 9585 | ** has locked the required resource is stored internally. ^After an |
| 9586 | ** application receives an SQLITE_LOCKED error, it may call the |
| 9587 | ** sqlite3_unlock_notify() method with the blocked connection handle as |
| 9588 | ** the first argument to register for a callback that will be invoked |
| 9589 | ** when the blocking connection's current transaction is concluded. ^The |
| 9590 | ** callback is invoked from within the [sqlite3_step] or [sqlite3_close] |
| 9591 | ** call that concludes the blocking connection's transaction. |
| 9592 | ** |
| 9593 | ** ^(If sqlite3_unlock_notify() is called in a multi-threaded application, |
| 9594 | ** there is a chance that the blocking connection will have already |
| @@ -9604,11 +9604,11 @@ | |
| 9604 | ** ^(There may be at most one unlock-notify callback registered by a |
| 9605 | ** blocked connection. If sqlite3_unlock_notify() is called when the |
| 9606 | ** blocked connection already has a registered unlock-notify callback, |
| 9607 | ** then the new callback replaces the old.)^ ^If sqlite3_unlock_notify() is |
| 9608 | ** called with a NULL pointer as its second argument, then any existing |
| 9609 | ** unlock-notify callback is canceled. ^The blocked connection's |
| 9610 | ** unlock-notify callback may also be canceled by closing the blocked |
| 9611 | ** connection using [sqlite3_close()]. |
| 9612 | ** |
| 9613 | ** The unlock-notify callback is not reentrant. If an application invokes |
| 9614 | ** any sqlite3_xxx API functions from within an unlock-notify callback, a |
| @@ -10002,11 +10002,11 @@ | |
| 10002 | ** where X is an integer. If X is zero, then the [virtual table] whose |
| 10003 | ** [xCreate] or [xConnect] method invoked [sqlite3_vtab_config()] does not |
| 10004 | ** support constraints. In this configuration (which is the default) if |
| 10005 | ** a call to the [xUpdate] method returns [SQLITE_CONSTRAINT], then the entire |
| 10006 | ** statement is rolled back as if [ON CONFLICT | OR ABORT] had been |
| 10007 | ** specified as part of the user's SQL statement, regardless of the actual |
| 10008 | ** ON CONFLICT mode specified. |
| 10009 | ** |
| 10010 | ** If X is non-zero, then the virtual table implementation guarantees |
| 10011 | ** that if [xUpdate] returns [SQLITE_CONSTRAINT], it will do so before |
| 10012 | ** any modifications to internal or persistent data structures have been made. |
| @@ -10036,11 +10036,11 @@ | |
| 10036 | ** </dd> |
| 10037 | ** |
| 10038 | ** [[SQLITE_VTAB_INNOCUOUS]]<dt>SQLITE_VTAB_INNOCUOUS</dt> |
| 10039 | ** <dd>Calls of the form |
| 10040 | ** [sqlite3_vtab_config](db,SQLITE_VTAB_INNOCUOUS) from within the |
| 10041 | ** [xConnect] or [xCreate] methods of a [virtual table] implementation |
| 10042 | ** identify that virtual table as being safe to use from within triggers |
| 10043 | ** and views. Conceptually, the SQLITE_VTAB_INNOCUOUS tag means that the |
| 10044 | ** virtual table can do no serious harm even if it is controlled by a |
| 10045 | ** malicious hacker. Developers should avoid setting the SQLITE_VTAB_INNOCUOUS |
| 10046 | ** flag unless absolutely necessary. |
| @@ -10204,21 +10204,21 @@ | |
| 10204 | ** <tr><td>2<td>no<td>yes<td>yes |
| 10205 | ** <tr><td>3<td>yes<td>yes<td>yes |
| 10206 | ** </table> |
| 10207 | ** |
| 10208 | ** ^For the purposes of comparing virtual table output values to see if the |
| 10209 | ** values are the same value for sorting purposes, two NULL values are considered |
| 10210 | ** to be the same. In other words, the comparison operator is "IS" |
| 10211 | ** (or "IS NOT DISTINCT FROM") and not "==". |
| 10212 | ** |
| 10213 | ** If a virtual table implementation is unable to meet the requirements |
| 10214 | ** specified above, then it must not set the "orderByConsumed" flag in the |
| 10215 | ** [sqlite3_index_info] object or an incorrect answer may result. |
| 10216 | ** |
| 10217 | ** ^A virtual table implementation is always free to return rows in any order |
| 10218 | ** it wants, as long as the "orderByConsumed" flag is not set. ^When the |
| 10219 | ** "orderByConsumed" flag is unset, the query planner will add extra |
| 10220 | ** [bytecode] to ensure that the final results returned by the SQL query are |
| 10221 | ** ordered correctly. The use of the "orderByConsumed" flag and the |
| 10222 | ** sqlite3_vtab_distinct() interface is merely an optimization. ^Careful |
| 10223 | ** use of the sqlite3_vtab_distinct() interface and the "orderByConsumed" |
| 10224 | ** flag might help queries against a virtual table to run faster. Being |
| @@ -10311,11 +10311,11 @@ | |
| 10311 | ** |
| 10312 | ** The X parameter in a call to sqlite3_vtab_in_first(X,P) or |
| 10313 | ** sqlite3_vtab_in_next(X,P) should be one of the parameters to the |
| 10314 | ** xFilter method which invokes these routines, and specifically |
| 10315 | ** a parameter that was previously selected for all-at-once IN constraint |
| 10316 | ** processing using the [sqlite3_vtab_in()] interface in the |
| 10317 | ** [xBestIndex|xBestIndex method]. ^(If the X parameter is not |
| 10318 | ** an xFilter argument that was selected for all-at-once IN constraint |
| 10319 | ** processing, then these routines return [SQLITE_ERROR].)^ |
| 10320 | ** |
| 10321 | ** ^(Use these routines to access all values on the right-hand side |
| @@ -10366,11 +10366,11 @@ | |
| 10366 | ** right-hand operand is not known, then *V is set to a NULL pointer. |
| 10367 | ** ^The sqlite3_vtab_rhs_value(P,J,V) interface returns SQLITE_OK if |
| 10368 | ** and only if *V is set to a value. ^The sqlite3_vtab_rhs_value(P,J,V) |
| 10369 | ** inteface returns SQLITE_NOTFOUND if the right-hand side of the J-th |
| 10370 | ** constraint is not available. ^The sqlite3_vtab_rhs_value() interface |
| 10371 | ** can return a result code other than SQLITE_OK or SQLITE_NOTFOUND if |
| 10372 | ** something goes wrong. |
| 10373 | ** |
| 10374 | ** The sqlite3_vtab_rhs_value() interface is usually only successful if |
| 10375 | ** the right-hand operand of a constraint is a literal value in the original |
| 10376 | ** SQL statement. If the right-hand operand is an expression or a reference |
| @@ -10394,12 +10394,12 @@ | |
| 10394 | /* |
| 10395 | ** CAPI3REF: Conflict resolution modes |
| 10396 | ** KEYWORDS: {conflict resolution mode} |
| 10397 | ** |
| 10398 | ** These constants are returned by [sqlite3_vtab_on_conflict()] to |
| 10399 | ** inform a [virtual table] implementation of the [ON CONFLICT] mode |
| 10400 | ** for the SQL statement being evaluated. |
| 10401 | ** |
| 10402 | ** Note that the [SQLITE_IGNORE] constant is also used as a potential |
| 10403 | ** return value from the [sqlite3_set_authorizer()] callback and that |
| 10404 | ** [SQLITE_ABORT] is also a [result code]. |
| 10405 | */ |
| @@ -10435,43 +10435,43 @@ | |
| 10435 | ** to the total number of rows examined by all iterations of the X-th loop.</dd> |
| 10436 | ** |
| 10437 | ** [[SQLITE_SCANSTAT_EST]] <dt>SQLITE_SCANSTAT_EST</dt> |
| 10438 | ** <dd>^The "double" variable pointed to by the V parameter will be set to the |
| 10439 | ** query planner's estimate for the average number of rows output from each |
| 10440 | ** iteration of the X-th loop. If the query planner's estimate was accurate, |
| 10441 | ** then this value will approximate the quotient NVISIT/NLOOP and the |
| 10442 | ** product of this value for all prior loops with the same SELECTID will |
| 10443 | ** be the NLOOP value for the current loop.</dd> |
| 10444 | ** |
| 10445 | ** [[SQLITE_SCANSTAT_NAME]] <dt>SQLITE_SCANSTAT_NAME</dt> |
| 10446 | ** <dd>^The "const char *" variable pointed to by the V parameter will be set |
| 10447 | ** to a zero-terminated UTF-8 string containing the name of the index or table |
| 10448 | ** used for the X-th loop.</dd> |
| 10449 | ** |
| 10450 | ** [[SQLITE_SCANSTAT_EXPLAIN]] <dt>SQLITE_SCANSTAT_EXPLAIN</dt> |
| 10451 | ** <dd>^The "const char *" variable pointed to by the V parameter will be set |
| 10452 | ** to a zero-terminated UTF-8 string containing the [EXPLAIN QUERY PLAN] |
| 10453 | ** description for the X-th loop.</dd> |
| 10454 | ** |
| 10455 | ** [[SQLITE_SCANSTAT_SELECTID]] <dt>SQLITE_SCANSTAT_SELECTID</dt> |
| 10456 | ** <dd>^The "int" variable pointed to by the V parameter will be set to the |
| 10457 | ** id for the X-th query plan element. The id value is unique within the |
| 10458 | ** statement. The select-id is the same value as is output in the first |
| 10459 | ** column of an [EXPLAIN QUERY PLAN] query.</dd> |
| 10460 | ** |
| 10461 | ** [[SQLITE_SCANSTAT_PARENTID]] <dt>SQLITE_SCANSTAT_PARENTID</dt> |
| 10462 | ** <dd>The "int" variable pointed to by the V parameter will be set to the |
| 10463 | ** id of the parent of the current query element, if applicable, or |
| 10464 | ** to zero if the query element has no parent. This is the same value as |
| 10465 | ** returned in the second column of an [EXPLAIN QUERY PLAN] query.</dd> |
| 10466 | ** |
| 10467 | ** [[SQLITE_SCANSTAT_NCYCLE]] <dt>SQLITE_SCANSTAT_NCYCLE</dt> |
| 10468 | ** <dd>The sqlite3_int64 output value is set to the number of cycles, |
| 10469 | ** according to the processor time-stamp counter, that elapsed while the |
| 10470 | ** query element was being processed. This value is not available for |
| 10471 | ** all query elements - if it is unavailable the output variable is |
| 10472 | ** set to -1.</dd> |
| 10473 | ** </dl> |
| 10474 | */ |
| 10475 | #define SQLITE_SCANSTAT_NLOOP 0 |
| 10476 | #define SQLITE_SCANSTAT_NVISIT 1 |
| 10477 | #define SQLITE_SCANSTAT_EST 2 |
| @@ -10508,12 +10508,12 @@ | |
| 10508 | ** the EXPLAIN QUERY PLAN output) are available. Invoking API |
| 10509 | ** sqlite3_stmt_scanstatus() is equivalent to calling |
| 10510 | ** sqlite3_stmt_scanstatus_v2() with a zeroed flags parameter. |
| 10511 | ** |
| 10512 | ** Parameter "idx" identifies the specific query element to retrieve statistics |
| 10513 | ** for. Query elements are numbered starting from zero. A value of -1 may |
| 10514 | ** retrieve statistics for the entire query. ^If idx is out of range |
| 10515 | ** - less than -1 or greater than or equal to the total number of query |
| 10516 | ** elements used to implement the statement - a non-zero value is returned and |
| 10517 | ** the variable that pOut points to is unchanged. |
| 10518 | ** |
| 10519 | ** See also: [sqlite3_stmt_scanstatus_reset()] |
| @@ -10666,12 +10666,12 @@ | |
| 10666 | ** operation; or 1 for inserts, updates, or deletes invoked by top-level |
| 10667 | ** triggers; or 2 for changes resulting from triggers called by top-level |
| 10668 | ** triggers; and so forth. |
| 10669 | ** |
| 10670 | ** When the [sqlite3_blob_write()] API is used to update a blob column, |
| 10671 | ** the pre-update hook is invoked with SQLITE_DELETE, because |
| 10672 | ** the new values are not yet available. In this case, when a |
| 10673 | ** callback made with op==SQLITE_DELETE is actually a write using the |
| 10674 | ** sqlite3_blob_write() API, the [sqlite3_preupdate_blobwrite()] returns |
| 10675 | ** the index of the column being written. In other cases, where the |
| 10676 | ** pre-update hook is being invoked for some other reason, including a |
| 10677 | ** regular DELETE, sqlite3_preupdate_blobwrite() returns -1. |
| @@ -10920,20 +10920,20 @@ | |
| 10920 | ** is written into *P. |
| 10921 | ** |
| 10922 | ** For an ordinary on-disk database file, the serialization is just a |
| 10923 | ** copy of the disk file. For an in-memory database or a "TEMP" database, |
| 10924 | ** the serialization is the same sequence of bytes which would be written |
| 10925 | ** to disk if that database were backed up to disk. |
| 10926 | ** |
| 10927 | ** The usual case is that sqlite3_serialize() copies the serialization of |
| 10928 | ** the database into memory obtained from [sqlite3_malloc64()] and returns |
| 10929 | ** a pointer to that memory. The caller is responsible for freeing the |
| 10930 | ** returned value to avoid a memory leak. However, if the F argument |
| 10931 | ** contains the SQLITE_SERIALIZE_NOCOPY bit, then no memory allocations |
| 10932 | ** are made, and the sqlite3_serialize() function will return a pointer |
| 10933 | ** to the contiguous memory representation of the database that SQLite |
| 10934 | ** is currently using for that database, or NULL if no such contiguous |
| 10935 | ** memory representation of the database exists. A contiguous memory |
| 10936 | ** representation of the database will usually only exist if there has |
| 10937 | ** been a prior call to [sqlite3_deserialize(D,S,...)] with the same |
| 10938 | ** values of D and S. |
| 10939 | ** The size of the database is written into *P even if the |
| @@ -11000,11 +11000,11 @@ | |
| 11000 | ** |
| 11001 | ** The sqlite3_deserialize() interface will fail with SQLITE_BUSY if the |
| 11002 | ** database is currently in a read transaction or is involved in a backup |
| 11003 | ** operation. |
| 11004 | ** |
| 11005 | ** It is not possible to deserialize into the TEMP database. If the |
| 11006 | ** S argument to sqlite3_deserialize(D,S,P,N,M,F) is "temp" then the |
| 11007 | ** function returns SQLITE_ERROR. |
| 11008 | ** |
| 11009 | ** The deserialized database should not be in [WAL mode]. If the database |
| 11010 | ** is in WAL mode, then any attempt to use the database file will result |
| @@ -11022,19 +11022,19 @@ | |
| 11022 | */ |
| 11023 | SQLITE_API int sqlite3_deserialize( |
| 11024 | sqlite3 *db, /* The database connection */ |
| 11025 | const char *zSchema, /* Which DB to reopen with the deserialization */ |
| 11026 | unsigned char *pData, /* The serialized database content */ |
| 11027 | sqlite3_int64 szDb, /* Number of bytes in the deserialization */ |
| 11028 | sqlite3_int64 szBuf, /* Total size of buffer pData[] */ |
| 11029 | unsigned mFlags /* Zero or more SQLITE_DESERIALIZE_* flags */ |
| 11030 | ); |
| 11031 | |
| 11032 | /* |
| 11033 | ** CAPI3REF: Flags for sqlite3_deserialize() |
| 11034 | ** |
| 11035 | ** The following are allowed values for the 6th argument (the F argument) to |
| 11036 | ** the [sqlite3_deserialize(D,S,P,N,M,F)] interface. |
| 11037 | ** |
| 11038 | ** The SQLITE_DESERIALIZE_FREEONCLOSE means that the database serialization |
| 11039 | ** in the P argument is held in memory obtained from [sqlite3_malloc64()] |
| 11040 | ** and that SQLite should take ownership of this memory and automatically |
| 11041 |