| | @@ -39,10 +39,18 @@ |
| 39 | 39 | ** SQLite was built with. |
| 40 | 40 | */ |
| 41 | 41 | |
| 42 | 42 | #ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS |
| 43 | 43 | |
| 44 | +/* |
| 45 | +** Include the configuration header output by 'configure' if we're using the |
| 46 | +** autoconf-based build |
| 47 | +*/ |
| 48 | +#if defined(_HAVE_SQLITE_CONFIG_H) && !defined(SQLITECONFIG_H) |
| 49 | +#include "config.h" |
| 50 | +#define SQLITECONFIG_H 1 |
| 51 | +#endif |
| 44 | 52 | |
| 45 | 53 | /* These macros are provided to "stringify" the value of the define |
| 46 | 54 | ** for those options in which the value is meaningful. */ |
| 47 | 55 | #define CTIMEOPT_VAL_(opt) #opt |
| 48 | 56 | #define CTIMEOPT_VAL(opt) CTIMEOPT_VAL_(opt) |
| | @@ -279,10 +287,13 @@ |
| 279 | 287 | #if SQLITE_ENABLE_OVERSIZE_CELL_CHECK |
| 280 | 288 | "ENABLE_OVERSIZE_CELL_CHECK", |
| 281 | 289 | #endif |
| 282 | 290 | #if SQLITE_ENABLE_PREUPDATE_HOOK |
| 283 | 291 | "ENABLE_PREUPDATE_HOOK", |
| 292 | +#endif |
| 293 | +#if SQLITE_ENABLE_QPSG |
| 294 | + "ENABLE_QPSG", |
| 284 | 295 | #endif |
| 285 | 296 | #if SQLITE_ENABLE_RBU |
| 286 | 297 | "ENABLE_RBU", |
| 287 | 298 | #endif |
| 288 | 299 | #if SQLITE_ENABLE_RTREE |
| | @@ -302,10 +313,13 @@ |
| 302 | 313 | #endif |
| 303 | 314 | #if defined(SQLITE_ENABLE_STAT4) |
| 304 | 315 | "ENABLE_STAT4", |
| 305 | 316 | #elif defined(SQLITE_ENABLE_STAT3) |
| 306 | 317 | "ENABLE_STAT3", |
| 318 | +#endif |
| 319 | +#if SQLITE_ENABLE_STMTVTAB |
| 320 | + "ENABLE_STMTVTAB", |
| 307 | 321 | #endif |
| 308 | 322 | #if SQLITE_ENABLE_STMT_SCANSTATUS |
| 309 | 323 | "ENABLE_STMT_SCANSTATUS", |
| 310 | 324 | #endif |
| 311 | 325 | #if SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION |
| | @@ -1012,11 +1026,11 @@ |
| 1012 | 1026 | ** MinGW. |
| 1013 | 1027 | */ |
| 1014 | 1028 | /************** Include sqlite3.h in the middle of sqliteInt.h ***************/ |
| 1015 | 1029 | /************** Begin file sqlite3.h *****************************************/ |
| 1016 | 1030 | /* |
| 1017 | | -** 2001 September 15 |
| 1031 | +** 2001-09-15 |
| 1018 | 1032 | ** |
| 1019 | 1033 | ** The author disclaims copyright to this source code. In place of |
| 1020 | 1034 | ** a legal notice, here is a blessing: |
| 1021 | 1035 | ** |
| 1022 | 1036 | ** May you do good and not evil. |
| | @@ -1136,11 +1150,11 @@ |
| 1136 | 1150 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 1137 | 1151 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 1138 | 1152 | */ |
| 1139 | 1153 | #define SQLITE_VERSION "3.20.0" |
| 1140 | 1154 | #define SQLITE_VERSION_NUMBER 3020000 |
| 1141 | | -#define SQLITE_SOURCE_ID "2017-06-24 13:31:40 0583b84ab444db3ae3c93db619b67bf84b0305ab989200e77214e02ff2dc923a" |
| 1155 | +#define SQLITE_SOURCE_ID "2017-06-29 17:27:04 284707a7b3514a55cce24292e45632b7033d6edcff5b27deac5118b27c7b2954" |
| 1142 | 1156 | |
| 1143 | 1157 | /* |
| 1144 | 1158 | ** CAPI3REF: Run-Time Library Version Numbers |
| 1145 | 1159 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 1146 | 1160 | ** |
| | @@ -1248,11 +1262,11 @@ |
| 1248 | 1262 | ** the opaque structure named "sqlite3". It is useful to think of an sqlite3 |
| 1249 | 1263 | ** pointer as an object. The [sqlite3_open()], [sqlite3_open16()], and |
| 1250 | 1264 | ** [sqlite3_open_v2()] interfaces are its constructors, and [sqlite3_close()] |
| 1251 | 1265 | ** and [sqlite3_close_v2()] are its destructors. There are many other |
| 1252 | 1266 | ** interfaces (such as |
| 1253 | | -** [sqlite3_prepare_v2()], [sqlite3_create_function()], and |
| 1267 | +** [sqlite3_prepare_v3()], [sqlite3_create_function()], and |
| 1254 | 1268 | ** [sqlite3_busy_timeout()] to name but three) that are methods on an |
| 1255 | 1269 | ** sqlite3 object. |
| 1256 | 1270 | */ |
| 1257 | 1271 | typedef struct sqlite3 sqlite3; |
| 1258 | 1272 | |
| | @@ -1352,11 +1366,11 @@ |
| 1352 | 1366 | /* |
| 1353 | 1367 | ** CAPI3REF: One-Step Query Execution Interface |
| 1354 | 1368 | ** METHOD: sqlite3 |
| 1355 | 1369 | ** |
| 1356 | 1370 | ** The sqlite3_exec() interface is a convenience wrapper around |
| 1357 | | -** [sqlite3_prepare_v2()], [sqlite3_step()], and [sqlite3_finalize()], |
| 1371 | +** [sqlite3_prepare_v3()], [sqlite3_step()], and [sqlite3_finalize()], |
| 1358 | 1372 | ** that allows an application to run multiple statements of SQL |
| 1359 | 1373 | ** without having to use a lot of C code. |
| 1360 | 1374 | ** |
| 1361 | 1375 | ** ^The sqlite3_exec() interface runs zero or more UTF-8 encoded, |
| 1362 | 1376 | ** semicolon-separate SQL statements passed into its 2nd argument, |
| | @@ -3020,19 +3034,31 @@ |
| 3020 | 3034 | ** default) to enable them. The second parameter is a pointer to an integer |
| 3021 | 3035 | ** into which is written 0 or 1 to indicate whether checkpoints-on-close |
| 3022 | 3036 | ** have been disabled - 0 if they are not disabled, 1 if they are. |
| 3023 | 3037 | ** </dd> |
| 3024 | 3038 | ** |
| 3039 | +** <dt>SQLITE_DBCONFIG_ENABLE_QPSG</dt> |
| 3040 | +** <dd>The SQLITE_DBCONFIG_ENABLE_QPSG option activates or deactivates |
| 3041 | +** the [query planner stability guarantee] (QPSG). When the QPSG is active, |
| 3042 | +** a single SQL query statement will always use the same algorithm regardless |
| 3043 | +** of values of [bound parameters]. The QPSG disables some query optimizations |
| 3044 | +** that look at the values of bound parameters, which can make some queries |
| 3045 | +** slower. But the QPSG has the advantage of more predictable behavior. With |
| 3046 | +** the QPSG active, SQLite will always use the same query plan in the field as |
| 3047 | +** was used during testing in the lab. |
| 3048 | +** </dd> |
| 3049 | +** |
| 3025 | 3050 | ** </dl> |
| 3026 | 3051 | */ |
| 3027 | 3052 | #define SQLITE_DBCONFIG_MAINDBNAME 1000 /* const char* */ |
| 3028 | 3053 | #define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */ |
| 3029 | 3054 | #define SQLITE_DBCONFIG_ENABLE_FKEY 1002 /* int int* */ |
| 3030 | 3055 | #define SQLITE_DBCONFIG_ENABLE_TRIGGER 1003 /* int int* */ |
| 3031 | 3056 | #define SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER 1004 /* int int* */ |
| 3032 | 3057 | #define SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION 1005 /* int int* */ |
| 3033 | 3058 | #define SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE 1006 /* int int* */ |
| 3059 | +#define SQLITE_DBCONFIG_ENABLE_QPSG 1007 /* int int* */ |
| 3034 | 3060 | |
| 3035 | 3061 | |
| 3036 | 3062 | /* |
| 3037 | 3063 | ** CAPI3REF: Enable Or Disable Extended Result Codes |
| 3038 | 3064 | ** METHOD: sqlite3 |
| | @@ -3692,25 +3718,26 @@ |
| 3692 | 3718 | ** |
| 3693 | 3719 | ** ^This routine registers an authorizer callback with a particular |
| 3694 | 3720 | ** [database connection], supplied in the first argument. |
| 3695 | 3721 | ** ^The authorizer callback is invoked as SQL statements are being compiled |
| 3696 | 3722 | ** by [sqlite3_prepare()] or its variants [sqlite3_prepare_v2()], |
| 3697 | | -** [sqlite3_prepare16()] and [sqlite3_prepare16_v2()]. ^At various |
| 3723 | +** [sqlite3_prepare_v3()], [sqlite3_prepare16()], [sqlite3_prepare16_v2()], |
| 3724 | +** and [sqlite3_prepare16_v3()]. ^At various |
| 3698 | 3725 | ** points during the compilation process, as logic is being created |
| 3699 | 3726 | ** to perform various actions, the authorizer callback is invoked to |
| 3700 | 3727 | ** see if those actions are allowed. ^The authorizer callback should |
| 3701 | 3728 | ** return [SQLITE_OK] to allow the action, [SQLITE_IGNORE] to disallow the |
| 3702 | 3729 | ** specific action but allow the SQL statement to continue to be |
| 3703 | 3730 | ** compiled, or [SQLITE_DENY] to cause the entire SQL statement to be |
| 3704 | 3731 | ** rejected with an error. ^If the authorizer callback returns |
| 3705 | 3732 | ** any value other than [SQLITE_IGNORE], [SQLITE_OK], or [SQLITE_DENY] |
| 3706 | | -** then the [sqlite3_prepare_v2()] or equivalent call that triggered |
| 3733 | +** then the [sqlite3_prepare_v3()] or equivalent call that triggered |
| 3707 | 3734 | ** the authorizer will fail with an error message. |
| 3708 | 3735 | ** |
| 3709 | 3736 | ** When the callback returns [SQLITE_OK], that means the operation |
| 3710 | 3737 | ** requested is ok. ^When the callback returns [SQLITE_DENY], the |
| 3711 | | -** [sqlite3_prepare_v2()] or equivalent call that triggered the |
| 3738 | +** [sqlite3_prepare_v3()] or equivalent call that triggered the |
| 3712 | 3739 | ** authorizer will fail with an error message explaining that |
| 3713 | 3740 | ** access is denied. |
| 3714 | 3741 | ** |
| 3715 | 3742 | ** ^The first parameter to the authorizer callback is a copy of the third |
| 3716 | 3743 | ** parameter to the sqlite3_set_authorizer() interface. ^The second parameter |
| | @@ -3757,23 +3784,23 @@ |
| 3757 | 3784 | ** previous call.)^ ^Disable the authorizer by installing a NULL callback. |
| 3758 | 3785 | ** The authorizer is disabled by default. |
| 3759 | 3786 | ** |
| 3760 | 3787 | ** The authorizer callback must not do anything that will modify |
| 3761 | 3788 | ** the database connection that invoked the authorizer callback. |
| 3762 | | -** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their |
| 3789 | +** Note that [sqlite3_prepare_v3()] and [sqlite3_step()] both modify their |
| 3763 | 3790 | ** database connections for the meaning of "modify" in this paragraph. |
| 3764 | 3791 | ** |
| 3765 | | -** ^When [sqlite3_prepare_v2()] is used to prepare a statement, the |
| 3792 | +** ^When [sqlite3_prepare_v3()] is used to prepare a statement, the |
| 3766 | 3793 | ** statement might be re-prepared during [sqlite3_step()] due to a |
| 3767 | 3794 | ** schema change. Hence, the application should ensure that the |
| 3768 | 3795 | ** correct authorizer callback remains in place during the [sqlite3_step()]. |
| 3769 | 3796 | ** |
| 3770 | 3797 | ** ^Note that the authorizer callback is invoked only during |
| 3771 | 3798 | ** [sqlite3_prepare()] or its variants. Authorization is not |
| 3772 | 3799 | ** performed during statement evaluation in [sqlite3_step()], unless |
| 3773 | 3800 | ** as stated in the previous paragraph, sqlite3_step() invokes |
| 3774 | | -** sqlite3_prepare_v2() to reprepare a statement after a schema change. |
| 3801 | +** sqlite3_prepare_v3() to reprepare a statement after a schema change. |
| 3775 | 3802 | */ |
| 3776 | 3803 | SQLITE_API int sqlite3_set_authorizer( |
| 3777 | 3804 | sqlite3*, |
| 3778 | 3805 | int (*xAuth)(void*,int,const char*,const char*,const char*,const char*), |
| 3779 | 3806 | void *pUserData |
| | @@ -4005,11 +4032,11 @@ |
| 4005 | 4032 | ** interrupted. This feature can be used to implement a |
| 4006 | 4033 | ** "Cancel" button on a GUI progress dialog box. |
| 4007 | 4034 | ** |
| 4008 | 4035 | ** The progress handler callback must not do anything that will modify |
| 4009 | 4036 | ** the database connection that invoked the progress handler. |
| 4010 | | -** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their |
| 4037 | +** Note that [sqlite3_prepare_v3()] and [sqlite3_step()] both modify their |
| 4011 | 4038 | ** database connections for the meaning of "modify" in this paragraph. |
| 4012 | 4039 | ** |
| 4013 | 4040 | */ |
| 4014 | 4041 | SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*); |
| 4015 | 4042 | |
| | @@ -4359,11 +4386,11 @@ |
| 4359 | 4386 | ** prepared statement before it can be run. |
| 4360 | 4387 | ** |
| 4361 | 4388 | ** The life-cycle of a prepared statement object usually goes like this: |
| 4362 | 4389 | ** |
| 4363 | 4390 | ** <ol> |
| 4364 | | -** <li> Create the prepared statement object using [sqlite3_prepare_v2()]. |
| 4391 | +** <li> Create the prepared statement object using [sqlite3_prepare_v3()]. |
| 4365 | 4392 | ** <li> Bind values to [parameters] using the sqlite3_bind_*() |
| 4366 | 4393 | ** interfaces. |
| 4367 | 4394 | ** <li> Run the SQL by calling [sqlite3_step()] one or more times. |
| 4368 | 4395 | ** <li> Reset the prepared statement using [sqlite3_reset()] then go back |
| 4369 | 4396 | ** to step 2. Do this zero or more times. |
| | @@ -4441,11 +4468,11 @@ |
| 4441 | 4468 | ** [[SQLITE_LIMIT_COMPOUND_SELECT]] ^(<dt>SQLITE_LIMIT_COMPOUND_SELECT</dt> |
| 4442 | 4469 | ** <dd>The maximum number of terms in a compound SELECT statement.</dd>)^ |
| 4443 | 4470 | ** |
| 4444 | 4471 | ** [[SQLITE_LIMIT_VDBE_OP]] ^(<dt>SQLITE_LIMIT_VDBE_OP</dt> |
| 4445 | 4472 | ** <dd>The maximum number of instructions in a virtual machine program |
| 4446 | | -** used to implement an SQL statement. If [sqlite3_prepare_v2()] or |
| 4473 | +** used to implement an SQL statement. If [sqlite3_prepare_v3()] or |
| 4447 | 4474 | ** the equivalent tries to allocate space for more than this many opcodes |
| 4448 | 4475 | ** in a single prepared statement, an SQLITE_NOMEM error is returned.</dd>)^ |
| 4449 | 4476 | ** |
| 4450 | 4477 | ** [[SQLITE_LIMIT_FUNCTION_ARG]] ^(<dt>SQLITE_LIMIT_FUNCTION_ARG</dt> |
| 4451 | 4478 | ** <dd>The maximum number of arguments on a function.</dd>)^ |
| | @@ -4481,28 +4508,61 @@ |
| 4481 | 4508 | #define SQLITE_LIMIT_LIKE_PATTERN_LENGTH 8 |
| 4482 | 4509 | #define SQLITE_LIMIT_VARIABLE_NUMBER 9 |
| 4483 | 4510 | #define SQLITE_LIMIT_TRIGGER_DEPTH 10 |
| 4484 | 4511 | #define SQLITE_LIMIT_WORKER_THREADS 11 |
| 4485 | 4512 | |
| 4513 | +/* |
| 4514 | +** CAPI3REF: Prepare Flags |
| 4515 | +** |
| 4516 | +** These constants define various flags that can be passed into |
| 4517 | +** "prepFlags" parameter of the [sqlite3_prepare_v3()] and |
| 4518 | +** [sqlite3_prepare16_v3()] interfaces. |
| 4519 | +** |
| 4520 | +** New flags may be added in future releases of SQLite. |
| 4521 | +** |
| 4522 | +** <dl> |
| 4523 | +** [[SQLITE_PREPARE_PERSISTENT]] ^(<dt>SQLITE_PREPARE_PERSISTENT</dt> |
| 4524 | +** <dd>The SQLITE_PREPARE_PERSISTENT flag causes [sqlite3_prepare_v3()] |
| 4525 | +** and [sqlite3_prepare16_v3()] |
| 4526 | +** to optimize the resulting prepared statement to be retained for a |
| 4527 | +** relatively long amount of time.)^ ^Without this flag, |
| 4528 | +** [sqlite3_prepare_v3()] and [sqlite3_prepare16_v3()] assume that |
| 4529 | +** the prepared statement will be used just once or at most a few times |
| 4530 | +** and then destroyed using [sqlite3_finalize()] relatively soon. |
| 4531 | +** </dl> |
| 4532 | +*/ |
| 4533 | +#define SQLITE_PREPARE_PERSISTENT 0x01 |
| 4486 | 4534 | |
| 4487 | 4535 | /* |
| 4488 | 4536 | ** CAPI3REF: Compiling An SQL Statement |
| 4489 | 4537 | ** KEYWORDS: {SQL statement compiler} |
| 4490 | 4538 | ** METHOD: sqlite3 |
| 4491 | 4539 | ** CONSTRUCTOR: sqlite3_stmt |
| 4492 | 4540 | ** |
| 4493 | | -** To execute an SQL query, it must first be compiled into a byte-code |
| 4494 | | -** program using one of these routines. |
| 4541 | +** To execute an SQL statement, it must first be compiled into a byte-code |
| 4542 | +** program using one of these routines. Or, in other words, these routines |
| 4543 | +** are constructors for the [prepared statement] object. |
| 4544 | +** |
| 4545 | +** The preferred routine to use is [sqlite3_prepare_v2()]. The |
| 4546 | +** [sqlite3_prepare()] interface is legacy and should be avoided. |
| 4547 | +** [sqlite3_prepare_v3()] has an extra "prepFlags" option that is used |
| 4548 | +** for special purposes. |
| 4549 | +** |
| 4550 | +** The use of the UTF-8 interfaces is preferred, as SQLite currently |
| 4551 | +** does all parsing using UTF-8. The UTF-16 interfaces are provided |
| 4552 | +** as a convenience. The UTF-16 interfaces work by converting the |
| 4553 | +** input text into UTF-8, then invoking the corresponding UTF-8 interface. |
| 4495 | 4554 | ** |
| 4496 | 4555 | ** The first argument, "db", is a [database connection] obtained from a |
| 4497 | 4556 | ** prior successful call to [sqlite3_open()], [sqlite3_open_v2()] or |
| 4498 | 4557 | ** [sqlite3_open16()]. The database connection must not have been closed. |
| 4499 | 4558 | ** |
| 4500 | 4559 | ** The second argument, "zSql", is the statement to be compiled, encoded |
| 4501 | | -** as either UTF-8 or UTF-16. The sqlite3_prepare() and sqlite3_prepare_v2() |
| 4502 | | -** interfaces use UTF-8, and sqlite3_prepare16() and sqlite3_prepare16_v2() |
| 4503 | | -** use UTF-16. |
| 4560 | +** as either UTF-8 or UTF-16. The sqlite3_prepare(), sqlite3_prepare_v2(), |
| 4561 | +** and sqlite3_prepare_v3() |
| 4562 | +** interfaces use UTF-8, and sqlite3_prepare16(), sqlite3_prepare16_v2(), |
| 4563 | +** and sqlite3_prepare16_v3() use UTF-16. |
| 4504 | 4564 | ** |
| 4505 | 4565 | ** ^If the nByte argument is negative, then zSql is read up to the |
| 4506 | 4566 | ** first zero terminator. ^If nByte is positive, then it is the |
| 4507 | 4567 | ** number of bytes read from zSql. ^If nByte is zero, then no prepared |
| 4508 | 4568 | ** statement is generated. |
| | @@ -4525,14 +4585,15 @@ |
| 4525 | 4585 | ** ppStmt may not be NULL. |
| 4526 | 4586 | ** |
| 4527 | 4587 | ** ^On success, the sqlite3_prepare() family of routines return [SQLITE_OK]; |
| 4528 | 4588 | ** otherwise an [error code] is returned. |
| 4529 | 4589 | ** |
| 4530 | | -** The sqlite3_prepare_v2() and sqlite3_prepare16_v2() interfaces are |
| 4531 | | -** recommended for all new programs. The two older interfaces are retained |
| 4532 | | -** for backwards compatibility, but their use is discouraged. |
| 4533 | | -** ^In the "v2" interfaces, the prepared statement |
| 4590 | +** The sqlite3_prepare_v2(), sqlite3_prepare_v3(), sqlite3_prepare16_v2(), |
| 4591 | +** and sqlite3_prepare16_v3() interfaces are recommended for all new programs. |
| 4592 | +** The older interfaces (sqlite3_prepare() and sqlite3_prepare16()) |
| 4593 | +** are retained for backwards compatibility, but their use is discouraged. |
| 4594 | +** ^In the "vX" interfaces, the prepared statement |
| 4534 | 4595 | ** that is returned (the [sqlite3_stmt] object) contains a copy of the |
| 4535 | 4596 | ** original SQL text. This causes the [sqlite3_step()] interface to |
| 4536 | 4597 | ** behave differently in three ways: |
| 4537 | 4598 | ** |
| 4538 | 4599 | ** <ol> |
| | @@ -4561,10 +4622,16 @@ |
| 4561 | 4622 | ** ^The specific value of WHERE-clause [parameter] might influence the |
| 4562 | 4623 | ** choice of query plan if the parameter is the left-hand side of a [LIKE] |
| 4563 | 4624 | ** or [GLOB] operator or if the parameter is compared to an indexed column |
| 4564 | 4625 | ** and the [SQLITE_ENABLE_STAT3] compile-time option is enabled. |
| 4565 | 4626 | ** </li> |
| 4627 | +** |
| 4628 | +** <p>^sqlite3_prepare_v3() differs from sqlite3_prepare_v2() only in having |
| 4629 | +** the extra prepFlags parameter, which is a bit array consisting of zero or |
| 4630 | +** more of the [SQLITE_PREPARE_PERSISTENT|SQLITE_PREPARE_*] flags. ^The |
| 4631 | +** sqlite3_prepare_v2() interface works exactly the same as |
| 4632 | +** sqlite3_prepare_v3() with a zero prepFlags parameter. |
| 4566 | 4633 | ** </ol> |
| 4567 | 4634 | */ |
| 4568 | 4635 | SQLITE_API int sqlite3_prepare( |
| 4569 | 4636 | sqlite3 *db, /* Database handle */ |
| 4570 | 4637 | const char *zSql, /* SQL statement, UTF-8 encoded */ |
| | @@ -4574,10 +4641,18 @@ |
| 4574 | 4641 | ); |
| 4575 | 4642 | SQLITE_API int sqlite3_prepare_v2( |
| 4576 | 4643 | sqlite3 *db, /* Database handle */ |
| 4577 | 4644 | const char *zSql, /* SQL statement, UTF-8 encoded */ |
| 4578 | 4645 | int nByte, /* Maximum length of zSql in bytes. */ |
| 4646 | + sqlite3_stmt **ppStmt, /* OUT: Statement handle */ |
| 4647 | + const char **pzTail /* OUT: Pointer to unused portion of zSql */ |
| 4648 | +); |
| 4649 | +SQLITE_API int sqlite3_prepare_v3( |
| 4650 | + sqlite3 *db, /* Database handle */ |
| 4651 | + const char *zSql, /* SQL statement, UTF-8 encoded */ |
| 4652 | + int nByte, /* Maximum length of zSql in bytes. */ |
| 4653 | + unsigned int prepFlags, /* Zero or more SQLITE_PREPARE_ flags */ |
| 4579 | 4654 | sqlite3_stmt **ppStmt, /* OUT: Statement handle */ |
| 4580 | 4655 | const char **pzTail /* OUT: Pointer to unused portion of zSql */ |
| 4581 | 4656 | ); |
| 4582 | 4657 | SQLITE_API int sqlite3_prepare16( |
| 4583 | 4658 | sqlite3 *db, /* Database handle */ |
| | @@ -4591,18 +4666,27 @@ |
| 4591 | 4666 | const void *zSql, /* SQL statement, UTF-16 encoded */ |
| 4592 | 4667 | int nByte, /* Maximum length of zSql in bytes. */ |
| 4593 | 4668 | sqlite3_stmt **ppStmt, /* OUT: Statement handle */ |
| 4594 | 4669 | const void **pzTail /* OUT: Pointer to unused portion of zSql */ |
| 4595 | 4670 | ); |
| 4671 | +SQLITE_API int sqlite3_prepare16_v3( |
| 4672 | + sqlite3 *db, /* Database handle */ |
| 4673 | + const void *zSql, /* SQL statement, UTF-16 encoded */ |
| 4674 | + int nByte, /* Maximum length of zSql in bytes. */ |
| 4675 | + unsigned int prepFalgs, /* Zero or more SQLITE_PREPARE_ flags */ |
| 4676 | + sqlite3_stmt **ppStmt, /* OUT: Statement handle */ |
| 4677 | + const void **pzTail /* OUT: Pointer to unused portion of zSql */ |
| 4678 | +); |
| 4596 | 4679 | |
| 4597 | 4680 | /* |
| 4598 | 4681 | ** CAPI3REF: Retrieving Statement SQL |
| 4599 | 4682 | ** METHOD: sqlite3_stmt |
| 4600 | 4683 | ** |
| 4601 | 4684 | ** ^The sqlite3_sql(P) interface returns a pointer to a copy of the UTF-8 |
| 4602 | 4685 | ** SQL text used to create [prepared statement] P if P was |
| 4603 | | -** created by either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()]. |
| 4686 | +** created by [sqlite3_prepare_v2()], [sqlite3_prepare_v3()], |
| 4687 | +** [sqlite3_prepare16_v2()], or [sqlite3_prepare16_v3()]. |
| 4604 | 4688 | ** ^The sqlite3_expanded_sql(P) interface returns a pointer to a UTF-8 |
| 4605 | 4689 | ** string containing the SQL text of prepared statement P with |
| 4606 | 4690 | ** [bound parameters] expanded. |
| 4607 | 4691 | ** |
| 4608 | 4692 | ** ^(For example, if a prepared statement is created using the SQL |
| | @@ -4744,11 +4828,11 @@ |
| 4744 | 4828 | ** CAPI3REF: Binding Values To Prepared Statements |
| 4745 | 4829 | ** KEYWORDS: {host parameter} {host parameters} {host parameter name} |
| 4746 | 4830 | ** KEYWORDS: {SQL parameter} {SQL parameters} {parameter binding} |
| 4747 | 4831 | ** METHOD: sqlite3_stmt |
| 4748 | 4832 | ** |
| 4749 | | -** ^(In the SQL statement text input to [sqlite3_prepare_v2()] and its variants, |
| 4833 | +** ^(In the SQL statement text input to [sqlite3_prepare_v3()] and its variants, |
| 4750 | 4834 | ** literals may be replaced by a [parameter] that matches one of following |
| 4751 | 4835 | ** templates: |
| 4752 | 4836 | ** |
| 4753 | 4837 | ** <ul> |
| 4754 | 4838 | ** <li> ? |
| | @@ -4763,11 +4847,11 @@ |
| 4763 | 4847 | ** parameters (also called "host parameter names" or "SQL parameters") |
| 4764 | 4848 | ** can be set using the sqlite3_bind_*() routines defined here. |
| 4765 | 4849 | ** |
| 4766 | 4850 | ** ^The first argument to the sqlite3_bind_*() routines is always |
| 4767 | 4851 | ** a pointer to the [sqlite3_stmt] object returned from |
| 4768 | | -** [sqlite3_prepare_v2()] or its variants. |
| 4852 | +** [sqlite3_prepare_v3()] or its variants. |
| 4769 | 4853 | ** |
| 4770 | 4854 | ** ^The second argument is the index of the SQL parameter to be set. |
| 4771 | 4855 | ** ^The leftmost SQL parameter has an index of 1. ^When the same named |
| 4772 | 4856 | ** SQL parameter is used more than once, second and subsequent |
| 4773 | 4857 | ** occurrences have the same index as the first occurrence. |
| | @@ -4900,12 +4984,12 @@ |
| 4900 | 4984 | ** ^The first host parameter has an index of 1, not 0. |
| 4901 | 4985 | ** |
| 4902 | 4986 | ** ^If the value N is out of range or if the N-th parameter is |
| 4903 | 4987 | ** nameless, then NULL is returned. ^The returned string is |
| 4904 | 4988 | ** always in UTF-8 encoding even if the named parameter was |
| 4905 | | -** originally specified as UTF-16 in [sqlite3_prepare16()] or |
| 4906 | | -** [sqlite3_prepare16_v2()]. |
| 4989 | +** originally specified as UTF-16 in [sqlite3_prepare16()], |
| 4990 | +** [sqlite3_prepare16_v2()], or [sqlite3_prepare16_v3()]. |
| 4907 | 4991 | ** |
| 4908 | 4992 | ** See also: [sqlite3_bind_blob|sqlite3_bind()], |
| 4909 | 4993 | ** [sqlite3_bind_parameter_count()], and |
| 4910 | 4994 | ** [sqlite3_bind_parameter_index()]. |
| 4911 | 4995 | */ |
| | @@ -4918,11 +5002,12 @@ |
| 4918 | 5002 | ** ^Return the index of an SQL parameter given its name. ^The |
| 4919 | 5003 | ** index value returned is suitable for use as the second |
| 4920 | 5004 | ** parameter to [sqlite3_bind_blob|sqlite3_bind()]. ^A zero |
| 4921 | 5005 | ** is returned if no matching parameter is found. ^The parameter |
| 4922 | 5006 | ** name must be given in UTF-8 even if the original statement |
| 4923 | | -** was prepared from UTF-16 text using [sqlite3_prepare16_v2()]. |
| 5007 | +** was prepared from UTF-16 text using [sqlite3_prepare16_v2()] or |
| 5008 | +** [sqlite3_prepare16_v3()]. |
| 4924 | 5009 | ** |
| 4925 | 5010 | ** See also: [sqlite3_bind_blob|sqlite3_bind()], |
| 4926 | 5011 | ** [sqlite3_bind_parameter_count()], and |
| 4927 | 5012 | ** [sqlite3_bind_parameter_name()]. |
| 4928 | 5013 | */ |
| | @@ -5072,20 +5157,22 @@ |
| 5072 | 5157 | |
| 5073 | 5158 | /* |
| 5074 | 5159 | ** CAPI3REF: Evaluate An SQL Statement |
| 5075 | 5160 | ** METHOD: sqlite3_stmt |
| 5076 | 5161 | ** |
| 5077 | | -** After a [prepared statement] has been prepared using either |
| 5078 | | -** [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] or one of the legacy |
| 5162 | +** After a [prepared statement] has been prepared using any of |
| 5163 | +** [sqlite3_prepare_v2()], [sqlite3_prepare_v3()], [sqlite3_prepare16_v2()], |
| 5164 | +** or [sqlite3_prepare16_v3()] or one of the legacy |
| 5079 | 5165 | ** interfaces [sqlite3_prepare()] or [sqlite3_prepare16()], this function |
| 5080 | 5166 | ** must be called one or more times to evaluate the statement. |
| 5081 | 5167 | ** |
| 5082 | 5168 | ** The details of the behavior of the sqlite3_step() interface depend |
| 5083 | | -** on whether the statement was prepared using the newer "v2" interface |
| 5084 | | -** [sqlite3_prepare_v2()] and [sqlite3_prepare16_v2()] or the older legacy |
| 5085 | | -** interface [sqlite3_prepare()] and [sqlite3_prepare16()]. The use of the |
| 5086 | | -** new "v2" interface is recommended for new applications but the legacy |
| 5169 | +** on whether the statement was prepared using the newer "vX" interfaces |
| 5170 | +** [sqlite3_prepare_v3()], [sqlite3_prepare_v2()], [sqlite3_prepare16_v3()], |
| 5171 | +** [sqlite3_prepare16_v2()] or the older legacy |
| 5172 | +** interfaces [sqlite3_prepare()] and [sqlite3_prepare16()]. The use of the |
| 5173 | +** new "vX" interface is recommended for new applications but the legacy |
| 5087 | 5174 | ** interface will continue to be supported. |
| 5088 | 5175 | ** |
| 5089 | 5176 | ** ^In the legacy interface, the return value will be either [SQLITE_BUSY], |
| 5090 | 5177 | ** [SQLITE_DONE], [SQLITE_ROW], [SQLITE_ERROR], or [SQLITE_MISUSE]. |
| 5091 | 5178 | ** ^With the "v2" interface, any of the other [result codes] or |
| | @@ -5142,14 +5229,15 @@ |
| 5142 | 5229 | ** error other than [SQLITE_BUSY] and [SQLITE_MISUSE]. You must call |
| 5143 | 5230 | ** [sqlite3_reset()] or [sqlite3_finalize()] in order to find one of the |
| 5144 | 5231 | ** specific [error codes] that better describes the error. |
| 5145 | 5232 | ** We admit that this is a goofy design. The problem has been fixed |
| 5146 | 5233 | ** with the "v2" interface. If you prepare all of your SQL statements |
| 5147 | | -** using either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] instead |
| 5234 | +** using [sqlite3_prepare_v3()] or [sqlite3_prepare_v2()] |
| 5235 | +** or [sqlite3_prepare16_v2()] or [sqlite3_prepare16_v3()] instead |
| 5148 | 5236 | ** of the legacy [sqlite3_prepare()] and [sqlite3_prepare16()] interfaces, |
| 5149 | 5237 | ** then the more specific [error codes] are returned directly |
| 5150 | | -** by sqlite3_step(). The use of the "v2" interface is recommended. |
| 5238 | +** by sqlite3_step(). The use of the "vX" interfaces is recommended. |
| 5151 | 5239 | */ |
| 5152 | 5240 | SQLITE_API int sqlite3_step(sqlite3_stmt*); |
| 5153 | 5241 | |
| 5154 | 5242 | /* |
| 5155 | 5243 | ** CAPI3REF: Number of columns in a result set |
| | @@ -5210,11 +5298,11 @@ |
| 5210 | 5298 | ** METHOD: sqlite3_stmt |
| 5211 | 5299 | ** |
| 5212 | 5300 | ** ^These routines return information about a single column of the current |
| 5213 | 5301 | ** result row of a query. ^In every case the first argument is a pointer |
| 5214 | 5302 | ** to the [prepared statement] that is being evaluated (the [sqlite3_stmt*] |
| 5215 | | -** that was returned from [sqlite3_prepare_v2()] or one of its variants) |
| 5303 | +** that was returned from [sqlite3_prepare_v3()] or one of its variants) |
| 5216 | 5304 | ** and the second argument is the index of the column for which information |
| 5217 | 5305 | ** should be returned. ^The leftmost column of the result set has the index 0. |
| 5218 | 5306 | ** ^The number of columns in the result can be determined using |
| 5219 | 5307 | ** [sqlite3_column_count()]. |
| 5220 | 5308 | ** |
| | @@ -6334,11 +6422,11 @@ |
| 6334 | 6422 | ** |
| 6335 | 6423 | ** ^The sqlite3_db_handle interface returns the [database connection] handle |
| 6336 | 6424 | ** to which a [prepared statement] belongs. ^The [database connection] |
| 6337 | 6425 | ** returned by sqlite3_db_handle is the same [database connection] |
| 6338 | 6426 | ** that was the first argument |
| 6339 | | -** to the [sqlite3_prepare_v2()] call (or its variants) that was used to |
| 6427 | +** to the [sqlite3_prepare_v3()] call (or its variants) that was used to |
| 6340 | 6428 | ** create the statement in the first place. |
| 6341 | 6429 | */ |
| 6342 | 6430 | SQLITE_API sqlite3 *sqlite3_db_handle(sqlite3_stmt*); |
| 6343 | 6431 | |
| 6344 | 6432 | /* |
| | @@ -6410,11 +6498,11 @@ |
| 6410 | 6498 | ** the database connection that invoked the callback. Any actions |
| 6411 | 6499 | ** to modify the database connection must be deferred until after the |
| 6412 | 6500 | ** completion of the [sqlite3_step()] call that triggered the commit |
| 6413 | 6501 | ** or rollback hook in the first place. |
| 6414 | 6502 | ** Note that running any other SQL statements, including SELECT statements, |
| 6415 | | -** or merely calling [sqlite3_prepare_v2()] and [sqlite3_step()] will modify |
| 6503 | +** or merely calling [sqlite3_prepare_v3()] and [sqlite3_step()] will modify |
| 6416 | 6504 | ** the database connections for the meaning of "modify" in this paragraph. |
| 6417 | 6505 | ** |
| 6418 | 6506 | ** ^Registering a NULL function disables the callback. |
| 6419 | 6507 | ** |
| 6420 | 6508 | ** ^When the commit hook callback routine returns zero, the [COMMIT] |
| | @@ -6470,11 +6558,11 @@ |
| 6470 | 6558 | ** |
| 6471 | 6559 | ** The update hook implementation must not do anything that will modify |
| 6472 | 6560 | ** the database connection that invoked the update hook. Any actions |
| 6473 | 6561 | ** to modify the database connection must be deferred until after the |
| 6474 | 6562 | ** completion of the [sqlite3_step()] call that triggered the update hook. |
| 6475 | | -** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their |
| 6563 | +** Note that [sqlite3_prepare_v3()] and [sqlite3_step()] both modify their |
| 6476 | 6564 | ** database connections for the meaning of "modify" in this paragraph. |
| 6477 | 6565 | ** |
| 6478 | 6566 | ** ^The sqlite3_update_hook(D,C,P) function |
| 6479 | 6567 | ** returns the P argument from the previous call |
| 6480 | 6568 | ** on the same [database connection] D, or NULL for |
| | @@ -8148,10 +8236,22 @@ |
| 8148 | 8236 | ** by the prepared statement if that number is less than or equal |
| 8149 | 8237 | ** to 2147483647. The number of virtual machine operations can be |
| 8150 | 8238 | ** used as a proxy for the total work done by the prepared statement. |
| 8151 | 8239 | ** If the number of virtual machine operations exceeds 2147483647 |
| 8152 | 8240 | ** then the value returned by this statement status code is undefined. |
| 8241 | +** |
| 8242 | +** [[SQLITE_STMTSTATUS_REPREPARE]] <dt>SQLITE_STMTSTATUS_REPREPARE</dt> |
| 8243 | +** <dd>^This is the number of times that the prepare statement has been |
| 8244 | +** automatically regenerated due to schema changes or change to |
| 8245 | +** [bound parameters] that might affect the query plan. |
| 8246 | +** |
| 8247 | +** [[SQLITE_STMTSTATUS_RUN]] <dt>SQLITE_STMTSTATUS_RUN</dt> |
| 8248 | +** <dd>^This is the number of times that the prepared statement has |
| 8249 | +** been run. A single "run" for the purposes of this counter is one |
| 8250 | +** or more calls to [sqlite3_step()] followed by a call to [sqlite3_reset()]. |
| 8251 | +** The counter is incremented on the first [sqlite3_step()] call of each |
| 8252 | +** cycle. |
| 8153 | 8253 | ** |
| 8154 | 8254 | ** [[SQLITE_STMTSTATUS_MEMUSED]] <dt>SQLITE_STMTSTATUS_MEMUSED</dt> |
| 8155 | 8255 | ** <dd>^This is the approximate number of bytes of heap memory |
| 8156 | 8256 | ** used to store the prepared statement. ^This value is not actually |
| 8157 | 8257 | ** a counter, and so the resetFlg parameter to sqlite3_stmt_status() |
| | @@ -8161,11 +8261,13 @@ |
| 8161 | 8261 | */ |
| 8162 | 8262 | #define SQLITE_STMTSTATUS_FULLSCAN_STEP 1 |
| 8163 | 8263 | #define SQLITE_STMTSTATUS_SORT 2 |
| 8164 | 8264 | #define SQLITE_STMTSTATUS_AUTOINDEX 3 |
| 8165 | 8265 | #define SQLITE_STMTSTATUS_VM_STEP 4 |
| 8166 | | -#define SQLITE_STMTSTATUS_MEMUSED 5 |
| 8266 | +#define SQLITE_STMTSTATUS_REPREPARE 5 |
| 8267 | +#define SQLITE_STMTSTATUS_RUN 6 |
| 8268 | +#define SQLITE_STMTSTATUS_MEMUSED 99 |
| 8167 | 8269 | |
| 8168 | 8270 | /* |
| 8169 | 8271 | ** CAPI3REF: Custom Page Cache Object |
| 8170 | 8272 | ** |
| 8171 | 8273 | ** The sqlite3_pcache type is opaque. It is implemented by |
| | @@ -11528,12 +11630,13 @@ |
| 11528 | 11630 | |
| 11529 | 11631 | /* |
| 11530 | 11632 | ** Include the configuration header output by 'configure' if we're using the |
| 11531 | 11633 | ** autoconf-based build |
| 11532 | 11634 | */ |
| 11533 | | -#ifdef _HAVE_SQLITE_CONFIG_H |
| 11534 | | -#include "config.h" |
| 11635 | +#if defined(_HAVE_SQLITE_CONFIG_H) && !defined(SQLITECONFIG_H) |
| 11636 | +/* #include "config.h" */ |
| 11637 | +#define SQLITECONFIG_H 1 |
| 11535 | 11638 | #endif |
| 11536 | 11639 | |
| 11537 | 11640 | /************** Include sqliteLimit.h in the middle of sqliteInt.h ***********/ |
| 11538 | 11641 | /************** Begin file sqliteLimit.h *************************************/ |
| 11539 | 11642 | /* |
| | @@ -13695,10 +13798,16 @@ |
| 13695 | 13798 | #define SQLITE_MX_JUMP_OPCODE 83 /* Maximum JUMP opcode */ |
| 13696 | 13799 | |
| 13697 | 13800 | /************** End of opcodes.h *********************************************/ |
| 13698 | 13801 | /************** Continuing where we left off in vdbe.h ***********************/ |
| 13699 | 13802 | |
| 13803 | +/* |
| 13804 | +** Additional non-public SQLITE_PREPARE_* flags |
| 13805 | +*/ |
| 13806 | +#define SQLITE_PREPARE_SAVESQL 0x80 /* Preserve SQL text */ |
| 13807 | +#define SQLITE_PREPARE_MASK 0x0f /* Mask of public flags */ |
| 13808 | + |
| 13700 | 13809 | /* |
| 13701 | 13810 | ** Prototypes for the VDBE interface. See comments on the implementation |
| 13702 | 13811 | ** for a description of what each of these routines does. |
| 13703 | 13812 | */ |
| 13704 | 13813 | SQLITE_PRIVATE Vdbe *sqlite3VdbeCreate(Parse*); |
| | @@ -13752,11 +13861,12 @@ |
| 13752 | 13861 | SQLITE_PRIVATE int sqlite3VdbeReset(Vdbe*); |
| 13753 | 13862 | SQLITE_PRIVATE void sqlite3VdbeSetNumCols(Vdbe*,int); |
| 13754 | 13863 | SQLITE_PRIVATE int sqlite3VdbeSetColName(Vdbe*, int, int, const char *, void(*)(void*)); |
| 13755 | 13864 | SQLITE_PRIVATE void sqlite3VdbeCountChanges(Vdbe*); |
| 13756 | 13865 | SQLITE_PRIVATE sqlite3 *sqlite3VdbeDb(Vdbe*); |
| 13757 | | -SQLITE_PRIVATE void sqlite3VdbeSetSql(Vdbe*, const char *z, int n, int); |
| 13866 | +SQLITE_PRIVATE u8 sqlite3VdbePrepareFlags(Vdbe*); |
| 13867 | +SQLITE_PRIVATE void sqlite3VdbeSetSql(Vdbe*, const char *z, int n, u8); |
| 13758 | 13868 | SQLITE_PRIVATE void sqlite3VdbeSwap(Vdbe*,Vdbe*); |
| 13759 | 13869 | SQLITE_PRIVATE VdbeOp *sqlite3VdbeTakeOpArray(Vdbe*, int*, int*); |
| 13760 | 13870 | SQLITE_PRIVATE sqlite3_value *sqlite3VdbeGetBoundValue(Vdbe*, int, u8); |
| 13761 | 13871 | SQLITE_PRIVATE void sqlite3VdbeSetVarmask(Vdbe*, int); |
| 13762 | 13872 | #ifndef SQLITE_OMIT_TRACE |
| | @@ -14974,12 +15084,12 @@ |
| 14974 | 15084 | ** Value constraints (enforced via assert()): |
| 14975 | 15085 | ** SQLITE_FullFSync == PAGER_FULLFSYNC |
| 14976 | 15086 | ** SQLITE_CkptFullFSync == PAGER_CKPT_FULLFSYNC |
| 14977 | 15087 | ** SQLITE_CacheSpill == PAGER_CACHE_SPILL |
| 14978 | 15088 | */ |
| 14979 | | -#define SQLITE_VdbeTrace 0x00000001 /* True to trace VDBE execution */ |
| 14980 | | -#define SQLITE_InternChanges 0x00000002 /* Uncommitted Hash table changes */ |
| 15089 | +#define SQLITE_WriteSchema 0x00000001 /* OK to update SQLITE_MASTER */ |
| 15090 | +#define SQLITE_LegacyFileFmt 0x00000002 /* Create new databases in format 1 */ |
| 14981 | 15091 | #define SQLITE_FullColNames 0x00000004 /* Show full column names on SELECT */ |
| 14982 | 15092 | #define SQLITE_FullFSync 0x00000008 /* Use full fsync on the backend */ |
| 14983 | 15093 | #define SQLITE_CkptFullFSync 0x00000010 /* Use full fsync for checkpoint */ |
| 14984 | 15094 | #define SQLITE_CacheSpill 0x00000020 /* OK to spill pager cache */ |
| 14985 | 15095 | #define SQLITE_ShortColNames 0x00000040 /* Show short columns names */ |
| | @@ -14986,33 +15096,38 @@ |
| 14986 | 15096 | #define SQLITE_CountRows 0x00000080 /* Count rows changed by INSERT, */ |
| 14987 | 15097 | /* DELETE, or UPDATE and return */ |
| 14988 | 15098 | /* the count using a callback. */ |
| 14989 | 15099 | #define SQLITE_NullCallback 0x00000100 /* Invoke the callback once if the */ |
| 14990 | 15100 | /* result set is empty */ |
| 14991 | | -#define SQLITE_SqlTrace 0x00000200 /* Debug print SQL as it executes */ |
| 14992 | | -#define SQLITE_VdbeListing 0x00000400 /* Debug listings of VDBE programs */ |
| 14993 | | -#define SQLITE_WriteSchema 0x00000800 /* OK to update SQLITE_MASTER */ |
| 14994 | | -#define SQLITE_VdbeAddopTrace 0x00001000 /* Trace sqlite3VdbeAddOp() calls */ |
| 14995 | | -#define SQLITE_IgnoreChecks 0x00002000 /* Do not enforce check constraints */ |
| 14996 | | -#define SQLITE_ReadUncommitted 0x0004000 /* For shared-cache mode */ |
| 14997 | | -#define SQLITE_LegacyFileFmt 0x00008000 /* Create new databases in format 1 */ |
| 14998 | | -#define SQLITE_RecoveryMode 0x00010000 /* Ignore schema errors */ |
| 14999 | | -#define SQLITE_ReverseOrder 0x00020000 /* Reverse unordered SELECTs */ |
| 15000 | | -#define SQLITE_RecTriggers 0x00040000 /* Enable recursive triggers */ |
| 15001 | | -#define SQLITE_ForeignKeys 0x00080000 /* Enforce foreign key constraints */ |
| 15002 | | -#define SQLITE_AutoIndex 0x00100000 /* Enable automatic indexes */ |
| 15003 | | -#define SQLITE_PreferBuiltin 0x00200000 /* Preference to built-in funcs */ |
| 15004 | | -#define SQLITE_LoadExtension 0x00400000 /* Enable load_extension */ |
| 15005 | | -#define SQLITE_LoadExtFunc 0x00800000 /* Enable load_extension() SQL func */ |
| 15006 | | -#define SQLITE_EnableTrigger 0x01000000 /* True to enable triggers */ |
| 15007 | | -#define SQLITE_DeferFKs 0x02000000 /* Defer all FK constraints */ |
| 15008 | | -#define SQLITE_QueryOnly 0x04000000 /* Disable database changes */ |
| 15009 | | -#define SQLITE_VdbeEQP 0x08000000 /* Debug EXPLAIN QUERY PLAN */ |
| 15010 | | -#define SQLITE_Vacuum 0x10000000 /* Currently in a VACUUM */ |
| 15011 | | -#define SQLITE_CellSizeCk 0x20000000 /* Check btree cell sizes on load */ |
| 15012 | | -#define SQLITE_Fts3Tokenizer 0x40000000 /* Enable fts3_tokenizer(2) */ |
| 15013 | | -#define SQLITE_NoCkptOnClose 0x80000000 /* No checkpoint on close()/DETACH */ |
| 15101 | +#define SQLITE_IgnoreChecks 0x00000200 /* Do not enforce check constraints */ |
| 15102 | +#define SQLITE_ReadUncommit 0x00000400 /* READ UNCOMMITTED in shared-cache */ |
| 15103 | +#define SQLITE_NoCkptOnClose 0x00000800 /* No checkpoint on close()/DETACH */ |
| 15104 | +#define SQLITE_ReverseOrder 0x00001000 /* Reverse unordered SELECTs */ |
| 15105 | +#define SQLITE_RecTriggers 0x00002000 /* Enable recursive triggers */ |
| 15106 | +#define SQLITE_ForeignKeys 0x00004000 /* Enforce foreign key constraints */ |
| 15107 | +#define SQLITE_AutoIndex 0x00008000 /* Enable automatic indexes */ |
| 15108 | +#define SQLITE_LoadExtension 0x00010000 /* Enable load_extension */ |
| 15109 | +#define SQLITE_EnableTrigger 0x00020000 /* True to enable triggers */ |
| 15110 | +#define SQLITE_DeferFKs 0x00040000 /* Defer all FK constraints */ |
| 15111 | +#define SQLITE_QueryOnly 0x00080000 /* Disable database changes */ |
| 15112 | +#define SQLITE_CellSizeCk 0x00100000 /* Check btree cell sizes on load */ |
| 15113 | +#define SQLITE_Fts3Tokenizer 0x00200000 /* Enable fts3_tokenizer(2) */ |
| 15114 | +#define SQLITE_EnableQPSG 0x00400000 /* Query Planner Stability Guarantee */ |
| 15115 | +/* The next four values are not used by PRAGMAs or by sqlite3_dbconfig() and |
| 15116 | +** could be factored out into a separate bit vector of the sqlite3 object. */ |
| 15117 | +#define SQLITE_InternChanges 0x00800000 /* Uncommitted Hash table changes */ |
| 15118 | +#define SQLITE_LoadExtFunc 0x01000000 /* Enable load_extension() SQL func */ |
| 15119 | +#define SQLITE_PreferBuiltin 0x02000000 /* Preference to built-in funcs */ |
| 15120 | +#define SQLITE_Vacuum 0x04000000 /* Currently in a VACUUM */ |
| 15121 | +/* Flags used only if debugging */ |
| 15122 | +#ifdef SQLITE_DEBUG |
| 15123 | +#define SQLITE_SqlTrace 0x08000000 /* Debug print SQL as it executes */ |
| 15124 | +#define SQLITE_VdbeListing 0x10000000 /* Debug listings of VDBE programs */ |
| 15125 | +#define SQLITE_VdbeTrace 0x20000000 /* True to trace VDBE execution */ |
| 15126 | +#define SQLITE_VdbeAddopTrace 0x40000000 /* Trace sqlite3VdbeAddOp() calls */ |
| 15127 | +#define SQLITE_VdbeEQP 0x80000000 /* Debug EXPLAIN QUERY PLAN */ |
| 15128 | +#endif |
| 15014 | 15129 | |
| 15015 | 15130 | |
| 15016 | 15131 | /* |
| 15017 | 15132 | ** Bits of the sqlite3.dbOptFlags field that are used by the |
| 15018 | 15133 | ** sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS,...) interface to |
| | @@ -17305,14 +17420,14 @@ |
| 17305 | 17420 | SQLITE_PRIVATE void sqlite3UnlinkAndDeleteTable(sqlite3*,int,const char*); |
| 17306 | 17421 | SQLITE_PRIVATE void sqlite3UnlinkAndDeleteIndex(sqlite3*,int,const char*); |
| 17307 | 17422 | SQLITE_PRIVATE void sqlite3Vacuum(Parse*,Token*); |
| 17308 | 17423 | SQLITE_PRIVATE int sqlite3RunVacuum(char**, sqlite3*, int); |
| 17309 | 17424 | SQLITE_PRIVATE char *sqlite3NameFromToken(sqlite3*, Token*); |
| 17310 | | -SQLITE_PRIVATE int sqlite3ExprCompare(Expr*, Expr*, int); |
| 17425 | +SQLITE_PRIVATE int sqlite3ExprCompare(Parse*,Expr*, Expr*, int); |
| 17311 | 17426 | SQLITE_PRIVATE int sqlite3ExprCompareSkip(Expr*, Expr*, int); |
| 17312 | 17427 | SQLITE_PRIVATE int sqlite3ExprListCompare(ExprList*, ExprList*, int); |
| 17313 | | -SQLITE_PRIVATE int sqlite3ExprImpliesExpr(Expr*, Expr*, int); |
| 17428 | +SQLITE_PRIVATE int sqlite3ExprImpliesExpr(Parse*,Expr*, Expr*, int); |
| 17314 | 17429 | SQLITE_PRIVATE void sqlite3ExprAnalyzeAggregates(NameContext*, Expr*); |
| 17315 | 17430 | SQLITE_PRIVATE void sqlite3ExprAnalyzeAggList(NameContext*,ExprList*); |
| 17316 | 17431 | SQLITE_PRIVATE int sqlite3ExprCoveredByIndex(Expr*, int iCur, Index *pIdx); |
| 17317 | 17432 | SQLITE_PRIVATE int sqlite3FunctionUsesThisSrc(Expr*, SrcList*); |
| 17318 | 17433 | SQLITE_PRIVATE Vdbe *sqlite3GetVdbe(Parse*); |
| | @@ -18606,22 +18721,22 @@ |
| 18606 | 18721 | int rcApp; /* errcode set by sqlite3_result_error_code() */ |
| 18607 | 18722 | #endif |
| 18608 | 18723 | u16 nResColumn; /* Number of columns in one row of the result set */ |
| 18609 | 18724 | u8 errorAction; /* Recovery action to do in case of an error */ |
| 18610 | 18725 | u8 minWriteFileFormat; /* Minimum file format for writable database files */ |
| 18726 | + u8 prepFlags; /* SQLITE_PREPARE_* flags */ |
| 18611 | 18727 | bft expired:1; /* True if the VM needs to be recompiled */ |
| 18612 | 18728 | bft doingRerun:1; /* True if rerunning after an auto-reprepare */ |
| 18613 | 18729 | bft explain:2; /* True if EXPLAIN present on SQL command */ |
| 18614 | 18730 | bft changeCntOn:1; /* True to update the change-counter */ |
| 18615 | 18731 | bft runOnlyOnce:1; /* Automatically expire on reset */ |
| 18616 | 18732 | bft usesStmtJournal:1; /* True if uses a statement journal */ |
| 18617 | 18733 | bft readOnly:1; /* True for statements that do not write */ |
| 18618 | 18734 | bft bIsReader:1; /* True for statements that read */ |
| 18619 | | - bft isPrepareV2:1; /* True if prepared with prepare_v2() */ |
| 18620 | 18735 | yDbMask btreeMask; /* Bitmask of db->aDb[] entries referenced */ |
| 18621 | 18736 | yDbMask lockMask; /* Subset of btreeMask that requires a lock */ |
| 18622 | | - u32 aCounter[5]; /* Counters used by sqlite3_stmt_status() */ |
| 18737 | + u32 aCounter[7]; /* Counters used by sqlite3_stmt_status() */ |
| 18623 | 18738 | char *zSql; /* Text of the SQL statement that generated this */ |
| 18624 | 18739 | void *pFree; /* Free this when deleting the vdbe */ |
| 18625 | 18740 | VdbeFrame *pFrame; /* Parent frame */ |
| 18626 | 18741 | VdbeFrame *pDelFrame; /* List of frame objects to free on VM reset */ |
| 18627 | 18742 | int nFrame; /* Number of frames in pFrame list */ |
| | @@ -59469,11 +59584,11 @@ |
| 59469 | 59584 | /* If this database is not shareable, or if the client is reading |
| 59470 | 59585 | ** and has the read-uncommitted flag set, then no lock is required. |
| 59471 | 59586 | ** Return true immediately. |
| 59472 | 59587 | */ |
| 59473 | 59588 | if( (pBtree->sharable==0) |
| 59474 | | - || (eLockType==READ_LOCK && (pBtree->db->flags & SQLITE_ReadUncommitted)) |
| 59589 | + || (eLockType==READ_LOCK && (pBtree->db->flags & SQLITE_ReadUncommit)) |
| 59475 | 59590 | ){ |
| 59476 | 59591 | return 1; |
| 59477 | 59592 | } |
| 59478 | 59593 | |
| 59479 | 59594 | /* If the client is reading or writing an index and the schema is |
| | @@ -59546,11 +59661,11 @@ |
| 59546 | 59661 | static int hasReadConflicts(Btree *pBtree, Pgno iRoot){ |
| 59547 | 59662 | BtCursor *p; |
| 59548 | 59663 | for(p=pBtree->pBt->pCursor; p; p=p->pNext){ |
| 59549 | 59664 | if( p->pgnoRoot==iRoot |
| 59550 | 59665 | && p->pBtree!=pBtree |
| 59551 | | - && 0==(p->pBtree->db->flags & SQLITE_ReadUncommitted) |
| 59666 | + && 0==(p->pBtree->db->flags & SQLITE_ReadUncommit) |
| 59552 | 59667 | ){ |
| 59553 | 59668 | return 1; |
| 59554 | 59669 | } |
| 59555 | 59670 | } |
| 59556 | 59671 | return 0; |
| | @@ -59568,11 +59683,11 @@ |
| 59568 | 59683 | BtLock *pIter; |
| 59569 | 59684 | |
| 59570 | 59685 | assert( sqlite3BtreeHoldsMutex(p) ); |
| 59571 | 59686 | assert( eLock==READ_LOCK || eLock==WRITE_LOCK ); |
| 59572 | 59687 | assert( p->db!=0 ); |
| 59573 | | - assert( !(p->db->flags&SQLITE_ReadUncommitted)||eLock==WRITE_LOCK||iTab==1 ); |
| 59688 | + assert( !(p->db->flags&SQLITE_ReadUncommit)||eLock==WRITE_LOCK||iTab==1 ); |
| 59574 | 59689 | |
| 59575 | 59690 | /* If requesting a write-lock, then the Btree must have an open write |
| 59576 | 59691 | ** transaction on this file. And, obviously, for this to be so there |
| 59577 | 59692 | ** must be an open write transaction on the file itself. |
| 59578 | 59693 | */ |
| | @@ -59646,11 +59761,11 @@ |
| 59646 | 59761 | |
| 59647 | 59762 | /* A connection with the read-uncommitted flag set will never try to |
| 59648 | 59763 | ** obtain a read-lock using this function. The only read-lock obtained |
| 59649 | 59764 | ** by a connection in read-uncommitted mode is on the sqlite_master |
| 59650 | 59765 | ** table, and that lock is obtained in BtreeBeginTrans(). */ |
| 59651 | | - assert( 0==(p->db->flags&SQLITE_ReadUncommitted) || eLock==WRITE_LOCK ); |
| 59766 | + assert( 0==(p->db->flags&SQLITE_ReadUncommit) || eLock==WRITE_LOCK ); |
| 59652 | 59767 | |
| 59653 | 59768 | /* This function should only be called on a sharable b-tree after it |
| 59654 | 59769 | ** has been determined that no other b-tree holds a conflicting lock. */ |
| 59655 | 59770 | assert( p->sharable ); |
| 59656 | 59771 | assert( SQLITE_OK==querySharedCacheTableLock(p, iTable, eLock) ); |
| | @@ -62338,11 +62453,11 @@ |
| 62338 | 62453 | freeTempSpace(pBt); |
| 62339 | 62454 | rc = sqlite3PagerSetPagesize(pBt->pPager, &pBt->pageSize, |
| 62340 | 62455 | pageSize-usableSize); |
| 62341 | 62456 | return rc; |
| 62342 | 62457 | } |
| 62343 | | - if( (pBt->db->flags & SQLITE_RecoveryMode)==0 && nPage>nPageFile ){ |
| 62458 | + if( (pBt->db->flags & SQLITE_WriteSchema)==0 && nPage>nPageFile ){ |
| 62344 | 62459 | rc = SQLITE_CORRUPT_BKPT; |
| 62345 | 62460 | goto page1_init_failed; |
| 62346 | 62461 | } |
| 62347 | 62462 | /* EVIDENCE-OF: R-28312-64704 However, the usable size is not allowed to |
| 62348 | 62463 | ** be less than 480. In other words, if the page size is 512, then the |
| | @@ -71465,28 +71580,25 @@ |
| 71465 | 71580 | sqlite3 *db = pParse->db; |
| 71466 | 71581 | |
| 71467 | 71582 | /* Skip over any TK_COLLATE nodes */ |
| 71468 | 71583 | pExpr = sqlite3ExprSkipCollate(pExpr); |
| 71469 | 71584 | |
| 71585 | + assert( pExpr==0 || pExpr->op!=TK_REGISTER || pExpr->op2!=TK_VARIABLE ); |
| 71470 | 71586 | if( !pExpr ){ |
| 71471 | 71587 | pVal = valueNew(db, pAlloc); |
| 71472 | 71588 | if( pVal ){ |
| 71473 | 71589 | sqlite3VdbeMemSetNull((Mem*)pVal); |
| 71474 | 71590 | } |
| 71475 | | - }else if( pExpr->op==TK_VARIABLE |
| 71476 | | - || NEVER(pExpr->op==TK_REGISTER && pExpr->op2==TK_VARIABLE) |
| 71477 | | - ){ |
| 71591 | + }else if( pExpr->op==TK_VARIABLE && (db->flags & SQLITE_EnableQPSG)==0 ){ |
| 71478 | 71592 | Vdbe *v; |
| 71479 | 71593 | int iBindVar = pExpr->iColumn; |
| 71480 | 71594 | sqlite3VdbeSetVarmask(pParse->pVdbe, iBindVar); |
| 71481 | 71595 | if( (v = pParse->pReprepare)!=0 ){ |
| 71482 | 71596 | pVal = valueNew(db, pAlloc); |
| 71483 | 71597 | if( pVal ){ |
| 71484 | 71598 | rc = sqlite3VdbeMemCopy((Mem*)pVal, &v->aVar[iBindVar-1]); |
| 71485 | | - if( rc==SQLITE_OK ){ |
| 71486 | | - sqlite3ValueApplyAffinity(pVal, affinity, ENC(db)); |
| 71487 | | - } |
| 71599 | + sqlite3ValueApplyAffinity(pVal, affinity, ENC(db)); |
| 71488 | 71600 | pVal->db = pParse->db; |
| 71489 | 71601 | } |
| 71490 | 71602 | } |
| 71491 | 71603 | }else{ |
| 71492 | 71604 | rc = valueFromExpr(db, pExpr, ENC(db), affinity, &pVal, pAlloc); |
| | @@ -71756,20 +71868,18 @@ |
| 71756 | 71868 | } |
| 71757 | 71869 | |
| 71758 | 71870 | /* |
| 71759 | 71871 | ** Remember the SQL string for a prepared statement. |
| 71760 | 71872 | */ |
| 71761 | | -SQLITE_PRIVATE void sqlite3VdbeSetSql(Vdbe *p, const char *z, int n, int isPrepareV2){ |
| 71762 | | - assert( isPrepareV2==1 || isPrepareV2==0 ); |
| 71873 | +SQLITE_PRIVATE void sqlite3VdbeSetSql(Vdbe *p, const char *z, int n, u8 prepFlags){ |
| 71763 | 71874 | if( p==0 ) return; |
| 71764 | | - if( !isPrepareV2 ) p->expmask = 0; |
| 71765 | | -#if defined(SQLITE_OMIT_TRACE) && !defined(SQLITE_ENABLE_SQLLOG) |
| 71766 | | - if( !isPrepareV2 ) return; |
| 71767 | | -#endif |
| 71875 | + p->prepFlags = prepFlags; |
| 71876 | + if( (prepFlags & SQLITE_PREPARE_SAVESQL)==0 ){ |
| 71877 | + p->expmask = 0; |
| 71878 | + } |
| 71768 | 71879 | assert( p->zSql==0 ); |
| 71769 | 71880 | p->zSql = sqlite3DbStrNDup(p->db, z, n); |
| 71770 | | - p->isPrepareV2 = (u8)isPrepareV2; |
| 71771 | 71881 | } |
| 71772 | 71882 | |
| 71773 | 71883 | /* |
| 71774 | 71884 | ** Swap all content between two VDBE structures. |
| 71775 | 71885 | */ |
| | @@ -71787,12 +71897,14 @@ |
| 71787 | 71897 | pA->pPrev = pB->pPrev; |
| 71788 | 71898 | pB->pPrev = pTmp; |
| 71789 | 71899 | zTmp = pA->zSql; |
| 71790 | 71900 | pA->zSql = pB->zSql; |
| 71791 | 71901 | pB->zSql = zTmp; |
| 71792 | | - pB->isPrepareV2 = pA->isPrepareV2; |
| 71793 | 71902 | pB->expmask = pA->expmask; |
| 71903 | + pB->prepFlags = pA->prepFlags; |
| 71904 | + memcpy(pB->aCounter, pA->aCounter, sizeof(pB->aCounter)); |
| 71905 | + pB->aCounter[SQLITE_STMTSTATUS_REPREPARE]++; |
| 71794 | 71906 | } |
| 71795 | 71907 | |
| 71796 | 71908 | /* |
| 71797 | 71909 | ** Resize the Vdbe.aOp array so that it is at least nOp elements larger |
| 71798 | 71910 | ** than its current size. nOp is guaranteed to be less than or equal |
| | @@ -76231,10 +76343,17 @@ |
| 76231 | 76343 | ** Return the database associated with the Vdbe. |
| 76232 | 76344 | */ |
| 76233 | 76345 | SQLITE_PRIVATE sqlite3 *sqlite3VdbeDb(Vdbe *v){ |
| 76234 | 76346 | return v->db; |
| 76235 | 76347 | } |
| 76348 | + |
| 76349 | +/* |
| 76350 | +** Return the SQLITE_PREPARE flags for a Vdbe. |
| 76351 | +*/ |
| 76352 | +SQLITE_PRIVATE u8 sqlite3VdbePrepareFlags(Vdbe *v){ |
| 76353 | + return v->prepFlags; |
| 76354 | +} |
| 76236 | 76355 | |
| 76237 | 76356 | /* |
| 76238 | 76357 | ** Return a pointer to an sqlite3_value structure containing the value bound |
| 76239 | 76358 | ** parameter iVar of VM v. Except, if the value is an SQL NULL, return |
| 76240 | 76359 | ** 0 instead. Unless it is NULL, apply affinity aff (one of the SQLITE_AFF_* |
| | @@ -76244,10 +76363,11 @@ |
| 76244 | 76363 | */ |
| 76245 | 76364 | SQLITE_PRIVATE sqlite3_value *sqlite3VdbeGetBoundValue(Vdbe *v, int iVar, u8 aff){ |
| 76246 | 76365 | assert( iVar>0 ); |
| 76247 | 76366 | if( v ){ |
| 76248 | 76367 | Mem *pMem = &v->aVar[iVar-1]; |
| 76368 | + assert( (v->db->flags & SQLITE_EnableQPSG)==0 ); |
| 76249 | 76369 | if( 0==(pMem->flags & MEM_Null) ){ |
| 76250 | 76370 | sqlite3_value *pRet = sqlite3ValueNew(v->db); |
| 76251 | 76371 | if( pRet ){ |
| 76252 | 76372 | sqlite3VdbeMemCopy((Mem *)pRet, pMem); |
| 76253 | 76373 | sqlite3ValueApplyAffinity(pRet, aff, SQLITE_UTF8); |
| | @@ -76263,10 +76383,11 @@ |
| 76263 | 76383 | ** to sqlite3_reoptimize() that re-preparing the statement may result |
| 76264 | 76384 | ** in a better query plan. |
| 76265 | 76385 | */ |
| 76266 | 76386 | SQLITE_PRIVATE void sqlite3VdbeSetVarmask(Vdbe *v, int iVar){ |
| 76267 | 76387 | assert( iVar>0 ); |
| 76388 | + assert( (v->db->flags & SQLITE_EnableQPSG)==0 ); |
| 76268 | 76389 | if( iVar>=32 ){ |
| 76269 | 76390 | v->expmask |= 0x80000000; |
| 76270 | 76391 | }else{ |
| 76271 | 76392 | v->expmask |= ((u32)1 << (iVar-1)); |
| 76272 | 76393 | } |
| | @@ -76534,11 +76655,11 @@ |
| 76534 | 76655 | sqlite3_mutex_enter(mutex); |
| 76535 | 76656 | for(i=0; i<p->nVar; i++){ |
| 76536 | 76657 | sqlite3VdbeMemRelease(&p->aVar[i]); |
| 76537 | 76658 | p->aVar[i].flags = MEM_Null; |
| 76538 | 76659 | } |
| 76539 | | - assert( p->isPrepareV2 || p->expmask==0 ); |
| 76660 | + assert( (p->prepFlags & SQLITE_PREPARE_SAVESQL)!=0 || p->expmask==0 ); |
| 76540 | 76661 | if( p->expmask ){ |
| 76541 | 76662 | p->expired = 1; |
| 76542 | 76663 | } |
| 76543 | 76664 | sqlite3_mutex_leave(mutex); |
| 76544 | 76665 | return rc; |
| | @@ -77013,12 +77134,15 @@ |
| 77013 | 77134 | */ |
| 77014 | 77135 | assert( rc==SQLITE_ROW || rc==SQLITE_DONE || rc==SQLITE_ERROR |
| 77015 | 77136 | || (rc&0xff)==SQLITE_BUSY || rc==SQLITE_MISUSE |
| 77016 | 77137 | ); |
| 77017 | 77138 | assert( (p->rc!=SQLITE_ROW && p->rc!=SQLITE_DONE) || p->rc==p->rcApp ); |
| 77018 | | - if( p->isPrepareV2 && rc!=SQLITE_ROW && rc!=SQLITE_DONE ){ |
| 77019 | | - /* If this statement was prepared using sqlite3_prepare_v2(), and an |
| 77139 | + if( (p->prepFlags & SQLITE_PREPARE_SAVESQL)!=0 |
| 77140 | + && rc!=SQLITE_ROW |
| 77141 | + && rc!=SQLITE_DONE |
| 77142 | + ){ |
| 77143 | + /* If this statement was prepared using saved SQL and an |
| 77020 | 77144 | ** error has occurred, then return the error code in p->rc to the |
| 77021 | 77145 | ** caller. Set the error code in the database handle to the same value. |
| 77022 | 77146 | */ |
| 77023 | 77147 | rc = sqlite3VdbeTransferError(p); |
| 77024 | 77148 | } |
| | @@ -77653,11 +77777,11 @@ |
| 77653 | 77777 | ** parameter in the WHERE clause might influence the choice of query plan |
| 77654 | 77778 | ** for a statement, then the statement will be automatically recompiled, |
| 77655 | 77779 | ** as if there had been a schema change, on the first sqlite3_step() call |
| 77656 | 77780 | ** following any change to the bindings of that parameter. |
| 77657 | 77781 | */ |
| 77658 | | - assert( p->isPrepareV2 || p->expmask==0 ); |
| 77782 | + assert( (p->prepFlags & SQLITE_PREPARE_SAVESQL)!=0 || p->expmask==0 ); |
| 77659 | 77783 | if( p->expmask!=0 && (p->expmask & (i>=31 ? 0x80000000 : (u32)1<<i))!=0 ){ |
| 77660 | 77784 | p->expired = 1; |
| 77661 | 77785 | } |
| 77662 | 77786 | return SQLITE_OK; |
| 77663 | 77787 | } |
| | @@ -77919,15 +78043,15 @@ |
| 77919 | 78043 | Vdbe *pFrom = (Vdbe*)pFromStmt; |
| 77920 | 78044 | Vdbe *pTo = (Vdbe*)pToStmt; |
| 77921 | 78045 | if( pFrom->nVar!=pTo->nVar ){ |
| 77922 | 78046 | return SQLITE_ERROR; |
| 77923 | 78047 | } |
| 77924 | | - assert( pTo->isPrepareV2 || pTo->expmask==0 ); |
| 78048 | + assert( (pTo->prepFlags & SQLITE_PREPARE_SAVESQL)!=0 || pTo->expmask==0 ); |
| 77925 | 78049 | if( pTo->expmask ){ |
| 77926 | 78050 | pTo->expired = 1; |
| 77927 | 78051 | } |
| 77928 | | - assert( pFrom->isPrepareV2 || pFrom->expmask==0 ); |
| 78052 | + assert( (pFrom->prepFlags & SQLITE_PREPARE_SAVESQL)!=0 || pFrom->expmask==0 ); |
| 77929 | 78053 | if( pFrom->expmask ){ |
| 77930 | 78054 | pFrom->expired = 1; |
| 77931 | 78055 | } |
| 77932 | 78056 | return sqlite3TransferBindings(pFromStmt, pToStmt); |
| 77933 | 78057 | } |
| | @@ -85158,11 +85282,11 @@ |
| 85158 | 85282 | ** P4 contains a pointer to the name of the table being locked. This is only |
| 85159 | 85283 | ** used to generate an error message if the lock cannot be obtained. |
| 85160 | 85284 | */ |
| 85161 | 85285 | case OP_TableLock: { |
| 85162 | 85286 | u8 isWriteLock = (u8)pOp->p3; |
| 85163 | | - if( isWriteLock || 0==(db->flags&SQLITE_ReadUncommitted) ){ |
| 85287 | + if( isWriteLock || 0==(db->flags&SQLITE_ReadUncommit) ){ |
| 85164 | 85288 | int p1 = pOp->p1; |
| 85165 | 85289 | assert( p1>=0 && p1<db->nDb ); |
| 85166 | 85290 | assert( DbMaskTest(p->btreeMask, p1) ); |
| 85167 | 85291 | assert( isWriteLock==0 || isWriteLock==1 ); |
| 85168 | 85292 | rc = sqlite3BtreeLockTable(db->aDb[p1].pBt, pOp->p2, isWriteLock); |
| | @@ -85666,10 +85790,11 @@ |
| 85666 | 85790 | if( p->aOp[i].opcode==OP_Once ) p->aOp[i].p1 = 0; |
| 85667 | 85791 | } |
| 85668 | 85792 | pOp->p1 = 0; |
| 85669 | 85793 | } |
| 85670 | 85794 | pOp->p1++; |
| 85795 | + p->aCounter[SQLITE_STMTSTATUS_RUN]++; |
| 85671 | 85796 | goto jump_to_p2; |
| 85672 | 85797 | } |
| 85673 | 85798 | |
| 85674 | 85799 | #ifdef SQLITE_ENABLE_CURSOR_HINTS |
| 85675 | 85800 | /* Opcode: CursorHint P1 * * P4 * |
| | @@ -90568,11 +90693,11 @@ |
| 90568 | 90693 | /* Try to match the ORDER BY expression against an expression |
| 90569 | 90694 | ** in the result set. Return an 1-based index of the matching |
| 90570 | 90695 | ** result-set entry. |
| 90571 | 90696 | */ |
| 90572 | 90697 | for(i=0; i<pEList->nExpr; i++){ |
| 90573 | | - if( sqlite3ExprCompare(pEList->a[i].pExpr, pE, -1)<2 ){ |
| 90698 | + if( sqlite3ExprCompare(0, pEList->a[i].pExpr, pE, -1)<2 ){ |
| 90574 | 90699 | return i+1; |
| 90575 | 90700 | } |
| 90576 | 90701 | } |
| 90577 | 90702 | |
| 90578 | 90703 | /* If no match, return 0. */ |
| | @@ -90802,11 +90927,11 @@ |
| 90802 | 90927 | pItem->u.x.iOrderByCol = 0; |
| 90803 | 90928 | if( sqlite3ResolveExprNames(pNC, pE) ){ |
| 90804 | 90929 | return 1; |
| 90805 | 90930 | } |
| 90806 | 90931 | for(j=0; j<pSelect->pEList->nExpr; j++){ |
| 90807 | | - if( sqlite3ExprCompare(pE, pSelect->pEList->a[j].pExpr, -1)==0 ){ |
| 90932 | + if( sqlite3ExprCompare(0, pE, pSelect->pEList->a[j].pExpr, -1)==0 ){ |
| 90808 | 90933 | pItem->u.x.iOrderByCol = j+1; |
| 90809 | 90934 | } |
| 90810 | 90935 | } |
| 90811 | 90936 | } |
| 90812 | 90937 | return sqlite3ResolveOrderGroupBy(pParse, pSelect, pOrderBy, zType); |
| | @@ -93027,11 +93152,11 @@ |
| 93027 | 93152 | |
| 93028 | 93153 | /* Check if pExpr is identical to any GROUP BY term. If so, consider |
| 93029 | 93154 | ** it constant. */ |
| 93030 | 93155 | for(i=0; i<pGroupBy->nExpr; i++){ |
| 93031 | 93156 | Expr *p = pGroupBy->a[i].pExpr; |
| 93032 | | - if( sqlite3ExprCompare(pExpr, p, -1)<2 ){ |
| 93157 | + if( sqlite3ExprCompare(0, pExpr, p, -1)<2 ){ |
| 93033 | 93158 | CollSeq *pColl = sqlite3ExprCollSeq(pWalker->pParse, p); |
| 93034 | 93159 | if( pColl==0 || sqlite3_stricmp("BINARY", pColl->zName)==0 ){ |
| 93035 | 93160 | return WRC_Prune; |
| 93036 | 93161 | } |
| 93037 | 93162 | } |
| | @@ -95303,11 +95428,11 @@ |
| 95303 | 95428 | p = pParse->pConstExpr; |
| 95304 | 95429 | if( regDest<0 && p ){ |
| 95305 | 95430 | struct ExprList_item *pItem; |
| 95306 | 95431 | int i; |
| 95307 | 95432 | for(pItem=p->a, i=p->nExpr; i>0; pItem++, i--){ |
| 95308 | | - if( pItem->reusable && sqlite3ExprCompare(pItem->pExpr,pExpr,-1)==0 ){ |
| 95433 | + if( pItem->reusable && sqlite3ExprCompare(0,pItem->pExpr,pExpr,-1)==0 ){ |
| 95309 | 95434 | return pItem->u.iConstExprReg; |
| 95310 | 95435 | } |
| 95311 | 95436 | } |
| 95312 | 95437 | } |
| 95313 | 95438 | pExpr = sqlite3ExprDup(pParse->db, pExpr, 0); |
| | @@ -95858,10 +95983,45 @@ |
| 95858 | 95983 | sqlite3ExprIfFalse(pParse, pCopy, dest, jumpIfNull); |
| 95859 | 95984 | } |
| 95860 | 95985 | sqlite3ExprDelete(db, pCopy); |
| 95861 | 95986 | } |
| 95862 | 95987 | |
| 95988 | +/* |
| 95989 | +** Expression pVar is guaranteed to be an SQL variable. pExpr may be any |
| 95990 | +** type of expression. |
| 95991 | +** |
| 95992 | +** If pExpr is a simple SQL value - an integer, real, string, blob |
| 95993 | +** or NULL value - then the VDBE currently being prepared is configured |
| 95994 | +** to re-prepare each time a new value is bound to variable pVar. |
| 95995 | +** |
| 95996 | +** Additionally, if pExpr is a simple SQL value and the value is the |
| 95997 | +** same as that currently bound to variable pVar, non-zero is returned. |
| 95998 | +** Otherwise, if the values are not the same or if pExpr is not a simple |
| 95999 | +** SQL value, zero is returned. |
| 96000 | +*/ |
| 96001 | +static int exprCompareVariable(Parse *pParse, Expr *pVar, Expr *pExpr){ |
| 96002 | + int res = 0; |
| 96003 | + int iVar; |
| 96004 | + sqlite3_value *pL, *pR = 0; |
| 96005 | + |
| 96006 | + sqlite3ValueFromExpr(pParse->db, pExpr, SQLITE_UTF8, SQLITE_AFF_BLOB, &pR); |
| 96007 | + if( pR ){ |
| 96008 | + iVar = pVar->iColumn; |
| 96009 | + sqlite3VdbeSetVarmask(pParse->pVdbe, iVar); |
| 96010 | + pL = sqlite3VdbeGetBoundValue(pParse->pReprepare, iVar, SQLITE_AFF_BLOB); |
| 96011 | + if( pL ){ |
| 96012 | + if( sqlite3_value_type(pL)==SQLITE_TEXT ){ |
| 96013 | + sqlite3_value_text(pL); /* Make sure the encoding is UTF-8 */ |
| 96014 | + } |
| 96015 | + res = 0==sqlite3MemCompare(pL, pR, 0); |
| 96016 | + } |
| 96017 | + sqlite3ValueFree(pR); |
| 96018 | + sqlite3ValueFree(pL); |
| 96019 | + } |
| 96020 | + |
| 96021 | + return res; |
| 96022 | +} |
| 95863 | 96023 | |
| 95864 | 96024 | /* |
| 95865 | 96025 | ** Do a deep comparison of two expression trees. Return 0 if the two |
| 95866 | 96026 | ** expressions are completely identical. Return 1 if they differ only |
| 95867 | 96027 | ** by a COLLATE operator at the top level. Return 2 if there are differences |
| | @@ -95880,28 +96040,38 @@ |
| 95880 | 96040 | ** expressions are the same. But if you get a 0 or 1 return, then you |
| 95881 | 96041 | ** can be sure the expressions are the same. In the places where |
| 95882 | 96042 | ** this routine is used, it does not hurt to get an extra 2 - that |
| 95883 | 96043 | ** just might result in some slightly slower code. But returning |
| 95884 | 96044 | ** an incorrect 0 or 1 could lead to a malfunction. |
| 96045 | +** |
| 96046 | +** If pParse is not NULL then TK_VARIABLE terms in pA with bindings in |
| 96047 | +** pParse->pReprepare can be matched against literals in pB. The |
| 96048 | +** pParse->pVdbe->expmask bitmask is updated for each variable referenced. |
| 96049 | +** If pParse is NULL (the normal case) then any TK_VARIABLE term in |
| 96050 | +** Argument pParse should normally be NULL. If it is not NULL and pA or |
| 96051 | +** pB causes a return value of 2. |
| 95885 | 96052 | */ |
| 95886 | | -SQLITE_PRIVATE int sqlite3ExprCompare(Expr *pA, Expr *pB, int iTab){ |
| 96053 | +SQLITE_PRIVATE int sqlite3ExprCompare(Parse *pParse, Expr *pA, Expr *pB, int iTab){ |
| 95887 | 96054 | u32 combinedFlags; |
| 95888 | 96055 | if( pA==0 || pB==0 ){ |
| 95889 | 96056 | return pB==pA ? 0 : 2; |
| 96057 | + } |
| 96058 | + if( pParse && pA->op==TK_VARIABLE && exprCompareVariable(pParse, pA, pB) ){ |
| 96059 | + return 0; |
| 95890 | 96060 | } |
| 95891 | 96061 | combinedFlags = pA->flags | pB->flags; |
| 95892 | 96062 | if( combinedFlags & EP_IntValue ){ |
| 95893 | 96063 | if( (pA->flags&pB->flags&EP_IntValue)!=0 && pA->u.iValue==pB->u.iValue ){ |
| 95894 | 96064 | return 0; |
| 95895 | 96065 | } |
| 95896 | 96066 | return 2; |
| 95897 | 96067 | } |
| 95898 | 96068 | if( pA->op!=pB->op ){ |
| 95899 | | - if( pA->op==TK_COLLATE && sqlite3ExprCompare(pA->pLeft, pB, iTab)<2 ){ |
| 96069 | + if( pA->op==TK_COLLATE && sqlite3ExprCompare(pParse, pA->pLeft,pB,iTab)<2 ){ |
| 95900 | 96070 | return 1; |
| 95901 | 96071 | } |
| 95902 | | - if( pB->op==TK_COLLATE && sqlite3ExprCompare(pA, pB->pLeft, iTab)<2 ){ |
| 96072 | + if( pB->op==TK_COLLATE && sqlite3ExprCompare(pParse, pA,pB->pLeft,iTab)<2 ){ |
| 95903 | 96073 | return 1; |
| 95904 | 96074 | } |
| 95905 | 96075 | return 2; |
| 95906 | 96076 | } |
| 95907 | 96077 | if( pA->op!=TK_COLUMN && pA->op!=TK_AGG_COLUMN && pA->u.zToken ){ |
| | @@ -95912,12 +96082,12 @@ |
| 95912 | 96082 | } |
| 95913 | 96083 | } |
| 95914 | 96084 | if( (pA->flags & EP_Distinct)!=(pB->flags & EP_Distinct) ) return 2; |
| 95915 | 96085 | if( ALWAYS((combinedFlags & EP_TokenOnly)==0) ){ |
| 95916 | 96086 | if( combinedFlags & EP_xIsSelect ) return 2; |
| 95917 | | - if( sqlite3ExprCompare(pA->pLeft, pB->pLeft, iTab) ) return 2; |
| 95918 | | - if( sqlite3ExprCompare(pA->pRight, pB->pRight, iTab) ) return 2; |
| 96087 | + if( sqlite3ExprCompare(pParse, pA->pLeft, pB->pLeft, iTab) ) return 2; |
| 96088 | + if( sqlite3ExprCompare(pParse, pA->pRight, pB->pRight, iTab) ) return 2; |
| 95919 | 96089 | if( sqlite3ExprListCompare(pA->x.pList, pB->x.pList, iTab) ) return 2; |
| 95920 | 96090 | if( ALWAYS((combinedFlags & EP_Reduced)==0) && pA->op!=TK_STRING ){ |
| 95921 | 96091 | if( pA->iColumn!=pB->iColumn ) return 2; |
| 95922 | 96092 | if( pA->iTable!=pB->iTable |
| 95923 | 96093 | && (pA->iTable!=iTab || NEVER(pB->iTable>=0)) ) return 2; |
| | @@ -95948,21 +96118,21 @@ |
| 95948 | 96118 | if( pA->nExpr!=pB->nExpr ) return 1; |
| 95949 | 96119 | for(i=0; i<pA->nExpr; i++){ |
| 95950 | 96120 | Expr *pExprA = pA->a[i].pExpr; |
| 95951 | 96121 | Expr *pExprB = pB->a[i].pExpr; |
| 95952 | 96122 | if( pA->a[i].sortOrder!=pB->a[i].sortOrder ) return 1; |
| 95953 | | - if( sqlite3ExprCompare(pExprA, pExprB, iTab) ) return 1; |
| 96123 | + if( sqlite3ExprCompare(0, pExprA, pExprB, iTab) ) return 1; |
| 95954 | 96124 | } |
| 95955 | 96125 | return 0; |
| 95956 | 96126 | } |
| 95957 | 96127 | |
| 95958 | 96128 | /* |
| 95959 | 96129 | ** Like sqlite3ExprCompare() except COLLATE operators at the top-level |
| 95960 | 96130 | ** are ignored. |
| 95961 | 96131 | */ |
| 95962 | 96132 | SQLITE_PRIVATE int sqlite3ExprCompareSkip(Expr *pA, Expr *pB, int iTab){ |
| 95963 | | - return sqlite3ExprCompare( |
| 96133 | + return sqlite3ExprCompare(0, |
| 95964 | 96134 | sqlite3ExprSkipCollate(pA), |
| 95965 | 96135 | sqlite3ExprSkipCollate(pB), |
| 95966 | 96136 | iTab); |
| 95967 | 96137 | } |
| 95968 | 96138 | |
| | @@ -95980,28 +96150,33 @@ |
| 95980 | 96150 | ** pE1: x IS ?2 pE2: x IS NOT NULL Reuslt: false |
| 95981 | 96151 | ** |
| 95982 | 96152 | ** When comparing TK_COLUMN nodes between pE1 and pE2, if pE2 has |
| 95983 | 96153 | ** Expr.iTable<0 then assume a table number given by iTab. |
| 95984 | 96154 | ** |
| 96155 | +** If pParse is not NULL, then the values of bound variables in pE1 are |
| 96156 | +** compared against literal values in pE2 and pParse->pVdbe->expmask is |
| 96157 | +** modified to record which bound variables are referenced. If pParse |
| 96158 | +** is NULL, then false will be returned if pE1 contains any bound variables. |
| 96159 | +** |
| 95985 | 96160 | ** When in doubt, return false. Returning true might give a performance |
| 95986 | 96161 | ** improvement. Returning false might cause a performance reduction, but |
| 95987 | 96162 | ** it will always give the correct answer and is hence always safe. |
| 95988 | 96163 | */ |
| 95989 | | -SQLITE_PRIVATE int sqlite3ExprImpliesExpr(Expr *pE1, Expr *pE2, int iTab){ |
| 95990 | | - if( sqlite3ExprCompare(pE1, pE2, iTab)==0 ){ |
| 96164 | +SQLITE_PRIVATE int sqlite3ExprImpliesExpr(Parse *pParse, Expr *pE1, Expr *pE2, int iTab){ |
| 96165 | + if( sqlite3ExprCompare(pParse, pE1, pE2, iTab)==0 ){ |
| 95991 | 96166 | return 1; |
| 95992 | 96167 | } |
| 95993 | 96168 | if( pE2->op==TK_OR |
| 95994 | | - && (sqlite3ExprImpliesExpr(pE1, pE2->pLeft, iTab) |
| 95995 | | - || sqlite3ExprImpliesExpr(pE1, pE2->pRight, iTab) ) |
| 96169 | + && (sqlite3ExprImpliesExpr(pParse, pE1, pE2->pLeft, iTab) |
| 96170 | + || sqlite3ExprImpliesExpr(pParse, pE1, pE2->pRight, iTab) ) |
| 95996 | 96171 | ){ |
| 95997 | 96172 | return 1; |
| 95998 | 96173 | } |
| 95999 | 96174 | if( pE2->op==TK_NOTNULL && pE1->op!=TK_ISNULL && pE1->op!=TK_IS ){ |
| 96000 | 96175 | Expr *pX = sqlite3ExprSkipCollate(pE1->pLeft); |
| 96001 | 96176 | testcase( pX!=pE1->pLeft ); |
| 96002 | | - if( sqlite3ExprCompare(pX, pE2->pLeft, iTab)==0 ) return 1; |
| 96177 | + if( sqlite3ExprCompare(pParse, pX, pE2->pLeft, iTab)==0 ) return 1; |
| 96003 | 96178 | } |
| 96004 | 96179 | return 0; |
| 96005 | 96180 | } |
| 96006 | 96181 | |
| 96007 | 96182 | /* |
| | @@ -96238,11 +96413,11 @@ |
| 96238 | 96413 | /* Check to see if pExpr is a duplicate of another aggregate |
| 96239 | 96414 | ** function that is already in the pAggInfo structure |
| 96240 | 96415 | */ |
| 96241 | 96416 | struct AggInfo_func *pItem = pAggInfo->aFunc; |
| 96242 | 96417 | for(i=0; i<pAggInfo->nFunc; i++, pItem++){ |
| 96243 | | - if( sqlite3ExprCompare(pItem->pExpr, pExpr, -1)==0 ){ |
| 96418 | + if( sqlite3ExprCompare(0, pItem->pExpr, pExpr, -1)==0 ){ |
| 96244 | 96419 | break; |
| 96245 | 96420 | } |
| 96246 | 96421 | } |
| 96247 | 96422 | if( i>=pAggInfo->nFunc ){ |
| 96248 | 96423 | /* pExpr is original. Make a new entry in pAggInfo->aFunc[] |
| | @@ -96795,11 +96970,11 @@ |
| 96795 | 96970 | ** in pParse->zErr (system tables may not be altered) and returns non-zero. |
| 96796 | 96971 | ** |
| 96797 | 96972 | ** Or, if zName is not a system table, zero is returned. |
| 96798 | 96973 | */ |
| 96799 | 96974 | static int isSystemTable(Parse *pParse, const char *zName){ |
| 96800 | | - if( sqlite3Strlen30(zName)>6 && 0==sqlite3StrNICmp(zName, "sqlite_", 7) ){ |
| 96975 | + if( 0==sqlite3StrNICmp(zName, "sqlite_", 7) ){ |
| 96801 | 96976 | sqlite3ErrorMsg(pParse, "table %s may not be altered", zName); |
| 96802 | 96977 | return 1; |
| 96803 | 96978 | } |
| 96804 | 96979 | return 0; |
| 96805 | 96980 | } |
| | @@ -104193,11 +104368,13 @@ |
| 104193 | 104368 | for(j=0; j<pIdx->nKeyCol; j++){ |
| 104194 | 104369 | char *zCol; |
| 104195 | 104370 | assert( pIdx->aiColumn[j]>=0 ); |
| 104196 | 104371 | zCol = pTab->aCol[pIdx->aiColumn[j]].zName; |
| 104197 | 104372 | if( j ) sqlite3StrAccumAppend(&errMsg, ", ", 2); |
| 104198 | | - sqlite3XPrintf(&errMsg, "%s.%s", pTab->zName, zCol); |
| 104373 | + sqlite3StrAccumAppendAll(&errMsg, pTab->zName); |
| 104374 | + sqlite3StrAccumAppend(&errMsg, ".", 1); |
| 104375 | + sqlite3StrAccumAppendAll(&errMsg, zCol); |
| 104199 | 104376 | } |
| 104200 | 104377 | } |
| 104201 | 104378 | zErr = sqlite3StrAccumFinish(&errMsg); |
| 104202 | 104379 | sqlite3HaltConstraint(pParse, |
| 104203 | 104380 | IsPrimaryKeyIndex(pIdx) ? SQLITE_CONSTRAINT_PRIMARYKEY |
| | @@ -111051,11 +111228,11 @@ |
| 111051 | 111228 | if( pSrc->aiColumn[i]!=pDest->aiColumn[i] ){ |
| 111052 | 111229 | return 0; /* Different columns indexed */ |
| 111053 | 111230 | } |
| 111054 | 111231 | if( pSrc->aiColumn[i]==XN_EXPR ){ |
| 111055 | 111232 | assert( pSrc->aColExpr!=0 && pDest->aColExpr!=0 ); |
| 111056 | | - if( sqlite3ExprCompare(pSrc->aColExpr->a[i].pExpr, |
| 111233 | + if( sqlite3ExprCompare(0, pSrc->aColExpr->a[i].pExpr, |
| 111057 | 111234 | pDest->aColExpr->a[i].pExpr, -1)!=0 ){ |
| 111058 | 111235 | return 0; /* Different expressions in the index */ |
| 111059 | 111236 | } |
| 111060 | 111237 | } |
| 111061 | 111238 | if( pSrc->aSortOrder[i]!=pDest->aSortOrder[i] ){ |
| | @@ -111063,11 +111240,11 @@ |
| 111063 | 111240 | } |
| 111064 | 111241 | if( sqlite3_stricmp(pSrc->azColl[i],pDest->azColl[i])!=0 ){ |
| 111065 | 111242 | return 0; /* Different collating sequences */ |
| 111066 | 111243 | } |
| 111067 | 111244 | } |
| 111068 | | - if( sqlite3ExprCompare(pSrc->pPartIdxWhere, pDest->pPartIdxWhere, -1) ){ |
| 111245 | + if( sqlite3ExprCompare(0, pSrc->pPartIdxWhere, pDest->pPartIdxWhere, -1) ){ |
| 111069 | 111246 | return 0; /* Different WHERE clauses */ |
| 111070 | 111247 | } |
| 111071 | 111248 | |
| 111072 | 111249 | /* If no test above fails then the indices must be compatible */ |
| 111073 | 111250 | return 1; |
| | @@ -111543,15 +111720,12 @@ |
| 111543 | 111720 | if( pStmt ) sqlite3VdbeFinalize((Vdbe *)pStmt); |
| 111544 | 111721 | sqlite3DbFree(db, azCols); |
| 111545 | 111722 | |
| 111546 | 111723 | rc = sqlite3ApiExit(db, rc); |
| 111547 | 111724 | if( rc!=SQLITE_OK && pzErrMsg ){ |
| 111548 | | - int nErrMsg = 1 + sqlite3Strlen30(sqlite3_errmsg(db)); |
| 111549 | | - *pzErrMsg = sqlite3Malloc(nErrMsg); |
| 111550 | | - if( *pzErrMsg ){ |
| 111551 | | - memcpy(*pzErrMsg, sqlite3_errmsg(db), nErrMsg); |
| 111552 | | - }else{ |
| 111725 | + *pzErrMsg = sqlite3DbStrDup(0, sqlite3_errmsg(db)); |
| 111726 | + if( *pzErrMsg==0 ){ |
| 111553 | 111727 | rc = SQLITE_NOMEM_BKPT; |
| 111554 | 111728 | sqlite3Error(db, SQLITE_NOMEM); |
| 111555 | 111729 | } |
| 111556 | 111730 | }else if( pzErrMsg ){ |
| 111557 | 111731 | *pzErrMsg = 0; |
| | @@ -113415,11 +113589,11 @@ |
| 113415 | 113589 | #if !defined(SQLITE_OMIT_FLAG_PRAGMAS) |
| 113416 | 113590 | {/* zName: */ "read_uncommitted", |
| 113417 | 113591 | /* ePragTyp: */ PragTyp_FLAG, |
| 113418 | 113592 | /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, |
| 113419 | 113593 | /* ColNames: */ 0, 0, |
| 113420 | | - /* iArg: */ SQLITE_ReadUncommitted }, |
| 113594 | + /* iArg: */ SQLITE_ReadUncommit }, |
| 113421 | 113595 | {/* zName: */ "recursive_triggers", |
| 113422 | 113596 | /* ePragTyp: */ PragTyp_FLAG, |
| 113423 | 113597 | /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, |
| 113424 | 113598 | /* ColNames: */ 0, 0, |
| 113425 | 113599 | /* iArg: */ SQLITE_RecTriggers }, |
| | @@ -113567,11 +113741,11 @@ |
| 113567 | 113741 | #if !defined(SQLITE_OMIT_FLAG_PRAGMAS) |
| 113568 | 113742 | {/* zName: */ "writable_schema", |
| 113569 | 113743 | /* ePragTyp: */ PragTyp_FLAG, |
| 113570 | 113744 | /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, |
| 113571 | 113745 | /* ColNames: */ 0, 0, |
| 113572 | | - /* iArg: */ SQLITE_WriteSchema|SQLITE_RecoveryMode }, |
| 113746 | + /* iArg: */ SQLITE_WriteSchema }, |
| 113573 | 113747 | #endif |
| 113574 | 113748 | }; |
| 113575 | 113749 | /* Number of pragmas: 60 on by default, 74 total. */ |
| 113576 | 113750 | |
| 113577 | 113751 | /************** End of pragma.h **********************************************/ |
| | @@ -116009,11 +116183,11 @@ |
| 116009 | 116183 | InitData *pData, /* Initialization context */ |
| 116010 | 116184 | const char *zObj, /* Object being parsed at the point of error */ |
| 116011 | 116185 | const char *zExtra /* Error information */ |
| 116012 | 116186 | ){ |
| 116013 | 116187 | sqlite3 *db = pData->db; |
| 116014 | | - if( !db->mallocFailed && (db->flags & SQLITE_RecoveryMode)==0 ){ |
| 116188 | + if( !db->mallocFailed && (db->flags & SQLITE_WriteSchema)==0 ){ |
| 116015 | 116189 | char *z; |
| 116016 | 116190 | if( zObj==0 ) zObj = "?"; |
| 116017 | 116191 | z = sqlite3MPrintf(db, "malformed database schema (%s)", zObj); |
| 116018 | 116192 | if( zExtra ) z = sqlite3MPrintf(db, "%z - %s", z, zExtra); |
| 116019 | 116193 | sqlite3DbFree(db, *pData->pzErrMsg); |
| | @@ -116296,12 +116470,12 @@ |
| 116296 | 116470 | } |
| 116297 | 116471 | if( db->mallocFailed ){ |
| 116298 | 116472 | rc = SQLITE_NOMEM_BKPT; |
| 116299 | 116473 | sqlite3ResetAllSchemasOfConnection(db); |
| 116300 | 116474 | } |
| 116301 | | - if( rc==SQLITE_OK || (db->flags&SQLITE_RecoveryMode)){ |
| 116302 | | - /* Black magic: If the SQLITE_RecoveryMode flag is set, then consider |
| 116475 | + if( rc==SQLITE_OK || (db->flags&SQLITE_WriteSchema)){ |
| 116476 | + /* Black magic: If the SQLITE_WriteSchema flag is set, then consider |
| 116303 | 116477 | ** the schema loaded, even if errors occurred. In this situation the |
| 116304 | 116478 | ** current sqlite3_prepare() operation will fail, but the following one |
| 116305 | 116479 | ** will attempt to compile the supplied statement against whatever subset |
| 116306 | 116480 | ** of the schema was loaded before the error occurred. The primary |
| 116307 | 116481 | ** purpose of this is to allow access to the sqlite_master table |
| | @@ -116497,11 +116671,11 @@ |
| 116497 | 116671 | */ |
| 116498 | 116672 | static int sqlite3Prepare( |
| 116499 | 116673 | sqlite3 *db, /* Database handle. */ |
| 116500 | 116674 | const char *zSql, /* UTF-8 encoded SQL statement. */ |
| 116501 | 116675 | int nBytes, /* Length of zSql in bytes. */ |
| 116502 | | - int saveSqlFlag, /* True to copy SQL text into the sqlite3_stmt */ |
| 116676 | + u32 prepFlags, /* Zero or more SQLITE_PREPARE_* flags */ |
| 116503 | 116677 | Vdbe *pReprepare, /* VM being reprepared */ |
| 116504 | 116678 | sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */ |
| 116505 | 116679 | const char **pzTail /* OUT: End of parsed string */ |
| 116506 | 116680 | ){ |
| 116507 | 116681 | char *zErrMsg = 0; /* Error message */ |
| | @@ -116513,10 +116687,18 @@ |
| 116513 | 116687 | memset(PARSE_TAIL(&sParse), 0, PARSE_TAIL_SZ); |
| 116514 | 116688 | sParse.pReprepare = pReprepare; |
| 116515 | 116689 | assert( ppStmt && *ppStmt==0 ); |
| 116516 | 116690 | /* assert( !db->mallocFailed ); // not true with SQLITE_USE_ALLOCA */ |
| 116517 | 116691 | assert( sqlite3_mutex_held(db->mutex) ); |
| 116692 | + |
| 116693 | + /* For a long-term use prepared statement avoid the use of |
| 116694 | + ** lookaside memory. |
| 116695 | + */ |
| 116696 | + if( prepFlags & SQLITE_PREPARE_PERSISTENT ){ |
| 116697 | + sParse.disableLookaside++; |
| 116698 | + db->lookaside.bDisable++; |
| 116699 | + } |
| 116518 | 116700 | |
| 116519 | 116701 | /* Check to verify that it is possible to get a read lock on all |
| 116520 | 116702 | ** database schemas. The inability to get a read lock indicates that |
| 116521 | 116703 | ** some other database connection is holding a write-lock, which in |
| 116522 | 116704 | ** turn means that the other connection has made uncommitted changes |
| | @@ -116545,11 +116727,11 @@ |
| 116545 | 116727 | assert( sqlite3BtreeHoldsMutex(pBt) ); |
| 116546 | 116728 | rc = sqlite3BtreeSchemaLocked(pBt); |
| 116547 | 116729 | if( rc ){ |
| 116548 | 116730 | const char *zDb = db->aDb[i].zDbSName; |
| 116549 | 116731 | sqlite3ErrorWithMsg(db, rc, "database schema is locked: %s", zDb); |
| 116550 | | - testcase( db->flags & SQLITE_ReadUncommitted ); |
| 116732 | + testcase( db->flags & SQLITE_ReadUncommit ); |
| 116551 | 116733 | goto end_prepare; |
| 116552 | 116734 | } |
| 116553 | 116735 | } |
| 116554 | 116736 | } |
| 116555 | 116737 | |
| | @@ -116613,12 +116795,11 @@ |
| 116613 | 116795 | } |
| 116614 | 116796 | } |
| 116615 | 116797 | #endif |
| 116616 | 116798 | |
| 116617 | 116799 | if( db->init.busy==0 ){ |
| 116618 | | - Vdbe *pVdbe = sParse.pVdbe; |
| 116619 | | - sqlite3VdbeSetSql(pVdbe, zSql, (int)(sParse.zTail-zSql), saveSqlFlag); |
| 116800 | + sqlite3VdbeSetSql(sParse.pVdbe, zSql, (int)(sParse.zTail-zSql), prepFlags); |
| 116620 | 116801 | } |
| 116621 | 116802 | if( sParse.pVdbe && (rc!=SQLITE_OK || db->mallocFailed) ){ |
| 116622 | 116803 | sqlite3VdbeFinalize(sParse.pVdbe); |
| 116623 | 116804 | assert(!(*ppStmt)); |
| 116624 | 116805 | }else{ |
| | @@ -116648,11 +116829,11 @@ |
| 116648 | 116829 | } |
| 116649 | 116830 | static int sqlite3LockAndPrepare( |
| 116650 | 116831 | sqlite3 *db, /* Database handle. */ |
| 116651 | 116832 | const char *zSql, /* UTF-8 encoded SQL statement. */ |
| 116652 | 116833 | int nBytes, /* Length of zSql in bytes. */ |
| 116653 | | - int saveSqlFlag, /* True to copy SQL text into the sqlite3_stmt */ |
| 116834 | + u32 prepFlags, /* Zero or more SQLITE_PREPARE_* flags */ |
| 116654 | 116835 | Vdbe *pOld, /* VM being reprepared */ |
| 116655 | 116836 | sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */ |
| 116656 | 116837 | const char **pzTail /* OUT: End of parsed string */ |
| 116657 | 116838 | ){ |
| 116658 | 116839 | int rc; |
| | @@ -116664,14 +116845,14 @@ |
| 116664 | 116845 | if( !sqlite3SafetyCheckOk(db)||zSql==0 ){ |
| 116665 | 116846 | return SQLITE_MISUSE_BKPT; |
| 116666 | 116847 | } |
| 116667 | 116848 | sqlite3_mutex_enter(db->mutex); |
| 116668 | 116849 | sqlite3BtreeEnterAll(db); |
| 116669 | | - rc = sqlite3Prepare(db, zSql, nBytes, saveSqlFlag, pOld, ppStmt, pzTail); |
| 116850 | + rc = sqlite3Prepare(db, zSql, nBytes, prepFlags, pOld, ppStmt, pzTail); |
| 116670 | 116851 | if( rc==SQLITE_SCHEMA ){ |
| 116671 | 116852 | sqlite3_finalize(*ppStmt); |
| 116672 | | - rc = sqlite3Prepare(db, zSql, nBytes, saveSqlFlag, pOld, ppStmt, pzTail); |
| 116853 | + rc = sqlite3Prepare(db, zSql, nBytes, prepFlags, pOld, ppStmt, pzTail); |
| 116673 | 116854 | } |
| 116674 | 116855 | sqlite3BtreeLeaveAll(db); |
| 116675 | 116856 | sqlite3_mutex_leave(db->mutex); |
| 116676 | 116857 | assert( rc==SQLITE_OK || *ppStmt==0 ); |
| 116677 | 116858 | return rc; |
| | @@ -116688,17 +116869,19 @@ |
| 116688 | 116869 | SQLITE_PRIVATE int sqlite3Reprepare(Vdbe *p){ |
| 116689 | 116870 | int rc; |
| 116690 | 116871 | sqlite3_stmt *pNew; |
| 116691 | 116872 | const char *zSql; |
| 116692 | 116873 | sqlite3 *db; |
| 116874 | + u8 prepFlags; |
| 116693 | 116875 | |
| 116694 | 116876 | assert( sqlite3_mutex_held(sqlite3VdbeDb(p)->mutex) ); |
| 116695 | 116877 | zSql = sqlite3_sql((sqlite3_stmt *)p); |
| 116696 | 116878 | assert( zSql!=0 ); /* Reprepare only called for prepare_v2() statements */ |
| 116697 | 116879 | db = sqlite3VdbeDb(p); |
| 116698 | 116880 | assert( sqlite3_mutex_held(db->mutex) ); |
| 116699 | | - rc = sqlite3LockAndPrepare(db, zSql, -1, 0, p, &pNew, 0); |
| 116881 | + prepFlags = sqlite3VdbePrepareFlags(p); |
| 116882 | + rc = sqlite3LockAndPrepare(db, zSql, -1, prepFlags, p, &pNew, 0); |
| 116700 | 116883 | if( rc ){ |
| 116701 | 116884 | if( rc==SQLITE_NOMEM ){ |
| 116702 | 116885 | sqlite3OomFault(db); |
| 116703 | 116886 | } |
| 116704 | 116887 | assert( pNew==0 ); |
| | @@ -116740,11 +116923,27 @@ |
| 116740 | 116923 | int nBytes, /* Length of zSql in bytes. */ |
| 116741 | 116924 | sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */ |
| 116742 | 116925 | const char **pzTail /* OUT: End of parsed string */ |
| 116743 | 116926 | ){ |
| 116744 | 116927 | int rc; |
| 116745 | | - rc = sqlite3LockAndPrepare(db,zSql,nBytes,1,0,ppStmt,pzTail); |
| 116928 | + rc = sqlite3LockAndPrepare(db,zSql,nBytes,SQLITE_PREPARE_SAVESQL,0, |
| 116929 | + ppStmt,pzTail); |
| 116930 | + assert( rc==SQLITE_OK || ppStmt==0 || *ppStmt==0 ); /* VERIFY: F13021 */ |
| 116931 | + return rc; |
| 116932 | +} |
| 116933 | +SQLITE_API int sqlite3_prepare_v3( |
| 116934 | + sqlite3 *db, /* Database handle. */ |
| 116935 | + const char *zSql, /* UTF-8 encoded SQL statement. */ |
| 116936 | + int nBytes, /* Length of zSql in bytes. */ |
| 116937 | + unsigned int prepFlags, /* Zero or more SQLITE_PREPARE_* flags */ |
| 116938 | + sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */ |
| 116939 | + const char **pzTail /* OUT: End of parsed string */ |
| 116940 | +){ |
| 116941 | + int rc; |
| 116942 | + rc = sqlite3LockAndPrepare(db,zSql,nBytes, |
| 116943 | + SQLITE_PREPARE_SAVESQL|(prepFlags&SQLITE_PREPARE_MASK), |
| 116944 | + 0,ppStmt,pzTail); |
| 116746 | 116945 | assert( rc==SQLITE_OK || ppStmt==0 || *ppStmt==0 ); /* VERIFY: F13021 */ |
| 116747 | 116946 | return rc; |
| 116748 | 116947 | } |
| 116749 | 116948 | |
| 116750 | 116949 | |
| | @@ -116754,11 +116953,11 @@ |
| 116754 | 116953 | */ |
| 116755 | 116954 | static int sqlite3Prepare16( |
| 116756 | 116955 | sqlite3 *db, /* Database handle. */ |
| 116757 | 116956 | const void *zSql, /* UTF-16 encoded SQL statement. */ |
| 116758 | 116957 | int nBytes, /* Length of zSql in bytes. */ |
| 116759 | | - int saveSqlFlag, /* True to save SQL text into the sqlite3_stmt */ |
| 116958 | + u32 prepFlags, /* Zero or more SQLITE_PREPARE_* flags */ |
| 116760 | 116959 | sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */ |
| 116761 | 116960 | const void **pzTail /* OUT: End of parsed string */ |
| 116762 | 116961 | ){ |
| 116763 | 116962 | /* This function currently works by first transforming the UTF-16 |
| 116764 | 116963 | ** encoded string to UTF-8, then invoking sqlite3_prepare(). The |
| | @@ -116782,11 +116981,11 @@ |
| 116782 | 116981 | nBytes = sz; |
| 116783 | 116982 | } |
| 116784 | 116983 | sqlite3_mutex_enter(db->mutex); |
| 116785 | 116984 | zSql8 = sqlite3Utf16to8(db, zSql, nBytes, SQLITE_UTF16NATIVE); |
| 116786 | 116985 | if( zSql8 ){ |
| 116787 | | - rc = sqlite3LockAndPrepare(db, zSql8, -1, saveSqlFlag, 0, ppStmt, &zTail8); |
| 116986 | + rc = sqlite3LockAndPrepare(db, zSql8, -1, prepFlags, 0, ppStmt, &zTail8); |
| 116788 | 116987 | } |
| 116789 | 116988 | |
| 116790 | 116989 | if( zTail8 && pzTail ){ |
| 116791 | 116990 | /* If sqlite3_prepare returns a tail pointer, we calculate the |
| 116792 | 116991 | ** equivalent pointer into the UTF-16 string by counting the unicode |
| | @@ -116828,11 +117027,26 @@ |
| 116828 | 117027 | int nBytes, /* Length of zSql in bytes. */ |
| 116829 | 117028 | sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */ |
| 116830 | 117029 | const void **pzTail /* OUT: End of parsed string */ |
| 116831 | 117030 | ){ |
| 116832 | 117031 | int rc; |
| 116833 | | - rc = sqlite3Prepare16(db,zSql,nBytes,1,ppStmt,pzTail); |
| 117032 | + rc = sqlite3Prepare16(db,zSql,nBytes,SQLITE_PREPARE_SAVESQL,ppStmt,pzTail); |
| 117033 | + assert( rc==SQLITE_OK || ppStmt==0 || *ppStmt==0 ); /* VERIFY: F13021 */ |
| 117034 | + return rc; |
| 117035 | +} |
| 117036 | +SQLITE_API int sqlite3_prepare16_v3( |
| 117037 | + sqlite3 *db, /* Database handle. */ |
| 117038 | + const void *zSql, /* UTF-16 encoded SQL statement. */ |
| 117039 | + int nBytes, /* Length of zSql in bytes. */ |
| 117040 | + unsigned int prepFlags, /* Zero or more SQLITE_PREPARE_* flags */ |
| 117041 | + sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */ |
| 117042 | + const void **pzTail /* OUT: End of parsed string */ |
| 117043 | +){ |
| 117044 | + int rc; |
| 117045 | + rc = sqlite3Prepare16(db,zSql,nBytes, |
| 117046 | + SQLITE_PREPARE_SAVESQL|(prepFlags&SQLITE_PREPARE_MASK), |
| 117047 | + ppStmt,pzTail); |
| 116834 | 117048 | assert( rc==SQLITE_OK || ppStmt==0 || *ppStmt==0 ); /* VERIFY: F13021 */ |
| 116835 | 117049 | return rc; |
| 116836 | 117050 | } |
| 116837 | 117051 | |
| 116838 | 117052 | #endif /* SQLITE_OMIT_UTF16 */ |
| | @@ -121844,11 +122058,13 @@ |
| 121844 | 122058 | if( pItem->pSelect==0 ) continue; |
| 121845 | 122059 | if( pItem->fg.viaCoroutine ) continue; |
| 121846 | 122060 | if( pItem->zName==0 ) continue; |
| 121847 | 122061 | if( sqlite3_stricmp(pItem->zDatabase, pThis->zDatabase)!=0 ) continue; |
| 121848 | 122062 | if( sqlite3_stricmp(pItem->zName, pThis->zName)!=0 ) continue; |
| 121849 | | - if( sqlite3ExprCompare(pThis->pSelect->pWhere, pItem->pSelect->pWhere, -1) ){ |
| 122063 | + if( sqlite3ExprCompare(0, |
| 122064 | + pThis->pSelect->pWhere, pItem->pSelect->pWhere, -1) |
| 122065 | + ){ |
| 121850 | 122066 | /* The view was modified by some other optimization such as |
| 121851 | 122067 | ** pushDownWhereTerms() */ |
| 121852 | 122068 | continue; |
| 121853 | 122069 | } |
| 121854 | 122070 | return pItem; |
| | @@ -128193,11 +128409,11 @@ |
| 128193 | 128409 | ** If pExpr matches, then transform it into a reference to the index column |
| 128194 | 128410 | ** that contains the value of pExpr. |
| 128195 | 128411 | */ |
| 128196 | 128412 | static int whereIndexExprTransNode(Walker *p, Expr *pExpr){ |
| 128197 | 128413 | IdxExprTrans *pX = p->u.pIdxTrans; |
| 128198 | | - if( sqlite3ExprCompare(pExpr, pX->pIdxExpr, pX->iTabCur)==0 ){ |
| 128414 | + if( sqlite3ExprCompare(0, pExpr, pX->pIdxExpr, pX->iTabCur)==0 ){ |
| 128199 | 128415 | pExpr->op = TK_COLUMN; |
| 128200 | 128416 | pExpr->iTable = pX->iIdxCur; |
| 128201 | 128417 | pExpr->iColumn = pX->iIdxCol; |
| 128202 | 128418 | pExpr->pTab = 0; |
| 128203 | 128419 | return WRC_Prune; |
| | @@ -129487,11 +129703,11 @@ |
| 129487 | 129703 | pList = pExpr->x.pList; |
| 129488 | 129704 | pLeft = pList->a[1].pExpr; |
| 129489 | 129705 | |
| 129490 | 129706 | pRight = sqlite3ExprSkipCollate(pList->a[0].pExpr); |
| 129491 | 129707 | op = pRight->op; |
| 129492 | | - if( op==TK_VARIABLE ){ |
| 129708 | + if( op==TK_VARIABLE && (db->flags & SQLITE_EnableQPSG)==0 ){ |
| 129493 | 129709 | Vdbe *pReprepare = pParse->pReprepare; |
| 129494 | 129710 | int iCol = pRight->iColumn; |
| 129495 | 129711 | pVal = sqlite3VdbeGetBoundValue(pReprepare, iCol, SQLITE_AFF_BLOB); |
| 129496 | 129712 | if( pVal && sqlite3_value_type(pVal)==SQLITE_TEXT ){ |
| 129497 | 129713 | z = (char *)sqlite3_value_text(pVal); |
| | @@ -129677,12 +129893,12 @@ |
| 129677 | 129893 | if( (pTwo->eOperator & (WO_EQ|WO_LT|WO_LE|WO_GT|WO_GE))==0 ) return; |
| 129678 | 129894 | if( (eOp & (WO_EQ|WO_LT|WO_LE))!=eOp |
| 129679 | 129895 | && (eOp & (WO_EQ|WO_GT|WO_GE))!=eOp ) return; |
| 129680 | 129896 | assert( pOne->pExpr->pLeft!=0 && pOne->pExpr->pRight!=0 ); |
| 129681 | 129897 | assert( pTwo->pExpr->pLeft!=0 && pTwo->pExpr->pRight!=0 ); |
| 129682 | | - if( sqlite3ExprCompare(pOne->pExpr->pLeft, pTwo->pExpr->pLeft, -1) ) return; |
| 129683 | | - if( sqlite3ExprCompare(pOne->pExpr->pRight, pTwo->pExpr->pRight, -1) )return; |
| 129898 | + if( sqlite3ExprCompare(0,pOne->pExpr->pLeft, pTwo->pExpr->pLeft, -1) ) return; |
| 129899 | + if( sqlite3ExprCompare(0,pOne->pExpr->pRight, pTwo->pExpr->pRight,-1) )return; |
| 129684 | 129900 | /* If we reach this point, it means the two subterms can be combined */ |
| 129685 | 129901 | if( (eOp & (eOp-1))!=0 ){ |
| 129686 | 129902 | if( eOp & (WO_LT|WO_LE) ){ |
| 129687 | 129903 | eOp = WO_LE; |
| 129688 | 129904 | }else{ |
| | @@ -130449,10 +130665,13 @@ |
| 130449 | 130665 | prereqColumn = sqlite3WhereExprUsage(pMaskSet, pLeft); |
| 130450 | 130666 | if( (prereqExpr & prereqColumn)==0 ){ |
| 130451 | 130667 | Expr *pNewExpr; |
| 130452 | 130668 | pNewExpr = sqlite3PExpr(pParse, TK_MATCH, |
| 130453 | 130669 | 0, sqlite3ExprDup(db, pRight, 0)); |
| 130670 | + if( ExprHasProperty(pExpr, EP_FromJoin) && pNewExpr ){ |
| 130671 | + ExprSetProperty(pNewExpr, EP_FromJoin); |
| 130672 | + } |
| 130454 | 130673 | idxNew = whereClauseInsert(pWC, pNewExpr, TERM_VIRTUAL|TERM_DYNAMIC); |
| 130455 | 130674 | testcase( idxNew==0 ); |
| 130456 | 130675 | pNewTerm = &pWC->a[idxNew]; |
| 130457 | 130676 | pNewTerm->prereqRight = prereqExpr; |
| 130458 | 130677 | pNewTerm->leftCursor = pLeft->iTable; |
| | @@ -133387,11 +133606,11 @@ |
| 133387 | 133606 | if( pExpr->iColumn==pIndex->aiColumn[jj] ) return 1; |
| 133388 | 133607 | } |
| 133389 | 133608 | }else if( (aColExpr = pIndex->aColExpr)!=0 ){ |
| 133390 | 133609 | for(jj=0; jj<pIndex->nKeyCol; jj++){ |
| 133391 | 133610 | if( pIndex->aiColumn[jj]!=XN_EXPR ) continue; |
| 133392 | | - if( sqlite3ExprCompare(pExpr,aColExpr->a[jj].pExpr,iCursor)==0 ){ |
| 133611 | + if( sqlite3ExprCompare(0, pExpr,aColExpr->a[jj].pExpr,iCursor)==0 ){ |
| 133393 | 133612 | return 1; |
| 133394 | 133613 | } |
| 133395 | 133614 | } |
| 133396 | 133615 | } |
| 133397 | 133616 | } |
| | @@ -133420,18 +133639,20 @@ |
| 133420 | 133639 | ** in the current query. Return true if it can be and false if not. |
| 133421 | 133640 | */ |
| 133422 | 133641 | static int whereUsablePartialIndex(int iTab, WhereClause *pWC, Expr *pWhere){ |
| 133423 | 133642 | int i; |
| 133424 | 133643 | WhereTerm *pTerm; |
| 133644 | + Parse *pParse = pWC->pWInfo->pParse; |
| 133425 | 133645 | while( pWhere->op==TK_AND ){ |
| 133426 | 133646 | if( !whereUsablePartialIndex(iTab,pWC,pWhere->pLeft) ) return 0; |
| 133427 | 133647 | pWhere = pWhere->pRight; |
| 133428 | 133648 | } |
| 133649 | + if( pParse->db->flags & SQLITE_EnableQPSG ) pParse = 0; |
| 133429 | 133650 | for(i=0, pTerm=pWC->a; i<pWC->nTerm; i++, pTerm++){ |
| 133430 | 133651 | Expr *pExpr = pTerm->pExpr; |
| 133431 | | - if( sqlite3ExprImpliesExpr(pExpr, pWhere, iTab) |
| 133432 | | - && (!ExprHasProperty(pExpr, EP_FromJoin) || pExpr->iRightJoinTable==iTab) |
| 133652 | + if( (!ExprHasProperty(pExpr, EP_FromJoin) || pExpr->iRightJoinTable==iTab) |
| 133653 | + && sqlite3ExprImpliesExpr(pParse, pExpr, pWhere, iTab) |
| 133433 | 133654 | ){ |
| 133434 | 133655 | return 1; |
| 133435 | 133656 | } |
| 133436 | 133657 | } |
| 133437 | 133658 | return 0; |
| | @@ -134406,11 +134627,12 @@ |
| 134406 | 134627 | if( iColumn>=(-1) ){ |
| 134407 | 134628 | if( pOBExpr->op!=TK_COLUMN ) continue; |
| 134408 | 134629 | if( pOBExpr->iTable!=iCur ) continue; |
| 134409 | 134630 | if( pOBExpr->iColumn!=iColumn ) continue; |
| 134410 | 134631 | }else{ |
| 134411 | | - if( sqlite3ExprCompare(pOBExpr,pIndex->aColExpr->a[j].pExpr,iCur) ){ |
| 134632 | + if( sqlite3ExprCompare(0, |
| 134633 | + pOBExpr,pIndex->aColExpr->a[j].pExpr,iCur) ){ |
| 134412 | 134634 | continue; |
| 134413 | 134635 | } |
| 134414 | 134636 | } |
| 134415 | 134637 | if( iColumn>=0 ){ |
| 134416 | 134638 | pColl = sqlite3ExprCollSeq(pWInfo->pParse, pOrderBy->a[i].pExpr); |
| | @@ -134705,10 +134927,11 @@ |
| 134705 | 134927 | ("---- sort cost=%-3d (%d/%d) increases cost %3d to %-3d\n", |
| 134706 | 134928 | aSortCost[isOrdered], (nOrderBy-isOrdered), nOrderBy, |
| 134707 | 134929 | rUnsorted, rCost)); |
| 134708 | 134930 | }else{ |
| 134709 | 134931 | rCost = rUnsorted; |
| 134932 | + rUnsorted -= 2; /* TUNING: Slight bias in favor of no-sort plans */ |
| 134710 | 134933 | } |
| 134711 | 134934 | |
| 134712 | 134935 | /* Check to see if pWLoop should be added to the set of |
| 134713 | 134936 | ** mxChoice best-so-far paths. |
| 134714 | 134937 | ** |
| | @@ -136126,19 +136349,19 @@ |
| 136126 | 136349 | #define sqlite3ParserARG_PDECL ,Parse *pParse |
| 136127 | 136350 | #define sqlite3ParserARG_FETCH Parse *pParse = yypParser->pParse |
| 136128 | 136351 | #define sqlite3ParserARG_STORE yypParser->pParse = pParse |
| 136129 | 136352 | #define YYFALLBACK 1 |
| 136130 | 136353 | #define YYNSTATE 456 |
| 136131 | | -#define YYNRULE 332 |
| 136354 | +#define YYNRULE 331 |
| 136132 | 136355 | #define YY_MAX_SHIFT 455 |
| 136133 | | -#define YY_MIN_SHIFTREDUCE 668 |
| 136134 | | -#define YY_MAX_SHIFTREDUCE 999 |
| 136135 | | -#define YY_MIN_REDUCE 1000 |
| 136136 | | -#define YY_MAX_REDUCE 1331 |
| 136137 | | -#define YY_ERROR_ACTION 1332 |
| 136138 | | -#define YY_ACCEPT_ACTION 1333 |
| 136139 | | -#define YY_NO_ACTION 1334 |
| 136356 | +#define YY_MIN_SHIFTREDUCE 667 |
| 136357 | +#define YY_MAX_SHIFTREDUCE 997 |
| 136358 | +#define YY_MIN_REDUCE 998 |
| 136359 | +#define YY_MAX_REDUCE 1328 |
| 136360 | +#define YY_ERROR_ACTION 1329 |
| 136361 | +#define YY_ACCEPT_ACTION 1330 |
| 136362 | +#define YY_NO_ACTION 1331 |
| 136140 | 136363 | /************* End control #defines *******************************************/ |
| 136141 | 136364 | |
| 136142 | 136365 | /* Define the yytestcase() macro to be a no-op if is not already defined |
| 136143 | 136366 | ** otherwise. |
| 136144 | 136367 | ** |
| | @@ -136208,167 +136431,167 @@ |
| 136208 | 136431 | ** yy_default[] Default action for each state. |
| 136209 | 136432 | ** |
| 136210 | 136433 | *********** Begin parsing tables **********************************************/ |
| 136211 | 136434 | #define YY_ACTTAB_COUNT (1566) |
| 136212 | 136435 | static const YYACTIONTYPE yy_action[] = { |
| 136213 | | - /* 0 */ 325, 411, 343, 752, 752, 203, 946, 354, 976, 98, |
| 136436 | + /* 0 */ 325, 411, 343, 751, 751, 203, 944, 354, 974, 98, |
| 136214 | 136437 | /* 10 */ 98, 98, 98, 91, 96, 96, 96, 96, 95, 95, |
| 136215 | | - /* 20 */ 94, 94, 94, 93, 351, 1333, 155, 155, 2, 813, |
| 136216 | | - /* 30 */ 978, 978, 98, 98, 98, 98, 20, 96, 96, 96, |
| 136438 | + /* 20 */ 94, 94, 94, 93, 351, 1330, 155, 155, 2, 812, |
| 136439 | + /* 30 */ 976, 976, 98, 98, 98, 98, 20, 96, 96, 96, |
| 136217 | 136440 | /* 40 */ 96, 95, 95, 94, 94, 94, 93, 351, 92, 89, |
| 136218 | | - /* 50 */ 178, 99, 100, 90, 853, 856, 845, 845, 97, 97, |
| 136441 | + /* 50 */ 178, 99, 100, 90, 852, 855, 844, 844, 97, 97, |
| 136219 | 136442 | /* 60 */ 98, 98, 98, 98, 351, 96, 96, 96, 96, 95, |
| 136220 | | - /* 70 */ 95, 94, 94, 94, 93, 351, 325, 340, 976, 262, |
| 136221 | | - /* 80 */ 365, 251, 212, 169, 287, 405, 282, 404, 199, 791, |
| 136222 | | - /* 90 */ 242, 412, 21, 957, 379, 280, 93, 351, 792, 95, |
| 136223 | | - /* 100 */ 95, 94, 94, 94, 93, 351, 978, 978, 96, 96, |
| 136224 | | - /* 110 */ 96, 96, 95, 95, 94, 94, 94, 93, 351, 813, |
| 136225 | | - /* 120 */ 329, 242, 412, 913, 832, 913, 132, 99, 100, 90, |
| 136226 | | - /* 130 */ 853, 856, 845, 845, 97, 97, 98, 98, 98, 98, |
| 136443 | + /* 70 */ 95, 94, 94, 94, 93, 351, 325, 340, 974, 262, |
| 136444 | + /* 80 */ 365, 251, 212, 169, 287, 405, 282, 404, 199, 790, |
| 136445 | + /* 90 */ 242, 412, 21, 955, 379, 280, 93, 351, 791, 95, |
| 136446 | + /* 100 */ 95, 94, 94, 94, 93, 351, 976, 976, 96, 96, |
| 136447 | + /* 110 */ 96, 96, 95, 95, 94, 94, 94, 93, 351, 812, |
| 136448 | + /* 120 */ 329, 242, 412, 1242, 831, 1242, 132, 99, 100, 90, |
| 136449 | + /* 130 */ 852, 855, 844, 844, 97, 97, 98, 98, 98, 98, |
| 136227 | 136450 | /* 140 */ 450, 96, 96, 96, 96, 95, 95, 94, 94, 94, |
| 136228 | | - /* 150 */ 93, 351, 325, 825, 349, 348, 120, 819, 120, 75, |
| 136229 | | - /* 160 */ 52, 52, 957, 958, 959, 760, 984, 146, 361, 262, |
| 136230 | | - /* 170 */ 370, 261, 957, 982, 961, 983, 92, 89, 178, 371, |
| 136231 | | - /* 180 */ 230, 371, 978, 978, 817, 361, 360, 101, 824, 824, |
| 136232 | | - /* 190 */ 826, 384, 24, 964, 381, 428, 413, 369, 985, 380, |
| 136233 | | - /* 200 */ 985, 708, 325, 99, 100, 90, 853, 856, 845, 845, |
| 136451 | + /* 150 */ 93, 351, 325, 824, 349, 348, 120, 818, 120, 75, |
| 136452 | + /* 160 */ 52, 52, 955, 956, 957, 1090, 982, 146, 361, 262, |
| 136453 | + /* 170 */ 370, 261, 955, 980, 959, 981, 92, 89, 178, 371, |
| 136454 | + /* 180 */ 230, 371, 976, 976, 1147, 361, 360, 101, 823, 823, |
| 136455 | + /* 190 */ 825, 384, 24, 1293, 381, 428, 413, 369, 983, 380, |
| 136456 | + /* 200 */ 983, 1038, 325, 99, 100, 90, 852, 855, 844, 844, |
| 136234 | 136457 | /* 210 */ 97, 97, 98, 98, 98, 98, 373, 96, 96, 96, |
| 136235 | | - /* 220 */ 96, 95, 95, 94, 94, 94, 93, 351, 957, 132, |
| 136236 | | - /* 230 */ 897, 450, 978, 978, 896, 60, 94, 94, 94, 93, |
| 136237 | | - /* 240 */ 351, 957, 958, 959, 961, 103, 361, 957, 385, 334, |
| 136238 | | - /* 250 */ 702, 52, 52, 99, 100, 90, 853, 856, 845, 845, |
| 136239 | | - /* 260 */ 97, 97, 98, 98, 98, 98, 698, 96, 96, 96, |
| 136458 | + /* 220 */ 96, 95, 95, 94, 94, 94, 93, 351, 955, 132, |
| 136459 | + /* 230 */ 895, 450, 976, 976, 895, 60, 94, 94, 94, 93, |
| 136460 | + /* 240 */ 351, 955, 956, 957, 959, 103, 361, 955, 385, 334, |
| 136461 | + /* 250 */ 701, 52, 52, 99, 100, 90, 852, 855, 844, 844, |
| 136462 | + /* 260 */ 97, 97, 98, 98, 98, 98, 1028, 96, 96, 96, |
| 136240 | 136463 | /* 270 */ 96, 95, 95, 94, 94, 94, 93, 351, 325, 455, |
| 136241 | | - /* 280 */ 670, 450, 227, 61, 157, 243, 344, 114, 701, 888, |
| 136242 | | - /* 290 */ 147, 832, 957, 373, 747, 957, 320, 957, 958, 959, |
| 136243 | | - /* 300 */ 194, 10, 10, 402, 399, 398, 888, 890, 978, 978, |
| 136244 | | - /* 310 */ 762, 171, 170, 157, 397, 337, 957, 958, 959, 702, |
| 136245 | | - /* 320 */ 825, 310, 153, 957, 819, 321, 82, 23, 80, 99, |
| 136246 | | - /* 330 */ 100, 90, 853, 856, 845, 845, 97, 97, 98, 98, |
| 136247 | | - /* 340 */ 98, 98, 894, 96, 96, 96, 96, 95, 95, 94, |
| 136248 | | - /* 350 */ 94, 94, 93, 351, 325, 824, 824, 826, 277, 231, |
| 136249 | | - /* 360 */ 300, 957, 958, 959, 957, 958, 959, 888, 194, 25, |
| 136250 | | - /* 370 */ 450, 402, 399, 398, 957, 355, 300, 450, 957, 74, |
| 136251 | | - /* 380 */ 450, 1, 397, 132, 978, 978, 957, 224, 224, 813, |
| 136252 | | - /* 390 */ 10, 10, 957, 958, 959, 968, 132, 52, 52, 415, |
| 136253 | | - /* 400 */ 52, 52, 739, 739, 339, 99, 100, 90, 853, 856, |
| 136254 | | - /* 410 */ 845, 845, 97, 97, 98, 98, 98, 98, 790, 96, |
| 136464 | + /* 280 */ 1000, 450, 227, 61, 157, 243, 344, 114, 1031, 1218, |
| 136465 | + /* 290 */ 147, 831, 955, 373, 1077, 955, 320, 955, 956, 957, |
| 136466 | + /* 300 */ 194, 10, 10, 402, 399, 398, 1218, 1220, 976, 976, |
| 136467 | + /* 310 */ 761, 171, 170, 157, 397, 337, 955, 956, 957, 701, |
| 136468 | + /* 320 */ 824, 310, 153, 955, 818, 321, 82, 23, 80, 99, |
| 136469 | + /* 330 */ 100, 90, 852, 855, 844, 844, 97, 97, 98, 98, |
| 136470 | + /* 340 */ 98, 98, 893, 96, 96, 96, 96, 95, 95, 94, |
| 136471 | + /* 350 */ 94, 94, 93, 351, 325, 823, 823, 825, 277, 231, |
| 136472 | + /* 360 */ 300, 955, 956, 957, 955, 956, 957, 1218, 194, 25, |
| 136473 | + /* 370 */ 450, 402, 399, 398, 955, 355, 300, 450, 955, 74, |
| 136474 | + /* 380 */ 450, 1, 397, 132, 976, 976, 955, 224, 224, 812, |
| 136475 | + /* 390 */ 10, 10, 955, 956, 957, 1297, 132, 52, 52, 415, |
| 136476 | + /* 400 */ 52, 52, 1069, 1069, 339, 99, 100, 90, 852, 855, |
| 136477 | + /* 410 */ 844, 844, 97, 97, 98, 98, 98, 98, 1120, 96, |
| 136255 | 136478 | /* 420 */ 96, 96, 96, 95, 95, 94, 94, 94, 93, 351, |
| 136256 | | - /* 430 */ 325, 789, 428, 418, 706, 428, 427, 1270, 1270, 262, |
| 136257 | | - /* 440 */ 370, 261, 957, 957, 958, 959, 757, 957, 958, 959, |
| 136258 | | - /* 450 */ 450, 756, 450, 734, 713, 957, 958, 959, 443, 711, |
| 136259 | | - /* 460 */ 978, 978, 734, 394, 92, 89, 178, 447, 447, 447, |
| 136260 | | - /* 470 */ 51, 51, 52, 52, 439, 778, 700, 92, 89, 178, |
| 136261 | | - /* 480 */ 172, 99, 100, 90, 853, 856, 845, 845, 97, 97, |
| 136479 | + /* 430 */ 325, 1119, 428, 418, 705, 428, 427, 1267, 1267, 262, |
| 136480 | + /* 440 */ 370, 261, 955, 955, 956, 957, 756, 955, 956, 957, |
| 136481 | + /* 450 */ 450, 755, 450, 1064, 1043, 955, 956, 957, 443, 710, |
| 136482 | + /* 460 */ 976, 976, 1064, 394, 92, 89, 178, 447, 447, 447, |
| 136483 | + /* 470 */ 51, 51, 52, 52, 439, 777, 1030, 92, 89, 178, |
| 136484 | + /* 480 */ 172, 99, 100, 90, 852, 855, 844, 844, 97, 97, |
| 136262 | 136485 | /* 490 */ 98, 98, 98, 98, 198, 96, 96, 96, 96, 95, |
| 136263 | | - /* 500 */ 95, 94, 94, 94, 93, 351, 325, 428, 408, 916, |
| 136264 | | - /* 510 */ 699, 957, 958, 959, 92, 89, 178, 224, 224, 157, |
| 136265 | | - /* 520 */ 241, 221, 419, 299, 776, 917, 416, 375, 450, 415, |
| 136266 | | - /* 530 */ 58, 324, 737, 737, 920, 379, 978, 978, 379, 777, |
| 136267 | | - /* 540 */ 449, 918, 363, 740, 296, 686, 9, 9, 52, 52, |
| 136268 | | - /* 550 */ 234, 330, 234, 256, 417, 741, 280, 99, 100, 90, |
| 136269 | | - /* 560 */ 853, 856, 845, 845, 97, 97, 98, 98, 98, 98, |
| 136486 | + /* 500 */ 95, 94, 94, 94, 93, 351, 325, 428, 408, 914, |
| 136487 | + /* 510 */ 698, 955, 956, 957, 92, 89, 178, 224, 224, 157, |
| 136488 | + /* 520 */ 241, 221, 419, 299, 775, 915, 416, 375, 450, 415, |
| 136489 | + /* 530 */ 58, 324, 1067, 1067, 1249, 379, 976, 976, 379, 776, |
| 136490 | + /* 540 */ 449, 916, 363, 739, 296, 685, 9, 9, 52, 52, |
| 136491 | + /* 550 */ 234, 330, 234, 256, 417, 740, 280, 99, 100, 90, |
| 136492 | + /* 560 */ 852, 855, 844, 844, 97, 97, 98, 98, 98, 98, |
| 136270 | 136493 | /* 570 */ 450, 96, 96, 96, 96, 95, 95, 94, 94, 94, |
| 136271 | | - /* 580 */ 93, 351, 325, 423, 72, 450, 833, 120, 368, 450, |
| 136272 | | - /* 590 */ 10, 10, 5, 301, 203, 450, 177, 976, 253, 420, |
| 136273 | | - /* 600 */ 255, 776, 200, 175, 233, 10, 10, 842, 842, 36, |
| 136274 | | - /* 610 */ 36, 1299, 978, 978, 729, 37, 37, 349, 348, 425, |
| 136275 | | - /* 620 */ 203, 260, 776, 976, 232, 937, 1326, 876, 338, 1326, |
| 136276 | | - /* 630 */ 422, 854, 857, 99, 100, 90, 853, 856, 845, 845, |
| 136494 | + /* 580 */ 93, 351, 325, 423, 72, 450, 832, 120, 368, 450, |
| 136495 | + /* 590 */ 10, 10, 5, 301, 203, 450, 177, 974, 253, 420, |
| 136496 | + /* 600 */ 255, 775, 200, 175, 233, 10, 10, 841, 841, 36, |
| 136497 | + /* 610 */ 36, 1296, 976, 976, 728, 37, 37, 349, 348, 425, |
| 136498 | + /* 620 */ 203, 260, 775, 974, 232, 935, 1323, 875, 338, 1323, |
| 136499 | + /* 630 */ 422, 853, 856, 99, 100, 90, 852, 855, 844, 844, |
| 136277 | 136500 | /* 640 */ 97, 97, 98, 98, 98, 98, 268, 96, 96, 96, |
| 136278 | | - /* 650 */ 96, 95, 95, 94, 94, 94, 93, 351, 325, 846, |
| 136279 | | - /* 660 */ 450, 985, 818, 985, 1209, 450, 916, 976, 720, 350, |
| 136280 | | - /* 670 */ 350, 350, 935, 177, 450, 937, 1327, 254, 198, 1327, |
| 136281 | | - /* 680 */ 12, 12, 917, 403, 450, 27, 27, 250, 978, 978, |
| 136282 | | - /* 690 */ 118, 721, 162, 976, 38, 38, 268, 176, 918, 776, |
| 136283 | | - /* 700 */ 433, 1275, 946, 354, 39, 39, 317, 998, 325, 99, |
| 136284 | | - /* 710 */ 100, 90, 853, 856, 845, 845, 97, 97, 98, 98, |
| 136285 | | - /* 720 */ 98, 98, 935, 96, 96, 96, 96, 95, 95, 94, |
| 136286 | | - /* 730 */ 94, 94, 93, 351, 450, 330, 450, 358, 978, 978, |
| 136287 | | - /* 740 */ 717, 317, 936, 341, 900, 900, 387, 673, 674, 675, |
| 136288 | | - /* 750 */ 275, 996, 318, 999, 40, 40, 41, 41, 268, 99, |
| 136289 | | - /* 760 */ 100, 90, 853, 856, 845, 845, 97, 97, 98, 98, |
| 136501 | + /* 650 */ 96, 95, 95, 94, 94, 94, 93, 351, 325, 845, |
| 136502 | + /* 660 */ 450, 983, 817, 983, 1207, 450, 914, 974, 719, 350, |
| 136503 | + /* 670 */ 350, 350, 933, 177, 450, 935, 1324, 254, 198, 1324, |
| 136504 | + /* 680 */ 12, 12, 915, 403, 450, 27, 27, 250, 976, 976, |
| 136505 | + /* 690 */ 118, 720, 162, 974, 38, 38, 268, 176, 916, 775, |
| 136506 | + /* 700 */ 433, 1272, 944, 354, 39, 39, 317, 996, 325, 99, |
| 136507 | + /* 710 */ 100, 90, 852, 855, 844, 844, 97, 97, 98, 98, |
| 136508 | + /* 720 */ 98, 98, 933, 96, 96, 96, 96, 95, 95, 94, |
| 136509 | + /* 730 */ 94, 94, 93, 351, 450, 330, 450, 358, 976, 976, |
| 136510 | + /* 740 */ 1047, 317, 934, 341, 898, 898, 387, 672, 673, 674, |
| 136511 | + /* 750 */ 275, 1325, 318, 997, 40, 40, 41, 41, 268, 99, |
| 136512 | + /* 760 */ 100, 90, 852, 855, 844, 844, 97, 97, 98, 98, |
| 136290 | 136513 | /* 770 */ 98, 98, 450, 96, 96, 96, 96, 95, 95, 94, |
| 136291 | | - /* 780 */ 94, 94, 93, 351, 325, 450, 356, 450, 999, 450, |
| 136292 | | - /* 790 */ 692, 331, 42, 42, 791, 270, 450, 273, 450, 228, |
| 136293 | | - /* 800 */ 450, 298, 450, 792, 450, 28, 28, 29, 29, 31, |
| 136294 | | - /* 810 */ 31, 450, 817, 450, 978, 978, 43, 43, 44, 44, |
| 136295 | | - /* 820 */ 45, 45, 11, 11, 46, 46, 893, 78, 893, 268, |
| 136296 | | - /* 830 */ 268, 105, 105, 47, 47, 99, 100, 90, 853, 856, |
| 136297 | | - /* 840 */ 845, 845, 97, 97, 98, 98, 98, 98, 450, 96, |
| 136514 | + /* 780 */ 94, 94, 93, 351, 325, 450, 356, 450, 997, 450, |
| 136515 | + /* 790 */ 1022, 331, 42, 42, 790, 270, 450, 273, 450, 228, |
| 136516 | + /* 800 */ 450, 298, 450, 791, 450, 28, 28, 29, 29, 31, |
| 136517 | + /* 810 */ 31, 450, 1147, 450, 976, 976, 43, 43, 44, 44, |
| 136518 | + /* 820 */ 45, 45, 11, 11, 46, 46, 892, 78, 892, 268, |
| 136519 | + /* 830 */ 268, 105, 105, 47, 47, 99, 100, 90, 852, 855, |
| 136520 | + /* 840 */ 844, 844, 97, 97, 98, 98, 98, 98, 450, 96, |
| 136298 | 136521 | /* 850 */ 96, 96, 96, 95, 95, 94, 94, 94, 93, 351, |
| 136299 | | - /* 860 */ 325, 450, 117, 450, 749, 158, 450, 696, 48, 48, |
| 136300 | | - /* 870 */ 229, 919, 450, 928, 450, 415, 450, 335, 450, 245, |
| 136301 | | - /* 880 */ 450, 33, 33, 49, 49, 450, 50, 50, 246, 817, |
| 136302 | | - /* 890 */ 978, 978, 34, 34, 122, 122, 123, 123, 124, 124, |
| 136522 | + /* 860 */ 325, 450, 117, 450, 1079, 158, 450, 695, 48, 48, |
| 136523 | + /* 870 */ 229, 1248, 450, 1257, 450, 415, 450, 335, 450, 245, |
| 136524 | + /* 880 */ 450, 33, 33, 49, 49, 450, 50, 50, 246, 1147, |
| 136525 | + /* 890 */ 976, 976, 34, 34, 122, 122, 123, 123, 124, 124, |
| 136303 | 136526 | /* 900 */ 56, 56, 268, 81, 249, 35, 35, 197, 196, 195, |
| 136304 | | - /* 910 */ 325, 99, 100, 90, 853, 856, 845, 845, 97, 97, |
| 136527 | + /* 910 */ 325, 99, 100, 90, 852, 855, 844, 844, 97, 97, |
| 136305 | 136528 | /* 920 */ 98, 98, 98, 98, 450, 96, 96, 96, 96, 95, |
| 136306 | | - /* 930 */ 95, 94, 94, 94, 93, 351, 450, 696, 450, 817, |
| 136307 | | - /* 940 */ 978, 978, 975, 884, 106, 106, 268, 886, 268, 944, |
| 136308 | | - /* 950 */ 2, 892, 268, 892, 336, 716, 53, 53, 107, 107, |
| 136309 | | - /* 960 */ 325, 99, 100, 90, 853, 856, 845, 845, 97, 97, |
| 136529 | + /* 930 */ 95, 94, 94, 94, 93, 351, 450, 695, 450, 1147, |
| 136530 | + /* 940 */ 976, 976, 973, 1214, 106, 106, 268, 1216, 268, 1273, |
| 136531 | + /* 950 */ 2, 891, 268, 891, 336, 1046, 53, 53, 107, 107, |
| 136532 | + /* 960 */ 325, 99, 100, 90, 852, 855, 844, 844, 97, 97, |
| 136310 | 136533 | /* 970 */ 98, 98, 98, 98, 450, 96, 96, 96, 96, 95, |
| 136311 | | - /* 980 */ 95, 94, 94, 94, 93, 351, 450, 746, 450, 742, |
| 136312 | | - /* 990 */ 978, 978, 715, 267, 108, 108, 446, 331, 332, 133, |
| 136313 | | - /* 1000 */ 223, 175, 301, 225, 386, 933, 104, 104, 121, 121, |
| 136314 | | - /* 1010 */ 325, 99, 88, 90, 853, 856, 845, 845, 97, 97, |
| 136315 | | - /* 1020 */ 98, 98, 98, 98, 817, 96, 96, 96, 96, 95, |
| 136534 | + /* 980 */ 95, 94, 94, 94, 93, 351, 450, 1076, 450, 1072, |
| 136535 | + /* 990 */ 976, 976, 1045, 267, 108, 108, 446, 331, 332, 133, |
| 136536 | + /* 1000 */ 223, 175, 301, 225, 386, 1262, 104, 104, 121, 121, |
| 136537 | + /* 1010 */ 325, 99, 88, 90, 852, 855, 844, 844, 97, 97, |
| 136538 | + /* 1020 */ 98, 98, 98, 98, 1147, 96, 96, 96, 96, 95, |
| 136316 | 136539 | /* 1030 */ 95, 94, 94, 94, 93, 351, 450, 347, 450, 167, |
| 136317 | | - /* 1040 */ 978, 978, 932, 815, 372, 319, 202, 202, 374, 263, |
| 136318 | | - /* 1050 */ 395, 202, 74, 208, 726, 727, 119, 119, 112, 112, |
| 136319 | | - /* 1060 */ 325, 407, 100, 90, 853, 856, 845, 845, 97, 97, |
| 136540 | + /* 1040 */ 976, 976, 930, 814, 372, 319, 202, 202, 374, 263, |
| 136541 | + /* 1050 */ 395, 202, 74, 208, 725, 726, 119, 119, 112, 112, |
| 136542 | + /* 1060 */ 325, 407, 100, 90, 852, 855, 844, 844, 97, 97, |
| 136320 | 136543 | /* 1070 */ 98, 98, 98, 98, 450, 96, 96, 96, 96, 95, |
| 136321 | | - /* 1080 */ 95, 94, 94, 94, 93, 351, 450, 757, 450, 345, |
| 136322 | | - /* 1090 */ 978, 978, 756, 278, 111, 111, 74, 719, 718, 709, |
| 136323 | | - /* 1100 */ 286, 883, 754, 1289, 257, 77, 109, 109, 110, 110, |
| 136324 | | - /* 1110 */ 908, 285, 810, 90, 853, 856, 845, 845, 97, 97, |
| 136325 | | - /* 1120 */ 98, 98, 98, 98, 911, 96, 96, 96, 96, 95, |
| 136544 | + /* 1080 */ 95, 94, 94, 94, 93, 351, 450, 756, 450, 345, |
| 136545 | + /* 1090 */ 976, 976, 755, 278, 111, 111, 74, 718, 717, 708, |
| 136546 | + /* 1100 */ 286, 882, 753, 1286, 257, 77, 109, 109, 110, 110, |
| 136547 | + /* 1110 */ 1237, 285, 1140, 90, 852, 855, 844, 844, 97, 97, |
| 136548 | + /* 1120 */ 98, 98, 98, 98, 1240, 96, 96, 96, 96, 95, |
| 136326 | 136549 | /* 1130 */ 95, 94, 94, 94, 93, 351, 86, 445, 450, 3, |
| 136327 | | - /* 1140 */ 1202, 450, 745, 132, 352, 120, 689, 86, 445, 785, |
| 136328 | | - /* 1150 */ 3, 767, 202, 377, 448, 352, 907, 120, 55, 55, |
| 136329 | | - /* 1160 */ 450, 57, 57, 828, 879, 448, 450, 208, 450, 709, |
| 136330 | | - /* 1170 */ 450, 883, 237, 434, 436, 120, 440, 429, 362, 120, |
| 136331 | | - /* 1180 */ 54, 54, 132, 450, 434, 832, 52, 52, 26, 26, |
| 136332 | | - /* 1190 */ 30, 30, 382, 132, 409, 444, 832, 694, 264, 390, |
| 136550 | + /* 1140 */ 1200, 450, 1075, 132, 352, 120, 1019, 86, 445, 784, |
| 136551 | + /* 1150 */ 3, 1097, 202, 377, 448, 352, 1236, 120, 55, 55, |
| 136552 | + /* 1160 */ 450, 57, 57, 827, 878, 448, 450, 208, 450, 708, |
| 136553 | + /* 1170 */ 450, 882, 237, 434, 436, 120, 440, 429, 362, 120, |
| 136554 | + /* 1180 */ 54, 54, 132, 450, 434, 831, 52, 52, 26, 26, |
| 136555 | + /* 1190 */ 30, 30, 382, 132, 409, 444, 831, 693, 264, 390, |
| 136333 | 136556 | /* 1200 */ 116, 269, 272, 32, 32, 83, 84, 120, 274, 120, |
| 136334 | | - /* 1210 */ 120, 276, 85, 352, 452, 451, 83, 84, 819, 730, |
| 136335 | | - /* 1220 */ 714, 428, 430, 85, 352, 452, 451, 120, 120, 819, |
| 136336 | | - /* 1230 */ 378, 218, 281, 828, 783, 816, 86, 445, 410, 3, |
| 136337 | | - /* 1240 */ 763, 774, 431, 432, 352, 302, 303, 823, 697, 824, |
| 136338 | | - /* 1250 */ 824, 826, 827, 19, 448, 691, 680, 679, 681, 951, |
| 136339 | | - /* 1260 */ 824, 824, 826, 827, 19, 289, 159, 291, 293, 7, |
| 136340 | | - /* 1270 */ 316, 173, 259, 434, 805, 364, 252, 910, 376, 713, |
| 136341 | | - /* 1280 */ 295, 435, 168, 993, 400, 832, 284, 881, 880, 205, |
| 136342 | | - /* 1290 */ 954, 308, 927, 86, 445, 990, 3, 925, 333, 144, |
| 136343 | | - /* 1300 */ 130, 352, 72, 135, 59, 83, 84, 761, 137, 366, |
| 136344 | | - /* 1310 */ 802, 448, 85, 352, 452, 451, 139, 226, 819, 140, |
| 136345 | | - /* 1320 */ 156, 62, 315, 314, 313, 215, 311, 367, 393, 683, |
| 136346 | | - /* 1330 */ 434, 185, 141, 912, 142, 160, 148, 812, 875, 383, |
| 136347 | | - /* 1340 */ 189, 67, 832, 180, 389, 248, 895, 775, 219, 824, |
| 136348 | | - /* 1350 */ 824, 826, 827, 19, 247, 190, 266, 154, 391, 271, |
| 136349 | | - /* 1360 */ 191, 192, 83, 84, 682, 406, 733, 182, 322, 85, |
| 136350 | | - /* 1370 */ 352, 452, 451, 732, 183, 819, 342, 132, 181, 711, |
| 136351 | | - /* 1380 */ 731, 421, 76, 445, 705, 3, 323, 704, 283, 724, |
| 136352 | | - /* 1390 */ 352, 771, 703, 966, 723, 71, 204, 6, 288, 290, |
| 136353 | | - /* 1400 */ 448, 772, 770, 769, 79, 292, 824, 824, 826, 827, |
| 136354 | | - /* 1410 */ 19, 294, 297, 438, 346, 442, 102, 861, 753, 434, |
| 136557 | + /* 1210 */ 120, 276, 85, 352, 452, 451, 83, 84, 818, 1060, |
| 136558 | + /* 1220 */ 1044, 428, 430, 85, 352, 452, 451, 120, 120, 818, |
| 136559 | + /* 1230 */ 378, 218, 281, 827, 1113, 1146, 86, 445, 410, 3, |
| 136560 | + /* 1240 */ 1093, 1104, 431, 432, 352, 302, 303, 1153, 1027, 823, |
| 136561 | + /* 1250 */ 823, 825, 826, 19, 448, 1021, 1010, 1009, 1011, 1280, |
| 136562 | + /* 1260 */ 823, 823, 825, 826, 19, 289, 159, 291, 293, 7, |
| 136563 | + /* 1270 */ 316, 173, 259, 434, 1135, 364, 252, 1239, 376, 1043, |
| 136564 | + /* 1280 */ 295, 435, 168, 991, 400, 831, 284, 1211, 1210, 205, |
| 136565 | + /* 1290 */ 1283, 308, 1256, 86, 445, 988, 3, 1254, 333, 144, |
| 136566 | + /* 1300 */ 130, 352, 72, 135, 59, 83, 84, 760, 137, 366, |
| 136567 | + /* 1310 */ 1132, 448, 85, 352, 452, 451, 139, 226, 818, 140, |
| 136568 | + /* 1320 */ 156, 62, 315, 314, 313, 215, 311, 367, 393, 682, |
| 136569 | + /* 1330 */ 434, 185, 141, 1241, 142, 160, 148, 1142, 1205, 383, |
| 136570 | + /* 1340 */ 189, 67, 831, 180, 389, 248, 1225, 1105, 219, 823, |
| 136571 | + /* 1350 */ 823, 825, 826, 19, 247, 190, 266, 154, 391, 271, |
| 136572 | + /* 1360 */ 191, 192, 83, 84, 1012, 406, 1063, 182, 322, 85, |
| 136573 | + /* 1370 */ 352, 452, 451, 1062, 183, 818, 342, 132, 181, 710, |
| 136574 | + /* 1380 */ 1061, 421, 76, 445, 1035, 3, 323, 1034, 283, 1054, |
| 136575 | + /* 1390 */ 352, 1101, 1033, 1295, 1053, 71, 204, 6, 288, 290, |
| 136576 | + /* 1400 */ 448, 1102, 1100, 1099, 79, 292, 823, 823, 825, 826, |
| 136577 | + /* 1410 */ 19, 294, 297, 438, 346, 442, 102, 1191, 1083, 434, |
| 136355 | 136578 | /* 1420 */ 238, 426, 73, 305, 239, 304, 326, 240, 424, 306, |
| 136356 | | - /* 1430 */ 307, 832, 213, 688, 22, 952, 453, 214, 216, 217, |
| 136357 | | - /* 1440 */ 454, 677, 115, 676, 671, 125, 126, 235, 127, 669, |
| 136579 | + /* 1430 */ 307, 831, 213, 1018, 22, 950, 453, 214, 216, 217, |
| 136580 | + /* 1440 */ 454, 1007, 115, 1006, 1001, 125, 126, 235, 127, 668, |
| 136358 | 136581 | /* 1450 */ 327, 83, 84, 359, 353, 244, 166, 328, 85, 352, |
| 136359 | | - /* 1460 */ 452, 451, 134, 179, 819, 357, 113, 891, 811, 889, |
| 136360 | | - /* 1470 */ 136, 128, 138, 743, 258, 184, 906, 143, 145, 63, |
| 136361 | | - /* 1480 */ 64, 65, 66, 129, 909, 905, 187, 186, 8, 13, |
| 136362 | | - /* 1490 */ 188, 265, 898, 149, 202, 824, 824, 826, 827, 19, |
| 136363 | | - /* 1500 */ 388, 987, 150, 161, 285, 685, 392, 396, 151, 722, |
| 136364 | | - /* 1510 */ 193, 68, 14, 401, 279, 15, 69, 236, 831, 830, |
| 136365 | | - /* 1520 */ 131, 859, 751, 70, 16, 414, 755, 4, 784, 220, |
| 136366 | | - /* 1530 */ 222, 174, 152, 437, 779, 201, 17, 77, 74, 18, |
| 136367 | | - /* 1540 */ 874, 860, 858, 915, 863, 914, 207, 206, 941, 163, |
| 136368 | | - /* 1550 */ 210, 942, 209, 164, 441, 862, 165, 211, 829, 695, |
| 136369 | | - /* 1560 */ 87, 312, 309, 947, 1291, 1290, |
| 136582 | + /* 1460 */ 452, 451, 134, 179, 818, 357, 113, 890, 810, 888, |
| 136583 | + /* 1470 */ 136, 128, 138, 742, 258, 184, 904, 143, 145, 63, |
| 136584 | + /* 1480 */ 64, 65, 66, 129, 907, 903, 187, 186, 8, 13, |
| 136585 | + /* 1490 */ 188, 265, 896, 149, 202, 823, 823, 825, 826, 19, |
| 136586 | + /* 1500 */ 388, 985, 150, 161, 285, 684, 392, 396, 151, 721, |
| 136587 | + /* 1510 */ 193, 68, 14, 401, 279, 15, 69, 236, 830, 829, |
| 136588 | + /* 1520 */ 131, 858, 750, 70, 16, 414, 754, 4, 783, 220, |
| 136589 | + /* 1530 */ 222, 174, 152, 437, 778, 201, 17, 77, 74, 18, |
| 136590 | + /* 1540 */ 873, 859, 857, 913, 862, 912, 207, 206, 939, 163, |
| 136591 | + /* 1550 */ 210, 940, 209, 164, 441, 861, 165, 211, 828, 694, |
| 136592 | + /* 1560 */ 87, 312, 309, 945, 1288, 1287, |
| 136370 | 136593 | }; |
| 136371 | 136594 | static const YYCODETYPE yy_lookahead[] = { |
| 136372 | 136595 | /* 0 */ 19, 115, 19, 117, 118, 24, 1, 2, 27, 79, |
| 136373 | 136596 | /* 10 */ 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, |
| 136374 | 136597 | /* 20 */ 90, 91, 92, 93, 94, 144, 145, 146, 147, 58, |
| | @@ -136617,56 +136840,56 @@ |
| 136617 | 136840 | /* 300 */ 1236, 1195, 1198, 1238, 1213, 1221, 1220, 1227, 1229, 1271, |
| 136618 | 136841 | /* 310 */ 1275, 1284, 1285, 1289, 1290, 1292, 1293, 1201, 1208, 1216, |
| 136619 | 136842 | /* 320 */ 1280, 1281, 1264, 1269, 1283, |
| 136620 | 136843 | }; |
| 136621 | 136844 | static const YYACTIONTYPE yy_default[] = { |
| 136622 | | - /* 0 */ 1280, 1270, 1270, 1270, 1202, 1202, 1202, 1202, 1270, 1096, |
| 136623 | | - /* 10 */ 1125, 1125, 1254, 1332, 1332, 1332, 1332, 1332, 1332, 1201, |
| 136624 | | - /* 20 */ 1332, 1332, 1332, 1332, 1270, 1100, 1131, 1332, 1332, 1332, |
| 136625 | | - /* 30 */ 1332, 1203, 1204, 1332, 1332, 1332, 1253, 1255, 1141, 1140, |
| 136626 | | - /* 40 */ 1139, 1138, 1236, 1112, 1136, 1129, 1133, 1203, 1197, 1198, |
| 136627 | | - /* 50 */ 1196, 1200, 1204, 1332, 1132, 1167, 1181, 1166, 1332, 1332, |
| 136628 | | - /* 60 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, |
| 136629 | | - /* 70 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, |
| 136630 | | - /* 80 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, |
| 136631 | | - /* 90 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, |
| 136632 | | - /* 100 */ 1332, 1332, 1332, 1332, 1175, 1180, 1187, 1179, 1176, 1169, |
| 136633 | | - /* 110 */ 1168, 1170, 1171, 1332, 1019, 1067, 1332, 1332, 1332, 1172, |
| 136634 | | - /* 120 */ 1332, 1173, 1184, 1183, 1182, 1261, 1288, 1287, 1332, 1332, |
| 136635 | | - /* 130 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, |
| 136636 | | - /* 140 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, |
| 136637 | | - /* 150 */ 1332, 1332, 1332, 1332, 1332, 1280, 1270, 1025, 1025, 1332, |
| 136638 | | - /* 160 */ 1270, 1270, 1270, 1270, 1270, 1270, 1266, 1100, 1091, 1332, |
| 136639 | | - /* 170 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, |
| 136640 | | - /* 180 */ 1258, 1256, 1332, 1217, 1332, 1332, 1332, 1332, 1332, 1332, |
| 136641 | | - /* 190 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, |
| 136642 | | - /* 200 */ 1332, 1332, 1332, 1332, 1096, 1332, 1332, 1332, 1332, 1332, |
| 136643 | | - /* 210 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1282, 1332, 1231, |
| 136644 | | - /* 220 */ 1096, 1096, 1096, 1098, 1080, 1090, 1004, 1135, 1114, 1114, |
| 136645 | | - /* 230 */ 1321, 1135, 1321, 1042, 1302, 1039, 1125, 1114, 1199, 1125, |
| 136646 | | - /* 240 */ 1125, 1097, 1090, 1332, 1324, 1105, 1105, 1323, 1323, 1105, |
| 136647 | | - /* 250 */ 1146, 1070, 1135, 1076, 1076, 1076, 1076, 1105, 1016, 1135, |
| 136648 | | - /* 260 */ 1146, 1070, 1070, 1135, 1105, 1016, 1235, 1318, 1105, 1105, |
| 136649 | | - /* 270 */ 1016, 1210, 1105, 1016, 1105, 1016, 1210, 1068, 1068, 1068, |
| 136650 | | - /* 280 */ 1057, 1210, 1068, 1042, 1068, 1057, 1068, 1068, 1118, 1113, |
| 136651 | | - /* 290 */ 1118, 1113, 1118, 1113, 1118, 1113, 1105, 1205, 1105, 1332, |
| 136652 | | - /* 300 */ 1210, 1214, 1214, 1210, 1130, 1119, 1128, 1126, 1135, 1022, |
| 136653 | | - /* 310 */ 1060, 1285, 1285, 1281, 1281, 1281, 1281, 1329, 1329, 1266, |
| 136654 | | - /* 320 */ 1297, 1297, 1044, 1044, 1297, 1332, 1332, 1332, 1332, 1332, |
| 136655 | | - /* 330 */ 1332, 1292, 1332, 1219, 1332, 1332, 1332, 1332, 1332, 1332, |
| 136656 | | - /* 340 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, |
| 136657 | | - /* 350 */ 1332, 1332, 1152, 1332, 1000, 1263, 1332, 1332, 1262, 1332, |
| 136658 | | - /* 360 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, |
| 136659 | | - /* 370 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1320, |
| 136660 | | - /* 380 */ 1332, 1332, 1332, 1332, 1332, 1332, 1234, 1233, 1332, 1332, |
| 136661 | | - /* 390 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, |
| 136662 | | - /* 400 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, |
| 136663 | | - /* 410 */ 1332, 1082, 1332, 1332, 1332, 1306, 1332, 1332, 1332, 1332, |
| 136664 | | - /* 420 */ 1332, 1332, 1332, 1127, 1332, 1120, 1332, 1332, 1311, 1332, |
| 136665 | | - /* 430 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1272, |
| 136666 | | - /* 440 */ 1332, 1332, 1332, 1271, 1332, 1332, 1332, 1332, 1332, 1154, |
| 136667 | | - /* 450 */ 1332, 1153, 1157, 1332, 1010, 1332, |
| 136845 | + /* 0 */ 1277, 1267, 1267, 1267, 1200, 1200, 1200, 1200, 1267, 1094, |
| 136846 | + /* 10 */ 1123, 1123, 1251, 1329, 1329, 1329, 1329, 1329, 1329, 1199, |
| 136847 | + /* 20 */ 1329, 1329, 1329, 1329, 1267, 1098, 1129, 1329, 1329, 1329, |
| 136848 | + /* 30 */ 1329, 1201, 1202, 1329, 1329, 1329, 1250, 1252, 1139, 1138, |
| 136849 | + /* 40 */ 1137, 1136, 1233, 1110, 1134, 1127, 1131, 1201, 1195, 1196, |
| 136850 | + /* 50 */ 1194, 1198, 1202, 1329, 1130, 1165, 1179, 1164, 1329, 1329, |
| 136851 | + /* 60 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, |
| 136852 | + /* 70 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, |
| 136853 | + /* 80 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, |
| 136854 | + /* 90 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, |
| 136855 | + /* 100 */ 1329, 1329, 1329, 1329, 1173, 1178, 1185, 1177, 1174, 1167, |
| 136856 | + /* 110 */ 1166, 1168, 1169, 1329, 1017, 1065, 1329, 1329, 1329, 1170, |
| 136857 | + /* 120 */ 1329, 1171, 1182, 1181, 1180, 1258, 1285, 1284, 1329, 1329, |
| 136858 | + /* 130 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, |
| 136859 | + /* 140 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, |
| 136860 | + /* 150 */ 1329, 1329, 1329, 1329, 1329, 1277, 1267, 1023, 1023, 1329, |
| 136861 | + /* 160 */ 1267, 1267, 1267, 1267, 1267, 1267, 1263, 1098, 1089, 1329, |
| 136862 | + /* 170 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, |
| 136863 | + /* 180 */ 1255, 1253, 1329, 1215, 1329, 1329, 1329, 1329, 1329, 1329, |
| 136864 | + /* 190 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, |
| 136865 | + /* 200 */ 1329, 1329, 1329, 1329, 1094, 1329, 1329, 1329, 1329, 1329, |
| 136866 | + /* 210 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1279, 1329, 1228, |
| 136867 | + /* 220 */ 1094, 1094, 1094, 1096, 1078, 1088, 1002, 1133, 1112, 1112, |
| 136868 | + /* 230 */ 1318, 1133, 1318, 1040, 1299, 1037, 1123, 1112, 1197, 1123, |
| 136869 | + /* 240 */ 1123, 1095, 1088, 1329, 1321, 1103, 1103, 1320, 1320, 1103, |
| 136870 | + /* 250 */ 1144, 1068, 1133, 1074, 1074, 1074, 1074, 1103, 1014, 1133, |
| 136871 | + /* 260 */ 1144, 1068, 1068, 1133, 1103, 1014, 1232, 1315, 1103, 1103, |
| 136872 | + /* 270 */ 1014, 1208, 1103, 1014, 1103, 1014, 1208, 1066, 1066, 1066, |
| 136873 | + /* 280 */ 1055, 1208, 1066, 1040, 1066, 1055, 1066, 1066, 1116, 1111, |
| 136874 | + /* 290 */ 1116, 1111, 1116, 1111, 1116, 1111, 1103, 1203, 1103, 1329, |
| 136875 | + /* 300 */ 1208, 1212, 1212, 1208, 1128, 1117, 1126, 1124, 1133, 1020, |
| 136876 | + /* 310 */ 1058, 1282, 1282, 1278, 1278, 1278, 1278, 1326, 1326, 1263, |
| 136877 | + /* 320 */ 1294, 1294, 1042, 1042, 1294, 1329, 1329, 1329, 1329, 1329, |
| 136878 | + /* 330 */ 1329, 1289, 1329, 1217, 1329, 1329, 1329, 1329, 1329, 1329, |
| 136879 | + /* 340 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, |
| 136880 | + /* 350 */ 1329, 1329, 1150, 1329, 998, 1260, 1329, 1329, 1259, 1329, |
| 136881 | + /* 360 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, |
| 136882 | + /* 370 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1317, |
| 136883 | + /* 380 */ 1329, 1329, 1329, 1329, 1329, 1329, 1231, 1230, 1329, 1329, |
| 136884 | + /* 390 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, |
| 136885 | + /* 400 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, |
| 136886 | + /* 410 */ 1329, 1080, 1329, 1329, 1329, 1303, 1329, 1329, 1329, 1329, |
| 136887 | + /* 420 */ 1329, 1329, 1329, 1125, 1329, 1118, 1329, 1329, 1308, 1329, |
| 136888 | + /* 430 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1269, |
| 136889 | + /* 440 */ 1329, 1329, 1329, 1268, 1329, 1329, 1329, 1329, 1329, 1152, |
| 136890 | + /* 450 */ 1329, 1151, 1155, 1329, 1008, 1329, |
| 136668 | 136891 | }; |
| 136669 | 136892 | /********** End of lemon-generated parsing tables *****************************/ |
| 136670 | 136893 | |
| 136671 | 136894 | /* The next table maps tokens (terminal symbols) into fallback tokens. |
| 136672 | 136895 | ** If a construct like the following: |
| | @@ -136796,10 +137019,11 @@ |
| 136796 | 137019 | int yystksz; /* Current side of the stack */ |
| 136797 | 137020 | yyStackEntry *yystack; /* The parser's stack */ |
| 136798 | 137021 | yyStackEntry yystk0; /* First stack entry */ |
| 136799 | 137022 | #else |
| 136800 | 137023 | yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */ |
| 137024 | + yyStackEntry *yystackEnd; /* Last entry in the stack */ |
| 136801 | 137025 | #endif |
| 136802 | 137026 | }; |
| 136803 | 137027 | typedef struct yyParser yyParser; |
| 136804 | 137028 | |
| 136805 | 137029 | #ifndef NDEBUG |
| | @@ -137134,114 +137358,113 @@ |
| 137134 | 137358 | /* 223 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP", |
| 137135 | 137359 | /* 224 */ "plus_num ::= PLUS INTEGER|FLOAT", |
| 137136 | 137360 | /* 225 */ "minus_num ::= MINUS INTEGER|FLOAT", |
| 137137 | 137361 | /* 226 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END", |
| 137138 | 137362 | /* 227 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause", |
| 137139 | | - /* 228 */ "trigger_time ::= BEFORE", |
| 137140 | | - /* 229 */ "trigger_time ::= AFTER", |
| 137141 | | - /* 230 */ "trigger_time ::= INSTEAD OF", |
| 137142 | | - /* 231 */ "trigger_time ::=", |
| 137143 | | - /* 232 */ "trigger_event ::= DELETE|INSERT", |
| 137144 | | - /* 233 */ "trigger_event ::= UPDATE", |
| 137145 | | - /* 234 */ "trigger_event ::= UPDATE OF idlist", |
| 137146 | | - /* 235 */ "when_clause ::=", |
| 137147 | | - /* 236 */ "when_clause ::= WHEN expr", |
| 137148 | | - /* 237 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI", |
| 137149 | | - /* 238 */ "trigger_cmd_list ::= trigger_cmd SEMI", |
| 137150 | | - /* 239 */ "trnm ::= nm DOT nm", |
| 137151 | | - /* 240 */ "tridxby ::= INDEXED BY nm", |
| 137152 | | - /* 241 */ "tridxby ::= NOT INDEXED", |
| 137153 | | - /* 242 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt", |
| 137154 | | - /* 243 */ "trigger_cmd ::= insert_cmd INTO trnm idlist_opt select", |
| 137155 | | - /* 244 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt", |
| 137156 | | - /* 245 */ "trigger_cmd ::= select", |
| 137157 | | - /* 246 */ "expr ::= RAISE LP IGNORE RP", |
| 137158 | | - /* 247 */ "expr ::= RAISE LP raisetype COMMA nm RP", |
| 137159 | | - /* 248 */ "raisetype ::= ROLLBACK", |
| 137160 | | - /* 249 */ "raisetype ::= ABORT", |
| 137161 | | - /* 250 */ "raisetype ::= FAIL", |
| 137162 | | - /* 251 */ "cmd ::= DROP TRIGGER ifexists fullname", |
| 137163 | | - /* 252 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt", |
| 137164 | | - /* 253 */ "cmd ::= DETACH database_kw_opt expr", |
| 137165 | | - /* 254 */ "key_opt ::=", |
| 137166 | | - /* 255 */ "key_opt ::= KEY expr", |
| 137167 | | - /* 256 */ "cmd ::= REINDEX", |
| 137168 | | - /* 257 */ "cmd ::= REINDEX nm dbnm", |
| 137169 | | - /* 258 */ "cmd ::= ANALYZE", |
| 137170 | | - /* 259 */ "cmd ::= ANALYZE nm dbnm", |
| 137171 | | - /* 260 */ "cmd ::= ALTER TABLE fullname RENAME TO nm", |
| 137172 | | - /* 261 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist", |
| 137173 | | - /* 262 */ "add_column_fullname ::= fullname", |
| 137174 | | - /* 263 */ "cmd ::= create_vtab", |
| 137175 | | - /* 264 */ "cmd ::= create_vtab LP vtabarglist RP", |
| 137176 | | - /* 265 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm", |
| 137177 | | - /* 266 */ "vtabarg ::=", |
| 137178 | | - /* 267 */ "vtabargtoken ::= ANY", |
| 137179 | | - /* 268 */ "vtabargtoken ::= lp anylist RP", |
| 137180 | | - /* 269 */ "lp ::= LP", |
| 137181 | | - /* 270 */ "with ::=", |
| 137182 | | - /* 271 */ "with ::= WITH wqlist", |
| 137183 | | - /* 272 */ "with ::= WITH RECURSIVE wqlist", |
| 137184 | | - /* 273 */ "wqlist ::= nm eidlist_opt AS LP select RP", |
| 137185 | | - /* 274 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP", |
| 137186 | | - /* 275 */ "input ::= cmdlist", |
| 137187 | | - /* 276 */ "cmdlist ::= cmdlist ecmd", |
| 137188 | | - /* 277 */ "cmdlist ::= ecmd", |
| 137189 | | - /* 278 */ "ecmd ::= SEMI", |
| 137190 | | - /* 279 */ "ecmd ::= explain cmdx SEMI", |
| 137191 | | - /* 280 */ "explain ::=", |
| 137192 | | - /* 281 */ "trans_opt ::=", |
| 137193 | | - /* 282 */ "trans_opt ::= TRANSACTION", |
| 137194 | | - /* 283 */ "trans_opt ::= TRANSACTION nm", |
| 137195 | | - /* 284 */ "savepoint_opt ::= SAVEPOINT", |
| 137196 | | - /* 285 */ "savepoint_opt ::=", |
| 137197 | | - /* 286 */ "cmd ::= create_table create_table_args", |
| 137198 | | - /* 287 */ "columnlist ::= columnlist COMMA columnname carglist", |
| 137199 | | - /* 288 */ "columnlist ::= columnname carglist", |
| 137200 | | - /* 289 */ "nm ::= ID|INDEXED", |
| 137201 | | - /* 290 */ "nm ::= STRING", |
| 137202 | | - /* 291 */ "nm ::= JOIN_KW", |
| 137203 | | - /* 292 */ "typetoken ::= typename", |
| 137204 | | - /* 293 */ "typename ::= ID|STRING", |
| 137205 | | - /* 294 */ "signed ::= plus_num", |
| 137206 | | - /* 295 */ "signed ::= minus_num", |
| 137207 | | - /* 296 */ "carglist ::= carglist ccons", |
| 137208 | | - /* 297 */ "carglist ::=", |
| 137209 | | - /* 298 */ "ccons ::= NULL onconf", |
| 137210 | | - /* 299 */ "conslist_opt ::= COMMA conslist", |
| 137211 | | - /* 300 */ "conslist ::= conslist tconscomma tcons", |
| 137212 | | - /* 301 */ "conslist ::= tcons", |
| 137213 | | - /* 302 */ "tconscomma ::=", |
| 137214 | | - /* 303 */ "defer_subclause_opt ::= defer_subclause", |
| 137215 | | - /* 304 */ "resolvetype ::= raisetype", |
| 137216 | | - /* 305 */ "selectnowith ::= oneselect", |
| 137217 | | - /* 306 */ "oneselect ::= values", |
| 137218 | | - /* 307 */ "sclp ::= selcollist COMMA", |
| 137219 | | - /* 308 */ "as ::= ID|STRING", |
| 137220 | | - /* 309 */ "expr ::= term", |
| 137221 | | - /* 310 */ "likeop ::= LIKE_KW|MATCH", |
| 137222 | | - /* 311 */ "exprlist ::= nexprlist", |
| 137223 | | - /* 312 */ "nmnum ::= plus_num", |
| 137224 | | - /* 313 */ "nmnum ::= nm", |
| 137225 | | - /* 314 */ "nmnum ::= ON", |
| 137226 | | - /* 315 */ "nmnum ::= DELETE", |
| 137227 | | - /* 316 */ "nmnum ::= DEFAULT", |
| 137228 | | - /* 317 */ "plus_num ::= INTEGER|FLOAT", |
| 137229 | | - /* 318 */ "foreach_clause ::=", |
| 137230 | | - /* 319 */ "foreach_clause ::= FOR EACH ROW", |
| 137231 | | - /* 320 */ "trnm ::= nm", |
| 137232 | | - /* 321 */ "tridxby ::=", |
| 137233 | | - /* 322 */ "database_kw_opt ::= DATABASE", |
| 137234 | | - /* 323 */ "database_kw_opt ::=", |
| 137235 | | - /* 324 */ "kwcolumn_opt ::=", |
| 137236 | | - /* 325 */ "kwcolumn_opt ::= COLUMNKW", |
| 137237 | | - /* 326 */ "vtabarglist ::= vtabarg", |
| 137238 | | - /* 327 */ "vtabarglist ::= vtabarglist COMMA vtabarg", |
| 137239 | | - /* 328 */ "vtabarg ::= vtabarg vtabargtoken", |
| 137240 | | - /* 329 */ "anylist ::=", |
| 137241 | | - /* 330 */ "anylist ::= anylist LP anylist RP", |
| 137242 | | - /* 331 */ "anylist ::= anylist ANY", |
| 137363 | + /* 228 */ "trigger_time ::= BEFORE|AFTER", |
| 137364 | + /* 229 */ "trigger_time ::= INSTEAD OF", |
| 137365 | + /* 230 */ "trigger_time ::=", |
| 137366 | + /* 231 */ "trigger_event ::= DELETE|INSERT", |
| 137367 | + /* 232 */ "trigger_event ::= UPDATE", |
| 137368 | + /* 233 */ "trigger_event ::= UPDATE OF idlist", |
| 137369 | + /* 234 */ "when_clause ::=", |
| 137370 | + /* 235 */ "when_clause ::= WHEN expr", |
| 137371 | + /* 236 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI", |
| 137372 | + /* 237 */ "trigger_cmd_list ::= trigger_cmd SEMI", |
| 137373 | + /* 238 */ "trnm ::= nm DOT nm", |
| 137374 | + /* 239 */ "tridxby ::= INDEXED BY nm", |
| 137375 | + /* 240 */ "tridxby ::= NOT INDEXED", |
| 137376 | + /* 241 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt", |
| 137377 | + /* 242 */ "trigger_cmd ::= insert_cmd INTO trnm idlist_opt select", |
| 137378 | + /* 243 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt", |
| 137379 | + /* 244 */ "trigger_cmd ::= select", |
| 137380 | + /* 245 */ "expr ::= RAISE LP IGNORE RP", |
| 137381 | + /* 246 */ "expr ::= RAISE LP raisetype COMMA nm RP", |
| 137382 | + /* 247 */ "raisetype ::= ROLLBACK", |
| 137383 | + /* 248 */ "raisetype ::= ABORT", |
| 137384 | + /* 249 */ "raisetype ::= FAIL", |
| 137385 | + /* 250 */ "cmd ::= DROP TRIGGER ifexists fullname", |
| 137386 | + /* 251 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt", |
| 137387 | + /* 252 */ "cmd ::= DETACH database_kw_opt expr", |
| 137388 | + /* 253 */ "key_opt ::=", |
| 137389 | + /* 254 */ "key_opt ::= KEY expr", |
| 137390 | + /* 255 */ "cmd ::= REINDEX", |
| 137391 | + /* 256 */ "cmd ::= REINDEX nm dbnm", |
| 137392 | + /* 257 */ "cmd ::= ANALYZE", |
| 137393 | + /* 258 */ "cmd ::= ANALYZE nm dbnm", |
| 137394 | + /* 259 */ "cmd ::= ALTER TABLE fullname RENAME TO nm", |
| 137395 | + /* 260 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist", |
| 137396 | + /* 261 */ "add_column_fullname ::= fullname", |
| 137397 | + /* 262 */ "cmd ::= create_vtab", |
| 137398 | + /* 263 */ "cmd ::= create_vtab LP vtabarglist RP", |
| 137399 | + /* 264 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm", |
| 137400 | + /* 265 */ "vtabarg ::=", |
| 137401 | + /* 266 */ "vtabargtoken ::= ANY", |
| 137402 | + /* 267 */ "vtabargtoken ::= lp anylist RP", |
| 137403 | + /* 268 */ "lp ::= LP", |
| 137404 | + /* 269 */ "with ::=", |
| 137405 | + /* 270 */ "with ::= WITH wqlist", |
| 137406 | + /* 271 */ "with ::= WITH RECURSIVE wqlist", |
| 137407 | + /* 272 */ "wqlist ::= nm eidlist_opt AS LP select RP", |
| 137408 | + /* 273 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP", |
| 137409 | + /* 274 */ "input ::= cmdlist", |
| 137410 | + /* 275 */ "cmdlist ::= cmdlist ecmd", |
| 137411 | + /* 276 */ "cmdlist ::= ecmd", |
| 137412 | + /* 277 */ "ecmd ::= SEMI", |
| 137413 | + /* 278 */ "ecmd ::= explain cmdx SEMI", |
| 137414 | + /* 279 */ "explain ::=", |
| 137415 | + /* 280 */ "trans_opt ::=", |
| 137416 | + /* 281 */ "trans_opt ::= TRANSACTION", |
| 137417 | + /* 282 */ "trans_opt ::= TRANSACTION nm", |
| 137418 | + /* 283 */ "savepoint_opt ::= SAVEPOINT", |
| 137419 | + /* 284 */ "savepoint_opt ::=", |
| 137420 | + /* 285 */ "cmd ::= create_table create_table_args", |
| 137421 | + /* 286 */ "columnlist ::= columnlist COMMA columnname carglist", |
| 137422 | + /* 287 */ "columnlist ::= columnname carglist", |
| 137423 | + /* 288 */ "nm ::= ID|INDEXED", |
| 137424 | + /* 289 */ "nm ::= STRING", |
| 137425 | + /* 290 */ "nm ::= JOIN_KW", |
| 137426 | + /* 291 */ "typetoken ::= typename", |
| 137427 | + /* 292 */ "typename ::= ID|STRING", |
| 137428 | + /* 293 */ "signed ::= plus_num", |
| 137429 | + /* 294 */ "signed ::= minus_num", |
| 137430 | + /* 295 */ "carglist ::= carglist ccons", |
| 137431 | + /* 296 */ "carglist ::=", |
| 137432 | + /* 297 */ "ccons ::= NULL onconf", |
| 137433 | + /* 298 */ "conslist_opt ::= COMMA conslist", |
| 137434 | + /* 299 */ "conslist ::= conslist tconscomma tcons", |
| 137435 | + /* 300 */ "conslist ::= tcons", |
| 137436 | + /* 301 */ "tconscomma ::=", |
| 137437 | + /* 302 */ "defer_subclause_opt ::= defer_subclause", |
| 137438 | + /* 303 */ "resolvetype ::= raisetype", |
| 137439 | + /* 304 */ "selectnowith ::= oneselect", |
| 137440 | + /* 305 */ "oneselect ::= values", |
| 137441 | + /* 306 */ "sclp ::= selcollist COMMA", |
| 137442 | + /* 307 */ "as ::= ID|STRING", |
| 137443 | + /* 308 */ "expr ::= term", |
| 137444 | + /* 309 */ "likeop ::= LIKE_KW|MATCH", |
| 137445 | + /* 310 */ "exprlist ::= nexprlist", |
| 137446 | + /* 311 */ "nmnum ::= plus_num", |
| 137447 | + /* 312 */ "nmnum ::= nm", |
| 137448 | + /* 313 */ "nmnum ::= ON", |
| 137449 | + /* 314 */ "nmnum ::= DELETE", |
| 137450 | + /* 315 */ "nmnum ::= DEFAULT", |
| 137451 | + /* 316 */ "plus_num ::= INTEGER|FLOAT", |
| 137452 | + /* 317 */ "foreach_clause ::=", |
| 137453 | + /* 318 */ "foreach_clause ::= FOR EACH ROW", |
| 137454 | + /* 319 */ "trnm ::= nm", |
| 137455 | + /* 320 */ "tridxby ::=", |
| 137456 | + /* 321 */ "database_kw_opt ::= DATABASE", |
| 137457 | + /* 322 */ "database_kw_opt ::=", |
| 137458 | + /* 323 */ "kwcolumn_opt ::=", |
| 137459 | + /* 324 */ "kwcolumn_opt ::= COLUMNKW", |
| 137460 | + /* 325 */ "vtabarglist ::= vtabarg", |
| 137461 | + /* 326 */ "vtabarglist ::= vtabarglist COMMA vtabarg", |
| 137462 | + /* 327 */ "vtabarg ::= vtabarg vtabargtoken", |
| 137463 | + /* 328 */ "anylist ::=", |
| 137464 | + /* 329 */ "anylist ::= anylist LP anylist RP", |
| 137465 | + /* 330 */ "anylist ::= anylist ANY", |
| 137243 | 137466 | }; |
| 137244 | 137467 | #endif /* NDEBUG */ |
| 137245 | 137468 | |
| 137246 | 137469 | |
| 137247 | 137470 | #if YYSTACKDEPTH<=0 |
| | @@ -137306,10 +137529,11 @@ |
| 137306 | 137529 | pParser->yyerrcnt = -1; |
| 137307 | 137530 | #endif |
| 137308 | 137531 | pParser->yytos = pParser->yystack; |
| 137309 | 137532 | pParser->yystack[0].stateno = 0; |
| 137310 | 137533 | pParser->yystack[0].major = 0; |
| 137534 | + pParser->yystackEnd = &pParser->yystack[YYSTACKDEPTH-1]; |
| 137311 | 137535 | } |
| 137312 | 137536 | |
| 137313 | 137537 | #ifndef sqlite3Parser_ENGINEALWAYSONSTACK |
| 137314 | 137538 | /* |
| 137315 | 137539 | ** This function allocates a new parser. |
| | @@ -137648,11 +137872,11 @@ |
| 137648 | 137872 | yypParser->yyhwm++; |
| 137649 | 137873 | assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack) ); |
| 137650 | 137874 | } |
| 137651 | 137875 | #endif |
| 137652 | 137876 | #if YYSTACKDEPTH>0 |
| 137653 | | - if( yypParser->yytos>=&yypParser->yystack[YYSTACKDEPTH] ){ |
| 137877 | + if( yypParser->yytos>yypParser->yystackEnd ){ |
| 137654 | 137878 | yypParser->yytos--; |
| 137655 | 137879 | yyStackOverflow(yypParser); |
| 137656 | 137880 | return; |
| 137657 | 137881 | } |
| 137658 | 137882 | #else |
| | @@ -137676,345 +137900,344 @@ |
| 137676 | 137900 | |
| 137677 | 137901 | /* The following table contains information about every rule that |
| 137678 | 137902 | ** is used during the reduce. |
| 137679 | 137903 | */ |
| 137680 | 137904 | static const struct { |
| 137681 | | - YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ |
| 137682 | | - unsigned char nrhs; /* Number of right-hand side symbols in the rule */ |
| 137905 | + YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ |
| 137906 | + signed char nrhs; /* Negative of the number of RHS symbols in the rule */ |
| 137683 | 137907 | } yyRuleInfo[] = { |
| 137684 | | - { 147, 1 }, |
| 137685 | | - { 147, 3 }, |
| 137686 | | - { 148, 1 }, |
| 137687 | | - { 149, 3 }, |
| 137908 | + { 147, -1 }, |
| 137909 | + { 147, -3 }, |
| 137910 | + { 148, -1 }, |
| 137911 | + { 149, -3 }, |
| 137688 | 137912 | { 150, 0 }, |
| 137689 | | - { 150, 1 }, |
| 137690 | | - { 150, 1 }, |
| 137691 | | - { 150, 1 }, |
| 137692 | | - { 149, 2 }, |
| 137693 | | - { 149, 2 }, |
| 137694 | | - { 149, 2 }, |
| 137695 | | - { 149, 2 }, |
| 137696 | | - { 149, 3 }, |
| 137697 | | - { 149, 5 }, |
| 137698 | | - { 154, 6 }, |
| 137699 | | - { 156, 1 }, |
| 137913 | + { 150, -1 }, |
| 137914 | + { 150, -1 }, |
| 137915 | + { 150, -1 }, |
| 137916 | + { 149, -2 }, |
| 137917 | + { 149, -2 }, |
| 137918 | + { 149, -2 }, |
| 137919 | + { 149, -2 }, |
| 137920 | + { 149, -3 }, |
| 137921 | + { 149, -5 }, |
| 137922 | + { 154, -6 }, |
| 137923 | + { 156, -1 }, |
| 137700 | 137924 | { 158, 0 }, |
| 137701 | | - { 158, 3 }, |
| 137702 | | - { 157, 1 }, |
| 137925 | + { 158, -3 }, |
| 137926 | + { 157, -1 }, |
| 137703 | 137927 | { 157, 0 }, |
| 137704 | | - { 155, 5 }, |
| 137705 | | - { 155, 2 }, |
| 137928 | + { 155, -5 }, |
| 137929 | + { 155, -2 }, |
| 137706 | 137930 | { 162, 0 }, |
| 137707 | | - { 162, 2 }, |
| 137708 | | - { 164, 2 }, |
| 137931 | + { 162, -2 }, |
| 137932 | + { 164, -2 }, |
| 137709 | 137933 | { 166, 0 }, |
| 137710 | | - { 166, 4 }, |
| 137711 | | - { 166, 6 }, |
| 137712 | | - { 167, 2 }, |
| 137713 | | - { 171, 2 }, |
| 137714 | | - { 171, 2 }, |
| 137715 | | - { 171, 4 }, |
| 137716 | | - { 171, 3 }, |
| 137717 | | - { 171, 3 }, |
| 137718 | | - { 171, 2 }, |
| 137719 | | - { 171, 3 }, |
| 137720 | | - { 171, 5 }, |
| 137721 | | - { 171, 2 }, |
| 137722 | | - { 171, 4 }, |
| 137723 | | - { 171, 4 }, |
| 137724 | | - { 171, 1 }, |
| 137725 | | - { 171, 2 }, |
| 137934 | + { 166, -4 }, |
| 137935 | + { 166, -6 }, |
| 137936 | + { 167, -2 }, |
| 137937 | + { 171, -2 }, |
| 137938 | + { 171, -2 }, |
| 137939 | + { 171, -4 }, |
| 137940 | + { 171, -3 }, |
| 137941 | + { 171, -3 }, |
| 137942 | + { 171, -2 }, |
| 137943 | + { 171, -3 }, |
| 137944 | + { 171, -5 }, |
| 137945 | + { 171, -2 }, |
| 137946 | + { 171, -4 }, |
| 137947 | + { 171, -4 }, |
| 137948 | + { 171, -1 }, |
| 137949 | + { 171, -2 }, |
| 137726 | 137950 | { 176, 0 }, |
| 137727 | | - { 176, 1 }, |
| 137951 | + { 176, -1 }, |
| 137728 | 137952 | { 178, 0 }, |
| 137729 | | - { 178, 2 }, |
| 137730 | | - { 180, 2 }, |
| 137731 | | - { 180, 3 }, |
| 137732 | | - { 180, 3 }, |
| 137733 | | - { 180, 3 }, |
| 137734 | | - { 181, 2 }, |
| 137735 | | - { 181, 2 }, |
| 137736 | | - { 181, 1 }, |
| 137737 | | - { 181, 1 }, |
| 137738 | | - { 181, 2 }, |
| 137739 | | - { 179, 3 }, |
| 137740 | | - { 179, 2 }, |
| 137953 | + { 178, -2 }, |
| 137954 | + { 180, -2 }, |
| 137955 | + { 180, -3 }, |
| 137956 | + { 180, -3 }, |
| 137957 | + { 180, -3 }, |
| 137958 | + { 181, -2 }, |
| 137959 | + { 181, -2 }, |
| 137960 | + { 181, -1 }, |
| 137961 | + { 181, -1 }, |
| 137962 | + { 181, -2 }, |
| 137963 | + { 179, -3 }, |
| 137964 | + { 179, -2 }, |
| 137741 | 137965 | { 182, 0 }, |
| 137742 | | - { 182, 2 }, |
| 137743 | | - { 182, 2 }, |
| 137966 | + { 182, -2 }, |
| 137967 | + { 182, -2 }, |
| 137744 | 137968 | { 161, 0 }, |
| 137745 | | - { 184, 1 }, |
| 137746 | | - { 185, 2 }, |
| 137747 | | - { 185, 7 }, |
| 137748 | | - { 185, 5 }, |
| 137749 | | - { 185, 5 }, |
| 137750 | | - { 185, 10 }, |
| 137969 | + { 184, -1 }, |
| 137970 | + { 185, -2 }, |
| 137971 | + { 185, -7 }, |
| 137972 | + { 185, -5 }, |
| 137973 | + { 185, -5 }, |
| 137974 | + { 185, -10 }, |
| 137751 | 137975 | { 188, 0 }, |
| 137752 | 137976 | { 174, 0 }, |
| 137753 | | - { 174, 3 }, |
| 137977 | + { 174, -3 }, |
| 137754 | 137978 | { 189, 0 }, |
| 137755 | | - { 189, 2 }, |
| 137756 | | - { 190, 1 }, |
| 137757 | | - { 190, 1 }, |
| 137758 | | - { 149, 4 }, |
| 137759 | | - { 192, 2 }, |
| 137979 | + { 189, -2 }, |
| 137980 | + { 190, -1 }, |
| 137981 | + { 190, -1 }, |
| 137982 | + { 149, -4 }, |
| 137983 | + { 192, -2 }, |
| 137760 | 137984 | { 192, 0 }, |
| 137761 | | - { 149, 9 }, |
| 137762 | | - { 149, 4 }, |
| 137763 | | - { 149, 1 }, |
| 137764 | | - { 163, 2 }, |
| 137765 | | - { 194, 3 }, |
| 137766 | | - { 197, 1 }, |
| 137767 | | - { 197, 2 }, |
| 137768 | | - { 197, 1 }, |
| 137769 | | - { 195, 9 }, |
| 137770 | | - { 206, 4 }, |
| 137771 | | - { 206, 5 }, |
| 137772 | | - { 198, 1 }, |
| 137773 | | - { 198, 1 }, |
| 137985 | + { 149, -9 }, |
| 137986 | + { 149, -4 }, |
| 137987 | + { 149, -1 }, |
| 137988 | + { 163, -2 }, |
| 137989 | + { 194, -3 }, |
| 137990 | + { 197, -1 }, |
| 137991 | + { 197, -2 }, |
| 137992 | + { 197, -1 }, |
| 137993 | + { 195, -9 }, |
| 137994 | + { 206, -4 }, |
| 137995 | + { 206, -5 }, |
| 137996 | + { 198, -1 }, |
| 137997 | + { 198, -1 }, |
| 137774 | 137998 | { 198, 0 }, |
| 137775 | 137999 | { 209, 0 }, |
| 137776 | | - { 199, 3 }, |
| 137777 | | - { 199, 2 }, |
| 137778 | | - { 199, 4 }, |
| 137779 | | - { 210, 2 }, |
| 138000 | + { 199, -3 }, |
| 138001 | + { 199, -2 }, |
| 138002 | + { 199, -4 }, |
| 138003 | + { 210, -2 }, |
| 137780 | 138004 | { 210, 0 }, |
| 137781 | 138005 | { 200, 0 }, |
| 137782 | | - { 200, 2 }, |
| 137783 | | - { 212, 2 }, |
| 138006 | + { 200, -2 }, |
| 138007 | + { 212, -2 }, |
| 137784 | 138008 | { 212, 0 }, |
| 137785 | | - { 211, 7 }, |
| 137786 | | - { 211, 9 }, |
| 137787 | | - { 211, 7 }, |
| 137788 | | - { 211, 7 }, |
| 138009 | + { 211, -7 }, |
| 138010 | + { 211, -9 }, |
| 138011 | + { 211, -7 }, |
| 138012 | + { 211, -7 }, |
| 137789 | 138013 | { 159, 0 }, |
| 137790 | | - { 159, 2 }, |
| 137791 | | - { 193, 2 }, |
| 137792 | | - { 213, 1 }, |
| 137793 | | - { 213, 2 }, |
| 137794 | | - { 213, 3 }, |
| 137795 | | - { 213, 4 }, |
| 137796 | | - { 215, 2 }, |
| 138014 | + { 159, -2 }, |
| 138015 | + { 193, -2 }, |
| 138016 | + { 213, -1 }, |
| 138017 | + { 213, -2 }, |
| 138018 | + { 213, -3 }, |
| 138019 | + { 213, -4 }, |
| 138020 | + { 215, -2 }, |
| 137797 | 138021 | { 215, 0 }, |
| 137798 | 138022 | { 214, 0 }, |
| 137799 | | - { 214, 3 }, |
| 137800 | | - { 214, 2 }, |
| 137801 | | - { 216, 4 }, |
| 138023 | + { 214, -3 }, |
| 138024 | + { 214, -2 }, |
| 138025 | + { 216, -4 }, |
| 137802 | 138026 | { 216, 0 }, |
| 137803 | 138027 | { 204, 0 }, |
| 137804 | | - { 204, 3 }, |
| 137805 | | - { 186, 4 }, |
| 137806 | | - { 186, 2 }, |
| 137807 | | - { 175, 1 }, |
| 137808 | | - { 175, 1 }, |
| 138028 | + { 204, -3 }, |
| 138029 | + { 186, -4 }, |
| 138030 | + { 186, -2 }, |
| 138031 | + { 175, -1 }, |
| 138032 | + { 175, -1 }, |
| 137809 | 138033 | { 175, 0 }, |
| 137810 | 138034 | { 202, 0 }, |
| 137811 | | - { 202, 3 }, |
| 138035 | + { 202, -3 }, |
| 137812 | 138036 | { 203, 0 }, |
| 137813 | | - { 203, 2 }, |
| 138037 | + { 203, -2 }, |
| 137814 | 138038 | { 205, 0 }, |
| 137815 | | - { 205, 2 }, |
| 137816 | | - { 205, 4 }, |
| 137817 | | - { 205, 4 }, |
| 137818 | | - { 149, 6 }, |
| 138039 | + { 205, -2 }, |
| 138040 | + { 205, -4 }, |
| 138041 | + { 205, -4 }, |
| 138042 | + { 149, -6 }, |
| 137819 | 138043 | { 201, 0 }, |
| 137820 | | - { 201, 2 }, |
| 137821 | | - { 149, 8 }, |
| 137822 | | - { 218, 5 }, |
| 137823 | | - { 218, 7 }, |
| 137824 | | - { 218, 3 }, |
| 137825 | | - { 218, 5 }, |
| 137826 | | - { 149, 6 }, |
| 137827 | | - { 149, 7 }, |
| 137828 | | - { 219, 2 }, |
| 137829 | | - { 219, 1 }, |
| 138044 | + { 201, -2 }, |
| 138045 | + { 149, -8 }, |
| 138046 | + { 218, -5 }, |
| 138047 | + { 218, -7 }, |
| 138048 | + { 218, -3 }, |
| 138049 | + { 218, -5 }, |
| 138050 | + { 149, -6 }, |
| 138051 | + { 149, -7 }, |
| 138052 | + { 219, -2 }, |
| 138053 | + { 219, -1 }, |
| 137830 | 138054 | { 220, 0 }, |
| 137831 | | - { 220, 3 }, |
| 137832 | | - { 217, 3 }, |
| 137833 | | - { 217, 1 }, |
| 137834 | | - { 173, 3 }, |
| 137835 | | - { 172, 1 }, |
| 137836 | | - { 173, 1 }, |
| 137837 | | - { 173, 1 }, |
| 137838 | | - { 173, 3 }, |
| 137839 | | - { 173, 5 }, |
| 137840 | | - { 172, 1 }, |
| 137841 | | - { 172, 1 }, |
| 137842 | | - { 172, 1 }, |
| 137843 | | - { 173, 1 }, |
| 137844 | | - { 173, 3 }, |
| 137845 | | - { 173, 6 }, |
| 137846 | | - { 173, 5 }, |
| 137847 | | - { 173, 4 }, |
| 137848 | | - { 172, 1 }, |
| 137849 | | - { 173, 5 }, |
| 137850 | | - { 173, 3 }, |
| 137851 | | - { 173, 3 }, |
| 137852 | | - { 173, 3 }, |
| 137853 | | - { 173, 3 }, |
| 137854 | | - { 173, 3 }, |
| 137855 | | - { 173, 3 }, |
| 137856 | | - { 173, 3 }, |
| 137857 | | - { 173, 3 }, |
| 137858 | | - { 221, 2 }, |
| 137859 | | - { 173, 3 }, |
| 137860 | | - { 173, 5 }, |
| 137861 | | - { 173, 2 }, |
| 137862 | | - { 173, 3 }, |
| 137863 | | - { 173, 3 }, |
| 137864 | | - { 173, 4 }, |
| 137865 | | - { 173, 2 }, |
| 137866 | | - { 173, 2 }, |
| 137867 | | - { 173, 2 }, |
| 137868 | | - { 173, 2 }, |
| 137869 | | - { 222, 1 }, |
| 137870 | | - { 222, 2 }, |
| 137871 | | - { 173, 5 }, |
| 137872 | | - { 223, 1 }, |
| 137873 | | - { 223, 2 }, |
| 137874 | | - { 173, 5 }, |
| 137875 | | - { 173, 3 }, |
| 137876 | | - { 173, 5 }, |
| 137877 | | - { 173, 5 }, |
| 137878 | | - { 173, 4 }, |
| 137879 | | - { 173, 5 }, |
| 137880 | | - { 226, 5 }, |
| 137881 | | - { 226, 4 }, |
| 137882 | | - { 227, 2 }, |
| 138055 | + { 220, -3 }, |
| 138056 | + { 217, -3 }, |
| 138057 | + { 217, -1 }, |
| 138058 | + { 173, -3 }, |
| 138059 | + { 172, -1 }, |
| 138060 | + { 173, -1 }, |
| 138061 | + { 173, -1 }, |
| 138062 | + { 173, -3 }, |
| 138063 | + { 173, -5 }, |
| 138064 | + { 172, -1 }, |
| 138065 | + { 172, -1 }, |
| 138066 | + { 172, -1 }, |
| 138067 | + { 173, -1 }, |
| 138068 | + { 173, -3 }, |
| 138069 | + { 173, -6 }, |
| 138070 | + { 173, -5 }, |
| 138071 | + { 173, -4 }, |
| 138072 | + { 172, -1 }, |
| 138073 | + { 173, -5 }, |
| 138074 | + { 173, -3 }, |
| 138075 | + { 173, -3 }, |
| 138076 | + { 173, -3 }, |
| 138077 | + { 173, -3 }, |
| 138078 | + { 173, -3 }, |
| 138079 | + { 173, -3 }, |
| 138080 | + { 173, -3 }, |
| 138081 | + { 173, -3 }, |
| 138082 | + { 221, -2 }, |
| 138083 | + { 173, -3 }, |
| 138084 | + { 173, -5 }, |
| 138085 | + { 173, -2 }, |
| 138086 | + { 173, -3 }, |
| 138087 | + { 173, -3 }, |
| 138088 | + { 173, -4 }, |
| 138089 | + { 173, -2 }, |
| 138090 | + { 173, -2 }, |
| 138091 | + { 173, -2 }, |
| 138092 | + { 173, -2 }, |
| 138093 | + { 222, -1 }, |
| 138094 | + { 222, -2 }, |
| 138095 | + { 173, -5 }, |
| 138096 | + { 223, -1 }, |
| 138097 | + { 223, -2 }, |
| 138098 | + { 173, -5 }, |
| 138099 | + { 173, -3 }, |
| 138100 | + { 173, -5 }, |
| 138101 | + { 173, -5 }, |
| 138102 | + { 173, -4 }, |
| 138103 | + { 173, -5 }, |
| 138104 | + { 226, -5 }, |
| 138105 | + { 226, -4 }, |
| 138106 | + { 227, -2 }, |
| 137883 | 138107 | { 227, 0 }, |
| 137884 | | - { 225, 1 }, |
| 138108 | + { 225, -1 }, |
| 137885 | 138109 | { 225, 0 }, |
| 137886 | 138110 | { 208, 0 }, |
| 137887 | | - { 207, 3 }, |
| 137888 | | - { 207, 1 }, |
| 138111 | + { 207, -3 }, |
| 138112 | + { 207, -1 }, |
| 137889 | 138113 | { 224, 0 }, |
| 137890 | | - { 224, 3 }, |
| 137891 | | - { 149, 12 }, |
| 137892 | | - { 228, 1 }, |
| 138114 | + { 224, -3 }, |
| 138115 | + { 149, -12 }, |
| 138116 | + { 228, -1 }, |
| 137893 | 138117 | { 228, 0 }, |
| 137894 | 138118 | { 177, 0 }, |
| 137895 | | - { 177, 3 }, |
| 137896 | | - { 187, 5 }, |
| 137897 | | - { 187, 3 }, |
| 138119 | + { 177, -3 }, |
| 138120 | + { 187, -5 }, |
| 138121 | + { 187, -3 }, |
| 137898 | 138122 | { 229, 0 }, |
| 137899 | | - { 229, 2 }, |
| 137900 | | - { 149, 4 }, |
| 137901 | | - { 149, 1 }, |
| 137902 | | - { 149, 2 }, |
| 137903 | | - { 149, 3 }, |
| 137904 | | - { 149, 5 }, |
| 137905 | | - { 149, 6 }, |
| 137906 | | - { 149, 5 }, |
| 137907 | | - { 149, 6 }, |
| 137908 | | - { 169, 2 }, |
| 137909 | | - { 170, 2 }, |
| 137910 | | - { 149, 5 }, |
| 137911 | | - { 231, 11 }, |
| 137912 | | - { 233, 1 }, |
| 137913 | | - { 233, 1 }, |
| 137914 | | - { 233, 2 }, |
| 138123 | + { 229, -2 }, |
| 138124 | + { 149, -4 }, |
| 138125 | + { 149, -1 }, |
| 138126 | + { 149, -2 }, |
| 138127 | + { 149, -3 }, |
| 138128 | + { 149, -5 }, |
| 138129 | + { 149, -6 }, |
| 138130 | + { 149, -5 }, |
| 138131 | + { 149, -6 }, |
| 138132 | + { 169, -2 }, |
| 138133 | + { 170, -2 }, |
| 138134 | + { 149, -5 }, |
| 138135 | + { 231, -11 }, |
| 138136 | + { 233, -1 }, |
| 138137 | + { 233, -2 }, |
| 137915 | 138138 | { 233, 0 }, |
| 137916 | | - { 234, 1 }, |
| 137917 | | - { 234, 1 }, |
| 137918 | | - { 234, 3 }, |
| 138139 | + { 234, -1 }, |
| 138140 | + { 234, -1 }, |
| 138141 | + { 234, -3 }, |
| 137919 | 138142 | { 236, 0 }, |
| 137920 | | - { 236, 2 }, |
| 137921 | | - { 232, 3 }, |
| 137922 | | - { 232, 2 }, |
| 137923 | | - { 238, 3 }, |
| 137924 | | - { 239, 3 }, |
| 137925 | | - { 239, 2 }, |
| 137926 | | - { 237, 7 }, |
| 137927 | | - { 237, 5 }, |
| 137928 | | - { 237, 5 }, |
| 137929 | | - { 237, 1 }, |
| 137930 | | - { 173, 4 }, |
| 137931 | | - { 173, 6 }, |
| 137932 | | - { 191, 1 }, |
| 137933 | | - { 191, 1 }, |
| 137934 | | - { 191, 1 }, |
| 137935 | | - { 149, 4 }, |
| 137936 | | - { 149, 6 }, |
| 137937 | | - { 149, 3 }, |
| 138143 | + { 236, -2 }, |
| 138144 | + { 232, -3 }, |
| 138145 | + { 232, -2 }, |
| 138146 | + { 238, -3 }, |
| 138147 | + { 239, -3 }, |
| 138148 | + { 239, -2 }, |
| 138149 | + { 237, -7 }, |
| 138150 | + { 237, -5 }, |
| 138151 | + { 237, -5 }, |
| 138152 | + { 237, -1 }, |
| 138153 | + { 173, -4 }, |
| 138154 | + { 173, -6 }, |
| 138155 | + { 191, -1 }, |
| 138156 | + { 191, -1 }, |
| 138157 | + { 191, -1 }, |
| 138158 | + { 149, -4 }, |
| 138159 | + { 149, -6 }, |
| 138160 | + { 149, -3 }, |
| 137938 | 138161 | { 241, 0 }, |
| 137939 | | - { 241, 2 }, |
| 137940 | | - { 149, 1 }, |
| 137941 | | - { 149, 3 }, |
| 137942 | | - { 149, 1 }, |
| 137943 | | - { 149, 3 }, |
| 137944 | | - { 149, 6 }, |
| 137945 | | - { 149, 7 }, |
| 137946 | | - { 242, 1 }, |
| 137947 | | - { 149, 1 }, |
| 137948 | | - { 149, 4 }, |
| 137949 | | - { 244, 8 }, |
| 138162 | + { 241, -2 }, |
| 138163 | + { 149, -1 }, |
| 138164 | + { 149, -3 }, |
| 138165 | + { 149, -1 }, |
| 138166 | + { 149, -3 }, |
| 138167 | + { 149, -6 }, |
| 138168 | + { 149, -7 }, |
| 138169 | + { 242, -1 }, |
| 138170 | + { 149, -1 }, |
| 138171 | + { 149, -4 }, |
| 138172 | + { 244, -8 }, |
| 137950 | 138173 | { 246, 0 }, |
| 137951 | | - { 247, 1 }, |
| 137952 | | - { 247, 3 }, |
| 137953 | | - { 248, 1 }, |
| 138174 | + { 247, -1 }, |
| 138175 | + { 247, -3 }, |
| 138176 | + { 248, -1 }, |
| 137954 | 138177 | { 196, 0 }, |
| 137955 | | - { 196, 2 }, |
| 137956 | | - { 196, 3 }, |
| 137957 | | - { 250, 6 }, |
| 137958 | | - { 250, 8 }, |
| 137959 | | - { 144, 1 }, |
| 137960 | | - { 145, 2 }, |
| 137961 | | - { 145, 1 }, |
| 137962 | | - { 146, 1 }, |
| 137963 | | - { 146, 3 }, |
| 138178 | + { 196, -2 }, |
| 138179 | + { 196, -3 }, |
| 138180 | + { 250, -6 }, |
| 138181 | + { 250, -8 }, |
| 138182 | + { 144, -1 }, |
| 138183 | + { 145, -2 }, |
| 138184 | + { 145, -1 }, |
| 138185 | + { 146, -1 }, |
| 138186 | + { 146, -3 }, |
| 137964 | 138187 | { 147, 0 }, |
| 137965 | 138188 | { 151, 0 }, |
| 137966 | | - { 151, 1 }, |
| 137967 | | - { 151, 2 }, |
| 137968 | | - { 153, 1 }, |
| 138189 | + { 151, -1 }, |
| 138190 | + { 151, -2 }, |
| 138191 | + { 153, -1 }, |
| 137969 | 138192 | { 153, 0 }, |
| 137970 | | - { 149, 2 }, |
| 137971 | | - { 160, 4 }, |
| 137972 | | - { 160, 2 }, |
| 137973 | | - { 152, 1 }, |
| 137974 | | - { 152, 1 }, |
| 137975 | | - { 152, 1 }, |
| 137976 | | - { 166, 1 }, |
| 137977 | | - { 167, 1 }, |
| 137978 | | - { 168, 1 }, |
| 137979 | | - { 168, 1 }, |
| 137980 | | - { 165, 2 }, |
| 138193 | + { 149, -2 }, |
| 138194 | + { 160, -4 }, |
| 138195 | + { 160, -2 }, |
| 138196 | + { 152, -1 }, |
| 138197 | + { 152, -1 }, |
| 138198 | + { 152, -1 }, |
| 138199 | + { 166, -1 }, |
| 138200 | + { 167, -1 }, |
| 138201 | + { 168, -1 }, |
| 138202 | + { 168, -1 }, |
| 138203 | + { 165, -2 }, |
| 137981 | 138204 | { 165, 0 }, |
| 137982 | | - { 171, 2 }, |
| 137983 | | - { 161, 2 }, |
| 137984 | | - { 183, 3 }, |
| 137985 | | - { 183, 1 }, |
| 138205 | + { 171, -2 }, |
| 138206 | + { 161, -2 }, |
| 138207 | + { 183, -3 }, |
| 138208 | + { 183, -1 }, |
| 137986 | 138209 | { 184, 0 }, |
| 137987 | | - { 188, 1 }, |
| 137988 | | - { 190, 1 }, |
| 137989 | | - { 194, 1 }, |
| 137990 | | - { 195, 1 }, |
| 137991 | | - { 209, 2 }, |
| 137992 | | - { 210, 1 }, |
| 137993 | | - { 173, 1 }, |
| 137994 | | - { 221, 1 }, |
| 137995 | | - { 208, 1 }, |
| 137996 | | - { 230, 1 }, |
| 137997 | | - { 230, 1 }, |
| 137998 | | - { 230, 1 }, |
| 137999 | | - { 230, 1 }, |
| 138000 | | - { 230, 1 }, |
| 138001 | | - { 169, 1 }, |
| 138210 | + { 188, -1 }, |
| 138211 | + { 190, -1 }, |
| 138212 | + { 194, -1 }, |
| 138213 | + { 195, -1 }, |
| 138214 | + { 209, -2 }, |
| 138215 | + { 210, -1 }, |
| 138216 | + { 173, -1 }, |
| 138217 | + { 221, -1 }, |
| 138218 | + { 208, -1 }, |
| 138219 | + { 230, -1 }, |
| 138220 | + { 230, -1 }, |
| 138221 | + { 230, -1 }, |
| 138222 | + { 230, -1 }, |
| 138223 | + { 230, -1 }, |
| 138224 | + { 169, -1 }, |
| 138002 | 138225 | { 235, 0 }, |
| 138003 | | - { 235, 3 }, |
| 138004 | | - { 238, 1 }, |
| 138226 | + { 235, -3 }, |
| 138227 | + { 238, -1 }, |
| 138005 | 138228 | { 239, 0 }, |
| 138006 | | - { 240, 1 }, |
| 138229 | + { 240, -1 }, |
| 138007 | 138230 | { 240, 0 }, |
| 138008 | 138231 | { 243, 0 }, |
| 138009 | | - { 243, 1 }, |
| 138010 | | - { 245, 1 }, |
| 138011 | | - { 245, 3 }, |
| 138012 | | - { 246, 2 }, |
| 138232 | + { 243, -1 }, |
| 138233 | + { 245, -1 }, |
| 138234 | + { 245, -3 }, |
| 138235 | + { 246, -2 }, |
| 138013 | 138236 | { 249, 0 }, |
| 138014 | | - { 249, 4 }, |
| 138015 | | - { 249, 2 }, |
| 138237 | + { 249, -4 }, |
| 138238 | + { 249, -2 }, |
| 138016 | 138239 | }; |
| 138017 | 138240 | |
| 138018 | 138241 | static void yy_accept(yyParser*); /* Forward Declaration */ |
| 138019 | 138242 | |
| 138020 | 138243 | /* |
| | @@ -138033,11 +138256,11 @@ |
| 138033 | 138256 | yymsp = yypParser->yytos; |
| 138034 | 138257 | #ifndef NDEBUG |
| 138035 | 138258 | if( yyTraceFILE && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){ |
| 138036 | 138259 | yysize = yyRuleInfo[yyruleno].nrhs; |
| 138037 | 138260 | fprintf(yyTraceFILE, "%sReduce [%s], go to state %d.\n", yyTracePrompt, |
| 138038 | | - yyRuleName[yyruleno], yymsp[-yysize].stateno); |
| 138261 | + yyRuleName[yyruleno], yymsp[yysize].stateno); |
| 138039 | 138262 | } |
| 138040 | 138263 | #endif /* NDEBUG */ |
| 138041 | 138264 | |
| 138042 | 138265 | /* Check that the stack is large enough to grow by a single entry |
| 138043 | 138266 | ** if the RHS of the rule is empty. This ensures that there is room |
| | @@ -138048,11 +138271,11 @@ |
| 138048 | 138271 | yypParser->yyhwm++; |
| 138049 | 138272 | assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack)); |
| 138050 | 138273 | } |
| 138051 | 138274 | #endif |
| 138052 | 138275 | #if YYSTACKDEPTH>0 |
| 138053 | | - if( yypParser->yytos>=&yypParser->yystack[YYSTACKDEPTH-1] ){ |
| 138276 | + if( yypParser->yytos>=yypParser->yystackEnd ){ |
| 138054 | 138277 | yyStackOverflow(yypParser); |
| 138055 | 138278 | return; |
| 138056 | 138279 | } |
| 138057 | 138280 | #else |
| 138058 | 138281 | if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){ |
| | @@ -139007,11 +139230,11 @@ |
| 139007 | 139230 | sqlite3SrcListAppend(pParse->db,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy148, yymsp[-10].minor.yy194, |
| 139008 | 139231 | &yymsp[-11].minor.yy0, yymsp[0].minor.yy72, SQLITE_SO_ASC, yymsp[-8].minor.yy194, SQLITE_IDXTYPE_APPDEF); |
| 139009 | 139232 | } |
| 139010 | 139233 | break; |
| 139011 | 139234 | case 208: /* uniqueflag ::= UNIQUE */ |
| 139012 | | - case 249: /* raisetype ::= ABORT */ yytestcase(yyruleno==249); |
| 139235 | + case 248: /* raisetype ::= ABORT */ yytestcase(yyruleno==248); |
| 139013 | 139236 | {yymsp[0].minor.yy194 = OE_Abort;} |
| 139014 | 139237 | break; |
| 139015 | 139238 | case 209: /* uniqueflag ::= */ |
| 139016 | 139239 | {yymsp[1].minor.yy194 = OE_None;} |
| 139017 | 139240 | break; |
| | @@ -139061,268 +139284,269 @@ |
| 139061 | 139284 | { |
| 139062 | 139285 | sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy194, yymsp[-4].minor.yy332.a, yymsp[-4].minor.yy332.b, yymsp[-2].minor.yy185, yymsp[0].minor.yy72, yymsp[-10].minor.yy194, yymsp[-8].minor.yy194); |
| 139063 | 139286 | yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/ |
| 139064 | 139287 | } |
| 139065 | 139288 | break; |
| 139066 | | - case 228: /* trigger_time ::= BEFORE */ |
| 139067 | | -{ yymsp[0].minor.yy194 = TK_BEFORE; } |
| 139289 | + case 228: /* trigger_time ::= BEFORE|AFTER */ |
| 139290 | +{ yymsp[0].minor.yy194 = yymsp[0].major; /*A-overwrites-X*/ } |
| 139068 | 139291 | break; |
| 139069 | | - case 229: /* trigger_time ::= AFTER */ |
| 139070 | | -{ yymsp[0].minor.yy194 = TK_AFTER; } |
| 139071 | | - break; |
| 139072 | | - case 230: /* trigger_time ::= INSTEAD OF */ |
| 139292 | + case 229: /* trigger_time ::= INSTEAD OF */ |
| 139073 | 139293 | { yymsp[-1].minor.yy194 = TK_INSTEAD;} |
| 139074 | 139294 | break; |
| 139075 | | - case 231: /* trigger_time ::= */ |
| 139295 | + case 230: /* trigger_time ::= */ |
| 139076 | 139296 | { yymsp[1].minor.yy194 = TK_BEFORE; } |
| 139077 | 139297 | break; |
| 139078 | | - case 232: /* trigger_event ::= DELETE|INSERT */ |
| 139079 | | - case 233: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==233); |
| 139298 | + case 231: /* trigger_event ::= DELETE|INSERT */ |
| 139299 | + case 232: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==232); |
| 139080 | 139300 | {yymsp[0].minor.yy332.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy332.b = 0;} |
| 139081 | 139301 | break; |
| 139082 | | - case 234: /* trigger_event ::= UPDATE OF idlist */ |
| 139302 | + case 233: /* trigger_event ::= UPDATE OF idlist */ |
| 139083 | 139303 | {yymsp[-2].minor.yy332.a = TK_UPDATE; yymsp[-2].minor.yy332.b = yymsp[0].minor.yy254;} |
| 139084 | 139304 | break; |
| 139085 | | - case 235: /* when_clause ::= */ |
| 139086 | | - case 254: /* key_opt ::= */ yytestcase(yyruleno==254); |
| 139305 | + case 234: /* when_clause ::= */ |
| 139306 | + case 253: /* key_opt ::= */ yytestcase(yyruleno==253); |
| 139087 | 139307 | { yymsp[1].minor.yy72 = 0; } |
| 139088 | 139308 | break; |
| 139089 | | - case 236: /* when_clause ::= WHEN expr */ |
| 139090 | | - case 255: /* key_opt ::= KEY expr */ yytestcase(yyruleno==255); |
| 139309 | + case 235: /* when_clause ::= WHEN expr */ |
| 139310 | + case 254: /* key_opt ::= KEY expr */ yytestcase(yyruleno==254); |
| 139091 | 139311 | { yymsp[-1].minor.yy72 = yymsp[0].minor.yy190.pExpr; } |
| 139092 | 139312 | break; |
| 139093 | | - case 237: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ |
| 139313 | + case 236: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ |
| 139094 | 139314 | { |
| 139095 | 139315 | assert( yymsp[-2].minor.yy145!=0 ); |
| 139096 | 139316 | yymsp[-2].minor.yy145->pLast->pNext = yymsp[-1].minor.yy145; |
| 139097 | 139317 | yymsp[-2].minor.yy145->pLast = yymsp[-1].minor.yy145; |
| 139098 | 139318 | } |
| 139099 | 139319 | break; |
| 139100 | | - case 238: /* trigger_cmd_list ::= trigger_cmd SEMI */ |
| 139320 | + case 237: /* trigger_cmd_list ::= trigger_cmd SEMI */ |
| 139101 | 139321 | { |
| 139102 | 139322 | assert( yymsp[-1].minor.yy145!=0 ); |
| 139103 | 139323 | yymsp[-1].minor.yy145->pLast = yymsp[-1].minor.yy145; |
| 139104 | 139324 | } |
| 139105 | 139325 | break; |
| 139106 | | - case 239: /* trnm ::= nm DOT nm */ |
| 139326 | + case 238: /* trnm ::= nm DOT nm */ |
| 139107 | 139327 | { |
| 139108 | 139328 | yymsp[-2].minor.yy0 = yymsp[0].minor.yy0; |
| 139109 | 139329 | sqlite3ErrorMsg(pParse, |
| 139110 | 139330 | "qualified table names are not allowed on INSERT, UPDATE, and DELETE " |
| 139111 | 139331 | "statements within triggers"); |
| 139112 | 139332 | } |
| 139113 | 139333 | break; |
| 139114 | | - case 240: /* tridxby ::= INDEXED BY nm */ |
| 139334 | + case 239: /* tridxby ::= INDEXED BY nm */ |
| 139115 | 139335 | { |
| 139116 | 139336 | sqlite3ErrorMsg(pParse, |
| 139117 | 139337 | "the INDEXED BY clause is not allowed on UPDATE or DELETE statements " |
| 139118 | 139338 | "within triggers"); |
| 139119 | 139339 | } |
| 139120 | 139340 | break; |
| 139121 | | - case 241: /* tridxby ::= NOT INDEXED */ |
| 139341 | + case 240: /* tridxby ::= NOT INDEXED */ |
| 139122 | 139342 | { |
| 139123 | 139343 | sqlite3ErrorMsg(pParse, |
| 139124 | 139344 | "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements " |
| 139125 | 139345 | "within triggers"); |
| 139126 | 139346 | } |
| 139127 | 139347 | break; |
| 139128 | | - case 242: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt */ |
| 139348 | + case 241: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt */ |
| 139129 | 139349 | {yymsp[-6].minor.yy145 = sqlite3TriggerUpdateStep(pParse->db, &yymsp[-4].minor.yy0, yymsp[-1].minor.yy148, yymsp[0].minor.yy72, yymsp[-5].minor.yy194);} |
| 139130 | 139350 | break; |
| 139131 | | - case 243: /* trigger_cmd ::= insert_cmd INTO trnm idlist_opt select */ |
| 139351 | + case 242: /* trigger_cmd ::= insert_cmd INTO trnm idlist_opt select */ |
| 139132 | 139352 | {yymsp[-4].minor.yy145 = sqlite3TriggerInsertStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy254, yymsp[0].minor.yy243, yymsp[-4].minor.yy194);/*A-overwrites-R*/} |
| 139133 | 139353 | break; |
| 139134 | | - case 244: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt */ |
| 139354 | + case 243: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt */ |
| 139135 | 139355 | {yymsp[-4].minor.yy145 = sqlite3TriggerDeleteStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[0].minor.yy72);} |
| 139136 | 139356 | break; |
| 139137 | | - case 245: /* trigger_cmd ::= select */ |
| 139357 | + case 244: /* trigger_cmd ::= select */ |
| 139138 | 139358 | {yymsp[0].minor.yy145 = sqlite3TriggerSelectStep(pParse->db, yymsp[0].minor.yy243); /*A-overwrites-X*/} |
| 139139 | 139359 | break; |
| 139140 | | - case 246: /* expr ::= RAISE LP IGNORE RP */ |
| 139360 | + case 245: /* expr ::= RAISE LP IGNORE RP */ |
| 139141 | 139361 | { |
| 139142 | 139362 | spanSet(&yymsp[-3].minor.yy190,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/ |
| 139143 | 139363 | yymsp[-3].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_RAISE, 0, 0); |
| 139144 | 139364 | if( yymsp[-3].minor.yy190.pExpr ){ |
| 139145 | 139365 | yymsp[-3].minor.yy190.pExpr->affinity = OE_Ignore; |
| 139146 | 139366 | } |
| 139147 | 139367 | } |
| 139148 | 139368 | break; |
| 139149 | | - case 247: /* expr ::= RAISE LP raisetype COMMA nm RP */ |
| 139369 | + case 246: /* expr ::= RAISE LP raisetype COMMA nm RP */ |
| 139150 | 139370 | { |
| 139151 | 139371 | spanSet(&yymsp[-5].minor.yy190,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/ |
| 139152 | 139372 | yymsp[-5].minor.yy190.pExpr = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1); |
| 139153 | 139373 | if( yymsp[-5].minor.yy190.pExpr ) { |
| 139154 | 139374 | yymsp[-5].minor.yy190.pExpr->affinity = (char)yymsp[-3].minor.yy194; |
| 139155 | 139375 | } |
| 139156 | 139376 | } |
| 139157 | 139377 | break; |
| 139158 | | - case 248: /* raisetype ::= ROLLBACK */ |
| 139378 | + case 247: /* raisetype ::= ROLLBACK */ |
| 139159 | 139379 | {yymsp[0].minor.yy194 = OE_Rollback;} |
| 139160 | 139380 | break; |
| 139161 | | - case 250: /* raisetype ::= FAIL */ |
| 139381 | + case 249: /* raisetype ::= FAIL */ |
| 139162 | 139382 | {yymsp[0].minor.yy194 = OE_Fail;} |
| 139163 | 139383 | break; |
| 139164 | | - case 251: /* cmd ::= DROP TRIGGER ifexists fullname */ |
| 139384 | + case 250: /* cmd ::= DROP TRIGGER ifexists fullname */ |
| 139165 | 139385 | { |
| 139166 | 139386 | sqlite3DropTrigger(pParse,yymsp[0].minor.yy185,yymsp[-1].minor.yy194); |
| 139167 | 139387 | } |
| 139168 | 139388 | break; |
| 139169 | | - case 252: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ |
| 139389 | + case 251: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ |
| 139170 | 139390 | { |
| 139171 | 139391 | sqlite3Attach(pParse, yymsp[-3].minor.yy190.pExpr, yymsp[-1].minor.yy190.pExpr, yymsp[0].minor.yy72); |
| 139172 | 139392 | } |
| 139173 | 139393 | break; |
| 139174 | | - case 253: /* cmd ::= DETACH database_kw_opt expr */ |
| 139394 | + case 252: /* cmd ::= DETACH database_kw_opt expr */ |
| 139175 | 139395 | { |
| 139176 | 139396 | sqlite3Detach(pParse, yymsp[0].minor.yy190.pExpr); |
| 139177 | 139397 | } |
| 139178 | 139398 | break; |
| 139179 | | - case 256: /* cmd ::= REINDEX */ |
| 139399 | + case 255: /* cmd ::= REINDEX */ |
| 139180 | 139400 | {sqlite3Reindex(pParse, 0, 0);} |
| 139181 | 139401 | break; |
| 139182 | | - case 257: /* cmd ::= REINDEX nm dbnm */ |
| 139402 | + case 256: /* cmd ::= REINDEX nm dbnm */ |
| 139183 | 139403 | {sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);} |
| 139184 | 139404 | break; |
| 139185 | | - case 258: /* cmd ::= ANALYZE */ |
| 139405 | + case 257: /* cmd ::= ANALYZE */ |
| 139186 | 139406 | {sqlite3Analyze(pParse, 0, 0);} |
| 139187 | 139407 | break; |
| 139188 | | - case 259: /* cmd ::= ANALYZE nm dbnm */ |
| 139408 | + case 258: /* cmd ::= ANALYZE nm dbnm */ |
| 139189 | 139409 | {sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);} |
| 139190 | 139410 | break; |
| 139191 | | - case 260: /* cmd ::= ALTER TABLE fullname RENAME TO nm */ |
| 139411 | + case 259: /* cmd ::= ALTER TABLE fullname RENAME TO nm */ |
| 139192 | 139412 | { |
| 139193 | 139413 | sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy185,&yymsp[0].minor.yy0); |
| 139194 | 139414 | } |
| 139195 | 139415 | break; |
| 139196 | | - case 261: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ |
| 139416 | + case 260: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ |
| 139197 | 139417 | { |
| 139198 | 139418 | yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n; |
| 139199 | 139419 | sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0); |
| 139200 | 139420 | } |
| 139201 | 139421 | break; |
| 139202 | | - case 262: /* add_column_fullname ::= fullname */ |
| 139422 | + case 261: /* add_column_fullname ::= fullname */ |
| 139203 | 139423 | { |
| 139204 | 139424 | disableLookaside(pParse); |
| 139205 | 139425 | sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy185); |
| 139206 | 139426 | } |
| 139207 | 139427 | break; |
| 139208 | | - case 263: /* cmd ::= create_vtab */ |
| 139428 | + case 262: /* cmd ::= create_vtab */ |
| 139209 | 139429 | {sqlite3VtabFinishParse(pParse,0);} |
| 139210 | 139430 | break; |
| 139211 | | - case 264: /* cmd ::= create_vtab LP vtabarglist RP */ |
| 139431 | + case 263: /* cmd ::= create_vtab LP vtabarglist RP */ |
| 139212 | 139432 | {sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);} |
| 139213 | 139433 | break; |
| 139214 | | - case 265: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ |
| 139434 | + case 264: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ |
| 139215 | 139435 | { |
| 139216 | 139436 | sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy194); |
| 139217 | 139437 | } |
| 139218 | 139438 | break; |
| 139219 | | - case 266: /* vtabarg ::= */ |
| 139439 | + case 265: /* vtabarg ::= */ |
| 139220 | 139440 | {sqlite3VtabArgInit(pParse);} |
| 139221 | 139441 | break; |
| 139222 | | - case 267: /* vtabargtoken ::= ANY */ |
| 139223 | | - case 268: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==268); |
| 139224 | | - case 269: /* lp ::= LP */ yytestcase(yyruleno==269); |
| 139442 | + case 266: /* vtabargtoken ::= ANY */ |
| 139443 | + case 267: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==267); |
| 139444 | + case 268: /* lp ::= LP */ yytestcase(yyruleno==268); |
| 139225 | 139445 | {sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);} |
| 139226 | 139446 | break; |
| 139227 | | - case 270: /* with ::= */ |
| 139447 | + case 269: /* with ::= */ |
| 139228 | 139448 | {yymsp[1].minor.yy285 = 0;} |
| 139229 | 139449 | break; |
| 139230 | | - case 271: /* with ::= WITH wqlist */ |
| 139450 | + case 270: /* with ::= WITH wqlist */ |
| 139231 | 139451 | { yymsp[-1].minor.yy285 = yymsp[0].minor.yy285; } |
| 139232 | 139452 | break; |
| 139233 | | - case 272: /* with ::= WITH RECURSIVE wqlist */ |
| 139453 | + case 271: /* with ::= WITH RECURSIVE wqlist */ |
| 139234 | 139454 | { yymsp[-2].minor.yy285 = yymsp[0].minor.yy285; } |
| 139235 | 139455 | break; |
| 139236 | | - case 273: /* wqlist ::= nm eidlist_opt AS LP select RP */ |
| 139456 | + case 272: /* wqlist ::= nm eidlist_opt AS LP select RP */ |
| 139237 | 139457 | { |
| 139238 | 139458 | yymsp[-5].minor.yy285 = sqlite3WithAdd(pParse, 0, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy148, yymsp[-1].minor.yy243); /*A-overwrites-X*/ |
| 139239 | 139459 | } |
| 139240 | 139460 | break; |
| 139241 | | - case 274: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */ |
| 139461 | + case 273: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */ |
| 139242 | 139462 | { |
| 139243 | 139463 | yymsp[-7].minor.yy285 = sqlite3WithAdd(pParse, yymsp[-7].minor.yy285, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy148, yymsp[-1].minor.yy243); |
| 139244 | 139464 | } |
| 139245 | 139465 | break; |
| 139246 | 139466 | default: |
| 139247 | | - /* (275) input ::= cmdlist */ yytestcase(yyruleno==275); |
| 139248 | | - /* (276) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==276); |
| 139249 | | - /* (277) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=277); |
| 139250 | | - /* (278) ecmd ::= SEMI */ yytestcase(yyruleno==278); |
| 139251 | | - /* (279) ecmd ::= explain cmdx SEMI */ yytestcase(yyruleno==279); |
| 139252 | | - /* (280) explain ::= */ yytestcase(yyruleno==280); |
| 139253 | | - /* (281) trans_opt ::= */ yytestcase(yyruleno==281); |
| 139254 | | - /* (282) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==282); |
| 139255 | | - /* (283) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==283); |
| 139256 | | - /* (284) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==284); |
| 139257 | | - /* (285) savepoint_opt ::= */ yytestcase(yyruleno==285); |
| 139258 | | - /* (286) cmd ::= create_table create_table_args */ yytestcase(yyruleno==286); |
| 139259 | | - /* (287) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==287); |
| 139260 | | - /* (288) columnlist ::= columnname carglist */ yytestcase(yyruleno==288); |
| 139261 | | - /* (289) nm ::= ID|INDEXED */ yytestcase(yyruleno==289); |
| 139262 | | - /* (290) nm ::= STRING */ yytestcase(yyruleno==290); |
| 139263 | | - /* (291) nm ::= JOIN_KW */ yytestcase(yyruleno==291); |
| 139264 | | - /* (292) typetoken ::= typename */ yytestcase(yyruleno==292); |
| 139265 | | - /* (293) typename ::= ID|STRING */ yytestcase(yyruleno==293); |
| 139266 | | - /* (294) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=294); |
| 139267 | | - /* (295) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=295); |
| 139268 | | - /* (296) carglist ::= carglist ccons */ yytestcase(yyruleno==296); |
| 139269 | | - /* (297) carglist ::= */ yytestcase(yyruleno==297); |
| 139270 | | - /* (298) ccons ::= NULL onconf */ yytestcase(yyruleno==298); |
| 139271 | | - /* (299) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==299); |
| 139272 | | - /* (300) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==300); |
| 139273 | | - /* (301) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=301); |
| 139274 | | - /* (302) tconscomma ::= */ yytestcase(yyruleno==302); |
| 139275 | | - /* (303) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=303); |
| 139276 | | - /* (304) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=304); |
| 139277 | | - /* (305) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=305); |
| 139278 | | - /* (306) oneselect ::= values */ yytestcase(yyruleno==306); |
| 139279 | | - /* (307) sclp ::= selcollist COMMA */ yytestcase(yyruleno==307); |
| 139280 | | - /* (308) as ::= ID|STRING */ yytestcase(yyruleno==308); |
| 139281 | | - /* (309) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=309); |
| 139282 | | - /* (310) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==310); |
| 139283 | | - /* (311) exprlist ::= nexprlist */ yytestcase(yyruleno==311); |
| 139284 | | - /* (312) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=312); |
| 139285 | | - /* (313) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=313); |
| 139286 | | - /* (314) nmnum ::= ON */ yytestcase(yyruleno==314); |
| 139287 | | - /* (315) nmnum ::= DELETE */ yytestcase(yyruleno==315); |
| 139288 | | - /* (316) nmnum ::= DEFAULT */ yytestcase(yyruleno==316); |
| 139289 | | - /* (317) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==317); |
| 139290 | | - /* (318) foreach_clause ::= */ yytestcase(yyruleno==318); |
| 139291 | | - /* (319) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==319); |
| 139292 | | - /* (320) trnm ::= nm */ yytestcase(yyruleno==320); |
| 139293 | | - /* (321) tridxby ::= */ yytestcase(yyruleno==321); |
| 139294 | | - /* (322) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==322); |
| 139295 | | - /* (323) database_kw_opt ::= */ yytestcase(yyruleno==323); |
| 139296 | | - /* (324) kwcolumn_opt ::= */ yytestcase(yyruleno==324); |
| 139297 | | - /* (325) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==325); |
| 139298 | | - /* (326) vtabarglist ::= vtabarg */ yytestcase(yyruleno==326); |
| 139299 | | - /* (327) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==327); |
| 139300 | | - /* (328) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==328); |
| 139301 | | - /* (329) anylist ::= */ yytestcase(yyruleno==329); |
| 139302 | | - /* (330) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==330); |
| 139303 | | - /* (331) anylist ::= anylist ANY */ yytestcase(yyruleno==331); |
| 139467 | + /* (274) input ::= cmdlist */ yytestcase(yyruleno==274); |
| 139468 | + /* (275) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==275); |
| 139469 | + /* (276) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=276); |
| 139470 | + /* (277) ecmd ::= SEMI */ yytestcase(yyruleno==277); |
| 139471 | + /* (278) ecmd ::= explain cmdx SEMI */ yytestcase(yyruleno==278); |
| 139472 | + /* (279) explain ::= */ yytestcase(yyruleno==279); |
| 139473 | + /* (280) trans_opt ::= */ yytestcase(yyruleno==280); |
| 139474 | + /* (281) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==281); |
| 139475 | + /* (282) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==282); |
| 139476 | + /* (283) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==283); |
| 139477 | + /* (284) savepoint_opt ::= */ yytestcase(yyruleno==284); |
| 139478 | + /* (285) cmd ::= create_table create_table_args */ yytestcase(yyruleno==285); |
| 139479 | + /* (286) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==286); |
| 139480 | + /* (287) columnlist ::= columnname carglist */ yytestcase(yyruleno==287); |
| 139481 | + /* (288) nm ::= ID|INDEXED */ yytestcase(yyruleno==288); |
| 139482 | + /* (289) nm ::= STRING */ yytestcase(yyruleno==289); |
| 139483 | + /* (290) nm ::= JOIN_KW */ yytestcase(yyruleno==290); |
| 139484 | + /* (291) typetoken ::= typename */ yytestcase(yyruleno==291); |
| 139485 | + /* (292) typename ::= ID|STRING */ yytestcase(yyruleno==292); |
| 139486 | + /* (293) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=293); |
| 139487 | + /* (294) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=294); |
| 139488 | + /* (295) carglist ::= carglist ccons */ yytestcase(yyruleno==295); |
| 139489 | + /* (296) carglist ::= */ yytestcase(yyruleno==296); |
| 139490 | + /* (297) ccons ::= NULL onconf */ yytestcase(yyruleno==297); |
| 139491 | + /* (298) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==298); |
| 139492 | + /* (299) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==299); |
| 139493 | + /* (300) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=300); |
| 139494 | + /* (301) tconscomma ::= */ yytestcase(yyruleno==301); |
| 139495 | + /* (302) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=302); |
| 139496 | + /* (303) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=303); |
| 139497 | + /* (304) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=304); |
| 139498 | + /* (305) oneselect ::= values */ yytestcase(yyruleno==305); |
| 139499 | + /* (306) sclp ::= selcollist COMMA */ yytestcase(yyruleno==306); |
| 139500 | + /* (307) as ::= ID|STRING */ yytestcase(yyruleno==307); |
| 139501 | + /* (308) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=308); |
| 139502 | + /* (309) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==309); |
| 139503 | + /* (310) exprlist ::= nexprlist */ yytestcase(yyruleno==310); |
| 139504 | + /* (311) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=311); |
| 139505 | + /* (312) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=312); |
| 139506 | + /* (313) nmnum ::= ON */ yytestcase(yyruleno==313); |
| 139507 | + /* (314) nmnum ::= DELETE */ yytestcase(yyruleno==314); |
| 139508 | + /* (315) nmnum ::= DEFAULT */ yytestcase(yyruleno==315); |
| 139509 | + /* (316) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==316); |
| 139510 | + /* (317) foreach_clause ::= */ yytestcase(yyruleno==317); |
| 139511 | + /* (318) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==318); |
| 139512 | + /* (319) trnm ::= nm */ yytestcase(yyruleno==319); |
| 139513 | + /* (320) tridxby ::= */ yytestcase(yyruleno==320); |
| 139514 | + /* (321) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==321); |
| 139515 | + /* (322) database_kw_opt ::= */ yytestcase(yyruleno==322); |
| 139516 | + /* (323) kwcolumn_opt ::= */ yytestcase(yyruleno==323); |
| 139517 | + /* (324) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==324); |
| 139518 | + /* (325) vtabarglist ::= vtabarg */ yytestcase(yyruleno==325); |
| 139519 | + /* (326) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==326); |
| 139520 | + /* (327) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==327); |
| 139521 | + /* (328) anylist ::= */ yytestcase(yyruleno==328); |
| 139522 | + /* (329) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==329); |
| 139523 | + /* (330) anylist ::= anylist ANY */ yytestcase(yyruleno==330); |
| 139304 | 139524 | break; |
| 139305 | 139525 | /********** End reduce actions ************************************************/ |
| 139306 | 139526 | }; |
| 139307 | 139527 | assert( yyruleno<sizeof(yyRuleInfo)/sizeof(yyRuleInfo[0]) ); |
| 139308 | 139528 | yygoto = yyRuleInfo[yyruleno].lhs; |
| 139309 | 139529 | yysize = yyRuleInfo[yyruleno].nrhs; |
| 139310 | | - yyact = yy_find_reduce_action(yymsp[-yysize].stateno,(YYCODETYPE)yygoto); |
| 139311 | | - if( yyact <= YY_MAX_SHIFTREDUCE ){ |
| 139312 | | - if( yyact>YY_MAX_SHIFT ){ |
| 139313 | | - yyact += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE; |
| 139314 | | - } |
| 139315 | | - yymsp -= yysize-1; |
| 139530 | + yyact = yy_find_reduce_action(yymsp[yysize].stateno,(YYCODETYPE)yygoto); |
| 139531 | + |
| 139532 | + /* There are no SHIFTREDUCE actions on nonterminals because the table |
| 139533 | + ** generator has simplified them to pure REDUCE actions. */ |
| 139534 | + assert( !(yyact>YY_MAX_SHIFT && yyact<=YY_MAX_SHIFTREDUCE) ); |
| 139535 | + |
| 139536 | + /* It is not possible for a REDUCE to be followed by an error */ |
| 139537 | + assert( yyact!=YY_ERROR_ACTION ); |
| 139538 | + |
| 139539 | + if( yyact==YY_ACCEPT_ACTION ){ |
| 139540 | + yypParser->yytos += yysize; |
| 139541 | + yy_accept(yypParser); |
| 139542 | + }else{ |
| 139543 | + yymsp += yysize+1; |
| 139316 | 139544 | yypParser->yytos = yymsp; |
| 139317 | 139545 | yymsp->stateno = (YYACTIONTYPE)yyact; |
| 139318 | 139546 | yymsp->major = (YYCODETYPE)yygoto; |
| 139319 | 139547 | yyTraceShift(yypParser, yyact); |
| 139320 | | - }else{ |
| 139321 | | - assert( yyact == YY_ACCEPT_ACTION ); |
| 139322 | | - yypParser->yytos -= yysize; |
| 139323 | | - yy_accept(yypParser); |
| 139324 | 139548 | } |
| 139325 | 139549 | } |
| 139326 | 139550 | |
| 139327 | 139551 | /* |
| 139328 | 139552 | ** The following code executes when the parse fails |
| | @@ -140886,10 +141110,13 @@ |
| 140886 | 141110 | /************** Continuing where we left off in main.c ***********************/ |
| 140887 | 141111 | #endif |
| 140888 | 141112 | #ifdef SQLITE_ENABLE_JSON1 |
| 140889 | 141113 | SQLITE_PRIVATE int sqlite3Json1Init(sqlite3*); |
| 140890 | 141114 | #endif |
| 141115 | +#ifdef SQLITE_ENABLE_STMTVTAB |
| 141116 | +SQLITE_PRIVATE int sqlite3StmtVtabInit(sqlite3*); |
| 141117 | +#endif |
| 140891 | 141118 | #ifdef SQLITE_ENABLE_FTS5 |
| 140892 | 141119 | SQLITE_PRIVATE int sqlite3Fts5Init(sqlite3*); |
| 140893 | 141120 | #endif |
| 140894 | 141121 | |
| 140895 | 141122 | #ifndef SQLITE_AMALGAMATION |
| | @@ -141669,10 +141896,11 @@ |
| 141669 | 141896 | { SQLITE_DBCONFIG_ENABLE_FKEY, SQLITE_ForeignKeys }, |
| 141670 | 141897 | { SQLITE_DBCONFIG_ENABLE_TRIGGER, SQLITE_EnableTrigger }, |
| 141671 | 141898 | { SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER, SQLITE_Fts3Tokenizer }, |
| 141672 | 141899 | { SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION, SQLITE_LoadExtension }, |
| 141673 | 141900 | { SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE, SQLITE_NoCkptOnClose }, |
| 141901 | + { SQLITE_DBCONFIG_ENABLE_QPSG, SQLITE_EnableQPSG }, |
| 141674 | 141902 | }; |
| 141675 | 141903 | unsigned int i; |
| 141676 | 141904 | rc = SQLITE_ERROR; /* IMP: R-42790-23372 */ |
| 141677 | 141905 | for(i=0; i<ArraySize(aFlagOp); i++){ |
| 141678 | 141906 | if( aFlagOp[i].op==op ){ |
| | @@ -143774,10 +144002,13 @@ |
| 143774 | 144002 | | SQLITE_CellSizeCk |
| 143775 | 144003 | #endif |
| 143776 | 144004 | #if defined(SQLITE_ENABLE_FTS3_TOKENIZER) |
| 143777 | 144005 | | SQLITE_Fts3Tokenizer |
| 143778 | 144006 | #endif |
| 144007 | +#if defined(SQLITE_ENABLE_QPSG) |
| 144008 | + | SQLITE_EnableQPSG |
| 144009 | +#endif |
| 143779 | 144010 | ; |
| 143780 | 144011 | sqlite3HashInit(&db->aCollSeq); |
| 143781 | 144012 | #ifndef SQLITE_OMIT_VIRTUALTABLE |
| 143782 | 144013 | sqlite3HashInit(&db->aModule); |
| 143783 | 144014 | #endif |
| | @@ -143911,10 +144142,16 @@ |
| 143911 | 144142 | #ifdef SQLITE_ENABLE_JSON1 |
| 143912 | 144143 | if( !db->mallocFailed && rc==SQLITE_OK){ |
| 143913 | 144144 | rc = sqlite3Json1Init(db); |
| 143914 | 144145 | } |
| 143915 | 144146 | #endif |
| 144147 | + |
| 144148 | +#ifdef SQLITE_ENABLE_STMTVTAB |
| 144149 | + if( !db->mallocFailed && rc==SQLITE_OK){ |
| 144150 | + rc = sqlite3StmtVtabInit(db); |
| 144151 | + } |
| 144152 | +#endif |
| 143916 | 144153 | |
| 143917 | 144154 | /* -DSQLITE_DEFAULT_LOCKING_MODE=1 makes EXCLUSIVE the default locking |
| 143918 | 144155 | ** mode. -DSQLITE_DEFAULT_LOCKING_MODE=0 make NORMAL the default locking |
| 143919 | 144156 | ** mode. Doing nothing at all also makes NORMAL the default. |
| 143920 | 144157 | */ |
| | @@ -148000,11 +148237,11 @@ |
| 148000 | 148237 | pCsr->pStmt = p->pSeekStmt; |
| 148001 | 148238 | p->pSeekStmt = 0; |
| 148002 | 148239 | }else{ |
| 148003 | 148240 | zSql = sqlite3_mprintf("SELECT %s WHERE rowid = ?", p->zReadExprlist); |
| 148004 | 148241 | if( !zSql ) return SQLITE_NOMEM; |
| 148005 | | - rc = sqlite3_prepare_v2(p->db, zSql, -1, &pCsr->pStmt, 0); |
| 148242 | + rc = sqlite3_prepare_v3(p->db, zSql,-1,SQLITE_PREPARE_PERSISTENT,&pCsr->pStmt,0); |
| 148006 | 148243 | sqlite3_free(zSql); |
| 148007 | 148244 | } |
| 148008 | 148245 | if( rc==SQLITE_OK ) pCsr->bSeekStmt = 1; |
| 148009 | 148246 | } |
| 148010 | 148247 | return rc; |
| | @@ -149537,11 +149774,11 @@ |
| 149537 | 149774 | zSql = sqlite3_mprintf("SELECT %s ORDER BY rowid %s", |
| 149538 | 149775 | p->zReadExprlist, (pCsr->bDesc ? "DESC" : "ASC") |
| 149539 | 149776 | ); |
| 149540 | 149777 | } |
| 149541 | 149778 | if( zSql ){ |
| 149542 | | - rc = sqlite3_prepare_v2(p->db, zSql, -1, &pCsr->pStmt, 0); |
| 149779 | + rc = sqlite3_prepare_v3(p->db,zSql,-1,SQLITE_PREPARE_PERSISTENT,&pCsr->pStmt,0); |
| 149543 | 149780 | sqlite3_free(zSql); |
| 149544 | 149781 | }else{ |
| 149545 | 149782 | rc = SQLITE_NOMEM; |
| 149546 | 149783 | } |
| 149547 | 149784 | }else if( eSearch==FTS3_DOCID_SEARCH ){ |
| | @@ -156744,11 +156981,12 @@ |
| 156744 | 156981 | zSql = sqlite3_mprintf(azSql[eStmt], p->zDb, p->zName); |
| 156745 | 156982 | } |
| 156746 | 156983 | if( !zSql ){ |
| 156747 | 156984 | rc = SQLITE_NOMEM; |
| 156748 | 156985 | }else{ |
| 156749 | | - rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, NULL); |
| 156986 | + rc = sqlite3_prepare_v3(p->db, zSql, -1, SQLITE_PREPARE_PERSISTENT, |
| 156987 | + &pStmt, NULL); |
| 156750 | 156988 | sqlite3_free(zSql); |
| 156751 | 156989 | assert( rc==SQLITE_OK || pStmt==0 ); |
| 156752 | 156990 | p->aStmt[eStmt] = pStmt; |
| 156753 | 156991 | } |
| 156754 | 156992 | } |
| | @@ -167854,11 +168092,12 @@ |
| 167854 | 168092 | |
| 167855 | 168093 | rc = rtreeQueryStat1(db, pRtree); |
| 167856 | 168094 | for(i=0; i<N_STATEMENT && rc==SQLITE_OK; i++){ |
| 167857 | 168095 | char *zSql = sqlite3_mprintf(azSql[i], zDb, zPrefix); |
| 167858 | 168096 | if( zSql ){ |
| 167859 | | - rc = sqlite3_prepare_v2(db, zSql, -1, appStmt[i], 0); |
| 168097 | + rc = sqlite3_prepare_v3(db, zSql, -1, SQLITE_PREPARE_PERSISTENT, |
| 168098 | + appStmt[i], 0); |
| 167860 | 168099 | }else{ |
| 167861 | 168100 | rc = SQLITE_NOMEM; |
| 167862 | 168101 | } |
| 167863 | 168102 | sqlite3_free(zSql); |
| 167864 | 168103 | } |
| | @@ -183900,16 +184139,16 @@ |
| 183900 | 184139 | ** fts5yy_default[] Default action for each state. |
| 183901 | 184140 | ** |
| 183902 | 184141 | *********** Begin parsing tables **********************************************/ |
| 183903 | 184142 | #define fts5YY_ACTTAB_COUNT (98) |
| 183904 | 184143 | static const fts5YYACTIONTYPE fts5yy_action[] = { |
| 183905 | | - /* 0 */ 105, 19, 63, 6, 26, 66, 65, 24, 24, 17, |
| 183906 | | - /* 10 */ 63, 6, 26, 16, 65, 54, 24, 18, 63, 6, |
| 183907 | | - /* 20 */ 26, 10, 65, 12, 24, 75, 59, 63, 6, 26, |
| 183908 | | - /* 30 */ 13, 65, 75, 24, 20, 63, 6, 26, 74, 65, |
| 183909 | | - /* 40 */ 56, 24, 27, 63, 6, 26, 73, 65, 21, 24, |
| 183910 | | - /* 50 */ 23, 15, 30, 11, 1, 64, 22, 25, 9, 65, |
| 184144 | + /* 0 */ 105, 19, 90, 6, 26, 93, 92, 24, 24, 17, |
| 184145 | + /* 10 */ 90, 6, 26, 16, 92, 54, 24, 18, 90, 6, |
| 184146 | + /* 20 */ 26, 10, 92, 12, 24, 75, 86, 90, 6, 26, |
| 184147 | + /* 30 */ 13, 92, 75, 24, 20, 90, 6, 26, 101, 92, |
| 184148 | + /* 40 */ 56, 24, 27, 90, 6, 26, 100, 92, 21, 24, |
| 184149 | + /* 50 */ 23, 15, 30, 11, 1, 91, 22, 25, 9, 92, |
| 183911 | 184150 | /* 60 */ 7, 24, 3, 4, 5, 3, 4, 5, 3, 77, |
| 183912 | 184151 | /* 70 */ 4, 5, 3, 61, 23, 15, 60, 11, 80, 12, |
| 183913 | 184152 | /* 80 */ 2, 13, 68, 10, 29, 52, 55, 75, 31, 32, |
| 183914 | 184153 | /* 90 */ 8, 28, 5, 3, 51, 55, 72, 14, |
| 183915 | 184154 | }; |
| | @@ -184010,10 +184249,11 @@ |
| 184010 | 184249 | int fts5yystksz; /* Current side of the stack */ |
| 184011 | 184250 | fts5yyStackEntry *fts5yystack; /* The parser's stack */ |
| 184012 | 184251 | fts5yyStackEntry fts5yystk0; /* First stack entry */ |
| 184013 | 184252 | #else |
| 184014 | 184253 | fts5yyStackEntry fts5yystack[fts5YYSTACKDEPTH]; /* The parser's stack */ |
| 184254 | + fts5yyStackEntry *fts5yystackEnd; /* Last entry in the stack */ |
| 184015 | 184255 | #endif |
| 184016 | 184256 | }; |
| 184017 | 184257 | typedef struct fts5yyParser fts5yyParser; |
| 184018 | 184258 | |
| 184019 | 184259 | #ifndef NDEBUG |
| | @@ -184159,10 +184399,11 @@ |
| 184159 | 184399 | pParser->fts5yyerrcnt = -1; |
| 184160 | 184400 | #endif |
| 184161 | 184401 | pParser->fts5yytos = pParser->fts5yystack; |
| 184162 | 184402 | pParser->fts5yystack[0].stateno = 0; |
| 184163 | 184403 | pParser->fts5yystack[0].major = 0; |
| 184404 | + pParser->fts5yystackEnd = &pParser->fts5yystack[fts5YYSTACKDEPTH-1]; |
| 184164 | 184405 | } |
| 184165 | 184406 | |
| 184166 | 184407 | #ifndef sqlite3Fts5Parser_ENGINEALWAYSONSTACK |
| 184167 | 184408 | /* |
| 184168 | 184409 | ** This function allocates a new parser. |
| | @@ -184457,11 +184698,11 @@ |
| 184457 | 184698 | fts5yypParser->fts5yyhwm++; |
| 184458 | 184699 | assert( fts5yypParser->fts5yyhwm == (int)(fts5yypParser->fts5yytos - fts5yypParser->fts5yystack) ); |
| 184459 | 184700 | } |
| 184460 | 184701 | #endif |
| 184461 | 184702 | #if fts5YYSTACKDEPTH>0 |
| 184462 | | - if( fts5yypParser->fts5yytos>=&fts5yypParser->fts5yystack[fts5YYSTACKDEPTH] ){ |
| 184703 | + if( fts5yypParser->fts5yytos>fts5yypParser->fts5yystackEnd ){ |
| 184463 | 184704 | fts5yypParser->fts5yytos--; |
| 184464 | 184705 | fts5yyStackOverflow(fts5yypParser); |
| 184465 | 184706 | return; |
| 184466 | 184707 | } |
| 184467 | 184708 | #else |
| | @@ -184485,39 +184726,39 @@ |
| 184485 | 184726 | |
| 184486 | 184727 | /* The following table contains information about every rule that |
| 184487 | 184728 | ** is used during the reduce. |
| 184488 | 184729 | */ |
| 184489 | 184730 | static const struct { |
| 184490 | | - fts5YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ |
| 184491 | | - unsigned char nrhs; /* Number of right-hand side symbols in the rule */ |
| 184731 | + fts5YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ |
| 184732 | + signed char nrhs; /* Negative of the number of RHS symbols in the rule */ |
| 184492 | 184733 | } fts5yyRuleInfo[] = { |
| 184493 | | - { 16, 1 }, |
| 184494 | | - { 20, 4 }, |
| 184495 | | - { 20, 3 }, |
| 184496 | | - { 20, 1 }, |
| 184497 | | - { 20, 2 }, |
| 184498 | | - { 21, 2 }, |
| 184499 | | - { 21, 1 }, |
| 184500 | | - { 17, 3 }, |
| 184501 | | - { 17, 3 }, |
| 184502 | | - { 17, 3 }, |
| 184503 | | - { 17, 5 }, |
| 184504 | | - { 17, 3 }, |
| 184505 | | - { 17, 1 }, |
| 184506 | | - { 19, 1 }, |
| 184507 | | - { 19, 2 }, |
| 184508 | | - { 18, 1 }, |
| 184509 | | - { 18, 3 }, |
| 184510 | | - { 22, 1 }, |
| 184511 | | - { 22, 5 }, |
| 184512 | | - { 23, 1 }, |
| 184513 | | - { 23, 2 }, |
| 184734 | + { 16, -1 }, |
| 184735 | + { 20, -4 }, |
| 184736 | + { 20, -3 }, |
| 184737 | + { 20, -1 }, |
| 184738 | + { 20, -2 }, |
| 184739 | + { 21, -2 }, |
| 184740 | + { 21, -1 }, |
| 184741 | + { 17, -3 }, |
| 184742 | + { 17, -3 }, |
| 184743 | + { 17, -3 }, |
| 184744 | + { 17, -5 }, |
| 184745 | + { 17, -3 }, |
| 184746 | + { 17, -1 }, |
| 184747 | + { 19, -1 }, |
| 184748 | + { 19, -2 }, |
| 184749 | + { 18, -1 }, |
| 184750 | + { 18, -3 }, |
| 184751 | + { 22, -1 }, |
| 184752 | + { 22, -5 }, |
| 184753 | + { 23, -1 }, |
| 184754 | + { 23, -2 }, |
| 184514 | 184755 | { 25, 0 }, |
| 184515 | | - { 25, 2 }, |
| 184516 | | - { 24, 4 }, |
| 184517 | | - { 24, 2 }, |
| 184518 | | - { 26, 1 }, |
| 184756 | + { 25, -2 }, |
| 184757 | + { 24, -4 }, |
| 184758 | + { 24, -2 }, |
| 184759 | + { 26, -1 }, |
| 184519 | 184760 | { 26, 0 }, |
| 184520 | 184761 | }; |
| 184521 | 184762 | |
| 184522 | 184763 | static void fts5yy_accept(fts5yyParser*); /* Forward Declaration */ |
| 184523 | 184764 | |
| | @@ -184537,11 +184778,11 @@ |
| 184537 | 184778 | fts5yymsp = fts5yypParser->fts5yytos; |
| 184538 | 184779 | #ifndef NDEBUG |
| 184539 | 184780 | if( fts5yyTraceFILE && fts5yyruleno<(int)(sizeof(fts5yyRuleName)/sizeof(fts5yyRuleName[0])) ){ |
| 184540 | 184781 | fts5yysize = fts5yyRuleInfo[fts5yyruleno].nrhs; |
| 184541 | 184782 | fprintf(fts5yyTraceFILE, "%sReduce [%s], go to state %d.\n", fts5yyTracePrompt, |
| 184542 | | - fts5yyRuleName[fts5yyruleno], fts5yymsp[-fts5yysize].stateno); |
| 184783 | + fts5yyRuleName[fts5yyruleno], fts5yymsp[fts5yysize].stateno); |
| 184543 | 184784 | } |
| 184544 | 184785 | #endif /* NDEBUG */ |
| 184545 | 184786 | |
| 184546 | 184787 | /* Check that the stack is large enough to grow by a single entry |
| 184547 | 184788 | ** if the RHS of the rule is empty. This ensures that there is room |
| | @@ -184552,11 +184793,11 @@ |
| 184552 | 184793 | fts5yypParser->fts5yyhwm++; |
| 184553 | 184794 | assert( fts5yypParser->fts5yyhwm == (int)(fts5yypParser->fts5yytos - fts5yypParser->fts5yystack)); |
| 184554 | 184795 | } |
| 184555 | 184796 | #endif |
| 184556 | 184797 | #if fts5YYSTACKDEPTH>0 |
| 184557 | | - if( fts5yypParser->fts5yytos>=&fts5yypParser->fts5yystack[fts5YYSTACKDEPTH-1] ){ |
| 184798 | + if( fts5yypParser->fts5yytos>=fts5yypParser->fts5yystackEnd ){ |
| 184558 | 184799 | fts5yyStackOverflow(fts5yypParser); |
| 184559 | 184800 | return; |
| 184560 | 184801 | } |
| 184561 | 184802 | #else |
| 184562 | 184803 | if( fts5yypParser->fts5yytos>=&fts5yypParser->fts5yystack[fts5yypParser->fts5yystksz-1] ){ |
| | @@ -184719,24 +184960,28 @@ |
| 184719 | 184960 | /********** End reduce actions ************************************************/ |
| 184720 | 184961 | }; |
| 184721 | 184962 | assert( fts5yyruleno<sizeof(fts5yyRuleInfo)/sizeof(fts5yyRuleInfo[0]) ); |
| 184722 | 184963 | fts5yygoto = fts5yyRuleInfo[fts5yyruleno].lhs; |
| 184723 | 184964 | fts5yysize = fts5yyRuleInfo[fts5yyruleno].nrhs; |
| 184724 | | - fts5yyact = fts5yy_find_reduce_action(fts5yymsp[-fts5yysize].stateno,(fts5YYCODETYPE)fts5yygoto); |
| 184725 | | - if( fts5yyact <= fts5YY_MAX_SHIFTREDUCE ){ |
| 184726 | | - if( fts5yyact>fts5YY_MAX_SHIFT ){ |
| 184727 | | - fts5yyact += fts5YY_MIN_REDUCE - fts5YY_MIN_SHIFTREDUCE; |
| 184728 | | - } |
| 184729 | | - fts5yymsp -= fts5yysize-1; |
| 184965 | + fts5yyact = fts5yy_find_reduce_action(fts5yymsp[fts5yysize].stateno,(fts5YYCODETYPE)fts5yygoto); |
| 184966 | + |
| 184967 | + /* There are no SHIFTREDUCE actions on nonterminals because the table |
| 184968 | + ** generator has simplified them to pure REDUCE actions. */ |
| 184969 | + assert( !(fts5yyact>fts5YY_MAX_SHIFT && fts5yyact<=fts5YY_MAX_SHIFTREDUCE) ); |
| 184970 | + |
| 184971 | + /* It is not possible for a REDUCE to be followed by an error */ |
| 184972 | + assert( fts5yyact!=fts5YY_ERROR_ACTION ); |
| 184973 | + |
| 184974 | + if( fts5yyact==fts5YY_ACCEPT_ACTION ){ |
| 184975 | + fts5yypParser->fts5yytos += fts5yysize; |
| 184976 | + fts5yy_accept(fts5yypParser); |
| 184977 | + }else{ |
| 184978 | + fts5yymsp += fts5yysize+1; |
| 184730 | 184979 | fts5yypParser->fts5yytos = fts5yymsp; |
| 184731 | 184980 | fts5yymsp->stateno = (fts5YYACTIONTYPE)fts5yyact; |
| 184732 | 184981 | fts5yymsp->major = (fts5YYCODETYPE)fts5yygoto; |
| 184733 | 184982 | fts5yyTraceShift(fts5yypParser, fts5yyact); |
| 184734 | | - }else{ |
| 184735 | | - assert( fts5yyact == fts5YY_ACCEPT_ACTION ); |
| 184736 | | - fts5yypParser->fts5yytos -= fts5yysize; |
| 184737 | | - fts5yy_accept(fts5yypParser); |
| 184738 | 184983 | } |
| 184739 | 184984 | } |
| 184740 | 184985 | |
| 184741 | 184986 | /* |
| 184742 | 184987 | ** The following code executes when the parse fails |
| | @@ -191124,11 +191369,12 @@ |
| 191124 | 191369 | sqlite3_stmt **ppStmt, |
| 191125 | 191370 | char *zSql |
| 191126 | 191371 | ){ |
| 191127 | 191372 | if( p->rc==SQLITE_OK ){ |
| 191128 | 191373 | if( zSql ){ |
| 191129 | | - p->rc = sqlite3_prepare_v2(p->pConfig->db, zSql, -1, ppStmt, 0); |
| 191374 | + p->rc = sqlite3_prepare_v3(p->pConfig->db, zSql, -1, |
| 191375 | + SQLITE_PREPARE_PERSISTENT, ppStmt, 0); |
| 191130 | 191376 | }else{ |
| 191131 | 191377 | p->rc = SQLITE_NOMEM; |
| 191132 | 191378 | } |
| 191133 | 191379 | } |
| 191134 | 191380 | sqlite3_free(zSql); |
| | @@ -191173,11 +191419,12 @@ |
| 191173 | 191419 | pConfig->zDb, pConfig->zName |
| 191174 | 191420 | ); |
| 191175 | 191421 | if( zSql==0 ){ |
| 191176 | 191422 | rc = SQLITE_NOMEM; |
| 191177 | 191423 | }else{ |
| 191178 | | - rc = sqlite3_prepare_v2(pConfig->db, zSql, -1, &p->pDeleter, 0); |
| 191424 | + rc = sqlite3_prepare_v3(pConfig->db, zSql, -1, |
| 191425 | + SQLITE_PREPARE_PERSISTENT, &p->pDeleter, 0); |
| 191179 | 191426 | sqlite3_free(zSql); |
| 191180 | 191427 | } |
| 191181 | 191428 | if( rc!=SQLITE_OK ){ |
| 191182 | 191429 | p->rc = rc; |
| 191183 | 191430 | return; |
| | @@ -197772,11 +198019,12 @@ |
| 197772 | 198019 | va_start(ap, zFmt); |
| 197773 | 198020 | zSql = sqlite3_vmprintf(zFmt, ap); |
| 197774 | 198021 | if( zSql==0 ){ |
| 197775 | 198022 | rc = SQLITE_NOMEM; |
| 197776 | 198023 | }else{ |
| 197777 | | - rc = sqlite3_prepare_v2(pConfig->db, zSql, -1, &pRet, 0); |
| 198024 | + rc = sqlite3_prepare_v3(pConfig->db, zSql, -1, |
| 198025 | + SQLITE_PREPARE_PERSISTENT, &pRet, 0); |
| 197778 | 198026 | if( rc!=SQLITE_OK ){ |
| 197779 | 198027 | *pConfig->pzErrmsg = sqlite3_mprintf("%s", sqlite3_errmsg(pConfig->db)); |
| 197780 | 198028 | } |
| 197781 | 198029 | sqlite3_free(zSql); |
| 197782 | 198030 | } |
| | @@ -197908,11 +198156,12 @@ |
| 197908 | 198156 | |
| 197909 | 198157 | if( zRankArgs ){ |
| 197910 | 198158 | char *zSql = sqlite3Fts5Mprintf(&rc, "SELECT %s", zRankArgs); |
| 197911 | 198159 | if( zSql ){ |
| 197912 | 198160 | sqlite3_stmt *pStmt = 0; |
| 197913 | | - rc = sqlite3_prepare_v2(pConfig->db, zSql, -1, &pStmt, 0); |
| 198161 | + rc = sqlite3_prepare_v3(pConfig->db, zSql, -1, |
| 198162 | + SQLITE_PREPARE_PERSISTENT, &pStmt, 0); |
| 197914 | 198163 | sqlite3_free(zSql); |
| 197915 | 198164 | assert( rc==SQLITE_OK || pCsr->pRankArgStmt==0 ); |
| 197916 | 198165 | if( rc==SQLITE_OK ){ |
| 197917 | 198166 | if( SQLITE_ROW==sqlite3_step(pStmt) ){ |
| 197918 | 198167 | int nByte; |
| | @@ -199517,11 +199766,11 @@ |
| 199517 | 199766 | int nArg, /* Number of args */ |
| 199518 | 199767 | sqlite3_value **apUnused /* Function arguments */ |
| 199519 | 199768 | ){ |
| 199520 | 199769 | assert( nArg==0 ); |
| 199521 | 199770 | UNUSED_PARAM2(nArg, apUnused); |
| 199522 | | - sqlite3_result_text(pCtx, "fts5: 2017-06-24 13:31:40 0583b84ab444db3ae3c93db619b67bf84b0305ab989200e77214e02ff2dc923a", -1, SQLITE_TRANSIENT); |
| 199771 | + sqlite3_result_text(pCtx, "fts5: 2017-06-29 17:27:04 284707a7b3514a55cce24292e45632b7033d6edcff5b27deac5118b27c7b2954", -1, SQLITE_TRANSIENT); |
| 199523 | 199772 | } |
| 199524 | 199773 | |
| 199525 | 199774 | static int fts5Init(sqlite3 *db){ |
| 199526 | 199775 | static const sqlite3_module fts5Mod = { |
| 199527 | 199776 | /* iVersion */ 2, |
| | @@ -199771,11 +200020,12 @@ |
| 199771 | 200020 | } |
| 199772 | 200021 | |
| 199773 | 200022 | if( zSql==0 ){ |
| 199774 | 200023 | rc = SQLITE_NOMEM; |
| 199775 | 200024 | }else{ |
| 199776 | | - rc = sqlite3_prepare_v2(pC->db, zSql, -1, &p->aStmt[eStmt], 0); |
| 200025 | + rc = sqlite3_prepare_v3(pC->db, zSql, -1, |
| 200026 | + SQLITE_PREPARE_PERSISTENT, &p->aStmt[eStmt], 0); |
| 199777 | 200027 | sqlite3_free(zSql); |
| 199778 | 200028 | if( rc!=SQLITE_OK && pzErrMsg ){ |
| 199779 | 200029 | *pzErrMsg = sqlite3_mprintf("%s", sqlite3_errmsg(pC->db)); |
| 199780 | 200030 | } |
| 199781 | 200031 | } |
| | @@ -203371,5 +203621,325 @@ |
| 203371 | 203621 | |
| 203372 | 203622 | |
| 203373 | 203623 | #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS5) */ |
| 203374 | 203624 | |
| 203375 | 203625 | /************** End of fts5.c ************************************************/ |
| 203626 | +/************** Begin file stmt.c ********************************************/ |
| 203627 | +/* |
| 203628 | +** 2017-05-31 |
| 203629 | +** |
| 203630 | +** The author disclaims copyright to this source code. In place of |
| 203631 | +** a legal notice, here is a blessing: |
| 203632 | +** |
| 203633 | +** May you do good and not evil. |
| 203634 | +** May you find forgiveness for yourself and forgive others. |
| 203635 | +** May you share freely, never taking more than you give. |
| 203636 | +** |
| 203637 | +************************************************************************* |
| 203638 | +** |
| 203639 | +** This file demonstrates an eponymous virtual table that returns information |
| 203640 | +** about all prepared statements for the database connection. |
| 203641 | +** |
| 203642 | +** Usage example: |
| 203643 | +** |
| 203644 | +** .load ./stmt |
| 203645 | +** .mode line |
| 203646 | +** .header on |
| 203647 | +** SELECT * FROM stmt; |
| 203648 | +*/ |
| 203649 | +#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) |
| 203650 | +#if !defined(SQLITEINT_H) |
| 203651 | +/* #include "sqlite3ext.h" */ |
| 203652 | +#endif |
| 203653 | +SQLITE_EXTENSION_INIT1 |
| 203654 | +/* #include <assert.h> */ |
| 203655 | +/* #include <string.h> */ |
| 203656 | + |
| 203657 | +#ifndef SQLITE_OMIT_VIRTUALTABLE |
| 203658 | + |
| 203659 | +/* |
| 203660 | +** The following macros are used to cast pointers to integers. |
| 203661 | +** The way you do this varies from one compiler |
| 203662 | +** to the next, so we have developed the following set of #if statements |
| 203663 | +** to generate appropriate macros for a wide range of compilers. |
| 203664 | +*/ |
| 203665 | +#if defined(__PTRDIFF_TYPE__) /* This case should work for GCC */ |
| 203666 | +# define SQLITE_PTR_TO_INT64(X) ((sqlite3_int64)(__PTRDIFF_TYPE__)(X)) |
| 203667 | +#elif !defined(__GNUC__) /* Works for compilers other than LLVM */ |
| 203668 | +# define SQLITE_PTR_TO_INT64(X) ((sqlite3_int64)(((char*)X)-(char*)0)) |
| 203669 | +#elif defined(HAVE_STDINT_H) /* Use this case if we have ANSI headers */ |
| 203670 | +# define SQLITE_PTR_TO_INT64(X) ((sqlite3_int64)(intptr_t)(X)) |
| 203671 | +#else /* Generates a warning - but it always works */ |
| 203672 | +# define SQLITE_PTR_TO_INT64(X) ((sqlite3_int64)(X)) |
| 203673 | +#endif |
| 203674 | + |
| 203675 | + |
| 203676 | +/* stmt_vtab is a subclass of sqlite3_vtab which will |
| 203677 | +** serve as the underlying representation of a stmt virtual table |
| 203678 | +*/ |
| 203679 | +typedef struct stmt_vtab stmt_vtab; |
| 203680 | +struct stmt_vtab { |
| 203681 | + sqlite3_vtab base; /* Base class - must be first */ |
| 203682 | + sqlite3 *db; /* Database connection for this stmt vtab */ |
| 203683 | +}; |
| 203684 | + |
| 203685 | +/* stmt_cursor is a subclass of sqlite3_vtab_cursor which will |
| 203686 | +** serve as the underlying representation of a cursor that scans |
| 203687 | +** over rows of the result |
| 203688 | +*/ |
| 203689 | +typedef struct stmt_cursor stmt_cursor; |
| 203690 | +struct stmt_cursor { |
| 203691 | + sqlite3_vtab_cursor base; /* Base class - must be first */ |
| 203692 | + sqlite3 *db; /* Database connection for this cursor */ |
| 203693 | + sqlite3_stmt *pStmt; /* Statement cursor is currently pointing at */ |
| 203694 | + sqlite3_int64 iRowid; /* The rowid */ |
| 203695 | +}; |
| 203696 | + |
| 203697 | +/* |
| 203698 | +** The stmtConnect() method is invoked to create a new |
| 203699 | +** stmt_vtab that describes the generate_stmt virtual table. |
| 203700 | +** |
| 203701 | +** Think of this routine as the constructor for stmt_vtab objects. |
| 203702 | +** |
| 203703 | +** All this routine needs to do is: |
| 203704 | +** |
| 203705 | +** (1) Allocate the stmt_vtab object and initialize all fields. |
| 203706 | +** |
| 203707 | +** (2) Tell SQLite (via the sqlite3_declare_vtab() interface) what the |
| 203708 | +** result set of queries against generate_stmt will look like. |
| 203709 | +*/ |
| 203710 | +static int stmtConnect( |
| 203711 | + sqlite3 *db, |
| 203712 | + void *pAux, |
| 203713 | + int argc, const char *const*argv, |
| 203714 | + sqlite3_vtab **ppVtab, |
| 203715 | + char **pzErr |
| 203716 | +){ |
| 203717 | + stmt_vtab *pNew; |
| 203718 | + int rc; |
| 203719 | + |
| 203720 | +/* Column numbers */ |
| 203721 | +#define STMT_COLUMN_PTR 0 /* Numeric value of the statement pointer */ |
| 203722 | +#define STMT_COLUMN_SQL 1 /* SQL for the statement */ |
| 203723 | +#define STMT_COLUMN_NCOL 2 /* Number of result columns */ |
| 203724 | +#define STMT_COLUMN_RO 3 /* True if read-only */ |
| 203725 | +#define STMT_COLUMN_BUSY 4 /* True if currently busy */ |
| 203726 | +#define STMT_COLUMN_NSCAN 5 /* SQLITE_STMTSTATUS_FULLSCAN_STEP */ |
| 203727 | +#define STMT_COLUMN_NSORT 6 /* SQLITE_STMTSTATUS_SORT */ |
| 203728 | +#define STMT_COLUMN_NAIDX 7 /* SQLITE_STMTSTATUS_AUTOINDEX */ |
| 203729 | +#define STMT_COLUMN_NSTEP 8 /* SQLITE_STMTSTATUS_VM_STEP */ |
| 203730 | +#define STMT_COLUMN_REPREP 9 /* SQLITE_STMTSTATUS_REPREPARE */ |
| 203731 | +#define STMT_COLUMN_RUN 10 /* SQLITE_STMTSTATUS_RUN */ |
| 203732 | +#define STMT_COLUMN_MEM 11 /* SQLITE_STMTSTATUS_MEMUSED */ |
| 203733 | + |
| 203734 | + |
| 203735 | + rc = sqlite3_declare_vtab(db, |
| 203736 | + "CREATE TABLE x(ptr,sql,ncol,ro,busy,nscan,nsort,naidx,nstep," |
| 203737 | + "reprep,run,mem)"); |
| 203738 | + if( rc==SQLITE_OK ){ |
| 203739 | + pNew = sqlite3_malloc( sizeof(*pNew) ); |
| 203740 | + *ppVtab = (sqlite3_vtab*)pNew; |
| 203741 | + if( pNew==0 ) return SQLITE_NOMEM; |
| 203742 | + memset(pNew, 0, sizeof(*pNew)); |
| 203743 | + pNew->db = db; |
| 203744 | + } |
| 203745 | + return rc; |
| 203746 | +} |
| 203747 | + |
| 203748 | +/* |
| 203749 | +** This method is the destructor for stmt_cursor objects. |
| 203750 | +*/ |
| 203751 | +static int stmtDisconnect(sqlite3_vtab *pVtab){ |
| 203752 | + sqlite3_free(pVtab); |
| 203753 | + return SQLITE_OK; |
| 203754 | +} |
| 203755 | + |
| 203756 | +/* |
| 203757 | +** Constructor for a new stmt_cursor object. |
| 203758 | +*/ |
| 203759 | +static int stmtOpen(sqlite3_vtab *p, sqlite3_vtab_cursor **ppCursor){ |
| 203760 | + stmt_cursor *pCur; |
| 203761 | + pCur = sqlite3_malloc( sizeof(*pCur) ); |
| 203762 | + if( pCur==0 ) return SQLITE_NOMEM; |
| 203763 | + memset(pCur, 0, sizeof(*pCur)); |
| 203764 | + pCur->db = ((stmt_vtab*)p)->db; |
| 203765 | + *ppCursor = &pCur->base; |
| 203766 | + return SQLITE_OK; |
| 203767 | +} |
| 203768 | + |
| 203769 | +/* |
| 203770 | +** Destructor for a stmt_cursor. |
| 203771 | +*/ |
| 203772 | +static int stmtClose(sqlite3_vtab_cursor *cur){ |
| 203773 | + sqlite3_free(cur); |
| 203774 | + return SQLITE_OK; |
| 203775 | +} |
| 203776 | + |
| 203777 | + |
| 203778 | +/* |
| 203779 | +** Advance a stmt_cursor to its next row of output. |
| 203780 | +*/ |
| 203781 | +static int stmtNext(sqlite3_vtab_cursor *cur){ |
| 203782 | + stmt_cursor *pCur = (stmt_cursor*)cur; |
| 203783 | + pCur->iRowid++; |
| 203784 | + pCur->pStmt = sqlite3_next_stmt(pCur->db, pCur->pStmt); |
| 203785 | + return SQLITE_OK; |
| 203786 | +} |
| 203787 | + |
| 203788 | +/* |
| 203789 | +** Return values of columns for the row at which the stmt_cursor |
| 203790 | +** is currently pointing. |
| 203791 | +*/ |
| 203792 | +static int stmtColumn( |
| 203793 | + sqlite3_vtab_cursor *cur, /* The cursor */ |
| 203794 | + sqlite3_context *ctx, /* First argument to sqlite3_result_...() */ |
| 203795 | + int i /* Which column to return */ |
| 203796 | +){ |
| 203797 | + stmt_cursor *pCur = (stmt_cursor*)cur; |
| 203798 | + switch( i ){ |
| 203799 | + case STMT_COLUMN_PTR: { |
| 203800 | + sqlite3_result_int64(ctx, SQLITE_PTR_TO_INT64(pCur->pStmt)); |
| 203801 | + break; |
| 203802 | + } |
| 203803 | + case STMT_COLUMN_SQL: { |
| 203804 | + sqlite3_result_text(ctx, sqlite3_sql(pCur->pStmt), -1, SQLITE_TRANSIENT); |
| 203805 | + break; |
| 203806 | + } |
| 203807 | + case STMT_COLUMN_NCOL: { |
| 203808 | + sqlite3_result_int(ctx, sqlite3_column_count(pCur->pStmt)); |
| 203809 | + break; |
| 203810 | + } |
| 203811 | + case STMT_COLUMN_RO: { |
| 203812 | + sqlite3_result_int(ctx, sqlite3_stmt_readonly(pCur->pStmt)); |
| 203813 | + break; |
| 203814 | + } |
| 203815 | + case STMT_COLUMN_BUSY: { |
| 203816 | + sqlite3_result_int(ctx, sqlite3_stmt_busy(pCur->pStmt)); |
| 203817 | + break; |
| 203818 | + } |
| 203819 | + case STMT_COLUMN_MEM: { |
| 203820 | + i = SQLITE_STMTSTATUS_MEMUSED + |
| 203821 | + STMT_COLUMN_NSCAN - SQLITE_STMTSTATUS_FULLSCAN_STEP; |
| 203822 | + /* Fall thru */ |
| 203823 | + } |
| 203824 | + case STMT_COLUMN_NSCAN: |
| 203825 | + case STMT_COLUMN_NSORT: |
| 203826 | + case STMT_COLUMN_NAIDX: |
| 203827 | + case STMT_COLUMN_NSTEP: |
| 203828 | + case STMT_COLUMN_REPREP: |
| 203829 | + case STMT_COLUMN_RUN: { |
| 203830 | + sqlite3_result_int(ctx, sqlite3_stmt_status(pCur->pStmt, |
| 203831 | + i-STMT_COLUMN_NSCAN+SQLITE_STMTSTATUS_FULLSCAN_STEP, 0)); |
| 203832 | + break; |
| 203833 | + } |
| 203834 | + } |
| 203835 | + return SQLITE_OK; |
| 203836 | +} |
| 203837 | + |
| 203838 | +/* |
| 203839 | +** Return the rowid for the current row. In this implementation, the |
| 203840 | +** rowid is the same as the output value. |
| 203841 | +*/ |
| 203842 | +static int stmtRowid(sqlite3_vtab_cursor *cur, sqlite_int64 *pRowid){ |
| 203843 | + stmt_cursor *pCur = (stmt_cursor*)cur; |
| 203844 | + *pRowid = pCur->iRowid; |
| 203845 | + return SQLITE_OK; |
| 203846 | +} |
| 203847 | + |
| 203848 | +/* |
| 203849 | +** Return TRUE if the cursor has been moved off of the last |
| 203850 | +** row of output. |
| 203851 | +*/ |
| 203852 | +static int stmtEof(sqlite3_vtab_cursor *cur){ |
| 203853 | + stmt_cursor *pCur = (stmt_cursor*)cur; |
| 203854 | + return pCur->pStmt==0; |
| 203855 | +} |
| 203856 | + |
| 203857 | +/* |
| 203858 | +** This method is called to "rewind" the stmt_cursor object back |
| 203859 | +** to the first row of output. This method is always called at least |
| 203860 | +** once prior to any call to stmtColumn() or stmtRowid() or |
| 203861 | +** stmtEof(). |
| 203862 | +*/ |
| 203863 | +static int stmtFilter( |
| 203864 | + sqlite3_vtab_cursor *pVtabCursor, |
| 203865 | + int idxNum, const char *idxStr, |
| 203866 | + int argc, sqlite3_value **argv |
| 203867 | +){ |
| 203868 | + stmt_cursor *pCur = (stmt_cursor *)pVtabCursor; |
| 203869 | + pCur->pStmt = 0; |
| 203870 | + pCur->iRowid = 0; |
| 203871 | + return stmtNext(pVtabCursor); |
| 203872 | +} |
| 203873 | + |
| 203874 | +/* |
| 203875 | +** SQLite will invoke this method one or more times while planning a query |
| 203876 | +** that uses the generate_stmt virtual table. This routine needs to create |
| 203877 | +** a query plan for each invocation and compute an estimated cost for that |
| 203878 | +** plan. |
| 203879 | +*/ |
| 203880 | +static int stmtBestIndex( |
| 203881 | + sqlite3_vtab *tab, |
| 203882 | + sqlite3_index_info *pIdxInfo |
| 203883 | +){ |
| 203884 | + pIdxInfo->estimatedCost = (double)500; |
| 203885 | + pIdxInfo->estimatedRows = 500; |
| 203886 | + return SQLITE_OK; |
| 203887 | +} |
| 203888 | + |
| 203889 | +/* |
| 203890 | +** This following structure defines all the methods for the |
| 203891 | +** generate_stmt virtual table. |
| 203892 | +*/ |
| 203893 | +static sqlite3_module stmtModule = { |
| 203894 | + 0, /* iVersion */ |
| 203895 | + 0, /* xCreate */ |
| 203896 | + stmtConnect, /* xConnect */ |
| 203897 | + stmtBestIndex, /* xBestIndex */ |
| 203898 | + stmtDisconnect, /* xDisconnect */ |
| 203899 | + 0, /* xDestroy */ |
| 203900 | + stmtOpen, /* xOpen - open a cursor */ |
| 203901 | + stmtClose, /* xClose - close a cursor */ |
| 203902 | + stmtFilter, /* xFilter - configure scan constraints */ |
| 203903 | + stmtNext, /* xNext - advance a cursor */ |
| 203904 | + stmtEof, /* xEof - check for end of scan */ |
| 203905 | + stmtColumn, /* xColumn - read data */ |
| 203906 | + stmtRowid, /* xRowid - read data */ |
| 203907 | + 0, /* xUpdate */ |
| 203908 | + 0, /* xBegin */ |
| 203909 | + 0, /* xSync */ |
| 203910 | + 0, /* xCommit */ |
| 203911 | + 0, /* xRollback */ |
| 203912 | + 0, /* xFindMethod */ |
| 203913 | + 0, /* xRename */ |
| 203914 | +}; |
| 203915 | + |
| 203916 | +#endif /* SQLITE_OMIT_VIRTUALTABLE */ |
| 203917 | + |
| 203918 | +SQLITE_PRIVATE int sqlite3StmtVtabInit(sqlite3 *db){ |
| 203919 | + int rc = SQLITE_OK; |
| 203920 | +#ifndef SQLITE_OMIT_VIRTUALTABLE |
| 203921 | + rc = sqlite3_create_module(db, "stmt", &stmtModule, 0); |
| 203922 | +#endif |
| 203923 | + return rc; |
| 203924 | +} |
| 203925 | + |
| 203926 | +#ifndef SQLITE_CORE |
| 203927 | +#ifdef _WIN32 |
| 203928 | +__declspec(dllexport) |
| 203929 | +#endif |
| 203930 | +SQLITE_API int sqlite3_stmt_init( |
| 203931 | + sqlite3 *db, |
| 203932 | + char **pzErrMsg, |
| 203933 | + const sqlite3_api_routines *pApi |
| 203934 | +){ |
| 203935 | + int rc = SQLITE_OK; |
| 203936 | + SQLITE_EXTENSION_INIT2(pApi); |
| 203937 | +#ifndef SQLITE_OMIT_VIRTUALTABLE |
| 203938 | + rc = sqlite3StmtVtabInit(db); |
| 203939 | +#endif |
| 203940 | + return rc; |
| 203941 | +} |
| 203942 | +#endif /* SQLITE_CORE */ |
| 203943 | +#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */ |
| 203944 | + |
| 203945 | +/************** End of stmt.c ************************************************/ |
| 203376 | 203946 | |