diff --git a/Makefile b/Makefile
index 4e501ab2e..bd5886be4 100644
--- a/Makefile
+++ b/Makefile
@@ -15,7 +15,7 @@ INCLUDE = -I$(PROJECT) -I$(PROJECT)/mbedtls/include
CXXFLAGS = -g -std=c++20 -fPIC -DSQLITE_ENABLE_NORMALIZE $(BEDROCK_OPTIM_COMPILE_FLAG) -Wall -Werror -Wformat-security -Wno-unqualified-std-cast-call -Wno-error=deprecated-declarations $(INCLUDE)
# Amalgamation flags
-AMALGAMATION_FLAGS = -Wno-unused-but-set-variable -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT -DSQLITE_ENABLE_NOOP_UPDATE -DSQLITE_MUTEX_ALERT_MILLISECONDS=20 -DHAVE_USLEEP=1 -DSQLITE_MAX_MMAP_SIZE=17592186044416ull -DSQLITE_SHARED_MAPPING -DSQLITE_ENABLE_NORMALIZE -DSQLITE_MAX_PAGE_COUNT=4294967294 -DSQLITE_DISABLE_PAGECACHE_OVERFLOW_STATS -DSQLITE_DEFAULT_CACHE_SIZE=-51200 -DSQLITE_MAX_FUNCTION_ARG=32767 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=0 -DSQLITE_ENABLE_WAL_BIGHASH -DSQLITE_ENABLE_WAL2NOCKSUM
+AMALGAMATION_FLAGS = -Wno-unused-but-set-variable -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT -DSQLITE_ENABLE_NOOP_UPDATE -DSQLITE_MUTEX_ALERT_MILLISECONDS=20 -DHAVE_USLEEP=1 -DSQLITE_MAX_MMAP_SIZE=17592186044416ull -DSQLITE_SHARED_MAPPING -DSQLITE_ENABLE_NORMALIZE -DSQLITE_MAX_PAGE_COUNT=4294967294 -DSQLITE_DISABLE_PAGECACHE_OVERFLOW_STATS -DSQLITE_DEFAULT_CACHE_SIZE=-51200 -DSQLITE_MAX_FUNCTION_ARG=32767 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=0 -DSQLITE_WAL_BIGHASH
# All our intermediate, dependency, object, etc files get hidden in here.
INTERMEDIATEDIR = .build
diff --git a/libstuff/sqlite3.c b/libstuff/sqlite3.c
index 992198da4..bf0c778a0 100644
--- a/libstuff/sqlite3.c
+++ b/libstuff/sqlite3.c
@@ -1,6 +1,6 @@
/******************************************************************************
** This file is an amalgamation of many separate C source files from SQLite
-** version 3.49.0. By combining all the individual C code files into this
+** version 3.47.0. By combining all the individual C code files into this
** single large file, the entire code can be compiled as a single translation
** unit. This allows many compilers to do optimizations that would not be
** possible if the files were compiled separately. Performance improvements
@@ -18,11 +18,8 @@
** separate file. This file contains only code for the core SQLite library.
**
** The content in this amalgamation comes from Fossil check-in
-** cc3ce784b0feea2f7e86960d262a04c555df with changes in files:
-**
-**
+** dc3a24a784c95398656e0d7885f7eb0ee626.
*/
-#ifndef SQLITE_AMALGAMATION
#define SQLITE_CORE 1
#define SQLITE_AMALGAMATION 1
#ifndef SQLITE_PRIVATE
@@ -466,9 +463,9 @@ extern "C" {
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
** [sqlite_version()] and [sqlite_source_id()].
*/
-#define SQLITE_VERSION "3.49.0"
-#define SQLITE_VERSION_NUMBER 3049000
-#define SQLITE_SOURCE_ID "2025-02-06 12:46:51 cc3ce784b0feea2f7e86960d262a04c555df817192695d5760c2a83fb804a212"
+#define SQLITE_VERSION "3.47.0"
+#define SQLITE_VERSION_NUMBER 3047000
+#define SQLITE_SOURCE_ID "2024-12-23 11:31:16 dc3a24a784c95398656e0d7885f7eb0ee626b86c896e759a6ac5c243fd6f0ab7"
/*
** CAPI3REF: Run-Time Library Version Numbers
@@ -972,13 +969,6 @@ SQLITE_API int sqlite3_exec(
** filesystem supports doing multiple write operations atomically when those
** write operations are bracketed by [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] and
** [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE].
-**
-** The SQLITE_IOCAP_SUBPAGE_READ property means that it is ok to read
-** from the database file in amounts that are not a multiple of the
-** page size and that do not begin at a page boundary. Without this
-** property, SQLite is careful to only do full-page reads and write
-** on aligned pages, with the one exception that it will do a sub-page
-** read of the first page to access the database header.
*/
#define SQLITE_IOCAP_ATOMIC 0x00000001
#define SQLITE_IOCAP_ATOMIC512 0x00000002
@@ -995,7 +985,6 @@ SQLITE_API int sqlite3_exec(
#define SQLITE_IOCAP_POWERSAFE_OVERWRITE 0x00001000
#define SQLITE_IOCAP_IMMUTABLE 0x00002000
#define SQLITE_IOCAP_BATCH_ATOMIC 0x00004000
-#define SQLITE_IOCAP_SUBPAGE_READ 0x00008000
/*
** CAPI3REF: File Locking Levels
@@ -1142,7 +1131,6 @@ struct sqlite3_file {
**
[SQLITE_IOCAP_POWERSAFE_OVERWRITE]
** [SQLITE_IOCAP_IMMUTABLE]
** [SQLITE_IOCAP_BATCH_ATOMIC]
-** [SQLITE_IOCAP_SUBPAGE_READ]
**
**
** The SQLITE_IOCAP_ATOMIC property means that all writes of
@@ -1420,11 +1408,6 @@ struct sqlite3_io_methods {
** pointed to by the pArg argument. This capability is used during testing
** and only needs to be supported when SQLITE_TEST is defined.
**
-** [[SQLITE_FCNTL_NULL_IO]]
-** The [SQLITE_FCNTL_NULL_IO] opcode sets the low-level file descriptor
-** or file handle for the [sqlite3_file] object such that it will no longer
-** read or write to the database file.
-**
** [[SQLITE_FCNTL_WAL_BLOCK]]
** The [SQLITE_FCNTL_WAL_BLOCK] is a signal to the VFS layer that it might
** be advantageous to block on the next WAL lock if the lock is not immediately
@@ -1578,7 +1561,6 @@ struct sqlite3_io_methods {
#define SQLITE_FCNTL_EXTERNAL_READER 40
#define SQLITE_FCNTL_CKSM_FILE 41
#define SQLITE_FCNTL_RESET_CACHE 42
-#define SQLITE_FCNTL_NULL_IO 43
/* deprecated names */
#define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE
@@ -2531,15 +2513,7 @@ struct sqlite3_mem_methods {
** CAPI3REF: Database Connection Configuration Options
**
** These constants are the available integer configuration options that
-** can be passed as the second parameter to the [sqlite3_db_config()] interface.
-**
-** The [sqlite3_db_config()] interface is a var-args functions. It takes a
-** variable number of parameters, though always at least two. The number of
-** parameters passed into sqlite3_db_config() depends on which of these
-** constants is given as the second parameter. This documentation page
-** refers to parameters beyond the second as "arguments". Thus, when this
-** page says "the N-th argument" it means "the N-th parameter past the
-** configuration option" or "the (N+2)-th parameter to sqlite3_db_config()".
+** can be passed as the second argument to the [sqlite3_db_config()] interface.
**
** New configuration options may be added in future releases of SQLite.
** Existing configuration options might be discontinued. Applications
@@ -2551,14 +2525,8 @@ struct sqlite3_mem_methods {
**
** [[SQLITE_DBCONFIG_LOOKASIDE]]
** - SQLITE_DBCONFIG_LOOKASIDE
-** - The SQLITE_DBCONFIG_LOOKASIDE option is used to adjust the
-** configuration of the lookaside memory allocator within a database
-** connection.
-** The arguments to the SQLITE_DBCONFIG_LOOKASIDE option are not
-** in the [DBCONFIG arguments|usual format].
-** The SQLITE_DBCONFIG_LOOKASIDE option takes three arguments, not two,
-** so that a call to [sqlite3_db_config()] that uses SQLITE_DBCONFIG_LOOKASIDE
-** should have a total of five parameters.
+**
- ^This option takes three additional arguments that determine the
+** [lookaside memory allocator] configuration for the [database connection].
** ^The first argument (the third parameter to [sqlite3_db_config()] is a
** pointer to a memory buffer to use for lookaside memory.
** ^The first argument after the SQLITE_DBCONFIG_LOOKASIDE verb
@@ -2581,8 +2549,7 @@ struct sqlite3_mem_methods {
** [[SQLITE_DBCONFIG_ENABLE_FKEY]]
**
- SQLITE_DBCONFIG_ENABLE_FKEY
** - ^This option is used to enable or disable the enforcement of
-** [foreign key constraints]. This is the same setting that is
-** enabled or disabled by the [PRAGMA foreign_keys] statement.
+** [foreign key constraints]. There should be two additional arguments.
** The first argument is an integer which is 0 to disable FK enforcement,
** positive to enable FK enforcement or negative to leave FK enforcement
** unchanged. The second parameter is a pointer to an integer into which
@@ -2604,13 +2571,13 @@ struct sqlite3_mem_methods {
**
Originally this option disabled all triggers. ^(However, since
** SQLite version 3.35.0, TEMP triggers are still allowed even if
** this option is off. So, in other words, this option now only disables
-** triggers in the main database schema or in the schemas of [ATTACH]-ed
+** triggers in the main database schema or in the schemas of ATTACH-ed
** databases.)^
**
** [[SQLITE_DBCONFIG_ENABLE_VIEW]]
** - SQLITE_DBCONFIG_ENABLE_VIEW
** - ^This option is used to enable or disable [CREATE VIEW | views].
-** There must be two additional arguments.
+** There should be two additional arguments.
** The first argument is an integer which is 0 to disable views,
** positive to enable views or negative to leave the setting unchanged.
** The second parameter is a pointer to an integer into which
@@ -2629,7 +2596,7 @@ struct sqlite3_mem_methods {
**
- ^This option is used to enable or disable the
** [fts3_tokenizer()] function which is part of the
** [FTS3] full-text search engine extension.
-** There must be two additional arguments.
+** There should be two additional arguments.
** The first argument is an integer which is 0 to disable fts3_tokenizer() or
** positive to enable fts3_tokenizer() or negative to leave the setting
** unchanged.
@@ -2644,7 +2611,7 @@ struct sqlite3_mem_methods {
** interface independently of the [load_extension()] SQL function.
** The [sqlite3_enable_load_extension()] API enables or disables both the
** C-API [sqlite3_load_extension()] and the SQL function [load_extension()].
-** There must be two additional arguments.
+** There should be two additional arguments.
** When the first argument to this interface is 1, then only the C-API is
** enabled and the SQL function remains disabled. If the first argument to
** this interface is 0, then both the C-API and the SQL function are disabled.
@@ -2658,30 +2625,23 @@ struct sqlite3_mem_methods {
**
** [[SQLITE_DBCONFIG_MAINDBNAME]]
- SQLITE_DBCONFIG_MAINDBNAME
** - ^This option is used to change the name of the "main" database
-** schema. This option does not follow the
-** [DBCONFIG arguments|usual SQLITE_DBCONFIG argument format].
-** This option takes exactly one additional argument so that the
-** [sqlite3_db_config()] call has a total of three parameters. The
-** extra argument must be a pointer to a constant UTF8 string which
-** will become the new schema name in place of "main". ^SQLite does
-** not make a copy of the new main schema name string, so the application
-** must ensure that the argument passed into SQLITE_DBCONFIG MAINDBNAME
-** is unchanged until after the database connection closes.
+** schema. ^The sole argument is a pointer to a constant UTF8 string
+** which will become the new schema name in place of "main". ^SQLite
+** does not make a copy of the new main schema name string, so the application
+** must ensure that the argument passed into this DBCONFIG option is unchanged
+** until after the database connection closes.
**
**
** [[SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE]]
** - SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE
-** - Usually, when a database in [WAL mode] is closed or detached from a
-** database handle, SQLite checks if if there are other connections to the
-** same database, and if there are no other database connection (if the
-** connection being closed is the last open connection to the database),
-** then SQLite performs a [checkpoint] before closing the connection and
-** deletes the WAL file. The SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE option can
-** be used to override that behavior. The first argument passed to this
-** operation (the third parameter to [sqlite3_db_config()]) is an integer
-** which is positive to disable checkpoints-on-close, or zero (the default)
-** to enable them, and negative to leave the setting unchanged.
-** The second argument (the fourth parameter) is a pointer to an integer
+**
- Usually, when a database in wal mode is closed or detached from a
+** database handle, SQLite checks if this will mean that there are now no
+** connections at all to the database. If so, it performs a checkpoint
+** operation before closing the connection. This option may be used to
+** override this behavior. The first parameter passed to this operation
+** is an integer - positive to disable checkpoints-on-close, or zero (the
+** default) to enable them, and negative to leave the setting unchanged.
+** The second parameter is a pointer to an integer
** into which is written 0 or 1 to indicate whether checkpoints-on-close
** have been disabled - 0 if they are not disabled, 1 if they are.
**
@@ -2842,7 +2802,7 @@ struct sqlite3_mem_methods {
** statistics. For statistics to be collected, the flag must be set on
** the database handle both when the SQL statement is prepared and when it
** is stepped. The flag is set (collection of statistics is enabled)
-** by default. This option takes two arguments: an integer and a pointer to
+** by default. This option takes two arguments: an integer and a pointer to
** an integer.. The first argument is 1, 0, or -1 to enable, disable, or
** leave unchanged the statement scanstatus option. If the second argument
** is not NULL, then the value of the statement scanstatus setting after
@@ -2856,7 +2816,7 @@ struct sqlite3_mem_methods {
** in which tables and indexes are scanned so that the scans start at the end
** and work toward the beginning rather than starting at the beginning and
** working toward the end. Setting SQLITE_DBCONFIG_REVERSE_SCANORDER is the
-** same as setting [PRAGMA reverse_unordered_selects].
This option takes
+** same as setting [PRAGMA reverse_unordered_selects]. This option takes
** two arguments which are an integer and a pointer to an integer. The first
** argument is 1, 0, or -1 to enable, disable, or leave unchanged the
** reverse scan order flag, respectively. If the second argument is not NULL,
@@ -2865,76 +2825,7 @@ struct sqlite3_mem_methods {
** first argument.
**
**
-** [[SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE]]
-** - SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE
-** - The SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE option enables or disables
-** the ability of the [ATTACH DATABASE] SQL command to create a new database
-** file if the database filed named in the ATTACH command does not already
-** exist. This ability of ATTACH to create a new database is enabled by
-** default. Applications can disable or reenable the ability for ATTACH to
-** create new database files using this DBCONFIG option.
-** This option takes two arguments which are an integer and a pointer
-** to an integer. The first argument is 1, 0, or -1 to enable, disable, or
-** leave unchanged the attach-create flag, respectively. If the second
-** argument is not NULL, then 0 or 1 is written into the integer that the
-** second argument points to depending on if the attach-create flag is set
-** after processing the first argument.
-**
-**
-** [[SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE]]
-** - SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE
-** - The SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE option enables or disables the
-** ability of the [ATTACH DATABASE] SQL command to open a database for writing.
-** This capability is enabled by default. Applications can disable or
-** reenable this capability using the current DBCONFIG option. If the
-** the this capability is disabled, the [ATTACH] command will still work,
-** but the database will be opened read-only. If this option is disabled,
-** then the ability to create a new database using [ATTACH] is also disabled,
-** regardless of the value of the [SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE]
-** option.
-** This option takes two arguments which are an integer and a pointer
-** to an integer. The first argument is 1, 0, or -1 to enable, disable, or
-** leave unchanged the ability to ATTACH another database for writing,
-** respectively. If the second argument is not NULL, then 0 or 1 is written
-** into the integer to which the second argument points, depending on whether
-** the ability to ATTACH a read/write database is enabled or disabled
-** after processing the first argument.
-**
-**
-** [[SQLITE_DBCONFIG_ENABLE_COMMENTS]]
-** - SQLITE_DBCONFIG_ENABLE_COMMENTS
-** - The SQLITE_DBCONFIG_ENABLE_COMMENTS option enables or disables the
-** ability to include comments in SQL text. Comments are enabled by default.
-** An application can disable or reenable comments in SQL text using this
-** DBCONFIG option.
-** This option takes two arguments which are an integer and a pointer
-** to an integer. The first argument is 1, 0, or -1 to enable, disable, or
-** leave unchanged the ability to use comments in SQL text,
-** respectively. If the second argument is not NULL, then 0 or 1 is written
-** into the integer that the second argument points to depending on if
-** comments are allowed in SQL text after processing the first argument.
-**
-**
**
-**
-** [[DBCONFIG arguments]] Arguments To SQLITE_DBCONFIG Options
-**
-** Most of the SQLITE_DBCONFIG options take two arguments, so that the
-** overall call to [sqlite3_db_config()] has a total of four parameters.
-** The first argument (the third parameter to sqlite3_db_config()) is a integer.
-** The second argument is a pointer to an integer. If the first argument is 1,
-** then the option becomes enabled. If the first integer argument is 0, then the
-** option is disabled. If the first argument is -1, then the option setting
-** is unchanged. The second argument, the pointer to an integer, may be NULL.
-** If the second argument is not NULL, then a value of 0 or 1 is written into
-** the integer to which the second argument points, depending on whether the
-** setting is disabled or enabled after applying any changes specified by
-** the first argument.
-**
-**
While most SQLITE_DBCONFIG options use the argument format
-** described in the previous paragraph, the [SQLITE_DBCONFIG_MAINDBNAME]
-** and [SQLITE_DBCONFIG_LOOKASIDE] options are different. See the
-** documentation of those exceptional options for details.
*/
#define SQLITE_DBCONFIG_MAINDBNAME 1000 /* const char* */
#define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */
@@ -2956,10 +2847,7 @@ struct sqlite3_mem_methods {
#define SQLITE_DBCONFIG_TRUSTED_SCHEMA 1017 /* int int* */
#define SQLITE_DBCONFIG_STMT_SCANSTATUS 1018 /* int int* */
#define SQLITE_DBCONFIG_REVERSE_SCANORDER 1019 /* int int* */
-#define SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE 1020 /* int int* */
-#define SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE 1021 /* int int* */
-#define SQLITE_DBCONFIG_ENABLE_COMMENTS 1022 /* int int* */
-#define SQLITE_DBCONFIG_MAX 1022 /* Largest DBCONFIG */
+#define SQLITE_DBCONFIG_MAX 1019 /* Largest DBCONFIG */
/*
** CAPI3REF: Enable Or Disable Extended Result Codes
@@ -3051,14 +2939,10 @@ SQLITE_API void sqlite3_set_last_insert_rowid(sqlite3*,sqlite3_int64);
** deleted by the most recently completed INSERT, UPDATE or DELETE
** statement on the database connection specified by the only parameter.
** The two functions are identical except for the type of the return value
-** and that if the number of rows modified by the most recent INSERT, UPDATE,
+** and that if the number of rows modified by the most recent INSERT, UPDATE
** or DELETE is greater than the maximum value supported by type "int", then
** the return value of sqlite3_changes() is undefined. ^Executing any other
** type of SQL statement does not modify the value returned by these functions.
-** For the purposes of this interface, a CREATE TABLE AS SELECT statement
-** does not count as an INSERT, UPDATE or DELETE statement and hence the rows
-** added to the new table by the CREATE TABLE AS SELECT statement are not
-** counted.
**
** ^Only changes made directly by the INSERT, UPDATE or DELETE statement are
** considered - auxiliary changes caused by [CREATE TRIGGER | triggers],
@@ -4618,22 +4502,11 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
**
The SQLITE_PREPARE_NO_VTAB flag causes the SQL compiler
** to return an error (error code SQLITE_ERROR) if the statement uses
** any virtual tables.
-**
-** [[SQLITE_PREPARE_DONT_LOG]] SQLITE_PREPARE_DONT_LOG
-** The SQLITE_PREPARE_DONT_LOG flag prevents SQL compiler
-** errors from being sent to the error log defined by
-** [SQLITE_CONFIG_LOG]. This can be used, for example, to do test
-** compiles to see if some SQL syntax is well-formed, without generating
-** messages on the global error log when it is not. If the test compile
-** fails, the sqlite3_prepare_v3() call returns the same error indications
-** with or without this flag; it just omits the call to [sqlite3_log()] that
-** logs the error.
**
*/
#define SQLITE_PREPARE_PERSISTENT 0x01
#define SQLITE_PREPARE_NORMALIZE 0x02
#define SQLITE_PREPARE_NO_VTAB 0x04
-#define SQLITE_PREPARE_DONT_LOG 0x10
/*
** CAPI3REF: Compiling An SQL Statement
@@ -4666,17 +4539,13 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
** and sqlite3_prepare16_v3() use UTF-16.
**
** ^If the nByte argument is negative, then zSql is read up to the
-** first zero terminator. ^If nByte is positive, then it is the maximum
-** number of bytes read from zSql. When nByte is positive, zSql is read
-** up to the first zero terminator or until the nByte bytes have been read,
-** whichever comes first. ^If nByte is zero, then no prepared
+** first zero terminator. ^If nByte is positive, then it is the
+** number of bytes read from zSql. ^If nByte is zero, then no prepared
** statement is generated.
** If the caller knows that the supplied string is nul-terminated, then
** there is a small performance advantage to passing an nByte parameter that
** is the number of bytes in the input string including
** the nul-terminator.
-** Note that nByte measure the length of the input in bytes, not
-** characters, even for the UTF-16 interfaces.
**
** ^If pzTail is not NULL then *pzTail is made to point to the first byte
** past the end of the first SQL statement in zSql. These routines only
@@ -6047,7 +5916,7 @@ SQLITE_API int sqlite3_create_window_function(
** This flag instructs SQLite to omit some corner-case optimizations that
** might disrupt the operation of the [sqlite3_value_subtype()] function,
** causing it to return zero rather than the correct subtype().
-** All SQL functions that invoke [sqlite3_value_subtype()] should have this
+** SQL functions that invokes [sqlite3_value_subtype()] should have this
** property. If the SQLITE_SUBTYPE property is omitted, then the return
** value from [sqlite3_value_subtype()] might sometimes be zero even though
** a non-zero subtype was specified by the function argument expression.
@@ -8812,7 +8681,7 @@ SQLITE_API int sqlite3_test_control(int op, ...);
#define SQLITE_TESTCTRL_TRACEFLAGS 31
#define SQLITE_TESTCTRL_TUNE 32
#define SQLITE_TESTCTRL_LOGEST 33
-#define SQLITE_TESTCTRL_USELONGDOUBLE 34 /* NOT USED */
+#define SQLITE_TESTCTRL_USELONGDOUBLE 34
#define SQLITE_TESTCTRL_LAST 34 /* Largest TESTCTRL */
/*
@@ -9788,16 +9657,6 @@ typedef struct sqlite3_backup sqlite3_backup;
** APIs are not strictly speaking threadsafe. If they are invoked at the
** same time as another thread is invoking sqlite3_backup_step() it is
** possible that they return invalid values.
-**
-** Alternatives To Using The Backup API
-**
-** Other techniques for safely creating a consistent backup of an SQLite
-** database include:
-**
-**
-** - The [VACUUM INTO] command.
-**
- The [sqlite3_rsync] utility program.
-**
*/
SQLITE_API sqlite3_backup *sqlite3_backup_init(
sqlite3 *pDest, /* Destination database handle */
@@ -10997,14 +10856,6 @@ typedef struct sqlite3_snapshot {
** If there is not already a read-transaction open on schema S when
** this function is called, one is opened automatically.
**
-** If a read-transaction is opened by this function, then it is guaranteed
-** that the returned snapshot object may not be invalidated by a database
-** writer or checkpointer until after the read-transaction is closed. This
-** is not guaranteed if a read-transaction is already open when this
-** function is called. In that case, any subsequent write or checkpoint
-** operation on the database may invalidate the returned snapshot handle,
-** even while the read-transaction remains open.
-**
** The following must be true for this function to succeed. If any of
** the following statements are false when sqlite3_snapshot_get() is
** called, SQLITE_ERROR is returned. The final value of *P is undefined
@@ -11187,9 +11038,8 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_wal_info(
/*
** CAPI3REF: Serialize a database
**
-** The sqlite3_serialize(D,S,P,F) interface returns a pointer to
-** memory that is a serialization of the S database on
-** [database connection] D. If S is a NULL pointer, the main database is used.
+** The sqlite3_serialize(D,S,P,F) interface returns a pointer to memory
+** that is a serialization of the S database on [database connection] D.
** If P is not a NULL pointer, then the size of the database in bytes
** is written into *P.
**
@@ -11442,7 +11292,7 @@ SQLITE_API int sqlite3_commit_status(
#if 0
} /* End of the 'extern "C"' block */
#endif
-/* #endif for SQLITE3_H will be added by mksqlite3.tcl */
+#endif /* SQLITE3_H */
/******** Begin file sqlite3rtree.h *********/
/*
@@ -13723,29 +13573,14 @@ struct Fts5PhraseIter {
** value returned by xInstCount(), SQLITE_RANGE is returned. Otherwise,
** output variable (*ppToken) is set to point to a buffer containing the
** matching document token, and (*pnToken) to the size of that buffer in
-** bytes.
+** bytes. This API is not available if the specified token matches a
+** prefix query term. In that case both output variables are always set
+** to 0.
**
** The output text is not a copy of the document text that was tokenized.
** It is the output of the tokenizer module. For tokendata=1 tables, this
** includes any embedded 0x00 and trailing data.
**
-** This API may be slow in some cases if the token identified by parameters
-** iIdx and iToken matched a prefix token in the query. In most cases, the
-** first call to this API for each prefix token in the query is forced
-** to scan the portion of the full-text index that matches the prefix
-** token to collect the extra data required by this API. If the prefix
-** token matches a large number of token instances in the document set,
-** this may be a performance problem.
-**
-** If the user knows in advance that a query may use this API for a
-** prefix token, FTS5 may be configured to collect all required data as part
-** of the initial querying of the full-text index, avoiding the second scan
-** entirely. This also causes prefix queries that do not use this API to
-** run more slowly and use more memory. FTS5 may be configured in this way
-** either on a per-table basis using the [FTS5 insttoken | 'insttoken']
-** option, or on a per-query basis using the
-** [fts5_insttoken | fts5_insttoken()] user function.
-**
** This API can be quite slow if used with an FTS5 table created with the
** "detail=none" or "detail=column" option.
**
@@ -13836,6 +13671,7 @@ struct Fts5ExtensionApi {
** Applications may also register custom tokenizer types. A tokenizer
** is registered by providing fts5 with a populated instance of the
** following structure. All structure methods must be defined, setting
+**
** any member of the fts5_tokenizer struct to NULL leads to undefined
** behaviour. The structure methods are expected to function as follows:
**
@@ -14179,7 +14015,6 @@ struct fts5_api {
#endif /* _FTS5_H */
/******** End of fts5.h *********/
-#endif /* SQLITE3_H */
/************** End of sqlite3.h *********************************************/
/************** Continuing where we left off in sqliteInt.h ******************/
@@ -14225,7 +14060,6 @@ struct fts5_api {
#ifndef SQLITE_MAX_LENGTH
# define SQLITE_MAX_LENGTH 1000000000
#endif
-#define SQLITE_MIN_LENGTH 30 /* Minimum value for the length limit */
/*
** This is the maximum number of
@@ -15121,8 +14955,7 @@ SQLITE_PRIVATE void sqlite3HashClear(Hash*);
#define TK_ERROR 183
#define TK_QNUMBER 184
#define TK_SPACE 185
-#define TK_COMMENT 186
-#define TK_ILLEGAL 187
+#define TK_ILLEGAL 186
/************** End of parse.h ***********************************************/
/************** Continuing where we left off in sqliteInt.h ******************/
@@ -15131,7 +14964,6 @@ SQLITE_PRIVATE void sqlite3HashClear(Hash*);
#include
#include
#include
-#include
/*
** Use a macro to replace memcpy() if compiled with SQLITE_INLINE_MEMCPY.
@@ -15154,6 +14986,7 @@ SQLITE_PRIVATE void sqlite3HashClear(Hash*);
# define float sqlite_int64
# define fabs(X) ((X)<0?-(X):(X))
# define sqlite3IsOverflow(X) 0
+# define LONGDOUBLE_TYPE sqlite_int64
# ifndef SQLITE_BIG_DBL
# define SQLITE_BIG_DBL (((sqlite3_int64)1)<<50)
# endif
@@ -15328,6 +15161,9 @@ SQLITE_PRIVATE void sqlite3HashClear(Hash*);
# define INT8_TYPE signed char
# endif
#endif
+#ifndef LONGDOUBLE_TYPE
+# define LONGDOUBLE_TYPE long double
+#endif
typedef sqlite_int64 i64; /* 8-byte signed integer */
typedef sqlite_uint64 u64; /* 8-byte unsigned integer */
typedef UINT32_TYPE u32; /* 4-byte unsigned integer */
@@ -15374,8 +15210,6 @@ typedef u64 tRowcnt;
** 0.5 -> -10 0.1 -> -33 0.0625 -> -40
*/
typedef INT16_TYPE LogEst;
-#define LOGEST_MIN (-32768)
-#define LOGEST_MAX (32767)
/*
** Set the SQLITE_PTRSIZE macro to the number of bytes in a pointer
@@ -15646,7 +15480,7 @@ SQLITE_PRIVATE u32 sqlite3WhereTrace;
** 0xFFFF---- Low-level debug messages
**
** 0x00000001 Code generation
-** 0x00000002 Solver (Use 0x40000 for less detail)
+** 0x00000002 Solver
** 0x00000004 Solver costs
** 0x00000008 WhereLoop inserts
**
@@ -15665,8 +15499,6 @@ SQLITE_PRIVATE u32 sqlite3WhereTrace;
**
** 0x00010000 Show more detail when printing WHERE terms
** 0x00020000 Show WHERE terms returned from whereScanNext()
-** 0x00040000 Solver overview messages
-** 0x00080000 Star-query heuristic
*/
@@ -16503,6 +16335,8 @@ SQLITE_PRIVATE void sqlite3PagerRefdump(Pager*);
SQLITE_PRIVATE int sqlite3PagerWalSystemErrno(Pager*);
#endif
+SQLITE_PRIVATE void sqlite3PagerSetCommitTime(Pager *pPager, u64 *aCommitTime);
+
#endif /* SQLITE_PAGER_H */
/************** End of pager.h ***********************************************/
@@ -16751,9 +16585,6 @@ SQLITE_PRIVATE int sqlite3BtreeCursor(
);
SQLITE_PRIVATE BtCursor *sqlite3BtreeFakeValidCursor(void);
SQLITE_PRIVATE int sqlite3BtreeCursorSize(void);
-#ifdef SQLITE_DEBUG
-SQLITE_PRIVATE int sqlite3BtreeClosesWithCursor(Btree*,BtCursor*);
-#endif
SQLITE_PRIVATE void sqlite3BtreeCursorZero(BtCursor*);
SQLITE_PRIVATE void sqlite3BtreeCursorHintFlags(BtCursor*, unsigned);
#ifdef SQLITE_ENABLE_CURSOR_HINTS
@@ -16981,7 +16812,6 @@ typedef struct SubrtnSig SubrtnSig;
*/
struct SubrtnSig {
int selId; /* SELECT-id for the SELECT statement on the RHS */
- u8 bComplete; /* True if fully coded and available for reusable */
char *zAff; /* Affinity of the overall IN expression */
int iTable; /* Ephemeral table generated by the subroutine */
int iAddr; /* Subroutine entry address */
@@ -17369,7 +17199,7 @@ typedef struct VdbeOpList VdbeOpList;
** Additional non-public SQLITE_PREPARE_* flags
*/
#define SQLITE_PREPARE_SAVESQL 0x80 /* Preserve SQL text */
-#define SQLITE_PREPARE_MASK 0x1f /* Mask of public flags */
+#define SQLITE_PREPARE_MASK 0x0f /* Mask of public flags */
/*
** Prototypes for the VDBE interface. See comments on the implementation
@@ -17609,6 +17439,67 @@ SQLITE_PRIVATE void sqlite3VdbePrintOp(FILE*, int, VdbeOp*);
SQLITE_PRIVATE int sqlite3CursorRangeHintExprCheck(Walker *pWalker, Expr *pExpr);
#endif
+
+#define COMMIT_TIME_START 0
+#define COMMIT_TIME_BEFORE_HALT 1
+#define COMMIT_TIME_BEFORE_VDBECOMMIT 2
+
+#define COMMIT_TIME_BEFORE_PHASEONE 3
+#define COMMIT_TIME_START_FIXUNLOCKED 4
+#define COMMIT_TIME_START_RELOCATE1 5
+#define COMMIT_TIME_START_RELOCATE2 6
+
+#define COMMIT_TIME_OTHERWRITERS 7
+#define COMMIT_TIME_RELOCATE1COUNT 8
+#define COMMIT_TIME_RELOCATE2COUNT 9
+
+#define COMMIT_TIME_RELOCATE2_READUS 10
+#define COMMIT_TIME_RELOCATE2_READCOUNT 11
+#define COMMIT_TIME_RELOCATE2_EXACTUS 12
+#define COMMIT_TIME_RELOCATE2_ALLOCATEUS 13
+#define COMMIT_TIME_RELOCATE2_RELOCATEUS 14
+
+#define COMMIT_TIME_AFTER_FIXUNLOCKED 15
+
+#define COMMIT_TIME_BEFORE_WALFRAMES 16
+#define COMMIT_TIME_AFTER_CHANGECOUNTER 17
+#define COMMIT_TIME_AFTER_RESTARTLOG 18
+#define COMMIT_TIME_AFTER_WRITEHDR 19
+
+#define COMMIT_TIME_OSWRITE 20
+
+#define COMMIT_TIME_AFTER_WRITEFRAMES 21
+
+#define COMMIT_TIME_NFRAME 22
+#define COMMIT_TIME_HASHMAPUS 23
+
+#define COMMIT_TIME_BEFORE_WALINDEX 24
+
+#define COMMIT_TIME_WALINDEX_HASHGETUS 25
+#define COMMIT_TIME_WALINDEX_MEMSETUS 26
+#define COMMIT_TIME_WALINDEX_CLEANUPUS 27
+#define COMMIT_TIME_WALINDEX_ENTRYUS 28
+
+#define COMMIT_TIME_AFTER_WALINDEX 29
+#define COMMIT_TIME_AFTER_WALINDEXHDR 30
+#define COMMIT_TIME_WALFRAMESFLAGS 31
+#define COMMIT_TIME_AFTER_WALFRAMES 32
+#define COMMIT_TIME_BEFORE_PHASETWO 33
+#define COMMIT_TIME_AFTER_PHASETWO 34
+
+#define COMMIT_TIME_AFTER_VDBECOMMIT 35
+#define COMMIT_TIME_AFTER_HALT 36
+#define COMMIT_TIME_FINISH 37
+
+#define COMMIT_TIME_N 38
+
+/* #define COMMIT_TIME_TIMEOUT (2*1000*1000) */
+#define COMMIT_TIME_TIMEOUT (10*1000) /* 10ms threshold */
+
+SQLITE_PRIVATE void sqlite3CommitTimeLog(u64*);
+SQLITE_PRIVATE u64 sqlite3STimeNow();
+SQLITE_PRIVATE void sqlite3CommitTimeSet(u64*, int);
+
#endif /* SQLITE_VDBE_H */
/************** End of vdbe.h ************************************************/
@@ -18095,11 +17986,47 @@ struct FuncDefHash {
};
#define SQLITE_FUNC_HASH(C,L) (((C)+(L))%SQLITE_FUNC_HASH_SZ)
+#if defined(SQLITE_USER_AUTHENTICATION)
+# warning "The SQLITE_USER_AUTHENTICATION extension is deprecated. \
+ See ext/userauth/user-auth.txt for details."
+#endif
+#ifdef SQLITE_USER_AUTHENTICATION
+/*
+** Information held in the "sqlite3" database connection object and used
+** to manage user authentication.
+*/
+typedef struct sqlite3_userauth sqlite3_userauth;
+struct sqlite3_userauth {
+ u8 authLevel; /* Current authentication level */
+ int nAuthPW; /* Size of the zAuthPW in bytes */
+ char *zAuthPW; /* Password used to authenticate */
+ char *zAuthUser; /* User name used to authenticate */
+};
+
+/* Allowed values for sqlite3_userauth.authLevel */
+#define UAUTH_Unknown 0 /* Authentication not yet checked */
+#define UAUTH_Fail 1 /* User authentication failed */
+#define UAUTH_User 2 /* Authenticated as a normal user */
+#define UAUTH_Admin 3 /* Authenticated as an administrator */
+
+/* Functions used only by user authorization logic */
+SQLITE_PRIVATE int sqlite3UserAuthTable(const char*);
+SQLITE_PRIVATE int sqlite3UserAuthCheckLogin(sqlite3*,const char*,u8*);
+SQLITE_PRIVATE void sqlite3UserAuthInit(sqlite3*);
+SQLITE_PRIVATE void sqlite3CryptFunc(sqlite3_context*,int,sqlite3_value**);
+
+#endif /* SQLITE_USER_AUTHENTICATION */
+
/*
** typedef for the authorization callback function.
*/
-typedef int (*sqlite3_xauth)(void*,int,const char*,const char*,const char*,
- const char*);
+#ifdef SQLITE_USER_AUTHENTICATION
+ typedef int (*sqlite3_xauth)(void*,int,const char*,const char*,const char*,
+ const char*, const char*);
+#else
+ typedef int (*sqlite3_xauth)(void*,int,const char*,const char*,const char*,
+ const char*);
+#endif
#ifndef SQLITE_OMIT_DEPRECATED
/* This is an extra SQLITE_TRACE macro that indicates "legacy" tracing
@@ -18262,14 +18189,82 @@ struct sqlite3 {
void (*xUnlockNotify)(void **, int); /* Unlock notify callback */
sqlite3 *pNextBlocked; /* Next in list of all blocked connections */
#endif
+#ifdef SQLITE_USER_AUTHENTICATION
+ sqlite3_userauth auth; /* User authentication information */
+#endif
#ifndef SQLITE_OMIT_CONCURRENT
/* Return values for sqlite3_commit_status() requests:
** SQLITE_COMMIT_CONFLICT_DB, CONFLICT_FRAME and CONFLICT_PGNO.
*/
u32 aCommit[5];
#endif
+
+ u64 *aPrepareTime;
+ u64 *aSchemaTime;
};
+#define PREPARE_TIME_START 0
+#define PREPARE_TIME_BEGINPARSE 1
+#define PREPARE_TIME_BEGINPRAGMA 2
+
+#define PREPARE_TIME_BEGINAUTHCHECK 3
+#define PREPARE_TIME_ENDAUTHCHECK 4
+#define PREPARE_TIME_BEGINLOADSCHEMA 5
+#define PREPARE_TIME_ENDLOADSCHEMA 6
+
+
+#define PREPARE_TIME_BEGINCACHESIZE 7
+#define PREPARE_TIME_BEGINSETCACHESIZE 8
+#define PREPARE_TIME_ENDSETCACHESIZE 9
+#define PREPARE_TIME_ENDCACHESIZE 10
+#define PREPARE_TIME_ENDPRAGMA 11
+#define PREPARE_TIME_ENDPARSE 12
+#define PREPARE_TIME_FINISH 13
+
+#define PREPARE_TIME_N 14
+
+
+
+#define SCHEMA_TIME_START 0
+#define SCHEMA_TIME_AFTER_CREATE_1 1
+#define SCHEMA_TIME_AFTER_OPEN_TRANS 2
+#define SCHEMA_TIME_AFTER_GET_META 3
+#define SCHEMA_TIME_AFTER_FIX_ENCODING 4
+#define SCHEMA_TIME_AFTER_SETCACHESIZE 5
+#define SCHEMA_TIME_BEGIN_EXEC 6
+#define SCHEMA_TIME_BEFORE_STEP 7
+#define SCHEMA_TIME_BEFORE_PREPARE 8
+#define SCHEMA_TIME_BEFORE_FINALIZE 9
+#define SCHEMA_TIME_BEGIN_ANALYZE_LOAD 10
+
+#define SCHEMA_TIME_AFTER_CLEAR_STATS 11
+#define SCHEMA_TIME_AFTER_STAT1 12
+#define SCHEMA_TIME_AFTER_DEFAULTS 13
+
+#define SCHEMA_TIME_AFTER_STAT4_SPACE 14
+#define SCHEMA_TIME_AFTER_STAT4_PREPARE 15
+
+#define SCHEMA_TIME_STAT4_GROWUS 16
+#define SCHEMA_TIME_STAT4_Q2_BODYUS 17
+#define SCHEMA_TIME_AFTER_STAT4_Q2 18
+
+#define SCHEMA_TIME_AFTER_STAT4 19
+
+#define SCHEMA_TIME_END_ANALYZE_LOAD 20
+#define SCHEMA_TIME_FINISH 21
+
+#define SCHEMA_TIME_N 22
+#define SCHEMA_TIME_TIMEOUT (500 * 1000)
+
+
+
+#define sqlite3PrepareTimeSet(x,y) sqlite3CommitTimeSet(x,y)
+SQLITE_PRIVATE void sqlite3PrepareTimeLog(const char *zSql, int nSql, u64 *aPrepareTime);
+SQLITE_PRIVATE void sqlite3SchemaTimeLog(u64 *aSchemaTime, const char *zFile);
+
+#define PREPARE_TIME_TIMEOUT (2 * 1000 * 1000) /* 2 second timeout */
+
+
/*
** Candidate values for sqlite3.eConcurrent
*/
@@ -18338,9 +18333,6 @@ struct sqlite3 {
#define SQLITE_CorruptRdOnly HI(0x00002) /* Prohibit writes due to error */
#define SQLITE_ReadUncommit HI(0x00004) /* READ UNCOMMITTED in shared-cache */
#define SQLITE_FkNoAction HI(0x00008) /* Treat all FK as NO ACTION */
-#define SQLITE_AttachCreate HI(0x00010) /* ATTACH allowed to create new dbs */
-#define SQLITE_AttachWrite HI(0x00020) /* ATTACH allowed to open for write */
-#define SQLITE_Comments HI(0x00040) /* Enable SQL comments */
#define SQLITE_NoopUpdate 0x01000000 /* UPDATE operations are no-ops */
/* Flags used only if debugging */
@@ -18401,7 +18393,6 @@ struct sqlite3 {
#define SQLITE_NullUnusedCols 0x04000000 /* NULL unused columns in subqueries */
#define SQLITE_OnePass 0x08000000 /* Single-pass DELETE and UPDATE */
#define SQLITE_OrderBySubq 0x10000000 /* ORDER BY in subquery helps outer */
-#define SQLITE_StarQuery 0x20000000 /* Heurists for star queries */
#define SQLITE_AllOpts 0xffffffff /* All optimizations */
/*
@@ -19267,7 +19258,7 @@ struct Index {
** expression, or a reference to a VIRTUAL column */
#ifdef SQLITE_ENABLE_STAT4
int nSample; /* Number of elements in aSample[] */
- int nSampleAlloc; /* Allocated size of aSample[] */
+ int nSampleAlloc; /* Number of slots allocated to aSample[] */
int nSampleCol; /* Size of IndexSample.anEq[] and so on */
tRowcnt *aAvgEq; /* Average nEq values for keys not in aSample */
IndexSample *aSample; /* Samples of the left-most key */
@@ -19578,7 +19569,7 @@ struct Expr {
#define EP_IsTrue 0x10000000 /* Always has boolean value of TRUE */
#define EP_IsFalse 0x20000000 /* Always has boolean value of FALSE */
#define EP_FromDDL 0x40000000 /* Originates from sqlite_schema */
-#define EP_SubtArg 0x80000000 /* Is argument to SQLITE_SUBTYPE function */
+ /* 0x80000000 // Available */
/* The EP_Propagate mask is a set of properties that automatically propagate
** upwards into parent nodes.
@@ -19731,8 +19722,13 @@ struct ExprList {
*/
struct IdList {
int nId; /* Number of identifiers on the list */
+ u8 eU4; /* Which element of a.u4 is valid */
struct IdList_item {
char *zName; /* Name of the identifier */
+ union {
+ int idx; /* Index in some Table.aCol[] of a column named zName */
+ Expr *pExpr; /* Expr to implement a USING variable -- NOT USED */
+ } u4;
} a[1];
};
@@ -20129,7 +20125,7 @@ struct Select {
** row of result as the key in table pDest->iSDParm.
** Apply the affinity pDest->affSdst before storing
** results. if pDest->iSDParm2 is positive, then it is
-** a register holding a Bloom filter for the IN operator
+** a regsiter holding a Bloom filter for the IN operator
** that should be populated in addition to the
** pDest->iSDParm table. This SRT is used to
** implement "IN (SELECT ...)".
@@ -20419,7 +20415,9 @@ struct Parse {
int nVtabLock; /* Number of virtual tables to lock */
#endif
int nHeight; /* Expression tree height of current sub-select */
+#ifndef SQLITE_OMIT_EXPLAIN
int addrExplain; /* Address of current OP_Explain opcode */
+#endif
VList *pVList; /* Mapping between variable names and numbers */
Vdbe *pReprepare; /* VM being reprepared (sqlite3Reprepare()) */
const char *zTail; /* All SQL text past the last semicolon parsed */
@@ -20726,6 +20724,7 @@ struct Sqlite3Config {
u8 bUseCis; /* Use covering indices for full-scans */
u8 bSmallMalloc; /* Avoid large memory allocations if true */
u8 bExtraSchemaChecks; /* Verify type,name,tbl_name in schema */
+ u8 bUseLongDouble; /* Make use of long double */
#ifdef SQLITE_DEBUG
u8 bJsonSelfcheck; /* Double-check JSON parsing */
#endif
@@ -21100,6 +21099,15 @@ SQLITE_PRIVATE int sqlite3CorruptPgnoError(int,Pgno);
# define SQLITE_ENABLE_FTS3 1
#endif
+/*
+** The ctype.h header is needed for non-ASCII systems. It is also
+** needed by FTS3 when FTS3 is included in the amalgamation.
+*/
+#if !defined(SQLITE_ASCII) || \
+ (defined(SQLITE_ENABLE_FTS3) && defined(SQLITE_AMALGAMATION))
+# include
+#endif
+
/*
** The following macros mimic the standard library functions toupper(),
** isspace(), isalnum(), isdigit() and isxdigit(), respectively. The
@@ -21723,7 +21731,7 @@ SQLITE_PRIVATE int sqlite3GetInt32(const char *, int*);
SQLITE_PRIVATE int sqlite3GetUInt32(const char*, u32*);
SQLITE_PRIVATE int sqlite3Atoi(const char*);
#ifndef SQLITE_OMIT_UTF16
-SQLITE_PRIVATE int sqlite3Utf16ByteLen(const void *pData, int nByte, int nChar);
+SQLITE_PRIVATE int sqlite3Utf16ByteLen(const void *pData, int nChar);
#endif
SQLITE_PRIVATE int sqlite3Utf8CharLen(const char *pData, int nByte);
SQLITE_PRIVATE u32 sqlite3Utf8Read(const u8**);
@@ -23181,6 +23189,9 @@ static const char * const sqlite3azCompileOpt[] = {
#ifdef SQLITE_UNTESTABLE
"UNTESTABLE",
#endif
+#ifdef SQLITE_USER_AUTHENTICATION
+ "USER_AUTHENTICATION",
+#endif
#ifdef SQLITE_USE_ALLOCA
"USE_ALLOCA",
#endif
@@ -23457,6 +23468,7 @@ SQLITE_PRIVATE SQLITE_WSD struct Sqlite3Config sqlite3Config = {
SQLITE_ALLOW_COVERING_INDEX_SCAN, /* bUseCis */
0, /* bSmallMalloc */
1, /* bExtraSchemaChecks */
+ sizeof(LONGDOUBLE_TYPE)>8, /* bUseLongDouble */
#ifdef SQLITE_DEBUG
0, /* bJsonSelfcheck */
#endif
@@ -23880,7 +23892,6 @@ struct sqlite3_value {
#ifdef SQLITE_DEBUG
Mem *pScopyFrom; /* This Mem is a shallow copy of pScopyFrom */
u16 mScopyFlags; /* flags value immediately after the shallow copy */
- u8 bScopy; /* The pScopyFrom of some other Mem *might* point here */
#endif
};
@@ -24151,6 +24162,7 @@ struct Vdbe {
int nScan; /* Entries in aScan[] */
ScanStatus *aScan; /* Scan definitions for sqlite3_stmt_scanstatus() */
#endif
+ u64 *aCommitTime;
};
/*
@@ -24177,11 +24189,9 @@ struct PreUpdate {
int iBlobWrite; /* Value returned by preupdate_blobwrite() */
i64 iKey1; /* First key value passed to hook */
i64 iKey2; /* Second key value passed to hook */
- Mem oldipk; /* Memory cell holding "old" IPK value */
Mem *aNew; /* Array of new.* values */
Table *pTab; /* Schema object being updated */
Index *pPk; /* PK index if pTab is WITHOUT ROWID */
- sqlite3_value **apDflt; /* Array of default values, if required */
};
/*
@@ -24979,9 +24989,6 @@ static int parseHhMmSs(const char *zDate, DateTime *p){
zDate++;
}
ms /= rScale;
- /* Truncate to avoid problems with sub-milliseconds
- ** rounding. https://sqlite.org/forum/forumpost/766a2c9231 */
- if( ms>0.999 ) ms = 0.999;
}
}else{
s = 0;
@@ -26189,7 +26196,7 @@ static void strftimeFunc(
}
case 'f': { /* Fractional seconds. (Non-standard) */
double s = x.s;
- if( NEVER(s>59.999) ) s = 59.999;
+ if( s>59.999 ) s = 59.999;
sqlite3_str_appendf(&sRes, "%06.3f", s);
break;
}
@@ -29630,29 +29637,16 @@ SQLITE_API void sqlite3_mutex_leave(sqlite3_mutex *p){
/*
** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routine are
** intended for use inside assert() statements.
-**
-** Because these routines raise false-positive alerts in TSAN, disable
-** them (make them always return 1) when compiling with TSAN.
*/
SQLITE_API int sqlite3_mutex_held(sqlite3_mutex *p){
-# if defined(__has_feature)
-# if __has_feature(thread_sanitizer)
- p = 0;
-# endif
-# endif
assert( p==0 || sqlite3GlobalConfig.mutex.xMutexHeld );
return p==0 || sqlite3GlobalConfig.mutex.xMutexHeld(p);
}
SQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex *p){
-# if defined(__has_feature)
-# if __has_feature(thread_sanitizer)
- p = 0;
-# endif
-# endif
assert( p==0 || sqlite3GlobalConfig.mutex.xMutexNotheld );
return p==0 || sqlite3GlobalConfig.mutex.xMutexNotheld(p);
}
-#endif /* NDEBUG */
+#endif
#endif /* !defined(SQLITE_MUTEX_OMIT) */
@@ -32630,7 +32624,6 @@ SQLITE_PRIVATE void sqlite3RecordErrorOffsetOfExpr(sqlite3 *db, const Expr *pExp
pExpr = pExpr->pLeft;
}
if( pExpr==0 ) return;
- if( ExprHasProperty(pExpr, EP_FromDDL) ) return;
db->errByteOffset = pExpr->w.iOfst;
}
@@ -33010,7 +33003,7 @@ SQLITE_API char *sqlite3_snprintf(int n, char *zBuf, const char *zFormat, ...){
*/
static void renderLogMsg(int iErrCode, const char *zFormat, va_list ap){
StrAccum acc; /* String accumulator */
- char zMsg[SQLITE_PRINT_BUF_SIZE*3]; /* Complete log message */
+ char zMsg[SQLITE_PRINT_BUF_SIZE*10]; /* Complete log message */
sqlite3StrAccumInit(&acc, 0, zMsg, sizeof(zMsg), 0);
sqlite3_str_vappendf(&acc, zFormat, ap);
@@ -33357,13 +33350,10 @@ SQLITE_PRIVATE void sqlite3TreeViewSrcList(TreeView *pView, const SrcList *pSrc)
sqlite3_str_appendf(&x, " DDL");
}
if( pItem->fg.isCte ){
- static const char *aMat[] = {",MAT", "", ",NO-MAT"};
- sqlite3_str_appendf(&x, " CteUse=%d%s",
- pItem->u2.pCteUse->nUse,
- aMat[pItem->u2.pCteUse->eM10d]);
+ sqlite3_str_appendf(&x, " CteUse=0x%p", pItem->u2.pCteUse);
}
if( pItem->fg.isOn || (pItem->fg.isUsing==0 && pItem->u3.pOn!=0) ){
- sqlite3_str_appendf(&x, " isOn");
+ sqlite3_str_appendf(&x, " ON");
}
if( pItem->fg.isTabFunc ) sqlite3_str_appendf(&x, " isTabFunc");
if( pItem->fg.isCorrelated ) sqlite3_str_appendf(&x, " isCorrelated");
@@ -33391,6 +33381,9 @@ SQLITE_PRIVATE void sqlite3TreeViewSrcList(TreeView *pView, const SrcList *pSrc)
sqlite3TreeViewColumnList(pView, pTab->aCol, pTab->nCol, 1);
}
assert( (int)pItem->fg.isNestedFrom == IsNestedFrom(pItem) );
+ sqlite3TreeViewPush(&pView, 0);
+ sqlite3TreeViewLine(pView, "SUBQUERY");
+ sqlite3TreeViewPop(&pView);
sqlite3TreeViewSelect(pView, pItem->u4.pSubq->pSelect, 0);
}
if( pItem->fg.isTabFunc ){
@@ -34120,7 +34113,21 @@ SQLITE_PRIVATE void sqlite3TreeViewBareIdList(
if( zName==0 ) zName = "(null)";
sqlite3TreeViewPush(&pView, moreToFollow);
sqlite3TreeViewLine(pView, 0);
- fprintf(stdout, "%s\n", zName);
+ if( pList->eU4==EU4_NONE ){
+ fprintf(stdout, "%s\n", zName);
+ }else if( pList->eU4==EU4_IDX ){
+ fprintf(stdout, "%s (%d)\n", zName, pList->a[i].u4.idx);
+ }else{
+ assert( pList->eU4==EU4_EXPR );
+ if( pList->a[i].u4.pExpr==0 ){
+ fprintf(stdout, "%s (pExpr=NULL)\n", zName);
+ }else{
+ fprintf(stdout, "%s\n", zName);
+ sqlite3TreeViewPush(&pView, inId-1);
+ sqlite3TreeViewExpr(pView, pList->a[i].u4.pExpr, 0);
+ sqlite3TreeViewPop(&pView);
+ }
+ }
sqlite3TreeViewPop(&pView);
}
}
@@ -34430,10 +34437,6 @@ SQLITE_PRIVATE void sqlite3TreeViewTrigger(
** accessible to the debugging, and to avoid warnings about unused
** functions. But these routines only exist in debugging builds, so they
** do not contaminate the interface.
-**
-** See Also:
-**
-** sqlite3ShowWhereTerm() in where.c
*/
SQLITE_PRIVATE void sqlite3ShowExpr(const Expr *p){ sqlite3TreeViewExpr(0,p,0); }
SQLITE_PRIVATE void sqlite3ShowExprList(const ExprList *p){ sqlite3TreeViewExprList(0,p,0,0);}
@@ -35058,7 +35061,7 @@ static const unsigned char sqlite3Utf8Trans1[] = {
c = *(zIn++); \
if( c>=0xc0 ){ \
c = sqlite3Utf8Trans1[c-0xc0]; \
- while( zIn=0xd8 && c<0xdc && z<=zEnd && z[0]>=0xdc && z[0]<0xe0 ) z += 2;
+ if( c>=0xd8 && c<0xdc && z[0]>=0xdc && z[0]<0xe0 ) z += 2;
n++;
}
return (int)(z-(unsigned char const *)zIn)
@@ -36032,8 +36033,6 @@ SQLITE_PRIVATE int sqlite3AtoF(const char *z, double *pResult, int length, u8 en
int eValid = 1; /* True exponent is either not used or is well-formed */
int nDigit = 0; /* Number of digits processed */
int eType = 1; /* 1: pure integer, 2+: fractional -1 or less: bad UTF16 */
- u64 s2; /* round-tripped significand */
- double rr[2];
assert( enc==SQLITE_UTF8 || enc==SQLITE_UTF16LE || enc==SQLITE_UTF16BE );
*pResult = 0.0; /* Default return value, in case of an error */
@@ -36136,7 +36135,7 @@ SQLITE_PRIVATE int sqlite3AtoF(const char *z, double *pResult, int length, u8 en
e = (e*esign) + d;
/* Try to adjust the exponent to make it smaller */
- while( e>0 && s<((LARGEST_UINT64-0x7ff)/10) ){
+ while( e>0 && s<(LARGEST_UINT64/10) ){
s *= 10;
e--;
}
@@ -36145,52 +36144,68 @@ SQLITE_PRIVATE int sqlite3AtoF(const char *z, double *pResult, int length, u8 en
e++;
}
- rr[0] = (double)s;
- assert( sizeof(s2)==sizeof(rr[0]) );
-#ifdef SQLITE_DEBUG
- rr[1] = 18446744073709549568.0;
- memcpy(&s2, &rr[1], sizeof(s2));
- assert( s2==0x43efffffffffffffLL );
+ if( e==0 ){
+ *pResult = s;
+ }else if( sqlite3Config.bUseLongDouble ){
+ LONGDOUBLE_TYPE r = (LONGDOUBLE_TYPE)s;
+ if( e>0 ){
+ while( e>=100 ){ e-=100; r *= 1.0e+100L; }
+ while( e>=10 ){ e-=10; r *= 1.0e+10L; }
+ while( e>=1 ){ e-=1; r *= 1.0e+01L; }
+ }else{
+ while( e<=-100 ){ e+=100; r *= 1.0e-100L; }
+ while( e<=-10 ){ e+=10; r *= 1.0e-10L; }
+ while( e<=-1 ){ e+=1; r *= 1.0e-01L; }
+ }
+ assert( r>=0.0 );
+ if( r>+1.7976931348623157081452742373e+308L ){
+#ifdef INFINITY
+ *pResult = +INFINITY;
+#else
+ *pResult = 1.0e308*10.0;
#endif
- /* Largest double that can be safely converted to u64
- ** vvvvvvvvvvvvvvvvvvvvvv */
- if( rr[0]<=18446744073709549568.0 ){
- s2 = (u64)rr[0];
- rr[1] = s>=s2 ? (double)(s - s2) : -(double)(s2 - s);
- }else{
- rr[1] = 0.0;
- }
- assert( rr[1]<=1.0e-10*rr[0] ); /* Equal only when rr[0]==0.0 */
-
- if( e>0 ){
- while( e>=100 ){
- e -= 100;
- dekkerMul2(rr, 1.0e+100, -1.5902891109759918046e+83);
- }
- while( e>=10 ){
- e -= 10;
- dekkerMul2(rr, 1.0e+10, 0.0);
- }
- while( e>=1 ){
- e -= 1;
- dekkerMul2(rr, 1.0e+01, 0.0);
+ }else{
+ *pResult = (double)r;
}
}else{
- while( e<=-100 ){
- e += 100;
- dekkerMul2(rr, 1.0e-100, -1.99918998026028836196e-117);
- }
- while( e<=-10 ){
- e += 10;
- dekkerMul2(rr, 1.0e-10, -3.6432197315497741579e-27);
- }
- while( e<=-1 ){
- e += 1;
- dekkerMul2(rr, 1.0e-01, -5.5511151231257827021e-18);
+ double rr[2];
+ u64 s2;
+ rr[0] = (double)s;
+ s2 = (u64)rr[0];
+#if defined(_MSC_VER) && _MSC_VER<1700
+ if( s2==0x8000000000000000LL ){ s2 = 2*(u64)(0.5*rr[0]); }
+#endif
+ rr[1] = s>=s2 ? (double)(s - s2) : -(double)(s2 - s);
+ if( e>0 ){
+ while( e>=100 ){
+ e -= 100;
+ dekkerMul2(rr, 1.0e+100, -1.5902891109759918046e+83);
+ }
+ while( e>=10 ){
+ e -= 10;
+ dekkerMul2(rr, 1.0e+10, 0.0);
+ }
+ while( e>=1 ){
+ e -= 1;
+ dekkerMul2(rr, 1.0e+01, 0.0);
+ }
+ }else{
+ while( e<=-100 ){
+ e += 100;
+ dekkerMul2(rr, 1.0e-100, -1.99918998026028836196e-117);
+ }
+ while( e<=-10 ){
+ e += 10;
+ dekkerMul2(rr, 1.0e-10, -3.6432197315497741579e-27);
+ }
+ while( e<=-1 ){
+ e += 1;
+ dekkerMul2(rr, 1.0e-01, -5.5511151231257827021e-18);
+ }
}
+ *pResult = rr[0]+rr[1];
+ if( sqlite3IsNaN(*pResult) ) *pResult = 1e300*1e300;
}
- *pResult = rr[0]+rr[1];
- if( sqlite3IsNaN(*pResult) ) *pResult = 1e300*1e300;
if( sign<0 ) *pResult = -*pResult;
assert( !sqlite3IsNaN(*pResult) );
@@ -36511,10 +36526,9 @@ SQLITE_PRIVATE void sqlite3FpDecode(FpDecode *p, double r, int iRound, int mxRou
int i;
u64 v;
int e, exp = 0;
- double rr[2];
-
p->isSpecial = 0;
p->z = p->zBuf;
+
assert( mxRound>0 );
/* Convert negative numbers to positive. Deal with Infinity, 0.0, and
@@ -36542,45 +36556,62 @@ SQLITE_PRIVATE void sqlite3FpDecode(FpDecode *p, double r, int iRound, int mxRou
/* Multiply r by powers of ten until it lands somewhere in between
** 1.0e+19 and 1.0e+17.
- **
- ** Use Dekker-style double-double computation to increase the
- ** precision.
- **
- ** The error terms on constants like 1.0e+100 computed using the
- ** decimal extension, for example as follows:
- **
- ** SELECT decimal_exp(decimal_sub('1.0e+100',decimal(1.0e+100)));
*/
- rr[0] = r;
- rr[1] = 0.0;
- if( rr[0]>9.223372036854774784e+18 ){
- while( rr[0]>9.223372036854774784e+118 ){
- exp += 100;
- dekkerMul2(rr, 1.0e-100, -1.99918998026028836196e-117);
- }
- while( rr[0]>9.223372036854774784e+28 ){
- exp += 10;
- dekkerMul2(rr, 1.0e-10, -3.6432197315497741579e-27);
- }
- while( rr[0]>9.223372036854774784e+18 ){
- exp += 1;
- dekkerMul2(rr, 1.0e-01, -5.5511151231257827021e-18);
+ if( sqlite3Config.bUseLongDouble ){
+ LONGDOUBLE_TYPE rr = r;
+ if( rr>=1.0e+19 ){
+ while( rr>=1.0e+119L ){ exp+=100; rr *= 1.0e-100L; }
+ while( rr>=1.0e+29L ){ exp+=10; rr *= 1.0e-10L; }
+ while( rr>=1.0e+19L ){ exp++; rr *= 1.0e-1L; }
+ }else{
+ while( rr<1.0e-97L ){ exp-=100; rr *= 1.0e+100L; }
+ while( rr<1.0e+07L ){ exp-=10; rr *= 1.0e+10L; }
+ while( rr<1.0e+17L ){ exp--; rr *= 1.0e+1L; }
}
+ v = (u64)rr;
}else{
- while( rr[0]<9.223372036854774784e-83 ){
- exp -= 100;
- dekkerMul2(rr, 1.0e+100, -1.5902891109759918046e+83);
- }
- while( rr[0]<9.223372036854774784e+07 ){
- exp -= 10;
- dekkerMul2(rr, 1.0e+10, 0.0);
- }
- while( rr[0]<9.22337203685477478e+17 ){
- exp -= 1;
- dekkerMul2(rr, 1.0e+01, 0.0);
+ /* If high-precision floating point is not available using "long double",
+ ** then use Dekker-style double-double computation to increase the
+ ** precision.
+ **
+ ** The error terms on constants like 1.0e+100 computed using the
+ ** decimal extension, for example as follows:
+ **
+ ** SELECT decimal_exp(decimal_sub('1.0e+100',decimal(1.0e+100)));
+ */
+ double rr[2];
+ rr[0] = r;
+ rr[1] = 0.0;
+ if( rr[0]>9.223372036854774784e+18 ){
+ while( rr[0]>9.223372036854774784e+118 ){
+ exp += 100;
+ dekkerMul2(rr, 1.0e-100, -1.99918998026028836196e-117);
+ }
+ while( rr[0]>9.223372036854774784e+28 ){
+ exp += 10;
+ dekkerMul2(rr, 1.0e-10, -3.6432197315497741579e-27);
+ }
+ while( rr[0]>9.223372036854774784e+18 ){
+ exp += 1;
+ dekkerMul2(rr, 1.0e-01, -5.5511151231257827021e-18);
+ }
+ }else{
+ while( rr[0]<9.223372036854774784e-83 ){
+ exp -= 100;
+ dekkerMul2(rr, 1.0e+100, -1.5902891109759918046e+83);
+ }
+ while( rr[0]<9.223372036854774784e+07 ){
+ exp -= 10;
+ dekkerMul2(rr, 1.0e+10, 0.0);
+ }
+ while( rr[0]<9.22337203685477478e+17 ){
+ exp -= 1;
+ dekkerMul2(rr, 1.0e+01, 0.0);
+ }
}
+ v = rr[1]<0.0 ? (u64)rr[0]-(u64)(-rr[1]) : (u64)rr[0]+(u64)rr[1];
}
- v = rr[1]<0.0 ? (u64)rr[0]-(u64)(-rr[1]) : (u64)rr[0]+(u64)rr[1];
+
/* Extract significant digits. */
i = sizeof(p->zBuf)-1;
@@ -37351,6 +37382,104 @@ SQLITE_PRIVATE int sqlite3VListNameToNum(VList *pIn, const char *zName, int nNam
return 0;
}
+/*
+** High-resolution hardware timer used for debugging and testing only.
+*/
+#if defined(VDBE_PROFILE) \
+ || defined(SQLITE_PERFORMANCE_TRACE) \
+ || defined(SQLITE_ENABLE_STMT_SCANSTATUS)
+/************** Include hwtime.h in the middle of util.c *********************/
+/************** Begin file hwtime.h ******************************************/
+/*
+** 2008 May 27
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+******************************************************************************
+**
+** This file contains inline asm code for retrieving "high-performance"
+** counters for x86 and x86_64 class CPUs.
+*/
+#ifndef SQLITE_HWTIME_H
+#define SQLITE_HWTIME_H
+
+/*
+** The following routine only works on Pentium-class (or newer) processors.
+** It uses the RDTSC opcode to read the cycle count value out of the
+** processor and returns that value. This can be used for high-res
+** profiling.
+*/
+#if !defined(__STRICT_ANSI__) && \
+ (defined(__GNUC__) || defined(_MSC_VER)) && \
+ (defined(i386) || defined(__i386__) || defined(_M_IX86))
+
+ #if defined(__GNUC__)
+
+ __inline__ sqlite_uint64 sqlite3Hwtime(void){
+ unsigned int lo, hi;
+ __asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi));
+ return (sqlite_uint64)hi << 32 | lo;
+ }
+
+ #elif defined(_MSC_VER)
+
+ __declspec(naked) __inline sqlite_uint64 __cdecl sqlite3Hwtime(void){
+ __asm {
+ rdtsc
+ ret ; return value at EDX:EAX
+ }
+ }
+
+ #endif
+
+#elif !defined(__STRICT_ANSI__) && (defined(__GNUC__) && defined(__x86_64__))
+
+ __inline__ sqlite_uint64 sqlite3Hwtime(void){
+ unsigned int lo, hi;
+ __asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi));
+ return (sqlite_uint64)hi << 32 | lo;
+ }
+
+#elif !defined(__STRICT_ANSI__) && (defined(__GNUC__) && defined(__ppc__))
+
+ __inline__ sqlite_uint64 sqlite3Hwtime(void){
+ unsigned long long retval;
+ unsigned long junk;
+ __asm__ __volatile__ ("\n\
+ 1: mftbu %1\n\
+ mftb %L0\n\
+ mftbu %0\n\
+ cmpw %0,%1\n\
+ bne 1b"
+ : "=r" (retval), "=r" (junk));
+ return retval;
+ }
+
+#else
+
+ /*
+ ** asm() is needed for hardware timing support. Without asm(),
+ ** disable the sqlite3Hwtime() routine.
+ **
+ ** sqlite3Hwtime() is only used for some obscure debugging
+ ** and analysis configurations, not in any deliverable, so this
+ ** should not be a great loss.
+ */
+SQLITE_PRIVATE sqlite_uint64 sqlite3Hwtime(void){ return ((sqlite_uint64)0); }
+
+#endif
+
+#endif /* !defined(SQLITE_HWTIME_H) */
+
+/************** End of hwtime.h **********************************************/
+/************** Continuing where we left off in util.c ***********************/
+#endif
+
/************** End of util.c ************************************************/
/************** Begin file hash.c ********************************************/
/*
@@ -39042,7 +39171,7 @@ SQLITE_PRIVATE int sqlite3KvvfsInit(void){
# endif
#else /* !SQLITE_WASI */
# ifndef HAVE_FCHMOD
-# define HAVE_FCHMOD 1
+# define HAVE_FCHMOD
# endif
#endif /* SQLITE_WASI */
@@ -40504,7 +40633,7 @@ static int unixFileLock(unixFile *pFile, struct flock *pLock){
if( (pFile->ctrlFlags & (UNIXFILE_EXCL|UNIXFILE_RDONLY))==UNIXFILE_EXCL ){
if( pInode->bProcessLock==0 ){
struct flock lock;
- /* assert( pInode->nLock==0 ); <-- Not true if unix-excl READONLY used */
+ assert( pInode->nLock==0 );
lock.l_whence = SEEK_SET;
lock.l_start = SHARED_FIRST;
lock.l_len = SHARED_SIZE;
@@ -41312,33 +41441,54 @@ static int robust_flock(int fd, int op){
** is set to SQLITE_OK unless an I/O error occurs during lock checking.
*/
static int flockCheckReservedLock(sqlite3_file *id, int *pResOut){
-#ifdef SQLITE_DEBUG
+ int rc = SQLITE_OK;
+ int reserved = 0;
unixFile *pFile = (unixFile*)id;
-#else
- UNUSED_PARAMETER(id);
-#endif
SimulateIOError( return SQLITE_IOERR_CHECKRESERVEDLOCK; );
assert( pFile );
- assert( pFile->eFileLock<=SHARED_LOCK );
- /* The flock VFS only ever takes exclusive locks (see function flockLock).
- ** Therefore, if this connection is holding any lock at all, no other
- ** connection may be holding a RESERVED lock. So set *pResOut to 0
- ** in this case.
- **
- ** Or, this connection may be holding no lock. In that case, set *pResOut to
- ** 0 as well. The caller will then attempt to take an EXCLUSIVE lock on the
- ** db in order to roll the hot journal back. If there is another connection
- ** holding a lock, that attempt will fail and an SQLITE_BUSY returned to
- ** the user. With other VFS, we try to avoid this, in order to allow a reader
- ** to proceed while a writer is preparing its transaction. But that won't
- ** work with the flock VFS - as it always takes EXCLUSIVE locks - so it is
- ** not a problem in this case. */
- *pResOut = 0;
+ /* Check if a thread in this process holds such a lock */
+ if( pFile->eFileLock>SHARED_LOCK ){
+ reserved = 1;
+ }
- return SQLITE_OK;
+ /* Otherwise see if some other process holds it. */
+ if( !reserved ){
+ /* attempt to get the lock */
+ int lrc = robust_flock(pFile->h, LOCK_EX | LOCK_NB);
+ if( !lrc ){
+ /* got the lock, unlock it */
+ lrc = robust_flock(pFile->h, LOCK_UN);
+ if ( lrc ) {
+ int tErrno = errno;
+ /* unlock failed with an error */
+ lrc = SQLITE_IOERR_UNLOCK;
+ storeLastErrno(pFile, tErrno);
+ rc = lrc;
+ }
+ } else {
+ int tErrno = errno;
+ reserved = 1;
+ /* someone else might have it reserved */
+ lrc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_LOCK);
+ if( IS_LOCK_ERROR(lrc) ){
+ storeLastErrno(pFile, tErrno);
+ rc = lrc;
+ }
+ }
+ }
+ OSTRACE(("TEST WR-LOCK %d %d %d (flock)\n", pFile->h, rc, reserved));
+
+#ifdef SQLITE_IGNORE_FLOCK_LOCK_ERRORS
+ if( (rc & 0xff) == SQLITE_IOERR ){
+ rc = SQLITE_OK;
+ reserved=1;
+ }
+#endif /* SQLITE_IGNORE_FLOCK_LOCK_ERRORS */
+ *pResOut = reserved;
+ return rc;
}
/*
@@ -42835,11 +42985,6 @@ static int unixFileControl(sqlite3_file *id, int op, void *pArg){
}
#endif /* __linux__ && SQLITE_ENABLE_BATCH_ATOMIC_WRITE */
- case SQLITE_FCNTL_NULL_IO: {
- osClose(pFile->h);
- pFile->h = -1;
- return SQLITE_OK;
- }
case SQLITE_FCNTL_LOCKSTATE: {
*(int*)pArg = pFile->eFileLock;
return SQLITE_OK;
@@ -42984,7 +43129,6 @@ static void setDeviceCharacteristics(unixFile *pFd){
if( pFd->ctrlFlags & UNIXFILE_PSOW ){
pFd->deviceCharacteristics |= SQLITE_IOCAP_POWERSAFE_OVERWRITE;
}
- pFd->deviceCharacteristics |= SQLITE_IOCAP_SUBPAGE_READ;
pFd->sectorSize = SQLITE_DEFAULT_SECTOR_SIZE;
}
@@ -43035,7 +43179,7 @@ static void setDeviceCharacteristics(unixFile *pFile){
pFile->sectorSize = fsInfo.f_bsize;
pFile->deviceCharacteristics =
/* full bitset of atomics from max sector size and smaller */
- (((pFile->sectorSize / 512 * SQLITE_IOCAP_ATOMIC512) << 1) - 2) |
+ ((pFile->sectorSize / 512 * SQLITE_IOCAP_ATOMIC512) << 1) - 2 |
SQLITE_IOCAP_SEQUENTIAL | /* The ram filesystem has no write behind
** so it is ordered */
0;
@@ -43043,7 +43187,7 @@ static void setDeviceCharacteristics(unixFile *pFile){
pFile->sectorSize = fsInfo.f_bsize;
pFile->deviceCharacteristics =
/* full bitset of atomics from max sector size and smaller */
- (((pFile->sectorSize / 512 * SQLITE_IOCAP_ATOMIC512) << 1) - 2) |
+ ((pFile->sectorSize / 512 * SQLITE_IOCAP_ATOMIC512) << 1) - 2 |
SQLITE_IOCAP_SEQUENTIAL | /* The ram filesystem has no write behind
** so it is ordered */
0;
@@ -50878,11 +51022,6 @@ static int winFileControl(sqlite3_file *id, int op, void *pArg){
return SQLITE_OK;
}
#endif
- case SQLITE_FCNTL_NULL_IO: {
- (void)osCloseHandle(pFile->h);
- pFile->h = NULL;
- return SQLITE_OK;
- }
case SQLITE_FCNTL_TEMPFILENAME: {
char *zTFile = 0;
int rc = winGetTempname(pFile->pVfs, &zTFile);
@@ -50944,7 +51083,7 @@ static int winSectorSize(sqlite3_file *id){
*/
static int winDeviceCharacteristics(sqlite3_file *id){
winFile *p = (winFile*)id;
- return SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN | SQLITE_IOCAP_SUBPAGE_READ |
+ return SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN |
((p->ctrlFlags & WINFILE_PSOW)?SQLITE_IOCAP_POWERSAFE_OVERWRITE:0);
}
@@ -52332,7 +52471,7 @@ static int winOpen(
int rc = SQLITE_OK; /* Function Return Code */
#if !defined(NDEBUG) || SQLITE_OS_WINCE
- int eType = flags&0x0FFF00; /* Type of file to open */
+ int eType = flags&0xFFFFFF00; /* Type of file to open */
#endif
int isExclusive = (flags & SQLITE_OPEN_EXCLUSIVE);
@@ -56906,7 +57045,13 @@ static void pcache1Unpin(
assert( PAGE_IS_PINNED(pPage) );
if( reuseUnlikely || pGroup->nPurgeable>pGroup->nMaxPage ){
+ /* If pcache1.separateCache is set, temporarily set the isBulkLocal flag
+ ** so that pcache1RemoveFromHash() moves the page buffer to the pFree
+ ** list instead of sqlite3_free()ing it. */
+ u16 isBulkLocal = pPage->isBulkLocal;
+ pPage->isBulkLocal = (u16)pcache1.separateCache;
pcache1RemoveFromHash(pPage, 1);
+ pPage->isBulkLocal = isBulkLocal;
}else{
/* Add the page to the PGroup LRU list. */
PgHdr1 **ppFirst = &pGroup->lru.pLruNext;
@@ -57808,6 +57953,8 @@ SQLITE_PRIVATE int sqlite3WalInfo(Wal *pWal, u32 *pnPrior, u32 *pnFrame);
/* sqlite3_wal_info() data */
SQLITE_PRIVATE int sqlite3WalInfo(Wal *pWal, u32 *pnPrior, u32 *pnFrame);
+SQLITE_PRIVATE void sqlite3WalSetCommitTime(Wal *pWal, u64 *aCommitTime);
+
#endif /* ifndef SQLITE_OMIT_WAL */
#endif /* SQLITE_WAL_H */
@@ -58495,6 +58642,7 @@ struct Pager {
Wal *pWal; /* Write-ahead log used by "journal_mode=wal" */
char *zWal; /* File name for write-ahead log */
#endif
+ u64 *aCommitTime;
};
/*
@@ -58589,28 +58737,20 @@ static const unsigned char aJournalMagic[] = {
** Return true if page pgno can be read directly from the database file
** by the b-tree layer. This is the case if:
**
-** (1) the database file is open
-** (2) the VFS for the database is able to do unaligned sub-page reads
-** (3) there are no dirty pages in the cache, and
-** (4) the desired page is not currently in the wal file.
+** * the database file is open,
+** * there are no dirty pages in the cache, and
+** * the desired page is not currently in the wal file.
*/
SQLITE_PRIVATE int sqlite3PagerDirectReadOk(Pager *pPager, Pgno pgno){
- assert( pPager!=0 );
- assert( pPager->fd!=0 );
- if( pPager->fd->pMethods==0 ) return 0; /* Case (1) */
- if( sqlite3PCacheIsDirty(pPager->pPCache) ) return 0; /* Failed (3) */
+ if( pPager->fd->pMethods==0 ) return 0;
+ if( sqlite3PCacheIsDirty(pPager->pPCache) ) return 0;
#ifndef SQLITE_OMIT_WAL
if( pPager->pWal ){
u32 iRead = 0;
(void)sqlite3WalFindFrame(pPager->pWal, pgno, &iRead);
- if( iRead ) return 0; /* Case (4) */
+ return iRead==0;
}
#endif
- assert( pPager->fd->pMethods->xDeviceCharacteristics!=0 );
- if( (pPager->fd->pMethods->xDeviceCharacteristics(pPager->fd)
- & SQLITE_IOCAP_SUBPAGE_READ)==0 ){
- return 0; /* Case (2) */
- }
return 1;
}
#endif
@@ -60850,6 +60990,7 @@ static int pager_playback(Pager *pPager, int isHot){
static int readDbPage(PgHdr *pPg){
Pager *pPager = pPg->pPager; /* Pager object associated with page pPg */
int rc = SQLITE_OK; /* Return code */
+ u64 t1 = 0;
#ifndef SQLITE_OMIT_WAL
u32 iFrame = 0; /* Frame of WAL containing pgno */
@@ -60861,6 +61002,9 @@ static int readDbPage(PgHdr *pPg){
rc = sqlite3WalFindFrame(pPager->pWal, pPg->pgno, &iFrame);
if( rc ) return rc;
}
+ if( pPager->aCommitTime ){
+ t1 = sqlite3STimeNow();
+ }
if( iFrame ){
rc = sqlite3WalReadFrame(pPager->pWal, iFrame,pPager->pageSize,pPg->pData);
}else
@@ -60872,6 +61016,10 @@ static int readDbPage(PgHdr *pPg){
rc = SQLITE_OK;
}
}
+ if( pPager->aCommitTime ){
+ pPager->aCommitTime[COMMIT_TIME_RELOCATE2_READUS] += (sqlite3STimeNow() - t1);
+ pPager->aCommitTime[COMMIT_TIME_RELOCATE2_READCOUNT]++;
+ }
if( pPg->pgno==1 ){
if( rc ){
@@ -61063,6 +61211,7 @@ static int pagerWalFrames(
pPager->aStat[PAGER_STAT_WRITE] += nList;
if( pList->pgno==1 ) pager_write_changecounter(pList);
+ sqlite3CommitTimeSet(pPager->aCommitTime, COMMIT_TIME_AFTER_CHANGECOUNTER);
rc = sqlite3WalFrames(pPager->pWal,
pPager->pageSize, pList, nTruncate, isCommit, pPager->walSyncFlags
);
@@ -64453,7 +64602,9 @@ SQLITE_PRIVATE int sqlite3PagerCommitPhaseOne(
}
assert( rc==SQLITE_OK );
if( ALWAYS(pList) ){
+ sqlite3CommitTimeSet(pPager->aCommitTime, COMMIT_TIME_BEFORE_WALFRAMES);
rc = pagerWalFrames(pPager, pList, pPager->dbSize, 1);
+ sqlite3CommitTimeSet(pPager->aCommitTime, COMMIT_TIME_AFTER_WALFRAMES);
}
sqlite3PagerUnref(pPageOne);
if( rc==SQLITE_OK ){
@@ -64627,6 +64778,10 @@ SQLITE_PRIVATE int sqlite3PagerCommitPhaseOne(
return rc;
}
+SQLITE_PRIVATE void sqlite3PagerSetCommitTime(Pager *pPager, u64 *aCommitTime){
+ pPager->aCommitTime = aCommitTime;
+ sqlite3WalSetCommitTime(pPager->pWal, aCommitTime);
+}
/*
** When this function is called, the database file has been completely
@@ -65831,7 +65986,7 @@ SQLITE_PRIVATE int sqlite3PagerWalSystemErrno(Pager *pPager){
** 28: Checksum-2 (second part of checksum for first 24 bytes of header).
**
** Immediately following the wal-header are zero or more frames. Each
-** frame consists of a 24-byte frame-header followed by bytes
+** frame consists of a 24-byte frame-header followed by a bytes
** of page data. The frame-header is six big-endian 32-bit unsigned
** integer values, as follows:
**
@@ -66245,7 +66400,7 @@ SQLITE_PRIVATE int sqlite3WalTrace = 0;
** version-2 ("journal_mode=wal2"). Legacy clients may support version-1
** only.
*/
-#ifdef SQLITE_ENABLE_WAL_BIGHASH
+#ifdef SQLITE_WAL_BIGHASH
# define WAL_VERSION1 3007001 /* For "journal_mode=wal" */
# define WAL_VERSION2 3021001 /* For "journal_mode=wal2" */
#else
@@ -66253,13 +66408,12 @@ SQLITE_PRIVATE int sqlite3WalTrace = 0;
# define WAL_VERSION2 3021000 /* For "journal_mode=wal2" */
#endif
+#define SQLITE_ENABLE_WAL2NOCKSUM 1
+
#ifdef SQLITE_ENABLE_WAL2NOCKSUM
# undef WAL_VERSION2
-# ifdef SQLITE_ENABLE_WAL_BIGHASH
-# define WAL_VERSION2 3048001 /* wal2, big-hash, checksums on frame hdrs */
-# else
-# define WAL_VERSION2 3048000 /* wal2, big-hash, full checksums */
-# endif
+# define WAL_VERSION2 3048000 /* For "journal_mode=wal2" sans checksums */
+
# define isNocksum(pWal) isWalMode2(pWal)
#else
# define isNocksum(pWal) 0
@@ -66610,13 +66764,13 @@ struct Wal {
#endif
#ifdef SQLITE_ENABLE_SNAPSHOT
WalIndexHdr *pSnapshot; /* Start transaction here if not NULL */
- int bGetSnapshot; /* Transaction opened for sqlite3_get_snapshot() */
#endif
int bClosing; /* Set to true at start of sqlite3WalClose() */
int bWal2; /* bWal2 flag passed to WalOpen() */
#ifdef SQLITE_ENABLE_SETLK_TIMEOUT
sqlite3 *db;
#endif
+ u64 *aCommitTime;
};
/*
@@ -66637,7 +66791,7 @@ struct Wal {
** Each page of the wal-index mapping contains a hash-table made up of
** an array of HASHTABLE_NSLOT elements of the following type.
*/
-#ifdef SQLITE_ENABLE_WAL_BIGHASH
+#ifdef SQLITE_WAL_BIGHASH
typedef u32 ht_slot;
#else
typedef u16 ht_slot;
@@ -66678,7 +66832,7 @@ struct WalIterator {
** Changing any of these constants will alter the wal-index format and
** create incompatibilities.
*/
-#ifdef SQLITE_ENABLE_WAL_BIGHASH
+#ifdef SQLITE_WAL_BIGHASH
# define HASHTABLE_BITS 17 /* 128K frames per hash */
#else
# define HASHTABLE_BITS 12 /* 4K frames per hash */
@@ -66699,6 +66853,7 @@ struct WalIterator {
sizeof(ht_slot)*HASHTABLE_NSLOT + HASHTABLE_NPAGE*sizeof(u32) \
)
+
/*
** Structured Exception Handling (SEH) is a Windows-specific technique
** for catching exceptions raised while accessing memory-mapped files.
@@ -66805,7 +66960,6 @@ static void sehInjectFault(Wal *pWal){
# define SEH_SET_ON_ERROR(X,Y)
#endif /* ifdef SQLITE_USE_SEH */
-
/*
** Obtain a pointer to the iPage'th page of the wal-index. The wal-index
** is broken into pages of WALINDEX_PGSZ bytes. Wal-index pages are
@@ -66880,7 +67034,14 @@ static int walIndexPage(
){
SEH_INJECT_FAULT;
if( pWal->nWiData<=iPage || (*ppPage = pWal->apWiData[iPage])==0 ){
- return walIndexPageRealloc(pWal, iPage, ppPage);
+ int rc;
+ u64 t1;
+ if( pWal->aCommitTime ) t1 = sqlite3STimeNow();
+ rc = walIndexPageRealloc(pWal, iPage, ppPage);
+ if( pWal->aCommitTime ){
+ pWal->aCommitTime[COMMIT_TIME_HASHMAPUS] += sqlite3STimeNow() - t1;
+ }
+ return rc;
}
return SQLITE_OK;
}
@@ -67053,9 +67214,9 @@ static void walEncodeFrame(
if( pWal->iReCksum==0 ){
memcpy(&aFrame[8], pWal->hdr.aSalt, 8);
- nativeCksum = (pWal->hdr.bigEndCksum==SQLITE_BIGENDIAN);
- walChecksumBytes(nativeCksum, aFrame, 8, aCksum, aCksum);
if( isNocksum(pWal)==0 ){
+ nativeCksum = (pWal->hdr.bigEndCksum==SQLITE_BIGENDIAN);
+ walChecksumBytes(nativeCksum, aFrame, 8, aCksum, aCksum);
walChecksumBytes(nativeCksum, aData, pWal->szPage, aCksum, aCksum);
}
@@ -67103,16 +67264,16 @@ static int walDecodeFrame(
** and the frame-data matches the checksum in the last 8
** bytes of this frame-header.
*/
- nativeCksum = (pWal->hdr.bigEndCksum==SQLITE_BIGENDIAN);
- walChecksumBytes(nativeCksum, aFrame, 8, aCksum, aCksum);
if( isNocksum(pWal)==0 ){
+ nativeCksum = (pWal->hdr.bigEndCksum==SQLITE_BIGENDIAN);
+ walChecksumBytes(nativeCksum, aFrame, 8, aCksum, aCksum);
walChecksumBytes(nativeCksum, aData, pWal->szPage, aCksum, aCksum);
- }
- if( aCksum[0]!=sqlite3Get4byte(&aFrame[16])
- || aCksum[1]!=sqlite3Get4byte(&aFrame[20])
- ){
- /* Checksum failed. */
- return 0;
+ if( aCksum[0]!=sqlite3Get4byte(&aFrame[16])
+ || aCksum[1]!=sqlite3Get4byte(&aFrame[20])
+ ){
+ /* Checksum failed. */
+ return 0;
+ }
}
/* If we reach this point, the frame is valid. Return the page number
@@ -67426,6 +67587,29 @@ static void walCleanupHash(Wal *pWal){
#endif /* SQLITE_ENABLE_EXPENSIVE_ASSERT */
}
+/*
+** Zero the n byte block indicated by pointer p. n Must be a multiple of
+** 8, and p must be aligned to an 8-byte boundary.
+*/
+static void zero64(void *p, int n){
+#if defined(__x86_64__)
+ size_t c = n / sizeof(u64);
+ void *d = p;
+
+ assert( (n & 0x7)==0 );
+ assert( EIGHT_BYTE_ALIGNMENT(p) );
+
+ __asm__ volatile (
+ "rep stosq"
+ : "+D" (d), "+c" (c)
+ : "a" (0)
+ : "memory"
+ );
+#else
+ memset(p, 0, n);
+#endif
+}
+
/*
** Set an entry in the wal-index that will map database page number
** pPage into WAL frame iFrame.
@@ -67434,6 +67618,7 @@ static int walIndexAppend(Wal *pWal, int iWal, u32 iFrame, u32 iPage){
int rc; /* Return code */
WalHashLoc sLoc; /* Wal-index hash table location */
u32 iExternal;
+ u64 t;
if( isWalMode2(pWal) ){
iExternal = walExternalEncode(iWal, iFrame);
@@ -67442,7 +67627,11 @@ static int walIndexAppend(Wal *pWal, int iWal, u32 iFrame, u32 iPage){
iExternal = iFrame;
}
+ if( pWal->aCommitTime ) t = sqlite3STimeNow();
rc = walHashGet(pWal, walFramePage(iExternal), &sLoc);
+ if( pWal->aCommitTime ){
+ pWal->aCommitTime[COMMIT_TIME_WALINDEX_HASHGETUS] += sqlite3STimeNow()-t;
+ }
/* Assuming the wal-index file was successfully mapped, populate the
** page number array and hash table entry.
@@ -67458,10 +67647,14 @@ static int walIndexAppend(Wal *pWal, int iWal, u32 iFrame, u32 iPage){
/* If this is the first entry to be added to this hash-table, zero the
** entire hash table and aPgno[] array before proceeding.
*/
- if( idx==1 ){
- int nByte = (int)((u8*)&sLoc.aHash[HASHTABLE_NSLOT] - (u8*)sLoc.aPgno);
- assert( nByte>=0 );
- memset((void*)sLoc.aPgno, 0, nByte);
+ if( pWal->aCommitTime ) t = sqlite3STimeNow();
+ if( idx==1 && sLoc.aPgno[0]!=0 ){
+ /* Special for BEDROCK branch: Zero only the aHash[] part. Not the
+ ** aPgno[] part of the page. */
+ zero64((void*)sLoc.aHash, HASHTABLE_NSLOT * sizeof(sLoc.aHash[0]));
+ }
+ if( pWal->aCommitTime ){
+ pWal->aCommitTime[COMMIT_TIME_WALINDEX_MEMSETUS]+=sqlite3STimeNow()-t;
}
/* If the entry in aPgno[] is already set, then the previous writer
@@ -67469,21 +67662,42 @@ static int walIndexAppend(Wal *pWal, int iWal, u32 iFrame, u32 iPage){
** writing one or more dirty pages to the WAL to free up memory).
** Remove the remnants of that writers uncommitted transaction from
** the hash-table before writing any new entries.
- */
- if( sLoc.aPgno[idx-1] ){
- walCleanupHash(pWal);
- assert( !sLoc.aPgno[idx-1] );
+ **
+ ** Special for BEDROCK branch: On this branch we do not assume that
+ ** the aPgno[] part of each hash-table has been zeroed. Therefore, we
+ ** only need to clear out the remnants of an old writer's transaction if
+ ** the hash table matches the aPgno[] entry (as it would if a write
+ ** transaction was interrupted). And, because this makes the test more
+ ** expensive, we only do the check for the first frame written by each
+ ** transaction. */
+ if( sLoc.aPgno[idx-1] && iFrame-1==walidxGetMxFrame(&pWal->hdr, iWal) ){
+ if( pWal->aCommitTime ) t = sqlite3STimeNow();
+ nCollide = idx;
+ for(iKey=walHash(iPage); sLoc.aHash[iKey]; iKey=walNextHash(iKey)){
+ if( sLoc.aHash[iKey]==idx ){
+ walCleanupHash(pWal);
+ }
+ if( (nCollide--)==0 ) return SQLITE_CORRUPT_BKPT;
+ }
+ if( pWal->aCommitTime ){
+ pWal->aCommitTime[COMMIT_TIME_WALINDEX_CLEANUPUS]+=sqlite3STimeNow()-t;
+ }
}
/* Write the aPgno[] array entry and the hash-table slot. */
+ if( pWal->aCommitTime ) t = sqlite3STimeNow();
nCollide = idx;
for(iKey=walHash(iPage); sLoc.aHash[iKey]; iKey=walNextHash(iKey)){
if( (nCollide--)==0 ) return SQLITE_CORRUPT_BKPT;
}
sLoc.aPgno[idx-1] = iPage;
AtomicStore(&sLoc.aHash[iKey], (ht_slot)idx);
+ if( pWal->aCommitTime ){
+ pWal->aCommitTime[COMMIT_TIME_WALINDEX_ENTRYUS]+=sqlite3STimeNow()-t;
+ }
#ifdef SQLITE_ENABLE_EXPENSIVE_ASSERT
+ assert( this_should_not_be_enabled );
/* Verify that the number of entries in the hash table exactly equals
** the number of entries in the mapping region.
*/
@@ -67619,6 +67833,7 @@ static int walIndexRecoverOne(Wal *pWal, int iWal, u32 *pnCkpt, int *pbZero){
if( aShare==0 ) break;
SEH_SET_ON_ERROR(iPg, aShare);
pWal->apWiData[iPg] = aPrivate;
+ memset(aPrivate, 0, WALINDEX_PGSZ);
if( iWal ){
assert( version==WAL_VERSION2 );
@@ -67965,7 +68180,7 @@ SQLITE_PRIVATE int sqlite3WalOpen(
assert( 40 == sizeof(WalCkptInfo) );
assert( 120 == WALINDEX_LOCK_OFFSET );
assert( 136 == WALINDEX_HDR_SIZE );
-#ifndef SQLITE_ENABLE_WAL_BIGHASH
+#ifndef SQLITE_WAL_BIGHASH
assert( 4096 == HASHTABLE_NPAGE );
assert( 4062 == HASHTABLE_NPAGE_ONE );
assert( 8192 == HASHTABLE_NSLOT );
@@ -68749,6 +68964,39 @@ static int walCheckpoint(
}
}
+ if( bWal2 && rc==SQLITE_OK && eMode!=SQLITE_CHECKPOINT_PASSIVE ){
+ /* In wal2 mode, a non-passive checkpoint waits for all readers of
+ ** the wal file just checkpointed to finish, then zeroes the hash
+ ** tables associated with that wal file. This is because in some
+ ** deployments, zeroing the hash tables as they are overwritten within
+ ** COMMIT commands is a significant performance hit.
+ **
+ ** Currently, both of the "PART" locks are held for the wal file
+ ** being checkpointed. i.e. if iCkpt==0, then we already hold both
+ ** WAL_LOCK_PART1 and WAL_LOCK_PART1_FULL2. If we now also take an
+ ** exclusive lock on WAL_LOCK_PART2_FULL1, then it is guaranteed that
+ ** there are no remaining readers of the (iCkpt==0) wal file. Similar
+ ** logic, with different locks, is used for (iCkpt==1).
+ */
+ int lockIdx = WAL_READ_LOCK(
+ iCkpt==0 ? WAL_LOCK_PART2_FULL1 : WAL_LOCK_PART1_FULL2
+ );
+ assert( iCkpt==0 || iCkpt==1 );
+ rc = walBusyLock(pWal, xBusy, pBusyArg, lockIdx, 1);
+ if( rc==SQLITE_OK ){
+ int iHash;
+ for(iHash = walFramePage2(iCkpt, mxSafeFrame); iHash>=0; iHash-=2){
+ WalHashLoc sLoc;
+ int nByte;
+ memset(&sLoc, 0, sizeof(sLoc));
+ walHashGet(pWal, iHash, &sLoc);
+ nByte = (int)((u8*)&sLoc.aHash[HASHTABLE_NSLOT] - (u8*)sLoc.aPgno);
+ memset((void*)sLoc.aPgno, 0, nByte);
+ }
+ walUnlockExclusive(pWal, lockIdx, 1);
+ }
+ }
+
if( rc==SQLITE_BUSY ){
/* Reset the return code so as not to report a checkpoint failure
** just because there are active readers. */
@@ -68869,7 +69117,7 @@ static int walHandleException(Wal *pWal){
/*
** Assert that the Wal.lockMask mask, which indicates the locks held
-** by the connection, is consistent with the Wal.readLock, Wal.writeLock
+** by the connenction, is consistent with the Wal.readLock, Wal.writeLock
** and Wal.ckptLock variables. To be used as:
**
** assert( walAssertLockmask(pWal) );
@@ -69581,16 +69829,15 @@ static int walTryBeginRead(Wal *pWal, int *pChanged, int useWal, int *pCnt){
pWal->readLock = eLock;
}
assert( pWal->minFrame==0 && walFramePage(pWal->minFrame)==0 );
- }else
- {
+ }else{
u32 mxReadMark; /* Largest aReadMark[] value */
int mxI; /* Index of largest aReadMark[] value */
int i; /* Loop counter */
u32 mxFrame; /* Wal frame to lock to */
if( !useWal && pInfo->nBackfill==pWal->hdr.mxFrame
-#ifdef SQLITE_ENABLE_SNAPSHOT
- && ((pWal->bGetSnapshot==0 && pWal->pSnapshot==0) || pWal->hdr.mxFrame==0)
-#endif
+ #ifdef SQLITE_ENABLE_SNAPSHOT
+ && (pWal->pSnapshot==0 || pWal->hdr.mxFrame==0)
+ #endif
){
/* The WAL has been completely backfilled (or it is empty).
** and can be safely ignored.
@@ -69630,11 +69877,11 @@ static int walTryBeginRead(Wal *pWal, int *pChanged, int useWal, int *pCnt){
mxReadMark = 0;
mxI = 0;
mxFrame = pWal->hdr.mxFrame;
-#ifdef SQLITE_ENABLE_SNAPSHOT
+ #ifdef SQLITE_ENABLE_SNAPSHOT
if( pWal->pSnapshot && pWal->pSnapshot->mxFramepSnapshot->mxFrame;
}
-#endif
+ #endif
for(i=1; iaReadMark+i); SEH_INJECT_FAULT;
if( mxReadMark<=thisMark && thisMark<=mxFrame ){
@@ -69677,6 +69924,7 @@ static int walTryBeginRead(Wal *pWal, int *pChanged, int useWal, int *pCnt){
#endif
assert((rc&0xFF)!=SQLITE_BUSY||rc==SQLITE_BUSY||rc==SQLITE_BUSY_TIMEOUT);
return (rc&0xFF)==SQLITE_BUSY ? WAL_RETRY : rc;
+
}
/* Now that the read-lock has been obtained, check that neither the
** value in the aReadMark[] array or the contents of the wal-index
@@ -69973,6 +70221,7 @@ SQLITE_PRIVATE int sqlite3WalBeginReadTransaction(Wal *pWal, int *pChanged){
return rc;
}
+
/*
** Finish with a read transaction. All this does is release the
** read-lock.
@@ -70514,6 +70763,7 @@ static int walLockForCommit(
}
}
}
+
pWal->nPriorFrame = walGetPriorFrame(&pWal->hdr);
return rc;
}
@@ -70767,61 +71017,37 @@ static int walRestartLog(Wal *pWal){
int iApp = walidxGetFile(&pWal->hdr);
u32 nWalSize = WAL_DEFAULT_WALSIZE;
if( pWal->mxWalSize>0 ){
- /* mxWalSize is in bytes. Convert this to a number of frames. */
nWalSize = (pWal->mxWalSize-WAL_HDRSIZE+pWal->szPage+WAL_FRAME_HDRSIZE-1)
/ (pWal->szPage+WAL_FRAME_HDRSIZE);
nWalSize = MAX(nWalSize, 1);
}
- /* With a BEGIN CONCURRENT transaction, it is possible for a connection
- ** to hold the WAL_LOCK_PART1 lock even if iApp==1 (or WAL_LOCK_PART2
- ** when iApp==0). This is because a connection running concurrent to this
- ** one may have switched the wal file after this connection took the
- ** read lock.
- **
- ** This is not a problem, as if this happens it means the current lock
- ** is more restrictive, not less, than required. And a BEGIN CONCURRENT
- ** transaction cannot be committed and downgraded to a read-transaction,
- ** so there is no chance of continuing while holding the wrong lock.
- */
- assert( iApp==0 || pWal->readLock==WAL_LOCK_PART2
- || pWal->readLock==WAL_LOCK_PART2_FULL1
- || pWal->readLock==WAL_LOCK_PART1 );
- assert( iApp==1 || pWal->readLock==WAL_LOCK_PART1
- || pWal->readLock==WAL_LOCK_PART1_FULL2
- || pWal->readLock==WAL_LOCK_PART2 );
-
- /* Switch to wal file !iApp if
- **
- ** (a) Wal file iApp (the current wal file) contains >= nWalSize frames.
- ** (b) This client is not reading from wal file !iApp.
- ** (c) No other client is reading from wal file !iApp.
- **
- ** Condition (b) guarantees that wal file !iApp is either empty or
- ** completely checkpointed.
- */
- assert( (0*3)+1==WAL_LOCK_PART1 ); /* iApp==0 -> require WAL_LOCK_PART1 */
- assert( (1*3)+1==WAL_LOCK_PART2 ); /* iApp==1 -> require WAL_LOCK_PART2 */
- if( pWal->readLock==(iApp*3)+1
+ assert( 1==WAL_LOCK_PART1 );
+ assert( 4==WAL_LOCK_PART2 );
+ assert( 1+(iApp*3)==WAL_LOCK_PART1 || 1+(iApp*3)==WAL_LOCK_PART2 );
+ if( pWal->readLock==1+(iApp*3)
&& walidxGetMxFrame(&pWal->hdr, iApp)>=nWalSize
){
- rc = wal2RestartOk(pWal, iApp);
- if( rc==SQLITE_OK ){
- volatile WalCkptInfo *pInfo = walCkptInfo(pWal);
- int iNew = !iApp;
- pWal->nCkpt++;
- walidxSetFile(&pWal->hdr, iNew);
- walidxSetMxFrame(&pWal->hdr, iNew, 0);
- sqlite3Put4byte((u8*)&pWal->hdr.aSalt[0], pWal->hdr.aFrameCksum[0]);
- sqlite3Put4byte((u8*)&pWal->hdr.aSalt[1], pWal->hdr.aFrameCksum[1]);
- walIndexWriteHdr(pWal);
- pInfo->nBackfill = 0;
- wal2RestartFinished(pWal, iApp);
- walUnlockShared(pWal, WAL_READ_LOCK(pWal->readLock));
- pWal->readLock = iNew ? WAL_LOCK_PART2_FULL1 : WAL_LOCK_PART1_FULL2;
- rc = walLockShared(pWal, WAL_READ_LOCK(pWal->readLock));
- }else if( rc==SQLITE_BUSY ){
- rc = SQLITE_OK;
+ volatile WalCkptInfo *pInfo = walCkptInfo(pWal);
+ u32 mxFrame = walidxGetMxFrame(&pWal->hdr, !iApp);
+ if( mxFrame==0 || pInfo->nBackfill ){
+ rc = wal2RestartOk(pWal, iApp);
+ if( rc==SQLITE_OK ){
+ int iNew = !iApp;
+ pWal->nCkpt++;
+ walidxSetFile(&pWal->hdr, iNew);
+ walidxSetMxFrame(&pWal->hdr, iNew, 0);
+ sqlite3Put4byte((u8*)&pWal->hdr.aSalt[0], pWal->hdr.aFrameCksum[0]);
+ sqlite3Put4byte((u8*)&pWal->hdr.aSalt[1], pWal->hdr.aFrameCksum[1]);
+ walIndexWriteHdr(pWal);
+ pInfo->nBackfill = 0;
+ wal2RestartFinished(pWal, iApp);
+ walUnlockShared(pWal, WAL_READ_LOCK(pWal->readLock));
+ pWal->readLock = iNew ? WAL_LOCK_PART2_FULL1 : WAL_LOCK_PART1_FULL2;
+ rc = walLockShared(pWal, WAL_READ_LOCK(pWal->readLock));
+ }else if( rc==SQLITE_BUSY ){
+ rc = SQLITE_OK;
+ }
}
}
}else if( pWal->readLock==0 ){
@@ -70859,6 +71085,7 @@ static int walRestartLog(Wal *pWal){
** to the wal file. */
rc = walUpgradeReadlock(pWal);
}
+
pWal->nPriorFrame = walGetPriorFrame(&pWal->hdr);
return rc;
}
@@ -70891,6 +71118,7 @@ static int walWriteToLog(
sqlite3_int64 iOffset /* Start writing at this offset */
){
int rc;
+ u64 t;
if( iOffsetiSyncPoint && iOffset+iAmt>=p->iSyncPoint ){
int iFirstAmt = (int)(p->iSyncPoint - iOffset);
rc = sqlite3OsWrite(p->pFd, pContent, iFirstAmt, iOffset);
@@ -70902,7 +71130,13 @@ static int walWriteToLog(
rc = sqlite3OsSync(p->pFd, WAL_SYNC_FLAGS(p->syncFlags));
if( iAmt==0 || rc ) return rc;
}
+ if( p->pWal->aCommitTime ){
+ t = sqlite3STimeNow();
+ }
rc = sqlite3OsWrite(p->pFd, pContent, iAmt, iOffset);
+ if( p->pWal->aCommitTime ){
+ p->pWal->aCommitTime[COMMIT_TIME_OSWRITE] += (sqlite3STimeNow() - t);
+ }
return rc;
}
@@ -71028,6 +71262,9 @@ static int walFrames(
WalIndexHdr *pLive; /* Pointer to shared header */
int iApp;
int bWal2 = isWalMode2(pWal);
+ int nFrame = 0;
+
+ int logFlags = 0;
assert( pList );
assert( pWal->writeLock );
@@ -71049,6 +71286,8 @@ static int walFrames(
return rc;
}
+ sqlite3CommitTimeSet(pWal->aCommitTime, COMMIT_TIME_AFTER_RESTARTLOG);
+
/* If this is the first frame written into the log, write the WAL
** header to the start of the WAL file. See comments at the top of
** this source file for a description of the WAL header format.
@@ -71064,6 +71303,7 @@ static int walFrames(
}
#endif
+ logFlags |= (iFrame==0 ? 0x01 : 0x00);
if( iFrame==0 ){
u32 iCkpt = 0;
u8 aWalHdr[WAL_HDRSIZE]; /* Buffer to assemble wal-header in */
@@ -71117,6 +71357,7 @@ static int walFrames(
if( (int)pWal->szPage!=szPage ){
return SQLITE_CORRUPT_BKPT; /* TH3 test case: cov1/corrupt155.test */
}
+ sqlite3CommitTimeSet(pWal->aCommitTime, COMMIT_TIME_AFTER_WRITEHDR);
/* Setup information needed to write frames into the WAL */
w.pWal = pWal;
@@ -71128,6 +71369,7 @@ static int walFrames(
szFrame = szPage + WAL_FRAME_HDRSIZE;
/* Write all frames into the log file exactly once */
+ logFlags |= (iFirst==0 ? 0x00 : 0x02);
for(p=pList; p; p=p->pDirty){
int nDbSize; /* 0 normally. Positive == commit flag */
@@ -71166,8 +71408,10 @@ static int walFrames(
p->flags |= PGHDR_WAL_APPEND;
}
+ sqlite3CommitTimeSet(pWal->aCommitTime, COMMIT_TIME_AFTER_WRITEFRAMES);
/* Recalculate checksums within the wal file if required. */
+ logFlags |= (pWal->iReCksum==0 ? 0x00 : 0x04);
if( isCommit && pWal->iReCksum ){
rc = walRewriteChecksums(pWal, iFrame);
if( rc ) return rc;
@@ -71187,6 +71431,7 @@ static int walFrames(
** sector boundary is synced; the part of the last frame that extends
** past the sector boundary is written after the sync.
*/
+ logFlags |= (WAL_SYNC_FLAGS(sync_flags)==0 ? 0x00 : 0x08);
if( isCommit && WAL_SYNC_FLAGS(sync_flags)!=0 ){
int bSync = 1;
if( pWal->padToSectorBoundary ){
@@ -71221,6 +71466,8 @@ static int walFrames(
pWal->truncateOnCommit = 0;
}
+ sqlite3CommitTimeSet(pWal->aCommitTime, COMMIT_TIME_BEFORE_WALINDEX);
+
/* Append data to the wal-index. It is not necessary to lock the
** wal-index to do this as the SQLITE_SHM_WRITE lock held on the wal-index
** guarantees that there are no other writers, and no data that may
@@ -71231,6 +71478,7 @@ static int walFrames(
if( (p->flags & PGHDR_WAL_APPEND)==0 ) continue;
iFrame++;
rc = walIndexAppend(pWal, iApp, iFrame, p->pgno);
+ nFrame++;
}
assert( pLast!=0 || nExtra==0 );
while( rc==SQLITE_OK && nExtra>0 ){
@@ -71238,6 +71486,9 @@ static int walFrames(
nExtra--;
rc = walIndexAppend(pWal, iApp, iFrame, pLast->pgno);
}
+ if( pWal->aCommitTime ) pWal->aCommitTime[COMMIT_TIME_NFRAME] = nFrame;
+
+ sqlite3CommitTimeSet(pWal->aCommitTime, COMMIT_TIME_AFTER_WALINDEX);
if( rc==SQLITE_OK ){
/* Update the private copy of the header. */
@@ -71266,10 +71517,16 @@ static int walFrames(
}
}
+ sqlite3CommitTimeSet(pWal->aCommitTime, COMMIT_TIME_AFTER_WALINDEXHDR);
+ if( pWal->aCommitTime ){
+ pWal->aCommitTime[COMMIT_TIME_WALFRAMESFLAGS] = logFlags;
+ }
+
WALTRACE(("WAL%p: frame write %s\n", pWal, rc ? "failed" : "ok"));
return rc;
}
+
/*
** Write a set of frames to the log. The caller must hold the write-lock
** on the log file (obtained using sqlite3WalBeginWriteTransaction()).
@@ -71489,6 +71746,7 @@ SQLITE_PRIVATE int sqlite3WalCallback(Wal *pWal){
*/
SQLITE_PRIVATE int sqlite3WalExclusiveMode(Wal *pWal, int op){
int rc;
+
assert( pWal->writeLock==0 );
assert( pWal->exclusiveMode!=WAL_HEAPMEMORY_MODE || op==-1 );
@@ -71551,7 +71809,7 @@ SQLITE_PRIVATE int sqlite3WalSnapshotGet(Wal *pWal, sqlite3_snapshot **ppSnapsho
assert( pWal->readLock>=0 && pWal->writeLock==0 );
- if( memcmp(&pWal->hdr.aFrameCksum[0],aZero,16)==0 ){
+ if( memcmp(&pWal->hdr.aFrameCksum[0],aZero,8)==0 ){
*ppSnapshot = 0;
return SQLITE_ERROR;
}
@@ -71572,20 +71830,7 @@ SQLITE_PRIVATE void sqlite3WalSnapshotOpen(
Wal *pWal,
sqlite3_snapshot *pSnapshot
){
- if( pSnapshot && ((WalIndexHdr*)pSnapshot)->iVersion==0 ){
- /* iVersion==0 means that this is a call to sqlite3_snapshot_get(). In
- ** this case set the bGetSnapshot flag so that if the call to
- ** sqlite3_snapshot_get() is about to read transaction on this wal
- ** file, it does not take read-lock 0 if the wal file has been completely
- ** checkpointed. Taking read-lock 0 would work, but then it would be
- ** possible for a subsequent writer to destroy the snapshot even while
- ** this connection is holding its read-transaction open. This is contrary
- ** to user expectations, so we avoid it by not taking read-lock 0. */
- pWal->bGetSnapshot = 1;
- }else{
- pWal->pSnapshot = (WalIndexHdr*)pSnapshot;
- pWal->bGetSnapshot = 0;
- }
+ pWal->pSnapshot = (WalIndexHdr*)pSnapshot;
}
/*
@@ -71634,7 +71879,7 @@ SQLITE_PRIVATE int sqlite3WalSnapshotCheck(Wal *pWal, sqlite3_snapshot *pSnapsho
}
}
}
- SEH_EXCEPT( rc = walHandleException(pWal); )
+ SEH_EXCEPT( rc = walHandleException(pWal) );
return rc;
}
@@ -71688,6 +71933,12 @@ SQLITE_PRIVATE int sqlite3WalJournalMode(Wal *pWal){
return (isWalMode2(pWal) ? PAGER_JOURNALMODE_WAL2 : PAGER_JOURNALMODE_WAL);
}
+SQLITE_PRIVATE void sqlite3WalSetCommitTime(Wal *pWal, u64 *aCommitTime){
+ if( pWal ){
+ pWal->aCommitTime = aCommitTime;
+ }
+}
+
#endif /* #ifndef SQLITE_OMIT_WAL */
/************** End of wal.c *************************************************/
@@ -72183,6 +72434,8 @@ struct BtShared {
BtreePtrmap *pMap;
#endif
int nPreformatSize; /* Size of last cell written by TransferRow() */
+
+ u64 *aCommitTime;
};
/*
@@ -75992,7 +76245,9 @@ SQLITE_PRIVATE int sqlite3BtreeSetCacheSize(Btree *p, int mxPage){
BtShared *pBt = p->pBt;
assert( sqlite3_mutex_held(p->db->mutex) );
sqlite3BtreeEnter(p);
+ sqlite3PrepareTimeSet(p->db->aPrepareTime, PREPARE_TIME_BEGINSETCACHESIZE);
sqlite3PagerSetCachesize(pBt->pPager, mxPage);
+ sqlite3PrepareTimeSet(p->db->aPrepareTime, PREPARE_TIME_ENDSETCACHESIZE);
sqlite3BtreeLeave(p);
return SQLITE_OK;
}
@@ -77319,21 +77574,33 @@ static int btreeRelocateRange(
if( pEntry->eType==PTRMAP_FREEPAGE ){
Pgno dummy;
+ u64 t1;
+ if( pBt->aCommitTime ) t1 = sqlite3STimeNow();
rc = allocateBtreePage(pBt, &pFree, &dummy, iPg, BTALLOC_EXACT);
+ if( pBt->aCommitTime ){
+ pBt->aCommitTime[COMMIT_TIME_RELOCATE2_EXACTUS] += (sqlite3STimeNow() - t1);
+ }
if( pFree ){
assert( sqlite3PagerPageRefcount(pFree->pDbPage)==1 );
sqlite3PcacheDrop(pFree->pDbPage);
}
assert( rc!=SQLITE_OK || dummy==iPg );
}else if( pnCurrent ){
+ u64 t1;
btreeGetPage(pBt, iPg, &pPg, 0);
assert( sqlite3PagerIswriteable(pPg->pDbPage) );
assert( sqlite3PagerPageRefcount(pPg->pDbPage)==1 );
iNew = ++(*pnCurrent);
if( iNew==PENDING_BYTE_PAGE(pBt) ) iNew = ++(*pnCurrent);
+ if( pBt->aCommitTime ) t1 = sqlite3STimeNow();
rc = relocatePage(pBt, pPg, pEntry->eType, pEntry->parent, iNew, 1);
+ if( pBt->aCommitTime ){
+ pBt->aCommitTime[COMMIT_TIME_RELOCATE2_RELOCATEUS] += (sqlite3STimeNow() - t1);
+ }
releasePageNotNull(pPg);
}else if( pEntry->eType!=0 ){
+ u64 t1;
+ if( pBt->aCommitTime ) t1 = sqlite3STimeNow();
/* Allocate a new page from the free-list to move page iPg to.
** Except - if the page allocated is within the range being relocated
@@ -77349,11 +77616,18 @@ static int btreeRelocateRange(
}
}while( pFree==0 );
+ if( pBt->aCommitTime ){
+ pBt->aCommitTime[COMMIT_TIME_RELOCATE2_ALLOCATEUS] += (sqlite3STimeNow() - t1);
+ }
assert( rc!=SQLITE_OK || iNewaCommitTime ) t1 = sqlite3STimeNow();
rc = relocatePage(pBt, pPg, pEntry->eType, pEntry->parent,iNew,1);
+ if( pBt->aCommitTime ){
+ pBt->aCommitTime[COMMIT_TIME_RELOCATE2_RELOCATEUS] += (sqlite3STimeNow() - t1);
+ }
releasePage(pPg);
}
}
@@ -77383,6 +77657,8 @@ static int btreeFixUnlocked(Btree *p){
Pgno nPage = btreePagecount(pBt);
u32 nFree = get4byte(&p1[36]);
+ sqlite3CommitTimeSet(p->pBt->aCommitTime, COMMIT_TIME_START_FIXUNLOCKED);
+
assert( pBt->pMap );
rc = sqlite3PagerUpgradeSnapshot(pPager, pPage1->pDbPage);
assert( p1==pPage1->aData );
@@ -77429,6 +77705,7 @@ static int btreeFixUnlocked(Btree *p){
nCurrent = MAX(nPage, nHPage);
pBt->nPage = nCurrent;
+ sqlite3CommitTimeSet(p->pBt->aCommitTime, COMMIT_TIME_START_RELOCATE1);
rc = btreeRelocateRange(pBt, pMap->iFirst, iLast, &nCurrent);
/* There are now no collisions with the snapshot at the head of the
@@ -77445,7 +77722,17 @@ static int btreeFixUnlocked(Btree *p){
nFin--;
}
nFin = MAX(nFin, nHPage);
+ if( p->pBt->aCommitTime ){
+ p->pBt->aCommitTime[COMMIT_TIME_OTHERWRITERS] = (1+nHPage-pMap->iFirst);
+ p->pBt->aCommitTime[COMMIT_TIME_RELOCATE1COUNT] = (1+iLast-pMap->iFirst);
+ p->pBt->aCommitTime[COMMIT_TIME_RELOCATE2COUNT] = (nCurrent - nFin);
+ }
+ sqlite3CommitTimeSet(
+ p->pBt->aCommitTime, COMMIT_TIME_START_RELOCATE2
+ );
+ sqlite3PagerSetCommitTime(pBt->pPager, pBt->aCommitTime);
rc = btreeRelocateRange(pBt, nFin+1, nCurrent, 0);
+ sqlite3PagerSetCommitTime(pBt->pPager, 0);
}
put4byte(&p1[28], nFin);
@@ -77510,9 +77797,12 @@ SQLITE_PRIVATE int sqlite3BtreeCommitPhaseOne(Btree *p, const char *zSuperJrnl){
#endif
if( rc==SQLITE_OK && ISCONCURRENT && p->db->eConcurrent==CONCURRENT_OPEN ){
rc = btreeFixUnlocked(p);
+ sqlite3CommitTimeSet(p->pBt->aCommitTime, COMMIT_TIME_AFTER_FIXUNLOCKED);
}
if( rc==SQLITE_OK ){
+ sqlite3PagerSetCommitTime(pBt->pPager, p->pBt->aCommitTime);
rc = sqlite3PagerCommitPhaseOne(pBt->pPager, zSuperJrnl, 0);
+ sqlite3PagerSetCommitTime(pBt->pPager, 0);
}
#ifndef SQLITE_OMIT_CONCURRENT
if( rc==SQLITE_OK ){
@@ -77617,7 +77907,9 @@ SQLITE_PRIVATE int sqlite3BtreeCommitPhaseTwo(Btree *p, int bCleanup){
BtShared *pBt = p->pBt;
assert( pBt->inTransaction==TRANS_WRITE );
assert( pBt->nTransaction>0 );
+ sqlite3PagerSetCommitTime(pBt->pPager, p->pBt->aCommitTime);
rc = sqlite3PagerCommitPhaseTwo(pBt->pPager);
+ sqlite3PagerSetCommitTime(pBt->pPager, 0);
if( rc!=SQLITE_OK && bCleanup==0 ){
sqlite3BtreeLeave(p);
return rc;
@@ -78000,25 +78292,6 @@ SQLITE_PRIVATE int sqlite3BtreeCursorSize(void){
return ROUND8(sizeof(BtCursor));
}
-#ifdef SQLITE_DEBUG
-/*
-** Return true if and only if the Btree object will be automatically
-** closed with the BtCursor closes. This is used within assert() statements
-** only.
-*/
-SQLITE_PRIVATE int sqlite3BtreeClosesWithCursor(
- Btree *pBtree, /* the btree object */
- BtCursor *pCur /* Corresponding cursor */
-){
- BtShared *pBt = pBtree->pBt;
- if( (pBt->openFlags & BTREE_SINGLE)==0 ) return 0;
- if( pBt->pCursor!=pCur ) return 0;
- if( pCur->pNext!=0 ) return 0;
- if( pCur->pBtree!=pBtree ) return 0;
- return 1;
-}
-#endif
-
/*
** Initialize memory that will be converted into a BtCursor object.
**
@@ -86732,30 +87005,27 @@ SQLITE_PRIVATE int sqlite3VdbeMemTooBig(Mem *p){
SQLITE_PRIVATE void sqlite3VdbeMemAboutToChange(Vdbe *pVdbe, Mem *pMem){
int i;
Mem *pX;
- if( pMem->bScopy ){
- for(i=1, pX=pVdbe->aMem+1; inMem; i++, pX++){
- if( pX->pScopyFrom==pMem ){
- u16 mFlags;
- if( pVdbe->db->flags & SQLITE_VdbeTrace ){
- sqlite3DebugPrintf("Invalidate R[%d] due to change in R[%d]\n",
- (int)(pX - pVdbe->aMem), (int)(pMem - pVdbe->aMem));
- }
- /* If pX is marked as a shallow copy of pMem, then try to verify that
- ** no significant changes have been made to pX since the OP_SCopy.
- ** A significant change would indicated a missed call to this
- ** function for pX. Minor changes, such as adding or removing a
- ** dual type, are allowed, as long as the underlying value is the
- ** same. */
- mFlags = pMem->flags & pX->flags & pX->mScopyFlags;
- assert( (mFlags&(MEM_Int|MEM_IntReal))==0 || pMem->u.i==pX->u.i );
-
- /* pMem is the register that is changing. But also mark pX as
- ** undefined so that we can quickly detect the shallow-copy error */
- pX->flags = MEM_Undefined;
- pX->pScopyFrom = 0;
- }
- }
- pMem->bScopy = 0;
+ for(i=1, pX=pVdbe->aMem+1; inMem; i++, pX++){
+ if( pX->pScopyFrom==pMem ){
+ u16 mFlags;
+ if( pVdbe->db->flags & SQLITE_VdbeTrace ){
+ sqlite3DebugPrintf("Invalidate R[%d] due to change in R[%d]\n",
+ (int)(pX - pVdbe->aMem), (int)(pMem - pVdbe->aMem));
+ }
+ /* If pX is marked as a shallow copy of pMem, then try to verify that
+ ** no significant changes have been made to pX since the OP_SCopy.
+ ** A significant change would indicated a missed call to this
+ ** function for pX. Minor changes, such as adding or removing a
+ ** dual type, are allowed, as long as the underlying value is the
+ ** same. */
+ mFlags = pMem->flags & pX->flags & pX->mScopyFlags;
+ assert( (mFlags&(MEM_Int|MEM_IntReal))==0 || pMem->u.i==pX->u.i );
+
+ /* pMem is the register that is changing. But also mark pX as
+ ** undefined so that we can quickly detect the shallow-copy error */
+ pX->flags = MEM_Undefined;
+ pX->pScopyFrom = 0;
+ }
}
pMem->pScopyFrom = 0;
}
@@ -87223,8 +87493,7 @@ static int valueFromFunction(
goto value_from_function_out;
}
for(i=0; ipParse, pList->a[i].pExpr, aff,
- &apVal[i]);
+ rc = sqlite3ValueFromExpr(db, pList->a[i].pExpr, enc, aff, &apVal[i]);
if( apVal[i]==0 || rc!=SQLITE_OK ) goto value_from_function_out;
}
}
@@ -87760,6 +88029,8 @@ SQLITE_PRIVATE int sqlite3ValueBytes(sqlite3_value *pVal, u8 enc){
/* #include "sqliteInt.h" */
/* #include "vdbeInt.h" */
+/* #include "btreeInt.h" */
+
/* Forward references */
static void freeEphemeralFunction(sqlite3 *db, FuncDef *pDef);
static void vdbeFreeOpArray(sqlite3 *, Op *, int);
@@ -89889,7 +90160,6 @@ SQLITE_PRIVATE void sqlite3VdbePrintOp(FILE *pOut, int pc, VdbeOp *pOp){
** will be initialized before use.
*/
static void initMemArray(Mem *p, int N, sqlite3 *db, u16 flags){
- assert( db!=0 );
if( N>0 ){
do{
p->flags = flags;
@@ -89897,7 +90167,6 @@ static void initMemArray(Mem *p, int N, sqlite3 *db, u16 flags){
p->szMalloc = 0;
#ifdef SQLITE_DEBUG
p->pScopyFrom = 0;
- p->bScopy = 0;
#endif
p++;
}while( (--N)>0 );
@@ -89916,7 +90185,6 @@ static void releaseMemArray(Mem *p, int N){
if( p && N ){
Mem *pEnd = &p[N];
sqlite3 *db = p->db;
- assert( db!=0 );
if( db->pnBytesFreed ){
do{
if( p->szMalloc ) sqlite3DbFree(db, p->zMalloc);
@@ -90397,7 +90665,6 @@ SQLITE_PRIVATE void sqlite3VdbeMakeReady(
assert( pParse!=0 );
assert( p->eVdbeState==VDBE_INIT_STATE );
assert( pParse==p->pParse );
- assert( pParse->db==p->db );
p->pVList = pParse->pVList;
pParse->pVList = 0;
db = p->db;
@@ -90749,13 +91016,18 @@ static int vdbeCommit(sqlite3 *db, Vdbe *p){
if( 0==sqlite3Strlen30(sqlite3BtreeGetFilename(db->aDb[0].pBt))
|| nTrans<=1
){
+ sqlite3CommitTimeSet(p->aCommitTime, COMMIT_TIME_BEFORE_PHASEONE);
for(i=0; rc==SQLITE_OK && inDb; i++){
Btree *pBt = db->aDb[i].pBt;
if( pBt ){
+ pBt->pBt->aCommitTime = p->aCommitTime;
rc = sqlite3BtreeCommitPhaseOne(pBt, 0);
+ pBt->pBt->aCommitTime = 0;
}
}
+ sqlite3CommitTimeSet(p->aCommitTime, COMMIT_TIME_BEFORE_PHASETWO);
+
/* Do the commit only if all databases successfully complete phase 1.
** If one of the BtreeCommitPhaseOne() calls fails, this indicates an
** IO error while deleting or truncating a journal file. It is unlikely,
@@ -90764,9 +91036,13 @@ static int vdbeCommit(sqlite3 *db, Vdbe *p){
for(i=0; rc==SQLITE_OK && inDb; i++){
Btree *pBt = db->aDb[i].pBt;
if( pBt ){
+ pBt->pBt->aCommitTime = p->aCommitTime;
rc = sqlite3BtreeCommitPhaseTwo(pBt, 0);
+ pBt->pBt->aCommitTime = 0;
}
}
+
+ sqlite3CommitTimeSet(p->aCommitTime, COMMIT_TIME_AFTER_PHASETWO);
if( rc==SQLITE_OK ){
sqlite3VtabCommit(db);
}
@@ -91163,7 +91439,9 @@ SQLITE_PRIVATE int sqlite3VdbeHalt(Vdbe *p){
** or hit an 'OR FAIL' constraint and there are no deferred foreign
** key constraints to hold up the transaction. This means a commit
** is required. */
+ sqlite3CommitTimeSet(p->aCommitTime, COMMIT_TIME_BEFORE_VDBECOMMIT);
rc = vdbeCommit(db, p);
+ sqlite3CommitTimeSet(p->aCommitTime, COMMIT_TIME_AFTER_VDBECOMMIT);
}
if( (rc & 0xFF)==SQLITE_BUSY && p->readOnly ){
sqlite3VdbeLeave(p);
@@ -92282,7 +92560,7 @@ SQLITE_PRIVATE SQLITE_NOINLINE int sqlite3BlobCompare(const Mem *pB1, const Mem
** We must use separate SQLITE_NOINLINE functions here, since otherwise
** optimizer code movement causes gcov to become very confused.
*/
-#if defined(SQLITE_COVERAGE_TEST) || defined(SQLITE_DEBUG)
+#if defined(SQLITE_COVERAGE_TEST) || defined(SQLITE_DEBUG)
static int SQLITE_NOINLINE doubleLt(double a, double b){ return ar );
+ testcase( x==r );
+ return (xr);
}else{
i64 y;
if( r<-9223372036854775808.0 ) return +1;
@@ -93188,6 +93473,101 @@ SQLITE_PRIVATE int sqlite3CursorRangeHintExprCheck(Walker *pWalker, Expr *pExpr)
}
#endif /* SQLITE_ENABLE_CURSOR_HINTS && SQLITE_DEBUG */
+/* #include */
+SQLITE_PRIVATE void sqlite3CommitTimeLog(u64 *aCommit){
+ u64 i1 = aCommit[COMMIT_TIME_START];
+ assert( COMMIT_TIME_START==0 && COMMIT_TIME_FINISH==COMMIT_TIME_N-1 );
+ if( aCommit[COMMIT_TIME_FINISH]>(i1+COMMIT_TIME_TIMEOUT) ){
+ char *zStr = 0;
+ int ii;
+ for(ii=1; ii(i1+PREPARE_TIME_TIMEOUT) ){
+ int nByte = nSql;
+ char *zStr = 0;
+ int ii;
+ for(ii=1; ii(i1+SCHEMA_TIME_TIMEOUT) ){
+ char *zStr = 0;
+ int ii;
+ for(ii=1; iinField; i++){
@@ -93307,13 +93686,6 @@ SQLITE_PRIVATE void sqlite3VdbePreUpdateHook(
}
sqlite3DbNNFreeNN(db, preupdate.aNew);
}
- if( preupdate.apDflt ){
- int i;
- for(i=0; inCol; i++){
- sqlite3ValueFree(preupdate.apDflt[i]);
- }
- sqlite3DbFree(db, preupdate.apDflt);
- }
}
#endif /* SQLITE_ENABLE_PREUPDATE_HOOK */
@@ -93384,6 +93756,7 @@ static SQLITE_NOINLINE void invokeProfileCallback(sqlite3 *db, Vdbe *p){
sqlite3_int64 iNow;
sqlite3_int64 iElapse;
assert( p->startTime>0 );
+ assert( (db->mTrace & (SQLITE_TRACE_PROFILE|SQLITE_TRACE_XPROFILE))!=0 );
assert( db->init.busy==0 );
assert( p->zSql!=0 );
sqlite3OsCurrentTimeInt64(db->pVfs, &iNow);
@@ -94103,7 +94476,7 @@ static int sqlite3Step(Vdbe *p){
}
assert( db->nVdbeWrite>0 || db->autoCommit==0
- || ((db->nDeferredCons + db->nDeferredImmCons)==0)
+ || (db->nDeferredCons==0 && db->nDeferredImmCons==0)
);
#ifndef SQLITE_OMIT_TRACE
@@ -94614,7 +94987,6 @@ static const Mem *columnNullValue(void){
#ifdef SQLITE_DEBUG
/* .pScopyFrom = */ (Mem*)0,
/* .mScopyFlags= */ 0,
- /* .bScopy = */ 0,
#endif
};
return &nullMem;
@@ -94656,7 +95028,7 @@ static Mem *columnMem(sqlite3_stmt *pStmt, int i){
** sqlite3_column_int64()
** sqlite3_column_text()
** sqlite3_column_text16()
-** sqlite3_column_double()
+** sqlite3_column_real()
** sqlite3_column_bytes()
** sqlite3_column_bytes16()
** sqlite3_column_blob()
@@ -94942,17 +95314,6 @@ SQLITE_API const void *sqlite3_column_origin_name16(sqlite3_stmt *pStmt, int N){
**
** The error code stored in database p->db is overwritten with the return
** value in any case.
-**
-** (tag-20240917-01) If vdbeUnbind(p,(u32)(i-1)) returns SQLITE_OK,
-** that means all of the the following will be true:
-**
-** p!=0
-** p->pVar!=0
-** i>0
-** i<=p->nVar
-**
-** An assert() is normally added after vdbeUnbind() to help static analyzers
-** realize this.
*/
static int vdbeUnbind(Vdbe *p, unsigned int i){
Mem *pVar;
@@ -95010,7 +95371,6 @@ static int bindText(
rc = vdbeUnbind(p, (u32)(i-1));
if( rc==SQLITE_OK ){
- assert( p!=0 && p->aVar!=0 && i>0 && i<=p->nVar ); /* tag-20240917-01 */
if( zData!=0 ){
pVar = &p->aVar[i-1];
rc = sqlite3VdbeMemSetStr(pVar, zData, nData, encoding, xDel);
@@ -95060,7 +95420,6 @@ SQLITE_API int sqlite3_bind_double(sqlite3_stmt *pStmt, int i, double rValue){
Vdbe *p = (Vdbe *)pStmt;
rc = vdbeUnbind(p, (u32)(i-1));
if( rc==SQLITE_OK ){
- assert( p!=0 && p->aVar!=0 && i>0 && i<=p->nVar ); /* tag-20240917-01 */
sqlite3VdbeMemSetDouble(&p->aVar[i-1], rValue);
sqlite3_mutex_leave(p->db->mutex);
}
@@ -95074,7 +95433,6 @@ SQLITE_API int sqlite3_bind_int64(sqlite3_stmt *pStmt, int i, sqlite_int64 iValu
Vdbe *p = (Vdbe *)pStmt;
rc = vdbeUnbind(p, (u32)(i-1));
if( rc==SQLITE_OK ){
- assert( p!=0 && p->aVar!=0 && i>0 && i<=p->nVar ); /* tag-20240917-01 */
sqlite3VdbeMemSetInt64(&p->aVar[i-1], iValue);
sqlite3_mutex_leave(p->db->mutex);
}
@@ -95085,7 +95443,6 @@ SQLITE_API int sqlite3_bind_null(sqlite3_stmt *pStmt, int i){
Vdbe *p = (Vdbe*)pStmt;
rc = vdbeUnbind(p, (u32)(i-1));
if( rc==SQLITE_OK ){
- assert( p!=0 && p->aVar!=0 && i>0 && i<=p->nVar ); /* tag-20240917-01 */
sqlite3_mutex_leave(p->db->mutex);
}
return rc;
@@ -95101,7 +95458,6 @@ SQLITE_API int sqlite3_bind_pointer(
Vdbe *p = (Vdbe*)pStmt;
rc = vdbeUnbind(p, (u32)(i-1));
if( rc==SQLITE_OK ){
- assert( p!=0 && p->aVar!=0 && i>0 && i<=p->nVar ); /* tag-20240917-01 */
sqlite3VdbeMemSetPointer(&p->aVar[i-1], pPtr, zPTtype, xDestructor);
sqlite3_mutex_leave(p->db->mutex);
}else if( xDestructor ){
@@ -95183,7 +95539,6 @@ SQLITE_API int sqlite3_bind_zeroblob(sqlite3_stmt *pStmt, int i, int n){
Vdbe *p = (Vdbe *)pStmt;
rc = vdbeUnbind(p, (u32)(i-1));
if( rc==SQLITE_OK ){
- assert( p!=0 && p->aVar!=0 && i>0 && i<=p->nVar ); /* tag-20240917-01 */
#ifndef SQLITE_OMIT_INCRBLOB
sqlite3VdbeMemSetZeroBlob(&p->aVar[i-1], n);
#else
@@ -95497,7 +95852,6 @@ SQLITE_API int sqlite3_preupdate_old(sqlite3 *db, int iIdx, sqlite3_value **ppVa
PreUpdate *p;
Mem *pMem;
int rc = SQLITE_OK;
- int iStore = 0;
#ifdef SQLITE_ENABLE_API_ARMOR
if( db==0 || ppValue==0 ){
@@ -95512,73 +95866,44 @@ SQLITE_API int sqlite3_preupdate_old(sqlite3 *db, int iIdx, sqlite3_value **ppVa
goto preupdate_old_out;
}
if( p->pPk ){
- iStore = sqlite3TableColumnToIndex(p->pPk, iIdx);
- }else{
- iStore = sqlite3TableColumnToStorage(p->pTab, iIdx);
+ iIdx = sqlite3TableColumnToIndex(p->pPk, iIdx);
}
- if( iStore>=p->pCsr->nField || iStore<0 ){
+ if( iIdx>=p->pCsr->nField || iIdx<0 ){
rc = SQLITE_RANGE;
goto preupdate_old_out;
}
- if( iIdx==p->pTab->iPKey ){
- *ppValue = pMem = &p->oldipk;
- sqlite3VdbeMemSetInt64(pMem, p->iKey1);
- }else{
+ /* If the old.* record has not yet been loaded into memory, do so now. */
+ if( p->pUnpacked==0 ){
+ u32 nRec;
+ u8 *aRec;
- /* If the old.* record has not yet been loaded into memory, do so now. */
- if( p->pUnpacked==0 ){
- u32 nRec;
- u8 *aRec;
-
- assert( p->pCsr->eCurType==CURTYPE_BTREE );
- nRec = sqlite3BtreePayloadSize(p->pCsr->uc.pCursor);
- aRec = sqlite3DbMallocRaw(db, nRec);
- if( !aRec ) goto preupdate_old_out;
- rc = sqlite3BtreePayload(p->pCsr->uc.pCursor, 0, nRec, aRec);
- if( rc==SQLITE_OK ){
- p->pUnpacked = vdbeUnpackRecord(&p->keyinfo, nRec, aRec);
- if( !p->pUnpacked ) rc = SQLITE_NOMEM;
- }
- if( rc!=SQLITE_OK ){
- sqlite3DbFree(db, aRec);
- goto preupdate_old_out;
- }
- p->aRecord = aRec;
+ assert( p->pCsr->eCurType==CURTYPE_BTREE );
+ nRec = sqlite3BtreePayloadSize(p->pCsr->uc.pCursor);
+ aRec = sqlite3DbMallocRaw(db, nRec);
+ if( !aRec ) goto preupdate_old_out;
+ rc = sqlite3BtreePayload(p->pCsr->uc.pCursor, 0, nRec, aRec);
+ if( rc==SQLITE_OK ){
+ p->pUnpacked = vdbeUnpackRecord(&p->keyinfo, nRec, aRec);
+ if( !p->pUnpacked ) rc = SQLITE_NOMEM;
}
+ if( rc!=SQLITE_OK ){
+ sqlite3DbFree(db, aRec);
+ goto preupdate_old_out;
+ }
+ p->aRecord = aRec;
+ }
- pMem = *ppValue = &p->pUnpacked->aMem[iStore];
- if( iStore>=p->pUnpacked->nField ){
- /* This occurs when the table has been extended using ALTER TABLE
- ** ADD COLUMN. The value to return is the default value of the column. */
- Column *pCol = &p->pTab->aCol[iIdx];
- if( pCol->iDflt>0 ){
- if( p->apDflt==0 ){
- int nByte = sizeof(sqlite3_value*)*p->pTab->nCol;
- p->apDflt = (sqlite3_value**)sqlite3DbMallocZero(db, nByte);
- if( p->apDflt==0 ) goto preupdate_old_out;
- }
- if( p->apDflt[iIdx]==0 ){
- sqlite3_value *pVal = 0;
- Expr *pDflt;
- assert( p->pTab!=0 && IsOrdinaryTable(p->pTab) );
- pDflt = p->pTab->u.tab.pDfltList->a[pCol->iDflt-1].pExpr;
- rc = sqlite3ValueFromExpr(db, pDflt, ENC(db), pCol->affinity, &pVal);
- if( rc==SQLITE_OK && pVal==0 ){
- rc = SQLITE_CORRUPT_BKPT;
- }
- p->apDflt[iIdx] = pVal;
- }
- *ppValue = p->apDflt[iIdx];
- }else{
- *ppValue = (sqlite3_value *)columnNullValue();
- }
- }else if( p->pTab->aCol[iIdx].affinity==SQLITE_AFF_REAL ){
- if( pMem->flags & (MEM_Int|MEM_IntReal) ){
- testcase( pMem->flags & MEM_Int );
- testcase( pMem->flags & MEM_IntReal );
- sqlite3VdbeMemRealify(pMem);
- }
+ pMem = *ppValue = &p->pUnpacked->aMem[iIdx];
+ if( iIdx==p->pTab->iPKey ){
+ sqlite3VdbeMemSetInt64(pMem, p->iKey1);
+ }else if( iIdx>=p->pUnpacked->nField ){
+ *ppValue = (sqlite3_value *)columnNullValue();
+ }else if( p->pTab->aCol[iIdx].affinity==SQLITE_AFF_REAL ){
+ if( pMem->flags & (MEM_Int|MEM_IntReal) ){
+ testcase( pMem->flags & MEM_Int );
+ testcase( pMem->flags & MEM_IntReal );
+ sqlite3VdbeMemRealify(pMem);
}
}
@@ -95652,7 +95977,6 @@ SQLITE_API int sqlite3_preupdate_new(sqlite3 *db, int iIdx, sqlite3_value **ppVa
PreUpdate *p;
int rc = SQLITE_OK;
Mem *pMem;
- int iStore = 0;
#ifdef SQLITE_ENABLE_API_ARMOR
if( db==0 || ppValue==0 ){
@@ -95665,12 +95989,9 @@ SQLITE_API int sqlite3_preupdate_new(sqlite3 *db, int iIdx, sqlite3_value **ppVa
goto preupdate_new_out;
}
if( p->pPk && p->op!=SQLITE_UPDATE ){
- iStore = sqlite3TableColumnToIndex(p->pPk, iIdx);
- }else{
- iStore = sqlite3TableColumnToStorage(p->pTab, iIdx);
+ iIdx = sqlite3TableColumnToIndex(p->pPk, iIdx);
}
-
- if( iStore>=p->pCsr->nField || iStore<0 ){
+ if( iIdx>=p->pCsr->nField || iIdx<0 ){
rc = SQLITE_RANGE;
goto preupdate_new_out;
}
@@ -95690,14 +96011,14 @@ SQLITE_API int sqlite3_preupdate_new(sqlite3 *db, int iIdx, sqlite3_value **ppVa
}
p->pNewUnpacked = pUnpack;
}
- pMem = &pUnpack->aMem[iStore];
+ pMem = &pUnpack->aMem[iIdx];
if( iIdx==p->pTab->iPKey ){
sqlite3VdbeMemSetInt64(pMem, p->iKey2);
- }else if( iStore>=pUnpack->nField ){
+ }else if( iIdx>=pUnpack->nField ){
pMem = (sqlite3_value *)columnNullValue();
}
}else{
- /* For an UPDATE, memory cell (p->iNewReg+1+iStore) contains the required
+ /* For an UPDATE, memory cell (p->iNewReg+1+iIdx) contains the required
** value. Make a copy of the cell contents and return a pointer to it.
** It is not safe to return a pointer to the memory cell itself as the
** caller may modify the value text encoding.
@@ -95710,13 +96031,13 @@ SQLITE_API int sqlite3_preupdate_new(sqlite3 *db, int iIdx, sqlite3_value **ppVa
goto preupdate_new_out;
}
}
- assert( iStore>=0 && iStorepCsr->nField );
- pMem = &p->aNew[iStore];
+ assert( iIdx>=0 && iIdxpCsr->nField );
+ pMem = &p->aNew[iIdx];
if( pMem->flags==0 ){
if( iIdx==p->pTab->iPKey ){
sqlite3VdbeMemSetInt64(pMem, p->iKey2);
}else{
- rc = sqlite3VdbeMemCopy(pMem, &p->v->aMem[p->iNewReg+1+iStore]);
+ rc = sqlite3VdbeMemCopy(pMem, &p->v->aMem[p->iNewReg+1+iIdx]);
if( rc!=SQLITE_OK ) goto preupdate_new_out;
}
}
@@ -96130,104 +96451,6 @@ SQLITE_PRIVATE char *sqlite3VdbeExpandSql(
/* #include "sqliteInt.h" */
/* #include "vdbeInt.h" */
-/*
-** High-resolution hardware timer used for debugging and testing only.
-*/
-#if defined(VDBE_PROFILE) \
- || defined(SQLITE_PERFORMANCE_TRACE) \
- || defined(SQLITE_ENABLE_STMT_SCANSTATUS)
-/************** Include hwtime.h in the middle of vdbe.c *********************/
-/************** Begin file hwtime.h ******************************************/
-/*
-** 2008 May 27
-**
-** The author disclaims copyright to this source code. In place of
-** a legal notice, here is a blessing:
-**
-** May you do good and not evil.
-** May you find forgiveness for yourself and forgive others.
-** May you share freely, never taking more than you give.
-**
-******************************************************************************
-**
-** This file contains inline asm code for retrieving "high-performance"
-** counters for x86 and x86_64 class CPUs.
-*/
-#ifndef SQLITE_HWTIME_H
-#define SQLITE_HWTIME_H
-
-/*
-** The following routine only works on Pentium-class (or newer) processors.
-** It uses the RDTSC opcode to read the cycle count value out of the
-** processor and returns that value. This can be used for high-res
-** profiling.
-*/
-#if !defined(__STRICT_ANSI__) && \
- (defined(__GNUC__) || defined(_MSC_VER)) && \
- (defined(i386) || defined(__i386__) || defined(_M_IX86))
-
- #if defined(__GNUC__)
-
- __inline__ sqlite_uint64 sqlite3Hwtime(void){
- unsigned int lo, hi;
- __asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi));
- return (sqlite_uint64)hi << 32 | lo;
- }
-
- #elif defined(_MSC_VER)
-
- __declspec(naked) __inline sqlite_uint64 __cdecl sqlite3Hwtime(void){
- __asm {
- rdtsc
- ret ; return value at EDX:EAX
- }
- }
-
- #endif
-
-#elif !defined(__STRICT_ANSI__) && (defined(__GNUC__) && defined(__x86_64__))
-
- __inline__ sqlite_uint64 sqlite3Hwtime(void){
- unsigned int lo, hi;
- __asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi));
- return (sqlite_uint64)hi << 32 | lo;
- }
-
-#elif !defined(__STRICT_ANSI__) && (defined(__GNUC__) && defined(__ppc__))
-
- __inline__ sqlite_uint64 sqlite3Hwtime(void){
- unsigned long long retval;
- unsigned long junk;
- __asm__ __volatile__ ("\n\
- 1: mftbu %1\n\
- mftb %L0\n\
- mftbu %0\n\
- cmpw %0,%1\n\
- bne 1b"
- : "=r" (retval), "=r" (junk));
- return retval;
- }
-
-#else
-
- /*
- ** asm() is needed for hardware timing support. Without asm(),
- ** disable the sqlite3Hwtime() routine.
- **
- ** sqlite3Hwtime() is only used for some obscure debugging
- ** and analysis configurations, not in any deliverable, so this
- ** should not be a great loss.
- */
-SQLITE_PRIVATE sqlite_uint64 sqlite3Hwtime(void){ return ((sqlite_uint64)0); }
-
-#endif
-
-#endif /* !defined(SQLITE_HWTIME_H) */
-
-/************** End of hwtime.h **********************************************/
-/************** Continuing where we left off in vdbe.c ***********************/
-#endif
-
/*
** Invoke this macro on memory cells just prior to changing the
** value of the cell. This macro verifies that shallow copies are
@@ -96805,7 +97028,6 @@ static void registerTrace(int iReg, Mem *p){
printf("R[%d] = ", iReg);
memTracePrint(p);
if( p->pScopyFrom ){
- assert( p->pScopyFrom->bScopy );
printf(" <== R[%d]", (int)(p->pScopyFrom - &p[-iReg]));
}
printf("\n");
@@ -97789,7 +98011,6 @@ case OP_Move: {
{ int i;
for(i=1; inMem; i++){
if( aMem[i].pScopyFrom==pIn1 ){
- assert( aMem[i].bScopy );
aMem[i].pScopyFrom = pOut;
}
}
@@ -97862,7 +98083,6 @@ case OP_SCopy: { /* out2 */
#ifdef SQLITE_DEBUG
pOut->pScopyFrom = pIn1;
pOut->mScopyFlags = pIn1->flags;
- pIn1->bScopy = 1;
#endif
break;
}
@@ -100165,6 +100385,13 @@ case OP_AutoCommit: {
assert( p->bIsReader );
if( desiredAutoCommit!=db->autoCommit ){
+
+ u64 aCommit[COMMIT_TIME_N];
+ memset(aCommit, 0, sizeof(aCommit));
+ if( iRollback==0 ){
+ sqlite3CommitTimeSet(aCommit, COMMIT_TIME_START);
+ }
+
if( iRollback ){
assert( desiredAutoCommit==1 );
sqlite3RollbackAll(db, SQLITE_ABORT_ROLLBACK);
@@ -100189,7 +100416,11 @@ case OP_AutoCommit: {
}else{
db->autoCommit = (u8)desiredAutoCommit;
}
+ sqlite3CommitTimeSet(aCommit, COMMIT_TIME_BEFORE_HALT);
+ p->aCommitTime = aCommit;
hrc = sqlite3VdbeHalt(p);
+ p->aCommitTime = 0;
+ sqlite3CommitTimeSet(aCommit, COMMIT_TIME_AFTER_HALT);
if( (hrc & 0xFF)==SQLITE_BUSY ){
p->pc = (int)(pOp - aOp);
db->autoCommit = (u8)(1-desiredAutoCommit);
@@ -100205,6 +100436,8 @@ case OP_AutoCommit: {
}else{
rc = SQLITE_ERROR;
}
+ sqlite3CommitTimeSet(aCommit, COMMIT_TIME_FINISH);
+ if( desiredAutoCommit && !iRollback ) sqlite3CommitTimeLog(aCommit);
goto vdbe_return;
}else{
sqlite3VdbeError(p,
@@ -100775,13 +101008,8 @@ case OP_OpenEphemeral: { /* ncycle */
}
}
pCx->isOrdered = (pOp->p5!=BTREE_UNORDERED);
- assert( p->apCsr[pOp->p1]==pCx );
if( rc ){
- assert( !sqlite3BtreeClosesWithCursor(pCx->ub.pBtx, pCx->uc.pCursor) );
sqlite3BtreeClose(pCx->ub.pBtx);
- p->apCsr[pOp->p1] = 0; /* Not required; helps with static analysis */
- }else{
- assert( sqlite3BtreeClosesWithCursor(pCx->ub.pBtx, pCx->uc.pCursor) );
}
}
}
@@ -104196,34 +104424,34 @@ case OP_JournalMode: { /* out2 */
(eNew==PAGER_JOURNALMODE_WAL ? "into" : "out of")
);
goto abort_due_to_error;
- }else{
-
- if( isWalMode(eOld) ){
- /* If leaving WAL mode, close the log file. If successful, the call
- ** to PagerCloseWal() checkpoints and deletes the write-ahead-log
- ** file. An EXCLUSIVE lock may still be held on the database file
- ** after a successful return.
- */
- rc = sqlite3PagerCloseWal(pPager, db);
- if( rc==SQLITE_OK ){
- sqlite3PagerSetJournalMode(pPager, eNew);
- }
- }else if( eOld==PAGER_JOURNALMODE_MEMORY ){
- /* Cannot transition directly from MEMORY to WAL. Use mode OFF
- ** as an intermediate */
- sqlite3PagerSetJournalMode(pPager, PAGER_JOURNALMODE_OFF);
- }
+ }
- /* Open a transaction on the database file. Regardless of the journal
- ** mode, this transaction always uses a rollback journal.
+ if( isWalMode(eOld) ){
+ /* If leaving WAL mode, close the log file. If successful, the call
+ ** to PagerCloseWal() checkpoints and deletes the write-ahead-log
+ ** file. An EXCLUSIVE lock may still be held on the database file
+ ** after a successful return.
*/
- assert( sqlite3BtreeTxnState(pBt)!=SQLITE_TXN_WRITE );
+ rc = sqlite3PagerCloseWal(pPager, db);
if( rc==SQLITE_OK ){
- /* 1==rollback, 2==wal, 3==wal2 */
- rc = sqlite3BtreeSetVersion(pBt,
- 1 + isWalMode(eNew) + (eNew==PAGER_JOURNALMODE_WAL2)
- );
+ sqlite3PagerSetJournalMode(pPager, eNew);
}
+ }else if( eOld==PAGER_JOURNALMODE_MEMORY ){
+ /* Cannot transition directly from MEMORY to WAL. Use mode OFF
+ ** as an intermediate */
+ sqlite3PagerSetJournalMode(pPager, PAGER_JOURNALMODE_OFF);
+ }
+
+ /* Open a transaction on the database file. Regardless of the journal
+ ** mode, this transaction always uses a rollback journal.
+ */
+ assert( sqlite3BtreeTxnState(pBt)!=SQLITE_TXN_WRITE );
+ if( rc==SQLITE_OK ){
+ /* 1==rollback, 2==wal, 3==wal2 */
+ rc = sqlite3BtreeSetVersion(pBt,
+ 1 + isWalMode(eNew) + (eNew==PAGER_JOURNALMODE_WAL2)
+ );
+
}
}
#endif /* ifndef SQLITE_OMIT_WAL */
@@ -105317,7 +105545,7 @@ case OP_ReleaseReg: {
** As with all opcodes, the meanings of the parameters for OP_Explain
** are subject to change from one release to the next. Applications
** should not attempt to interpret or use any of the information
-** contained in the OP_Explain opcode. The information provided by this
+** contined in the OP_Explain opcode. The information provided by this
** opcode is intended for testing and debugging use only.
*/
default: { /* This is really OP_Noop, OP_Explain */
@@ -110413,7 +110641,7 @@ static int lookupName(
*/
if( cntTab==0
|| (cntTab==1
- && pMatch!=0
+ && ALWAYS(pMatch!=0)
&& ALWAYS(pMatch->pSTab!=0)
&& (pMatch->pSTab->tabFlags & TF_Ephemeral)!=0
&& (pTab->tabFlags & TF_Ephemeral)==0)
@@ -111046,8 +111274,8 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
/* Resolve function names
*/
case TK_FUNCTION: {
- ExprList *pList; /* The argument list */
- int n; /* Number of arguments */
+ ExprList *pList = pExpr->x.pList; /* The argument list */
+ int n = pList ? pList->nExpr : 0; /* Number of arguments */
int no_such_func = 0; /* True if no such function exists */
int wrong_num_args = 0; /* True if wrong number of arguments */
int is_agg = 0; /* True if is an aggregate function */
@@ -111060,8 +111288,6 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
#endif
assert( !ExprHasProperty(pExpr, EP_xIsSelect|EP_IntValue) );
assert( pExpr->pLeft==0 || pExpr->pLeft->op==TK_ORDER );
- pList = pExpr->x.pList;
- n = pList ? pList->nExpr : 0;
zId = pExpr->u.zToken;
pDef = sqlite3FindFunction(pParse->db, zId, n, enc, 0);
if( pDef==0 ){
@@ -111110,24 +111336,6 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
}
}
#endif
-
- /* If the function may call sqlite3_value_subtype(), then set the
- ** EP_SubtArg flag on all of its argument expressions. This prevents
- ** where.c from replacing the expression with a value read from an
- ** index on the same expression, which will not have the correct
- ** subtype. Also set the flag if the function expression itself is
- ** an EP_SubtArg expression. In this case subtypes are required as
- ** the function may return a value with a subtype back to its
- ** caller using sqlite3_result_value(). */
- if( (pDef->funcFlags & SQLITE_SUBTYPE)
- || ExprHasProperty(pExpr, EP_SubtArg)
- ){
- int ii;
- for(ii=0; iia[ii].pExpr, EP_SubtArg);
- }
- }
-
if( pDef->funcFlags & (SQLITE_FUNC_CONSTANT|SQLITE_FUNC_SLOCHNG) ){
/* For the purposes of the EP_ConstFunc flag, date and time
** functions and other functions that change slowly are considered
@@ -114180,13 +114388,16 @@ SQLITE_PRIVATE IdList *sqlite3IdListDup(sqlite3 *db, const IdList *p){
int i;
assert( db!=0 );
if( p==0 ) return 0;
+ assert( p->eU4!=EU4_EXPR );
pNew = sqlite3DbMallocRawNN(db, sizeof(*pNew)+(p->nId-1)*sizeof(p->a[0]) );
if( pNew==0 ) return 0;
pNew->nId = p->nId;
+ pNew->eU4 = p->eU4;
for(i=0; inId; i++){
struct IdList_item *pNewItem = &pNew->a[i];
const struct IdList_item *pOldItem = &p->a[i];
pNewItem->zName = sqlite3DbStrDup(db, pOldItem->zName);
+ pNewItem->u4 = pOldItem->u4;
}
return pNew;
}
@@ -114891,7 +115102,7 @@ static int sqlite3ExprIsTableConstant(Expr *p, int iCur, int bAllowSubq){
** (4a) pExpr must come from an ON clause..
** (4b) and specifically the ON clause associated with the LEFT JOIN.
**
-** (5) If pSrc is the right operand of a LEFT JOIN or the left
+** (5) If pSrc is not the right operand of a LEFT JOIN or the left
** operand of a RIGHT JOIN, then pExpr must be from the WHERE
** clause, not an ON clause.
**
@@ -115530,7 +115741,6 @@ SQLITE_PRIVATE int sqlite3FindInIndex(
if( aiMap ) aiMap[i] = j;
}
- assert( nExpr>0 && nExpropcode==OP_BeginSubrtn );
pSig = pOp->p4.pSubrtnSig;
assert( pSig!=0 );
- if( !pSig->bComplete ) continue;
if( pNewSig->selId!=pSig->selId ) continue;
if( strcmp(pNewSig->zAff,pSig->zAff)!=0 ) continue;
pExpr->y.sub.iAddr = pSig->iAddr;
@@ -115757,7 +115966,6 @@ SQLITE_PRIVATE void sqlite3CodeRhsOfIN(
KeyInfo *pKeyInfo = 0; /* Key information */
int nVal; /* Size of vector pLeft */
Vdbe *v; /* The prepared statement under construction */
- SubrtnSig *pSig = 0; /* Signature for this subroutine */
v = pParse->pVdbe;
assert( v!=0 );
@@ -115778,6 +115986,7 @@ SQLITE_PRIVATE void sqlite3CodeRhsOfIN(
** Compute a signature for the RHS of the IN operator to facility
** finding and reusing prior instances of the same IN operator.
*/
+ SubrtnSig *pSig = 0;
assert( !ExprUseXSelect(pExpr) || pExpr->x.pSelect!=0 );
if( ExprUseXSelect(pExpr) && (pExpr->x.pSelect->selFlags & SF_All)==0 ){
pSig = sqlite3DbMallocRawNN(pParse->db, sizeof(pSig[0]));
@@ -115820,7 +116029,6 @@ SQLITE_PRIVATE void sqlite3CodeRhsOfIN(
pExpr->y.sub.iAddr =
sqlite3VdbeAddOp2(v, OP_BeginSubrtn, 0, pExpr->y.sub.regReturn) + 1;
if( pSig ){
- pSig->bComplete = 0;
pSig->iAddr = pExpr->y.sub.iAddr;
pSig->regReturn = pExpr->y.sub.regReturn;
pSig->iTable = iTab;
@@ -115956,7 +116164,6 @@ SQLITE_PRIVATE void sqlite3CodeRhsOfIN(
sqlite3ReleaseTempReg(pParse, r1);
sqlite3ReleaseTempReg(pParse, r2);
}
- if( pSig ) pSig->bComplete = 1;
if( pKeyInfo ){
sqlite3VdbeChangeP4(v, addr, (void *)pKeyInfo, P4_KEYINFO);
}
@@ -116803,59 +117010,6 @@ static int exprCodeInlineFunction(
return target;
}
-/*
-** Expression Node callback for sqlite3ExprCanReturnSubtype().
-**
-** Only a function call is able to return a subtype. So if the node
-** is not a function call, return WRC_Prune immediately.
-**
-** A function call is able to return a subtype if it has the
-** SQLITE_RESULT_SUBTYPE property.
-**
-** Assume that every function is able to pass-through a subtype from
-** one of its argument (using sqlite3_result_value()). Most functions
-** are not this way, but we don't have a mechanism to distinguish those
-** that are from those that are not, so assume they all work this way.
-** That means that if one of its arguments is another function and that
-** other function is able to return a subtype, then this function is
-** able to return a subtype.
-*/
-static int exprNodeCanReturnSubtype(Walker *pWalker, Expr *pExpr){
- int n;
- FuncDef *pDef;
- sqlite3 *db;
- if( pExpr->op!=TK_FUNCTION ){
- return WRC_Prune;
- }
- assert( ExprUseXList(pExpr) );
- db = pWalker->pParse->db;
- n = ALWAYS(pExpr->x.pList) ? pExpr->x.pList->nExpr : 0;
- pDef = sqlite3FindFunction(db, pExpr->u.zToken, n, ENC(db), 0);
- if( NEVER(pDef==0) || (pDef->funcFlags & SQLITE_RESULT_SUBTYPE)!=0 ){
- pWalker->eCode = 1;
- return WRC_Prune;
- }
- return WRC_Continue;
-}
-
-/*
-** Return TRUE if expression pExpr is able to return a subtype.
-**
-** A TRUE return does not guarantee that a subtype will be returned.
-** It only indicates that a subtype return is possible. False positives
-** are acceptable as they only disable an optimization. False negatives,
-** on the other hand, can lead to incorrect answers.
-*/
-static int sqlite3ExprCanReturnSubtype(Parse *pParse, Expr *pExpr){
- Walker w;
- memset(&w, 0, sizeof(w));
- w.pParse = pParse;
- w.xExprCallback = exprNodeCanReturnSubtype;
- sqlite3WalkExpr(&w, pExpr);
- return w.eCode;
-}
-
-
/*
** Check to see if pExpr is one of the indexed expressions on pParse->pIdxEpr.
** If it is, then resolve the expression by reading from the index and
@@ -116888,17 +117042,6 @@ static SQLITE_NOINLINE int sqlite3IndexedExprLookup(
continue;
}
-
- /* Functions that might set a subtype should not be replaced by the
- ** value taken from an expression index if they are themselves an
- ** argument to another scalar function or aggregate.
- ** https://sqlite.org/forum/forumpost/68d284c86b082c3e */
- if( ExprHasProperty(pExpr, EP_SubtArg)
- && sqlite3ExprCanReturnSubtype(pParse, pExpr)
- ){
- continue;
- }
-
v = pParse->pVdbe;
assert( v!=0 );
if( p->bMaybeNullRow ){
@@ -118429,23 +118572,16 @@ SQLITE_PRIVATE void sqlite3ExprIfFalseDup(Parse *pParse, Expr *pExpr, int dest,i
** same as that currently bound to variable pVar, non-zero is returned.
** Otherwise, if the values are not the same or if pExpr is not a simple
** SQL value, zero is returned.
-**
-** If the SQLITE_EnableQPSG flag is set on the database connection, then
-** this routine always returns false.
*/
-static SQLITE_NOINLINE int exprCompareVariable(
+static int exprCompareVariable(
const Parse *pParse,
const Expr *pVar,
const Expr *pExpr
){
- int res = 2;
+ int res = 0;
int iVar;
sqlite3_value *pL, *pR = 0;
- if( pExpr->op==TK_VARIABLE && pVar->iColumn==pExpr->iColumn ){
- return 0;
- }
- if( (pParse->db->flags & SQLITE_EnableQPSG)!=0 ) return 2;
sqlite3ValueFromExpr(pParse->db, pExpr, SQLITE_UTF8, SQLITE_AFF_BLOB, &pR);
if( pR ){
iVar = pVar->iColumn;
@@ -118455,11 +118591,12 @@ static SQLITE_NOINLINE int exprCompareVariable(
if( sqlite3_value_type(pL)==SQLITE_TEXT ){
sqlite3_value_text(pL); /* Make sure the encoding is UTF-8 */
}
- res = sqlite3MemCompare(pL, pR, 0) ? 2 : 0;
+ res = 0==sqlite3MemCompare(pL, pR, 0);
}
sqlite3ValueFree(pR);
sqlite3ValueFree(pL);
}
+
return res;
}
@@ -118485,10 +118622,12 @@ static SQLITE_NOINLINE int exprCompareVariable(
** just might result in some slightly slower code. But returning
** an incorrect 0 or 1 could lead to a malfunction.
**
-** If pParse is not NULL and SQLITE_EnableQPSG is off then TK_VARIABLE
-** terms in pA with bindings in pParse->pReprepare can be matched against
-** literals in pB. The pParse->pVdbe->expmask bitmask is updated for
-** each variable referenced.
+** If pParse is not NULL then TK_VARIABLE terms in pA with bindings in
+** pParse->pReprepare can be matched against literals in pB. The
+** pParse->pVdbe->expmask bitmask is updated for each variable referenced.
+** If pParse is NULL (the normal case) then any TK_VARIABLE term in
+** Argument pParse should normally be NULL. If it is not NULL and pA or
+** pB causes a return value of 2.
*/
SQLITE_PRIVATE int sqlite3ExprCompare(
const Parse *pParse,
@@ -118500,8 +118639,8 @@ SQLITE_PRIVATE int sqlite3ExprCompare(
if( pA==0 || pB==0 ){
return pB==pA ? 0 : 2;
}
- if( pParse && pA->op==TK_VARIABLE ){
- return exprCompareVariable(pParse, pA, pB);
+ if( pParse && pA->op==TK_VARIABLE && exprCompareVariable(pParse, pA, pB) ){
+ return 0;
}
combinedFlags = pA->flags | pB->flags;
if( combinedFlags & EP_IntValue ){
@@ -118696,70 +118835,18 @@ static int exprImpliesNotNull(
return 0;
}
-/*
-** Return true if the boolean value of the expression is always either
-** FALSE or NULL.
-*/
-static int sqlite3ExprIsNotTrue(Expr *pExpr){
- int v;
- if( pExpr->op==TK_NULL ) return 1;
- if( pExpr->op==TK_TRUEFALSE && sqlite3ExprTruthValue(pExpr)==0 ) return 1;
- v = 1;
- if( sqlite3ExprIsInteger(pExpr, &v, 0) && v==0 ) return 1;
- return 0;
-}
-
-/*
-** Return true if the expression is one of the following:
-**
-** CASE WHEN x THEN y END
-** CASE WHEN x THEN y ELSE NULL END
-** CASE WHEN x THEN y ELSE false END
-** iif(x,y)
-** iif(x,y,NULL)
-** iif(x,y,false)
-*/
-static int sqlite3ExprIsIIF(sqlite3 *db, const Expr *pExpr){
- ExprList *pList;
- if( pExpr->op==TK_FUNCTION ){
- const char *z = pExpr->u.zToken;
- FuncDef *pDef;
- if( (z[0]!='i' && z[0]!='I') ) return 0;
- if( pExpr->x.pList==0 ) return 0;
- pDef = sqlite3FindFunction(db, z, pExpr->x.pList->nExpr, ENC(db), 0);
-#ifdef SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION
- if( pDef==0 ) return 0;
-#else
- if( NEVER(pDef==0) ) return 0;
-#endif
- if( (pDef->funcFlags & SQLITE_FUNC_INLINE)==0 ) return 0;
- if( SQLITE_PTR_TO_INT(pDef->pUserData)!=INLINEFUNC_iif ) return 0;
- }else if( pExpr->op==TK_CASE ){
- if( pExpr->pLeft!=0 ) return 0;
- }else{
- return 0;
- }
- pList = pExpr->x.pList;
- assert( pList!=0 );
- if( pList->nExpr==2 ) return 1;
- if( pList->nExpr==3 && sqlite3ExprIsNotTrue(pList->a[2].pExpr) ) return 1;
- return 0;
-}
-
/*
** Return true if we can prove the pE2 will always be true if pE1 is
** true. Return false if we cannot complete the proof or if pE2 might
** be false. Examples:
**
-** pE1: x==5 pE2: x==5 Result: true
-** pE1: x>0 pE2: x==5 Result: false
-** pE1: x=21 pE2: x=21 OR y=43 Result: true
-** pE1: x!=123 pE2: x IS NOT NULL Result: true
-** pE1: x!=?1 pE2: x IS NOT NULL Result: true
-** pE1: x IS NULL pE2: x IS NOT NULL Result: false
-** pE1: x IS ?2 pE2: x IS NOT NULL Result: false
-** pE1: iif(x,y) pE2: x Result: true
-** PE1: iif(x,y,0) pE2: x Result: true
+** pE1: x==5 pE2: x==5 Result: true
+** pE1: x>0 pE2: x==5 Result: false
+** pE1: x=21 pE2: x=21 OR y=43 Result: true
+** pE1: x!=123 pE2: x IS NOT NULL Result: true
+** pE1: x!=?1 pE2: x IS NOT NULL Result: true
+** pE1: x IS NULL pE2: x IS NOT NULL Result: false
+** pE1: x IS ?2 pE2: x IS NOT NULL Result: false
**
** When comparing TK_COLUMN nodes between pE1 and pE2, if pE2 has
** Expr.iTable<0 then assume a table number given by iTab.
@@ -118793,9 +118880,6 @@ SQLITE_PRIVATE int sqlite3ExprImpliesExpr(
){
return 1;
}
- if( sqlite3ExprIsIIF(pParse->db, pE1) ){
- return sqlite3ExprImpliesExpr(pParse,pE1->x.pList->a[0].pExpr,pE2,iTab);
- }
return 0;
}
@@ -123864,6 +123948,8 @@ static int loadStatTbl(
rc = stat4AllocSpace(db, zDb);
if( rc!=SQLITE_OK ) return rc;
+ sqlite3PrepareTimeSet(db->aSchemaTime, SCHEMA_TIME_AFTER_STAT4_SPACE);
+
zSql = sqlite3MPrintf(db, zSql2, zDb);
if( !zSql ){
return SQLITE_NOMEM_BKPT;
@@ -123872,10 +123958,13 @@ static int loadStatTbl(
sqlite3DbFree(db, zSql);
if( rc ) return rc;
+ sqlite3PrepareTimeSet(db->aSchemaTime, SCHEMA_TIME_AFTER_STAT4_PREPARE);
+
while( sqlite3_step(pStmt)==SQLITE_ROW ){
char *zIndex; /* Index name */
Index *pIdx; /* Pointer to the index object */
int nCol = 1; /* Number of columns in index */
+ u64 t = sqlite3STimeNow();
zIndex = (char *)sqlite3_column_text(pStmt, 0);
if( zIndex==0 ) continue;
@@ -123883,6 +123972,7 @@ static int loadStatTbl(
if( pIdx==0 ) continue;
if( pIdx->nSample==pIdx->nSampleAlloc ){
+ u64 t2;
pIdx->pTable->tabFlags |= TF_HasStat4;
assert( !HasRowid(pIdx->pTable) || pIdx->nColumn==pIdx->nKeyCol+1 );
if( !HasRowid(pIdx->pTable) && IsPrimaryKeyIndex(pIdx) ){
@@ -123890,13 +123980,18 @@ static int loadStatTbl(
}else{
pIdx->nSampleCol = pIdx->nColumn;
}
+ t2 = sqlite3STimeNow();
if( growSampleArray(db, pIdx, &iBlockOff) ) break;
+ if( db->aSchemaTime ){
+ db->aSchemaTime[SCHEMA_TIME_STAT4_GROWUS] += (sqlite3STimeNow() - t);
+ }
}
if( pIdx!=pPrevIdx ){
initAvgEq(pPrevIdx);
pPrevIdx = pIdx;
}
+
nCol = pIdx->nSampleCol;
pSample = &pIdx->aSample[pIdx->nSample];
decodeIntArray((char*)sqlite3_column_text(pStmt,1),nCol,pSample->anEq,0,0);
@@ -123920,8 +124015,13 @@ static int loadStatTbl(
memcpy(pSample->p, sqlite3_column_blob(pStmt, 4), pSample->n);
}
pIdx->nSample++;
+
+ if( db->aSchemaTime ){
+ db->aSchemaTime[SCHEMA_TIME_STAT4_Q2_BODYUS] += (sqlite3STimeNow() - t);
+ }
}
rc = sqlite3_finalize(pStmt);
+ sqlite3PrepareTimeSet(db->aSchemaTime, SCHEMA_TIME_AFTER_STAT4_Q2);
if( rc==SQLITE_OK ) initAvgEq(pPrevIdx);
return rc;
}
@@ -123999,6 +124099,8 @@ SQLITE_PRIVATE int sqlite3AnalysisLoad(sqlite3 *db, int iDb){
pSchema->pStat4Space = 0;
#endif
+ sqlite3PrepareTimeSet(db->aSchemaTime, SCHEMA_TIME_AFTER_CLEAR_STATS);
+
/* Load new statistics out of the sqlite_stat1 table */
sInfo.db = db;
sInfo.zDatabase = db->aDb[iDb].zDbSName;
@@ -124015,6 +124117,8 @@ SQLITE_PRIVATE int sqlite3AnalysisLoad(sqlite3 *db, int iDb){
}
}
+ sqlite3PrepareTimeSet(db->aSchemaTime, SCHEMA_TIME_AFTER_STAT1);
+
/* Set appropriate defaults on all indexes not in the sqlite_stat1 table */
assert( sqlite3SchemaMutexHeld(db, iDb, 0) );
for(i=sqliteHashFirst(&pSchema->idxHash); i; i=sqliteHashNext(i)){
@@ -124022,6 +124126,8 @@ SQLITE_PRIVATE int sqlite3AnalysisLoad(sqlite3 *db, int iDb){
if( !pIdx->hasStat1 ) sqlite3DefaultRowEst(pIdx);
}
+ sqlite3PrepareTimeSet(db->aSchemaTime, SCHEMA_TIME_AFTER_DEFAULTS);
+
/* Load the statistics from the sqlite_stat4 table. */
#ifdef SQLITE_ENABLE_STAT4
if( rc==SQLITE_OK ){
@@ -124036,6 +124142,8 @@ SQLITE_PRIVATE int sqlite3AnalysisLoad(sqlite3 *db, int iDb){
}
#endif
+ sqlite3PrepareTimeSet(db->aSchemaTime, SCHEMA_TIME_AFTER_STAT4);
+
if( rc==SQLITE_NOMEM ){
sqlite3OomFault(db);
}
@@ -124224,12 +124332,6 @@ static void attachFunc(
sqlite3_free(zErr);
return;
}
- if( (db->flags & SQLITE_AttachWrite)==0 ){
- flags &= ~(SQLITE_OPEN_CREATE|SQLITE_OPEN_READWRITE);
- flags |= SQLITE_OPEN_READONLY;
- }else if( (db->flags & SQLITE_AttachCreate)==0 ){
- flags &= ~SQLITE_OPEN_CREATE;
- }
assert( pVfs );
flags |= SQLITE_OPEN_MAIN_DB;
rc = sqlite3BtreeOpen(pVfs, zPath, db, &pNew->pBt, 0, flags);
@@ -124282,6 +124384,15 @@ static void attachFunc(
sqlite3BtreeLeaveAll(db);
assert( zErrDyn==0 || rc!=SQLITE_OK );
}
+#ifdef SQLITE_USER_AUTHENTICATION
+ if( rc==SQLITE_OK && !REOPEN_AS_MEMDB(db) ){
+ u8 newAuth = 0;
+ rc = sqlite3UserAuthCheckLogin(db, zName, &newAuth);
+ if( newAuthauth.authLevel ){
+ rc = SQLITE_AUTH_USER;
+ }
+ }
+#endif
if( rc ){
if( ALWAYS(!REOPEN_AS_MEMDB(db)) ){
int iDb = db->nDb - 1;
@@ -124779,7 +124890,11 @@ SQLITE_PRIVATE int sqlite3AuthReadCol(
int rc; /* Auth callback return code */
if( db->init.busy ) return SQLITE_OK;
- rc = db->xAuth(db->pAuthArg, SQLITE_READ, zTab,zCol,zDb,pParse->zAuthContext);
+ rc = db->xAuth(db->pAuthArg, SQLITE_READ, zTab,zCol,zDb,pParse->zAuthContext
+#ifdef SQLITE_USER_AUTHENTICATION
+ ,db->auth.zAuthUser
+#endif
+ );
if( rc==SQLITE_DENY ){
char *z = sqlite3_mprintf("%s.%s", zTab, zCol);
if( db->nDb>2 || iDb!=0 ) z = sqlite3_mprintf("%s.%z", zDb, z);
@@ -124886,7 +125001,11 @@ SQLITE_PRIVATE int sqlite3AuthCheck(
testcase( zArg3==0 );
testcase( pParse->zAuthContext==0 );
- rc = db->xAuth(db->pAuthArg,code,zArg1,zArg2,zArg3,pParse->zAuthContext);
+ rc = db->xAuth(db->pAuthArg, code, zArg1, zArg2, zArg3, pParse->zAuthContext
+#ifdef SQLITE_USER_AUTHENTICATION
+ ,db->auth.zAuthUser
+#endif
+ );
if( rc==SQLITE_DENY ){
sqlite3ErrorMsg(pParse, "not authorized");
pParse->rc = SQLITE_AUTH;
@@ -125119,6 +125238,17 @@ SQLITE_PRIVATE void sqlite3FinishCoding(Parse *pParse){
}
sqlite3VdbeAddOp0(v, OP_Halt);
+#if SQLITE_USER_AUTHENTICATION && !defined(SQLITE_OMIT_SHARED_CACHE)
+ if( pParse->nTableLock>0 && db->init.busy==0 ){
+ sqlite3UserAuthInit(db);
+ if( db->auth.authLevelrc = SQLITE_AUTH_USER;
+ return;
+ }
+ }
+#endif
+
/* The cookie mask contains one bit for each database file open.
** (Bit 0 is for main, bit 1 is for temp, and so forth.) Bits are
** set for each database that is used. Generate code to start a
@@ -125247,6 +125377,16 @@ SQLITE_PRIVATE void sqlite3NestedParse(Parse *pParse, const char *zFormat, ...){
pParse->nested--;
}
+#if SQLITE_USER_AUTHENTICATION
+/*
+** Return TRUE if zTable is the name of the system table that stores the
+** list of users and their access credentials.
+*/
+SQLITE_PRIVATE int sqlite3UserAuthTable(const char *zTable){
+ return sqlite3_stricmp(zTable, "sqlite_user")==0;
+}
+#endif
+
/*
** Locate the in-memory structure that describes a particular database
** table given the name of that table and (optionally) the name of the
@@ -125265,6 +125405,13 @@ SQLITE_PRIVATE Table *sqlite3FindTable(sqlite3 *db, const char *zName, const cha
/* All mutexes are required for schema access. Make sure we hold them. */
assert( zDatabase!=0 || sqlite3BtreeHoldsAllMutexes(db) );
+#if SQLITE_USER_AUTHENTICATION
+ /* Only the admin user is allowed to know that the sqlite_user table
+ ** exists */
+ if( db->auth.authLevelnDb; i++){
if( sqlite3StrICmp(zDatabase, db->aDb[i].zDbSName)==0 ) break;
@@ -128923,6 +129070,9 @@ SQLITE_PRIVATE void sqlite3CreateIndex(
if( sqlite3StrNICmp(pTab->zName, "sqlite_", 7)==0
&& db->init.busy==0
&& pTblName!=0
+#if SQLITE_USER_AUTHENTICATION
+ && sqlite3UserAuthTable(pTab->zName)==0
+#endif
){
sqlite3ErrorMsg(pParse, "table %s may not be indexed", pTab->zName);
goto exit_create_index;
@@ -129621,6 +129771,7 @@ SQLITE_PRIVATE void sqlite3IdListDelete(sqlite3 *db, IdList *pList){
int i;
assert( db!=0 );
if( pList==0 ) return;
+ assert( pList->eU4!=EU4_EXPR ); /* EU4_EXPR mode is not currently used */
for(i=0; inId; i++){
sqlite3DbFree(db, pList->a[i].zName);
}
@@ -131001,18 +131152,12 @@ static int matchQuality(
u8 enc /* Desired text encoding */
){
int match;
- assert( p->nArg>=(-4) && p->nArg!=(-2) );
- assert( nArg>=(-2) );
+ assert( p->nArg>=-1 );
/* Wrong number of arguments means "no match" */
if( p->nArg!=nArg ){
- if( nArg==(-2) ) return p->xSFunc==0 ? 0 : FUNC_PERFECT_MATCH;
+ if( nArg==(-2) ) return (p->xSFunc==0) ? 0 : FUNC_PERFECT_MATCH;
if( p->nArg>=0 ) return 0;
- /* Special p->nArg values available to built-in functions only:
- ** -3 1 or more arguments required
- ** -4 2 or more arguments required
- */
- if( p->nArg<(-2) && nArg<(-2-p->nArg) ) return 0;
}
/* Give a better score to a function with a specific number of arguments
@@ -131327,7 +131472,6 @@ SQLITE_PRIVATE void sqlite3CodeChangeCount(Vdbe *v, int regCounter, const char *
** is for a top-level SQL statement.
*/
static int vtabIsReadOnly(Parse *pParse, Table *pTab){
- assert( IsVirtual(pTab) );
if( sqlite3GetVTable(pParse->db, pTab)->pMod->pModule->xUpdate==0 ){
return 1;
}
@@ -132639,6 +132783,7 @@ static void substrFunc(
int len;
int p0type;
i64 p1, p2;
+ int negP2 = 0;
assert( argc==3 || argc==2 );
if( sqlite3_value_type(argv[1])==SQLITE_NULL
@@ -132647,7 +132792,7 @@ static void substrFunc(
return;
}
p0type = sqlite3_value_type(argv[0]);
- p1 = sqlite3_value_int64(argv[1]);
+ p1 = sqlite3_value_int(argv[1]);
if( p0type==SQLITE_BLOB ){
len = sqlite3_value_bytes(argv[0]);
z = sqlite3_value_blob(argv[0]);
@@ -132672,18 +132817,19 @@ static void substrFunc(
if( p1==0 ) p1 = 1; /* */
#endif
if( argc==3 ){
- p2 = sqlite3_value_int64(argv[2]);
+ p2 = sqlite3_value_int(argv[2]);
+ if( p2<0 ){
+ p2 = -p2;
+ negP2 = 1;
+ }
}else{
p2 = sqlite3_context_db_handle(context)->aLimit[SQLITE_LIMIT_LENGTH];
}
if( p1<0 ){
p1 += len;
if( p1<0 ){
- if( p2<0 ){
- p2 = 0;
- }else{
- p2 += p1;
- }
+ p2 += p1;
+ if( p2<0 ) p2 = 0;
p1 = 0;
}
}else if( p1>0 ){
@@ -132691,13 +132837,12 @@ static void substrFunc(
}else if( p2>0 ){
p2--;
}
- if( p2<0 ){
- if( p2<-p1 ){
- p2 = p1;
- }else{
- p2 = -p2;
- }
+ if( negP2 ){
p1 -= p2;
+ if( p1<0 ){
+ p2 += p1;
+ p1 = 0;
+ }
}
assert( p1>=0 && p2>=0 );
if( p0type!=SQLITE_BLOB ){
@@ -132711,11 +132856,9 @@ static void substrFunc(
sqlite3_result_text64(context, (char*)z, z2-z, SQLITE_TRANSIENT,
SQLITE_UTF8);
}else{
- if( p1>=len ){
- p1 = p2 = 0;
- }else if( p2>len-p1 ){
+ if( p1+p2>len ){
p2 = len-p1;
- assert( p2>0 );
+ if( p2<0 ) p2 = 0;
}
sqlite3_result_blob64(context, (char*)&z[p1], (u64)p2, SQLITE_TRANSIENT);
}
@@ -132726,13 +132869,13 @@ static void substrFunc(
*/
#ifndef SQLITE_OMIT_FLOATING_POINT
static void roundFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
- i64 n = 0;
+ int n = 0;
double r;
char *zBuf;
assert( argc==1 || argc==2 );
if( argc==2 ){
if( SQLITE_NULL==sqlite3_value_type(argv[1]) ) return;
- n = sqlite3_value_int64(argv[1]);
+ n = sqlite3_value_int(argv[1]);
if( n>30 ) n = 30;
if( n<0 ) n = 0;
}
@@ -132747,7 +132890,7 @@ static void roundFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
}else if( n==0 ){
r = (double)((sqlite_int64)(r+(r<0?-0.5:+0.5)));
}else{
- zBuf = sqlite3_mprintf("%!.*f",(int)n,r);
+ zBuf = sqlite3_mprintf("%!.*f",n,r);
if( zBuf==0 ){
sqlite3_result_error_nomem(context);
return;
@@ -134156,10 +134299,7 @@ static void sumInverse(sqlite3_context *context, int argc, sqlite3_value**argv){
assert( p->cnt>0 );
p->cnt--;
if( !p->approx ){
- if( sqlite3SubInt64(&p->iSum, sqlite3_value_int64(argv[0])) ){
- p->ovrfl = 1;
- p->approx = 1;
- }
+ p->iSum -= sqlite3_value_int64(argv[0]);
}else if( type==SQLITE_INTEGER ){
i64 iVal = sqlite3_value_int64(argv[0]);
if( iVal!=SMALLEST_INT64 ){
@@ -134826,13 +134966,7 @@ static void signFunc(
** Implementation of fpdecode(x,y,z) function.
**
** x is a real number that is to be decoded. y is the precision.
-** z is the maximum real precision. Return a string that shows the
-** results of the sqlite3FpDecode() function.
-**
-** Used for testing and debugging only, specifically testing and debugging
-** of the sqlite3FpDecode() function. This SQL function does not appear
-** in production builds. This function is not an API and is subject to
-** modification or removal in future versions of SQLite.
+** z is the maximum real precision.
*/
static void fpdecodeFunc(
sqlite3_context *context,
@@ -134859,82 +134993,6 @@ static void fpdecodeFunc(
}
#endif /* SQLITE_DEBUG */
-#ifdef SQLITE_DEBUG
-/*
-** Implementation of parseuri(uri,flags) function.
-**
-** Required Arguments:
-** "uri" The URI to parse.
-** "flags" Bitmask of flags, as if to sqlite3_open_v2().
-**
-** Additional arguments beyond the first two make calls to
-** sqlite3_uri_key() for integers and sqlite3_uri_parameter for
-** anything else.
-**
-** The result is a string showing the results of calling sqlite3ParseUri().
-**
-** Used for testing and debugging only, specifically testing and debugging
-** of the sqlite3ParseUri() function. This SQL function does not appear
-** in production builds. This function is not an API and is subject to
-** modification or removal in future versions of SQLite.
-*/
-static void parseuriFunc(
- sqlite3_context *ctx,
- int argc,
- sqlite3_value **argv
-){
- sqlite3_str *pResult;
- const char *zVfs;
- const char *zUri;
- unsigned int flgs;
- int rc;
- sqlite3_vfs *pVfs = 0;
- char *zFile = 0;
- char *zErr = 0;
-
- if( argc<2 ) return;
- pVfs = sqlite3_vfs_find(0);
- assert( pVfs );
- zVfs = pVfs->zName;
- zUri = (const char*)sqlite3_value_text(argv[0]);
- if( zUri==0 ) return;
- flgs = (unsigned int)sqlite3_value_int(argv[1]);
- rc = sqlite3ParseUri(zVfs, zUri, &flgs, &pVfs, &zFile, &zErr);
- pResult = sqlite3_str_new(0);
- if( pResult ){
- int i;
- sqlite3_str_appendf(pResult, "rc=%d", rc);
- sqlite3_str_appendf(pResult, ", flags=0x%x", flgs);
- sqlite3_str_appendf(pResult, ", vfs=%Q", pVfs ? pVfs->zName: 0);
- sqlite3_str_appendf(pResult, ", err=%Q", zErr);
- sqlite3_str_appendf(pResult, ", file=%Q", zFile);
- if( zFile ){
- const char *z = zFile;
- z += sqlite3Strlen30(z)+1;
- while( z[0] ){
- sqlite3_str_appendf(pResult, ", %Q", z);
- z += sqlite3Strlen30(z)+1;
- }
- for(i=2; itabFlags & (TF_OOOHidden|TF_HasStored))==0;
if( pColumn ){
- aTabColMap = sqlite3DbMallocZero(db, pTab->nCol*sizeof(int));
- if( aTabColMap==0 ) goto insert_cleanup;
+ assert( pColumn->eU4!=EU4_EXPR );
+ pColumn->eU4 = EU4_IDX;
+ for(i=0; inId; i++){
+ pColumn->a[i].u4.idx = -1;
+ }
for(i=0; inId; i++){
- const char *zCName = pColumn->a[i].zName;
- u8 hName = sqlite3StrIHash(zCName);
for(j=0; jnCol; j++){
- if( pTab->aCol[j].hName!=hName ) continue;
- if( sqlite3StrICmp(zCName, pTab->aCol[j].zCnName)==0 ){
- if( aTabColMap[j]==0 ) aTabColMap[j] = i+1;
+ if( sqlite3StrICmp(pColumn->a[i].zName, pTab->aCol[j].zCnName)==0 ){
+ pColumn->a[i].u4.idx = j;
if( i!=j ) bIdListInOrder = 0;
if( j==pTab->iPKey ){
ipkColumn = i; assert( !withoutRowid );
@@ -138020,9 +138084,9 @@ SQLITE_PRIVATE void sqlite3Insert(
}
}
if( pColumn ){
- j = aTabColMap[i];
- assert( j>=0 && j<=pColumn->nId );
- if( j==0 ){
+ assert( pColumn->eU4==EU4_IDX );
+ for(j=0; jnId && pColumn->a[j].u4.idx!=i; j++){}
+ if( j>=pColumn->nId ){
/* A column not named in the insert column list gets its
** default value */
sqlite3ExprCodeFactorable(pParse,
@@ -138030,7 +138094,7 @@ SQLITE_PRIVATE void sqlite3Insert(
iRegStore);
continue;
}
- k = j - 1;
+ k = j;
}else if( nColumn==0 ){
/* This is INSERT INTO ... DEFAULT VALUES. Load the default value. */
sqlite3ExprCodeFactorable(pParse,
@@ -138275,10 +138339,7 @@ SQLITE_PRIVATE void sqlite3Insert(
sqlite3ExprListDelete(db, pList);
sqlite3UpsertDelete(db, pUpsert);
sqlite3SelectDelete(db, pSelect);
- if( pColumn ){
- sqlite3IdListDelete(db, pColumn);
- sqlite3DbFree(db, aTabColMap);
- }
+ sqlite3IdListDelete(db, pColumn);
if( aRegIdx ) sqlite3DbNNFreeNN(db, aRegIdx);
}
@@ -140066,6 +140127,7 @@ SQLITE_API int sqlite3_exec(
int nCol = 0;
char **azVals = 0;
+ sqlite3PrepareTimeSet(db->aSchemaTime, SCHEMA_TIME_BEFORE_PREPARE);
pStmt = 0;
rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, &zLeftover);
assert( rc==SQLITE_OK || pStmt==0 );
@@ -140079,6 +140141,7 @@ SQLITE_API int sqlite3_exec(
}
callbackIsInit = 0;
+ sqlite3PrepareTimeSet(db->aSchemaTime, SCHEMA_TIME_BEFORE_STEP);
while( 1 ){
int i;
rc = sqlite3_step(pStmt);
@@ -140124,6 +140187,7 @@ SQLITE_API int sqlite3_exec(
}
}
+ sqlite3PrepareTimeSet(db->aSchemaTime, SCHEMA_TIME_BEFORE_FINALIZE);
if( rc!=SQLITE_ROW ){
rc = sqlite3VdbeFinalize((Vdbe *)pStmt);
pStmt = 0;
@@ -142907,6 +142971,7 @@ SQLITE_PRIVATE void sqlite3Pragma(
Vdbe *v = sqlite3GetVdbe(pParse); /* Prepared statement */
const PragmaName *pPragma; /* The pragma */
+ sqlite3PrepareTimeSet(db->aPrepareTime, PREPARE_TIME_BEGINPRAGMA);
if( v==0 ) return;
sqlite3VdbeRunOnlyOnce(v);
pParse->nMem = 2;
@@ -142932,11 +142997,13 @@ SQLITE_PRIVATE void sqlite3Pragma(
zRight = sqlite3NameFromToken(db, pValue);
}
+ sqlite3PrepareTimeSet(db->aPrepareTime, PREPARE_TIME_BEGINAUTHCHECK);
assert( pId2 );
zDb = pId2->n>0 ? pDb->zDbSName : 0;
if( sqlite3AuthCheck(pParse, SQLITE_PRAGMA, zLeft, zRight, zDb) ){
goto pragma_out;
}
+ sqlite3PrepareTimeSet(db->aPrepareTime, PREPARE_TIME_ENDAUTHCHECK);
/* Send an SQLITE_FCNTL_PRAGMA file-control to the underlying VFS
** connection. If it returns SQLITE_OK, then assume that the VFS
@@ -142984,10 +143051,12 @@ SQLITE_PRIVATE void sqlite3Pragma(
goto pragma_out;
}
+ sqlite3PrepareTimeSet(db->aPrepareTime, PREPARE_TIME_BEGINLOADSCHEMA);
/* Make sure the database schema is loaded if the pragma requires that */
if( (pPragma->mPragFlg & PragFlg_NeedSchema)!=0 ){
if( sqlite3ReadSchema(pParse) ) goto pragma_out;
}
+ sqlite3PrepareTimeSet(db->aPrepareTime, PREPARE_TIME_ENDLOADSCHEMA);
/* Register the result column names for pragmas that return results */
if( (pPragma->mPragFlg & PragFlg_NoColumns)==0
@@ -143347,6 +143416,7 @@ SQLITE_PRIVATE void sqlite3Pragma(
*/
case PragTyp_CACHE_SIZE: {
assert( sqlite3SchemaMutexHeld(db, iDb, 0) );
+ sqlite3PrepareTimeSet(db->aPrepareTime, PREPARE_TIME_BEGINCACHESIZE);
if( !zRight ){
returnSingleInt(v, pDb->pSchema->cache_size);
}else{
@@ -143354,6 +143424,7 @@ SQLITE_PRIVATE void sqlite3Pragma(
pDb->pSchema->cache_size = size;
sqlite3BtreeSetCacheSize(pDb->pBt, pDb->pSchema->cache_size);
}
+ sqlite3PrepareTimeSet(db->aPrepareTime, PREPARE_TIME_ENDCACHESIZE);
break;
}
@@ -143626,6 +143697,12 @@ SQLITE_PRIVATE void sqlite3Pragma(
** in auto-commit mode. */
mask &= ~(SQLITE_ForeignKeys);
}
+#if SQLITE_USER_AUTHENTICATION
+ if( db->auth.authLevel==UAUTH_User ){
+ /* Do not allow non-admin users to modify the schema arbitrarily */
+ mask &= ~(SQLITE_WriteSchema);
+ }
+#endif
if( sqlite3GetBoolean(zRight, 0) ){
if( (mask & SQLITE_WriteSchema)==0
@@ -143761,8 +143838,7 @@ SQLITE_PRIVATE void sqlite3Pragma(
char *zSql = sqlite3MPrintf(db, "SELECT*FROM\"%w\"", pTab->zName);
if( zSql ){
sqlite3_stmt *pDummy = 0;
- (void)sqlite3_prepare_v3(db, zSql, -1, SQLITE_PREPARE_DONT_LOG,
- &pDummy, 0);
+ (void)sqlite3_prepare(db, zSql, -1, &pDummy, 0);
(void)sqlite3_finalize(pDummy);
sqlite3DbFree(db, zSql);
}
@@ -144238,7 +144314,6 @@ SQLITE_PRIVATE void sqlite3Pragma(
/* Make sure sufficient number of registers have been allocated */
sqlite3TouchRegister(pParse, 8+cnt);
- sqlite3VdbeAddOp3(v, OP_Null, 0, 8, 8+cnt);
sqlite3ClearTempRegCache(pParse);
/* Do the b-tree integrity checks */
@@ -145236,6 +145311,7 @@ SQLITE_PRIVATE void sqlite3Pragma(
pragma_out:
sqlite3DbFree(db, zLeft);
sqlite3DbFree(db, zRight);
+ sqlite3PrepareTimeSet(db->aPrepareTime, PREPARE_TIME_ENDPRAGMA);
}
#ifndef SQLITE_OMIT_VIRTUALTABLE
/*****************************************************************************
@@ -145766,6 +145842,11 @@ SQLITE_PRIVATE int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg, u32 mFl
int openedTransaction = 0;
int mask = ((db->mDbFlags & DBFLAG_EncodingFixed) | ~DBFLAG_EncodingFixed);
+ u64 aSchemaTime[SCHEMA_TIME_N];
+ memset(aSchemaTime, 0, sizeof(aSchemaTime));
+ db->aSchemaTime = aSchemaTime;
+ sqlite3PrepareTimeSet(aSchemaTime, SCHEMA_TIME_START);
+
assert( (db->mDbFlags & DBFLAG_SchemaKnownOk)==0 );
assert( iDb>=0 && iDbnDb );
assert( db->aDb[iDb].pSchema );
@@ -145800,6 +145881,8 @@ SQLITE_PRIVATE int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg, u32 mFl
goto error_out;
}
+ sqlite3PrepareTimeSet(aSchemaTime, SCHEMA_TIME_AFTER_CREATE_1);
+
/* Create a cursor to hold the database open
*/
pDb = &db->aDb[iDb];
@@ -145823,6 +145906,8 @@ SQLITE_PRIVATE int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg, u32 mFl
openedTransaction = 1;
}
+ sqlite3PrepareTimeSet(aSchemaTime, SCHEMA_TIME_AFTER_OPEN_TRANS);
+
/* Get the database meta information.
**
** Meta values are as follows:
@@ -145848,6 +145933,8 @@ SQLITE_PRIVATE int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg, u32 mFl
}
pDb->pSchema->schema_cookie = meta[BTREE_SCHEMA_VERSION-1];
+ sqlite3PrepareTimeSet(aSchemaTime, SCHEMA_TIME_AFTER_GET_META);
+
/* If opening a non-empty database, check the text encoding. For the
** main database, set sqlite3.enc to the encoding of the main database.
** For an attached db, it is an error if the encoding is not the same
@@ -145863,7 +145950,14 @@ SQLITE_PRIVATE int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg, u32 mFl
#else
encoding = SQLITE_UTF8;
#endif
- sqlite3SetTextEncoding(db, encoding);
+ if( db->nVdbeActive>0 && encoding!=ENC(db)
+ && (db->mDbFlags & DBFLAG_Vacuum)==0
+ ){
+ rc = SQLITE_LOCKED;
+ goto initone_error_out;
+ }else{
+ sqlite3SetTextEncoding(db, encoding);
+ }
}else{
/* If opening an attached database, the encoding much match ENC(db) */
if( (meta[BTREE_TEXT_ENCODING-1] & 3)!=ENC(db) ){
@@ -145876,6 +145970,8 @@ SQLITE_PRIVATE int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg, u32 mFl
}
pDb->pSchema->enc = ENC(db);
+ sqlite3PrepareTimeSet(aSchemaTime, SCHEMA_TIME_AFTER_FIX_ENCODING);
+
if( pDb->pSchema->cache_size==0 ){
#ifndef SQLITE_OMIT_DEPRECATED
size = sqlite3AbsInt32(meta[BTREE_DEFAULT_CACHE_SIZE-1]);
@@ -145887,6 +145983,8 @@ SQLITE_PRIVATE int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg, u32 mFl
sqlite3BtreeSetCacheSize(pDb->pBt, pDb->pSchema->cache_size);
}
+ sqlite3PrepareTimeSet(aSchemaTime, SCHEMA_TIME_AFTER_SETCACHESIZE);
+
/*
** file_format==1 Version 3.0.0.
** file_format==2 Version 3.1.3. // ALTER TABLE ADD COLUMN
@@ -145927,6 +146025,7 @@ SQLITE_PRIVATE int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg, u32 mFl
xAuth = db->xAuth;
db->xAuth = 0;
#endif
+ sqlite3PrepareTimeSet(aSchemaTime, SCHEMA_TIME_BEGIN_EXEC);
rc = sqlite3_exec(db, zSql, sqlite3InitCallback, &initData, 0);
#ifndef SQLITE_OMIT_AUTHORIZATION
db->xAuth = xAuth;
@@ -145934,11 +146033,13 @@ SQLITE_PRIVATE int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg, u32 mFl
#endif
if( rc==SQLITE_OK ) rc = initData.rc;
sqlite3DbFree(db, zSql);
+ sqlite3PrepareTimeSet(aSchemaTime, SCHEMA_TIME_BEGIN_ANALYZE_LOAD);
#ifndef SQLITE_OMIT_ANALYZE
if( rc==SQLITE_OK ){
sqlite3AnalysisLoad(db, iDb);
}
#endif
+ sqlite3PrepareTimeSet(aSchemaTime, SCHEMA_TIME_END_ANALYZE_LOAD);
}
assert( pDb == &(db->aDb[iDb]) );
if( db->mallocFailed ){
@@ -145972,6 +146073,12 @@ SQLITE_PRIVATE int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg, u32 mFl
sqlite3BtreeLeave(pDb->pBt);
error_out:
+ db->aSchemaTime = 0;
+ sqlite3PrepareTimeSet(aSchemaTime, SCHEMA_TIME_FINISH);
+ if( rc==SQLITE_OK && iDb==0 ){
+ const char *zFile = sqlite3BtreeGetFilename(pDb->pBt);
+ sqlite3SchemaTimeLog(aSchemaTime, zFile);
+ }
if( rc ){
if( rc==SQLITE_NOMEM || rc==SQLITE_IOERR_NOMEM ){
sqlite3OomFault(db);
@@ -146332,14 +146439,18 @@ static int sqlite3Prepare(
}
zSqlCopy = sqlite3DbStrNDup(db, zSql, nBytes);
if( zSqlCopy ){
+ sqlite3PrepareTimeSet(db->aPrepareTime, PREPARE_TIME_BEGINPARSE);
sqlite3RunParser(&sParse, zSqlCopy);
+ sqlite3PrepareTimeSet(db->aPrepareTime, PREPARE_TIME_ENDPARSE);
sParse.zTail = &zSql[sParse.zTail-zSqlCopy];
sqlite3DbFree(db, zSqlCopy);
}else{
sParse.zTail = &zSql[nBytes];
}
}else{
+ sqlite3PrepareTimeSet(db->aPrepareTime, PREPARE_TIME_BEGINPARSE);
sqlite3RunParser(&sParse, zSql);
+ sqlite3PrepareTimeSet(db->aPrepareTime, PREPARE_TIME_ENDPARSE);
}
assert( 0==sParse.nQueryLoop );
@@ -146400,6 +146511,12 @@ static int sqlite3LockAndPrepare(
){
int rc;
int cnt = 0;
+ u64 *aPrepareSave = db->aPrepareTime;
+
+ u64 aPrepareTime[PREPARE_TIME_N];
+ memset(aPrepareTime, 0, sizeof(aPrepareTime));
+ sqlite3PrepareTimeSet(aPrepareTime, PREPARE_TIME_START);
+ db->aPrepareTime = aPrepareTime;
#ifdef SQLITE_ENABLE_API_ARMOR
if( ppStmt==0 ) return SQLITE_MISUSE_BKPT;
@@ -146425,6 +146542,11 @@ static int sqlite3LockAndPrepare(
db->busyHandler.nBusy = 0;
sqlite3_mutex_leave(db->mutex);
assert( rc==SQLITE_OK || (*ppStmt)==0 );
+
+ db->aPrepareTime = aPrepareSave;
+ sqlite3PrepareTimeSet(aPrepareTime, PREPARE_TIME_FINISH);
+ sqlite3PrepareTimeLog(zSql, nBytes, aPrepareTime);
+
return rc;
}
@@ -146557,24 +146679,12 @@ static int sqlite3Prepare16(
if( !sqlite3SafetyCheckOk(db)||zSql==0 ){
return SQLITE_MISUSE_BKPT;
}
-
- /* Make sure nBytes is non-negative and correct. It should be the
- ** number of bytes until the end of the input buffer or until the first
- ** U+0000 character. If the input nBytes is odd, convert it into
- ** an even number. If the input nBytes is negative, then the input
- ** must be terminated by at least one U+0000 character */
if( nBytes>=0 ){
int sz;
const char *z = (const char*)zSql;
for(sz=0; szmutex);
zSql8 = sqlite3Utf16to8(db, zSql, nBytes, SQLITE_UTF16NATIVE);
if( zSql8 ){
@@ -146588,7 +146698,7 @@ static int sqlite3Prepare16(
** the same number of characters into the UTF-16 string.
*/
int chars_parsed = sqlite3Utf8CharLen(zSql8, (int)(zTail8-zSql8));
- *pzTail = (u8 *)zSql + sqlite3Utf16ByteLen(zSql, nBytes, chars_parsed);
+ *pzTail = (u8 *)zSql + sqlite3Utf16ByteLen(zSql, chars_parsed);
}
sqlite3DbFree(db, zSql8);
rc = sqlite3ApiExit(db, rc);
@@ -150561,32 +150671,32 @@ static Expr *substExpr(
if( pSubst->isOuterJoin ){
ExprSetProperty(pNew, EP_CanBeNull);
}
- if( pNew->op==TK_TRUEFALSE ){
- pNew->u.iValue = sqlite3ExprTruthValue(pNew);
- pNew->op = TK_INTEGER;
- ExprSetProperty(pNew, EP_IntValue);
+ if( ExprHasProperty(pExpr,EP_OuterON|EP_InnerON) ){
+ sqlite3SetJoinExpr(pNew, pExpr->w.iJoin,
+ pExpr->flags & (EP_OuterON|EP_InnerON));
+ }
+ sqlite3ExprDelete(db, pExpr);
+ pExpr = pNew;
+ if( pExpr->op==TK_TRUEFALSE ){
+ pExpr->u.iValue = sqlite3ExprTruthValue(pExpr);
+ pExpr->op = TK_INTEGER;
+ ExprSetProperty(pExpr, EP_IntValue);
}
/* Ensure that the expression now has an implicit collation sequence,
** just as it did when it was a column of a view or sub-query. */
{
- CollSeq *pNat = sqlite3ExprCollSeq(pSubst->pParse, pNew);
+ CollSeq *pNat = sqlite3ExprCollSeq(pSubst->pParse, pExpr);
CollSeq *pColl = sqlite3ExprCollSeq(pSubst->pParse,
pSubst->pCList->a[iColumn].pExpr
);
- if( pNat!=pColl || (pNew->op!=TK_COLUMN && pNew->op!=TK_COLLATE) ){
- pNew = sqlite3ExprAddCollateString(pSubst->pParse, pNew,
+ if( pNat!=pColl || (pExpr->op!=TK_COLUMN && pExpr->op!=TK_COLLATE) ){
+ pExpr = sqlite3ExprAddCollateString(pSubst->pParse, pExpr,
(pColl ? pColl->zName : "BINARY")
);
}
}
- ExprClearProperty(pNew, EP_Collate);
- if( ExprHasProperty(pExpr,EP_OuterON|EP_InnerON) ){
- sqlite3SetJoinExpr(pNew, pExpr->w.iJoin,
- pExpr->flags & (EP_OuterON|EP_InnerON));
- }
- sqlite3ExprDelete(db, pExpr);
- pExpr = pNew;
+ ExprClearProperty(pExpr, EP_Collate);
}
}
}else{
@@ -151323,7 +151433,6 @@ static int flattenSubquery(
/* Transfer the FROM clause terms from the subquery into the
** outer query.
*/
- iNewParent = pSubSrc->a[0].iCursor;
for(i=0; ia[i+iFrom];
assert( pItem->fg.isTabFunc==0 );
@@ -151333,6 +151442,7 @@ static int flattenSubquery(
if( pItem->fg.isUsing ) sqlite3IdListDelete(db, pItem->u3.pUsing);
*pItem = pSubSrc->a[i];
pItem->fg.jointype |= ltorj;
+ iNewParent = pSubSrc->a[i].iCursor;
memset(&pSubSrc->a[i], 0, sizeof(pSubSrc->a[i]));
}
pSrc->a[iFrom].fg.jointype &= JT_LTORJ;
@@ -151372,7 +151482,6 @@ static int flattenSubquery(
pWhere = pSub->pWhere;
pSub->pWhere = 0;
if( isOuterJoin>0 ){
- assert( pSubSrc->nSrc==1 );
sqlite3SetJoinExpr(pWhere, iNewParent, EP_OuterON);
}
if( pWhere ){
@@ -154472,7 +154581,7 @@ SQLITE_PRIVATE int sqlite3Select(
#endif
assert( pSubq->pSelect && (pSub->selFlags & SF_PushDown)!=0 );
}else{
- TREETRACE(0x4000,pParse,p,("WHERE-clause push-down not possible\n"));
+ TREETRACE(0x4000,pParse,p,("WHERE-lcause push-down not possible\n"));
}
/* Convert unused result columns of the subquery into simple NULL
@@ -160156,9 +160265,7 @@ SQLITE_API int sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable){
z = (const unsigned char*)zCreateTable;
for(i=0; aKeyword[i]; i++){
int tokenType = 0;
- do{
- z += sqlite3GetToken(z, &tokenType);
- }while( tokenType==TK_SPACE || tokenType==TK_COMMENT );
+ do{ z += sqlite3GetToken(z, &tokenType); }while( tokenType==TK_SPACE );
if( tokenType!=aKeyword[i] ){
sqlite3ErrorWithMsg(db, SQLITE_ERROR, "syntax error");
return SQLITE_ERROR;
@@ -160195,7 +160302,6 @@ SQLITE_API int sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable){
Table *pNew = sParse.pNewTable;
Index *pIdx;
pTab->aCol = pNew->aCol;
- assert( IsOrdinaryTable(pNew) );
sqlite3ExprListDelete(db, pNew->u.tab.pDfltList);
pTab->nNVCol = pTab->nCol = pNew->nCol;
pTab->tabFlags |= pNew->tabFlags & (TF_WithoutRowid|TF_NoVisibleRowid);
@@ -160889,10 +160995,8 @@ struct WhereLoop {
/**** whereLoopXfer() copies fields above ***********************/
# define WHERE_LOOP_XFER_SZ offsetof(WhereLoop,nLSlot)
u16 nLSlot; /* Number of slots allocated for aLTerm[] */
-#ifdef WHERETRACE_ENABLED
LogEst rStarDelta; /* Cost delta due to star-schema heuristic. Not
- ** initialized unless pWInfo->bStarUsed */
-#endif
+ ** initialized unless pWInfo->nOutStarDelta>0 */
WhereTerm **aLTerm; /* WhereTerms used */
WhereLoop *pNextLoop; /* Next WhereLoop object in the WhereClause */
WhereTerm *aLTermSpace[3]; /* Initial aLTerm[] space */
@@ -160941,7 +161045,7 @@ struct WherePath {
Bitmask revLoop; /* aLoop[]s that should be reversed for ORDER BY */
LogEst nRow; /* Estimated number of rows generated by this path */
LogEst rCost; /* Total cost of this path */
- LogEst rUnsort; /* Total cost of this path ignoring sorting costs */
+ LogEst rUnsorted; /* Total cost of this path ignoring sorting costs */
i8 isOrdered; /* No. of ORDER BY terms satisfied. -1 for unknown */
WhereLoop **aLoop; /* Array of WhereLoop objects implementing this path */
};
@@ -161214,13 +161318,9 @@ struct WhereInfo {
unsigned bDeferredSeek :1; /* Uses OP_DeferredSeek */
unsigned untestedTerms :1; /* Not all WHERE terms resolved by outer loop */
unsigned bOrderedInnerLoop:1;/* True if only the inner-most loop is ordered */
- unsigned sorted :1; /* True if really sorted (not just grouped) */
- unsigned bStarDone :1; /* True if check for star-query is complete */
- unsigned bStarUsed :1; /* True if star-query heuristic is used */
+ unsigned sorted :1; /* True if really sorted (not just grouped) */
+ LogEst nOutStarDelta; /* Artifical nOut reduction for star-query */
LogEst nRowOut; /* Estimated number of output rows */
-#ifdef WHERETRACE_ENABLED
- LogEst rTotalCost; /* Total cost of the solution */
-#endif
int iTop; /* The very beginning of the WHERE loop */
int iEndWhere; /* End of the WHERE clause itself */
WhereLoop *pLoops; /* List of all WhereLoop objects */
@@ -161266,17 +161366,9 @@ SQLITE_PRIVATE int sqlite3WhereExplainBloomFilter(
const WhereInfo *pWInfo, /* WHERE clause */
const WhereLevel *pLevel /* Bloom filter on this level */
);
-SQLITE_PRIVATE void sqlite3WhereAddExplainText(
- Parse *pParse, /* Parse context */
- int addr,
- SrcList *pTabList, /* Table list this loop refers to */
- WhereLevel *pLevel, /* Scan to write OP_Explain opcode for */
- u16 wctrlFlags /* Flags passed to sqlite3WhereBegin() */
-);
#else
# define sqlite3WhereExplainOneScan(u,v,w,x) 0
# define sqlite3WhereExplainBloomFilter(u,v,w) 0
-# define sqlite3WhereAddExplainText(u,v,w,x,y)
#endif /* SQLITE_OMIT_EXPLAIN */
#ifdef SQLITE_ENABLE_STMT_SCANSTATUS
SQLITE_PRIVATE void sqlite3WhereAddScanStatus(
@@ -161478,38 +161570,38 @@ static void explainIndexRange(StrAccum *pStr, WhereLoop *pLoop){
}
/*
-** This function sets the P4 value of an existing OP_Explain opcode to
-** text describing the loop in pLevel. If the OP_Explain opcode already has
-** a P4 value, it is freed before it is overwritten.
+** This function is a no-op unless currently processing an EXPLAIN QUERY PLAN
+** command, or if stmt_scanstatus_v2() stats are enabled, or if SQLITE_DEBUG
+** was defined at compile-time. If it is not a no-op, a single OP_Explain
+** opcode is added to the output to describe the table scan strategy in pLevel.
+**
+** If an OP_Explain opcode is added to the VM, its address is returned.
+** Otherwise, if no OP_Explain is coded, zero is returned.
*/
-SQLITE_PRIVATE void sqlite3WhereAddExplainText(
+SQLITE_PRIVATE int sqlite3WhereExplainOneScan(
Parse *pParse, /* Parse context */
- int addr, /* Address of OP_Explain opcode */
SrcList *pTabList, /* Table list this loop refers to */
WhereLevel *pLevel, /* Scan to write OP_Explain opcode for */
u16 wctrlFlags /* Flags passed to sqlite3WhereBegin() */
){
+ int ret = 0;
#if !defined(SQLITE_DEBUG)
if( sqlite3ParseToplevel(pParse)->explain==2 || IS_STMT_SCANSTATUS(pParse->db) )
#endif
{
- VdbeOp *pOp = sqlite3VdbeGetOp(pParse->pVdbe, addr);
-
SrcItem *pItem = &pTabList->a[pLevel->iFrom];
+ Vdbe *v = pParse->pVdbe; /* VM being constructed */
sqlite3 *db = pParse->db; /* Database handle */
int isSearch; /* True for a SEARCH. False for SCAN. */
WhereLoop *pLoop; /* The controlling WhereLoop object */
u32 flags; /* Flags that describe this loop */
-#if defined(SQLITE_DEBUG) && !defined(SQLITE_OMIT_EXPLAIN)
char *zMsg; /* Text to add to EQP output */
-#endif
StrAccum str; /* EQP output string */
char zBuf[100]; /* Initial space for EQP output string */
- if( db->mallocFailed ) return;
-
pLoop = pLevel->pWLoop;
flags = pLoop->wsFlags;
+ if( (flags&WHERE_MULTI_OR) || (wctrlFlags&WHERE_OR_SUBCLAUSE) ) return 0;
isSearch = (flags&(WHERE_BTM_LIMIT|WHERE_TOP_LIMIT))!=0
|| ((flags&WHERE_VIRTUALTABLE)==0 && (pLoop->u.btree.nEq>0))
@@ -161533,7 +161625,7 @@ SQLITE_PRIVATE void sqlite3WhereAddExplainText(
zFmt = "AUTOMATIC PARTIAL COVERING INDEX";
}else if( flags & WHERE_AUTO_INDEX ){
zFmt = "AUTOMATIC COVERING INDEX";
- }else if( flags & (WHERE_IDX_ONLY|WHERE_EXPRIDX) ){
+ }else if( flags & WHERE_IDX_ONLY ){
zFmt = "COVERING INDEX %s";
}else{
zFmt = "INDEX %s";
@@ -161585,50 +161677,11 @@ SQLITE_PRIVATE void sqlite3WhereAddExplainText(
sqlite3_str_append(&str, " (~1 row)", 9);
}
#endif
-#if defined(SQLITE_DEBUG) && !defined(SQLITE_OMIT_EXPLAIN)
zMsg = sqlite3StrAccumFinish(&str);
sqlite3ExplainBreakpoint("",zMsg);
-#endif
-
- assert( pOp->opcode==OP_Explain );
- assert( pOp->p4type==P4_DYNAMIC || pOp->p4.z==0 );
- sqlite3DbFree(db, pOp->p4.z);
- pOp->p4type = P4_DYNAMIC;
- pOp->p4.z = sqlite3StrAccumFinish(&str);
- }
-}
-
-
-/*
-** This function is a no-op unless currently processing an EXPLAIN QUERY PLAN
-** command, or if stmt_scanstatus_v2() stats are enabled, or if SQLITE_DEBUG
-** was defined at compile-time. If it is not a no-op, a single OP_Explain
-** opcode is added to the output to describe the table scan strategy in pLevel.
-**
-** If an OP_Explain opcode is added to the VM, its address is returned.
-** Otherwise, if no OP_Explain is coded, zero is returned.
-*/
-SQLITE_PRIVATE int sqlite3WhereExplainOneScan(
- Parse *pParse, /* Parse context */
- SrcList *pTabList, /* Table list this loop refers to */
- WhereLevel *pLevel, /* Scan to write OP_Explain opcode for */
- u16 wctrlFlags /* Flags passed to sqlite3WhereBegin() */
-){
- int ret = 0;
-#if !defined(SQLITE_DEBUG)
- if( sqlite3ParseToplevel(pParse)->explain==2 || IS_STMT_SCANSTATUS(pParse->db) )
-#endif
- {
- if( (pLevel->pWLoop->wsFlags & WHERE_MULTI_OR)==0
- && (wctrlFlags & WHERE_OR_SUBCLAUSE)==0
- ){
- Vdbe *v = pParse->pVdbe;
- int addr = sqlite3VdbeCurrentAddr(v);
- ret = sqlite3VdbeAddOp3(
- v, OP_Explain, addr, pParse->addrExplain, pLevel->pWLoop->rRun
- );
- sqlite3WhereAddExplainText(pParse, addr, pTabList, pLevel, wctrlFlags);
- }
+ ret = sqlite3VdbeAddOp4(v, OP_Explain, sqlite3VdbeCurrentAddr(v),
+ pParse->addrExplain, pLoop->rRun,
+ zMsg, P4_DYNAMIC);
}
return ret;
}
@@ -161727,10 +161780,9 @@ SQLITE_PRIVATE void sqlite3WhereAddScanStatus(
}
}else{
int addr;
- VdbeOp *pOp;
assert( pSrclist->a[pLvl->iFrom].fg.isSubquery );
addr = pSrclist->a[pLvl->iFrom].u4.pSubq->addrFillSub;
- pOp = sqlite3VdbeGetOp(v, addr-1);
+ VdbeOp *pOp = sqlite3VdbeGetOp(v, addr-1);
assert( sqlite3VdbeDb(v)->mallocFailed || pOp->opcode==OP_InitCoroutine );
assert( sqlite3VdbeDb(v)->mallocFailed || pOp->p2>addr );
sqlite3VdbeScanStatusRange(v, addrExplain, addr, pOp->p2-1);
@@ -161983,7 +162035,6 @@ static Expr *removeUnindexableInClauseTerms(
pNew->pLeft->x.pList = pLhs;
}
pSelect->pEList = pRhs;
- pSelect->selId = ++pParse->nSelect; /* Req'd for SubrtnSig validity */
if( pLhs && pLhs->nExpr==1 ){
/* Take care here not to generate a TK_VECTOR containing only a
** single value. Since the parser never creates such a vector, some
@@ -164531,27 +164582,20 @@ static int isLikeOrGlob(
z = (u8*)pRight->u.zToken;
}
if( z ){
- /* Count the number of prefix bytes prior to the first wildcard,
- ** U+fffd character, or malformed utf-8. If the underlying database
- ** has a UTF16LE encoding, then only consider ASCII characters. Note that
- ** the encoding of z[] is UTF8 - we are dealing with only UTF8 here in this
- ** code, but the database engine itself might be processing content using a
- ** different encoding. */
+
+ /* Count the number of prefix characters prior to the first wildcard.
+ ** If the underlying database has a UTF16LE encoding, then only consider
+ ** ASCII characters. Note that the encoding of z[] is UTF8 - we are
+ ** dealing with only UTF8 here in this code, but the database engine
+ ** itself might be processing content using a different encoding. */
cnt = 0;
while( (c=z[cnt])!=0 && c!=wc[0] && c!=wc[1] && c!=wc[2] ){
cnt++;
- if( c==wc[3] && z[cnt]>0 && z[cnt]<0x80 ){
+ if( c==wc[3] && z[cnt]!=0 ){
cnt++;
- }else if( c>=0x80 ){
- const u8 *z2 = z+cnt-1;
- if( c==0xff || sqlite3Utf8Read(&z2)==0xfffd /* bad utf-8 */
- || ENC(db)==SQLITE_UTF16LE
- ){
- cnt--;
- break;
- }else{
- cnt = (int)(z2-z);
- }
+ }else if( c>=0x80 && ENC(db)==SQLITE_UTF16LE ){
+ cnt--;
+ break;
}
}
@@ -164563,7 +164607,7 @@ static int isLikeOrGlob(
** range search. The third is because the caller assumes that the pattern
** consists of at least one character after all escapes have been
** removed. */
- if( (cnt>1 || (cnt>0 && z[0]!=wc[3])) && ALWAYS(255!=(u8)z[cnt-1]) ){
+ if( (cnt>1 || (cnt>0 && z[0]!=wc[3])) && 255!=(u8)z[cnt-1] ){
Expr *pPrefix;
/* A "complete" match if the pattern ends with "*" or "%" */
@@ -165698,8 +165742,9 @@ static void exprAnalyze(
}
if( !db->mallocFailed ){
- u8 *pC; /* Last character before the first wildcard */
+ u8 c, *pC; /* Last character before the first wildcard */
pC = (u8*)&pStr2->u.zToken[sqlite3Strlen30(pStr2->u.zToken)-1];
+ c = *pC;
if( noCase ){
/* The point is to increment the last character before the first
** wildcard. But if we increment '@', that will push it into the
@@ -165707,17 +165752,10 @@ static void exprAnalyze(
** inequality. To avoid this, make sure to also run the full
** LIKE on all candidate expressions by clearing the isComplete flag
*/
- if( *pC=='A'-1 ) isComplete = 0;
- *pC = sqlite3UpperToLower[*pC];
- }
-
- /* Increment the value of the last utf8 character in the prefix. */
- while( *pC==0xBF && pC>(u8*)pStr2->u.zToken ){
- *pC = 0x80;
- pC--;
+ if( c=='A'-1 ) isComplete = 0;
+ c = sqlite3UpperToLower[c];
}
- assert( *pC!=0xFF ); /* isLikeOrGlob() guarantees this */
- (*pC)++;
+ *pC = c + 1;
}
zCollSeqName = noCase ? "NOCASE" : sqlite3StrBINARY;
pNewExpr1 = sqlite3ExprDup(db, pLeft, 0);
@@ -167064,7 +167102,7 @@ static int constraintCompatibleWithOuterJoin(
return 0;
}
if( (pSrc->fg.jointype & (JT_LEFT|JT_RIGHT))!=0
- && NEVER(ExprHasProperty(pTerm->pExpr, EP_InnerON))
+ && ExprHasProperty(pTerm->pExpr, EP_InnerON)
){
return 0;
}
@@ -167085,11 +167123,6 @@ static int constraintCompatibleWithOuterJoin(
** more than 20, then return false.
**
** 3. If no disqualifying conditions above are found, return true.
-**
-** 2025-01-03: I experimented with a new rule that returns false if the
-** the datatype of the column is "BOOLEAN". This did not improve
-** performance on any queries at hand, but it did burn CPU cycles, so the
-** idea was not committed.
*/
static SQLITE_NOINLINE int columnIsGoodIndexCandidate(
const Table *pTab,
@@ -167174,7 +167207,7 @@ static void explainAutomaticIndex(
sqlite3_str *pStr = sqlite3_str_new(pParse->db);
sqlite3_str_appendf(pStr,"CREATE AUTOMATIC INDEX ON %s(", pTab->zName);
assert( pIdx->nColumn>1 );
- assert( pIdx->aiColumn[pIdx->nColumn-1]==XN_ROWID || !HasRowid(pTab) );
+ assert( pIdx->aiColumn[pIdx->nColumn-1]==XN_ROWID );
for(ii=0; ii<(pIdx->nColumn-1); ii++){
const char *zName = 0;
int iCol = pIdx->aiColumn[ii];
@@ -167305,19 +167338,6 @@ static SQLITE_NOINLINE void constructAutomaticIndex(
}else{
extraCols = pSrc->colUsed & (~idxCols | MASKBIT(BMS-1));
}
- if( !HasRowid(pTable) ){
- /* For WITHOUT ROWID tables, ensure that all PRIMARY KEY columns are
- ** either in the idxCols mask or in the extraCols mask */
- for(i=0; inCol; i++){
- if( (pTable->aCol[i].colFlags & COLFLAG_PRIMKEY)==0 ) continue;
- if( i>=BMS-1 ){
- extraCols |= MASKBIT(BMS-1);
- break;
- }
- if( idxCols & MASKBIT(i) ) continue;
- extraCols |= MASKBIT(i);
- }
- }
mxBitCol = MIN(BMS-1,pTable->nCol);
testcase( pTable->nCol==BMS-1 );
testcase( pTable->nCol==BMS-2 );
@@ -167329,8 +167349,7 @@ static SQLITE_NOINLINE void constructAutomaticIndex(
}
/* Construct the Index object to describe this index */
- pIdx = sqlite3AllocateIndexObject(pParse->db, nKeyCol+HasRowid(pTable),
- 0, &zNotUsed);
+ pIdx = sqlite3AllocateIndexObject(pParse->db, nKeyCol+1, 0, &zNotUsed);
if( pIdx==0 ) goto end_auto_index_create;
pLoop->u.btree.pIndex = pIdx;
pIdx->zName = "auto-index";
@@ -167386,10 +167405,8 @@ static SQLITE_NOINLINE void constructAutomaticIndex(
}
}
assert( n==nKeyCol );
- if( HasRowid(pTable) ){
- pIdx->aiColumn[n] = XN_ROWID;
- pIdx->azColl[n] = sqlite3StrBINARY;
- }
+ pIdx->aiColumn[n] = XN_ROWID;
+ pIdx->azColl[n] = sqlite3StrBINARY;
/* Create the automatic index */
explainAutomaticIndex(pParse, pIdx, pPartial!=0, &addrExp);
@@ -167882,11 +167899,9 @@ static void freeIndexInfo(sqlite3 *db, sqlite3_index_info *pIdxInfo){
** that this is required.
*/
static int vtabBestIndex(Parse *pParse, Table *pTab, sqlite3_index_info *p){
+ sqlite3_vtab *pVtab = sqlite3GetVTable(pParse->db, pTab)->pVtab;
int rc;
- sqlite3_vtab *pVtab;
- assert( IsVirtual(pTab) );
- pVtab = sqlite3GetVTable(pParse->db, pTab)->pVtab;
whereTraceIndexInfoInputs(p, pTab);
pParse->db->nSchemaLock++;
rc = pVtab->pModule->xBestIndex(pVtab, p);
@@ -168578,7 +168593,7 @@ static int whereInScanEst(
#endif /* SQLITE_ENABLE_STAT4 */
-#if defined(WHERETRACE_ENABLED) || defined(SQLITE_DEBUG)
+#ifdef WHERETRACE_ENABLED
/*
** Print the content of a WhereTerm object
*/
@@ -168622,9 +168637,6 @@ SQLITE_PRIVATE void sqlite3WhereTermPrint(WhereTerm *pTerm, int iTerm){
sqlite3TreeViewExpr(0, pTerm->pExpr, 0);
}
}
-SQLITE_PRIVATE void sqlite3ShowWhereTerm(WhereTerm *pTerm){
- sqlite3WhereTermPrint(pTerm, 0);
-}
#endif
#ifdef WHERETRACE_ENABLED
@@ -168656,9 +168668,8 @@ SQLITE_PRIVATE void sqlite3WhereClausePrint(WhereClause *pWC){
** 1.002.001 t2.t2xy 2 f 010241 N 2 cost 0,56,31
*/
SQLITE_PRIVATE void sqlite3WhereLoopPrint(const WhereLoop *p, const WhereClause *pWC){
- WhereInfo *pWInfo;
if( pWC ){
- pWInfo = pWC->pWInfo;
+ WhereInfo *pWInfo = pWC->pWInfo;
int nb = 1+(pWInfo->pTabList->nSrc+3)/4;
SrcItem *pItem = pWInfo->pTabList->a + p->iTab;
Table *pTab = pItem->pSTab;
@@ -168668,7 +168679,6 @@ SQLITE_PRIVATE void sqlite3WhereLoopPrint(const WhereLoop *p, const WhereClause
sqlite3DebugPrintf(" %12s",
pItem->zAlias ? pItem->zAlias : pTab->zName);
}else{
- pWInfo = 0;
sqlite3DebugPrintf("%c%2d.%03llx.%03llx %c%d",
p->cId, p->iTab, p->maskSelf, p->prereq & 0xfff, p->cId, p->iTab);
}
@@ -168700,12 +168710,7 @@ SQLITE_PRIVATE void sqlite3WhereLoopPrint(const WhereLoop *p, const WhereClause
}else{
sqlite3DebugPrintf(" f %06x N %d", p->wsFlags, p->nLTerm);
}
- if( pWInfo && pWInfo->bStarUsed && p->rStarDelta!=0 ){
- sqlite3DebugPrintf(" cost %d,%d,%d delta=%d\n",
- p->rSetup, p->rRun, p->nOut, p->rStarDelta);
- }else{
- sqlite3DebugPrintf(" cost %d,%d,%d\n", p->rSetup, p->rRun, p->nOut);
- }
+ sqlite3DebugPrintf(" cost %d,%d,%d\n", p->rSetup, p->rRun, p->nOut);
if( p->nLTerm && (sqlite3WhereTrace & 0x4000)!=0 ){
int i;
for(i=0; inLTerm; i++){
@@ -168839,7 +168844,7 @@ static void whereInfoFree(sqlite3 *db, WhereInfo *pWInfo){
** and Y has additional constraints that might speed the search that X lacks
** but the cost of running X is not more than the cost of running Y.
**
-** In other words, return true if the cost relationship between X and Y
+** In other words, return true if the cost relationwship between X and Y
** is inverted and needs to be adjusted.
**
** Case 1:
@@ -169817,6 +169822,7 @@ static int whereUsablePartialIndex(
if( !whereUsablePartialIndex(iTab,jointype,pWC,pWhere->pLeft) ) return 0;
pWhere = pWhere->pRight;
}
+ if( pParse->db->flags & SQLITE_EnableQPSG ) pParse = 0;
for(i=0, pTerm=pWC->a; inTerm; i++, pTerm++){
Expr *pExpr;
pExpr = pTerm->pExpr;
@@ -170171,6 +170177,7 @@ static int whereLoopAddBtree(
&& (pWInfo->pParse->db->flags & SQLITE_AutoIndex)!=0
&& !pSrc->fg.isIndexedBy /* Has no INDEXED BY clause */
&& !pSrc->fg.notIndexed /* Has no NOT INDEXED clause */
+ && HasRowid(pTab) /* Not WITHOUT ROWID table. (FIXME: Why not?) */
&& !pSrc->fg.isCorrelated /* Not a correlated subquery */
&& !pSrc->fg.isRecursive /* Not a recursive common table expression. */
&& (pSrc->fg.jointype & JT_RIGHT)==0 /* Not the right tab of a RIGHT JOIN */
@@ -171673,201 +171680,68 @@ static LogEst whereSortingCost(
** 18 for star queries
** 12 otherwise
**
-** For the purposes of this heuristic, a star-query is defined as a query
-** with a large central table that is joined using an INNER JOIN,
-** not CROSS or OUTER JOINs, against four or more smaller tables.
-** The central table is called the "fact" table. The smaller tables
-** that get joined are "dimension tables". Also, any table that is
-** self-joined cannot be a dimension table; we assume that dimension
-** tables may only be joined against fact tables.
+** For the purposes of SQLite, a star-query is defined as a query
+** with a large central table that is joined against four or more
+** smaller tables. The central table is called the "fact" table.
+** The smaller tables that get joined are "dimension tables".
**
** SIDE EFFECT: (and really the whole point of this subroutine)
**
-** If pWInfo describes a star-query, then the cost for SCANs of dimension
-** WhereLoops is increased to be slightly larger than the cost of a SCAN
-** in the fact table. Only SCAN costs are increased. SEARCH costs are
-** unchanged. This heuristic helps keep fact tables in outer loops. Without
-** this heuristic, paths with fact tables in outer loops tend to get pruned
-** by the mxChoice limit on the number of paths, resulting in poor query
-** plans. See the starschema1.test test module for examples of queries
-** that need this heuristic to find good query plans.
-**
-** This heuristic can be completely disabled, so that no query is
-** considered a star-query, using SQLITE_TESTCTRL_OPTIMIZATION to
-** disable the SQLITE_StarQuery optimization. In the CLI, the command
-** to do that is: ".testctrl opt -starquery".
-**
-** HISTORICAL NOTES:
-**
-** This optimization was first added on 2024-05-09 by check-in 38db9b5c83d.
-** The original optimization reduced the cost and output size estimate for
-** fact tables to help them move to outer loops. But months later (as people
-** started upgrading) performance regression reports started caming in,
-** including:
-**
-** forum post b18ef983e68d06d1 (2024-12-21)
-** forum post 0025389d0860af82 (2025-01-14)
-** forum post d87570a145599033 (2025-01-17)
-**
-** To address these, the criteria for a star-query was tightened to exclude
-** cases where the fact and dimensions are separated by an outer join, and
-** the affect of star-schema detection was changed to increase the rRun cost
-** on just full table scans of dimension tables, rather than reducing costs
-** in the all access methods of the fact table.
+** If pWInfo describes a star-query, then the cost on WhereLoops for the
+** fact table is reduced. This heuristic helps keep fact tables in
+** outer loops. Without this heuristic, paths with fact tables in outer
+** loops tend to get pruned by the mxChoice limit on the number of paths,
+** resulting in poor query plans. The total amount of heuristic cost
+** adjustment is stored in pWInfo->nOutStarDelta and the cost adjustment
+** for each WhereLoop is stored in its rStarDelta field.
*/
-static int computeMxChoice(WhereInfo *pWInfo){
+static int computeMxChoice(WhereInfo *pWInfo, LogEst nRowEst){
int nLoop = pWInfo->nLevel; /* Number of terms in the join */
- WhereLoop *pWLoop; /* For looping over WhereLoops */
-
-#ifdef SQLITE_DEBUG
- /* The star-query detection code below makes use of the following
- ** properties of the WhereLoop list, so verify them before
- ** continuing:
- ** (1) .maskSelf is the bitmask corresponding to .iTab
- ** (2) The WhereLoop list is in ascending .iTab order
- */
- for(pWLoop=pWInfo->pLoops; pWLoop; pWLoop=pWLoop->pNextLoop){
- assert( pWLoop->maskSelf==MASKBIT(pWLoop->iTab) );
- assert( pWLoop->pNextLoop==0 || pWLoop->iTab<=pWLoop->pNextLoop->iTab );
- }
-#endif /* SQLITE_DEBUG */
-
- if( nLoop>=5
- && !pWInfo->bStarDone
- && OptimizationEnabled(pWInfo->pParse->db, SQLITE_StarQuery)
- ){
- SrcItem *aFromTabs; /* All terms of the FROM clause */
- int iFromIdx; /* Term of FROM clause is the candidate fact-table */
- Bitmask m; /* Bitmask for candidate fact-table */
- Bitmask mSelfJoin = 0; /* Tables that cannot be dimension tables */
- WhereLoop *pStart; /* Where to start searching for dimension-tables */
-
- pWInfo->bStarDone = 1; /* Only do this computation once */
-
- /* Look for fact tables with four or more dimensions where the
- ** dimension tables are not separately from the fact tables by an outer
- ** or cross join. Adjust cost weights if found.
+ if( nRowEst==0 && nLoop>=5 ){
+ /* Check to see if we are dealing with a star schema and if so, reduce
+ ** the cost of fact tables relative to dimension tables, as a heuristic
+ ** to help keep the fact tables in outer loops.
*/
- assert( !pWInfo->bStarUsed );
- aFromTabs = pWInfo->pTabList->a;
- pStart = pWInfo->pLoops;
- for(iFromIdx=0, m=1; iFromIdxnOutStarDelta==0 );
+ for(iLoop=0, m=1; iLoopfg.jointype & (JT_OUTER|JT_CROSS))!=0 ){
- /* If the candidate fact-table is the right table of an outer join
- ** restrict the search for dimension-tables to be tables to the right
- ** of the fact-table. */
- if( iFromIdx+4 > nLoop ) break; /* Impossible to reach nDep>=4 */
- while( pStart && pStart->iTab<=iFromIdx ){
- pStart = pStart->pNextLoop;
- }
- }
- for(pWLoop=pStart; pWLoop; pWLoop=pWLoop->pNextLoop){
- if( (aFromTabs[pWLoop->iTab].fg.jointype & (JT_OUTER|JT_CROSS))!=0 ){
- /* Fact-tables and dimension-tables cannot be separated by an
- ** outer join (at least for the definition of fact- and dimension-
- ** used by this heuristic). */
- break;
- }
- if( (pWLoop->prereq & m)!=0 /* pWInfo depends on iFromIdx */
- && (pWLoop->maskSelf & mSeen)==0 /* pWInfo not already a dependency */
- && (pWLoop->maskSelf & mSelfJoin)==0 /* Not a self-join */
- ){
- if( aFromTabs[pWLoop->iTab].pSTab==pFactTab->pSTab ){
- mSelfJoin |= m;
- }else{
- nDep++;
- mSeen |= pWLoop->maskSelf;
- }
+ for(pWLoop=pWInfo->pLoops; pWLoop; pWLoop=pWLoop->pNextLoop){
+ if( (pWLoop->prereq & m)!=0 && (pWLoop->maskSelf & mSeen)==0 ){
+ nDep++;
+ mSeen |= pWLoop->maskSelf;
}
}
if( nDep<=3 ) continue;
-
- /* If we reach this point, it means that pFactTab is a fact table
- ** with four or more dimensions connected by inner joins. Proceed
- ** to make cost adjustments. */
-
-#ifdef WHERETRACE_ENABLED
- /* Make sure rStarDelta values are initialized */
- if( !pWInfo->bStarUsed ){
- for(pWLoop=pWInfo->pLoops; pWLoop; pWLoop=pWLoop->pNextLoop){
- pWLoop->rStarDelta = 0;
- }
+ rDelta = 15*(nDep-3);
+#ifdef WHERETRACE_ENABLED /* 0x4 */
+ if( sqlite3WhereTrace&0x4 ){
+ SrcItem *pItem = pWInfo->pTabList->a + iLoop;
+ sqlite3DebugPrintf("Fact-table %s: %d dimensions, cost reduced %d\n",
+ pItem->zAlias ? pItem->zAlias : pItem->pSTab->zName,
+ nDep, rDelta);
}
#endif
- pWInfo->bStarUsed = 1;
-
- /* Compute the maximum cost of any WhereLoop for the
- ** fact table plus one epsilon */
- mxRun = LOGEST_MIN;
- for(pWLoop=pStart; pWLoop; pWLoop=pWLoop->pNextLoop){
- if( pWLoop->iTabiTab>iFromIdx ) break;
- if( pWLoop->rRun>mxRun ) mxRun = pWLoop->rRun;
- }
- if( ALWAYS(mxRunpNextLoop){
- if( (pWLoop->maskSelf & mSeen)==0 ) continue;
- if( pWLoop->nLTerm ) continue;
- if( pWLoop->rRuniTab;
- sqlite3DebugPrintf(
- "Increase SCAN cost of dimension %s(%d) of fact %s(%d) to %d\n",
- pDim->zAlias ? pDim->zAlias: pDim->pSTab->zName, pWLoop->iTab,
- pFactTab->zAlias ? pFactTab->zAlias : pFactTab->pSTab->zName,
- iFromIdx, mxRun
- );
- }
- pWLoop->rStarDelta = mxRun - pWLoop->rRun;
-#endif /* WHERETRACE_ENABLED */
- pWLoop->rRun = mxRun;
+ if( pWInfo->nOutStarDelta==0 ){
+ for(pWLoop=pWInfo->pLoops; pWLoop; pWLoop=pWLoop->pNextLoop){
+ pWLoop->rStarDelta = 0;
}
}
- }
-#ifdef WHERETRACE_ENABLED /* 0x80000 */
- if( (sqlite3WhereTrace & 0x80000)!=0 && pWInfo->bStarUsed ){
- sqlite3DebugPrintf("WhereLoops changed by star-query heuristic:\n");
+ pWInfo->nOutStarDelta += rDelta;
for(pWLoop=pWInfo->pLoops; pWLoop; pWLoop=pWLoop->pNextLoop){
- if( pWLoop->rStarDelta ){
- sqlite3WhereLoopPrint(pWLoop, &pWInfo->sWC);
+ if( pWLoop->maskSelf==m ){
+ pWLoop->rRun -= rDelta;
+ pWLoop->nOut -= rDelta;
+ pWLoop->rStarDelta = rDelta;
}
}
}
-#endif
}
- return pWInfo->bStarUsed ? 18 : 12;
-}
-
-/*
-** Two WhereLoop objects, pCandidate and pBaseline, are known to have the
-** same cost. Look deep into each to see if pCandidate is even slightly
-** better than pBaseline. Return false if it is, if pCandidate is is preferred.
-** Return true if pBaseline is preferred or if we cannot tell the difference.
-**
-** Result Meaning
-** -------- ----------------------------------------------------------
-** true We cannot tell the difference in pCandidate and pBaseline
-** false pCandidate seems like a better choice than pBaseline
-*/
-static SQLITE_NOINLINE int whereLoopIsNoBetter(
- const WhereLoop *pCandidate,
- const WhereLoop *pBaseline
-){
- if( (pCandidate->wsFlags & WHERE_INDEXED)==0 ) return 1;
- if( (pBaseline->wsFlags & WHERE_INDEXED)==0 ) return 1;
- if( pCandidate->u.btree.pIndex->szIdxRow <
- pBaseline->u.btree.pIndex->szIdxRow ) return 0;
- return 1;
+ return pWInfo->nOutStarDelta>0 ? 18 : 12;
}
/*
@@ -171891,7 +171765,7 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){
int mxI = 0; /* Index of next entry to replace */
int nOrderBy; /* Number of ORDER BY clause terms */
LogEst mxCost = 0; /* Maximum cost of a set of paths */
- LogEst mxUnsort = 0; /* Maximum unsorted cost of a set of path */
+ LogEst mxUnsorted = 0; /* Maximum unsorted cost of a set of path */
int nTo, nFrom; /* Number of valid entries in aTo[] and aFrom[] */
WherePath *aFrom; /* All nFrom paths at the previous level */
WherePath *aTo; /* The nTo best paths at the current level */
@@ -171920,10 +171794,8 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){
mxChoice = 1;
}else if( nLoop==2 ){
mxChoice = 5;
- }else if( pParse->nErr ){
- mxChoice = 1;
}else{
- mxChoice = computeMxChoice(pWInfo);
+ mxChoice = computeMxChoice(pWInfo, nRowEst);
}
assert( nLoop<=pWInfo->pTabList->nSrc );
@@ -171990,7 +171862,7 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){
for(pWLoop=pWInfo->pLoops; pWLoop; pWLoop=pWLoop->pNextLoop){
LogEst nOut; /* Rows visited by (pFrom+pWLoop) */
LogEst rCost; /* Cost of path (pFrom+pWLoop) */
- LogEst rUnsort; /* Unsorted cost of (pFrom+pWLoop) */
+ LogEst rUnsorted; /* Unsorted cost of (pFrom+pWLoop) */
i8 isOrdered; /* isOrdered for (pFrom+pWLoop) */
Bitmask maskNew; /* Mask of src visited by (..) */
Bitmask revMask; /* Mask of rev-order loops for (..) */
@@ -172008,11 +171880,11 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){
/* At this point, pWLoop is a candidate to be the next loop.
** Compute its cost */
- rUnsort = pWLoop->rRun + pFrom->nRow;
+ rUnsorted = pWLoop->rRun + pFrom->nRow;
if( pWLoop->rSetup ){
- rUnsort = sqlite3LogEstAdd(pWLoop->rSetup, rUnsort);
+ rUnsorted = sqlite3LogEstAdd(pWLoop->rSetup, rUnsorted);
}
- rUnsort = sqlite3LogEstAdd(rUnsort, pFrom->rUnsort);
+ rUnsorted = sqlite3LogEstAdd(rUnsorted, pFrom->rUnsorted);
nOut = pFrom->nRow + pWLoop->nOut;
maskNew = pFrom->maskLoop | pWLoop->maskSelf;
isOrdered = pFrom->isOrdered;
@@ -172034,15 +171906,15 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){
** extra encouragement to the query planner to select a plan
** where the rows emerge in the correct order without any sorting
** required. */
- rCost = sqlite3LogEstAdd(rUnsort, aSortCost[isOrdered]) + 3;
+ rCost = sqlite3LogEstAdd(rUnsorted, aSortCost[isOrdered]) + 3;
WHERETRACE(0x002,
("---- sort cost=%-3d (%d/%d) increases cost %3d to %-3d\n",
aSortCost[isOrdered], (nOrderBy-isOrdered), nOrderBy,
- rUnsort, rCost));
+ rUnsorted, rCost));
}else{
- rCost = rUnsort;
- rUnsort -= 2; /* TUNING: Slight bias in favor of no-sort plans */
+ rCost = rUnsorted;
+ rUnsorted -= 2; /* TUNING: Slight bias in favor of no-sort plans */
}
/* Check to see if pWLoop should be added to the set of
@@ -172068,7 +171940,7 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){
if( jj>=nTo ){
/* None of the existing best-so-far paths match the candidate. */
if( nTo>=mxChoice
- && (rCost>mxCost || (rCost==mxCost && rUnsort>=mxUnsort))
+ && (rCost>mxCost || (rCost==mxCost && rUnsorted>=mxUnsorted))
){
/* The current candidate is no better than any of the mxChoice
** paths currently in the best-so-far buffer. So discard
@@ -172076,7 +171948,7 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){
#ifdef WHERETRACE_ENABLED /* 0x4 */
if( sqlite3WhereTrace&0x4 ){
sqlite3DebugPrintf("Skip %s cost=%-3d,%3d,%3d order=%c\n",
- wherePathName(pFrom, iLoop, pWLoop), rCost, nOut, rUnsort,
+ wherePathName(pFrom, iLoop, pWLoop), rCost, nOut, rUnsorted,
isOrdered>=0 ? isOrdered+'0' : '?');
}
#endif
@@ -172095,7 +171967,7 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){
#ifdef WHERETRACE_ENABLED /* 0x4 */
if( sqlite3WhereTrace&0x4 ){
sqlite3DebugPrintf("New %s cost=%-3d,%3d,%3d order=%c\n",
- wherePathName(pFrom, iLoop, pWLoop), rCost, nOut, rUnsort,
+ wherePathName(pFrom, iLoop, pWLoop), rCost, nOut, rUnsorted,
isOrdered>=0 ? isOrdered+'0' : '?');
}
#endif
@@ -172106,23 +171978,24 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){
** pTo or if the candidate should be skipped.
**
** The conditional is an expanded vector comparison equivalent to:
- ** (pTo->rCost,pTo->nRow,pTo->rUnsort) <= (rCost,nOut,rUnsort)
+ ** (pTo->rCost,pTo->nRow,pTo->rUnsorted) <= (rCost,nOut,rUnsorted)
*/
- if( (pTo->rCostrCost==rCost && pTo->nRowrCost==rCost && pTo->nRow==nOut && pTo->rUnsortrCost==rCost && pTo->nRow==nOut && pTo->rUnsort==rUnsort
- && whereLoopIsNoBetter(pWLoop, pTo->aLoop[iLoop]) )
+ if( pTo->rCostrCost==rCost
+ && (pTo->nRownRow==nOut && pTo->rUnsorted<=rUnsorted)
+ )
+ )
){
#ifdef WHERETRACE_ENABLED /* 0x4 */
if( sqlite3WhereTrace&0x4 ){
sqlite3DebugPrintf(
"Skip %s cost=%-3d,%3d,%3d order=%c",
- wherePathName(pFrom, iLoop, pWLoop), rCost, nOut, rUnsort,
+ wherePathName(pFrom, iLoop, pWLoop), rCost, nOut, rUnsorted,
isOrdered>=0 ? isOrdered+'0' : '?');
sqlite3DebugPrintf(" vs %s cost=%-3d,%3d,%3d order=%c\n",
wherePathName(pTo, iLoop+1, 0), pTo->rCost, pTo->nRow,
- pTo->rUnsort, pTo->isOrdered>=0 ? pTo->isOrdered+'0' : '?');
+ pTo->rUnsorted, pTo->isOrdered>=0 ? pTo->isOrdered+'0' : '?');
}
#endif
/* Discard the candidate path from further consideration */
@@ -172136,11 +172009,11 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){
if( sqlite3WhereTrace&0x4 ){
sqlite3DebugPrintf(
"Update %s cost=%-3d,%3d,%3d order=%c",
- wherePathName(pFrom, iLoop, pWLoop), rCost, nOut, rUnsort,
+ wherePathName(pFrom, iLoop, pWLoop), rCost, nOut, rUnsorted,
isOrdered>=0 ? isOrdered+'0' : '?');
sqlite3DebugPrintf(" was %s cost=%-3d,%3d,%3d order=%c\n",
wherePathName(pTo, iLoop+1, 0), pTo->rCost, pTo->nRow,
- pTo->rUnsort, pTo->isOrdered>=0 ? pTo->isOrdered+'0' : '?');
+ pTo->rUnsorted, pTo->isOrdered>=0 ? pTo->isOrdered+'0' : '?');
}
#endif
}
@@ -172149,20 +172022,20 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){
pTo->revLoop = revMask;
pTo->nRow = nOut;
pTo->rCost = rCost;
- pTo->rUnsort = rUnsort;
+ pTo->rUnsorted = rUnsorted;
pTo->isOrdered = isOrdered;
memcpy(pTo->aLoop, pFrom->aLoop, sizeof(WhereLoop*)*iLoop);
pTo->aLoop[iLoop] = pWLoop;
if( nTo>=mxChoice ){
mxI = 0;
mxCost = aTo[0].rCost;
- mxUnsort = aTo[0].nRow;
+ mxUnsorted = aTo[0].nRow;
for(jj=1, pTo=&aTo[1]; jjrCost>mxCost
- || (pTo->rCost==mxCost && pTo->rUnsort>mxUnsort)
+ || (pTo->rCost==mxCost && pTo->rUnsorted>mxUnsorted)
){
mxCost = pTo->rCost;
- mxUnsort = pTo->rUnsort;
+ mxUnsorted = pTo->rUnsorted;
mxI = jj;
}
}
@@ -172174,10 +172047,8 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){
if( sqlite3WhereTrace & 0x02 ){
LogEst rMin, rFloor = 0;
int nDone = 0;
- int nProgress;
sqlite3DebugPrintf("---- after round %d ----\n", iLoop);
- do{
- nProgress = 0;
+ while( nDonerCost>rFloor && pTo->rCostrCost;
@@ -172193,11 +172064,10 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){
sqlite3DebugPrintf("\n");
}
nDone++;
- nProgress++;
}
}
rFloor = rMin;
- }while( nDone0 );
+ }
}
#endif
@@ -172291,10 +172161,7 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){
}
}
- pWInfo->nRowOut = pFrom->nRow;
-#ifdef WHERETRACE_ENABLED
- pWInfo->rTotalCost = pFrom->rCost;
-#endif
+ pWInfo->nRowOut = pFrom->nRow + pWInfo->nOutStarDelta;
/* Free temporary memory and return success */
sqlite3StackFreeNN(pParse->db, pSpace);
@@ -172595,7 +172462,6 @@ static SQLITE_NOINLINE Bitmask whereOmitNoopJoin(
WhereTerm *pTerm, *pEnd;
SrcItem *pItem;
WhereLoop *pLoop;
- Bitmask m1;
pLoop = pWInfo->a[i].pWLoop;
pItem = &pWInfo->pTabList->a[pLoop->iTab];
if( (pItem->fg.jointype & (JT_LEFT|JT_RIGHT))!=JT_LEFT ) continue;
@@ -172616,16 +172482,13 @@ static SQLITE_NOINLINE Bitmask whereOmitNoopJoin(
}
if( hasRightJoin
&& ExprHasProperty(pTerm->pExpr, EP_InnerON)
- && NEVER(pTerm->pExpr->w.iJoin==pItem->iCursor)
+ && pTerm->pExpr->w.iJoin==pItem->iCursor
){
break; /* restriction (5) */
}
}
if( pTerm omit unused FROM-clause term %c\n",pLoop->cId));
- m1 = MASKBIT(i)-1;
- testcase( ((pWInfo->revMask>>1) & ~m1)!=0 );
- pWInfo->revMask = (m1 & pWInfo->revMask) | ((pWInfo->revMask>>1) & ~m1);
+ WHERETRACE(0xffffffff, ("-> drop loop %c not used\n", pLoop->cId));
notReady &= ~pLoop->maskSelf;
for(pTerm=pWInfo->sWC.a; pTermprereqAll & pLoop->maskSelf)!=0 ){
@@ -172692,7 +172555,60 @@ static SQLITE_NOINLINE void whereCheckIfBloomFilterIsUseful(
}
}
nSearch += pLoop->nOut;
+ if( pWInfo->nOutStarDelta ) nSearch += pLoop->rStarDelta;
+ }
+}
+
+/*
+** Expression Node callback for sqlite3ExprCanReturnSubtype().
+**
+** Only a function call is able to return a subtype. So if the node
+** is not a function call, return WRC_Prune immediately.
+**
+** A function call is able to return a subtype if it has the
+** SQLITE_RESULT_SUBTYPE property.
+**
+** Assume that every function is able to pass-through a subtype from
+** one of its argument (using sqlite3_result_value()). Most functions
+** are not this way, but we don't have a mechanism to distinguish those
+** that are from those that are not, so assume they all work this way.
+** That means that if one of its arguments is another function and that
+** other function is able to return a subtype, then this function is
+** able to return a subtype.
+*/
+static int exprNodeCanReturnSubtype(Walker *pWalker, Expr *pExpr){
+ int n;
+ FuncDef *pDef;
+ sqlite3 *db;
+ if( pExpr->op!=TK_FUNCTION ){
+ return WRC_Prune;
+ }
+ assert( ExprUseXList(pExpr) );
+ db = pWalker->pParse->db;
+ n = pExpr->x.pList ? pExpr->x.pList->nExpr : 0;
+ pDef = sqlite3FindFunction(db, pExpr->u.zToken, n, ENC(db), 0);
+ if( pDef==0 || (pDef->funcFlags & SQLITE_RESULT_SUBTYPE)!=0 ){
+ pWalker->eCode = 1;
+ return WRC_Prune;
}
+ return WRC_Continue;
+}
+
+/*
+** Return TRUE if expression pExpr is able to return a subtype.
+**
+** A TRUE return does not guarantee that a subtype will be returned.
+** It only indicates that a subtype return is possible. False positives
+** are acceptable as they only disable an optimization. False negatives,
+** on the other hand, can lead to incorrect answers.
+*/
+static int sqlite3ExprCanReturnSubtype(Parse *pParse, Expr *pExpr){
+ Walker w;
+ memset(&w, 0, sizeof(w));
+ w.pParse = pParse;
+ w.xExprCallback = exprNodeCanReturnSubtype;
+ sqlite3WalkExpr(&w, pExpr);
+ return w.eCode;
}
/*
@@ -172728,6 +172644,12 @@ static SQLITE_NOINLINE void whereAddIndexedExpr(
continue;
}
if( sqlite3ExprIsConstant(0,pExpr) ) continue;
+ if( pExpr->op==TK_FUNCTION && sqlite3ExprCanReturnSubtype(pParse,pExpr) ){
+ /* Functions that might set a subtype should not be replaced by the
+ ** value taken from an expression index since the index omits the
+ ** subtype. https://sqlite.org/forum/forumpost/68d284c86b082c3e */
+ continue;
+ }
p = sqlite3DbMallocRaw(pParse->db, sizeof(IndexedExpr));
if( p==0 ) break;
p->pIENext = pParse->pIdxEpr;
@@ -173174,8 +173096,7 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(
assert( db->mallocFailed==0 );
#ifdef WHERETRACE_ENABLED
if( sqlite3WhereTrace ){
- sqlite3DebugPrintf("---- Solution cost=%d, nRow=%d",
- pWInfo->rTotalCost, pWInfo->nRowOut);
+ sqlite3DebugPrintf("---- Solution nRow=%d", pWInfo->nRowOut);
if( pWInfo->nOBSat>0 ){
sqlite3DebugPrintf(" ORDERBY=%d,0x%llx", pWInfo->nOBSat, pWInfo->revMask);
}
@@ -173536,7 +173457,6 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(
){
if( (db->flags & SQLITE_VdbeAddopTrace)==0 ) return;
sqlite3VdbePrintOp(0, pc, pOp);
- sqlite3ShowWhereTerm(0); /* So compiler won't complain about unused func */
}
#endif
@@ -173836,28 +173756,14 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){
pOp->p2 = x;
pOp->p1 = pLevel->iIdxCur;
OpcodeRewriteTrace(db, k, pOp);
- }else if( pLoop->wsFlags & (WHERE_IDX_ONLY|WHERE_EXPRIDX) ){
+ }else{
+ /* Unable to translate the table reference into an index
+ ** reference. Verify that this is harmless - that the
+ ** table being referenced really is open.
+ */
if( pLoop->wsFlags & WHERE_IDX_ONLY ){
- /* An error. pLoop is supposed to be a covering index loop,
- ** and yet the VM code refers to a column of the table that
- ** is not part of the index. */
sqlite3ErrorMsg(pParse, "internal query planner error");
pParse->rc = SQLITE_INTERNAL;
- }else{
- /* The WHERE_EXPRIDX flag is set by the planner when it is likely
- ** that pLoop is a covering index loop, but it is not possible
- ** to be 100% sure. In this case, any OP_Explain opcode
- ** corresponding to this loop describes the index as a "COVERING
- ** INDEX". But, pOp proves that pLoop is not actually a covering
- ** index loop. So clear the WHERE_EXPRIDX flag and rewrite the
- ** text that accompanies the OP_Explain opcode, if any. */
- pLoop->wsFlags &= ~WHERE_EXPRIDX;
- sqlite3WhereAddExplainText(pParse,
- pLevel->addrBody-1,
- pTabList,
- pLevel,
- pWInfo->wctrlFlags
- );
}
}
}else if( pOp->opcode==OP_Rowid ){
@@ -175565,7 +175471,6 @@ static void windowAggStep(
int regArg;
int nArg = pWin->bExprArgs ? 0 : windowArgCount(pWin);
int i;
- int addrIf = 0;
assert( bInverse==0 || pWin->eStart!=TK_UNBOUNDED );
@@ -175582,18 +175487,6 @@ static void windowAggStep(
}
regArg = reg;
- if( pWin->pFilter ){
- int regTmp;
- assert( ExprUseXList(pWin->pOwner) );
- assert( pWin->bExprArgs || !nArg ||nArg==pWin->pOwner->x.pList->nExpr );
- assert( pWin->bExprArgs || nArg ||pWin->pOwner->x.pList==0 );
- regTmp = sqlite3GetTempReg(pParse);
- sqlite3VdbeAddOp3(v, OP_Column, csr, pWin->iArgCol+nArg,regTmp);
- addrIf = sqlite3VdbeAddOp3(v, OP_IfNot, regTmp, 0, 1);
- VdbeCoverage(v);
- sqlite3ReleaseTempReg(pParse, regTmp);
- }
-
if( pMWin->regStartRowid==0
&& (pFunc->funcFlags & SQLITE_FUNC_MINMAX)
&& (pWin->eStart!=TK_UNBOUNDED)
@@ -175613,13 +175506,25 @@ static void windowAggStep(
}
sqlite3VdbeJumpHere(v, addrIsNull);
}else if( pWin->regApp ){
- assert( pWin->pFilter==0 );
assert( pFunc->zName==nth_valueName
|| pFunc->zName==first_valueName
);
assert( bInverse==0 || bInverse==1 );
sqlite3VdbeAddOp2(v, OP_AddImm, pWin->regApp+1-bInverse, 1);
}else if( pFunc->xSFunc!=noopStepFunc ){
+ int addrIf = 0;
+ if( pWin->pFilter ){
+ int regTmp;
+ assert( ExprUseXList(pWin->pOwner) );
+ assert( pWin->bExprArgs || !nArg ||nArg==pWin->pOwner->x.pList->nExpr );
+ assert( pWin->bExprArgs || nArg ||pWin->pOwner->x.pList==0 );
+ regTmp = sqlite3GetTempReg(pParse);
+ sqlite3VdbeAddOp3(v, OP_Column, csr, pWin->iArgCol+nArg,regTmp);
+ addrIf = sqlite3VdbeAddOp3(v, OP_IfNot, regTmp, 0, 1);
+ VdbeCoverage(v);
+ sqlite3ReleaseTempReg(pParse, regTmp);
+ }
+
if( pWin->bExprArgs ){
int iOp = sqlite3VdbeCurrentAddr(v);
int iEnd;
@@ -175650,9 +175555,8 @@ static void windowAggStep(
if( pWin->bExprArgs ){
sqlite3ReleaseTempRange(pParse, regArg, nArg);
}
+ if( addrIf ) sqlite3VdbeJumpHere(v, addrIf);
}
-
- if( addrIf ) sqlite3VdbeJumpHere(v, addrIf);
}
}
@@ -177079,8 +176983,6 @@ SQLITE_PRIVATE void sqlite3WindowCodeStep(
*/
struct TrigEvent { int a; IdList * b; };
-struct FrameBound { int eType; Expr *pExpr; };
-
/*
** Generate a syntax error
*/
@@ -177088,6 +176990,8 @@ static void parserSyntaxError(Parse *pParse, Token *p){
sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", p);
}
+struct FrameBound { int eType; Expr *pExpr; };
+
/*
** Disable lookaside memory allocation for objects that might be
** shared across database connections.
@@ -177436,8 +177340,7 @@ static void updateDeleteLimitError(
#define TK_ERROR 183
#define TK_QNUMBER 184
#define TK_SPACE 185
-#define TK_COMMENT 186
-#define TK_ILLEGAL 187
+#define TK_ILLEGAL 186
#endif
/**************** End token definitions ***************************************/
@@ -177502,31 +177405,31 @@ static void updateDeleteLimitError(
#endif
/************* Begin control #defines *****************************************/
#define YYCODETYPE unsigned short int
-#define YYNOCODE 324
+#define YYNOCODE 323
#define YYACTIONTYPE unsigned short int
#define YYWILDCARD 102
#define sqlite3ParserTOKENTYPE Token
typedef union {
int yyinit;
sqlite3ParserTOKENTYPE yy0;
- SrcList* yy43;
- With* yy91;
- IdList* yy96;
- Select* yy99;
- const char* yy192;
- TriggerStep* yy203;
- Cte* yy207;
- int yy220;
- struct FrameBound yy225;
- struct TrigEvent yy234;
- ExprList* yy250;
- u32 yy279;
- struct {int value; int mask;} yy359;
- OnOrUsing yy425;
- u8 yy426;
- Window* yy459;
- Expr* yy530;
- Upsert* yy642;
+ u32 yy9;
+ struct TrigEvent yy28;
+ With* yy125;
+ IdList* yy204;
+ struct FrameBound yy205;
+ TriggerStep* yy319;
+ const char* yy342;
+ Cte* yy361;
+ ExprList* yy402;
+ Upsert* yy403;
+ OnOrUsing yy421;
+ u8 yy444;
+ struct {int value; int mask;} yy481;
+ Window* yy483;
+ int yy502;
+ SrcList* yy563;
+ Expr* yy590;
+ Select* yy637;
} YYMINORTYPE;
#ifndef YYSTACKDEPTH
#define YYSTACKDEPTH 100
@@ -177548,7 +177451,7 @@ typedef union {
#define YYNSTATE 587
#define YYNRULE 409
#define YYNRULE_WITH_ACTION 344
-#define YYNTOKEN 188
+#define YYNTOKEN 187
#define YY_MAX_SHIFT 586
#define YY_MIN_SHIFTREDUCE 849
#define YY_MAX_SHIFTREDUCE 1257
@@ -177557,8 +177460,8 @@ typedef union {
#define YY_NO_ACTION 1260
#define YY_MIN_REDUCE 1261
#define YY_MAX_REDUCE 1669
-#define YY_MIN_DSTRCTR 207
-#define YY_MAX_DSTRCTR 321
+#define YY_MIN_DSTRCTR 206
+#define YY_MAX_DSTRCTR 320
/************* End control #defines *******************************************/
#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
@@ -177658,459 +177561,459 @@ static const YYACTIONTYPE yy_action[] = {
/* 120 */ 288, 7, 561, 417, 1545, 459, 1586, 384, 1586, 548,
/* 130 */ 1208, 535, 577, 1572, 566, 134, 134, 134, 134, 133,
/* 140 */ 133, 132, 132, 132, 131, 128, 455, 245, 137, 138,
- /* 150 */ 91, 491, 1232, 1232, 1067, 1070, 1057, 1057, 135, 135,
+ /* 150 */ 91, 455, 1232, 1232, 1067, 1070, 1057, 1057, 135, 135,
/* 160 */ 136, 136, 136, 136, 130, 127, 234, 233, 1208, 1209,
- /* 170 */ 1208, 257, 953, 1579, 515, 512, 511, 7, 441, 459,
+ /* 170 */ 1208, 257, 953, 1297, 515, 512, 511, 182, 441, 459,
/* 180 */ 1208, 1209, 1208, 368, 510, 132, 132, 132, 131, 128,
/* 190 */ 455, 1178, 973, 1178, 134, 134, 134, 134, 133, 133,
- /* 200 */ 132, 132, 132, 131, 128, 455, 427, 134, 134, 134,
+ /* 200 */ 132, 132, 132, 131, 128, 455, 362, 134, 134, 134,
/* 210 */ 134, 133, 133, 132, 132, 132, 131, 128, 455, 133,
/* 220 */ 133, 132, 132, 132, 131, 128, 455, 417, 452, 451,
- /* 230 */ 44, 289, 289, 112, 455, 1023, 554, 1237, 1208, 1209,
- /* 240 */ 1208, 1297, 1239, 44, 577, 1574, 566, 381, 1572, 1572,
- /* 250 */ 1238, 298, 137, 138, 91, 518, 1232, 1232, 1067, 1070,
- /* 260 */ 1057, 1057, 135, 135, 136, 136, 136, 136, 1054, 1054,
- /* 270 */ 1068, 1071, 392, 438, 388, 1240, 331, 1240, 139, 274,
- /* 280 */ 291, 376, 521, 371, 520, 262, 580, 320, 571, 348,
- /* 290 */ 257, 367, 385, 515, 512, 511, 48, 50, 417, 182,
- /* 300 */ 320, 571, 6, 510, 329, 294, 574, 574, 574, 51,
- /* 310 */ 51, 134, 134, 134, 134, 133, 133, 132, 132, 132,
- /* 320 */ 131, 128, 455, 137, 138, 91, 1296, 1232, 1232, 1067,
+ /* 230 */ 44, 289, 289, 112, 485, 1023, 261, 1237, 1208, 1209,
+ /* 240 */ 1208, 111, 1239, 44, 577, 1574, 566, 381, 580, 329,
+ /* 250 */ 1238, 502, 137, 138, 91, 518, 1232, 1232, 1067, 1070,
+ /* 260 */ 1057, 1057, 135, 135, 136, 136, 136, 136, 357, 465,
+ /* 270 */ 360, 19, 19, 438, 392, 1240, 388, 1240, 139, 274,
+ /* 280 */ 291, 376, 521, 371, 520, 262, 430, 320, 571, 348,
+ /* 290 */ 1296, 367, 1173, 1173, 527, 527, 1509, 1023, 417, 7,
+ /* 300 */ 320, 571, 487, 544, 422, 1173, 1173, 294, 1173, 1173,
+ /* 310 */ 296, 134, 134, 134, 134, 133, 133, 132, 132, 132,
+ /* 320 */ 131, 128, 455, 137, 138, 91, 1632, 1232, 1232, 1067,
/* 330 */ 1070, 1057, 1057, 135, 135, 136, 136, 136, 136, 417,
- /* 340 */ 288, 288, 1058, 1173, 94, 476, 350, 93, 130, 127,
- /* 350 */ 234, 555, 555, 577, 544, 566, 1173, 386, 182, 1173,
- /* 360 */ 1573, 1573, 381, 381, 137, 138, 91, 417, 1232, 1232,
+ /* 340 */ 1510, 1455, 288, 288, 94, 257, 214, 93, 515, 512,
+ /* 350 */ 511, 348, 471, 334, 396, 577, 385, 566, 510, 410,
+ /* 360 */ 182, 543, 386, 502, 137, 138, 91, 417, 1232, 1232,
/* 370 */ 1067, 1070, 1057, 1057, 135, 135, 136, 136, 136, 136,
- /* 380 */ 886, 492, 134, 134, 134, 134, 133, 133, 132, 132,
- /* 390 */ 132, 131, 128, 455, 91, 1510, 1232, 1232, 1067, 1070,
- /* 400 */ 1057, 1057, 135, 135, 136, 136, 136, 136, 1349, 1588,
- /* 410 */ 417, 383, 543, 130, 127, 234, 527, 527, 452, 451,
- /* 420 */ 577, 7, 566, 134, 134, 134, 134, 133, 133, 132,
- /* 430 */ 132, 132, 131, 128, 455, 137, 138, 91, 487, 1232,
+ /* 380 */ 377, 1599, 134, 134, 134, 134, 133, 133, 132, 132,
+ /* 390 */ 132, 131, 128, 455, 91, 421, 1232, 1232, 1067, 1070,
+ /* 400 */ 1057, 1057, 135, 135, 136, 136, 136, 136, 425, 1602,
+ /* 410 */ 417, 1208, 130, 127, 234, 44, 579, 1208, 130, 127,
+ /* 420 */ 234, 476, 350, 134, 134, 134, 134, 133, 133, 132,
+ /* 430 */ 132, 132, 131, 128, 455, 137, 138, 91, 427, 1232,
/* 440 */ 1232, 1067, 1070, 1057, 1057, 135, 135, 136, 136, 136,
/* 450 */ 136, 134, 134, 134, 134, 133, 133, 132, 132, 132,
- /* 460 */ 131, 128, 455, 580, 464, 1240, 427, 1240, 580, 1208,
- /* 470 */ 229, 526, 1044, 1208, 562, 552, 552, 453, 453, 453,
- /* 480 */ 7, 303, 464, 463, 1208, 1343, 82, 82, 886, 1033,
- /* 490 */ 125, 19, 19, 1032, 134, 134, 134, 134, 133, 133,
- /* 500 */ 132, 132, 132, 131, 128, 455, 430, 1208, 485, 288,
- /* 510 */ 288, 131, 128, 455, 417, 1632, 288, 288, 364, 379,
- /* 520 */ 288, 288, 577, 561, 566, 1032, 1032, 1034, 1109, 577,
- /* 530 */ 1602, 566, 563, 577, 417, 566, 212, 45, 516, 137,
+ /* 460 */ 131, 128, 455, 580, 452, 451, 1439, 460, 1208, 580,
+ /* 470 */ 157, 1208, 320, 571, 562, 45, 554, 552, 552, 496,
+ /* 480 */ 528, 46, 7, 493, 197, 275, 82, 82, 1054, 1054,
+ /* 490 */ 1068, 1071, 61, 61, 134, 134, 134, 134, 133, 133,
+ /* 500 */ 132, 132, 132, 131, 128, 455, 468, 1208, 331, 288,
+ /* 510 */ 288, 1240, 580, 1240, 417, 288, 288, 415, 364, 1208,
+ /* 520 */ 1209, 1208, 577, 561, 566, 1208, 1209, 1208, 577, 529,
+ /* 530 */ 566, 382, 563, 580, 417, 51, 51, 432, 516, 137,
/* 540 */ 138, 91, 219, 1232, 1232, 1067, 1070, 1057, 1057, 135,
- /* 550 */ 135, 136, 136, 136, 136, 1192, 464, 906, 446, 137,
- /* 560 */ 138, 91, 579, 1232, 1232, 1067, 1070, 1057, 1057, 135,
- /* 570 */ 135, 136, 136, 136, 136, 1173, 468, 1208, 1209, 1208,
- /* 580 */ 485, 1208, 1209, 1208, 296, 1023, 551, 415, 1173, 519,
- /* 590 */ 580, 1173, 1208, 1209, 1208, 407, 1208, 907, 134, 134,
+ /* 550 */ 135, 136, 136, 136, 136, 379, 82, 82, 539, 137,
+ /* 560 */ 138, 91, 1058, 1232, 1232, 1067, 1070, 1057, 1057, 135,
+ /* 570 */ 135, 136, 136, 136, 136, 1173, 1208, 1209, 1208, 1208,
+ /* 580 */ 1209, 1208, 536, 108, 320, 571, 551, 580, 1173, 987,
+ /* 590 */ 580, 1173, 1575, 540, 446, 407, 1208, 988, 134, 134,
/* 600 */ 134, 134, 133, 133, 132, 132, 132, 131, 128, 455,
- /* 610 */ 580, 557, 96, 82, 82, 1208, 1209, 1208, 134, 134,
+ /* 610 */ 82, 82, 538, 82, 82, 1208, 1209, 1208, 134, 134,
/* 620 */ 134, 134, 133, 133, 132, 132, 132, 131, 128, 455,
- /* 630 */ 288, 288, 485, 19, 19, 141, 227, 502, 417, 348,
- /* 640 */ 471, 334, 890, 577, 542, 566, 476, 350, 435, 578,
- /* 650 */ 561, 940, 940, 439, 157, 1208, 299, 580, 417, 560,
- /* 660 */ 46, 483, 883, 137, 138, 91, 1281, 1232, 1232, 1067,
- /* 670 */ 1070, 1057, 1057, 135, 135, 136, 136, 136, 136, 44,
- /* 680 */ 82, 82, 425, 137, 138, 91, 1439, 1232, 1232, 1067,
- /* 690 */ 1070, 1057, 1057, 135, 135, 136, 136, 136, 136, 214,
- /* 700 */ 214, 288, 288, 485, 1208, 1209, 1208, 396, 302, 111,
- /* 710 */ 320, 571, 410, 405, 577, 580, 566, 540, 465, 1572,
- /* 720 */ 414, 413, 134, 134, 134, 134, 133, 133, 132, 132,
- /* 730 */ 132, 131, 128, 455, 491, 530, 320, 571, 82, 82,
- /* 740 */ 1515, 460, 134, 134, 134, 134, 133, 133, 132, 132,
- /* 750 */ 132, 131, 128, 455, 222, 1208, 6, 432, 1515, 1517,
- /* 760 */ 1173, 1173, 417, 1208, 1209, 1208, 1191, 47, 320, 571,
- /* 770 */ 288, 288, 275, 1173, 1173, 561, 1173, 1173, 382, 304,
- /* 780 */ 580, 539, 417, 577, 443, 566, 1045, 137, 138, 91,
+ /* 630 */ 288, 288, 550, 1153, 1662, 1588, 1662, 383, 417, 574,
+ /* 640 */ 574, 574, 890, 577, 542, 566, 578, 561, 940, 940,
+ /* 650 */ 561, 549, 131, 128, 455, 1208, 560, 238, 417, 443,
+ /* 660 */ 1184, 483, 883, 137, 138, 91, 303, 1232, 1232, 1067,
+ /* 670 */ 1070, 1057, 1057, 135, 135, 136, 136, 136, 136, 108,
+ /* 680 */ 537, 464, 111, 137, 138, 91, 533, 1232, 1232, 1067,
+ /* 690 */ 1070, 1057, 1057, 135, 135, 136, 136, 136, 136, 464,
+ /* 700 */ 463, 288, 288, 1248, 1208, 1209, 1208, 1439, 538, 22,
+ /* 710 */ 22, 427, 1184, 1151, 577, 1208, 566, 580, 232, 1343,
+ /* 720 */ 1572, 554, 134, 134, 134, 134, 133, 133, 132, 132,
+ /* 730 */ 132, 131, 128, 455, 580, 1281, 580, 229, 526, 96,
+ /* 740 */ 82, 82, 134, 134, 134, 134, 133, 133, 132, 132,
+ /* 750 */ 132, 131, 128, 455, 288, 288, 580, 19, 19, 19,
+ /* 760 */ 19, 6, 417, 1208, 1209, 1208, 1191, 577, 48, 566,
+ /* 770 */ 288, 288, 435, 464, 437, 320, 571, 316, 433, 145,
+ /* 780 */ 145, 212, 417, 577, 897, 566, 1045, 137, 138, 91,
/* 790 */ 975, 1232, 1232, 1067, 1070, 1057, 1057, 135, 135, 136,
- /* 800 */ 136, 136, 136, 82, 82, 580, 232, 137, 138, 91,
- /* 810 */ 1130, 1232, 1232, 1067, 1070, 1057, 1057, 135, 135, 136,
- /* 820 */ 136, 136, 136, 1153, 1662, 1131, 1662, 1130, 19, 19,
- /* 830 */ 209, 1573, 1515, 381, 347, 475, 1114, 1114, 499, 466,
- /* 840 */ 316, 1132, 1131, 437, 866, 390, 134, 134, 134, 134,
- /* 850 */ 133, 133, 132, 132, 132, 131, 128, 455, 1132, 580,
- /* 860 */ 427, 580, 568, 1208, 1209, 1208, 134, 134, 134, 134,
- /* 870 */ 133, 133, 132, 132, 132, 131, 128, 455, 1208, 926,
- /* 880 */ 1335, 1335, 19, 19, 19, 19, 417, 402, 1253, 927,
- /* 890 */ 1028, 197, 1111, 854, 855, 856, 1111, 306, 1439, 442,
- /* 900 */ 261, 1208, 1572, 1151, 474, 554, 417, 136, 136, 136,
- /* 910 */ 136, 137, 138, 91, 198, 1232, 1232, 1067, 1070, 1057,
- /* 920 */ 1057, 135, 135, 136, 136, 136, 136, 1556, 580, 497,
- /* 930 */ 213, 137, 138, 91, 421, 1232, 1232, 1067, 1070, 1057,
- /* 940 */ 1057, 135, 135, 136, 136, 136, 136, 1089, 1663, 403,
- /* 950 */ 49, 19, 19, 1439, 134, 134, 134, 134, 133, 133,
- /* 960 */ 132, 132, 132, 131, 128, 455, 206, 1254, 422, 433,
+ /* 800 */ 136, 136, 136, 580, 390, 580, 523, 137, 138, 91,
+ /* 810 */ 6, 1232, 1232, 1067, 1070, 1057, 1057, 135, 135, 136,
+ /* 820 */ 136, 136, 136, 1208, 1209, 1208, 19, 19, 19, 19,
+ /* 830 */ 427, 469, 1573, 948, 381, 209, 555, 555, 947, 580,
+ /* 840 */ 475, 306, 415, 442, 530, 1556, 134, 134, 134, 134,
+ /* 850 */ 133, 133, 132, 132, 132, 131, 128, 455, 580, 1558,
+ /* 860 */ 580, 1579, 82, 82, 580, 7, 134, 134, 134, 134,
+ /* 870 */ 133, 133, 132, 132, 132, 131, 128, 455, 1208, 288,
+ /* 880 */ 288, 19, 19, 19, 19, 491, 417, 19, 19, 492,
+ /* 890 */ 1028, 198, 577, 1111, 566, 461, 206, 1111, 207, 317,
+ /* 900 */ 213, 1208, 556, 1631, 580, 915, 417, 136, 136, 136,
+ /* 910 */ 136, 137, 138, 91, 40, 1232, 1232, 1067, 1070, 1057,
+ /* 920 */ 1057, 135, 135, 136, 136, 136, 136, 147, 147, 1515,
+ /* 930 */ 497, 137, 138, 91, 1228, 1232, 1232, 1067, 1070, 1057,
+ /* 940 */ 1057, 135, 135, 136, 136, 136, 136, 1515, 1517, 267,
+ /* 950 */ 340, 1130, 141, 1439, 134, 134, 134, 134, 133, 133,
+ /* 960 */ 132, 132, 132, 131, 128, 455, 1131, 1109, 1572, 536,
/* 970 */ 134, 134, 134, 134, 133, 133, 132, 132, 132, 131,
- /* 980 */ 128, 455, 580, 507, 1208, 1502, 1208, 1209, 1208, 1208,
+ /* 980 */ 128, 455, 1132, 477, 1208, 298, 1208, 1209, 1208, 1208,
/* 990 */ 134, 134, 134, 134, 133, 133, 132, 132, 132, 131,
- /* 1000 */ 128, 455, 40, 536, 580, 19, 19, 533, 1044, 1208,
- /* 1010 */ 1209, 1208, 261, 580, 1573, 550, 381, 491, 496, 417,
- /* 1020 */ 207, 1575, 493, 1129, 434, 1033, 1558, 19, 19, 1032,
- /* 1030 */ 22, 22, 1372, 315, 549, 461, 145, 145, 1554, 417,
- /* 1040 */ 536, 502, 556, 1184, 137, 138, 91, 115, 1232, 1232,
+ /* 1000 */ 128, 455, 5, 926, 580, 485, 345, 1208, 1044, 1208,
+ /* 1010 */ 1209, 1208, 337, 927, 339, 478, 50, 580, 125, 417,
+ /* 1020 */ 3, 1515, 1349, 1129, 434, 1033, 415, 66, 66, 1032,
+ /* 1030 */ 453, 453, 453, 290, 577, 866, 566, 414, 413, 417,
+ /* 1040 */ 67, 67, 1572, 1228, 137, 138, 91, 115, 1232, 1232,
/* 1050 */ 1067, 1070, 1057, 1057, 135, 135, 136, 136, 136, 136,
- /* 1060 */ 580, 1032, 1032, 1034, 137, 138, 91, 324, 1232, 1232,
+ /* 1060 */ 580, 1032, 1032, 1034, 137, 138, 91, 537, 1232, 1232,
/* 1070 */ 1067, 1070, 1057, 1057, 135, 135, 136, 136, 136, 136,
- /* 1080 */ 422, 1580, 340, 82, 82, 7, 1509, 402, 1152, 1286,
- /* 1090 */ 423, 1192, 1208, 1209, 1208, 1184, 367, 1208, 1209, 1208,
- /* 1100 */ 362, 537, 557, 134, 134, 134, 134, 133, 133, 132,
- /* 1110 */ 132, 132, 131, 128, 455, 564, 502, 305, 580, 974,
- /* 1120 */ 317, 158, 1208, 134, 134, 134, 134, 133, 133, 132,
- /* 1130 */ 132, 132, 131, 128, 455, 5, 580, 108, 537, 481,
- /* 1140 */ 1208, 147, 147, 1228, 337, 1578, 339, 580, 325, 7,
- /* 1150 */ 288, 288, 417, 3, 1439, 502, 10, 215, 267, 82,
- /* 1160 */ 82, 1344, 357, 577, 360, 566, 538, 1254, 502, 1577,
- /* 1170 */ 66, 66, 417, 7, 221, 1455, 1211, 137, 138, 91,
+ /* 1080 */ 1573, 299, 381, 82, 82, 476, 350, 1228, 1554, 485,
+ /* 1090 */ 47, 1192, 1208, 1209, 1208, 474, 338, 1208, 1209, 1208,
+ /* 1100 */ 10, 564, 267, 134, 134, 134, 134, 133, 133, 132,
+ /* 1110 */ 132, 132, 131, 128, 455, 1208, 1209, 1208, 1572, 974,
+ /* 1120 */ 449, 507, 580, 134, 134, 134, 134, 133, 133, 132,
+ /* 1130 */ 132, 132, 131, 128, 455, 580, 288, 288, 1089, 557,
+ /* 1140 */ 580, 1114, 1114, 499, 580, 21, 21, 580, 485, 577,
+ /* 1150 */ 261, 566, 417, 1620, 1573, 1439, 381, 215, 82, 82,
+ /* 1160 */ 260, 259, 258, 82, 82, 302, 49, 53, 53, 1211,
+ /* 1170 */ 68, 68, 417, 1335, 1335, 1454, 1502, 137, 138, 91,
/* 1180 */ 119, 1232, 1232, 1067, 1070, 1057, 1057, 135, 135, 136,
- /* 1190 */ 136, 136, 136, 580, 1454, 580, 449, 137, 138, 91,
- /* 1200 */ 1340, 1232, 1232, 1067, 1070, 1057, 1057, 135, 135, 136,
- /* 1210 */ 136, 136, 136, 355, 377, 1599, 82, 82, 82, 82,
- /* 1220 */ 260, 259, 258, 573, 423, 498, 1439, 973, 338, 328,
- /* 1230 */ 1208, 1209, 1208, 377, 1599, 238, 134, 134, 134, 134,
- /* 1240 */ 133, 133, 132, 132, 132, 131, 128, 455, 1208, 1209,
- /* 1250 */ 1208, 580, 1228, 450, 580, 454, 134, 134, 134, 134,
- /* 1260 */ 133, 133, 132, 132, 132, 131, 128, 455, 580, 467,
- /* 1270 */ 580, 424, 184, 467, 67, 67, 417, 21, 21, 297,
- /* 1280 */ 375, 1248, 1631, 297, 915, 1211, 1384, 469, 478, 482,
- /* 1290 */ 374, 53, 53, 68, 68, 580, 417, 447, 415, 415,
- /* 1300 */ 415, 137, 126, 91, 1383, 1232, 1232, 1067, 1070, 1057,
- /* 1310 */ 1057, 135, 135, 136, 136, 136, 136, 580, 54, 54,
- /* 1320 */ 580, 233, 138, 91, 580, 1232, 1232, 1067, 1070, 1057,
- /* 1330 */ 1057, 135, 135, 136, 136, 136, 136, 111, 878, 470,
- /* 1340 */ 69, 69, 227, 70, 70, 456, 973, 71, 71, 987,
- /* 1350 */ 580, 160, 477, 580, 1453, 123, 572, 988, 4, 1561,
+ /* 1190 */ 136, 136, 136, 906, 324, 450, 1228, 137, 138, 91,
+ /* 1200 */ 454, 1232, 1232, 1067, 1070, 1057, 1057, 135, 135, 136,
+ /* 1210 */ 136, 136, 136, 1453, 377, 1599, 1663, 403, 422, 854,
+ /* 1220 */ 855, 856, 1286, 423, 304, 519, 498, 973, 1372, 315,
+ /* 1230 */ 1573, 580, 381, 907, 367, 502, 134, 134, 134, 134,
+ /* 1240 */ 133, 133, 132, 132, 132, 131, 128, 455, 580, 227,
+ /* 1250 */ 580, 491, 377, 1599, 54, 54, 134, 134, 134, 134,
+ /* 1260 */ 133, 133, 132, 132, 132, 131, 128, 455, 580, 1173,
+ /* 1270 */ 580, 69, 69, 70, 70, 580, 417, 214, 1211, 227,
+ /* 1280 */ 1344, 557, 1173, 325, 878, 1173, 573, 423, 1439, 439,
+ /* 1290 */ 405, 71, 71, 72, 72, 580, 417, 160, 73, 73,
+ /* 1300 */ 158, 137, 126, 91, 502, 1232, 1232, 1067, 1070, 1057,
+ /* 1310 */ 1057, 135, 135, 136, 136, 136, 136, 580, 55, 55,
+ /* 1320 */ 886, 233, 138, 91, 580, 1232, 1232, 1067, 1070, 1057,
+ /* 1330 */ 1057, 135, 135, 136, 136, 136, 136, 402, 1253, 491,
+ /* 1340 */ 56, 56, 1130, 424, 184, 456, 973, 57, 57, 1340,
+ /* 1350 */ 502, 347, 580, 466, 580, 123, 572, 1131, 4, 447,
/* 1360 */ 134, 134, 134, 134, 133, 133, 132, 132, 132, 131,
- /* 1370 */ 128, 455, 575, 72, 72, 345, 73, 73, 580, 341,
+ /* 1370 */ 128, 455, 575, 1132, 109, 59, 59, 60, 60, 580,
/* 1380 */ 134, 134, 134, 134, 133, 133, 132, 132, 132, 131,
- /* 1390 */ 128, 455, 580, 377, 1599, 1534, 580, 1228, 585, 580,
- /* 1400 */ 1263, 55, 55, 489, 580, 321, 580, 155, 569, 580,
- /* 1410 */ 287, 231, 267, 523, 1345, 56, 56, 893, 44, 57,
- /* 1420 */ 57, 166, 59, 59, 319, 97, 218, 60, 60, 74,
- /* 1430 */ 74, 1533, 75, 75, 494, 415, 580, 1044, 1227, 897,
- /* 1440 */ 948, 352, 580, 121, 121, 947, 580, 878, 242, 288,
- /* 1450 */ 288, 122, 1096, 456, 581, 456, 1380, 580, 1032, 76,
- /* 1460 */ 76, 456, 577, 290, 566, 20, 20, 109, 528, 77,
- /* 1470 */ 77, 123, 572, 948, 4, 320, 571, 245, 947, 108,
- /* 1480 */ 61, 61, 120, 356, 117, 161, 456, 16, 575, 359,
- /* 1490 */ 1032, 1032, 1034, 1035, 35, 361, 123, 572, 580, 4,
- /* 1500 */ 23, 490, 9, 288, 288, 580, 1228, 580, 538, 459,
- /* 1510 */ 580, 293, 580, 575, 905, 904, 577, 529, 566, 479,
- /* 1520 */ 1192, 143, 143, 580, 569, 1315, 893, 580, 144, 144,
- /* 1530 */ 78, 78, 532, 62, 62, 79, 79, 1148, 546, 404,
- /* 1540 */ 428, 580, 300, 545, 524, 323, 63, 63, 363, 569,
- /* 1550 */ 80, 80, 580, 1044, 912, 913, 222, 580, 1328, 121,
- /* 1560 */ 121, 1096, 1314, 546, 64, 64, 244, 122, 547, 456,
- /* 1570 */ 581, 456, 990, 991, 1032, 170, 170, 456, 1044, 1036,
- /* 1580 */ 171, 171, 1313, 1620, 121, 121, 1312, 123, 572, 205,
- /* 1590 */ 4, 370, 122, 580, 456, 581, 456, 580, 1108, 1032,
- /* 1600 */ 1108, 580, 456, 580, 575, 380, 1032, 1032, 1034, 1035,
- /* 1610 */ 35, 1157, 123, 572, 1393, 4, 87, 87, 1438, 580,
- /* 1620 */ 65, 65, 1370, 1366, 83, 83, 146, 146, 346, 575,
- /* 1630 */ 111, 1032, 1032, 1034, 1035, 35, 1192, 280, 1593, 292,
- /* 1640 */ 569, 1378, 84, 84, 400, 400, 399, 277, 397, 567,
- /* 1650 */ 1025, 863, 266, 1443, 546, 580, 484, 580, 266, 545,
- /* 1660 */ 486, 1192, 266, 1293, 239, 569, 327, 1284, 580, 1044,
- /* 1670 */ 1272, 351, 580, 111, 326, 121, 121, 1271, 168, 168,
- /* 1680 */ 148, 148, 508, 122, 263, 456, 581, 456, 1036, 1273,
- /* 1690 */ 1032, 142, 142, 1613, 1044, 169, 169, 365, 503, 111,
- /* 1700 */ 121, 121, 952, 167, 165, 241, 111, 580, 122, 1363,
- /* 1710 */ 456, 581, 456, 175, 312, 1032, 43, 224, 1092, 580,
- /* 1720 */ 263, 313, 1032, 1032, 1034, 1035, 35, 1605, 1196, 458,
- /* 1730 */ 162, 162, 292, 240, 978, 12, 266, 400, 400, 399,
- /* 1740 */ 277, 397, 152, 152, 863, 314, 580, 1032, 1032, 1034,
- /* 1750 */ 1035, 35, 1192, 946, 237, 125, 580, 239, 1425, 327,
- /* 1760 */ 580, 943, 580, 125, 1107, 580, 1107, 326, 418, 151,
- /* 1770 */ 151, 580, 401, 320, 571, 333, 295, 1192, 580, 149,
- /* 1780 */ 149, 580, 343, 150, 150, 86, 86, 336, 88, 88,
- /* 1790 */ 876, 945, 159, 125, 85, 85, 1430, 462, 241, 1429,
- /* 1800 */ 344, 52, 52, 301, 58, 58, 175, 408, 456, 43,
- /* 1810 */ 349, 513, 488, 228, 1311, 1375, 373, 1506, 123, 572,
- /* 1820 */ 1505, 4, 1376, 210, 1374, 211, 240, 570, 456, 1616,
- /* 1830 */ 1373, 395, 1248, 223, 186, 575, 235, 92, 90, 572,
- /* 1840 */ 270, 4, 1553, 1551, 1245, 426, 95, 195, 96, 1420,
- /* 1850 */ 1511, 220, 1426, 13, 140, 575, 557, 180, 332, 188,
- /* 1860 */ 1413, 418, 472, 335, 190, 191, 320, 571, 192, 193,
- /* 1870 */ 473, 569, 506, 247, 109, 406, 1432, 1431, 14, 495,
- /* 1880 */ 480, 1434, 199, 1522, 409, 1500, 251, 102, 281, 501,
- /* 1890 */ 462, 569, 354, 253, 203, 358, 504, 1274, 522, 254,
- /* 1900 */ 1044, 255, 411, 1331, 1330, 440, 121, 121, 1329, 1322,
- /* 1910 */ 104, 1301, 897, 1630, 122, 1629, 456, 581, 456, 1321,
- /* 1920 */ 1044, 1032, 229, 372, 1299, 412, 121, 121, 1628, 1300,
+ /* 1390 */ 128, 455, 580, 878, 568, 355, 580, 222, 585, 580,
+ /* 1400 */ 1263, 580, 74, 74, 120, 321, 117, 155, 569, 402,
+ /* 1410 */ 1152, 161, 1044, 16, 1345, 75, 75, 1254, 44, 76,
+ /* 1420 */ 76, 482, 20, 20, 77, 77, 1580, 1578, 886, 1033,
+ /* 1430 */ 7, 7, 415, 1032, 1577, 489, 580, 1044, 7, 305,
+ /* 1440 */ 1227, 467, 948, 121, 121, 467, 580, 947, 297, 288,
+ /* 1450 */ 288, 122, 297, 456, 581, 456, 580, 319, 1032, 143,
+ /* 1460 */ 143, 456, 577, 166, 566, 1032, 1032, 1034, 415, 144,
+ /* 1470 */ 144, 123, 572, 242, 4, 320, 571, 245, 328, 78,
+ /* 1480 */ 78, 287, 231, 293, 481, 479, 456, 580, 575, 1254,
+ /* 1490 */ 1032, 1032, 1034, 1035, 35, 1192, 123, 572, 580, 4,
+ /* 1500 */ 97, 218, 9, 580, 1148, 580, 404, 580, 300, 459,
+ /* 1510 */ 62, 62, 580, 575, 23, 375, 580, 323, 580, 221,
+ /* 1520 */ 1192, 79, 79, 580, 569, 374, 63, 63, 80, 80,
+ /* 1530 */ 64, 64, 580, 490, 1384, 170, 170, 532, 546, 171,
+ /* 1540 */ 171, 87, 87, 545, 912, 913, 65, 65, 346, 569,
+ /* 1550 */ 111, 1383, 580, 1044, 428, 83, 83, 580, 222, 121,
+ /* 1560 */ 121, 470, 1025, 546, 266, 905, 904, 122, 547, 456,
+ /* 1570 */ 581, 456, 1561, 893, 1032, 146, 146, 456, 1044, 1096,
+ /* 1580 */ 84, 84, 990, 991, 121, 121, 524, 123, 572, 341,
+ /* 1590 */ 4, 244, 122, 1534, 456, 581, 456, 580, 484, 1032,
+ /* 1600 */ 266, 580, 456, 580, 575, 1036, 1032, 1032, 1034, 1035,
+ /* 1610 */ 35, 205, 123, 572, 580, 4, 1157, 1108, 580, 1108,
+ /* 1620 */ 168, 168, 1533, 494, 148, 148, 142, 142, 486, 575,
+ /* 1630 */ 266, 1032, 1032, 1034, 1035, 35, 1192, 169, 169, 292,
+ /* 1640 */ 569, 162, 162, 352, 400, 400, 399, 277, 397, 580,
+ /* 1650 */ 351, 863, 111, 1380, 546, 580, 508, 580, 263, 545,
+ /* 1660 */ 365, 1192, 111, 356, 239, 569, 327, 359, 580, 1044,
+ /* 1670 */ 361, 363, 152, 152, 326, 121, 121, 1328, 151, 151,
+ /* 1680 */ 149, 149, 893, 122, 1315, 456, 581, 456, 1096, 1314,
+ /* 1690 */ 1032, 150, 150, 1313, 1044, 580, 165, 1092, 111, 263,
+ /* 1700 */ 121, 121, 952, 1312, 978, 241, 266, 580, 122, 370,
+ /* 1710 */ 456, 581, 456, 175, 1036, 1032, 43, 380, 86, 86,
+ /* 1720 */ 1370, 1393, 1032, 1032, 1034, 1035, 35, 1605, 1196, 458,
+ /* 1730 */ 88, 88, 292, 240, 946, 1438, 125, 400, 400, 399,
+ /* 1740 */ 277, 397, 580, 943, 863, 125, 1366, 1032, 1032, 1034,
+ /* 1750 */ 1035, 35, 1192, 1593, 1107, 580, 1107, 239, 876, 327,
+ /* 1760 */ 159, 945, 1378, 125, 580, 85, 85, 326, 418, 567,
+ /* 1770 */ 503, 1443, 1293, 320, 571, 1284, 1272, 1192, 52, 52,
+ /* 1780 */ 1271, 1273, 1613, 280, 401, 167, 1363, 58, 58, 12,
+ /* 1790 */ 312, 313, 314, 1425, 224, 237, 295, 462, 241, 333,
+ /* 1800 */ 336, 343, 344, 301, 349, 488, 175, 1375, 456, 43,
+ /* 1810 */ 1430, 513, 1429, 228, 1376, 1311, 408, 210, 123, 572,
+ /* 1820 */ 373, 4, 1506, 1505, 1374, 1373, 240, 1616, 456, 570,
+ /* 1830 */ 211, 395, 1248, 270, 1553, 575, 1245, 223, 90, 572,
+ /* 1840 */ 1551, 4, 426, 186, 96, 1511, 220, 92, 235, 1426,
+ /* 1850 */ 95, 195, 140, 557, 332, 575, 13, 180, 1420, 188,
+ /* 1860 */ 1413, 418, 335, 472, 190, 191, 320, 571, 473, 192,
+ /* 1870 */ 193, 569, 506, 247, 109, 1434, 406, 199, 495, 1432,
+ /* 1880 */ 251, 102, 1431, 480, 409, 14, 501, 1522, 281, 354,
+ /* 1890 */ 462, 569, 1500, 203, 253, 522, 358, 254, 504, 1274,
+ /* 1900 */ 1044, 255, 1331, 411, 1330, 1329, 121, 121, 440, 104,
+ /* 1910 */ 1301, 412, 1322, 1630, 122, 1629, 456, 581, 456, 897,
+ /* 1920 */ 1044, 1032, 372, 1300, 1299, 1628, 121, 121, 1321, 229,
/* 1930 */ 1598, 444, 531, 310, 122, 445, 456, 581, 456, 311,
- /* 1940 */ 559, 1032, 378, 268, 269, 448, 1398, 11, 389, 1397,
- /* 1950 */ 1487, 116, 110, 1032, 1032, 1034, 1035, 35, 318, 541,
- /* 1960 */ 558, 1354, 1353, 1584, 387, 1583, 216, 393, 394, 42,
+ /* 1940 */ 559, 1032, 378, 268, 269, 448, 1398, 11, 1487, 389,
+ /* 1950 */ 116, 318, 110, 1032, 1032, 1034, 1035, 35, 1354, 387,
+ /* 1960 */ 558, 1353, 216, 1584, 1583, 541, 1397, 393, 42, 394,
/* 1970 */ 583, 1202, 276, 1032, 1032, 1034, 1035, 35, 1196, 458,
- /* 1980 */ 278, 279, 292, 1192, 584, 1269, 1264, 400, 400, 399,
- /* 1990 */ 277, 397, 1538, 1539, 863, 1537, 172, 185, 156, 308,
- /* 2000 */ 456, 225, 850, 1192, 1536, 173, 457, 239, 174, 327,
- /* 2010 */ 123, 572, 89, 4, 226, 217, 236, 326, 154, 322,
- /* 2020 */ 419, 420, 1106, 1104, 330, 187, 176, 575, 189, 1227,
- /* 2030 */ 243, 929, 246, 342, 1120, 194, 177, 178, 429, 98,
- /* 2040 */ 99, 196, 431, 100, 101, 179, 1123, 248, 241, 1119,
- /* 2050 */ 249, 163, 24, 250, 266, 353, 175, 1242, 252, 43,
- /* 2060 */ 500, 1112, 201, 569, 200, 15, 374, 865, 505, 256,
- /* 2070 */ 895, 517, 202, 103, 25, 509, 240, 366, 26, 369,
- /* 2080 */ 514, 908, 105, 309, 1158, 164, 106, 525, 107, 1189,
- /* 2090 */ 1073, 1159, 1044, 27, 181, 17, 230, 284, 121, 121,
- /* 2100 */ 286, 204, 1179, 265, 982, 976, 122, 125, 456, 581,
- /* 2110 */ 456, 418, 28, 1032, 29, 30, 320, 571, 31, 1177,
- /* 2120 */ 1175, 8, 1182, 32, 1164, 41, 553, 33, 34, 208,
- /* 2130 */ 111, 1087, 1074, 113, 1183, 1072, 1076, 114, 1128, 565,
- /* 2140 */ 462, 118, 271, 1077, 36, 1032, 1032, 1034, 1035, 35,
- /* 2150 */ 18, 576, 1037, 877, 939, 124, 37, 398, 272, 153,
- /* 2160 */ 183, 1198, 273, 1621, 1197, 1260, 1260, 1260, 1260, 1260,
+ /* 1980 */ 278, 279, 292, 1192, 584, 1538, 172, 400, 400, 399,
+ /* 1990 */ 277, 397, 156, 1539, 863, 1269, 1264, 1537, 1536, 308,
+ /* 2000 */ 456, 225, 173, 1192, 226, 174, 850, 239, 457, 327,
+ /* 2010 */ 123, 572, 89, 4, 217, 322, 419, 326, 185, 420,
+ /* 2020 */ 154, 236, 1106, 1104, 330, 187, 176, 575, 1227, 189,
+ /* 2030 */ 929, 243, 342, 246, 1120, 194, 177, 178, 429, 98,
+ /* 2040 */ 99, 196, 100, 101, 179, 431, 1123, 248, 241, 1119,
+ /* 2050 */ 249, 163, 24, 250, 266, 353, 175, 1242, 1112, 43,
+ /* 2060 */ 500, 252, 200, 569, 201, 15, 374, 865, 505, 509,
+ /* 2070 */ 256, 895, 202, 103, 25, 26, 240, 366, 164, 514,
+ /* 2080 */ 369, 105, 309, 517, 1189, 908, 106, 525, 107, 1073,
+ /* 2090 */ 1159, 17, 1044, 1158, 27, 181, 230, 284, 121, 121,
+ /* 2100 */ 286, 204, 265, 976, 28, 125, 122, 982, 456, 581,
+ /* 2110 */ 456, 418, 29, 1032, 1175, 30, 320, 571, 31, 1179,
+ /* 2120 */ 8, 1177, 1182, 32, 1164, 41, 553, 33, 34, 208,
+ /* 2130 */ 111, 1087, 1074, 1072, 1076, 1128, 271, 113, 565, 114,
+ /* 2140 */ 462, 118, 1077, 36, 18, 1032, 1032, 1034, 1035, 35,
+ /* 2150 */ 1037, 877, 1183, 939, 124, 37, 398, 272, 153, 576,
+ /* 2160 */ 273, 183, 1621, 1198, 1197, 1260, 1260, 1260, 1260, 1260,
/* 2170 */ 1260, 1260, 1260, 1260, 1260, 1192,
};
static const YYCODETYPE yy_lookahead[] = {
- /* 0 */ 226, 196, 228, 196, 196, 196, 196, 242, 243, 218,
- /* 10 */ 236, 188, 189, 190, 191, 192, 193, 226, 208, 19,
- /* 20 */ 255, 198, 257, 200, 219, 220, 219, 220, 219, 220,
- /* 30 */ 207, 31, 278, 279, 280, 22, 23, 219, 25, 39,
- /* 40 */ 278, 279, 280, 235, 44, 45, 46, 207, 48, 49,
+ /* 0 */ 225, 195, 227, 195, 195, 195, 195, 241, 242, 217,
+ /* 10 */ 235, 187, 188, 189, 190, 191, 192, 225, 207, 19,
+ /* 20 */ 254, 197, 256, 199, 218, 219, 218, 219, 218, 219,
+ /* 30 */ 206, 31, 277, 278, 279, 22, 23, 218, 25, 39,
+ /* 40 */ 277, 278, 279, 234, 44, 45, 46, 206, 48, 49,
/* 50 */ 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
- /* 60 */ 9, 299, 196, 22, 196, 242, 243, 190, 191, 192,
- /* 70 */ 193, 23, 9, 25, 206, 198, 208, 200, 255, 196,
- /* 80 */ 257, 196, 242, 243, 207, 219, 220, 282, 56, 57,
- /* 90 */ 58, 59, 60, 270, 209, 255, 55, 257, 238, 239,
- /* 100 */ 260, 261, 216, 103, 104, 105, 106, 107, 108, 109,
- /* 110 */ 110, 111, 112, 113, 114, 102, 231, 314, 233, 242,
- /* 120 */ 243, 318, 256, 19, 241, 302, 319, 320, 319, 320,
- /* 130 */ 9, 265, 255, 196, 257, 103, 104, 105, 106, 107,
- /* 140 */ 108, 109, 110, 111, 112, 113, 114, 270, 44, 45,
- /* 150 */ 46, 196, 48, 49, 50, 51, 52, 53, 54, 55,
- /* 160 */ 56, 57, 58, 59, 278, 279, 280, 119, 117, 118,
- /* 170 */ 119, 120, 109, 314, 123, 124, 125, 318, 19, 302,
+ /* 60 */ 9, 298, 195, 22, 195, 241, 242, 189, 190, 191,
+ /* 70 */ 192, 23, 9, 25, 205, 197, 207, 199, 254, 195,
+ /* 80 */ 256, 195, 241, 242, 206, 218, 219, 281, 56, 57,
+ /* 90 */ 58, 59, 60, 269, 208, 254, 55, 256, 237, 238,
+ /* 100 */ 259, 260, 215, 103, 104, 105, 106, 107, 108, 109,
+ /* 110 */ 110, 111, 112, 113, 114, 102, 230, 313, 232, 241,
+ /* 120 */ 242, 317, 255, 19, 240, 301, 318, 319, 318, 319,
+ /* 130 */ 9, 264, 254, 195, 256, 103, 104, 105, 106, 107,
+ /* 140 */ 108, 109, 110, 111, 112, 113, 114, 269, 44, 45,
+ /* 150 */ 46, 114, 48, 49, 50, 51, 52, 53, 54, 55,
+ /* 160 */ 56, 57, 58, 59, 277, 278, 279, 119, 117, 118,
+ /* 170 */ 119, 120, 109, 218, 123, 124, 125, 195, 19, 301,
/* 180 */ 117, 118, 119, 24, 133, 109, 110, 111, 112, 113,
/* 190 */ 114, 87, 144, 89, 103, 104, 105, 106, 107, 108,
- /* 200 */ 109, 110, 111, 112, 113, 114, 196, 103, 104, 105,
+ /* 200 */ 109, 110, 111, 112, 113, 114, 16, 103, 104, 105,
/* 210 */ 106, 107, 108, 109, 110, 111, 112, 113, 114, 107,
/* 220 */ 108, 109, 110, 111, 112, 113, 114, 19, 107, 108,
- /* 230 */ 82, 242, 243, 25, 114, 74, 196, 116, 117, 118,
- /* 240 */ 119, 219, 121, 82, 255, 308, 257, 310, 196, 196,
- /* 250 */ 129, 296, 44, 45, 46, 96, 48, 49, 50, 51,
- /* 260 */ 52, 53, 54, 55, 56, 57, 58, 59, 48, 49,
- /* 270 */ 50, 51, 252, 114, 254, 154, 266, 156, 70, 120,
- /* 280 */ 121, 122, 123, 124, 125, 126, 196, 139, 140, 128,
- /* 290 */ 120, 132, 222, 123, 124, 125, 244, 244, 19, 196,
- /* 300 */ 139, 140, 216, 133, 196, 207, 213, 214, 215, 219,
- /* 310 */ 220, 103, 104, 105, 106, 107, 108, 109, 110, 111,
- /* 320 */ 112, 113, 114, 44, 45, 46, 219, 48, 49, 50,
+ /* 230 */ 82, 241, 242, 25, 195, 74, 48, 116, 117, 118,
+ /* 240 */ 119, 25, 121, 82, 254, 307, 256, 309, 195, 195,
+ /* 250 */ 129, 195, 44, 45, 46, 96, 48, 49, 50, 51,
+ /* 260 */ 52, 53, 54, 55, 56, 57, 58, 59, 78, 121,
+ /* 270 */ 80, 218, 219, 114, 251, 154, 253, 156, 70, 120,
+ /* 280 */ 121, 122, 123, 124, 125, 126, 233, 139, 140, 128,
+ /* 290 */ 218, 132, 77, 77, 312, 313, 240, 74, 19, 317,
+ /* 300 */ 139, 140, 195, 88, 116, 90, 90, 206, 93, 93,
+ /* 310 */ 271, 103, 104, 105, 106, 107, 108, 109, 110, 111,
+ /* 320 */ 112, 113, 114, 44, 45, 46, 232, 48, 49, 50,
/* 330 */ 51, 52, 53, 54, 55, 56, 57, 58, 59, 19,
- /* 340 */ 242, 243, 122, 77, 24, 129, 130, 68, 278, 279,
- /* 350 */ 280, 311, 312, 255, 88, 257, 90, 222, 196, 93,
- /* 360 */ 308, 308, 310, 310, 44, 45, 46, 19, 48, 49,
+ /* 340 */ 286, 276, 241, 242, 24, 120, 195, 68, 123, 124,
+ /* 350 */ 125, 128, 129, 130, 203, 254, 221, 256, 133, 208,
+ /* 360 */ 195, 146, 221, 195, 44, 45, 46, 19, 48, 49,
/* 370 */ 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
- /* 380 */ 9, 295, 103, 104, 105, 106, 107, 108, 109, 110,
- /* 390 */ 111, 112, 113, 114, 46, 287, 48, 49, 50, 51,
- /* 400 */ 52, 53, 54, 55, 56, 57, 58, 59, 243, 319,
- /* 410 */ 19, 321, 146, 278, 279, 280, 313, 314, 107, 108,
- /* 420 */ 255, 318, 257, 103, 104, 105, 106, 107, 108, 109,
- /* 430 */ 110, 111, 112, 113, 114, 44, 45, 46, 196, 48,
+ /* 380 */ 315, 316, 103, 104, 105, 106, 107, 108, 109, 110,
+ /* 390 */ 111, 112, 113, 114, 46, 200, 48, 49, 50, 51,
+ /* 400 */ 52, 53, 54, 55, 56, 57, 58, 59, 240, 195,
+ /* 410 */ 19, 9, 277, 278, 279, 82, 195, 9, 277, 278,
+ /* 420 */ 279, 129, 130, 103, 104, 105, 106, 107, 108, 109,
+ /* 430 */ 110, 111, 112, 113, 114, 44, 45, 46, 195, 48,
/* 440 */ 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
/* 450 */ 59, 103, 104, 105, 106, 107, 108, 109, 110, 111,
- /* 460 */ 112, 113, 114, 196, 196, 154, 196, 156, 196, 9,
- /* 470 */ 166, 167, 101, 9, 207, 313, 314, 213, 214, 215,
- /* 480 */ 318, 207, 214, 215, 9, 207, 219, 220, 117, 118,
- /* 490 */ 25, 219, 220, 122, 103, 104, 105, 106, 107, 108,
- /* 500 */ 109, 110, 111, 112, 113, 114, 234, 9, 196, 242,
- /* 510 */ 243, 112, 113, 114, 19, 233, 242, 243, 23, 196,
- /* 520 */ 242, 243, 255, 256, 257, 154, 155, 156, 11, 255,
- /* 530 */ 196, 257, 265, 255, 19, 257, 266, 73, 23, 44,
+ /* 460 */ 112, 113, 114, 195, 107, 108, 195, 299, 9, 195,
+ /* 470 */ 25, 9, 139, 140, 206, 73, 195, 312, 313, 284,
+ /* 480 */ 206, 73, 317, 288, 22, 26, 218, 219, 48, 49,
+ /* 490 */ 50, 51, 218, 219, 103, 104, 105, 106, 107, 108,
+ /* 500 */ 109, 110, 111, 112, 113, 114, 246, 9, 265, 241,
+ /* 510 */ 242, 154, 195, 156, 19, 241, 242, 257, 23, 117,
+ /* 520 */ 118, 119, 254, 255, 256, 117, 118, 119, 254, 255,
+ /* 530 */ 256, 195, 264, 195, 19, 218, 219, 266, 23, 44,
/* 540 */ 45, 46, 151, 48, 49, 50, 51, 52, 53, 54,
- /* 550 */ 55, 56, 57, 58, 59, 184, 288, 35, 235, 44,
- /* 560 */ 45, 46, 196, 48, 49, 50, 51, 52, 53, 54,
- /* 570 */ 55, 56, 57, 58, 59, 77, 247, 117, 118, 119,
- /* 580 */ 196, 117, 118, 119, 272, 74, 88, 258, 90, 67,
- /* 590 */ 196, 93, 117, 118, 119, 207, 9, 75, 103, 104,
+ /* 550 */ 55, 56, 57, 58, 59, 195, 218, 219, 195, 44,
+ /* 560 */ 45, 46, 122, 48, 49, 50, 51, 52, 53, 54,
+ /* 570 */ 55, 56, 57, 58, 59, 77, 117, 118, 119, 117,
+ /* 580 */ 118, 119, 19, 116, 139, 140, 88, 195, 90, 31,
+ /* 590 */ 195, 93, 311, 255, 234, 206, 9, 39, 103, 104,
/* 600 */ 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
- /* 610 */ 196, 146, 152, 219, 220, 117, 118, 119, 103, 104,
+ /* 610 */ 218, 219, 145, 218, 219, 117, 118, 119, 103, 104,
/* 620 */ 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
- /* 630 */ 242, 243, 196, 219, 220, 22, 25, 196, 19, 128,
- /* 640 */ 129, 130, 23, 255, 146, 257, 129, 130, 234, 135,
- /* 650 */ 256, 137, 138, 131, 25, 9, 272, 196, 19, 265,
- /* 660 */ 73, 273, 23, 44, 45, 46, 207, 48, 49, 50,
- /* 670 */ 51, 52, 53, 54, 55, 56, 57, 58, 59, 82,
- /* 680 */ 219, 220, 241, 44, 45, 46, 196, 48, 49, 50,
- /* 690 */ 51, 52, 53, 54, 55, 56, 57, 58, 59, 196,
- /* 700 */ 196, 242, 243, 196, 117, 118, 119, 204, 272, 25,
- /* 710 */ 139, 140, 209, 209, 255, 196, 257, 256, 121, 196,
- /* 720 */ 107, 108, 103, 104, 105, 106, 107, 108, 109, 110,
- /* 730 */ 111, 112, 113, 114, 196, 207, 139, 140, 219, 220,
- /* 740 */ 196, 300, 103, 104, 105, 106, 107, 108, 109, 110,
- /* 750 */ 111, 112, 113, 114, 143, 9, 216, 267, 214, 215,
- /* 760 */ 77, 77, 19, 117, 118, 119, 23, 244, 139, 140,
- /* 770 */ 242, 243, 26, 90, 90, 256, 93, 93, 196, 272,
- /* 780 */ 196, 196, 19, 255, 265, 257, 23, 44, 45, 46,
+ /* 630 */ 241, 242, 67, 22, 23, 318, 25, 320, 19, 212,
+ /* 640 */ 213, 214, 23, 254, 146, 256, 135, 255, 137, 138,
+ /* 650 */ 255, 86, 112, 113, 114, 9, 264, 15, 19, 264,
+ /* 660 */ 95, 272, 23, 44, 45, 46, 206, 48, 49, 50,
+ /* 670 */ 51, 52, 53, 54, 55, 56, 57, 58, 59, 116,
+ /* 680 */ 117, 195, 25, 44, 45, 46, 195, 48, 49, 50,
+ /* 690 */ 51, 52, 53, 54, 55, 56, 57, 58, 59, 213,
+ /* 700 */ 214, 241, 242, 61, 117, 118, 119, 195, 145, 218,
+ /* 710 */ 219, 195, 147, 102, 254, 9, 256, 195, 195, 206,
+ /* 720 */ 195, 195, 103, 104, 105, 106, 107, 108, 109, 110,
+ /* 730 */ 111, 112, 113, 114, 195, 206, 195, 166, 167, 152,
+ /* 740 */ 218, 219, 103, 104, 105, 106, 107, 108, 109, 110,
+ /* 750 */ 111, 112, 113, 114, 241, 242, 195, 218, 219, 218,
+ /* 760 */ 219, 215, 19, 117, 118, 119, 23, 254, 243, 256,
+ /* 770 */ 241, 242, 233, 287, 233, 139, 140, 255, 266, 218,
+ /* 780 */ 219, 265, 19, 254, 127, 256, 23, 44, 45, 46,
/* 790 */ 144, 48, 49, 50, 51, 52, 53, 54, 55, 56,
- /* 800 */ 57, 58, 59, 219, 220, 196, 196, 44, 45, 46,
- /* 810 */ 12, 48, 49, 50, 51, 52, 53, 54, 55, 56,
- /* 820 */ 57, 58, 59, 22, 23, 27, 25, 12, 219, 220,
- /* 830 */ 290, 308, 288, 310, 296, 295, 128, 129, 130, 273,
- /* 840 */ 256, 43, 27, 234, 21, 196, 103, 104, 105, 106,
- /* 850 */ 107, 108, 109, 110, 111, 112, 113, 114, 43, 196,
- /* 860 */ 196, 196, 64, 117, 118, 119, 103, 104, 105, 106,
- /* 870 */ 107, 108, 109, 110, 111, 112, 113, 114, 9, 64,
- /* 880 */ 238, 239, 219, 220, 219, 220, 19, 22, 23, 74,
- /* 890 */ 23, 22, 29, 7, 8, 9, 33, 234, 196, 234,
- /* 900 */ 48, 9, 196, 102, 81, 196, 19, 56, 57, 58,
+ /* 800 */ 57, 58, 59, 195, 195, 195, 109, 44, 45, 46,
+ /* 810 */ 215, 48, 49, 50, 51, 52, 53, 54, 55, 56,
+ /* 820 */ 57, 58, 59, 117, 118, 119, 218, 219, 218, 219,
+ /* 830 */ 195, 246, 307, 136, 309, 289, 310, 311, 141, 195,
+ /* 840 */ 294, 233, 257, 233, 206, 195, 103, 104, 105, 106,
+ /* 850 */ 107, 108, 109, 110, 111, 112, 113, 114, 195, 195,
+ /* 860 */ 195, 313, 218, 219, 195, 317, 103, 104, 105, 106,
+ /* 870 */ 107, 108, 109, 110, 111, 112, 113, 114, 9, 241,
+ /* 880 */ 242, 218, 219, 218, 219, 195, 19, 218, 219, 294,
+ /* 890 */ 23, 22, 254, 29, 256, 195, 233, 33, 233, 255,
+ /* 900 */ 265, 9, 233, 23, 195, 25, 19, 56, 57, 58,
/* 910 */ 59, 44, 45, 46, 22, 48, 49, 50, 51, 52,
- /* 920 */ 53, 54, 55, 56, 57, 58, 59, 196, 196, 66,
- /* 930 */ 266, 44, 45, 46, 201, 48, 49, 50, 51, 52,
- /* 940 */ 53, 54, 55, 56, 57, 58, 59, 124, 305, 306,
- /* 950 */ 244, 219, 220, 196, 103, 104, 105, 106, 107, 108,
- /* 960 */ 109, 110, 111, 112, 113, 114, 234, 102, 116, 267,
+ /* 920 */ 53, 54, 55, 56, 57, 58, 59, 218, 219, 195,
+ /* 930 */ 66, 44, 45, 46, 9, 48, 49, 50, 51, 52,
+ /* 940 */ 53, 54, 55, 56, 57, 58, 59, 213, 214, 24,
+ /* 950 */ 16, 12, 22, 195, 103, 104, 105, 106, 107, 108,
+ /* 960 */ 109, 110, 111, 112, 113, 114, 27, 11, 195, 19,
/* 970 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
- /* 980 */ 113, 114, 196, 19, 9, 162, 117, 118, 119, 9,
+ /* 980 */ 113, 114, 43, 130, 9, 295, 117, 118, 119, 9,
/* 990 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
- /* 1000 */ 113, 114, 22, 19, 196, 219, 220, 196, 101, 117,
- /* 1010 */ 118, 119, 48, 196, 308, 67, 310, 196, 285, 19,
- /* 1020 */ 234, 312, 289, 23, 267, 118, 196, 219, 220, 122,
- /* 1030 */ 219, 220, 263, 264, 86, 196, 219, 220, 196, 19,
- /* 1040 */ 19, 196, 234, 95, 44, 45, 46, 160, 48, 49,
+ /* 1000 */ 113, 114, 22, 64, 195, 195, 153, 9, 101, 117,
+ /* 1010 */ 118, 119, 78, 74, 80, 246, 243, 195, 25, 19,
+ /* 1020 */ 22, 287, 242, 23, 266, 118, 257, 218, 219, 122,
+ /* 1030 */ 212, 213, 214, 22, 254, 21, 256, 107, 108, 19,
+ /* 1040 */ 218, 219, 195, 118, 44, 45, 46, 160, 48, 49,
/* 1050 */ 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
- /* 1060 */ 196, 154, 155, 156, 44, 45, 46, 196, 48, 49,
+ /* 1060 */ 195, 154, 155, 156, 44, 45, 46, 117, 48, 49,
/* 1070 */ 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
- /* 1080 */ 116, 314, 16, 219, 220, 318, 241, 22, 23, 211,
- /* 1090 */ 212, 184, 117, 118, 119, 147, 132, 117, 118, 119,
- /* 1100 */ 16, 117, 146, 103, 104, 105, 106, 107, 108, 109,
- /* 1110 */ 110, 111, 112, 113, 114, 207, 196, 296, 196, 144,
- /* 1120 */ 256, 165, 9, 103, 104, 105, 106, 107, 108, 109,
- /* 1130 */ 110, 111, 112, 113, 114, 22, 196, 116, 117, 116,
- /* 1140 */ 9, 219, 220, 9, 78, 314, 80, 196, 196, 318,
- /* 1150 */ 242, 243, 19, 22, 196, 196, 22, 24, 24, 219,
- /* 1160 */ 220, 241, 78, 255, 80, 257, 145, 102, 196, 314,
- /* 1170 */ 219, 220, 19, 318, 151, 277, 9, 44, 45, 46,
+ /* 1080 */ 307, 271, 309, 218, 219, 129, 130, 9, 195, 195,
+ /* 1090 */ 243, 184, 117, 118, 119, 81, 162, 117, 118, 119,
+ /* 1100 */ 22, 206, 24, 103, 104, 105, 106, 107, 108, 109,
+ /* 1110 */ 110, 111, 112, 113, 114, 117, 118, 119, 195, 144,
+ /* 1120 */ 255, 19, 195, 103, 104, 105, 106, 107, 108, 109,
+ /* 1130 */ 110, 111, 112, 113, 114, 195, 241, 242, 124, 146,
+ /* 1140 */ 195, 128, 129, 130, 195, 218, 219, 195, 195, 254,
+ /* 1150 */ 48, 256, 19, 142, 307, 195, 309, 24, 218, 219,
+ /* 1160 */ 128, 129, 130, 218, 219, 271, 243, 218, 219, 9,
+ /* 1170 */ 218, 219, 19, 237, 238, 276, 162, 44, 45, 46,
/* 1180 */ 160, 48, 49, 50, 51, 52, 53, 54, 55, 56,
- /* 1190 */ 57, 58, 59, 196, 277, 196, 256, 44, 45, 46,
- /* 1200 */ 241, 48, 49, 50, 51, 52, 53, 54, 55, 56,
- /* 1210 */ 57, 58, 59, 241, 316, 317, 219, 220, 219, 220,
- /* 1220 */ 128, 129, 130, 211, 212, 267, 196, 25, 162, 196,
- /* 1230 */ 117, 118, 119, 316, 317, 15, 103, 104, 105, 106,
- /* 1240 */ 107, 108, 109, 110, 111, 112, 113, 114, 117, 118,
- /* 1250 */ 119, 196, 118, 256, 196, 256, 103, 104, 105, 106,
- /* 1260 */ 107, 108, 109, 110, 111, 112, 113, 114, 196, 264,
- /* 1270 */ 196, 303, 304, 268, 219, 220, 19, 219, 220, 264,
- /* 1280 */ 122, 61, 23, 268, 25, 118, 196, 247, 247, 247,
- /* 1290 */ 132, 219, 220, 219, 220, 196, 19, 267, 258, 258,
- /* 1300 */ 258, 44, 45, 46, 196, 48, 49, 50, 51, 52,
- /* 1310 */ 53, 54, 55, 56, 57, 58, 59, 196, 219, 220,
- /* 1320 */ 196, 119, 45, 46, 196, 48, 49, 50, 51, 52,
- /* 1330 */ 53, 54, 55, 56, 57, 58, 59, 25, 9, 196,
- /* 1340 */ 219, 220, 25, 219, 220, 9, 144, 219, 220, 31,
- /* 1350 */ 196, 22, 130, 196, 277, 19, 20, 39, 22, 196,
+ /* 1190 */ 57, 58, 59, 35, 195, 255, 118, 44, 45, 46,
+ /* 1200 */ 255, 48, 49, 50, 51, 52, 53, 54, 55, 56,
+ /* 1210 */ 57, 58, 59, 276, 315, 316, 304, 305, 116, 7,
+ /* 1220 */ 8, 9, 210, 211, 271, 67, 266, 25, 262, 263,
+ /* 1230 */ 307, 195, 309, 75, 132, 195, 103, 104, 105, 106,
+ /* 1240 */ 107, 108, 109, 110, 111, 112, 113, 114, 195, 25,
+ /* 1250 */ 195, 195, 315, 316, 218, 219, 103, 104, 105, 106,
+ /* 1260 */ 107, 108, 109, 110, 111, 112, 113, 114, 195, 77,
+ /* 1270 */ 195, 218, 219, 218, 219, 195, 19, 195, 118, 25,
+ /* 1280 */ 240, 146, 90, 195, 9, 93, 210, 211, 195, 131,
+ /* 1290 */ 208, 218, 219, 218, 219, 195, 19, 22, 218, 219,
+ /* 1300 */ 165, 44, 45, 46, 195, 48, 49, 50, 51, 52,
+ /* 1310 */ 53, 54, 55, 56, 57, 58, 59, 195, 218, 219,
+ /* 1320 */ 9, 119, 45, 46, 195, 48, 49, 50, 51, 52,
+ /* 1330 */ 53, 54, 55, 56, 57, 58, 59, 22, 23, 195,
+ /* 1340 */ 218, 219, 12, 302, 303, 9, 144, 218, 219, 240,
+ /* 1350 */ 195, 295, 195, 272, 195, 19, 20, 27, 22, 266,
/* 1360 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
- /* 1370 */ 113, 114, 36, 219, 220, 153, 219, 220, 196, 196,
+ /* 1370 */ 113, 114, 36, 43, 150, 218, 219, 218, 219, 195,
/* 1380 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
- /* 1390 */ 113, 114, 196, 316, 317, 196, 196, 9, 191, 196,
- /* 1400 */ 193, 219, 220, 19, 196, 198, 196, 200, 72, 196,
- /* 1410 */ 260, 261, 24, 109, 207, 219, 220, 9, 82, 219,
- /* 1420 */ 220, 23, 219, 220, 247, 150, 151, 219, 220, 219,
- /* 1430 */ 220, 196, 219, 220, 196, 258, 196, 101, 25, 127,
- /* 1440 */ 136, 196, 196, 107, 108, 141, 196, 118, 24, 242,
- /* 1450 */ 243, 115, 9, 117, 118, 119, 196, 196, 122, 219,
- /* 1460 */ 220, 9, 255, 22, 257, 219, 220, 150, 207, 219,
- /* 1470 */ 220, 19, 20, 136, 22, 139, 140, 270, 141, 116,
- /* 1480 */ 219, 220, 159, 196, 161, 22, 9, 24, 36, 196,
- /* 1490 */ 154, 155, 156, 157, 158, 196, 19, 20, 196, 22,
- /* 1500 */ 22, 117, 50, 242, 243, 196, 118, 196, 145, 302,
- /* 1510 */ 196, 100, 196, 36, 121, 122, 255, 256, 257, 130,
- /* 1520 */ 184, 219, 220, 196, 72, 229, 118, 196, 219, 220,
- /* 1530 */ 219, 220, 19, 219, 220, 219, 220, 23, 86, 25,
- /* 1540 */ 62, 196, 153, 91, 146, 134, 219, 220, 196, 72,
- /* 1550 */ 219, 220, 196, 101, 7, 8, 143, 196, 196, 107,
- /* 1560 */ 108, 118, 229, 86, 219, 220, 142, 115, 91, 117,
- /* 1570 */ 118, 119, 84, 85, 122, 219, 220, 9, 101, 9,
- /* 1580 */ 219, 220, 229, 142, 107, 108, 196, 19, 20, 259,
- /* 1590 */ 22, 196, 115, 196, 117, 118, 119, 196, 154, 122,
- /* 1600 */ 156, 196, 9, 196, 36, 196, 154, 155, 156, 157,
- /* 1610 */ 158, 98, 19, 20, 196, 22, 219, 220, 196, 196,
- /* 1620 */ 219, 220, 262, 196, 219, 220, 219, 220, 23, 36,
- /* 1630 */ 25, 154, 155, 156, 157, 158, 184, 291, 323, 5,
- /* 1640 */ 72, 196, 219, 220, 10, 11, 12, 13, 14, 239,
- /* 1650 */ 23, 17, 25, 196, 86, 196, 23, 196, 25, 91,
- /* 1660 */ 23, 184, 25, 196, 30, 72, 32, 196, 196, 101,
- /* 1670 */ 196, 23, 196, 25, 40, 107, 108, 196, 219, 220,
- /* 1680 */ 219, 220, 23, 115, 25, 117, 118, 119, 118, 196,
- /* 1690 */ 122, 219, 220, 196, 101, 219, 220, 23, 292, 25,
- /* 1700 */ 107, 108, 109, 245, 23, 71, 25, 196, 115, 259,
- /* 1710 */ 117, 118, 119, 79, 259, 122, 82, 217, 23, 196,
- /* 1720 */ 25, 259, 154, 155, 156, 157, 158, 0, 1, 2,
- /* 1730 */ 219, 220, 5, 99, 23, 246, 25, 10, 11, 12,
- /* 1740 */ 13, 14, 219, 220, 17, 259, 196, 154, 155, 156,
- /* 1750 */ 157, 158, 184, 23, 301, 25, 196, 30, 275, 32,
- /* 1760 */ 196, 23, 196, 25, 154, 196, 156, 40, 134, 219,
- /* 1770 */ 220, 196, 194, 139, 140, 271, 248, 184, 196, 219,
- /* 1780 */ 220, 196, 297, 219, 220, 219, 220, 271, 219, 220,
- /* 1790 */ 23, 23, 25, 25, 219, 220, 275, 163, 71, 275,
- /* 1800 */ 249, 219, 220, 249, 219, 220, 79, 275, 9, 82,
- /* 1810 */ 248, 223, 297, 232, 228, 263, 222, 222, 19, 20,
- /* 1820 */ 222, 22, 263, 252, 263, 252, 99, 284, 9, 199,
- /* 1830 */ 263, 248, 61, 246, 301, 36, 301, 298, 19, 20,
- /* 1840 */ 142, 22, 203, 203, 38, 203, 298, 22, 152, 253,
- /* 1850 */ 287, 151, 276, 274, 149, 36, 146, 44, 252, 237,
- /* 1860 */ 253, 134, 18, 252, 240, 240, 139, 140, 240, 240,
- /* 1870 */ 203, 72, 18, 202, 150, 249, 276, 276, 274, 203,
- /* 1880 */ 249, 237, 237, 294, 249, 249, 202, 159, 203, 63,
- /* 1890 */ 163, 72, 293, 202, 22, 203, 224, 203, 116, 202,
- /* 1900 */ 101, 202, 224, 221, 221, 65, 107, 108, 221, 230,
- /* 1910 */ 22, 221, 127, 227, 115, 227, 117, 118, 119, 230,
- /* 1920 */ 101, 122, 166, 221, 221, 224, 107, 108, 221, 223,
- /* 1930 */ 317, 24, 309, 286, 115, 114, 117, 118, 119, 286,
- /* 1940 */ 141, 122, 224, 203, 92, 83, 269, 22, 203, 269,
- /* 1950 */ 281, 159, 148, 154, 155, 156, 157, 158, 283, 147,
- /* 1960 */ 141, 253, 253, 322, 252, 322, 251, 250, 249, 25,
- /* 1970 */ 205, 13, 197, 154, 155, 156, 157, 158, 1, 2,
- /* 1980 */ 197, 6, 5, 184, 195, 195, 195, 10, 11, 12,
- /* 1990 */ 13, 14, 216, 216, 17, 216, 210, 304, 225, 225,
- /* 2000 */ 9, 217, 4, 184, 216, 210, 3, 30, 210, 32,
- /* 2010 */ 19, 20, 216, 22, 217, 22, 15, 40, 16, 164,
- /* 2020 */ 307, 307, 23, 23, 140, 152, 131, 36, 143, 25,
- /* 2030 */ 24, 20, 145, 16, 1, 143, 131, 131, 62, 55,
- /* 2040 */ 55, 152, 37, 55, 55, 131, 117, 34, 71, 1,
- /* 2050 */ 142, 5, 22, 116, 25, 162, 79, 76, 142, 82,
- /* 2060 */ 41, 69, 116, 72, 69, 24, 132, 20, 19, 126,
- /* 2070 */ 9, 97, 22, 22, 22, 68, 99, 23, 22, 24,
- /* 2080 */ 68, 28, 22, 68, 98, 23, 150, 22, 25, 23,
- /* 2090 */ 23, 23, 101, 34, 37, 22, 142, 23, 107, 108,
- /* 2100 */ 23, 22, 76, 34, 117, 144, 115, 25, 117, 118,
- /* 2110 */ 119, 134, 34, 122, 34, 34, 139, 140, 34, 87,
- /* 2120 */ 89, 45, 94, 34, 23, 22, 24, 34, 22, 25,
- /* 2130 */ 25, 23, 23, 143, 76, 23, 23, 143, 23, 25,
- /* 2140 */ 163, 25, 22, 11, 22, 154, 155, 156, 157, 158,
- /* 2150 */ 22, 25, 23, 23, 136, 22, 22, 15, 142, 23,
- /* 2160 */ 25, 1, 142, 142, 1, 324, 324, 324, 324, 324,
- /* 2170 */ 324, 324, 324, 324, 324, 184, 324, 324, 324, 324,
- /* 2180 */ 324, 324, 324, 324, 324, 324, 324, 324, 324, 324,
- /* 2190 */ 324, 324, 324, 324, 324, 324, 324, 324, 324, 324,
- /* 2200 */ 324, 324, 324, 324, 324, 324, 324, 324, 324, 324,
- /* 2210 */ 324, 324, 324, 324, 324, 324, 324, 324, 324, 324,
- /* 2220 */ 324, 324, 324, 324, 324, 324, 324, 324, 324, 324,
- /* 2230 */ 324, 324, 324, 324, 324, 324, 324, 324, 324, 324,
- /* 2240 */ 324, 324, 324, 324, 324, 324, 324, 324, 324, 324,
- /* 2250 */ 324, 324, 324, 324, 324, 324, 324, 324, 324, 324,
- /* 2260 */ 324, 324, 324, 324, 324, 324, 324, 324, 324, 324,
- /* 2270 */ 324, 324, 324, 324, 324, 324, 324, 324, 324, 324,
- /* 2280 */ 324, 324, 324, 324, 324, 324, 324, 324, 324, 324,
- /* 2290 */ 324, 324, 324, 324, 324, 324, 324, 324, 324, 324,
- /* 2300 */ 324, 324, 324, 324, 324, 324, 324, 324, 324, 324,
- /* 2310 */ 324, 324, 324, 324, 324, 324, 324, 324, 324, 324,
- /* 2320 */ 324, 324, 324, 324, 324, 324, 324, 324, 324, 324,
- /* 2330 */ 324, 324, 324, 324, 324, 324, 324, 324, 324, 324,
- /* 2340 */ 324, 324, 324, 324, 324, 324, 324, 324, 324, 324,
- /* 2350 */ 324, 324, 324, 188, 188, 188, 188, 188, 188, 188,
- /* 2360 */ 188, 188, 188, 188,
+ /* 1390 */ 113, 114, 195, 118, 64, 240, 195, 143, 190, 195,
+ /* 1400 */ 192, 195, 218, 219, 159, 197, 161, 199, 72, 22,
+ /* 1410 */ 23, 22, 101, 24, 206, 218, 219, 102, 82, 218,
+ /* 1420 */ 219, 246, 218, 219, 218, 219, 313, 313, 117, 118,
+ /* 1430 */ 317, 317, 257, 122, 313, 19, 195, 101, 317, 295,
+ /* 1440 */ 25, 263, 136, 107, 108, 267, 195, 141, 263, 241,
+ /* 1450 */ 242, 115, 267, 117, 118, 119, 195, 246, 122, 218,
+ /* 1460 */ 219, 9, 254, 23, 256, 154, 155, 156, 257, 218,
+ /* 1470 */ 219, 19, 20, 24, 22, 139, 140, 269, 195, 218,
+ /* 1480 */ 219, 259, 260, 100, 116, 130, 9, 195, 36, 102,
+ /* 1490 */ 154, 155, 156, 157, 158, 184, 19, 20, 195, 22,
+ /* 1500 */ 150, 151, 50, 195, 23, 195, 25, 195, 153, 301,
+ /* 1510 */ 218, 219, 195, 36, 22, 122, 195, 134, 195, 151,
+ /* 1520 */ 184, 218, 219, 195, 72, 132, 218, 219, 218, 219,
+ /* 1530 */ 218, 219, 195, 117, 195, 218, 219, 19, 86, 218,
+ /* 1540 */ 219, 218, 219, 91, 7, 8, 218, 219, 23, 72,
+ /* 1550 */ 25, 195, 195, 101, 62, 218, 219, 195, 143, 107,
+ /* 1560 */ 108, 195, 23, 86, 25, 121, 122, 115, 91, 117,
+ /* 1570 */ 118, 119, 195, 9, 122, 218, 219, 9, 101, 9,
+ /* 1580 */ 218, 219, 84, 85, 107, 108, 146, 19, 20, 195,
+ /* 1590 */ 22, 142, 115, 195, 117, 118, 119, 195, 23, 122,
+ /* 1600 */ 25, 195, 9, 195, 36, 9, 154, 155, 156, 157,
+ /* 1610 */ 158, 258, 19, 20, 195, 22, 98, 154, 195, 156,
+ /* 1620 */ 218, 219, 195, 195, 218, 219, 218, 219, 23, 36,
+ /* 1630 */ 25, 154, 155, 156, 157, 158, 184, 218, 219, 5,
+ /* 1640 */ 72, 218, 219, 195, 10, 11, 12, 13, 14, 195,
+ /* 1650 */ 23, 17, 25, 195, 86, 195, 23, 195, 25, 91,
+ /* 1660 */ 23, 184, 25, 195, 30, 72, 32, 195, 195, 101,
+ /* 1670 */ 195, 195, 218, 219, 40, 107, 108, 195, 218, 219,
+ /* 1680 */ 218, 219, 118, 115, 228, 117, 118, 119, 118, 228,
+ /* 1690 */ 122, 218, 219, 228, 101, 195, 23, 23, 25, 25,
+ /* 1700 */ 107, 108, 109, 195, 23, 71, 25, 195, 115, 195,
+ /* 1710 */ 117, 118, 119, 79, 118, 122, 82, 195, 218, 219,
+ /* 1720 */ 261, 195, 154, 155, 156, 157, 158, 0, 1, 2,
+ /* 1730 */ 218, 219, 5, 99, 23, 195, 25, 10, 11, 12,
+ /* 1740 */ 13, 14, 195, 23, 17, 25, 195, 154, 155, 156,
+ /* 1750 */ 157, 158, 184, 322, 154, 195, 156, 30, 23, 32,
+ /* 1760 */ 25, 23, 195, 25, 195, 218, 219, 40, 134, 238,
+ /* 1770 */ 291, 195, 195, 139, 140, 195, 195, 184, 218, 219,
+ /* 1780 */ 195, 195, 195, 290, 193, 244, 258, 218, 219, 245,
+ /* 1790 */ 258, 258, 258, 274, 216, 300, 247, 163, 71, 270,
+ /* 1800 */ 270, 296, 248, 248, 247, 296, 79, 262, 9, 82,
+ /* 1810 */ 274, 222, 274, 231, 262, 227, 274, 251, 19, 20,
+ /* 1820 */ 221, 22, 221, 221, 262, 262, 99, 198, 9, 283,
+ /* 1830 */ 251, 247, 61, 142, 202, 36, 38, 245, 19, 20,
+ /* 1840 */ 202, 22, 202, 300, 152, 286, 151, 297, 300, 275,
+ /* 1850 */ 297, 22, 149, 146, 251, 36, 273, 44, 252, 236,
+ /* 1860 */ 252, 134, 251, 18, 239, 239, 139, 140, 202, 239,
+ /* 1870 */ 239, 72, 18, 201, 150, 236, 248, 236, 202, 275,
+ /* 1880 */ 201, 159, 275, 248, 248, 273, 63, 293, 202, 292,
+ /* 1890 */ 163, 72, 248, 22, 201, 116, 202, 201, 223, 202,
+ /* 1900 */ 101, 201, 220, 223, 220, 220, 107, 108, 65, 22,
+ /* 1910 */ 220, 223, 229, 226, 115, 226, 117, 118, 119, 127,
+ /* 1920 */ 101, 122, 220, 222, 220, 220, 107, 108, 229, 166,
+ /* 1930 */ 316, 24, 308, 285, 115, 114, 117, 118, 119, 285,
+ /* 1940 */ 141, 122, 223, 202, 92, 83, 268, 22, 280, 202,
+ /* 1950 */ 159, 282, 148, 154, 155, 156, 157, 158, 252, 251,
+ /* 1960 */ 141, 252, 250, 321, 321, 147, 268, 249, 25, 248,
+ /* 1970 */ 204, 13, 196, 154, 155, 156, 157, 158, 1, 2,
+ /* 1980 */ 196, 6, 5, 184, 194, 215, 209, 10, 11, 12,
+ /* 1990 */ 13, 14, 224, 215, 17, 194, 194, 215, 215, 224,
+ /* 2000 */ 9, 216, 209, 184, 216, 209, 4, 30, 3, 32,
+ /* 2010 */ 19, 20, 215, 22, 22, 164, 306, 40, 303, 306,
+ /* 2020 */ 16, 15, 23, 23, 140, 152, 131, 36, 25, 143,
+ /* 2030 */ 20, 24, 16, 145, 1, 143, 131, 131, 62, 55,
+ /* 2040 */ 55, 152, 55, 55, 131, 37, 117, 34, 71, 1,
+ /* 2050 */ 142, 5, 22, 116, 25, 162, 79, 76, 69, 82,
+ /* 2060 */ 41, 142, 69, 72, 116, 24, 132, 20, 19, 68,
+ /* 2070 */ 126, 9, 22, 22, 22, 22, 99, 23, 23, 68,
+ /* 2080 */ 24, 22, 68, 97, 23, 28, 150, 22, 25, 23,
+ /* 2090 */ 23, 22, 101, 98, 34, 37, 142, 23, 107, 108,
+ /* 2100 */ 23, 22, 34, 144, 34, 25, 115, 117, 117, 118,
+ /* 2110 */ 119, 134, 34, 122, 89, 34, 139, 140, 34, 76,
+ /* 2120 */ 45, 87, 94, 34, 23, 22, 24, 34, 22, 25,
+ /* 2130 */ 25, 23, 23, 23, 23, 23, 22, 143, 25, 143,
+ /* 2140 */ 163, 25, 11, 22, 22, 154, 155, 156, 157, 158,
+ /* 2150 */ 23, 23, 76, 136, 22, 22, 15, 142, 23, 25,
+ /* 2160 */ 142, 25, 142, 1, 1, 323, 323, 323, 323, 323,
+ /* 2170 */ 323, 323, 323, 323, 323, 184, 323, 323, 323, 323,
+ /* 2180 */ 323, 323, 323, 323, 323, 323, 323, 323, 323, 323,
+ /* 2190 */ 323, 323, 323, 323, 323, 323, 323, 323, 323, 323,
+ /* 2200 */ 323, 323, 323, 323, 323, 323, 323, 323, 323, 323,
+ /* 2210 */ 323, 323, 323, 323, 323, 323, 323, 323, 323, 323,
+ /* 2220 */ 323, 323, 323, 323, 323, 323, 323, 323, 323, 323,
+ /* 2230 */ 323, 323, 323, 323, 323, 323, 323, 323, 323, 323,
+ /* 2240 */ 323, 323, 323, 323, 323, 323, 323, 323, 323, 323,
+ /* 2250 */ 323, 323, 323, 323, 323, 323, 323, 323, 323, 323,
+ /* 2260 */ 323, 323, 323, 323, 323, 323, 323, 323, 323, 323,
+ /* 2270 */ 323, 323, 323, 323, 323, 323, 323, 323, 323, 323,
+ /* 2280 */ 323, 323, 323, 323, 323, 323, 323, 323, 323, 323,
+ /* 2290 */ 323, 323, 323, 323, 323, 323, 323, 323, 323, 323,
+ /* 2300 */ 323, 323, 323, 323, 323, 323, 323, 323, 323, 323,
+ /* 2310 */ 323, 323, 323, 323, 323, 323, 323, 323, 323, 323,
+ /* 2320 */ 323, 323, 323, 323, 323, 323, 323, 323, 323, 323,
+ /* 2330 */ 323, 323, 323, 323, 323, 323, 323, 323, 323, 323,
+ /* 2340 */ 323, 323, 323, 323, 323, 323, 323, 323, 323, 323,
+ /* 2350 */ 323, 323, 187, 187, 187, 187, 187, 187, 187, 187,
+ /* 2360 */ 187, 187, 187,
};
#define YY_SHIFT_COUNT (586)
#define YY_SHIFT_MIN (0)
#define YY_SHIFT_MAX (2163)
static const unsigned short int yy_shift_ofst[] = {
- /* 0 */ 1977, 1727, 1634, 1336, 1336, 148, 161, 1452, 1477, 1568,
- /* 10 */ 1991, 1991, 1991, 597, 148, 148, 148, 148, 148, 0,
+ /* 0 */ 1977, 1727, 1634, 1336, 1336, 333, 161, 1452, 1477, 1568,
+ /* 10 */ 1991, 1991, 1991, 148, 333, 333, 333, 333, 333, 0,
/* 20 */ 0, 279, 1153, 1991, 1991, 1991, 1991, 1991, 1991, 1991,
/* 30 */ 1991, 1991, 1991, 1991, 1991, 1991, 1991, 1991, 121, 121,
- /* 40 */ 498, 498, 51, 464, 587, 475, 475, 629, 629, 629,
- /* 50 */ 629, 104, 208, 320, 391, 495, 515, 619, 639, 743,
+ /* 40 */ 498, 498, 51, 402, 408, 706, 706, 445, 445, 445,
+ /* 50 */ 445, 104, 208, 320, 391, 495, 515, 619, 639, 743,
/* 60 */ 763, 867, 887, 1000, 1020, 1133, 1153, 1153, 1153, 1153,
/* 70 */ 1153, 1153, 1153, 1153, 1153, 1153, 1153, 1153, 1153, 1153,
/* 80 */ 1153, 1153, 1153, 1153, 1257, 1153, 1277, 348, 348, 1593,
@@ -178120,97 +178023,97 @@ static const unsigned short int yy_shift_ofst[] = {
/* 120 */ 1991, 1991, 1991, 1991, 1991, 1991, 1991, 1991, 1991, 1991,
/* 130 */ 1991, 1991, 1991, 1991, 1991, 1991, 1991, 1991, 1991, 1991,
/* 140 */ 1991, 1991, 32, 851, 851, 851, 851, 851, 851, 851,
- /* 150 */ 91, 112, 76, 746, 475, 823, 964, 475, 475, 311,
- /* 160 */ 311, 475, 399, 216, 304, 304, 304, 571, 120, 120,
- /* 170 */ 2176, 2176, 159, 159, 159, 460, 869, 869, 869, 869,
- /* 180 */ 815, 815, 266, 746, 13, 801, 475, 475, 475, 475,
- /* 190 */ 475, 475, 475, 475, 475, 475, 475, 475, 475, 475,
- /* 200 */ 475, 475, 475, 475, 475, 1021, 684, 684, 475, 517,
- /* 210 */ 683, 683, 984, 984, 1167, 1167, 956, 2176, 2176, 2176,
- /* 220 */ 2176, 2176, 2176, 2176, 371, 907, 907, 892, 170, 980,
- /* 230 */ 63, 1113, 646, 975, 1131, 475, 475, 475, 475, 475,
- /* 240 */ 475, 475, 475, 475, 475, 511, 475, 475, 475, 475,
- /* 250 */ 475, 475, 475, 475, 475, 475, 475, 475, 522, 522,
- /* 260 */ 522, 475, 475, 475, 48, 475, 475, 475, 1134, 948,
- /* 270 */ 475, 798, 475, 475, 475, 475, 475, 475, 475, 475,
- /* 280 */ 708, 863, 514, 1388, 1388, 1388, 1388, 1202, 514, 514,
- /* 290 */ 1304, 613, 886, 1220, 1023, 1275, 611, 1275, 1384, 1317,
- /* 300 */ 1023, 1023, 1317, 1023, 611, 1384, 1312, 1259, 852, 1318,
- /* 310 */ 1318, 1318, 1363, 1363, 1363, 1363, 465, 465, 1323, 1413,
- /* 320 */ 1337, 1463, 1771, 1771, 1698, 1698, 1806, 1806, 1698, 1696,
- /* 330 */ 1700, 1825, 1705, 1710, 1813, 1705, 1710, 1844, 1844, 1844,
- /* 340 */ 1844, 1698, 1854, 1724, 1700, 1700, 1724, 1825, 1813, 1724,
- /* 350 */ 1813, 1724, 1698, 1854, 1728, 1826, 1698, 1854, 1872, 1698,
- /* 360 */ 1854, 1698, 1854, 1872, 1782, 1782, 1782, 1840, 1888, 1888,
- /* 370 */ 1872, 1782, 1785, 1782, 1840, 1782, 1782, 1756, 1907, 1821,
- /* 380 */ 1821, 1872, 1698, 1852, 1852, 1862, 1862, 1705, 1710, 1925,
- /* 390 */ 1698, 1792, 1705, 1804, 1812, 1724, 1944, 1958, 1958, 1975,
+ /* 150 */ 91, 112, 76, 459, 706, 1014, 1102, 706, 706, 357,
+ /* 160 */ 357, 706, 540, 292, 571, 571, 571, 636, 37, 37,
+ /* 170 */ 2176, 2176, 159, 159, 159, 587, 462, 462, 462, 462,
+ /* 180 */ 939, 939, 215, 459, 13, 611, 706, 706, 706, 706,
+ /* 190 */ 706, 706, 706, 706, 706, 706, 706, 706, 706, 706,
+ /* 200 */ 706, 706, 706, 706, 706, 563, 216, 216, 706, 956,
+ /* 210 */ 1192, 1192, 950, 950, 1160, 1160, 1135, 2176, 2176, 2176,
+ /* 220 */ 2176, 2176, 2176, 2176, 1311, 907, 907, 869, 225, 892,
+ /* 230 */ 63, 980, 646, 975, 998, 706, 706, 706, 706, 706,
+ /* 240 */ 706, 706, 706, 706, 706, 223, 706, 706, 706, 706,
+ /* 250 */ 706, 706, 706, 706, 706, 706, 706, 706, 1158, 1158,
+ /* 260 */ 1158, 706, 706, 706, 48, 706, 706, 706, 1078, 565,
+ /* 270 */ 706, 1330, 706, 706, 706, 706, 706, 706, 706, 706,
+ /* 280 */ 1013, 864, 511, 925, 925, 925, 925, 1202, 511, 511,
+ /* 290 */ 697, 930, 1212, 642, 1368, 1350, 1254, 1350, 1416, 1224,
+ /* 300 */ 1368, 1368, 1224, 1368, 1254, 1416, 657, 880, 188, 558,
+ /* 310 */ 558, 558, 467, 467, 467, 467, 993, 993, 1245, 1415,
+ /* 320 */ 1306, 1389, 1771, 1771, 1691, 1691, 1798, 1798, 1691, 1692,
+ /* 330 */ 1695, 1829, 1703, 1707, 1813, 1703, 1707, 1845, 1845, 1845,
+ /* 340 */ 1845, 1691, 1854, 1724, 1695, 1695, 1724, 1829, 1813, 1724,
+ /* 350 */ 1813, 1724, 1691, 1854, 1722, 1823, 1691, 1854, 1871, 1691,
+ /* 360 */ 1854, 1691, 1854, 1871, 1779, 1779, 1779, 1843, 1887, 1887,
+ /* 370 */ 1871, 1779, 1792, 1779, 1843, 1779, 1779, 1763, 1907, 1821,
+ /* 380 */ 1821, 1871, 1691, 1852, 1852, 1862, 1862, 1703, 1707, 1925,
+ /* 390 */ 1691, 1791, 1703, 1804, 1818, 1724, 1943, 1958, 1958, 1975,
/* 400 */ 1975, 1975, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176,
- /* 410 */ 2176, 2176, 2176, 2176, 2176, 2176, 2176, 220, 1066, 865,
- /* 420 */ 1065, 1084, 1092, 1329, 1514, 1411, 41, 1424, 1222, 1389,
- /* 430 */ 1605, 1478, 1627, 1633, 1637, 1648, 1659, 1674, 1408, 1393,
- /* 440 */ 1547, 1158, 1681, 1398, 1513, 1443, 1695, 1711, 1488, 1730,
- /* 450 */ 1738, 1444, 1610, 1767, 1768, 1570, 1441, 1998, 2003, 1993,
- /* 460 */ 1855, 2001, 2002, 1999, 2000, 1884, 1873, 1895, 2004, 2004,
- /* 470 */ 2006, 1885, 2011, 1887, 2017, 2033, 1892, 1905, 2004, 1906,
- /* 480 */ 1976, 2005, 2004, 1889, 1984, 1985, 1988, 1989, 1914, 1929,
- /* 490 */ 2013, 1908, 2048, 2046, 2030, 1937, 1893, 1992, 2029, 1995,
- /* 500 */ 1981, 2019, 1916, 1946, 2041, 2047, 2049, 1934, 1943, 2050,
- /* 510 */ 2007, 2051, 2052, 2054, 2056, 2012, 2061, 2055, 1974, 2053,
- /* 520 */ 2060, 2015, 2057, 2062, 2059, 1936, 2065, 2066, 2067, 2063,
- /* 530 */ 2068, 2073, 1986, 1954, 2074, 2077, 1987, 2069, 2079, 1961,
- /* 540 */ 2082, 2078, 2080, 2081, 2084, 2031, 2026, 2032, 2076, 2058,
- /* 550 */ 2028, 2089, 2101, 2103, 2102, 2104, 2105, 2093, 1990, 1994,
- /* 560 */ 2108, 2082, 2109, 2112, 2113, 2106, 2114, 2116, 2115, 2120,
- /* 570 */ 2132, 2122, 2128, 2129, 2130, 2133, 2134, 2126, 2018, 2016,
- /* 580 */ 2020, 2021, 2135, 2136, 2142, 2160, 2163,
+ /* 410 */ 2176, 2176, 2176, 2176, 2176, 2176, 2176, 440, 934, 1315,
+ /* 420 */ 1387, 190, 1032, 1275, 1481, 1383, 41, 1449, 853, 1355,
+ /* 430 */ 1525, 1492, 1539, 1575, 1605, 1627, 1633, 1637, 1564, 1444,
+ /* 440 */ 1537, 1393, 1673, 1440, 1518, 1570, 1674, 1681, 1498, 1711,
+ /* 450 */ 1720, 1463, 1600, 1735, 1738, 1596, 1011, 2002, 2005, 1992,
+ /* 460 */ 1851, 2006, 2004, 1999, 2000, 1884, 1873, 1895, 2003, 2003,
+ /* 470 */ 2007, 1886, 2010, 1888, 2016, 2033, 1892, 1905, 2003, 1906,
+ /* 480 */ 1976, 2008, 2003, 1889, 1984, 1985, 1987, 1988, 1913, 1929,
+ /* 490 */ 2013, 1908, 2048, 2046, 2030, 1937, 1893, 1989, 2029, 1993,
+ /* 500 */ 1981, 2019, 1919, 1948, 2041, 2047, 2049, 1934, 1944, 2050,
+ /* 510 */ 2001, 2051, 2052, 2054, 2053, 2011, 2062, 2056, 1986, 2057,
+ /* 520 */ 2059, 2014, 2058, 2055, 2060, 1936, 2065, 2061, 2066, 2063,
+ /* 530 */ 2067, 2069, 1995, 1954, 2074, 2077, 1990, 2068, 2079, 1959,
+ /* 540 */ 2080, 2070, 2078, 2081, 2084, 2025, 2043, 2034, 2075, 2076,
+ /* 550 */ 2028, 2089, 2101, 2103, 2102, 2104, 2105, 2093, 1994, 1996,
+ /* 560 */ 2108, 2080, 2109, 2110, 2111, 2106, 2113, 2116, 2112, 2114,
+ /* 570 */ 2131, 2121, 2122, 2127, 2128, 2132, 2133, 2134, 2017, 2015,
+ /* 580 */ 2018, 2020, 2136, 2135, 2141, 2162, 2163,
};
#define YY_REDUCE_COUNT (416)
-#define YY_REDUCE_MIN (-246)
-#define YY_REDUCE_MAX (1798)
+#define YY_REDUCE_MIN (-245)
+#define YY_REDUCE_MAX (1802)
static const short yy_reduce_ofst[] = {
- /* 0 */ -177, -123, 1207, 267, 1261, -160, 388, -193, 90, -191,
- /* 10 */ -134, 394, 519, 98, 274, 278, 459, 528, 908, 70,
- /* 20 */ 135, -238, -114, 272, 414, 609, 663, 665, 461, 732,
- /* 30 */ 786, 584, 864, 808, 940, -195, 997, 999, 268, 544,
- /* 40 */ 103, 162, -115, 52, 53, 523, 706, -235, -11, -235,
- /* 50 */ -11, -246, -246, -246, -246, -246, -246, -246, -246, -246,
- /* 60 */ -246, -246, -246, -246, -246, -246, -246, -246, -246, -246,
- /* 70 */ -246, -246, -246, -246, -246, -246, -246, -246, -246, -246,
- /* 80 */ -246, -246, -246, -246, -246, -246, -246, -246, -246, 811,
- /* 90 */ 817, 922, 951, 1055, 1058, 1072, 1074, 1099, 1121, 1124,
- /* 100 */ 1128, 1154, 1157, 1182, 1196, 1200, 1203, 1208, 1210, 1213,
- /* 110 */ 1240, 1246, 1250, 1302, 1309, 1311, 1314, 1316, 1327, 1331,
- /* 120 */ 1345, 1356, 1361, 1397, 1401, 1405, 1407, 1423, 1459, 1461,
- /* 130 */ 1472, 1476, 1511, 1523, 1550, 1560, 1564, 1566, 1569, 1575,
- /* 140 */ 1582, 1585, -246, -246, -246, -246, -246, -246, -246, -246,
- /* 150 */ -246, -246, -246, -132, 441, 733, -226, -63, 40, 93,
- /* 160 */ 264, 503, -246, 540, 898, 917, 1077, 165, -246, -246,
- /* 170 */ -246, -246, -209, -209, -209, 108, 312, 384, 436, 507,
- /* 180 */ -140, 642, -197, -190, 643, 643, 504, 10, 270, 664,
- /* 190 */ -117, 845, 920, 959, -45, 490, 538, 702, 757, 821,
- /* 200 */ 958, 972, -192, 323, 1030, 769, -141, 767, 709, 86,
- /* 210 */ 831, 855, 1005, 1015, 878, 1012, 20, 968, 329, 1040,
- /* 220 */ 1041, 1042, 1150, 1177, -182, 22, 107, 242, 282, 334,
- /* 230 */ 366, 582, 585, 610, 649, 731, 830, 839, 842, 871,
- /* 240 */ 952, 1033, 1090, 1108, 1143, 566, 1163, 1183, 1199, 1235,
- /* 250 */ 1238, 1245, 1260, 1287, 1293, 1299, 1352, 1362, 1296, 1333,
- /* 260 */ 1353, 1390, 1395, 1409, 1360, 1418, 1422, 1427, 1330, 1315,
- /* 270 */ 1445, 1410, 1457, 366, 1467, 1471, 1474, 1481, 1493, 1497,
- /* 280 */ 1406, 1346, 1458, 1450, 1455, 1462, 1486, 1360, 1458, 1458,
- /* 290 */ 1489, 1500, 1578, 1453, 1483, 1504, 1528, 1516, 1485, 1551,
- /* 300 */ 1521, 1524, 1554, 1532, 1562, 1515, 1588, 1581, 1586, 1594,
- /* 310 */ 1595, 1598, 1552, 1559, 1561, 1567, 1571, 1573, 1543, 1583,
- /* 320 */ 1587, 1630, 1533, 1535, 1639, 1640, 1539, 1548, 1642, 1563,
- /* 330 */ 1576, 1579, 1596, 1606, 1622, 1607, 1611, 1624, 1625, 1628,
- /* 340 */ 1629, 1667, 1671, 1626, 1600, 1601, 1631, 1604, 1644, 1635,
- /* 350 */ 1645, 1636, 1676, 1684, 1589, 1599, 1685, 1691, 1672, 1692,
- /* 360 */ 1697, 1694, 1699, 1678, 1682, 1683, 1687, 1679, 1686, 1688,
- /* 370 */ 1701, 1690, 1706, 1702, 1689, 1703, 1707, 1613, 1623, 1647,
- /* 380 */ 1653, 1718, 1740, 1641, 1643, 1677, 1680, 1708, 1712, 1669,
- /* 390 */ 1745, 1675, 1709, 1715, 1717, 1719, 1765, 1775, 1783, 1789,
- /* 400 */ 1790, 1791, 1713, 1714, 1693, 1786, 1776, 1777, 1779, 1788,
- /* 410 */ 1795, 1773, 1774, 1784, 1797, 1796, 1798,
+ /* 0 */ -176, -122, 1208, 268, 274, -159, 389, -192, 317, -190,
+ /* 10 */ -133, 392, 395, 101, 460, 513, 529, 638, 895, 135,
+ /* 20 */ 141, -237, -113, 53, 539, 541, 608, 610, 338, 663,
+ /* 30 */ 665, 522, 644, 669, 865, -194, 940, 945, 486, 734,
+ /* 40 */ -18, 165, -114, 525, 773, 847, 923, -234, -10, -234,
+ /* 50 */ -10, -245, -245, -245, -245, -245, -245, -245, -245, -245,
+ /* 60 */ -245, -245, -245, -245, -245, -245, -245, -245, -245, -245,
+ /* 70 */ -245, -245, -245, -245, -245, -245, -245, -245, -245, -245,
+ /* 80 */ -245, -245, -245, -245, -245, -245, -245, -245, -245, 491,
+ /* 90 */ 561, 709, 809, 822, 927, 949, 952, 1036, 1053, 1055,
+ /* 100 */ 1073, 1075, 1080, 1100, 1122, 1129, 1157, 1159, 1184, 1197,
+ /* 110 */ 1201, 1204, 1206, 1241, 1251, 1261, 1292, 1303, 1308, 1310,
+ /* 120 */ 1312, 1317, 1321, 1323, 1328, 1337, 1357, 1362, 1402, 1406,
+ /* 130 */ 1408, 1419, 1423, 1454, 1460, 1462, 1473, 1500, 1512, 1547,
+ /* 140 */ 1560, 1569, -245, -245, -245, -245, -245, -245, -245, -245,
+ /* 150 */ -245, -245, -245, -131, 168, 195, -225, -62, 526, 427,
+ /* 160 */ 818, 151, -245, 546, 65, 899, 937, 780, -245, -245,
+ /* 170 */ -245, -245, -208, -208, -208, 54, 39, 810, 894, 953,
+ /* 180 */ -139, 936, -196, -189, 912, 912, 1082, 243, 516, 635,
+ /* 190 */ -116, 56, 1040, 1109, 690, 271, 1056, 512, 758, 1144,
+ /* 200 */ 960, 1155, -191, 360, 1093, 966, 548, 1113, 281, 595,
+ /* 210 */ 1114, 1121, 1178, 1185, 1012, 1076, 23, 1041, 260, 585,
+ /* 220 */ 769, 1175, 1222, 1211, -181, -45, 72, 107, 94, 214,
+ /* 230 */ 221, 336, 363, 523, 609, 650, 664, 700, 893, 999,
+ /* 240 */ 1088, 1283, 1339, 1356, 1366, 1081, 1377, 1394, 1398, 1427,
+ /* 250 */ 1428, 1448, 1458, 1468, 1472, 1475, 1476, 1482, 1456, 1461,
+ /* 260 */ 1465, 1508, 1514, 1522, 1459, 1526, 1540, 1551, 1353, 1431,
+ /* 270 */ 1567, 1531, 1576, 221, 1577, 1580, 1581, 1585, 1586, 1587,
+ /* 280 */ 1479, 1493, 1541, 1528, 1532, 1533, 1534, 1459, 1541, 1541,
+ /* 290 */ 1544, 1578, 1591, 1495, 1519, 1529, 1549, 1530, 1505, 1554,
+ /* 300 */ 1536, 1538, 1555, 1542, 1557, 1509, 1589, 1582, 1588, 1599,
+ /* 310 */ 1601, 1602, 1545, 1552, 1562, 1563, 1566, 1579, 1546, 1584,
+ /* 320 */ 1592, 1629, 1543, 1548, 1632, 1638, 1550, 1553, 1640, 1559,
+ /* 330 */ 1574, 1583, 1606, 1603, 1623, 1608, 1611, 1625, 1626, 1630,
+ /* 340 */ 1631, 1666, 1672, 1628, 1604, 1607, 1635, 1612, 1639, 1636,
+ /* 350 */ 1641, 1644, 1676, 1679, 1594, 1597, 1686, 1693, 1675, 1694,
+ /* 360 */ 1696, 1697, 1700, 1680, 1682, 1684, 1685, 1683, 1687, 1689,
+ /* 370 */ 1688, 1690, 1701, 1702, 1699, 1704, 1705, 1614, 1624, 1648,
+ /* 380 */ 1654, 1719, 1741, 1642, 1643, 1678, 1698, 1706, 1708, 1668,
+ /* 390 */ 1747, 1669, 1709, 1712, 1718, 1721, 1766, 1776, 1784, 1790,
+ /* 400 */ 1801, 1802, 1710, 1713, 1715, 1777, 1770, 1778, 1782, 1783,
+ /* 410 */ 1793, 1768, 1775, 1785, 1788, 1797, 1796,
};
static const YYACTIONTYPE yy_default[] = {
/* 0 */ 1667, 1667, 1667, 1495, 1258, 1371, 1258, 1258, 1258, 1258,
@@ -178477,7 +178380,6 @@ static const YYCODETYPE yyFallback[] = {
0, /* ERROR => nothing */
0, /* QNUMBER => nothing */
0, /* SPACE => nothing */
- 0, /* COMMENT => nothing */
0, /* ILLEGAL => nothing */
};
#endif /* YYFALLBACK */
@@ -178748,144 +178650,143 @@ static const char *const yyTokenName[] = {
/* 183 */ "ERROR",
/* 184 */ "QNUMBER",
/* 185 */ "SPACE",
- /* 186 */ "COMMENT",
- /* 187 */ "ILLEGAL",
- /* 188 */ "input",
- /* 189 */ "cmdlist",
- /* 190 */ "ecmd",
- /* 191 */ "cmdx",
- /* 192 */ "explain",
- /* 193 */ "cmd",
- /* 194 */ "transtype",
- /* 195 */ "trans_opt",
- /* 196 */ "nm",
- /* 197 */ "savepoint_opt",
- /* 198 */ "create_table",
- /* 199 */ "create_table_args",
- /* 200 */ "createkw",
- /* 201 */ "temp",
- /* 202 */ "ifnotexists",
- /* 203 */ "dbnm",
- /* 204 */ "columnlist",
- /* 205 */ "conslist_opt",
- /* 206 */ "table_option_set",
- /* 207 */ "select",
- /* 208 */ "table_option",
- /* 209 */ "columnname",
- /* 210 */ "carglist",
- /* 211 */ "typetoken",
- /* 212 */ "typename",
- /* 213 */ "signed",
- /* 214 */ "plus_num",
- /* 215 */ "minus_num",
- /* 216 */ "scanpt",
- /* 217 */ "scantok",
- /* 218 */ "ccons",
- /* 219 */ "term",
- /* 220 */ "expr",
- /* 221 */ "onconf",
- /* 222 */ "sortorder",
- /* 223 */ "autoinc",
- /* 224 */ "eidlist_opt",
- /* 225 */ "refargs",
- /* 226 */ "defer_subclause",
- /* 227 */ "generated",
- /* 228 */ "refarg",
- /* 229 */ "refact",
- /* 230 */ "init_deferred_pred_opt",
- /* 231 */ "conslist",
- /* 232 */ "tconscomma",
- /* 233 */ "tcons",
- /* 234 */ "sortlist",
- /* 235 */ "eidlist",
- /* 236 */ "defer_subclause_opt",
- /* 237 */ "orconf",
- /* 238 */ "resolvetype",
- /* 239 */ "raisetype",
- /* 240 */ "ifexists",
- /* 241 */ "fullname",
- /* 242 */ "selectnowith",
- /* 243 */ "oneselect",
- /* 244 */ "wqlist",
- /* 245 */ "multiselect_op",
- /* 246 */ "distinct",
- /* 247 */ "selcollist",
- /* 248 */ "from",
- /* 249 */ "where_opt",
- /* 250 */ "groupby_opt",
- /* 251 */ "having_opt",
- /* 252 */ "orderby_opt",
- /* 253 */ "limit_opt",
- /* 254 */ "window_clause",
- /* 255 */ "values",
- /* 256 */ "nexprlist",
- /* 257 */ "mvalues",
- /* 258 */ "sclp",
- /* 259 */ "as",
- /* 260 */ "seltablist",
- /* 261 */ "stl_prefix",
- /* 262 */ "joinop",
- /* 263 */ "on_using",
- /* 264 */ "indexed_by",
- /* 265 */ "exprlist",
- /* 266 */ "xfullname",
- /* 267 */ "idlist",
- /* 268 */ "indexed_opt",
- /* 269 */ "nulls",
- /* 270 */ "with",
- /* 271 */ "where_opt_ret",
- /* 272 */ "setlist",
- /* 273 */ "insert_cmd",
- /* 274 */ "idlist_opt",
- /* 275 */ "upsert",
- /* 276 */ "returning",
- /* 277 */ "filter_over",
- /* 278 */ "likeop",
- /* 279 */ "between_op",
- /* 280 */ "in_op",
- /* 281 */ "paren_exprlist",
- /* 282 */ "case_operand",
- /* 283 */ "case_exprlist",
- /* 284 */ "case_else",
- /* 285 */ "uniqueflag",
- /* 286 */ "collate",
- /* 287 */ "vinto",
- /* 288 */ "nmnum",
- /* 289 */ "trigger_decl",
- /* 290 */ "trigger_cmd_list",
- /* 291 */ "trigger_time",
- /* 292 */ "trigger_event",
- /* 293 */ "foreach_clause",
- /* 294 */ "when_clause",
- /* 295 */ "trigger_cmd",
- /* 296 */ "trnm",
- /* 297 */ "tridxby",
- /* 298 */ "database_kw_opt",
- /* 299 */ "key_opt",
- /* 300 */ "add_column_fullname",
- /* 301 */ "kwcolumn_opt",
- /* 302 */ "create_vtab",
- /* 303 */ "vtabarglist",
- /* 304 */ "vtabarg",
- /* 305 */ "vtabargtoken",
- /* 306 */ "lp",
- /* 307 */ "anylist",
- /* 308 */ "wqitem",
- /* 309 */ "wqas",
- /* 310 */ "withnm",
- /* 311 */ "windowdefn_list",
- /* 312 */ "windowdefn",
- /* 313 */ "window",
- /* 314 */ "frame_opt",
- /* 315 */ "part_opt",
- /* 316 */ "filter_clause",
- /* 317 */ "over_clause",
- /* 318 */ "range_or_rows",
- /* 319 */ "frame_bound",
- /* 320 */ "frame_bound_s",
- /* 321 */ "frame_bound_e",
- /* 322 */ "frame_exclude_opt",
- /* 323 */ "frame_exclude",
+ /* 186 */ "ILLEGAL",
+ /* 187 */ "input",
+ /* 188 */ "cmdlist",
+ /* 189 */ "ecmd",
+ /* 190 */ "cmdx",
+ /* 191 */ "explain",
+ /* 192 */ "cmd",
+ /* 193 */ "transtype",
+ /* 194 */ "trans_opt",
+ /* 195 */ "nm",
+ /* 196 */ "savepoint_opt",
+ /* 197 */ "create_table",
+ /* 198 */ "create_table_args",
+ /* 199 */ "createkw",
+ /* 200 */ "temp",
+ /* 201 */ "ifnotexists",
+ /* 202 */ "dbnm",
+ /* 203 */ "columnlist",
+ /* 204 */ "conslist_opt",
+ /* 205 */ "table_option_set",
+ /* 206 */ "select",
+ /* 207 */ "table_option",
+ /* 208 */ "columnname",
+ /* 209 */ "carglist",
+ /* 210 */ "typetoken",
+ /* 211 */ "typename",
+ /* 212 */ "signed",
+ /* 213 */ "plus_num",
+ /* 214 */ "minus_num",
+ /* 215 */ "scanpt",
+ /* 216 */ "scantok",
+ /* 217 */ "ccons",
+ /* 218 */ "term",
+ /* 219 */ "expr",
+ /* 220 */ "onconf",
+ /* 221 */ "sortorder",
+ /* 222 */ "autoinc",
+ /* 223 */ "eidlist_opt",
+ /* 224 */ "refargs",
+ /* 225 */ "defer_subclause",
+ /* 226 */ "generated",
+ /* 227 */ "refarg",
+ /* 228 */ "refact",
+ /* 229 */ "init_deferred_pred_opt",
+ /* 230 */ "conslist",
+ /* 231 */ "tconscomma",
+ /* 232 */ "tcons",
+ /* 233 */ "sortlist",
+ /* 234 */ "eidlist",
+ /* 235 */ "defer_subclause_opt",
+ /* 236 */ "orconf",
+ /* 237 */ "resolvetype",
+ /* 238 */ "raisetype",
+ /* 239 */ "ifexists",
+ /* 240 */ "fullname",
+ /* 241 */ "selectnowith",
+ /* 242 */ "oneselect",
+ /* 243 */ "wqlist",
+ /* 244 */ "multiselect_op",
+ /* 245 */ "distinct",
+ /* 246 */ "selcollist",
+ /* 247 */ "from",
+ /* 248 */ "where_opt",
+ /* 249 */ "groupby_opt",
+ /* 250 */ "having_opt",
+ /* 251 */ "orderby_opt",
+ /* 252 */ "limit_opt",
+ /* 253 */ "window_clause",
+ /* 254 */ "values",
+ /* 255 */ "nexprlist",
+ /* 256 */ "mvalues",
+ /* 257 */ "sclp",
+ /* 258 */ "as",
+ /* 259 */ "seltablist",
+ /* 260 */ "stl_prefix",
+ /* 261 */ "joinop",
+ /* 262 */ "on_using",
+ /* 263 */ "indexed_by",
+ /* 264 */ "exprlist",
+ /* 265 */ "xfullname",
+ /* 266 */ "idlist",
+ /* 267 */ "indexed_opt",
+ /* 268 */ "nulls",
+ /* 269 */ "with",
+ /* 270 */ "where_opt_ret",
+ /* 271 */ "setlist",
+ /* 272 */ "insert_cmd",
+ /* 273 */ "idlist_opt",
+ /* 274 */ "upsert",
+ /* 275 */ "returning",
+ /* 276 */ "filter_over",
+ /* 277 */ "likeop",
+ /* 278 */ "between_op",
+ /* 279 */ "in_op",
+ /* 280 */ "paren_exprlist",
+ /* 281 */ "case_operand",
+ /* 282 */ "case_exprlist",
+ /* 283 */ "case_else",
+ /* 284 */ "uniqueflag",
+ /* 285 */ "collate",
+ /* 286 */ "vinto",
+ /* 287 */ "nmnum",
+ /* 288 */ "trigger_decl",
+ /* 289 */ "trigger_cmd_list",
+ /* 290 */ "trigger_time",
+ /* 291 */ "trigger_event",
+ /* 292 */ "foreach_clause",
+ /* 293 */ "when_clause",
+ /* 294 */ "trigger_cmd",
+ /* 295 */ "trnm",
+ /* 296 */ "tridxby",
+ /* 297 */ "database_kw_opt",
+ /* 298 */ "key_opt",
+ /* 299 */ "add_column_fullname",
+ /* 300 */ "kwcolumn_opt",
+ /* 301 */ "create_vtab",
+ /* 302 */ "vtabarglist",
+ /* 303 */ "vtabarg",
+ /* 304 */ "vtabargtoken",
+ /* 305 */ "lp",
+ /* 306 */ "anylist",
+ /* 307 */ "wqitem",
+ /* 308 */ "wqas",
+ /* 309 */ "withnm",
+ /* 310 */ "windowdefn_list",
+ /* 311 */ "windowdefn",
+ /* 312 */ "window",
+ /* 313 */ "frame_opt",
+ /* 314 */ "part_opt",
+ /* 315 */ "filter_clause",
+ /* 316 */ "over_clause",
+ /* 317 */ "range_or_rows",
+ /* 318 */ "frame_bound",
+ /* 319 */ "frame_bound_s",
+ /* 320 */ "frame_bound_e",
+ /* 321 */ "frame_exclude_opt",
+ /* 322 */ "frame_exclude",
};
#endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */
@@ -179425,98 +179326,98 @@ static void yy_destructor(
** inside the C code.
*/
/********* Begin destructor definitions ***************************************/
- case 207: /* select */
- case 242: /* selectnowith */
- case 243: /* oneselect */
- case 255: /* values */
- case 257: /* mvalues */
+ case 206: /* select */
+ case 241: /* selectnowith */
+ case 242: /* oneselect */
+ case 254: /* values */
+ case 256: /* mvalues */
{
-sqlite3SelectDelete(pParse->db, (yypminor->yy99));
+sqlite3SelectDelete(pParse->db, (yypminor->yy637));
}
break;
- case 219: /* term */
- case 220: /* expr */
- case 249: /* where_opt */
- case 251: /* having_opt */
- case 271: /* where_opt_ret */
- case 282: /* case_operand */
- case 284: /* case_else */
- case 287: /* vinto */
- case 294: /* when_clause */
- case 299: /* key_opt */
- case 316: /* filter_clause */
+ case 218: /* term */
+ case 219: /* expr */
+ case 248: /* where_opt */
+ case 250: /* having_opt */
+ case 270: /* where_opt_ret */
+ case 281: /* case_operand */
+ case 283: /* case_else */
+ case 286: /* vinto */
+ case 293: /* when_clause */
+ case 298: /* key_opt */
+ case 315: /* filter_clause */
{
-sqlite3ExprDelete(pParse->db, (yypminor->yy530));
+sqlite3ExprDelete(pParse->db, (yypminor->yy590));
}
break;
- case 224: /* eidlist_opt */
- case 234: /* sortlist */
- case 235: /* eidlist */
- case 247: /* selcollist */
- case 250: /* groupby_opt */
- case 252: /* orderby_opt */
- case 256: /* nexprlist */
- case 258: /* sclp */
- case 265: /* exprlist */
- case 272: /* setlist */
- case 281: /* paren_exprlist */
- case 283: /* case_exprlist */
- case 315: /* part_opt */
+ case 223: /* eidlist_opt */
+ case 233: /* sortlist */
+ case 234: /* eidlist */
+ case 246: /* selcollist */
+ case 249: /* groupby_opt */
+ case 251: /* orderby_opt */
+ case 255: /* nexprlist */
+ case 257: /* sclp */
+ case 264: /* exprlist */
+ case 271: /* setlist */
+ case 280: /* paren_exprlist */
+ case 282: /* case_exprlist */
+ case 314: /* part_opt */
{
-sqlite3ExprListDelete(pParse->db, (yypminor->yy250));
+sqlite3ExprListDelete(pParse->db, (yypminor->yy402));
}
break;
- case 241: /* fullname */
- case 248: /* from */
- case 260: /* seltablist */
- case 261: /* stl_prefix */
- case 266: /* xfullname */
+ case 240: /* fullname */
+ case 247: /* from */
+ case 259: /* seltablist */
+ case 260: /* stl_prefix */
+ case 265: /* xfullname */
{
-sqlite3SrcListDelete(pParse->db, (yypminor->yy43));
+sqlite3SrcListDelete(pParse->db, (yypminor->yy563));
}
break;
- case 244: /* wqlist */
+ case 243: /* wqlist */
{
-sqlite3WithDelete(pParse->db, (yypminor->yy91));
+sqlite3WithDelete(pParse->db, (yypminor->yy125));
}
break;
- case 254: /* window_clause */
- case 311: /* windowdefn_list */
+ case 253: /* window_clause */
+ case 310: /* windowdefn_list */
{
-sqlite3WindowListDelete(pParse->db, (yypminor->yy459));
+sqlite3WindowListDelete(pParse->db, (yypminor->yy483));
}
break;
- case 267: /* idlist */
- case 274: /* idlist_opt */
+ case 266: /* idlist */
+ case 273: /* idlist_opt */
{
-sqlite3IdListDelete(pParse->db, (yypminor->yy96));
+sqlite3IdListDelete(pParse->db, (yypminor->yy204));
}
break;
- case 277: /* filter_over */
- case 312: /* windowdefn */
- case 313: /* window */
- case 314: /* frame_opt */
- case 317: /* over_clause */
+ case 276: /* filter_over */
+ case 311: /* windowdefn */
+ case 312: /* window */
+ case 313: /* frame_opt */
+ case 316: /* over_clause */
{
-sqlite3WindowDelete(pParse->db, (yypminor->yy459));
+sqlite3WindowDelete(pParse->db, (yypminor->yy483));
}
break;
- case 290: /* trigger_cmd_list */
- case 295: /* trigger_cmd */
+ case 289: /* trigger_cmd_list */
+ case 294: /* trigger_cmd */
{
-sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy203));
+sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy319));
}
break;
- case 292: /* trigger_event */
+ case 291: /* trigger_event */
{
-sqlite3IdListDelete(pParse->db, (yypminor->yy234).b);
+sqlite3IdListDelete(pParse->db, (yypminor->yy28).b);
}
break;
- case 319: /* frame_bound */
- case 320: /* frame_bound_s */
- case 321: /* frame_bound_e */
+ case 318: /* frame_bound */
+ case 319: /* frame_bound_s */
+ case 320: /* frame_bound_e */
{
-sqlite3ExprDelete(pParse->db, (yypminor->yy225).pExpr);
+sqlite3ExprDelete(pParse->db, (yypminor->yy205).pExpr);
}
break;
/********* End destructor definitions *****************************************/
@@ -179818,415 +179719,415 @@ static void yy_shift(
/* For rule J, yyRuleInfoLhs[J] contains the symbol on the left-hand side
** of that rule */
static const YYCODETYPE yyRuleInfoLhs[] = {
- 192, /* (0) explain ::= EXPLAIN */
- 192, /* (1) explain ::= EXPLAIN QUERY PLAN */
- 191, /* (2) cmdx ::= cmd */
- 193, /* (3) cmd ::= BEGIN transtype trans_opt */
- 194, /* (4) transtype ::= */
- 194, /* (5) transtype ::= DEFERRED */
- 194, /* (6) transtype ::= IMMEDIATE */
- 194, /* (7) transtype ::= ID */
- 193, /* (8) cmd ::= COMMIT|END trans_opt */
- 193, /* (9) cmd ::= ROLLBACK trans_opt */
- 193, /* (10) cmd ::= SAVEPOINT nm */
- 193, /* (11) cmd ::= RELEASE savepoint_opt nm */
- 193, /* (12) cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */
- 198, /* (13) create_table ::= createkw temp TABLE ifnotexists nm dbnm */
- 200, /* (14) createkw ::= CREATE */
- 202, /* (15) ifnotexists ::= */
- 202, /* (16) ifnotexists ::= IF NOT EXISTS */
- 201, /* (17) temp ::= TEMP */
- 201, /* (18) temp ::= */
- 199, /* (19) create_table_args ::= LP columnlist conslist_opt RP table_option_set */
- 199, /* (20) create_table_args ::= AS select */
- 206, /* (21) table_option_set ::= */
- 206, /* (22) table_option_set ::= table_option_set COMMA table_option */
- 208, /* (23) table_option ::= WITHOUT nm */
- 208, /* (24) table_option ::= nm */
- 209, /* (25) columnname ::= nm typetoken */
- 211, /* (26) typetoken ::= */
- 211, /* (27) typetoken ::= typename LP signed RP */
- 211, /* (28) typetoken ::= typename LP signed COMMA signed RP */
- 212, /* (29) typename ::= typename ID|STRING */
- 216, /* (30) scanpt ::= */
- 217, /* (31) scantok ::= */
- 218, /* (32) ccons ::= CONSTRAINT nm */
- 218, /* (33) ccons ::= DEFAULT scantok term */
- 218, /* (34) ccons ::= DEFAULT LP expr RP */
- 218, /* (35) ccons ::= DEFAULT PLUS scantok term */
- 218, /* (36) ccons ::= DEFAULT MINUS scantok term */
- 218, /* (37) ccons ::= DEFAULT scantok ID|INDEXED */
- 218, /* (38) ccons ::= NOT NULL onconf */
- 218, /* (39) ccons ::= PRIMARY KEY sortorder onconf autoinc */
- 218, /* (40) ccons ::= UNIQUE onconf */
- 218, /* (41) ccons ::= CHECK LP expr RP */
- 218, /* (42) ccons ::= REFERENCES nm eidlist_opt refargs */
- 218, /* (43) ccons ::= defer_subclause */
- 218, /* (44) ccons ::= COLLATE ID|STRING */
- 227, /* (45) generated ::= LP expr RP */
- 227, /* (46) generated ::= LP expr RP ID */
- 223, /* (47) autoinc ::= */
- 223, /* (48) autoinc ::= AUTOINCR */
- 225, /* (49) refargs ::= */
- 225, /* (50) refargs ::= refargs refarg */
- 228, /* (51) refarg ::= MATCH nm */
- 228, /* (52) refarg ::= ON INSERT refact */
- 228, /* (53) refarg ::= ON DELETE refact */
- 228, /* (54) refarg ::= ON UPDATE refact */
- 229, /* (55) refact ::= SET NULL */
- 229, /* (56) refact ::= SET DEFAULT */
- 229, /* (57) refact ::= CASCADE */
- 229, /* (58) refact ::= RESTRICT */
- 229, /* (59) refact ::= NO ACTION */
- 226, /* (60) defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
- 226, /* (61) defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
- 230, /* (62) init_deferred_pred_opt ::= */
- 230, /* (63) init_deferred_pred_opt ::= INITIALLY DEFERRED */
- 230, /* (64) init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
- 205, /* (65) conslist_opt ::= */
- 232, /* (66) tconscomma ::= COMMA */
- 233, /* (67) tcons ::= CONSTRAINT nm */
- 233, /* (68) tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
- 233, /* (69) tcons ::= UNIQUE LP sortlist RP onconf */
- 233, /* (70) tcons ::= CHECK LP expr RP onconf */
- 233, /* (71) tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
- 236, /* (72) defer_subclause_opt ::= */
- 221, /* (73) onconf ::= */
- 221, /* (74) onconf ::= ON CONFLICT resolvetype */
- 237, /* (75) orconf ::= */
- 237, /* (76) orconf ::= OR resolvetype */
- 238, /* (77) resolvetype ::= IGNORE */
- 238, /* (78) resolvetype ::= REPLACE */
- 193, /* (79) cmd ::= DROP TABLE ifexists fullname */
- 240, /* (80) ifexists ::= IF EXISTS */
- 240, /* (81) ifexists ::= */
- 193, /* (82) cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
- 193, /* (83) cmd ::= DROP VIEW ifexists fullname */
- 193, /* (84) cmd ::= select */
- 207, /* (85) select ::= WITH wqlist selectnowith */
- 207, /* (86) select ::= WITH RECURSIVE wqlist selectnowith */
- 207, /* (87) select ::= selectnowith */
- 242, /* (88) selectnowith ::= selectnowith multiselect_op oneselect */
- 245, /* (89) multiselect_op ::= UNION */
- 245, /* (90) multiselect_op ::= UNION ALL */
- 245, /* (91) multiselect_op ::= EXCEPT|INTERSECT */
- 243, /* (92) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
- 243, /* (93) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */
- 255, /* (94) values ::= VALUES LP nexprlist RP */
- 243, /* (95) oneselect ::= mvalues */
- 257, /* (96) mvalues ::= values COMMA LP nexprlist RP */
- 257, /* (97) mvalues ::= mvalues COMMA LP nexprlist RP */
- 246, /* (98) distinct ::= DISTINCT */
- 246, /* (99) distinct ::= ALL */
- 246, /* (100) distinct ::= */
- 258, /* (101) sclp ::= */
- 247, /* (102) selcollist ::= sclp scanpt expr scanpt as */
- 247, /* (103) selcollist ::= sclp scanpt STAR */
- 247, /* (104) selcollist ::= sclp scanpt nm DOT STAR */
- 259, /* (105) as ::= AS nm */
- 259, /* (106) as ::= */
- 248, /* (107) from ::= */
- 248, /* (108) from ::= FROM seltablist */
- 261, /* (109) stl_prefix ::= seltablist joinop */
- 261, /* (110) stl_prefix ::= */
- 260, /* (111) seltablist ::= stl_prefix nm dbnm as on_using */
- 260, /* (112) seltablist ::= stl_prefix nm dbnm as indexed_by on_using */
- 260, /* (113) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_using */
- 260, /* (114) seltablist ::= stl_prefix LP select RP as on_using */
- 260, /* (115) seltablist ::= stl_prefix LP seltablist RP as on_using */
- 203, /* (116) dbnm ::= */
- 203, /* (117) dbnm ::= DOT nm */
- 241, /* (118) fullname ::= nm */
- 241, /* (119) fullname ::= nm DOT nm */
- 266, /* (120) xfullname ::= nm */
- 266, /* (121) xfullname ::= nm DOT nm */
- 266, /* (122) xfullname ::= nm DOT nm AS nm */
- 266, /* (123) xfullname ::= nm AS nm */
- 262, /* (124) joinop ::= COMMA|JOIN */
- 262, /* (125) joinop ::= JOIN_KW JOIN */
- 262, /* (126) joinop ::= JOIN_KW nm JOIN */
- 262, /* (127) joinop ::= JOIN_KW nm nm JOIN */
- 263, /* (128) on_using ::= ON expr */
- 263, /* (129) on_using ::= USING LP idlist RP */
- 263, /* (130) on_using ::= */
- 268, /* (131) indexed_opt ::= */
- 264, /* (132) indexed_by ::= INDEXED BY nm */
- 264, /* (133) indexed_by ::= NOT INDEXED */
- 252, /* (134) orderby_opt ::= */
- 252, /* (135) orderby_opt ::= ORDER BY sortlist */
- 234, /* (136) sortlist ::= sortlist COMMA expr sortorder nulls */
- 234, /* (137) sortlist ::= expr sortorder nulls */
- 222, /* (138) sortorder ::= ASC */
- 222, /* (139) sortorder ::= DESC */
- 222, /* (140) sortorder ::= */
- 269, /* (141) nulls ::= NULLS FIRST */
- 269, /* (142) nulls ::= NULLS LAST */
- 269, /* (143) nulls ::= */
- 250, /* (144) groupby_opt ::= */
- 250, /* (145) groupby_opt ::= GROUP BY nexprlist */
- 251, /* (146) having_opt ::= */
- 251, /* (147) having_opt ::= HAVING expr */
- 253, /* (148) limit_opt ::= */
- 253, /* (149) limit_opt ::= LIMIT expr */
- 253, /* (150) limit_opt ::= LIMIT expr OFFSET expr */
- 253, /* (151) limit_opt ::= LIMIT expr COMMA expr */
- 193, /* (152) cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret orderby_opt limit_opt */
- 249, /* (153) where_opt ::= */
- 249, /* (154) where_opt ::= WHERE expr */
- 271, /* (155) where_opt_ret ::= */
- 271, /* (156) where_opt_ret ::= WHERE expr */
- 271, /* (157) where_opt_ret ::= RETURNING selcollist */
- 271, /* (158) where_opt_ret ::= WHERE expr RETURNING selcollist */
- 193, /* (159) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret orderby_opt limit_opt */
- 272, /* (160) setlist ::= setlist COMMA nm EQ expr */
- 272, /* (161) setlist ::= setlist COMMA LP idlist RP EQ expr */
- 272, /* (162) setlist ::= nm EQ expr */
- 272, /* (163) setlist ::= LP idlist RP EQ expr */
- 193, /* (164) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
- 193, /* (165) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */
- 275, /* (166) upsert ::= */
- 275, /* (167) upsert ::= RETURNING selcollist */
- 275, /* (168) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */
- 275, /* (169) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */
- 275, /* (170) upsert ::= ON CONFLICT DO NOTHING returning */
- 275, /* (171) upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */
- 276, /* (172) returning ::= RETURNING selcollist */
- 273, /* (173) insert_cmd ::= INSERT orconf */
- 273, /* (174) insert_cmd ::= REPLACE */
- 274, /* (175) idlist_opt ::= */
- 274, /* (176) idlist_opt ::= LP idlist RP */
- 267, /* (177) idlist ::= idlist COMMA nm */
- 267, /* (178) idlist ::= nm */
- 220, /* (179) expr ::= LP expr RP */
- 220, /* (180) expr ::= ID|INDEXED|JOIN_KW */
- 220, /* (181) expr ::= nm DOT nm */
- 220, /* (182) expr ::= nm DOT nm DOT nm */
- 219, /* (183) term ::= NULL|FLOAT|BLOB */
- 219, /* (184) term ::= STRING */
- 219, /* (185) term ::= INTEGER */
- 220, /* (186) expr ::= VARIABLE */
- 220, /* (187) expr ::= expr COLLATE ID|STRING */
- 220, /* (188) expr ::= CAST LP expr AS typetoken RP */
- 220, /* (189) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */
- 220, /* (190) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP */
- 220, /* (191) expr ::= ID|INDEXED|JOIN_KW LP STAR RP */
- 220, /* (192) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */
- 220, /* (193) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP filter_over */
- 220, /* (194) expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */
- 219, /* (195) term ::= CTIME_KW */
- 220, /* (196) expr ::= LP nexprlist COMMA expr RP */
- 220, /* (197) expr ::= expr AND expr */
- 220, /* (198) expr ::= expr OR expr */
- 220, /* (199) expr ::= expr LT|GT|GE|LE expr */
- 220, /* (200) expr ::= expr EQ|NE expr */
- 220, /* (201) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
- 220, /* (202) expr ::= expr PLUS|MINUS expr */
- 220, /* (203) expr ::= expr STAR|SLASH|REM expr */
- 220, /* (204) expr ::= expr CONCAT expr */
- 278, /* (205) likeop ::= NOT LIKE_KW|MATCH */
- 220, /* (206) expr ::= expr likeop expr */
- 220, /* (207) expr ::= expr likeop expr ESCAPE expr */
- 220, /* (208) expr ::= expr ISNULL|NOTNULL */
- 220, /* (209) expr ::= expr NOT NULL */
- 220, /* (210) expr ::= expr IS expr */
- 220, /* (211) expr ::= expr IS NOT expr */
- 220, /* (212) expr ::= expr IS NOT DISTINCT FROM expr */
- 220, /* (213) expr ::= expr IS DISTINCT FROM expr */
- 220, /* (214) expr ::= NOT expr */
- 220, /* (215) expr ::= BITNOT expr */
- 220, /* (216) expr ::= PLUS|MINUS expr */
- 220, /* (217) expr ::= expr PTR expr */
- 279, /* (218) between_op ::= BETWEEN */
- 279, /* (219) between_op ::= NOT BETWEEN */
- 220, /* (220) expr ::= expr between_op expr AND expr */
- 280, /* (221) in_op ::= IN */
- 280, /* (222) in_op ::= NOT IN */
- 220, /* (223) expr ::= expr in_op LP exprlist RP */
- 220, /* (224) expr ::= LP select RP */
- 220, /* (225) expr ::= expr in_op LP select RP */
- 220, /* (226) expr ::= expr in_op nm dbnm paren_exprlist */
- 220, /* (227) expr ::= EXISTS LP select RP */
- 220, /* (228) expr ::= CASE case_operand case_exprlist case_else END */
- 283, /* (229) case_exprlist ::= case_exprlist WHEN expr THEN expr */
- 283, /* (230) case_exprlist ::= WHEN expr THEN expr */
- 284, /* (231) case_else ::= ELSE expr */
- 284, /* (232) case_else ::= */
- 282, /* (233) case_operand ::= */
- 265, /* (234) exprlist ::= */
- 256, /* (235) nexprlist ::= nexprlist COMMA expr */
- 256, /* (236) nexprlist ::= expr */
- 281, /* (237) paren_exprlist ::= */
- 281, /* (238) paren_exprlist ::= LP exprlist RP */
- 193, /* (239) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
- 285, /* (240) uniqueflag ::= UNIQUE */
- 285, /* (241) uniqueflag ::= */
- 224, /* (242) eidlist_opt ::= */
- 224, /* (243) eidlist_opt ::= LP eidlist RP */
- 235, /* (244) eidlist ::= eidlist COMMA nm collate sortorder */
- 235, /* (245) eidlist ::= nm collate sortorder */
- 286, /* (246) collate ::= */
- 286, /* (247) collate ::= COLLATE ID|STRING */
- 193, /* (248) cmd ::= DROP INDEX ifexists fullname */
- 193, /* (249) cmd ::= VACUUM vinto */
- 193, /* (250) cmd ::= VACUUM nm vinto */
- 287, /* (251) vinto ::= INTO expr */
- 287, /* (252) vinto ::= */
- 193, /* (253) cmd ::= PRAGMA nm dbnm */
- 193, /* (254) cmd ::= PRAGMA nm dbnm EQ nmnum */
- 193, /* (255) cmd ::= PRAGMA nm dbnm LP nmnum RP */
- 193, /* (256) cmd ::= PRAGMA nm dbnm EQ minus_num */
- 193, /* (257) cmd ::= PRAGMA nm dbnm LP minus_num RP */
- 214, /* (258) plus_num ::= PLUS INTEGER|FLOAT */
- 215, /* (259) minus_num ::= MINUS INTEGER|FLOAT */
- 193, /* (260) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
- 289, /* (261) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
- 291, /* (262) trigger_time ::= BEFORE|AFTER */
- 291, /* (263) trigger_time ::= INSTEAD OF */
- 291, /* (264) trigger_time ::= */
- 292, /* (265) trigger_event ::= DELETE|INSERT */
- 292, /* (266) trigger_event ::= UPDATE */
- 292, /* (267) trigger_event ::= UPDATE OF idlist */
- 294, /* (268) when_clause ::= */
- 294, /* (269) when_clause ::= WHEN expr */
- 290, /* (270) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
- 290, /* (271) trigger_cmd_list ::= trigger_cmd SEMI */
- 296, /* (272) trnm ::= nm DOT nm */
- 297, /* (273) tridxby ::= INDEXED BY nm */
- 297, /* (274) tridxby ::= NOT INDEXED */
- 295, /* (275) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
- 295, /* (276) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
- 295, /* (277) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
- 295, /* (278) trigger_cmd ::= scanpt select scanpt */
- 220, /* (279) expr ::= RAISE LP IGNORE RP */
- 220, /* (280) expr ::= RAISE LP raisetype COMMA expr RP */
- 239, /* (281) raisetype ::= ROLLBACK */
- 239, /* (282) raisetype ::= ABORT */
- 239, /* (283) raisetype ::= FAIL */
- 193, /* (284) cmd ::= DROP TRIGGER ifexists fullname */
- 193, /* (285) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
- 193, /* (286) cmd ::= DETACH database_kw_opt expr */
- 299, /* (287) key_opt ::= */
- 299, /* (288) key_opt ::= KEY expr */
- 193, /* (289) cmd ::= REINDEX */
- 193, /* (290) cmd ::= REINDEX nm dbnm */
- 193, /* (291) cmd ::= ANALYZE */
- 193, /* (292) cmd ::= ANALYZE nm dbnm */
- 193, /* (293) cmd ::= ALTER TABLE fullname RENAME TO nm */
- 193, /* (294) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
- 193, /* (295) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
- 300, /* (296) add_column_fullname ::= fullname */
- 193, /* (297) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
- 193, /* (298) cmd ::= create_vtab */
- 193, /* (299) cmd ::= create_vtab LP vtabarglist RP */
- 302, /* (300) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
- 304, /* (301) vtabarg ::= */
- 305, /* (302) vtabargtoken ::= ANY */
- 305, /* (303) vtabargtoken ::= lp anylist RP */
- 306, /* (304) lp ::= LP */
- 270, /* (305) with ::= WITH wqlist */
- 270, /* (306) with ::= WITH RECURSIVE wqlist */
- 309, /* (307) wqas ::= AS */
- 309, /* (308) wqas ::= AS MATERIALIZED */
- 309, /* (309) wqas ::= AS NOT MATERIALIZED */
- 308, /* (310) wqitem ::= withnm eidlist_opt wqas LP select RP */
- 310, /* (311) withnm ::= nm */
- 244, /* (312) wqlist ::= wqitem */
- 244, /* (313) wqlist ::= wqlist COMMA wqitem */
- 311, /* (314) windowdefn_list ::= windowdefn_list COMMA windowdefn */
- 312, /* (315) windowdefn ::= nm AS LP window RP */
- 313, /* (316) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
- 313, /* (317) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
- 313, /* (318) window ::= ORDER BY sortlist frame_opt */
- 313, /* (319) window ::= nm ORDER BY sortlist frame_opt */
- 313, /* (320) window ::= nm frame_opt */
- 314, /* (321) frame_opt ::= */
- 314, /* (322) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
- 314, /* (323) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
- 318, /* (324) range_or_rows ::= RANGE|ROWS|GROUPS */
- 320, /* (325) frame_bound_s ::= frame_bound */
- 320, /* (326) frame_bound_s ::= UNBOUNDED PRECEDING */
- 321, /* (327) frame_bound_e ::= frame_bound */
- 321, /* (328) frame_bound_e ::= UNBOUNDED FOLLOWING */
- 319, /* (329) frame_bound ::= expr PRECEDING|FOLLOWING */
- 319, /* (330) frame_bound ::= CURRENT ROW */
- 322, /* (331) frame_exclude_opt ::= */
- 322, /* (332) frame_exclude_opt ::= EXCLUDE frame_exclude */
- 323, /* (333) frame_exclude ::= NO OTHERS */
- 323, /* (334) frame_exclude ::= CURRENT ROW */
- 323, /* (335) frame_exclude ::= GROUP|TIES */
- 254, /* (336) window_clause ::= WINDOW windowdefn_list */
- 277, /* (337) filter_over ::= filter_clause over_clause */
- 277, /* (338) filter_over ::= over_clause */
- 277, /* (339) filter_over ::= filter_clause */
- 317, /* (340) over_clause ::= OVER LP window RP */
- 317, /* (341) over_clause ::= OVER nm */
- 316, /* (342) filter_clause ::= FILTER LP WHERE expr RP */
- 219, /* (343) term ::= QNUMBER */
- 188, /* (344) input ::= cmdlist */
- 189, /* (345) cmdlist ::= cmdlist ecmd */
- 189, /* (346) cmdlist ::= ecmd */
- 190, /* (347) ecmd ::= SEMI */
- 190, /* (348) ecmd ::= cmdx SEMI */
- 190, /* (349) ecmd ::= explain cmdx SEMI */
- 195, /* (350) trans_opt ::= */
- 195, /* (351) trans_opt ::= TRANSACTION */
- 195, /* (352) trans_opt ::= TRANSACTION nm */
- 197, /* (353) savepoint_opt ::= SAVEPOINT */
- 197, /* (354) savepoint_opt ::= */
- 193, /* (355) cmd ::= create_table create_table_args */
- 206, /* (356) table_option_set ::= table_option */
- 204, /* (357) columnlist ::= columnlist COMMA columnname carglist */
- 204, /* (358) columnlist ::= columnname carglist */
- 196, /* (359) nm ::= ID|INDEXED|JOIN_KW */
- 196, /* (360) nm ::= STRING */
- 211, /* (361) typetoken ::= typename */
- 212, /* (362) typename ::= ID|STRING */
- 213, /* (363) signed ::= plus_num */
- 213, /* (364) signed ::= minus_num */
- 210, /* (365) carglist ::= carglist ccons */
- 210, /* (366) carglist ::= */
- 218, /* (367) ccons ::= NULL onconf */
- 218, /* (368) ccons ::= GENERATED ALWAYS AS generated */
- 218, /* (369) ccons ::= AS generated */
- 205, /* (370) conslist_opt ::= COMMA conslist */
- 231, /* (371) conslist ::= conslist tconscomma tcons */
- 231, /* (372) conslist ::= tcons */
- 232, /* (373) tconscomma ::= */
- 236, /* (374) defer_subclause_opt ::= defer_subclause */
- 238, /* (375) resolvetype ::= raisetype */
- 242, /* (376) selectnowith ::= oneselect */
- 243, /* (377) oneselect ::= values */
- 258, /* (378) sclp ::= selcollist COMMA */
- 259, /* (379) as ::= ID|STRING */
- 268, /* (380) indexed_opt ::= indexed_by */
- 276, /* (381) returning ::= */
- 220, /* (382) expr ::= term */
- 278, /* (383) likeop ::= LIKE_KW|MATCH */
- 282, /* (384) case_operand ::= expr */
- 265, /* (385) exprlist ::= nexprlist */
- 288, /* (386) nmnum ::= plus_num */
- 288, /* (387) nmnum ::= nm */
- 288, /* (388) nmnum ::= ON */
- 288, /* (389) nmnum ::= DELETE */
- 288, /* (390) nmnum ::= DEFAULT */
- 214, /* (391) plus_num ::= INTEGER|FLOAT */
- 293, /* (392) foreach_clause ::= */
- 293, /* (393) foreach_clause ::= FOR EACH ROW */
- 296, /* (394) trnm ::= nm */
- 297, /* (395) tridxby ::= */
- 298, /* (396) database_kw_opt ::= DATABASE */
- 298, /* (397) database_kw_opt ::= */
- 301, /* (398) kwcolumn_opt ::= */
- 301, /* (399) kwcolumn_opt ::= COLUMNKW */
- 303, /* (400) vtabarglist ::= vtabarg */
- 303, /* (401) vtabarglist ::= vtabarglist COMMA vtabarg */
- 304, /* (402) vtabarg ::= vtabarg vtabargtoken */
- 307, /* (403) anylist ::= */
- 307, /* (404) anylist ::= anylist LP anylist RP */
- 307, /* (405) anylist ::= anylist ANY */
- 270, /* (406) with ::= */
- 311, /* (407) windowdefn_list ::= windowdefn */
- 313, /* (408) window ::= frame_opt */
+ 191, /* (0) explain ::= EXPLAIN */
+ 191, /* (1) explain ::= EXPLAIN QUERY PLAN */
+ 190, /* (2) cmdx ::= cmd */
+ 192, /* (3) cmd ::= BEGIN transtype trans_opt */
+ 193, /* (4) transtype ::= */
+ 193, /* (5) transtype ::= DEFERRED */
+ 193, /* (6) transtype ::= IMMEDIATE */
+ 193, /* (7) transtype ::= ID */
+ 192, /* (8) cmd ::= COMMIT|END trans_opt */
+ 192, /* (9) cmd ::= ROLLBACK trans_opt */
+ 192, /* (10) cmd ::= SAVEPOINT nm */
+ 192, /* (11) cmd ::= RELEASE savepoint_opt nm */
+ 192, /* (12) cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */
+ 197, /* (13) create_table ::= createkw temp TABLE ifnotexists nm dbnm */
+ 199, /* (14) createkw ::= CREATE */
+ 201, /* (15) ifnotexists ::= */
+ 201, /* (16) ifnotexists ::= IF NOT EXISTS */
+ 200, /* (17) temp ::= TEMP */
+ 200, /* (18) temp ::= */
+ 198, /* (19) create_table_args ::= LP columnlist conslist_opt RP table_option_set */
+ 198, /* (20) create_table_args ::= AS select */
+ 205, /* (21) table_option_set ::= */
+ 205, /* (22) table_option_set ::= table_option_set COMMA table_option */
+ 207, /* (23) table_option ::= WITHOUT nm */
+ 207, /* (24) table_option ::= nm */
+ 208, /* (25) columnname ::= nm typetoken */
+ 210, /* (26) typetoken ::= */
+ 210, /* (27) typetoken ::= typename LP signed RP */
+ 210, /* (28) typetoken ::= typename LP signed COMMA signed RP */
+ 211, /* (29) typename ::= typename ID|STRING */
+ 215, /* (30) scanpt ::= */
+ 216, /* (31) scantok ::= */
+ 217, /* (32) ccons ::= CONSTRAINT nm */
+ 217, /* (33) ccons ::= DEFAULT scantok term */
+ 217, /* (34) ccons ::= DEFAULT LP expr RP */
+ 217, /* (35) ccons ::= DEFAULT PLUS scantok term */
+ 217, /* (36) ccons ::= DEFAULT MINUS scantok term */
+ 217, /* (37) ccons ::= DEFAULT scantok ID|INDEXED */
+ 217, /* (38) ccons ::= NOT NULL onconf */
+ 217, /* (39) ccons ::= PRIMARY KEY sortorder onconf autoinc */
+ 217, /* (40) ccons ::= UNIQUE onconf */
+ 217, /* (41) ccons ::= CHECK LP expr RP */
+ 217, /* (42) ccons ::= REFERENCES nm eidlist_opt refargs */
+ 217, /* (43) ccons ::= defer_subclause */
+ 217, /* (44) ccons ::= COLLATE ID|STRING */
+ 226, /* (45) generated ::= LP expr RP */
+ 226, /* (46) generated ::= LP expr RP ID */
+ 222, /* (47) autoinc ::= */
+ 222, /* (48) autoinc ::= AUTOINCR */
+ 224, /* (49) refargs ::= */
+ 224, /* (50) refargs ::= refargs refarg */
+ 227, /* (51) refarg ::= MATCH nm */
+ 227, /* (52) refarg ::= ON INSERT refact */
+ 227, /* (53) refarg ::= ON DELETE refact */
+ 227, /* (54) refarg ::= ON UPDATE refact */
+ 228, /* (55) refact ::= SET NULL */
+ 228, /* (56) refact ::= SET DEFAULT */
+ 228, /* (57) refact ::= CASCADE */
+ 228, /* (58) refact ::= RESTRICT */
+ 228, /* (59) refact ::= NO ACTION */
+ 225, /* (60) defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
+ 225, /* (61) defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
+ 229, /* (62) init_deferred_pred_opt ::= */
+ 229, /* (63) init_deferred_pred_opt ::= INITIALLY DEFERRED */
+ 229, /* (64) init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
+ 204, /* (65) conslist_opt ::= */
+ 231, /* (66) tconscomma ::= COMMA */
+ 232, /* (67) tcons ::= CONSTRAINT nm */
+ 232, /* (68) tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
+ 232, /* (69) tcons ::= UNIQUE LP sortlist RP onconf */
+ 232, /* (70) tcons ::= CHECK LP expr RP onconf */
+ 232, /* (71) tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
+ 235, /* (72) defer_subclause_opt ::= */
+ 220, /* (73) onconf ::= */
+ 220, /* (74) onconf ::= ON CONFLICT resolvetype */
+ 236, /* (75) orconf ::= */
+ 236, /* (76) orconf ::= OR resolvetype */
+ 237, /* (77) resolvetype ::= IGNORE */
+ 237, /* (78) resolvetype ::= REPLACE */
+ 192, /* (79) cmd ::= DROP TABLE ifexists fullname */
+ 239, /* (80) ifexists ::= IF EXISTS */
+ 239, /* (81) ifexists ::= */
+ 192, /* (82) cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
+ 192, /* (83) cmd ::= DROP VIEW ifexists fullname */
+ 192, /* (84) cmd ::= select */
+ 206, /* (85) select ::= WITH wqlist selectnowith */
+ 206, /* (86) select ::= WITH RECURSIVE wqlist selectnowith */
+ 206, /* (87) select ::= selectnowith */
+ 241, /* (88) selectnowith ::= selectnowith multiselect_op oneselect */
+ 244, /* (89) multiselect_op ::= UNION */
+ 244, /* (90) multiselect_op ::= UNION ALL */
+ 244, /* (91) multiselect_op ::= EXCEPT|INTERSECT */
+ 242, /* (92) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
+ 242, /* (93) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */
+ 254, /* (94) values ::= VALUES LP nexprlist RP */
+ 242, /* (95) oneselect ::= mvalues */
+ 256, /* (96) mvalues ::= values COMMA LP nexprlist RP */
+ 256, /* (97) mvalues ::= mvalues COMMA LP nexprlist RP */
+ 245, /* (98) distinct ::= DISTINCT */
+ 245, /* (99) distinct ::= ALL */
+ 245, /* (100) distinct ::= */
+ 257, /* (101) sclp ::= */
+ 246, /* (102) selcollist ::= sclp scanpt expr scanpt as */
+ 246, /* (103) selcollist ::= sclp scanpt STAR */
+ 246, /* (104) selcollist ::= sclp scanpt nm DOT STAR */
+ 258, /* (105) as ::= AS nm */
+ 258, /* (106) as ::= */
+ 247, /* (107) from ::= */
+ 247, /* (108) from ::= FROM seltablist */
+ 260, /* (109) stl_prefix ::= seltablist joinop */
+ 260, /* (110) stl_prefix ::= */
+ 259, /* (111) seltablist ::= stl_prefix nm dbnm as on_using */
+ 259, /* (112) seltablist ::= stl_prefix nm dbnm as indexed_by on_using */
+ 259, /* (113) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_using */
+ 259, /* (114) seltablist ::= stl_prefix LP select RP as on_using */
+ 259, /* (115) seltablist ::= stl_prefix LP seltablist RP as on_using */
+ 202, /* (116) dbnm ::= */
+ 202, /* (117) dbnm ::= DOT nm */
+ 240, /* (118) fullname ::= nm */
+ 240, /* (119) fullname ::= nm DOT nm */
+ 265, /* (120) xfullname ::= nm */
+ 265, /* (121) xfullname ::= nm DOT nm */
+ 265, /* (122) xfullname ::= nm DOT nm AS nm */
+ 265, /* (123) xfullname ::= nm AS nm */
+ 261, /* (124) joinop ::= COMMA|JOIN */
+ 261, /* (125) joinop ::= JOIN_KW JOIN */
+ 261, /* (126) joinop ::= JOIN_KW nm JOIN */
+ 261, /* (127) joinop ::= JOIN_KW nm nm JOIN */
+ 262, /* (128) on_using ::= ON expr */
+ 262, /* (129) on_using ::= USING LP idlist RP */
+ 262, /* (130) on_using ::= */
+ 267, /* (131) indexed_opt ::= */
+ 263, /* (132) indexed_by ::= INDEXED BY nm */
+ 263, /* (133) indexed_by ::= NOT INDEXED */
+ 251, /* (134) orderby_opt ::= */
+ 251, /* (135) orderby_opt ::= ORDER BY sortlist */
+ 233, /* (136) sortlist ::= sortlist COMMA expr sortorder nulls */
+ 233, /* (137) sortlist ::= expr sortorder nulls */
+ 221, /* (138) sortorder ::= ASC */
+ 221, /* (139) sortorder ::= DESC */
+ 221, /* (140) sortorder ::= */
+ 268, /* (141) nulls ::= NULLS FIRST */
+ 268, /* (142) nulls ::= NULLS LAST */
+ 268, /* (143) nulls ::= */
+ 249, /* (144) groupby_opt ::= */
+ 249, /* (145) groupby_opt ::= GROUP BY nexprlist */
+ 250, /* (146) having_opt ::= */
+ 250, /* (147) having_opt ::= HAVING expr */
+ 252, /* (148) limit_opt ::= */
+ 252, /* (149) limit_opt ::= LIMIT expr */
+ 252, /* (150) limit_opt ::= LIMIT expr OFFSET expr */
+ 252, /* (151) limit_opt ::= LIMIT expr COMMA expr */
+ 192, /* (152) cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret orderby_opt limit_opt */
+ 248, /* (153) where_opt ::= */
+ 248, /* (154) where_opt ::= WHERE expr */
+ 270, /* (155) where_opt_ret ::= */
+ 270, /* (156) where_opt_ret ::= WHERE expr */
+ 270, /* (157) where_opt_ret ::= RETURNING selcollist */
+ 270, /* (158) where_opt_ret ::= WHERE expr RETURNING selcollist */
+ 192, /* (159) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret orderby_opt limit_opt */
+ 271, /* (160) setlist ::= setlist COMMA nm EQ expr */
+ 271, /* (161) setlist ::= setlist COMMA LP idlist RP EQ expr */
+ 271, /* (162) setlist ::= nm EQ expr */
+ 271, /* (163) setlist ::= LP idlist RP EQ expr */
+ 192, /* (164) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
+ 192, /* (165) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */
+ 274, /* (166) upsert ::= */
+ 274, /* (167) upsert ::= RETURNING selcollist */
+ 274, /* (168) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */
+ 274, /* (169) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */
+ 274, /* (170) upsert ::= ON CONFLICT DO NOTHING returning */
+ 274, /* (171) upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */
+ 275, /* (172) returning ::= RETURNING selcollist */
+ 272, /* (173) insert_cmd ::= INSERT orconf */
+ 272, /* (174) insert_cmd ::= REPLACE */
+ 273, /* (175) idlist_opt ::= */
+ 273, /* (176) idlist_opt ::= LP idlist RP */
+ 266, /* (177) idlist ::= idlist COMMA nm */
+ 266, /* (178) idlist ::= nm */
+ 219, /* (179) expr ::= LP expr RP */
+ 219, /* (180) expr ::= ID|INDEXED|JOIN_KW */
+ 219, /* (181) expr ::= nm DOT nm */
+ 219, /* (182) expr ::= nm DOT nm DOT nm */
+ 218, /* (183) term ::= NULL|FLOAT|BLOB */
+ 218, /* (184) term ::= STRING */
+ 218, /* (185) term ::= INTEGER */
+ 219, /* (186) expr ::= VARIABLE */
+ 219, /* (187) expr ::= expr COLLATE ID|STRING */
+ 219, /* (188) expr ::= CAST LP expr AS typetoken RP */
+ 219, /* (189) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */
+ 219, /* (190) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP */
+ 219, /* (191) expr ::= ID|INDEXED|JOIN_KW LP STAR RP */
+ 219, /* (192) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */
+ 219, /* (193) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP filter_over */
+ 219, /* (194) expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */
+ 218, /* (195) term ::= CTIME_KW */
+ 219, /* (196) expr ::= LP nexprlist COMMA expr RP */
+ 219, /* (197) expr ::= expr AND expr */
+ 219, /* (198) expr ::= expr OR expr */
+ 219, /* (199) expr ::= expr LT|GT|GE|LE expr */
+ 219, /* (200) expr ::= expr EQ|NE expr */
+ 219, /* (201) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
+ 219, /* (202) expr ::= expr PLUS|MINUS expr */
+ 219, /* (203) expr ::= expr STAR|SLASH|REM expr */
+ 219, /* (204) expr ::= expr CONCAT expr */
+ 277, /* (205) likeop ::= NOT LIKE_KW|MATCH */
+ 219, /* (206) expr ::= expr likeop expr */
+ 219, /* (207) expr ::= expr likeop expr ESCAPE expr */
+ 219, /* (208) expr ::= expr ISNULL|NOTNULL */
+ 219, /* (209) expr ::= expr NOT NULL */
+ 219, /* (210) expr ::= expr IS expr */
+ 219, /* (211) expr ::= expr IS NOT expr */
+ 219, /* (212) expr ::= expr IS NOT DISTINCT FROM expr */
+ 219, /* (213) expr ::= expr IS DISTINCT FROM expr */
+ 219, /* (214) expr ::= NOT expr */
+ 219, /* (215) expr ::= BITNOT expr */
+ 219, /* (216) expr ::= PLUS|MINUS expr */
+ 219, /* (217) expr ::= expr PTR expr */
+ 278, /* (218) between_op ::= BETWEEN */
+ 278, /* (219) between_op ::= NOT BETWEEN */
+ 219, /* (220) expr ::= expr between_op expr AND expr */
+ 279, /* (221) in_op ::= IN */
+ 279, /* (222) in_op ::= NOT IN */
+ 219, /* (223) expr ::= expr in_op LP exprlist RP */
+ 219, /* (224) expr ::= LP select RP */
+ 219, /* (225) expr ::= expr in_op LP select RP */
+ 219, /* (226) expr ::= expr in_op nm dbnm paren_exprlist */
+ 219, /* (227) expr ::= EXISTS LP select RP */
+ 219, /* (228) expr ::= CASE case_operand case_exprlist case_else END */
+ 282, /* (229) case_exprlist ::= case_exprlist WHEN expr THEN expr */
+ 282, /* (230) case_exprlist ::= WHEN expr THEN expr */
+ 283, /* (231) case_else ::= ELSE expr */
+ 283, /* (232) case_else ::= */
+ 281, /* (233) case_operand ::= */
+ 264, /* (234) exprlist ::= */
+ 255, /* (235) nexprlist ::= nexprlist COMMA expr */
+ 255, /* (236) nexprlist ::= expr */
+ 280, /* (237) paren_exprlist ::= */
+ 280, /* (238) paren_exprlist ::= LP exprlist RP */
+ 192, /* (239) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
+ 284, /* (240) uniqueflag ::= UNIQUE */
+ 284, /* (241) uniqueflag ::= */
+ 223, /* (242) eidlist_opt ::= */
+ 223, /* (243) eidlist_opt ::= LP eidlist RP */
+ 234, /* (244) eidlist ::= eidlist COMMA nm collate sortorder */
+ 234, /* (245) eidlist ::= nm collate sortorder */
+ 285, /* (246) collate ::= */
+ 285, /* (247) collate ::= COLLATE ID|STRING */
+ 192, /* (248) cmd ::= DROP INDEX ifexists fullname */
+ 192, /* (249) cmd ::= VACUUM vinto */
+ 192, /* (250) cmd ::= VACUUM nm vinto */
+ 286, /* (251) vinto ::= INTO expr */
+ 286, /* (252) vinto ::= */
+ 192, /* (253) cmd ::= PRAGMA nm dbnm */
+ 192, /* (254) cmd ::= PRAGMA nm dbnm EQ nmnum */
+ 192, /* (255) cmd ::= PRAGMA nm dbnm LP nmnum RP */
+ 192, /* (256) cmd ::= PRAGMA nm dbnm EQ minus_num */
+ 192, /* (257) cmd ::= PRAGMA nm dbnm LP minus_num RP */
+ 213, /* (258) plus_num ::= PLUS INTEGER|FLOAT */
+ 214, /* (259) minus_num ::= MINUS INTEGER|FLOAT */
+ 192, /* (260) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
+ 288, /* (261) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
+ 290, /* (262) trigger_time ::= BEFORE|AFTER */
+ 290, /* (263) trigger_time ::= INSTEAD OF */
+ 290, /* (264) trigger_time ::= */
+ 291, /* (265) trigger_event ::= DELETE|INSERT */
+ 291, /* (266) trigger_event ::= UPDATE */
+ 291, /* (267) trigger_event ::= UPDATE OF idlist */
+ 293, /* (268) when_clause ::= */
+ 293, /* (269) when_clause ::= WHEN expr */
+ 289, /* (270) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
+ 289, /* (271) trigger_cmd_list ::= trigger_cmd SEMI */
+ 295, /* (272) trnm ::= nm DOT nm */
+ 296, /* (273) tridxby ::= INDEXED BY nm */
+ 296, /* (274) tridxby ::= NOT INDEXED */
+ 294, /* (275) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
+ 294, /* (276) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
+ 294, /* (277) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
+ 294, /* (278) trigger_cmd ::= scanpt select scanpt */
+ 219, /* (279) expr ::= RAISE LP IGNORE RP */
+ 219, /* (280) expr ::= RAISE LP raisetype COMMA expr RP */
+ 238, /* (281) raisetype ::= ROLLBACK */
+ 238, /* (282) raisetype ::= ABORT */
+ 238, /* (283) raisetype ::= FAIL */
+ 192, /* (284) cmd ::= DROP TRIGGER ifexists fullname */
+ 192, /* (285) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
+ 192, /* (286) cmd ::= DETACH database_kw_opt expr */
+ 298, /* (287) key_opt ::= */
+ 298, /* (288) key_opt ::= KEY expr */
+ 192, /* (289) cmd ::= REINDEX */
+ 192, /* (290) cmd ::= REINDEX nm dbnm */
+ 192, /* (291) cmd ::= ANALYZE */
+ 192, /* (292) cmd ::= ANALYZE nm dbnm */
+ 192, /* (293) cmd ::= ALTER TABLE fullname RENAME TO nm */
+ 192, /* (294) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
+ 192, /* (295) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
+ 299, /* (296) add_column_fullname ::= fullname */
+ 192, /* (297) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
+ 192, /* (298) cmd ::= create_vtab */
+ 192, /* (299) cmd ::= create_vtab LP vtabarglist RP */
+ 301, /* (300) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
+ 303, /* (301) vtabarg ::= */
+ 304, /* (302) vtabargtoken ::= ANY */
+ 304, /* (303) vtabargtoken ::= lp anylist RP */
+ 305, /* (304) lp ::= LP */
+ 269, /* (305) with ::= WITH wqlist */
+ 269, /* (306) with ::= WITH RECURSIVE wqlist */
+ 308, /* (307) wqas ::= AS */
+ 308, /* (308) wqas ::= AS MATERIALIZED */
+ 308, /* (309) wqas ::= AS NOT MATERIALIZED */
+ 307, /* (310) wqitem ::= withnm eidlist_opt wqas LP select RP */
+ 309, /* (311) withnm ::= nm */
+ 243, /* (312) wqlist ::= wqitem */
+ 243, /* (313) wqlist ::= wqlist COMMA wqitem */
+ 310, /* (314) windowdefn_list ::= windowdefn_list COMMA windowdefn */
+ 311, /* (315) windowdefn ::= nm AS LP window RP */
+ 312, /* (316) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
+ 312, /* (317) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
+ 312, /* (318) window ::= ORDER BY sortlist frame_opt */
+ 312, /* (319) window ::= nm ORDER BY sortlist frame_opt */
+ 312, /* (320) window ::= nm frame_opt */
+ 313, /* (321) frame_opt ::= */
+ 313, /* (322) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
+ 313, /* (323) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
+ 317, /* (324) range_or_rows ::= RANGE|ROWS|GROUPS */
+ 319, /* (325) frame_bound_s ::= frame_bound */
+ 319, /* (326) frame_bound_s ::= UNBOUNDED PRECEDING */
+ 320, /* (327) frame_bound_e ::= frame_bound */
+ 320, /* (328) frame_bound_e ::= UNBOUNDED FOLLOWING */
+ 318, /* (329) frame_bound ::= expr PRECEDING|FOLLOWING */
+ 318, /* (330) frame_bound ::= CURRENT ROW */
+ 321, /* (331) frame_exclude_opt ::= */
+ 321, /* (332) frame_exclude_opt ::= EXCLUDE frame_exclude */
+ 322, /* (333) frame_exclude ::= NO OTHERS */
+ 322, /* (334) frame_exclude ::= CURRENT ROW */
+ 322, /* (335) frame_exclude ::= GROUP|TIES */
+ 253, /* (336) window_clause ::= WINDOW windowdefn_list */
+ 276, /* (337) filter_over ::= filter_clause over_clause */
+ 276, /* (338) filter_over ::= over_clause */
+ 276, /* (339) filter_over ::= filter_clause */
+ 316, /* (340) over_clause ::= OVER LP window RP */
+ 316, /* (341) over_clause ::= OVER nm */
+ 315, /* (342) filter_clause ::= FILTER LP WHERE expr RP */
+ 218, /* (343) term ::= QNUMBER */
+ 187, /* (344) input ::= cmdlist */
+ 188, /* (345) cmdlist ::= cmdlist ecmd */
+ 188, /* (346) cmdlist ::= ecmd */
+ 189, /* (347) ecmd ::= SEMI */
+ 189, /* (348) ecmd ::= cmdx SEMI */
+ 189, /* (349) ecmd ::= explain cmdx SEMI */
+ 194, /* (350) trans_opt ::= */
+ 194, /* (351) trans_opt ::= TRANSACTION */
+ 194, /* (352) trans_opt ::= TRANSACTION nm */
+ 196, /* (353) savepoint_opt ::= SAVEPOINT */
+ 196, /* (354) savepoint_opt ::= */
+ 192, /* (355) cmd ::= create_table create_table_args */
+ 205, /* (356) table_option_set ::= table_option */
+ 203, /* (357) columnlist ::= columnlist COMMA columnname carglist */
+ 203, /* (358) columnlist ::= columnname carglist */
+ 195, /* (359) nm ::= ID|INDEXED|JOIN_KW */
+ 195, /* (360) nm ::= STRING */
+ 210, /* (361) typetoken ::= typename */
+ 211, /* (362) typename ::= ID|STRING */
+ 212, /* (363) signed ::= plus_num */
+ 212, /* (364) signed ::= minus_num */
+ 209, /* (365) carglist ::= carglist ccons */
+ 209, /* (366) carglist ::= */
+ 217, /* (367) ccons ::= NULL onconf */
+ 217, /* (368) ccons ::= GENERATED ALWAYS AS generated */
+ 217, /* (369) ccons ::= AS generated */
+ 204, /* (370) conslist_opt ::= COMMA conslist */
+ 230, /* (371) conslist ::= conslist tconscomma tcons */
+ 230, /* (372) conslist ::= tcons */
+ 231, /* (373) tconscomma ::= */
+ 235, /* (374) defer_subclause_opt ::= defer_subclause */
+ 237, /* (375) resolvetype ::= raisetype */
+ 241, /* (376) selectnowith ::= oneselect */
+ 242, /* (377) oneselect ::= values */
+ 257, /* (378) sclp ::= selcollist COMMA */
+ 258, /* (379) as ::= ID|STRING */
+ 267, /* (380) indexed_opt ::= indexed_by */
+ 275, /* (381) returning ::= */
+ 219, /* (382) expr ::= term */
+ 277, /* (383) likeop ::= LIKE_KW|MATCH */
+ 281, /* (384) case_operand ::= expr */
+ 264, /* (385) exprlist ::= nexprlist */
+ 287, /* (386) nmnum ::= plus_num */
+ 287, /* (387) nmnum ::= nm */
+ 287, /* (388) nmnum ::= ON */
+ 287, /* (389) nmnum ::= DELETE */
+ 287, /* (390) nmnum ::= DEFAULT */
+ 213, /* (391) plus_num ::= INTEGER|FLOAT */
+ 292, /* (392) foreach_clause ::= */
+ 292, /* (393) foreach_clause ::= FOR EACH ROW */
+ 295, /* (394) trnm ::= nm */
+ 296, /* (395) tridxby ::= */
+ 297, /* (396) database_kw_opt ::= DATABASE */
+ 297, /* (397) database_kw_opt ::= */
+ 300, /* (398) kwcolumn_opt ::= */
+ 300, /* (399) kwcolumn_opt ::= COLUMNKW */
+ 302, /* (400) vtabarglist ::= vtabarg */
+ 302, /* (401) vtabarglist ::= vtabarglist COMMA vtabarg */
+ 303, /* (402) vtabarg ::= vtabarg vtabargtoken */
+ 306, /* (403) anylist ::= */
+ 306, /* (404) anylist ::= anylist LP anylist RP */
+ 306, /* (405) anylist ::= anylist ANY */
+ 269, /* (406) with ::= */
+ 310, /* (407) windowdefn_list ::= windowdefn */
+ 312, /* (408) window ::= frame_opt */
};
/* For rule J, yyRuleInfoNRhs[J] contains the negative of the number
@@ -180692,23 +180593,23 @@ static YYACTIONTYPE yy_reduce(
{ sqlite3FinishCoding(pParse); }
break;
case 3: /* cmd ::= BEGIN transtype trans_opt */
-{sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy220);}
+{sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy502);}
break;
case 4: /* transtype ::= */
-{yymsp[1].minor.yy220 = TK_DEFERRED;}
+{yymsp[1].minor.yy502 = TK_DEFERRED;}
break;
case 5: /* transtype ::= DEFERRED */
case 6: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==6);
case 324: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==324);
-{yymsp[0].minor.yy220 = yymsp[0].major; /*A-overwrites-X*/}
+{yymsp[0].minor.yy502 = yymsp[0].major; /*A-overwrites-X*/}
break;
case 7: /* transtype ::= ID */
{
Token *p = &yymsp[0].minor.yy0;
if( p->n==9 && sqlite3_strnicmp(p->z,"exclusive",9)==0 ){
- yymsp[0].minor.yy220 = TK_EXCLUSIVE;
+ yymsp[0].minor.yy502 = TK_EXCLUSIVE;
}else if( p->n==10 && sqlite3_strnicmp(p->z,"concurrent",10)==0 ){
- yymsp[0].minor.yy220 = TK_CONCURRENT; /*A-overwrites-X*/
+ yymsp[0].minor.yy502 = TK_CONCURRENT; /*A-overwrites-X*/
}else{
parserSyntaxError(pParse, p);
}
@@ -180735,7 +180636,7 @@ static YYACTIONTYPE yy_reduce(
break;
case 13: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */
{
- sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy220,0,0,yymsp[-2].minor.yy220);
+ sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy502,0,0,yymsp[-2].minor.yy502);
}
break;
case 14: /* createkw ::= CREATE */
@@ -180749,38 +180650,38 @@ static YYACTIONTYPE yy_reduce(
case 81: /* ifexists ::= */ yytestcase(yyruleno==81);
case 100: /* distinct ::= */ yytestcase(yyruleno==100);
case 246: /* collate ::= */ yytestcase(yyruleno==246);
-{yymsp[1].minor.yy220 = 0;}
+{yymsp[1].minor.yy502 = 0;}
break;
case 16: /* ifnotexists ::= IF NOT EXISTS */
-{yymsp[-2].minor.yy220 = 1;}
+{yymsp[-2].minor.yy502 = 1;}
break;
case 17: /* temp ::= TEMP */
-{yymsp[0].minor.yy220 = pParse->db->init.busy==0;}
+{yymsp[0].minor.yy502 = pParse->db->init.busy==0;}
break;
case 19: /* create_table_args ::= LP columnlist conslist_opt RP table_option_set */
{
- sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy279,0);
+ sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy9,0);
}
break;
case 20: /* create_table_args ::= AS select */
{
- sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy99);
- sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy99);
+ sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy637);
+ sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy637);
}
break;
case 21: /* table_option_set ::= */
-{yymsp[1].minor.yy279 = 0;}
+{yymsp[1].minor.yy9 = 0;}
break;
case 22: /* table_option_set ::= table_option_set COMMA table_option */
-{yylhsminor.yy279 = yymsp[-2].minor.yy279|yymsp[0].minor.yy279;}
- yymsp[-2].minor.yy279 = yylhsminor.yy279;
+{yylhsminor.yy9 = yymsp[-2].minor.yy9|yymsp[0].minor.yy9;}
+ yymsp[-2].minor.yy9 = yylhsminor.yy9;
break;
case 23: /* table_option ::= WITHOUT nm */
{
if( yymsp[0].minor.yy0.n==5 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"rowid",5)==0 ){
- yymsp[-1].minor.yy279 = TF_WithoutRowid | TF_NoVisibleRowid;
+ yymsp[-1].minor.yy9 = TF_WithoutRowid | TF_NoVisibleRowid;
}else{
- yymsp[-1].minor.yy279 = 0;
+ yymsp[-1].minor.yy9 = 0;
sqlite3ErrorMsg(pParse, "unknown table option: %.*s", yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.z);
}
}
@@ -180788,13 +180689,13 @@ static YYACTIONTYPE yy_reduce(
case 24: /* table_option ::= nm */
{
if( yymsp[0].minor.yy0.n==6 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"strict",6)==0 ){
- yylhsminor.yy279 = TF_Strict;
+ yylhsminor.yy9 = TF_Strict;
}else{
- yylhsminor.yy279 = 0;
+ yylhsminor.yy9 = 0;
sqlite3ErrorMsg(pParse, "unknown table option: %.*s", yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.z);
}
}
- yymsp[0].minor.yy279 = yylhsminor.yy279;
+ yymsp[0].minor.yy9 = yylhsminor.yy9;
break;
case 25: /* columnname ::= nm typetoken */
{sqlite3AddColumn(pParse,yymsp[-1].minor.yy0,yymsp[0].minor.yy0);}
@@ -180820,7 +180721,7 @@ static YYACTIONTYPE yy_reduce(
case 30: /* scanpt ::= */
{
assert( yyLookahead!=YYNOCODE );
- yymsp[1].minor.yy192 = yyLookaheadToken.z;
+ yymsp[1].minor.yy342 = yyLookaheadToken.z;
}
break;
case 31: /* scantok ::= */
@@ -180834,17 +180735,17 @@ static YYACTIONTYPE yy_reduce(
{pParse->constraintName = yymsp[0].minor.yy0;}
break;
case 33: /* ccons ::= DEFAULT scantok term */
-{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy530,yymsp[-1].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);}
+{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy590,yymsp[-1].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);}
break;
case 34: /* ccons ::= DEFAULT LP expr RP */
-{sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy530,yymsp[-2].minor.yy0.z+1,yymsp[0].minor.yy0.z);}
+{sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy590,yymsp[-2].minor.yy0.z+1,yymsp[0].minor.yy0.z);}
break;
case 35: /* ccons ::= DEFAULT PLUS scantok term */
-{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy530,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);}
+{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy590,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);}
break;
case 36: /* ccons ::= DEFAULT MINUS scantok term */
{
- Expr *p = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy530, 0);
+ Expr *p = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy590, 0);
sqlite3AddDefaultValue(pParse,p,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);
}
break;
@@ -180859,155 +180760,151 @@ static YYACTIONTYPE yy_reduce(
}
break;
case 38: /* ccons ::= NOT NULL onconf */
-{sqlite3AddNotNull(pParse, yymsp[0].minor.yy220);}
+{sqlite3AddNotNull(pParse, yymsp[0].minor.yy502);}
break;
case 39: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */
-{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy220,yymsp[0].minor.yy220,yymsp[-2].minor.yy220);}
+{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy502,yymsp[0].minor.yy502,yymsp[-2].minor.yy502);}
break;
case 40: /* ccons ::= UNIQUE onconf */
-{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy220,0,0,0,0,
+{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy502,0,0,0,0,
SQLITE_IDXTYPE_UNIQUE);}
break;
case 41: /* ccons ::= CHECK LP expr RP */
-{sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy530,yymsp[-2].minor.yy0.z,yymsp[0].minor.yy0.z);}
+{sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy590,yymsp[-2].minor.yy0.z,yymsp[0].minor.yy0.z);}
break;
case 42: /* ccons ::= REFERENCES nm eidlist_opt refargs */
-{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy250,yymsp[0].minor.yy220);}
+{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy402,yymsp[0].minor.yy502);}
break;
case 43: /* ccons ::= defer_subclause */
-{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy220);}
+{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy502);}
break;
case 44: /* ccons ::= COLLATE ID|STRING */
{sqlite3AddCollateType(pParse, &yymsp[0].minor.yy0);}
break;
case 45: /* generated ::= LP expr RP */
-{sqlite3AddGenerated(pParse,yymsp[-1].minor.yy530,0);}
+{sqlite3AddGenerated(pParse,yymsp[-1].minor.yy590,0);}
break;
case 46: /* generated ::= LP expr RP ID */
-{sqlite3AddGenerated(pParse,yymsp[-2].minor.yy530,&yymsp[0].minor.yy0);}
+{sqlite3AddGenerated(pParse,yymsp[-2].minor.yy590,&yymsp[0].minor.yy0);}
break;
case 48: /* autoinc ::= AUTOINCR */
-{yymsp[0].minor.yy220 = 1;}
+{yymsp[0].minor.yy502 = 1;}
break;
case 49: /* refargs ::= */
-{ yymsp[1].minor.yy220 = OE_None*0x0101; /* EV: R-19803-45884 */}
+{ yymsp[1].minor.yy502 = OE_None*0x0101; /* EV: R-19803-45884 */}
break;
case 50: /* refargs ::= refargs refarg */
-{ yymsp[-1].minor.yy220 = (yymsp[-1].minor.yy220 & ~yymsp[0].minor.yy359.mask) | yymsp[0].minor.yy359.value; }
+{ yymsp[-1].minor.yy502 = (yymsp[-1].minor.yy502 & ~yymsp[0].minor.yy481.mask) | yymsp[0].minor.yy481.value; }
break;
case 51: /* refarg ::= MATCH nm */
-{ yymsp[-1].minor.yy359.value = 0; yymsp[-1].minor.yy359.mask = 0x000000; }
+{ yymsp[-1].minor.yy481.value = 0; yymsp[-1].minor.yy481.mask = 0x000000; }
break;
case 52: /* refarg ::= ON INSERT refact */
-{ yymsp[-2].minor.yy359.value = 0; yymsp[-2].minor.yy359.mask = 0x000000; }
+{ yymsp[-2].minor.yy481.value = 0; yymsp[-2].minor.yy481.mask = 0x000000; }
break;
case 53: /* refarg ::= ON DELETE refact */
-{ yymsp[-2].minor.yy359.value = yymsp[0].minor.yy220; yymsp[-2].minor.yy359.mask = 0x0000ff; }
+{ yymsp[-2].minor.yy481.value = yymsp[0].minor.yy502; yymsp[-2].minor.yy481.mask = 0x0000ff; }
break;
case 54: /* refarg ::= ON UPDATE refact */
-{ yymsp[-2].minor.yy359.value = yymsp[0].minor.yy220<<8; yymsp[-2].minor.yy359.mask = 0x00ff00; }
+{ yymsp[-2].minor.yy481.value = yymsp[0].minor.yy502<<8; yymsp[-2].minor.yy481.mask = 0x00ff00; }
break;
case 55: /* refact ::= SET NULL */
-{ yymsp[-1].minor.yy220 = OE_SetNull; /* EV: R-33326-45252 */}
+{ yymsp[-1].minor.yy502 = OE_SetNull; /* EV: R-33326-45252 */}
break;
case 56: /* refact ::= SET DEFAULT */
-{ yymsp[-1].minor.yy220 = OE_SetDflt; /* EV: R-33326-45252 */}
+{ yymsp[-1].minor.yy502 = OE_SetDflt; /* EV: R-33326-45252 */}
break;
case 57: /* refact ::= CASCADE */
-{ yymsp[0].minor.yy220 = OE_Cascade; /* EV: R-33326-45252 */}
+{ yymsp[0].minor.yy502 = OE_Cascade; /* EV: R-33326-45252 */}
break;
case 58: /* refact ::= RESTRICT */
-{ yymsp[0].minor.yy220 = OE_Restrict; /* EV: R-33326-45252 */}
+{ yymsp[0].minor.yy502 = OE_Restrict; /* EV: R-33326-45252 */}
break;
case 59: /* refact ::= NO ACTION */
-{ yymsp[-1].minor.yy220 = OE_None; /* EV: R-33326-45252 */}
+{ yymsp[-1].minor.yy502 = OE_None; /* EV: R-33326-45252 */}
break;
case 60: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
-{yymsp[-2].minor.yy220 = 0;}
+{yymsp[-2].minor.yy502 = 0;}
break;
case 61: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
case 76: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==76);
case 173: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==173);
-{yymsp[-1].minor.yy220 = yymsp[0].minor.yy220;}
+{yymsp[-1].minor.yy502 = yymsp[0].minor.yy502;}
break;
case 63: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
case 80: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==80);
case 219: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==219);
case 222: /* in_op ::= NOT IN */ yytestcase(yyruleno==222);
case 247: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==247);
-{yymsp[-1].minor.yy220 = 1;}
+{yymsp[-1].minor.yy502 = 1;}
break;
case 64: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
-{yymsp[-1].minor.yy220 = 0;}
+{yymsp[-1].minor.yy502 = 0;}
break;
case 66: /* tconscomma ::= COMMA */
{pParse->constraintName.n = 0;}
break;
case 68: /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
-{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy250,yymsp[0].minor.yy220,yymsp[-2].minor.yy220,0);}
+{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy402,yymsp[0].minor.yy502,yymsp[-2].minor.yy502,0);}
break;
case 69: /* tcons ::= UNIQUE LP sortlist RP onconf */
-{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy250,yymsp[0].minor.yy220,0,0,0,0,
+{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy402,yymsp[0].minor.yy502,0,0,0,0,
SQLITE_IDXTYPE_UNIQUE);}
break;
case 70: /* tcons ::= CHECK LP expr RP onconf */
-{sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy530,yymsp[-3].minor.yy0.z,yymsp[-1].minor.yy0.z);}
+{sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy590,yymsp[-3].minor.yy0.z,yymsp[-1].minor.yy0.z);}
break;
case 71: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
{
- sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy250, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy250, yymsp[-1].minor.yy220);
- sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy220);
+ sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy402, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy402, yymsp[-1].minor.yy502);
+ sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy502);
}
break;
case 73: /* onconf ::= */
case 75: /* orconf ::= */ yytestcase(yyruleno==75);
-{yymsp[1].minor.yy220 = OE_Default;}
+{yymsp[1].minor.yy502 = OE_Default;}
break;
case 74: /* onconf ::= ON CONFLICT resolvetype */
-{yymsp[-2].minor.yy220 = yymsp[0].minor.yy220;}
+{yymsp[-2].minor.yy502 = yymsp[0].minor.yy502;}
break;
case 77: /* resolvetype ::= IGNORE */
-{yymsp[0].minor.yy220 = OE_Ignore;}
+{yymsp[0].minor.yy502 = OE_Ignore;}
break;
case 78: /* resolvetype ::= REPLACE */
case 174: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==174);
-{yymsp[0].minor.yy220 = OE_Replace;}
+{yymsp[0].minor.yy502 = OE_Replace;}
break;
case 79: /* cmd ::= DROP TABLE ifexists fullname */
{
- sqlite3DropTable(pParse, yymsp[0].minor.yy43, 0, yymsp[-1].minor.yy220);
+ sqlite3DropTable(pParse, yymsp[0].minor.yy563, 0, yymsp[-1].minor.yy502);
}
break;
case 82: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
{
- sqlite3CreateView(pParse, &yymsp[-8].minor.yy0, &yymsp[-4].minor.yy0, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy250, yymsp[0].minor.yy99, yymsp[-7].minor.yy220, yymsp[-5].minor.yy220);
+ sqlite3CreateView(pParse, &yymsp[-8].minor.yy0, &yymsp[-4].minor.yy0, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy402, yymsp[0].minor.yy637, yymsp[-7].minor.yy502, yymsp[-5].minor.yy502);
}
break;
case 83: /* cmd ::= DROP VIEW ifexists fullname */
{
- sqlite3DropTable(pParse, yymsp[0].minor.yy43, 1, yymsp[-1].minor.yy220);
+ sqlite3DropTable(pParse, yymsp[0].minor.yy563, 1, yymsp[-1].minor.yy502);
}
break;
case 84: /* cmd ::= select */
{
SelectDest dest = {SRT_Output, 0, 0, 0, 0, 0, 0};
- if( (pParse->db->mDbFlags & DBFLAG_EncodingFixed)!=0
- || sqlite3ReadSchema(pParse)==SQLITE_OK
- ){
- sqlite3Select(pParse, yymsp[0].minor.yy99, &dest);
- }
- sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy99);
+ sqlite3Select(pParse, yymsp[0].minor.yy637, &dest);
+ sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy637);
}
break;
case 85: /* select ::= WITH wqlist selectnowith */
-{yymsp[-2].minor.yy99 = attachWithToSelect(pParse,yymsp[0].minor.yy99,yymsp[-1].minor.yy91);}
+{yymsp[-2].minor.yy637 = attachWithToSelect(pParse,yymsp[0].minor.yy637,yymsp[-1].minor.yy125);}
break;
case 86: /* select ::= WITH RECURSIVE wqlist selectnowith */
-{yymsp[-3].minor.yy99 = attachWithToSelect(pParse,yymsp[0].minor.yy99,yymsp[-1].minor.yy91);}
+{yymsp[-3].minor.yy637 = attachWithToSelect(pParse,yymsp[0].minor.yy637,yymsp[-1].minor.yy125);}
break;
case 87: /* select ::= selectnowith */
{
- Select *p = yymsp[0].minor.yy99;
+ Select *p = yymsp[0].minor.yy637;
if( p ){
parserDoubleLinkSelect(pParse, p);
}
@@ -181015,8 +180912,8 @@ static YYACTIONTYPE yy_reduce(
break;
case 88: /* selectnowith ::= selectnowith multiselect_op oneselect */
{
- Select *pRhs = yymsp[0].minor.yy99;
- Select *pLhs = yymsp[-2].minor.yy99;
+ Select *pRhs = yymsp[0].minor.yy637;
+ Select *pLhs = yymsp[-2].minor.yy637;
if( pRhs && pRhs->pPrior ){
SrcList *pFrom;
Token x;
@@ -181026,60 +180923,60 @@ static YYACTIONTYPE yy_reduce(
pRhs = sqlite3SelectNew(pParse,0,pFrom,0,0,0,0,0,0);
}
if( pRhs ){
- pRhs->op = (u8)yymsp[-1].minor.yy220;
+ pRhs->op = (u8)yymsp[-1].minor.yy502;
pRhs->pPrior = pLhs;
if( ALWAYS(pLhs) ) pLhs->selFlags &= ~SF_MultiValue;
pRhs->selFlags &= ~SF_MultiValue;
- if( yymsp[-1].minor.yy220!=TK_ALL ) pParse->hasCompound = 1;
+ if( yymsp[-1].minor.yy502!=TK_ALL ) pParse->hasCompound = 1;
}else{
sqlite3SelectDelete(pParse->db, pLhs);
}
- yymsp[-2].minor.yy99 = pRhs;
+ yymsp[-2].minor.yy637 = pRhs;
}
break;
case 89: /* multiselect_op ::= UNION */
case 91: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==91);
-{yymsp[0].minor.yy220 = yymsp[0].major; /*A-overwrites-OP*/}
+{yymsp[0].minor.yy502 = yymsp[0].major; /*A-overwrites-OP*/}
break;
case 90: /* multiselect_op ::= UNION ALL */
-{yymsp[-1].minor.yy220 = TK_ALL;}
+{yymsp[-1].minor.yy502 = TK_ALL;}
break;
case 92: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
{
- yymsp[-8].minor.yy99 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy250,yymsp[-5].minor.yy43,yymsp[-4].minor.yy530,yymsp[-3].minor.yy250,yymsp[-2].minor.yy530,yymsp[-1].minor.yy250,yymsp[-7].minor.yy220,yymsp[0].minor.yy530);
+ yymsp[-8].minor.yy637 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy402,yymsp[-5].minor.yy563,yymsp[-4].minor.yy590,yymsp[-3].minor.yy402,yymsp[-2].minor.yy590,yymsp[-1].minor.yy402,yymsp[-7].minor.yy502,yymsp[0].minor.yy590);
}
break;
case 93: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */
{
- yymsp[-9].minor.yy99 = sqlite3SelectNew(pParse,yymsp[-7].minor.yy250,yymsp[-6].minor.yy43,yymsp[-5].minor.yy530,yymsp[-4].minor.yy250,yymsp[-3].minor.yy530,yymsp[-1].minor.yy250,yymsp[-8].minor.yy220,yymsp[0].minor.yy530);
- if( yymsp[-9].minor.yy99 ){
- yymsp[-9].minor.yy99->pWinDefn = yymsp[-2].minor.yy459;
+ yymsp[-9].minor.yy637 = sqlite3SelectNew(pParse,yymsp[-7].minor.yy402,yymsp[-6].minor.yy563,yymsp[-5].minor.yy590,yymsp[-4].minor.yy402,yymsp[-3].minor.yy590,yymsp[-1].minor.yy402,yymsp[-8].minor.yy502,yymsp[0].minor.yy590);
+ if( yymsp[-9].minor.yy637 ){
+ yymsp[-9].minor.yy637->pWinDefn = yymsp[-2].minor.yy483;
}else{
- sqlite3WindowListDelete(pParse->db, yymsp[-2].minor.yy459);
+ sqlite3WindowListDelete(pParse->db, yymsp[-2].minor.yy483);
}
}
break;
case 94: /* values ::= VALUES LP nexprlist RP */
{
- yymsp[-3].minor.yy99 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy250,0,0,0,0,0,SF_Values,0);
+ yymsp[-3].minor.yy637 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy402,0,0,0,0,0,SF_Values,0);
}
break;
case 95: /* oneselect ::= mvalues */
{
- sqlite3MultiValuesEnd(pParse, yymsp[0].minor.yy99);
+ sqlite3MultiValuesEnd(pParse, yymsp[0].minor.yy637);
}
break;
case 96: /* mvalues ::= values COMMA LP nexprlist RP */
case 97: /* mvalues ::= mvalues COMMA LP nexprlist RP */ yytestcase(yyruleno==97);
{
- yymsp[-4].minor.yy99 = sqlite3MultiValues(pParse, yymsp[-4].minor.yy99, yymsp[-1].minor.yy250);
+ yymsp[-4].minor.yy637 = sqlite3MultiValues(pParse, yymsp[-4].minor.yy637, yymsp[-1].minor.yy402);
}
break;
case 98: /* distinct ::= DISTINCT */
-{yymsp[0].minor.yy220 = SF_Distinct;}
+{yymsp[0].minor.yy502 = SF_Distinct;}
break;
case 99: /* distinct ::= ALL */
-{yymsp[0].minor.yy220 = SF_All;}
+{yymsp[0].minor.yy502 = SF_All;}
break;
case 101: /* sclp ::= */
case 134: /* orderby_opt ::= */ yytestcase(yyruleno==134);
@@ -181087,20 +180984,20 @@ static YYACTIONTYPE yy_reduce(
case 234: /* exprlist ::= */ yytestcase(yyruleno==234);
case 237: /* paren_exprlist ::= */ yytestcase(yyruleno==237);
case 242: /* eidlist_opt ::= */ yytestcase(yyruleno==242);
-{yymsp[1].minor.yy250 = 0;}
+{yymsp[1].minor.yy402 = 0;}
break;
case 102: /* selcollist ::= sclp scanpt expr scanpt as */
{
- yymsp[-4].minor.yy250 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy250, yymsp[-2].minor.yy530);
- if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy250, &yymsp[0].minor.yy0, 1);
- sqlite3ExprListSetSpan(pParse,yymsp[-4].minor.yy250,yymsp[-3].minor.yy192,yymsp[-1].minor.yy192);
+ yymsp[-4].minor.yy402 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy402, yymsp[-2].minor.yy590);
+ if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy402, &yymsp[0].minor.yy0, 1);
+ sqlite3ExprListSetSpan(pParse,yymsp[-4].minor.yy402,yymsp[-3].minor.yy342,yymsp[-1].minor.yy342);
}
break;
case 103: /* selcollist ::= sclp scanpt STAR */
{
Expr *p = sqlite3Expr(pParse->db, TK_ASTERISK, 0);
sqlite3ExprSetErrorOffset(p, (int)(yymsp[0].minor.yy0.z - pParse->zTail));
- yymsp[-2].minor.yy250 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy250, p);
+ yymsp[-2].minor.yy402 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy402, p);
}
break;
case 104: /* selcollist ::= sclp scanpt nm DOT STAR */
@@ -181110,7 +181007,7 @@ static YYACTIONTYPE yy_reduce(
sqlite3ExprSetErrorOffset(pRight, (int)(yymsp[0].minor.yy0.z - pParse->zTail));
pLeft = tokenExpr(pParse, TK_ID, yymsp[-2].minor.yy0);
pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight);
- yymsp[-4].minor.yy250 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy250, pDot);
+ yymsp[-4].minor.yy402 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy402, pDot);
}
break;
case 105: /* as ::= AS nm */
@@ -181121,50 +181018,50 @@ static YYACTIONTYPE yy_reduce(
break;
case 107: /* from ::= */
case 110: /* stl_prefix ::= */ yytestcase(yyruleno==110);
-{yymsp[1].minor.yy43 = 0;}
+{yymsp[1].minor.yy563 = 0;}
break;
case 108: /* from ::= FROM seltablist */
{
- yymsp[-1].minor.yy43 = yymsp[0].minor.yy43;
- sqlite3SrcListShiftJoinType(pParse,yymsp[-1].minor.yy43);
+ yymsp[-1].minor.yy563 = yymsp[0].minor.yy563;
+ sqlite3SrcListShiftJoinType(pParse,yymsp[-1].minor.yy563);
}
break;
case 109: /* stl_prefix ::= seltablist joinop */
{
- if( ALWAYS(yymsp[-1].minor.yy43 && yymsp[-1].minor.yy43->nSrc>0) ) yymsp[-1].minor.yy43->a[yymsp[-1].minor.yy43->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy220;
+ if( ALWAYS(yymsp[-1].minor.yy563 && yymsp[-1].minor.yy563->nSrc>0) ) yymsp[-1].minor.yy563->a[yymsp[-1].minor.yy563->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy502;
}
break;
case 111: /* seltablist ::= stl_prefix nm dbnm as on_using */
{
- yymsp[-4].minor.yy43 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-4].minor.yy43,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0,&yymsp[0].minor.yy425);
+ yymsp[-4].minor.yy563 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-4].minor.yy563,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0,&yymsp[0].minor.yy421);
}
break;
case 112: /* seltablist ::= stl_prefix nm dbnm as indexed_by on_using */
{
- yymsp[-5].minor.yy43 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy43,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,0,&yymsp[0].minor.yy425);
- sqlite3SrcListIndexedBy(pParse, yymsp[-5].minor.yy43, &yymsp[-1].minor.yy0);
+ yymsp[-5].minor.yy563 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy563,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,0,&yymsp[0].minor.yy421);
+ sqlite3SrcListIndexedBy(pParse, yymsp[-5].minor.yy563, &yymsp[-1].minor.yy0);
}
break;
case 113: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_using */
{
- yymsp[-7].minor.yy43 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-7].minor.yy43,&yymsp[-6].minor.yy0,&yymsp[-5].minor.yy0,&yymsp[-1].minor.yy0,0,&yymsp[0].minor.yy425);
- sqlite3SrcListFuncArgs(pParse, yymsp[-7].minor.yy43, yymsp[-3].minor.yy250);
+ yymsp[-7].minor.yy563 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-7].minor.yy563,&yymsp[-6].minor.yy0,&yymsp[-5].minor.yy0,&yymsp[-1].minor.yy0,0,&yymsp[0].minor.yy421);
+ sqlite3SrcListFuncArgs(pParse, yymsp[-7].minor.yy563, yymsp[-3].minor.yy402);
}
break;
case 114: /* seltablist ::= stl_prefix LP select RP as on_using */
{
- yymsp[-5].minor.yy43 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy43,0,0,&yymsp[-1].minor.yy0,yymsp[-3].minor.yy99,&yymsp[0].minor.yy425);
+ yymsp[-5].minor.yy563 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy563,0,0,&yymsp[-1].minor.yy0,yymsp[-3].minor.yy637,&yymsp[0].minor.yy421);
}
break;
case 115: /* seltablist ::= stl_prefix LP seltablist RP as on_using */
{
- if( yymsp[-5].minor.yy43==0 && yymsp[-1].minor.yy0.n==0 && yymsp[0].minor.yy425.pOn==0 && yymsp[0].minor.yy425.pUsing==0 ){
- yymsp[-5].minor.yy43 = yymsp[-3].minor.yy43;
- }else if( ALWAYS(yymsp[-3].minor.yy43!=0) && yymsp[-3].minor.yy43->nSrc==1 ){
- yymsp[-5].minor.yy43 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy43,0,0,&yymsp[-1].minor.yy0,0,&yymsp[0].minor.yy425);
- if( yymsp[-5].minor.yy43 ){
- SrcItem *pNew = &yymsp[-5].minor.yy43->a[yymsp[-5].minor.yy43->nSrc-1];
- SrcItem *pOld = yymsp[-3].minor.yy43->a;
+ if( yymsp[-5].minor.yy563==0 && yymsp[-1].minor.yy0.n==0 && yymsp[0].minor.yy421.pOn==0 && yymsp[0].minor.yy421.pUsing==0 ){
+ yymsp[-5].minor.yy563 = yymsp[-3].minor.yy563;
+ }else if( ALWAYS(yymsp[-3].minor.yy563!=0) && yymsp[-3].minor.yy563->nSrc==1 ){
+ yymsp[-5].minor.yy563 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy563,0,0,&yymsp[-1].minor.yy0,0,&yymsp[0].minor.yy421);
+ if( yymsp[-5].minor.yy563 ){
+ SrcItem *pNew = &yymsp[-5].minor.yy563->a[yymsp[-5].minor.yy563->nSrc-1];
+ SrcItem *pOld = yymsp[-3].minor.yy563->a;
assert( pOld->fg.fixedSchema==0 );
pNew->zName = pOld->zName;
assert( pOld->fg.fixedSchema==0 );
@@ -181189,12 +181086,12 @@ static YYACTIONTYPE yy_reduce(
}
pOld->zName = 0;
}
- sqlite3SrcListDelete(pParse->db, yymsp[-3].minor.yy43);
+ sqlite3SrcListDelete(pParse->db, yymsp[-3].minor.yy563);
}else{
Select *pSubquery;
- sqlite3SrcListShiftJoinType(pParse,yymsp[-3].minor.yy43);
- pSubquery = sqlite3SelectNew(pParse,0,yymsp[-3].minor.yy43,0,0,0,0,SF_NestedFrom,0);
- yymsp[-5].minor.yy43 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy43,0,0,&yymsp[-1].minor.yy0,pSubquery,&yymsp[0].minor.yy425);
+ sqlite3SrcListShiftJoinType(pParse,yymsp[-3].minor.yy563);
+ pSubquery = sqlite3SelectNew(pParse,0,yymsp[-3].minor.yy563,0,0,0,0,SF_NestedFrom,0);
+ yymsp[-5].minor.yy563 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy563,0,0,&yymsp[-1].minor.yy0,pSubquery,&yymsp[0].minor.yy421);
}
}
break;
@@ -181204,56 +181101,56 @@ static YYACTIONTYPE yy_reduce(
break;
case 118: /* fullname ::= nm */
{
- yylhsminor.yy43 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0);
- if( IN_RENAME_OBJECT && yylhsminor.yy43 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy43->a[0].zName, &yymsp[0].minor.yy0);
+ yylhsminor.yy563 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0);
+ if( IN_RENAME_OBJECT && yylhsminor.yy563 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy563->a[0].zName, &yymsp[0].minor.yy0);
}
- yymsp[0].minor.yy43 = yylhsminor.yy43;
+ yymsp[0].minor.yy563 = yylhsminor.yy563;
break;
case 119: /* fullname ::= nm DOT nm */
{
- yylhsminor.yy43 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0);
- if( IN_RENAME_OBJECT && yylhsminor.yy43 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy43->a[0].zName, &yymsp[0].minor.yy0);
+ yylhsminor.yy563 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0);
+ if( IN_RENAME_OBJECT && yylhsminor.yy563 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy563->a[0].zName, &yymsp[0].minor.yy0);
}
- yymsp[-2].minor.yy43 = yylhsminor.yy43;
+ yymsp[-2].minor.yy563 = yylhsminor.yy563;
break;
case 120: /* xfullname ::= nm */
-{yymsp[0].minor.yy43 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0); /*A-overwrites-X*/}
+{yymsp[0].minor.yy563 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0); /*A-overwrites-X*/}
break;
case 121: /* xfullname ::= nm DOT nm */
-{yymsp[-2].minor.yy43 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/}
+{yymsp[-2].minor.yy563 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/}
break;
case 122: /* xfullname ::= nm DOT nm AS nm */
{
- yymsp[-4].minor.yy43 = sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,&yymsp[-2].minor.yy0); /*A-overwrites-X*/
- if( yymsp[-4].minor.yy43 ) yymsp[-4].minor.yy43->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0);
+ yymsp[-4].minor.yy563 = sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,&yymsp[-2].minor.yy0); /*A-overwrites-X*/
+ if( yymsp[-4].minor.yy563 ) yymsp[-4].minor.yy563->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0);
}
break;
case 123: /* xfullname ::= nm AS nm */
{
- yymsp[-2].minor.yy43 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,0); /*A-overwrites-X*/
- if( yymsp[-2].minor.yy43 ) yymsp[-2].minor.yy43->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0);
+ yymsp[-2].minor.yy563 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,0); /*A-overwrites-X*/
+ if( yymsp[-2].minor.yy563 ) yymsp[-2].minor.yy563->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0);
}
break;
case 124: /* joinop ::= COMMA|JOIN */
-{ yymsp[0].minor.yy220 = JT_INNER; }
+{ yymsp[0].minor.yy502 = JT_INNER; }
break;
case 125: /* joinop ::= JOIN_KW JOIN */
-{yymsp[-1].minor.yy220 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); /*X-overwrites-A*/}
+{yymsp[-1].minor.yy502 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); /*X-overwrites-A*/}
break;
case 126: /* joinop ::= JOIN_KW nm JOIN */
-{yymsp[-2].minor.yy220 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/}
+{yymsp[-2].minor.yy502 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/}
break;
case 127: /* joinop ::= JOIN_KW nm nm JOIN */
-{yymsp[-3].minor.yy220 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/}
+{yymsp[-3].minor.yy502 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/}
break;
case 128: /* on_using ::= ON expr */
-{yymsp[-1].minor.yy425.pOn = yymsp[0].minor.yy530; yymsp[-1].minor.yy425.pUsing = 0;}
+{yymsp[-1].minor.yy421.pOn = yymsp[0].minor.yy590; yymsp[-1].minor.yy421.pUsing = 0;}
break;
case 129: /* on_using ::= USING LP idlist RP */
-{yymsp[-3].minor.yy425.pOn = 0; yymsp[-3].minor.yy425.pUsing = yymsp[-1].minor.yy96;}
+{yymsp[-3].minor.yy421.pOn = 0; yymsp[-3].minor.yy421.pUsing = yymsp[-1].minor.yy204;}
break;
case 130: /* on_using ::= */
-{yymsp[1].minor.yy425.pOn = 0; yymsp[1].minor.yy425.pUsing = 0;}
+{yymsp[1].minor.yy421.pOn = 0; yymsp[1].minor.yy421.pUsing = 0;}
break;
case 132: /* indexed_by ::= INDEXED BY nm */
{yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;}
@@ -181263,35 +181160,35 @@ static YYACTIONTYPE yy_reduce(
break;
case 135: /* orderby_opt ::= ORDER BY sortlist */
case 145: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==145);
-{yymsp[-2].minor.yy250 = yymsp[0].minor.yy250;}
+{yymsp[-2].minor.yy402 = yymsp[0].minor.yy402;}
break;
case 136: /* sortlist ::= sortlist COMMA expr sortorder nulls */
{
- yymsp[-4].minor.yy250 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy250,yymsp[-2].minor.yy530);
- sqlite3ExprListSetSortOrder(yymsp[-4].minor.yy250,yymsp[-1].minor.yy220,yymsp[0].minor.yy220);
+ yymsp[-4].minor.yy402 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy402,yymsp[-2].minor.yy590);
+ sqlite3ExprListSetSortOrder(yymsp[-4].minor.yy402,yymsp[-1].minor.yy502,yymsp[0].minor.yy502);
}
break;
case 137: /* sortlist ::= expr sortorder nulls */
{
- yymsp[-2].minor.yy250 = sqlite3ExprListAppend(pParse,0,yymsp[-2].minor.yy530); /*A-overwrites-Y*/
- sqlite3ExprListSetSortOrder(yymsp[-2].minor.yy250,yymsp[-1].minor.yy220,yymsp[0].minor.yy220);
+ yymsp[-2].minor.yy402 = sqlite3ExprListAppend(pParse,0,yymsp[-2].minor.yy590); /*A-overwrites-Y*/
+ sqlite3ExprListSetSortOrder(yymsp[-2].minor.yy402,yymsp[-1].minor.yy502,yymsp[0].minor.yy502);
}
break;
case 138: /* sortorder ::= ASC */
-{yymsp[0].minor.yy220 = SQLITE_SO_ASC;}
+{yymsp[0].minor.yy502 = SQLITE_SO_ASC;}
break;
case 139: /* sortorder ::= DESC */
-{yymsp[0].minor.yy220 = SQLITE_SO_DESC;}
+{yymsp[0].minor.yy502 = SQLITE_SO_DESC;}
break;
case 140: /* sortorder ::= */
case 143: /* nulls ::= */ yytestcase(yyruleno==143);
-{yymsp[1].minor.yy220 = SQLITE_SO_UNDEFINED;}
+{yymsp[1].minor.yy502 = SQLITE_SO_UNDEFINED;}
break;
case 141: /* nulls ::= NULLS FIRST */
-{yymsp[-1].minor.yy220 = SQLITE_SO_ASC;}
+{yymsp[-1].minor.yy502 = SQLITE_SO_ASC;}
break;
case 142: /* nulls ::= NULLS LAST */
-{yymsp[-1].minor.yy220 = SQLITE_SO_DESC;}
+{yymsp[-1].minor.yy502 = SQLITE_SO_DESC;}
break;
case 146: /* having_opt ::= */
case 148: /* limit_opt ::= */ yytestcase(yyruleno==148);
@@ -181300,48 +181197,48 @@ static YYACTIONTYPE yy_reduce(
case 232: /* case_else ::= */ yytestcase(yyruleno==232);
case 233: /* case_operand ::= */ yytestcase(yyruleno==233);
case 252: /* vinto ::= */ yytestcase(yyruleno==252);
-{yymsp[1].minor.yy530 = 0;}
+{yymsp[1].minor.yy590 = 0;}
break;
case 147: /* having_opt ::= HAVING expr */
case 154: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==154);
case 156: /* where_opt_ret ::= WHERE expr */ yytestcase(yyruleno==156);
case 231: /* case_else ::= ELSE expr */ yytestcase(yyruleno==231);
case 251: /* vinto ::= INTO expr */ yytestcase(yyruleno==251);
-{yymsp[-1].minor.yy530 = yymsp[0].minor.yy530;}
+{yymsp[-1].minor.yy590 = yymsp[0].minor.yy590;}
break;
case 149: /* limit_opt ::= LIMIT expr */
-{yymsp[-1].minor.yy530 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy530,0);}
+{yymsp[-1].minor.yy590 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy590,0);}
break;
case 150: /* limit_opt ::= LIMIT expr OFFSET expr */
-{yymsp[-3].minor.yy530 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[-2].minor.yy530,yymsp[0].minor.yy530);}
+{yymsp[-3].minor.yy590 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[-2].minor.yy590,yymsp[0].minor.yy590);}
break;
case 151: /* limit_opt ::= LIMIT expr COMMA expr */
-{yymsp[-3].minor.yy530 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy530,yymsp[-2].minor.yy530);}
+{yymsp[-3].minor.yy590 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy590,yymsp[-2].minor.yy590);}
break;
case 152: /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret orderby_opt limit_opt */
{
- sqlite3SrcListIndexedBy(pParse, yymsp[-4].minor.yy43, &yymsp[-3].minor.yy0);
+ sqlite3SrcListIndexedBy(pParse, yymsp[-4].minor.yy563, &yymsp[-3].minor.yy0);
#ifndef SQLITE_ENABLE_UPDATE_DELETE_LIMIT
- if( yymsp[-1].minor.yy250 || yymsp[0].minor.yy530 ){
- updateDeleteLimitError(pParse,yymsp[-1].minor.yy250,yymsp[0].minor.yy530);
- yymsp[-1].minor.yy250 = 0;
- yymsp[0].minor.yy530 = 0;
+ if( yymsp[-1].minor.yy402 || yymsp[0].minor.yy590 ){
+ updateDeleteLimitError(pParse,yymsp[-1].minor.yy402,yymsp[0].minor.yy590);
+ yymsp[-1].minor.yy402 = 0;
+ yymsp[0].minor.yy590 = 0;
}
#endif
- sqlite3DeleteFrom(pParse,yymsp[-4].minor.yy43,yymsp[-2].minor.yy530,yymsp[-1].minor.yy250,yymsp[0].minor.yy530);
+ sqlite3DeleteFrom(pParse,yymsp[-4].minor.yy563,yymsp[-2].minor.yy590,yymsp[-1].minor.yy402,yymsp[0].minor.yy590);
}
break;
case 157: /* where_opt_ret ::= RETURNING selcollist */
-{sqlite3AddReturning(pParse,yymsp[0].minor.yy250); yymsp[-1].minor.yy530 = 0;}
+{sqlite3AddReturning(pParse,yymsp[0].minor.yy402); yymsp[-1].minor.yy590 = 0;}
break;
case 158: /* where_opt_ret ::= WHERE expr RETURNING selcollist */
-{sqlite3AddReturning(pParse,yymsp[0].minor.yy250); yymsp[-3].minor.yy530 = yymsp[-2].minor.yy530;}
+{sqlite3AddReturning(pParse,yymsp[0].minor.yy402); yymsp[-3].minor.yy590 = yymsp[-2].minor.yy590;}
break;
case 159: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret orderby_opt limit_opt */
{
- sqlite3SrcListIndexedBy(pParse, yymsp[-7].minor.yy43, &yymsp[-6].minor.yy0);
- if( yymsp[-3].minor.yy43 ){
- SrcList *pFromClause = yymsp[-3].minor.yy43;
+ sqlite3SrcListIndexedBy(pParse, yymsp[-7].minor.yy563, &yymsp[-6].minor.yy0);
+ if( yymsp[-3].minor.yy563 ){
+ SrcList *pFromClause = yymsp[-3].minor.yy563;
if( pFromClause->nSrc>1 ){
Select *pSubquery;
Token as;
@@ -181350,98 +181247,98 @@ static YYACTIONTYPE yy_reduce(
as.z = 0;
pFromClause = sqlite3SrcListAppendFromTerm(pParse,0,0,0,&as,pSubquery,0);
}
- yymsp[-7].minor.yy43 = sqlite3SrcListAppendList(pParse, yymsp[-7].minor.yy43, pFromClause);
+ yymsp[-7].minor.yy563 = sqlite3SrcListAppendList(pParse, yymsp[-7].minor.yy563, pFromClause);
}
- sqlite3ExprListCheckLength(pParse,yymsp[-4].minor.yy250,"set list");
+ sqlite3ExprListCheckLength(pParse,yymsp[-4].minor.yy402,"set list");
#ifndef SQLITE_ENABLE_UPDATE_DELETE_LIMIT
- if( yymsp[-1].minor.yy250 || yymsp[0].minor.yy530 ){
- updateDeleteLimitError(pParse,yymsp[-1].minor.yy250,yymsp[0].minor.yy530);
- yymsp[-1].minor.yy250 = 0;
- yymsp[0].minor.yy530 = 0;
+ if( yymsp[-1].minor.yy402 || yymsp[0].minor.yy590 ){
+ updateDeleteLimitError(pParse,yymsp[-1].minor.yy402,yymsp[0].minor.yy590);
+ yymsp[-1].minor.yy402 = 0;
+ yymsp[0].minor.yy590 = 0;
}
#endif
- sqlite3Update(pParse,yymsp[-7].minor.yy43,yymsp[-4].minor.yy250,yymsp[-2].minor.yy530,yymsp[-8].minor.yy220,yymsp[-1].minor.yy250,yymsp[0].minor.yy530,0);
+ sqlite3Update(pParse,yymsp[-7].minor.yy563,yymsp[-4].minor.yy402,yymsp[-2].minor.yy590,yymsp[-8].minor.yy502,yymsp[-1].minor.yy402,yymsp[0].minor.yy590,0);
}
break;
case 160: /* setlist ::= setlist COMMA nm EQ expr */
{
- yymsp[-4].minor.yy250 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy250, yymsp[0].minor.yy530);
- sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy250, &yymsp[-2].minor.yy0, 1);
+ yymsp[-4].minor.yy402 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy402, yymsp[0].minor.yy590);
+ sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy402, &yymsp[-2].minor.yy0, 1);
}
break;
case 161: /* setlist ::= setlist COMMA LP idlist RP EQ expr */
{
- yymsp[-6].minor.yy250 = sqlite3ExprListAppendVector(pParse, yymsp[-6].minor.yy250, yymsp[-3].minor.yy96, yymsp[0].minor.yy530);
+ yymsp[-6].minor.yy402 = sqlite3ExprListAppendVector(pParse, yymsp[-6].minor.yy402, yymsp[-3].minor.yy204, yymsp[0].minor.yy590);
}
break;
case 162: /* setlist ::= nm EQ expr */
{
- yylhsminor.yy250 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy530);
- sqlite3ExprListSetName(pParse, yylhsminor.yy250, &yymsp[-2].minor.yy0, 1);
+ yylhsminor.yy402 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy590);
+ sqlite3ExprListSetName(pParse, yylhsminor.yy402, &yymsp[-2].minor.yy0, 1);
}
- yymsp[-2].minor.yy250 = yylhsminor.yy250;
+ yymsp[-2].minor.yy402 = yylhsminor.yy402;
break;
case 163: /* setlist ::= LP idlist RP EQ expr */
{
- yymsp[-4].minor.yy250 = sqlite3ExprListAppendVector(pParse, 0, yymsp[-3].minor.yy96, yymsp[0].minor.yy530);
+ yymsp[-4].minor.yy402 = sqlite3ExprListAppendVector(pParse, 0, yymsp[-3].minor.yy204, yymsp[0].minor.yy590);
}
break;
case 164: /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
{
- sqlite3Insert(pParse, yymsp[-3].minor.yy43, yymsp[-1].minor.yy99, yymsp[-2].minor.yy96, yymsp[-5].minor.yy220, yymsp[0].minor.yy642);
+ sqlite3Insert(pParse, yymsp[-3].minor.yy563, yymsp[-1].minor.yy637, yymsp[-2].minor.yy204, yymsp[-5].minor.yy502, yymsp[0].minor.yy403);
}
break;
case 165: /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */
{
- sqlite3Insert(pParse, yymsp[-4].minor.yy43, 0, yymsp[-3].minor.yy96, yymsp[-6].minor.yy220, 0);
+ sqlite3Insert(pParse, yymsp[-4].minor.yy563, 0, yymsp[-3].minor.yy204, yymsp[-6].minor.yy502, 0);
}
break;
case 166: /* upsert ::= */
-{ yymsp[1].minor.yy642 = 0; }
+{ yymsp[1].minor.yy403 = 0; }
break;
case 167: /* upsert ::= RETURNING selcollist */
-{ yymsp[-1].minor.yy642 = 0; sqlite3AddReturning(pParse,yymsp[0].minor.yy250); }
+{ yymsp[-1].minor.yy403 = 0; sqlite3AddReturning(pParse,yymsp[0].minor.yy402); }
break;
case 168: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */
-{ yymsp[-11].minor.yy642 = sqlite3UpsertNew(pParse->db,yymsp[-8].minor.yy250,yymsp[-6].minor.yy530,yymsp[-2].minor.yy250,yymsp[-1].minor.yy530,yymsp[0].minor.yy642);}
+{ yymsp[-11].minor.yy403 = sqlite3UpsertNew(pParse->db,yymsp[-8].minor.yy402,yymsp[-6].minor.yy590,yymsp[-2].minor.yy402,yymsp[-1].minor.yy590,yymsp[0].minor.yy403);}
break;
case 169: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */
-{ yymsp[-8].minor.yy642 = sqlite3UpsertNew(pParse->db,yymsp[-5].minor.yy250,yymsp[-3].minor.yy530,0,0,yymsp[0].minor.yy642); }
+{ yymsp[-8].minor.yy403 = sqlite3UpsertNew(pParse->db,yymsp[-5].minor.yy402,yymsp[-3].minor.yy590,0,0,yymsp[0].minor.yy403); }
break;
case 170: /* upsert ::= ON CONFLICT DO NOTHING returning */
-{ yymsp[-4].minor.yy642 = sqlite3UpsertNew(pParse->db,0,0,0,0,0); }
+{ yymsp[-4].minor.yy403 = sqlite3UpsertNew(pParse->db,0,0,0,0,0); }
break;
case 171: /* upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */
-{ yymsp[-7].minor.yy642 = sqlite3UpsertNew(pParse->db,0,0,yymsp[-2].minor.yy250,yymsp[-1].minor.yy530,0);}
+{ yymsp[-7].minor.yy403 = sqlite3UpsertNew(pParse->db,0,0,yymsp[-2].minor.yy402,yymsp[-1].minor.yy590,0);}
break;
case 172: /* returning ::= RETURNING selcollist */
-{sqlite3AddReturning(pParse,yymsp[0].minor.yy250);}
+{sqlite3AddReturning(pParse,yymsp[0].minor.yy402);}
break;
case 175: /* idlist_opt ::= */
-{yymsp[1].minor.yy96 = 0;}
+{yymsp[1].minor.yy204 = 0;}
break;
case 176: /* idlist_opt ::= LP idlist RP */
-{yymsp[-2].minor.yy96 = yymsp[-1].minor.yy96;}
+{yymsp[-2].minor.yy204 = yymsp[-1].minor.yy204;}
break;
case 177: /* idlist ::= idlist COMMA nm */
-{yymsp[-2].minor.yy96 = sqlite3IdListAppend(pParse,yymsp[-2].minor.yy96,&yymsp[0].minor.yy0);}
+{yymsp[-2].minor.yy204 = sqlite3IdListAppend(pParse,yymsp[-2].minor.yy204,&yymsp[0].minor.yy0);}
break;
case 178: /* idlist ::= nm */
-{yymsp[0].minor.yy96 = sqlite3IdListAppend(pParse,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/}
+{yymsp[0].minor.yy204 = sqlite3IdListAppend(pParse,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/}
break;
case 179: /* expr ::= LP expr RP */
-{yymsp[-2].minor.yy530 = yymsp[-1].minor.yy530;}
+{yymsp[-2].minor.yy590 = yymsp[-1].minor.yy590;}
break;
case 180: /* expr ::= ID|INDEXED|JOIN_KW */
-{yymsp[0].minor.yy530=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/}
+{yymsp[0].minor.yy590=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/}
break;
case 181: /* expr ::= nm DOT nm */
{
Expr *temp1 = tokenExpr(pParse,TK_ID,yymsp[-2].minor.yy0);
Expr *temp2 = tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0);
- yylhsminor.yy530 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2);
+ yylhsminor.yy590 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2);
}
- yymsp[-2].minor.yy530 = yylhsminor.yy530;
+ yymsp[-2].minor.yy590 = yylhsminor.yy590;
break;
case 182: /* expr ::= nm DOT nm DOT nm */
{
@@ -181452,27 +181349,27 @@ static YYACTIONTYPE yy_reduce(
if( IN_RENAME_OBJECT ){
sqlite3RenameTokenRemap(pParse, 0, temp1);
}
- yylhsminor.yy530 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4);
+ yylhsminor.yy590 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4);
}
- yymsp[-4].minor.yy530 = yylhsminor.yy530;
+ yymsp[-4].minor.yy590 = yylhsminor.yy590;
break;
case 183: /* term ::= NULL|FLOAT|BLOB */
case 184: /* term ::= STRING */ yytestcase(yyruleno==184);
-{yymsp[0].minor.yy530=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/}
+{yymsp[0].minor.yy590=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/}
break;
case 185: /* term ::= INTEGER */
{
- yylhsminor.yy530 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1);
- if( yylhsminor.yy530 ) yylhsminor.yy530->w.iOfst = (int)(yymsp[0].minor.yy0.z - pParse->zTail);
+ yylhsminor.yy590 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1);
+ if( yylhsminor.yy590 ) yylhsminor.yy590->w.iOfst = (int)(yymsp[0].minor.yy0.z - pParse->zTail);
}
- yymsp[0].minor.yy530 = yylhsminor.yy530;
+ yymsp[0].minor.yy590 = yylhsminor.yy590;
break;
case 186: /* expr ::= VARIABLE */
{
if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){
u32 n = yymsp[0].minor.yy0.n;
- yymsp[0].minor.yy530 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0);
- sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy530, n);
+ yymsp[0].minor.yy590 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0);
+ sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy590, n);
}else{
/* When doing a nested parse, one can include terms in an expression
** that look like this: #1 #2 ... These terms refer to registers
@@ -181481,80 +181378,80 @@ static YYACTIONTYPE yy_reduce(
assert( t.n>=2 );
if( pParse->nested==0 ){
parserSyntaxError(pParse, &t);
- yymsp[0].minor.yy530 = 0;
+ yymsp[0].minor.yy590 = 0;
}else{
- yymsp[0].minor.yy530 = sqlite3PExpr(pParse, TK_REGISTER, 0, 0);
- if( yymsp[0].minor.yy530 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy530->iTable);
+ yymsp[0].minor.yy590 = sqlite3PExpr(pParse, TK_REGISTER, 0, 0);
+ if( yymsp[0].minor.yy590 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy590->iTable);
}
}
}
break;
case 187: /* expr ::= expr COLLATE ID|STRING */
{
- yymsp[-2].minor.yy530 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy530, &yymsp[0].minor.yy0, 1);
+ yymsp[-2].minor.yy590 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy590, &yymsp[0].minor.yy0, 1);
}
break;
case 188: /* expr ::= CAST LP expr AS typetoken RP */
{
- yymsp[-5].minor.yy530 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1);
- sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy530, yymsp[-3].minor.yy530, 0);
+ yymsp[-5].minor.yy590 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1);
+ sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy590, yymsp[-3].minor.yy590, 0);
}
break;
case 189: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */
{
- yylhsminor.yy530 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy250, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy220);
+ yylhsminor.yy590 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy402, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy502);
}
- yymsp[-4].minor.yy530 = yylhsminor.yy530;
+ yymsp[-4].minor.yy590 = yylhsminor.yy590;
break;
case 190: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP */
{
- yylhsminor.yy530 = sqlite3ExprFunction(pParse, yymsp[-4].minor.yy250, &yymsp[-7].minor.yy0, yymsp[-5].minor.yy220);
- sqlite3ExprAddFunctionOrderBy(pParse, yylhsminor.yy530, yymsp[-1].minor.yy250);
+ yylhsminor.yy590 = sqlite3ExprFunction(pParse, yymsp[-4].minor.yy402, &yymsp[-7].minor.yy0, yymsp[-5].minor.yy502);
+ sqlite3ExprAddFunctionOrderBy(pParse, yylhsminor.yy590, yymsp[-1].minor.yy402);
}
- yymsp[-7].minor.yy530 = yylhsminor.yy530;
+ yymsp[-7].minor.yy590 = yylhsminor.yy590;
break;
case 191: /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP */
{
- yylhsminor.yy530 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0);
+ yylhsminor.yy590 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0);
}
- yymsp[-3].minor.yy530 = yylhsminor.yy530;
+ yymsp[-3].minor.yy590 = yylhsminor.yy590;
break;
case 192: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */
{
- yylhsminor.yy530 = sqlite3ExprFunction(pParse, yymsp[-2].minor.yy250, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy220);
- sqlite3WindowAttach(pParse, yylhsminor.yy530, yymsp[0].minor.yy459);
+ yylhsminor.yy590 = sqlite3ExprFunction(pParse, yymsp[-2].minor.yy402, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy502);
+ sqlite3WindowAttach(pParse, yylhsminor.yy590, yymsp[0].minor.yy483);
}
- yymsp[-5].minor.yy530 = yylhsminor.yy530;
+ yymsp[-5].minor.yy590 = yylhsminor.yy590;
break;
case 193: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP filter_over */
{
- yylhsminor.yy530 = sqlite3ExprFunction(pParse, yymsp[-5].minor.yy250, &yymsp[-8].minor.yy0, yymsp[-6].minor.yy220);
- sqlite3WindowAttach(pParse, yylhsminor.yy530, yymsp[0].minor.yy459);
- sqlite3ExprAddFunctionOrderBy(pParse, yylhsminor.yy530, yymsp[-2].minor.yy250);
+ yylhsminor.yy590 = sqlite3ExprFunction(pParse, yymsp[-5].minor.yy402, &yymsp[-8].minor.yy0, yymsp[-6].minor.yy502);
+ sqlite3WindowAttach(pParse, yylhsminor.yy590, yymsp[0].minor.yy483);
+ sqlite3ExprAddFunctionOrderBy(pParse, yylhsminor.yy590, yymsp[-2].minor.yy402);
}
- yymsp[-8].minor.yy530 = yylhsminor.yy530;
+ yymsp[-8].minor.yy590 = yylhsminor.yy590;
break;
case 194: /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */
{
- yylhsminor.yy530 = sqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0, 0);
- sqlite3WindowAttach(pParse, yylhsminor.yy530, yymsp[0].minor.yy459);
+ yylhsminor.yy590 = sqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0, 0);
+ sqlite3WindowAttach(pParse, yylhsminor.yy590, yymsp[0].minor.yy483);
}
- yymsp[-4].minor.yy530 = yylhsminor.yy530;
+ yymsp[-4].minor.yy590 = yylhsminor.yy590;
break;
case 195: /* term ::= CTIME_KW */
{
- yylhsminor.yy530 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0, 0);
+ yylhsminor.yy590 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0, 0);
}
- yymsp[0].minor.yy530 = yylhsminor.yy530;
+ yymsp[0].minor.yy590 = yylhsminor.yy590;
break;
case 196: /* expr ::= LP nexprlist COMMA expr RP */
{
- ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy250, yymsp[-1].minor.yy530);
- yymsp[-4].minor.yy530 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0);
- if( yymsp[-4].minor.yy530 ){
- yymsp[-4].minor.yy530->x.pList = pList;
+ ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy402, yymsp[-1].minor.yy590);
+ yymsp[-4].minor.yy590 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0);
+ if( yymsp[-4].minor.yy590 ){
+ yymsp[-4].minor.yy590->x.pList = pList;
if( ALWAYS(pList->nExpr) ){
- yymsp[-4].minor.yy530->flags |= pList->a[0].pExpr->flags & EP_Propagate;
+ yymsp[-4].minor.yy590->flags |= pList->a[0].pExpr->flags & EP_Propagate;
}
}else{
sqlite3ExprListDelete(pParse->db, pList);
@@ -181562,7 +181459,7 @@ static YYACTIONTYPE yy_reduce(
}
break;
case 197: /* expr ::= expr AND expr */
-{yymsp[-2].minor.yy530=sqlite3ExprAnd(pParse,yymsp[-2].minor.yy530,yymsp[0].minor.yy530);}
+{yymsp[-2].minor.yy590=sqlite3ExprAnd(pParse,yymsp[-2].minor.yy590,yymsp[0].minor.yy590);}
break;
case 198: /* expr ::= expr OR expr */
case 199: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==199);
@@ -181571,7 +181468,7 @@ static YYACTIONTYPE yy_reduce(
case 202: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==202);
case 203: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==203);
case 204: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==204);
-{yymsp[-2].minor.yy530=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy530,yymsp[0].minor.yy530);}
+{yymsp[-2].minor.yy590=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy590,yymsp[0].minor.yy590);}
break;
case 205: /* likeop ::= NOT LIKE_KW|MATCH */
{yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n|=0x80000000; /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/}
@@ -181581,11 +181478,11 @@ static YYACTIONTYPE yy_reduce(
ExprList *pList;
int bNot = yymsp[-1].minor.yy0.n & 0x80000000;
yymsp[-1].minor.yy0.n &= 0x7fffffff;
- pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy530);
- pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy530);
- yymsp[-2].minor.yy530 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
- if( bNot ) yymsp[-2].minor.yy530 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy530, 0);
- if( yymsp[-2].minor.yy530 ) yymsp[-2].minor.yy530->flags |= EP_InfixFunc;
+ pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy590);
+ pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy590);
+ yymsp[-2].minor.yy590 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
+ if( bNot ) yymsp[-2].minor.yy590 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy590, 0);
+ if( yymsp[-2].minor.yy590 ) yymsp[-2].minor.yy590->flags |= EP_InfixFunc;
}
break;
case 207: /* expr ::= expr likeop expr ESCAPE expr */
@@ -181593,91 +181490,91 @@ static YYACTIONTYPE yy_reduce(
ExprList *pList;
int bNot = yymsp[-3].minor.yy0.n & 0x80000000;
yymsp[-3].minor.yy0.n &= 0x7fffffff;
- pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy530);
- pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy530);
- pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy530);
- yymsp[-4].minor.yy530 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0);
- if( bNot ) yymsp[-4].minor.yy530 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy530, 0);
- if( yymsp[-4].minor.yy530 ) yymsp[-4].minor.yy530->flags |= EP_InfixFunc;
+ pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy590);
+ pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy590);
+ pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy590);
+ yymsp[-4].minor.yy590 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0);
+ if( bNot ) yymsp[-4].minor.yy590 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy590, 0);
+ if( yymsp[-4].minor.yy590 ) yymsp[-4].minor.yy590->flags |= EP_InfixFunc;
}
break;
case 208: /* expr ::= expr ISNULL|NOTNULL */
-{yymsp[-1].minor.yy530 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy530,0);}
+{yymsp[-1].minor.yy590 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy590,0);}
break;
case 209: /* expr ::= expr NOT NULL */
-{yymsp[-2].minor.yy530 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy530,0);}
+{yymsp[-2].minor.yy590 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy590,0);}
break;
case 210: /* expr ::= expr IS expr */
{
- yymsp[-2].minor.yy530 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy530,yymsp[0].minor.yy530);
- binaryToUnaryIfNull(pParse, yymsp[0].minor.yy530, yymsp[-2].minor.yy530, TK_ISNULL);
+ yymsp[-2].minor.yy590 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy590,yymsp[0].minor.yy590);
+ binaryToUnaryIfNull(pParse, yymsp[0].minor.yy590, yymsp[-2].minor.yy590, TK_ISNULL);
}
break;
case 211: /* expr ::= expr IS NOT expr */
{
- yymsp[-3].minor.yy530 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy530,yymsp[0].minor.yy530);
- binaryToUnaryIfNull(pParse, yymsp[0].minor.yy530, yymsp[-3].minor.yy530, TK_NOTNULL);
+ yymsp[-3].minor.yy590 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy590,yymsp[0].minor.yy590);
+ binaryToUnaryIfNull(pParse, yymsp[0].minor.yy590, yymsp[-3].minor.yy590, TK_NOTNULL);
}
break;
case 212: /* expr ::= expr IS NOT DISTINCT FROM expr */
{
- yymsp[-5].minor.yy530 = sqlite3PExpr(pParse,TK_IS,yymsp[-5].minor.yy530,yymsp[0].minor.yy530);
- binaryToUnaryIfNull(pParse, yymsp[0].minor.yy530, yymsp[-5].minor.yy530, TK_ISNULL);
+ yymsp[-5].minor.yy590 = sqlite3PExpr(pParse,TK_IS,yymsp[-5].minor.yy590,yymsp[0].minor.yy590);
+ binaryToUnaryIfNull(pParse, yymsp[0].minor.yy590, yymsp[-5].minor.yy590, TK_ISNULL);
}
break;
case 213: /* expr ::= expr IS DISTINCT FROM expr */
{
- yymsp[-4].minor.yy530 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-4].minor.yy530,yymsp[0].minor.yy530);
- binaryToUnaryIfNull(pParse, yymsp[0].minor.yy530, yymsp[-4].minor.yy530, TK_NOTNULL);
+ yymsp[-4].minor.yy590 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-4].minor.yy590,yymsp[0].minor.yy590);
+ binaryToUnaryIfNull(pParse, yymsp[0].minor.yy590, yymsp[-4].minor.yy590, TK_NOTNULL);
}
break;
case 214: /* expr ::= NOT expr */
case 215: /* expr ::= BITNOT expr */ yytestcase(yyruleno==215);
-{yymsp[-1].minor.yy530 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy530, 0);/*A-overwrites-B*/}
+{yymsp[-1].minor.yy590 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy590, 0);/*A-overwrites-B*/}
break;
case 216: /* expr ::= PLUS|MINUS expr */
{
- Expr *p = yymsp[0].minor.yy530;
+ Expr *p = yymsp[0].minor.yy590;
u8 op = yymsp[-1].major + (TK_UPLUS-TK_PLUS);
assert( TK_UPLUS>TK_PLUS );
assert( TK_UMINUS == TK_MINUS + (TK_UPLUS - TK_PLUS) );
if( p && p->op==TK_UPLUS ){
p->op = op;
- yymsp[-1].minor.yy530 = p;
+ yymsp[-1].minor.yy590 = p;
}else{
- yymsp[-1].minor.yy530 = sqlite3PExpr(pParse, op, p, 0);
+ yymsp[-1].minor.yy590 = sqlite3PExpr(pParse, op, p, 0);
/*A-overwrites-B*/
}
}
break;
case 217: /* expr ::= expr PTR expr */
{
- ExprList *pList = sqlite3ExprListAppend(pParse, 0, yymsp[-2].minor.yy530);
- pList = sqlite3ExprListAppend(pParse, pList, yymsp[0].minor.yy530);
- yylhsminor.yy530 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
+ ExprList *pList = sqlite3ExprListAppend(pParse, 0, yymsp[-2].minor.yy590);
+ pList = sqlite3ExprListAppend(pParse, pList, yymsp[0].minor.yy590);
+ yylhsminor.yy590 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
}
- yymsp[-2].minor.yy530 = yylhsminor.yy530;
+ yymsp[-2].minor.yy590 = yylhsminor.yy590;
break;
case 218: /* between_op ::= BETWEEN */
case 221: /* in_op ::= IN */ yytestcase(yyruleno==221);
-{yymsp[0].minor.yy220 = 0;}
+{yymsp[0].minor.yy502 = 0;}
break;
case 220: /* expr ::= expr between_op expr AND expr */
{
- ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy530);
- pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy530);
- yymsp[-4].minor.yy530 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy530, 0);
- if( yymsp[-4].minor.yy530 ){
- yymsp[-4].minor.yy530->x.pList = pList;
+ ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy590);
+ pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy590);
+ yymsp[-4].minor.yy590 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy590, 0);
+ if( yymsp[-4].minor.yy590 ){
+ yymsp[-4].minor.yy590->x.pList = pList;
}else{
sqlite3ExprListDelete(pParse->db, pList);
}
- if( yymsp[-3].minor.yy220 ) yymsp[-4].minor.yy530 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy530, 0);
+ if( yymsp[-3].minor.yy502 ) yymsp[-4].minor.yy590 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy590, 0);
}
break;
case 223: /* expr ::= expr in_op LP exprlist RP */
{
- if( yymsp[-1].minor.yy250==0 ){
+ if( yymsp[-1].minor.yy402==0 ){
/* Expressions of the form
**
** expr1 IN ()
@@ -181686,110 +181583,110 @@ static YYACTIONTYPE yy_reduce(
** simplify to constants 0 (false) and 1 (true), respectively,
** regardless of the value of expr1.
*/
- sqlite3ExprUnmapAndDelete(pParse, yymsp[-4].minor.yy530);
- yymsp[-4].minor.yy530 = sqlite3Expr(pParse->db, TK_STRING, yymsp[-3].minor.yy220 ? "true" : "false");
- if( yymsp[-4].minor.yy530 ) sqlite3ExprIdToTrueFalse(yymsp[-4].minor.yy530);
+ sqlite3ExprUnmapAndDelete(pParse, yymsp[-4].minor.yy590);
+ yymsp[-4].minor.yy590 = sqlite3Expr(pParse->db, TK_STRING, yymsp[-3].minor.yy502 ? "true" : "false");
+ if( yymsp[-4].minor.yy590 ) sqlite3ExprIdToTrueFalse(yymsp[-4].minor.yy590);
}else{
- Expr *pRHS = yymsp[-1].minor.yy250->a[0].pExpr;
- if( yymsp[-1].minor.yy250->nExpr==1 && sqlite3ExprIsConstant(pParse,pRHS) && yymsp[-4].minor.yy530->op!=TK_VECTOR ){
- yymsp[-1].minor.yy250->a[0].pExpr = 0;
- sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy250);
+ Expr *pRHS = yymsp[-1].minor.yy402->a[0].pExpr;
+ if( yymsp[-1].minor.yy402->nExpr==1 && sqlite3ExprIsConstant(pParse,pRHS) && yymsp[-4].minor.yy590->op!=TK_VECTOR ){
+ yymsp[-1].minor.yy402->a[0].pExpr = 0;
+ sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy402);
pRHS = sqlite3PExpr(pParse, TK_UPLUS, pRHS, 0);
- yymsp[-4].minor.yy530 = sqlite3PExpr(pParse, TK_EQ, yymsp[-4].minor.yy530, pRHS);
- }else if( yymsp[-1].minor.yy250->nExpr==1 && pRHS->op==TK_SELECT ){
- yymsp[-4].minor.yy530 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy530, 0);
- sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy530, pRHS->x.pSelect);
+ yymsp[-4].minor.yy590 = sqlite3PExpr(pParse, TK_EQ, yymsp[-4].minor.yy590, pRHS);
+ }else if( yymsp[-1].minor.yy402->nExpr==1 && pRHS->op==TK_SELECT ){
+ yymsp[-4].minor.yy590 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy590, 0);
+ sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy590, pRHS->x.pSelect);
pRHS->x.pSelect = 0;
- sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy250);
+ sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy402);
}else{
- yymsp[-4].minor.yy530 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy530, 0);
- if( yymsp[-4].minor.yy530==0 ){
- sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy250);
- }else if( yymsp[-4].minor.yy530->pLeft->op==TK_VECTOR ){
- int nExpr = yymsp[-4].minor.yy530->pLeft->x.pList->nExpr;
- Select *pSelectRHS = sqlite3ExprListToValues(pParse, nExpr, yymsp[-1].minor.yy250);
+ yymsp[-4].minor.yy590 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy590, 0);
+ if( yymsp[-4].minor.yy590==0 ){
+ sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy402);
+ }else if( yymsp[-4].minor.yy590->pLeft->op==TK_VECTOR ){
+ int nExpr = yymsp[-4].minor.yy590->pLeft->x.pList->nExpr;
+ Select *pSelectRHS = sqlite3ExprListToValues(pParse, nExpr, yymsp[-1].minor.yy402);
if( pSelectRHS ){
parserDoubleLinkSelect(pParse, pSelectRHS);
- sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy530, pSelectRHS);
+ sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy590, pSelectRHS);
}
}else{
- yymsp[-4].minor.yy530->x.pList = yymsp[-1].minor.yy250;
- sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy530);
+ yymsp[-4].minor.yy590->x.pList = yymsp[-1].minor.yy402;
+ sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy590);
}
}
- if( yymsp[-3].minor.yy220 ) yymsp[-4].minor.yy530 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy530, 0);
+ if( yymsp[-3].minor.yy502 ) yymsp[-4].minor.yy590 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy590, 0);
}
}
break;
case 224: /* expr ::= LP select RP */
{
- yymsp[-2].minor.yy530 = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
- sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy530, yymsp[-1].minor.yy99);
+ yymsp[-2].minor.yy590 = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
+ sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy590, yymsp[-1].minor.yy637);
}
break;
case 225: /* expr ::= expr in_op LP select RP */
{
- yymsp[-4].minor.yy530 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy530, 0);
- sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy530, yymsp[-1].minor.yy99);
- if( yymsp[-3].minor.yy220 ) yymsp[-4].minor.yy530 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy530, 0);
+ yymsp[-4].minor.yy590 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy590, 0);
+ sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy590, yymsp[-1].minor.yy637);
+ if( yymsp[-3].minor.yy502 ) yymsp[-4].minor.yy590 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy590, 0);
}
break;
case 226: /* expr ::= expr in_op nm dbnm paren_exprlist */
{
SrcList *pSrc = sqlite3SrcListAppend(pParse, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);
Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0);
- if( yymsp[0].minor.yy250 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy250);
- yymsp[-4].minor.yy530 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy530, 0);
- sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy530, pSelect);
- if( yymsp[-3].minor.yy220 ) yymsp[-4].minor.yy530 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy530, 0);
+ if( yymsp[0].minor.yy402 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy402);
+ yymsp[-4].minor.yy590 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy590, 0);
+ sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy590, pSelect);
+ if( yymsp[-3].minor.yy502 ) yymsp[-4].minor.yy590 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy590, 0);
}
break;
case 227: /* expr ::= EXISTS LP select RP */
{
Expr *p;
- p = yymsp[-3].minor.yy530 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0);
- sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy99);
+ p = yymsp[-3].minor.yy590 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0);
+ sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy637);
}
break;
case 228: /* expr ::= CASE case_operand case_exprlist case_else END */
{
- yymsp[-4].minor.yy530 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy530, 0);
- if( yymsp[-4].minor.yy530 ){
- yymsp[-4].minor.yy530->x.pList = yymsp[-1].minor.yy530 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy250,yymsp[-1].minor.yy530) : yymsp[-2].minor.yy250;
- sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy530);
+ yymsp[-4].minor.yy590 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy590, 0);
+ if( yymsp[-4].minor.yy590 ){
+ yymsp[-4].minor.yy590->x.pList = yymsp[-1].minor.yy590 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy402,yymsp[-1].minor.yy590) : yymsp[-2].minor.yy402;
+ sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy590);
}else{
- sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy250);
- sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy530);
+ sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy402);
+ sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy590);
}
}
break;
case 229: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
{
- yymsp[-4].minor.yy250 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy250, yymsp[-2].minor.yy530);
- yymsp[-4].minor.yy250 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy250, yymsp[0].minor.yy530);
+ yymsp[-4].minor.yy402 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy402, yymsp[-2].minor.yy590);
+ yymsp[-4].minor.yy402 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy402, yymsp[0].minor.yy590);
}
break;
case 230: /* case_exprlist ::= WHEN expr THEN expr */
{
- yymsp[-3].minor.yy250 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy530);
- yymsp[-3].minor.yy250 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy250, yymsp[0].minor.yy530);
+ yymsp[-3].minor.yy402 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy590);
+ yymsp[-3].minor.yy402 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy402, yymsp[0].minor.yy590);
}
break;
case 235: /* nexprlist ::= nexprlist COMMA expr */
-{yymsp[-2].minor.yy250 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy250,yymsp[0].minor.yy530);}
+{yymsp[-2].minor.yy402 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy402,yymsp[0].minor.yy590);}
break;
case 236: /* nexprlist ::= expr */
-{yymsp[0].minor.yy250 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy530); /*A-overwrites-Y*/}
+{yymsp[0].minor.yy402 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy590); /*A-overwrites-Y*/}
break;
case 238: /* paren_exprlist ::= LP exprlist RP */
case 243: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==243);
-{yymsp[-2].minor.yy250 = yymsp[-1].minor.yy250;}
+{yymsp[-2].minor.yy402 = yymsp[-1].minor.yy402;}
break;
case 239: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
{
sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0,
- sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy250, yymsp[-10].minor.yy220,
- &yymsp[-11].minor.yy0, yymsp[0].minor.yy530, SQLITE_SO_ASC, yymsp[-8].minor.yy220, SQLITE_IDXTYPE_APPDEF);
+ sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy402, yymsp[-10].minor.yy502,
+ &yymsp[-11].minor.yy0, yymsp[0].minor.yy590, SQLITE_SO_ASC, yymsp[-8].minor.yy502, SQLITE_IDXTYPE_APPDEF);
if( IN_RENAME_OBJECT && pParse->pNewIndex ){
sqlite3RenameTokenMap(pParse, pParse->pNewIndex->zName, &yymsp[-4].minor.yy0);
}
@@ -181797,29 +181694,29 @@ static YYACTIONTYPE yy_reduce(
break;
case 240: /* uniqueflag ::= UNIQUE */
case 282: /* raisetype ::= ABORT */ yytestcase(yyruleno==282);
-{yymsp[0].minor.yy220 = OE_Abort;}
+{yymsp[0].minor.yy502 = OE_Abort;}
break;
case 241: /* uniqueflag ::= */
-{yymsp[1].minor.yy220 = OE_None;}
+{yymsp[1].minor.yy502 = OE_None;}
break;
case 244: /* eidlist ::= eidlist COMMA nm collate sortorder */
{
- yymsp[-4].minor.yy250 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy250, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy220, yymsp[0].minor.yy220);
+ yymsp[-4].minor.yy402 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy402, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy502, yymsp[0].minor.yy502);
}
break;
case 245: /* eidlist ::= nm collate sortorder */
{
- yymsp[-2].minor.yy250 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy220, yymsp[0].minor.yy220); /*A-overwrites-Y*/
+ yymsp[-2].minor.yy402 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy502, yymsp[0].minor.yy502); /*A-overwrites-Y*/
}
break;
case 248: /* cmd ::= DROP INDEX ifexists fullname */
-{sqlite3DropIndex(pParse, yymsp[0].minor.yy43, yymsp[-1].minor.yy220);}
+{sqlite3DropIndex(pParse, yymsp[0].minor.yy563, yymsp[-1].minor.yy502);}
break;
case 249: /* cmd ::= VACUUM vinto */
-{sqlite3Vacuum(pParse,0,yymsp[0].minor.yy530);}
+{sqlite3Vacuum(pParse,0,yymsp[0].minor.yy590);}
break;
case 250: /* cmd ::= VACUUM nm vinto */
-{sqlite3Vacuum(pParse,&yymsp[-1].minor.yy0,yymsp[0].minor.yy530);}
+{sqlite3Vacuum(pParse,&yymsp[-1].minor.yy0,yymsp[0].minor.yy590);}
break;
case 253: /* cmd ::= PRAGMA nm dbnm */
{sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);}
@@ -181841,50 +181738,50 @@ static YYACTIONTYPE yy_reduce(
Token all;
all.z = yymsp[-3].minor.yy0.z;
all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n;
- sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy203, &all);
+ sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy319, &all);
}
break;
case 261: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
{
- sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy220, yymsp[-4].minor.yy234.a, yymsp[-4].minor.yy234.b, yymsp[-2].minor.yy43, yymsp[0].minor.yy530, yymsp[-10].minor.yy220, yymsp[-8].minor.yy220);
+ sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy502, yymsp[-4].minor.yy28.a, yymsp[-4].minor.yy28.b, yymsp[-2].minor.yy563, yymsp[0].minor.yy590, yymsp[-10].minor.yy502, yymsp[-8].minor.yy502);
yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/
}
break;
case 262: /* trigger_time ::= BEFORE|AFTER */
-{ yymsp[0].minor.yy220 = yymsp[0].major; /*A-overwrites-X*/ }
+{ yymsp[0].minor.yy502 = yymsp[0].major; /*A-overwrites-X*/ }
break;
case 263: /* trigger_time ::= INSTEAD OF */
-{ yymsp[-1].minor.yy220 = TK_INSTEAD;}
+{ yymsp[-1].minor.yy502 = TK_INSTEAD;}
break;
case 264: /* trigger_time ::= */
-{ yymsp[1].minor.yy220 = TK_BEFORE; }
+{ yymsp[1].minor.yy502 = TK_BEFORE; }
break;
case 265: /* trigger_event ::= DELETE|INSERT */
case 266: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==266);
-{yymsp[0].minor.yy234.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy234.b = 0;}
+{yymsp[0].minor.yy28.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy28.b = 0;}
break;
case 267: /* trigger_event ::= UPDATE OF idlist */
-{yymsp[-2].minor.yy234.a = TK_UPDATE; yymsp[-2].minor.yy234.b = yymsp[0].minor.yy96;}
+{yymsp[-2].minor.yy28.a = TK_UPDATE; yymsp[-2].minor.yy28.b = yymsp[0].minor.yy204;}
break;
case 268: /* when_clause ::= */
case 287: /* key_opt ::= */ yytestcase(yyruleno==287);
-{ yymsp[1].minor.yy530 = 0; }
+{ yymsp[1].minor.yy590 = 0; }
break;
case 269: /* when_clause ::= WHEN expr */
case 288: /* key_opt ::= KEY expr */ yytestcase(yyruleno==288);
-{ yymsp[-1].minor.yy530 = yymsp[0].minor.yy530; }
+{ yymsp[-1].minor.yy590 = yymsp[0].minor.yy590; }
break;
case 270: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
{
- assert( yymsp[-2].minor.yy203!=0 );
- yymsp[-2].minor.yy203->pLast->pNext = yymsp[-1].minor.yy203;
- yymsp[-2].minor.yy203->pLast = yymsp[-1].minor.yy203;
+ assert( yymsp[-2].minor.yy319!=0 );
+ yymsp[-2].minor.yy319->pLast->pNext = yymsp[-1].minor.yy319;
+ yymsp[-2].minor.yy319->pLast = yymsp[-1].minor.yy319;
}
break;
case 271: /* trigger_cmd_list ::= trigger_cmd SEMI */
{
- assert( yymsp[-1].minor.yy203!=0 );
- yymsp[-1].minor.yy203->pLast = yymsp[-1].minor.yy203;
+ assert( yymsp[-1].minor.yy319!=0 );
+ yymsp[-1].minor.yy319->pLast = yymsp[-1].minor.yy319;
}
break;
case 272: /* trnm ::= nm DOT nm */
@@ -181910,58 +181807,58 @@ static YYACTIONTYPE yy_reduce(
}
break;
case 275: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
-{yylhsminor.yy203 = sqlite3TriggerUpdateStep(pParse, &yymsp[-6].minor.yy0, yymsp[-2].minor.yy43, yymsp[-3].minor.yy250, yymsp[-1].minor.yy530, yymsp[-7].minor.yy220, yymsp[-8].minor.yy0.z, yymsp[0].minor.yy192);}
- yymsp[-8].minor.yy203 = yylhsminor.yy203;
+{yylhsminor.yy319 = sqlite3TriggerUpdateStep(pParse, &yymsp[-6].minor.yy0, yymsp[-2].minor.yy563, yymsp[-3].minor.yy402, yymsp[-1].minor.yy590, yymsp[-7].minor.yy502, yymsp[-8].minor.yy0.z, yymsp[0].minor.yy342);}
+ yymsp[-8].minor.yy319 = yylhsminor.yy319;
break;
case 276: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
{
- yylhsminor.yy203 = sqlite3TriggerInsertStep(pParse,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy96,yymsp[-2].minor.yy99,yymsp[-6].minor.yy220,yymsp[-1].minor.yy642,yymsp[-7].minor.yy192,yymsp[0].minor.yy192);/*yylhsminor.yy203-overwrites-yymsp[-6].minor.yy220*/
+ yylhsminor.yy319 = sqlite3TriggerInsertStep(pParse,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy204,yymsp[-2].minor.yy637,yymsp[-6].minor.yy502,yymsp[-1].minor.yy403,yymsp[-7].minor.yy342,yymsp[0].minor.yy342);/*yylhsminor.yy319-overwrites-yymsp[-6].minor.yy502*/
}
- yymsp[-7].minor.yy203 = yylhsminor.yy203;
+ yymsp[-7].minor.yy319 = yylhsminor.yy319;
break;
case 277: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
-{yylhsminor.yy203 = sqlite3TriggerDeleteStep(pParse, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy530, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy192);}
- yymsp[-5].minor.yy203 = yylhsminor.yy203;
+{yylhsminor.yy319 = sqlite3TriggerDeleteStep(pParse, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy590, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy342);}
+ yymsp[-5].minor.yy319 = yylhsminor.yy319;
break;
case 278: /* trigger_cmd ::= scanpt select scanpt */
-{yylhsminor.yy203 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy99, yymsp[-2].minor.yy192, yymsp[0].minor.yy192); /*yylhsminor.yy203-overwrites-yymsp[-1].minor.yy99*/}
- yymsp[-2].minor.yy203 = yylhsminor.yy203;
+{yylhsminor.yy319 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy637, yymsp[-2].minor.yy342, yymsp[0].minor.yy342); /*yylhsminor.yy319-overwrites-yymsp[-1].minor.yy637*/}
+ yymsp[-2].minor.yy319 = yylhsminor.yy319;
break;
case 279: /* expr ::= RAISE LP IGNORE RP */
{
- yymsp[-3].minor.yy530 = sqlite3PExpr(pParse, TK_RAISE, 0, 0);
- if( yymsp[-3].minor.yy530 ){
- yymsp[-3].minor.yy530->affExpr = OE_Ignore;
+ yymsp[-3].minor.yy590 = sqlite3PExpr(pParse, TK_RAISE, 0, 0);
+ if( yymsp[-3].minor.yy590 ){
+ yymsp[-3].minor.yy590->affExpr = OE_Ignore;
}
}
break;
case 280: /* expr ::= RAISE LP raisetype COMMA expr RP */
{
- yymsp[-5].minor.yy530 = sqlite3PExpr(pParse, TK_RAISE, yymsp[-1].minor.yy530, 0);
- if( yymsp[-5].minor.yy530 ) {
- yymsp[-5].minor.yy530->affExpr = (char)yymsp[-3].minor.yy220;
+ yymsp[-5].minor.yy590 = sqlite3PExpr(pParse, TK_RAISE, yymsp[-1].minor.yy590, 0);
+ if( yymsp[-5].minor.yy590 ) {
+ yymsp[-5].minor.yy590->affExpr = (char)yymsp[-3].minor.yy502;
}
}
break;
case 281: /* raisetype ::= ROLLBACK */
-{yymsp[0].minor.yy220 = OE_Rollback;}
+{yymsp[0].minor.yy502 = OE_Rollback;}
break;
case 283: /* raisetype ::= FAIL */
-{yymsp[0].minor.yy220 = OE_Fail;}
+{yymsp[0].minor.yy502 = OE_Fail;}
break;
case 284: /* cmd ::= DROP TRIGGER ifexists fullname */
{
- sqlite3DropTrigger(pParse,yymsp[0].minor.yy43,yymsp[-1].minor.yy220);
+ sqlite3DropTrigger(pParse,yymsp[0].minor.yy563,yymsp[-1].minor.yy502);
}
break;
case 285: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
{
- sqlite3Attach(pParse, yymsp[-3].minor.yy530, yymsp[-1].minor.yy530, yymsp[0].minor.yy530);
+ sqlite3Attach(pParse, yymsp[-3].minor.yy590, yymsp[-1].minor.yy590, yymsp[0].minor.yy590);
}
break;
case 286: /* cmd ::= DETACH database_kw_opt expr */
{
- sqlite3Detach(pParse, yymsp[0].minor.yy530);
+ sqlite3Detach(pParse, yymsp[0].minor.yy590);
}
break;
case 289: /* cmd ::= REINDEX */
@@ -181978,7 +181875,7 @@ static YYACTIONTYPE yy_reduce(
break;
case 293: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
{
- sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy43,&yymsp[0].minor.yy0);
+ sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy563,&yymsp[0].minor.yy0);
}
break;
case 294: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
@@ -181989,18 +181886,18 @@ static YYACTIONTYPE yy_reduce(
break;
case 295: /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
{
- sqlite3AlterDropColumn(pParse, yymsp[-3].minor.yy43, &yymsp[0].minor.yy0);
+ sqlite3AlterDropColumn(pParse, yymsp[-3].minor.yy563, &yymsp[0].minor.yy0);
}
break;
case 296: /* add_column_fullname ::= fullname */
{
disableLookaside(pParse);
- sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy43);
+ sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy563);
}
break;
case 297: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
{
- sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy43, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
+ sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy563, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
}
break;
case 298: /* cmd ::= create_vtab */
@@ -182011,7 +181908,7 @@ static YYACTIONTYPE yy_reduce(
break;
case 300: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
{
- sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy220);
+ sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy502);
}
break;
case 301: /* vtabarg ::= */
@@ -182024,20 +181921,20 @@ static YYACTIONTYPE yy_reduce(
break;
case 305: /* with ::= WITH wqlist */
case 306: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==306);
-{ sqlite3WithPush(pParse, yymsp[0].minor.yy91, 1); }
+{ sqlite3WithPush(pParse, yymsp[0].minor.yy125, 1); }
break;
case 307: /* wqas ::= AS */
-{yymsp[0].minor.yy426 = M10d_Any;}
+{yymsp[0].minor.yy444 = M10d_Any;}
break;
case 308: /* wqas ::= AS MATERIALIZED */
-{yymsp[-1].minor.yy426 = M10d_Yes;}
+{yymsp[-1].minor.yy444 = M10d_Yes;}
break;
case 309: /* wqas ::= AS NOT MATERIALIZED */
-{yymsp[-2].minor.yy426 = M10d_No;}
+{yymsp[-2].minor.yy444 = M10d_No;}
break;
case 310: /* wqitem ::= withnm eidlist_opt wqas LP select RP */
{
- yymsp[-5].minor.yy207 = sqlite3CteNew(pParse, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy250, yymsp[-1].minor.yy99, yymsp[-3].minor.yy426); /*A-overwrites-X*/
+ yymsp[-5].minor.yy361 = sqlite3CteNew(pParse, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy402, yymsp[-1].minor.yy637, yymsp[-3].minor.yy444); /*A-overwrites-X*/
}
break;
case 311: /* withnm ::= nm */
@@ -182045,160 +181942,160 @@ static YYACTIONTYPE yy_reduce(
break;
case 312: /* wqlist ::= wqitem */
{
- yymsp[0].minor.yy91 = sqlite3WithAdd(pParse, 0, yymsp[0].minor.yy207); /*A-overwrites-X*/
+ yymsp[0].minor.yy125 = sqlite3WithAdd(pParse, 0, yymsp[0].minor.yy361); /*A-overwrites-X*/
}
break;
case 313: /* wqlist ::= wqlist COMMA wqitem */
{
- yymsp[-2].minor.yy91 = sqlite3WithAdd(pParse, yymsp[-2].minor.yy91, yymsp[0].minor.yy207);
+ yymsp[-2].minor.yy125 = sqlite3WithAdd(pParse, yymsp[-2].minor.yy125, yymsp[0].minor.yy361);
}
break;
case 314: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */
{
- assert( yymsp[0].minor.yy459!=0 );
- sqlite3WindowChain(pParse, yymsp[0].minor.yy459, yymsp[-2].minor.yy459);
- yymsp[0].minor.yy459->pNextWin = yymsp[-2].minor.yy459;
- yylhsminor.yy459 = yymsp[0].minor.yy459;
+ assert( yymsp[0].minor.yy483!=0 );
+ sqlite3WindowChain(pParse, yymsp[0].minor.yy483, yymsp[-2].minor.yy483);
+ yymsp[0].minor.yy483->pNextWin = yymsp[-2].minor.yy483;
+ yylhsminor.yy483 = yymsp[0].minor.yy483;
}
- yymsp[-2].minor.yy459 = yylhsminor.yy459;
+ yymsp[-2].minor.yy483 = yylhsminor.yy483;
break;
case 315: /* windowdefn ::= nm AS LP window RP */
{
- if( ALWAYS(yymsp[-1].minor.yy459) ){
- yymsp[-1].minor.yy459->zName = sqlite3DbStrNDup(pParse->db, yymsp[-4].minor.yy0.z, yymsp[-4].minor.yy0.n);
+ if( ALWAYS(yymsp[-1].minor.yy483) ){
+ yymsp[-1].minor.yy483->zName = sqlite3DbStrNDup(pParse->db, yymsp[-4].minor.yy0.z, yymsp[-4].minor.yy0.n);
}
- yylhsminor.yy459 = yymsp[-1].minor.yy459;
+ yylhsminor.yy483 = yymsp[-1].minor.yy483;
}
- yymsp[-4].minor.yy459 = yylhsminor.yy459;
+ yymsp[-4].minor.yy483 = yylhsminor.yy483;
break;
case 316: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */
{
- yymsp[-4].minor.yy459 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy459, yymsp[-2].minor.yy250, yymsp[-1].minor.yy250, 0);
+ yymsp[-4].minor.yy483 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy483, yymsp[-2].minor.yy402, yymsp[-1].minor.yy402, 0);
}
break;
case 317: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
{
- yylhsminor.yy459 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy459, yymsp[-2].minor.yy250, yymsp[-1].minor.yy250, &yymsp[-5].minor.yy0);
+ yylhsminor.yy483 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy483, yymsp[-2].minor.yy402, yymsp[-1].minor.yy402, &yymsp[-5].minor.yy0);
}
- yymsp[-5].minor.yy459 = yylhsminor.yy459;
+ yymsp[-5].minor.yy483 = yylhsminor.yy483;
break;
case 318: /* window ::= ORDER BY sortlist frame_opt */
{
- yymsp[-3].minor.yy459 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy459, 0, yymsp[-1].minor.yy250, 0);
+ yymsp[-3].minor.yy483 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy483, 0, yymsp[-1].minor.yy402, 0);
}
break;
case 319: /* window ::= nm ORDER BY sortlist frame_opt */
{
- yylhsminor.yy459 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy459, 0, yymsp[-1].minor.yy250, &yymsp[-4].minor.yy0);
+ yylhsminor.yy483 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy483, 0, yymsp[-1].minor.yy402, &yymsp[-4].minor.yy0);
}
- yymsp[-4].minor.yy459 = yylhsminor.yy459;
+ yymsp[-4].minor.yy483 = yylhsminor.yy483;
break;
case 320: /* window ::= nm frame_opt */
{
- yylhsminor.yy459 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy459, 0, 0, &yymsp[-1].minor.yy0);
+ yylhsminor.yy483 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy483, 0, 0, &yymsp[-1].minor.yy0);
}
- yymsp[-1].minor.yy459 = yylhsminor.yy459;
+ yymsp[-1].minor.yy483 = yylhsminor.yy483;
break;
case 321: /* frame_opt ::= */
{
- yymsp[1].minor.yy459 = sqlite3WindowAlloc(pParse, 0, TK_UNBOUNDED, 0, TK_CURRENT, 0, 0);
+ yymsp[1].minor.yy483 = sqlite3WindowAlloc(pParse, 0, TK_UNBOUNDED, 0, TK_CURRENT, 0, 0);
}
break;
case 322: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
{
- yylhsminor.yy459 = sqlite3WindowAlloc(pParse, yymsp[-2].minor.yy220, yymsp[-1].minor.yy225.eType, yymsp[-1].minor.yy225.pExpr, TK_CURRENT, 0, yymsp[0].minor.yy426);
+ yylhsminor.yy483 = sqlite3WindowAlloc(pParse, yymsp[-2].minor.yy502, yymsp[-1].minor.yy205.eType, yymsp[-1].minor.yy205.pExpr, TK_CURRENT, 0, yymsp[0].minor.yy444);
}
- yymsp[-2].minor.yy459 = yylhsminor.yy459;
+ yymsp[-2].minor.yy483 = yylhsminor.yy483;
break;
case 323: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
{
- yylhsminor.yy459 = sqlite3WindowAlloc(pParse, yymsp[-5].minor.yy220, yymsp[-3].minor.yy225.eType, yymsp[-3].minor.yy225.pExpr, yymsp[-1].minor.yy225.eType, yymsp[-1].minor.yy225.pExpr, yymsp[0].minor.yy426);
+ yylhsminor.yy483 = sqlite3WindowAlloc(pParse, yymsp[-5].minor.yy502, yymsp[-3].minor.yy205.eType, yymsp[-3].minor.yy205.pExpr, yymsp[-1].minor.yy205.eType, yymsp[-1].minor.yy205.pExpr, yymsp[0].minor.yy444);
}
- yymsp[-5].minor.yy459 = yylhsminor.yy459;
+ yymsp[-5].minor.yy483 = yylhsminor.yy483;
break;
case 325: /* frame_bound_s ::= frame_bound */
case 327: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==327);
-{yylhsminor.yy225 = yymsp[0].minor.yy225;}
- yymsp[0].minor.yy225 = yylhsminor.yy225;
+{yylhsminor.yy205 = yymsp[0].minor.yy205;}
+ yymsp[0].minor.yy205 = yylhsminor.yy205;
break;
case 326: /* frame_bound_s ::= UNBOUNDED PRECEDING */
case 328: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==328);
case 330: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==330);
-{yylhsminor.yy225.eType = yymsp[-1].major; yylhsminor.yy225.pExpr = 0;}
- yymsp[-1].minor.yy225 = yylhsminor.yy225;
+{yylhsminor.yy205.eType = yymsp[-1].major; yylhsminor.yy205.pExpr = 0;}
+ yymsp[-1].minor.yy205 = yylhsminor.yy205;
break;
case 329: /* frame_bound ::= expr PRECEDING|FOLLOWING */
-{yylhsminor.yy225.eType = yymsp[0].major; yylhsminor.yy225.pExpr = yymsp[-1].minor.yy530;}
- yymsp[-1].minor.yy225 = yylhsminor.yy225;
+{yylhsminor.yy205.eType = yymsp[0].major; yylhsminor.yy205.pExpr = yymsp[-1].minor.yy590;}
+ yymsp[-1].minor.yy205 = yylhsminor.yy205;
break;
case 331: /* frame_exclude_opt ::= */
-{yymsp[1].minor.yy426 = 0;}
+{yymsp[1].minor.yy444 = 0;}
break;
case 332: /* frame_exclude_opt ::= EXCLUDE frame_exclude */
-{yymsp[-1].minor.yy426 = yymsp[0].minor.yy426;}
+{yymsp[-1].minor.yy444 = yymsp[0].minor.yy444;}
break;
case 333: /* frame_exclude ::= NO OTHERS */
case 334: /* frame_exclude ::= CURRENT ROW */ yytestcase(yyruleno==334);
-{yymsp[-1].minor.yy426 = yymsp[-1].major; /*A-overwrites-X*/}
+{yymsp[-1].minor.yy444 = yymsp[-1].major; /*A-overwrites-X*/}
break;
case 335: /* frame_exclude ::= GROUP|TIES */
-{yymsp[0].minor.yy426 = yymsp[0].major; /*A-overwrites-X*/}
+{yymsp[0].minor.yy444 = yymsp[0].major; /*A-overwrites-X*/}
break;
case 336: /* window_clause ::= WINDOW windowdefn_list */
-{ yymsp[-1].minor.yy459 = yymsp[0].minor.yy459; }
+{ yymsp[-1].minor.yy483 = yymsp[0].minor.yy483; }
break;
case 337: /* filter_over ::= filter_clause over_clause */
{
- if( yymsp[0].minor.yy459 ){
- yymsp[0].minor.yy459->pFilter = yymsp[-1].minor.yy530;
+ if( yymsp[0].minor.yy483 ){
+ yymsp[0].minor.yy483->pFilter = yymsp[-1].minor.yy590;
}else{
- sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy530);
+ sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy590);
}
- yylhsminor.yy459 = yymsp[0].minor.yy459;
+ yylhsminor.yy483 = yymsp[0].minor.yy483;
}
- yymsp[-1].minor.yy459 = yylhsminor.yy459;
+ yymsp[-1].minor.yy483 = yylhsminor.yy483;
break;
case 338: /* filter_over ::= over_clause */
{
- yylhsminor.yy459 = yymsp[0].minor.yy459;
+ yylhsminor.yy483 = yymsp[0].minor.yy483;
}
- yymsp[0].minor.yy459 = yylhsminor.yy459;
+ yymsp[0].minor.yy483 = yylhsminor.yy483;
break;
case 339: /* filter_over ::= filter_clause */
{
- yylhsminor.yy459 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
- if( yylhsminor.yy459 ){
- yylhsminor.yy459->eFrmType = TK_FILTER;
- yylhsminor.yy459->pFilter = yymsp[0].minor.yy530;
+ yylhsminor.yy483 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
+ if( yylhsminor.yy483 ){
+ yylhsminor.yy483->eFrmType = TK_FILTER;
+ yylhsminor.yy483->pFilter = yymsp[0].minor.yy590;
}else{
- sqlite3ExprDelete(pParse->db, yymsp[0].minor.yy530);
+ sqlite3ExprDelete(pParse->db, yymsp[0].minor.yy590);
}
}
- yymsp[0].minor.yy459 = yylhsminor.yy459;
+ yymsp[0].minor.yy483 = yylhsminor.yy483;
break;
case 340: /* over_clause ::= OVER LP window RP */
{
- yymsp[-3].minor.yy459 = yymsp[-1].minor.yy459;
- assert( yymsp[-3].minor.yy459!=0 );
+ yymsp[-3].minor.yy483 = yymsp[-1].minor.yy483;
+ assert( yymsp[-3].minor.yy483!=0 );
}
break;
case 341: /* over_clause ::= OVER nm */
{
- yymsp[-1].minor.yy459 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
- if( yymsp[-1].minor.yy459 ){
- yymsp[-1].minor.yy459->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n);
+ yymsp[-1].minor.yy483 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
+ if( yymsp[-1].minor.yy483 ){
+ yymsp[-1].minor.yy483->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n);
}
}
break;
case 342: /* filter_clause ::= FILTER LP WHERE expr RP */
-{ yymsp[-4].minor.yy530 = yymsp[-1].minor.yy530; }
+{ yymsp[-4].minor.yy590 = yymsp[-1].minor.yy590; }
break;
case 343: /* term ::= QNUMBER */
{
- yylhsminor.yy530=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0);
- sqlite3DequoteNumber(pParse, yylhsminor.yy530);
+ yylhsminor.yy590=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0);
+ sqlite3DequoteNumber(pParse, yylhsminor.yy590);
}
- yymsp[0].minor.yy530 = yylhsminor.yy530;
+ yymsp[0].minor.yy590 = yylhsminor.yy590;
break;
default:
/* (344) input ::= cmdlist */ yytestcase(yyruleno==344);
@@ -182328,7 +182225,7 @@ static void yy_syntax_error(
UNUSED_PARAMETER(yymajor); /* Silence some compiler warnings */
if( TOKEN.z[0] ){
- parserSyntaxError(pParse, &TOKEN);
+ sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &TOKEN);
}else{
sqlite3ErrorMsg(pParse, "incomplete input");
}
@@ -183379,7 +183276,7 @@ SQLITE_PRIVATE int sqlite3GetToken(const unsigned char *z, int *tokenType){
case CC_MINUS: {
if( z[1]=='-' ){
for(i=2; (c=z[i])!=0 && c!='\n'; i++){}
- *tokenType = TK_COMMENT;
+ *tokenType = TK_SPACE; /* IMP: R-22934-25134 */
return i;
}else if( z[1]=='>' ){
*tokenType = TK_PTR;
@@ -183415,7 +183312,7 @@ SQLITE_PRIVATE int sqlite3GetToken(const unsigned char *z, int *tokenType){
}
for(i=3, c=z[2]; (c!='*' || z[i]!='/') && (c=z[i])!=0; i++){}
if( c ) i++;
- *tokenType = TK_COMMENT;
+ *tokenType = TK_SPACE; /* IMP: R-22934-25134 */
return i;
}
case CC_PERCENT: {
@@ -183744,12 +183641,12 @@ SQLITE_PRIVATE int sqlite3RunParser(Parse *pParse, const char *zSql){
if( tokenType>=TK_WINDOW ){
assert( tokenType==TK_SPACE || tokenType==TK_OVER || tokenType==TK_FILTER
|| tokenType==TK_ILLEGAL || tokenType==TK_WINDOW
- || tokenType==TK_QNUMBER || tokenType==TK_COMMENT
+ || tokenType==TK_QNUMBER
);
#else
if( tokenType>=TK_SPACE ){
assert( tokenType==TK_SPACE || tokenType==TK_ILLEGAL
- || tokenType==TK_QNUMBER || tokenType==TK_COMMENT
+ || tokenType==TK_QNUMBER
);
#endif /* SQLITE_OMIT_WINDOWFUNC */
if( AtomicLoad(&db->u1.isInterrupted) ){
@@ -183783,9 +183680,6 @@ SQLITE_PRIVATE int sqlite3RunParser(Parse *pParse, const char *zSql){
assert( n==6 );
tokenType = analyzeFilterKeyword((const u8*)&zSql[6], lastTokenParsed);
#endif /* SQLITE_OMIT_WINDOWFUNC */
- }else if( tokenType==TK_COMMENT && (db->flags & SQLITE_Comments)!=0 ){
- zSql += n;
- continue;
}else if( tokenType!=TK_QNUMBER ){
Token x;
x.z = zSql;
@@ -183822,9 +183716,7 @@ SQLITE_PRIVATE int sqlite3RunParser(Parse *pParse, const char *zSql){
if( pParse->zErrMsg==0 ){
pParse->zErrMsg = sqlite3MPrintf(db, "%s", sqlite3ErrStr(pParse->rc));
}
- if( (pParse->prepFlags & SQLITE_PREPARE_DONT_LOG)==0 ){
- sqlite3_log(pParse->rc, "%s in \"%s\"", pParse->zErrMsg, pParse->zTail);
- }
+ sqlite3_log(pParse->rc, "%s in \"%s\"", pParse->zErrMsg, pParse->zTail);
nErr++;
}
pParse->zTail = zSql;
@@ -183892,7 +183784,6 @@ SQLITE_PRIVATE char *sqlite3Normalize(
n = sqlite3GetToken((unsigned char*)zSql+i, &tokenType);
if( NEVER(n<=0) ) break;
switch( tokenType ){
- case TK_COMMENT:
case TK_SPACE: {
break;
}
@@ -184534,6 +184425,32 @@ SQLITE_API char *sqlite3_temp_directory = 0;
*/
SQLITE_API char *sqlite3_data_directory = 0;
+/*
+** Determine whether or not high-precision (long double) floating point
+** math works correctly on CPU currently running.
+*/
+static SQLITE_NOINLINE int hasHighPrecisionDouble(int rc){
+ if( sizeof(LONGDOUBLE_TYPE)<=8 ){
+ /* If the size of "long double" is not more than 8, then
+ ** high-precision math is not possible. */
+ return 0;
+ }else{
+ /* Just because sizeof(long double)>8 does not mean that the underlying
+ ** hardware actually supports high-precision floating point. For example,
+ ** clearing the 0x100 bit in the floating-point control word on Intel
+ ** processors will make long double work like double, even though long
+ ** double takes up more space. The only way to determine if long double
+ ** actually works is to run an experiment. */
+ LONGDOUBLE_TYPE a, b, c;
+ rc++;
+ a = 1.0+rc*0.1;
+ b = 1.0e+18+rc*25.0;
+ c = a+b;
+ return b!=c;
+ }
+}
+
+
/*
** Initialize SQLite.
**
@@ -184728,6 +184645,13 @@ SQLITE_API int sqlite3_initialize(void){
rc = SQLITE_EXTRA_INIT(0);
}
#endif
+
+ /* Experimentally determine if high-precision floating point is
+ ** available. */
+#ifndef SQLITE_OMIT_WSD
+ sqlite3Config.bUseLongDouble = hasHighPrecisionDouble(rc);
+#endif
+
return rc;
}
@@ -185334,7 +185258,7 @@ SQLITE_API int sqlite3_db_config(sqlite3 *db, int op, ...){
default: {
static const struct {
int op; /* The opcode */
- u64 mask; /* Mask of the bit in sqlite3.flags to set/clear */
+ u32 mask; /* Mask of the bit in sqlite3.flags to set/clear */
} aFlagOp[] = {
{ SQLITE_DBCONFIG_ENABLE_FKEY, SQLITE_ForeignKeys },
{ SQLITE_DBCONFIG_ENABLE_TRIGGER, SQLITE_EnableTrigger },
@@ -185355,9 +185279,6 @@ SQLITE_API int sqlite3_db_config(sqlite3 *db, int op, ...){
{ SQLITE_DBCONFIG_TRUSTED_SCHEMA, SQLITE_TrustedSchema },
{ SQLITE_DBCONFIG_STMT_SCANSTATUS, SQLITE_StmtScanStatus },
{ SQLITE_DBCONFIG_REVERSE_SCANORDER, SQLITE_ReverseOrder },
- { SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE, SQLITE_AttachCreate },
- { SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE, SQLITE_AttachWrite },
- { SQLITE_DBCONFIG_ENABLE_COMMENTS, SQLITE_Comments },
};
unsigned int i;
rc = SQLITE_ERROR; /* IMP: R-42790-23372 */
@@ -185801,6 +185722,10 @@ SQLITE_PRIVATE void sqlite3LeaveMutexAndCloseZombie(sqlite3 *db){
sqlite3Error(db, SQLITE_OK); /* Deallocates any cached error strings. */
sqlite3ValueFree(db->pErr);
sqlite3CloseExtensions(db);
+#if SQLITE_USER_AUTHENTICATION
+ sqlite3_free(db->auth.zAuthUser);
+ sqlite3_free(db->auth.zAuthPW);
+#endif
db->eOpenState = SQLITE_STATE_ERROR;
@@ -187303,8 +187228,8 @@ SQLITE_API int sqlite3_limit(sqlite3 *db, int limitId, int newLimit){
if( newLimit>=0 ){ /* IMP: R-52476-28732 */
if( newLimit>aHardLimit[limitId] ){
newLimit = aHardLimit[limitId]; /* IMP: R-51463-25634 */
- }else if( newLimitaLimit[limitId] = newLimit;
}
@@ -187699,9 +187624,6 @@ static int openDatabase(
| SQLITE_EnableTrigger
| SQLITE_EnableView
| SQLITE_CacheSpill
- | SQLITE_AttachCreate
- | SQLITE_AttachWrite
- | SQLITE_Comments
#if !defined(SQLITE_TRUSTED_SCHEMA) || SQLITE_TRUSTED_SCHEMA+0!=0
| SQLITE_TrustedSchema
#endif
@@ -187826,7 +187748,6 @@ static int openDatabase(
if( ((1<<(flags&7)) & 0x46)==0 ){
rc = SQLITE_MISUSE_BKPT; /* IMP: R-18321-05872 */
}else{
- if( zFilename==0 ) zFilename = ":memory:";
rc = sqlite3ParseUri(zVfs, zFilename, &flags, &db->pVfs, &zOpen, &zErrMsg);
}
if( rc!=SQLITE_OK ){
@@ -188651,6 +188572,7 @@ SQLITE_API int sqlite3_test_control(int op, ...){
/* Invoke these debugging routines so that the compiler does not
** issue "defined but not used" warnings. */
if( x==9999 ){
+ sqlite3ShowExpr(0);
sqlite3ShowExpr(0);
sqlite3ShowExprList(0);
sqlite3ShowIdList(0);
@@ -188981,6 +188903,24 @@ SQLITE_API int sqlite3_test_control(int op, ...){
break;
}
+#if !defined(SQLITE_OMIT_WSD)
+ /* sqlite3_test_control(SQLITE_TESTCTRL_USELONGDOUBLE, int X);
+ **
+ ** X<0 Make no changes to the bUseLongDouble. Just report value.
+ ** X==0 Disable bUseLongDouble
+ ** X==1 Enable bUseLongDouble
+ ** X>=2 Set bUseLongDouble to its default value for this platform
+ */
+ case SQLITE_TESTCTRL_USELONGDOUBLE: {
+ int b = va_arg(ap, int);
+ if( b>=2 ) b = hasHighPrecisionDouble(b);
+ if( b>=0 ) sqlite3Config.bUseLongDouble = b>0;
+ rc = sqlite3Config.bUseLongDouble!=0;
+ break;
+ }
+#endif
+
+
#if defined(SQLITE_DEBUG) && !defined(SQLITE_OMIT_WSD)
/* sqlite3_test_control(SQLITE_TESTCTRL_TUNE, id, *piValue)
**
@@ -189288,11 +189228,7 @@ SQLITE_API int sqlite3_snapshot_get(
if( iDb==0 || iDb>1 ){
Btree *pBt = db->aDb[iDb].pBt;
if( SQLITE_TXN_WRITE!=sqlite3BtreeTxnState(pBt) ){
- Pager *pPager = sqlite3BtreePager(pBt);
- i64 dummy = 0;
- sqlite3PagerSnapshotOpen(pPager, (sqlite3_snapshot*)&dummy);
rc = sqlite3BtreeBeginTrans(pBt, 0, 0);
- sqlite3PagerSnapshotOpen(pPager, 0);
if( rc==SQLITE_OK ){
rc = sqlite3PagerSnapshotGet(sqlite3BtreePager(pBt), ppSnapshot);
}
@@ -191036,7 +190972,6 @@ SQLITE_PRIVATE int sqlite3Fts3MsrIncrNext(
SQLITE_PRIVATE int sqlite3Fts3EvalPhrasePoslist(Fts3Cursor *, Fts3Expr *, int iCol, char **);
SQLITE_PRIVATE int sqlite3Fts3MsrOvfl(Fts3Cursor *, Fts3MultiSegReader *, int *);
SQLITE_PRIVATE int sqlite3Fts3MsrIncrRestart(Fts3MultiSegReader *pCsr);
-SQLITE_PRIVATE int sqlite3Fts3MsrCancel(Fts3Cursor*, Fts3Expr*);
/* fts3_tokenize_vtab.c */
SQLITE_PRIVATE int sqlite3Fts3InitTok(sqlite3*, Fts3Hash *, void(*xDestroy)(void*));
@@ -193112,15 +193047,10 @@ static int fts3PoslistPhraseMerge(
if( *p1==POS_COLUMN ){
p1++;
p1 += fts3GetVarint32(p1, &iCol1);
- /* iCol1==0 indicates corruption. Column 0 does not have a POS_COLUMN
- ** entry, so this is actually end-of-doclist. */
- if( iCol1==0 ) return 0;
}
if( *p2==POS_COLUMN ){
p2++;
p2 += fts3GetVarint32(p2, &iCol2);
- /* As above, iCol2==0 indicates corruption. */
- if( iCol2==0 ) return 0;
}
while( 1 ){
@@ -196291,7 +196221,7 @@ static int fts3EvalNearTest(Fts3Expr *pExpr, int *pRc){
nTmp += p->pRight->pPhrase->doclist.nList;
}
nTmp += p->pPhrase->doclist.nList;
- aTmp = sqlite3_malloc64(nTmp*2 + FTS3_VARINT_MAX);
+ aTmp = sqlite3_malloc64(nTmp*2);
if( !aTmp ){
*pRc = SQLITE_NOMEM;
res = 0;
@@ -196555,24 +196485,6 @@ static void fts3EvalRestart(
}
}
-/*
-** Expression node pExpr is an MSR phrase. This function restarts pExpr
-** so that it is a regular phrase query, not an MSR. SQLITE_OK is returned
-** if successful, or an SQLite error code otherwise.
-*/
-SQLITE_PRIVATE int sqlite3Fts3MsrCancel(Fts3Cursor *pCsr, Fts3Expr *pExpr){
- int rc = SQLITE_OK;
- if( pExpr->bEof==0 ){
- i64 iDocid = pExpr->iDocid;
- fts3EvalRestart(pCsr, pExpr, &rc);
- while( rc==SQLITE_OK && pExpr->iDocid!=iDocid ){
- fts3EvalNextRow(pCsr, pExpr, &rc);
- if( pExpr->bEof ) rc = FTS_CORRUPT_VTAB;
- }
- }
- return rc;
-}
-
/*
** After allocating the Fts3Expr.aMI[] array for each phrase in the
** expression rooted at pExpr, the cursor iterates through all rows matched
@@ -196960,7 +196872,7 @@ SQLITE_PRIVATE int sqlite3Fts3Corrupt(){
}
#endif
-#if !defined(SQLITE_CORE)
+#if !SQLITE_CORE
/*
** Initialize API pointer table, if required.
*/
@@ -197862,11 +197774,10 @@ static int getNextString(
Fts3PhraseToken *pToken;
p = fts3ReallocOrFree(p, nSpace + ii*sizeof(Fts3PhraseToken));
+ if( !p ) goto no_mem;
+
zTemp = fts3ReallocOrFree(zTemp, nTemp + nByte);
- if( !zTemp || !p ){
- rc = SQLITE_NOMEM;
- goto getnextstring_out;
- }
+ if( !zTemp ) goto no_mem;
assert( nToken==ii );
pToken = &((Fts3Phrase *)(&p[1]))->aToken[ii];
@@ -197881,6 +197792,9 @@ static int getNextString(
nToken = ii+1;
}
}
+
+ pModule->xClose(pCursor);
+ pCursor = 0;
}
if( rc==SQLITE_DONE ){
@@ -197888,10 +197802,7 @@ static int getNextString(
char *zBuf = 0;
p = fts3ReallocOrFree(p, nSpace + nToken*sizeof(Fts3PhraseToken) + nTemp);
- if( !p ){
- rc = SQLITE_NOMEM;
- goto getnextstring_out;
- }
+ if( !p ) goto no_mem;
memset(p, 0, (char *)&(((Fts3Phrase *)&p[1])->aToken[0])-(char *)p);
p->eType = FTSQUERY_PHRASE;
p->pPhrase = (Fts3Phrase *)&p[1];
@@ -197899,9 +197810,11 @@ static int getNextString(
p->pPhrase->nToken = nToken;
zBuf = (char *)&p->pPhrase->aToken[nToken];
- assert( nTemp==0 || zTemp );
if( zTemp ){
memcpy(zBuf, zTemp, nTemp);
+ sqlite3_free(zTemp);
+ }else{
+ assert( nTemp==0 );
}
for(jj=0; jjpPhrase->nToken; jj++){
@@ -197911,17 +197824,17 @@ static int getNextString(
rc = SQLITE_OK;
}
- getnextstring_out:
+ *ppExpr = p;
+ return rc;
+no_mem:
+
if( pCursor ){
pModule->xClose(pCursor);
}
sqlite3_free(zTemp);
- if( rc!=SQLITE_OK ){
- sqlite3_free(p);
- p = 0;
- }
- *ppExpr = p;
- return rc;
+ sqlite3_free(p);
+ *ppExpr = 0;
+ return SQLITE_NOMEM;
}
/*
@@ -208530,22 +208443,6 @@ static int fts3ExprTermOffsetInit(Fts3Expr *pExpr, int iPhrase, void *ctx){
return rc;
}
-/*
-** If expression pExpr is a phrase expression that uses an MSR query,
-** restart it as a regular, non-incremental query. Return SQLITE_OK
-** if successful, or an SQLite error code otherwise.
-*/
-static int fts3ExprRestartIfCb(Fts3Expr *pExpr, int iPhrase, void *ctx){
- TermOffsetCtx *p = (TermOffsetCtx*)ctx;
- int rc = SQLITE_OK;
- UNUSED_PARAMETER(iPhrase);
- if( pExpr->pPhrase && pExpr->pPhrase->bIncr ){
- rc = sqlite3Fts3MsrCancel(p->pCsr, pExpr);
- pExpr->pPhrase->bIncr = 0;
- }
- return rc;
-}
-
/*
** Implementation of offsets() function.
*/
@@ -208582,12 +208479,6 @@ SQLITE_PRIVATE void sqlite3Fts3Offsets(
sCtx.iDocid = pCsr->iPrevId;
sCtx.pCsr = pCsr;
- /* If a query restart will be required, do it here, rather than later of
- ** after pointers to poslist buffers that may be invalidated by a restart
- ** have been saved. */
- rc = sqlite3Fts3ExprIterate(pCsr->pExpr, fts3ExprRestartIfCb, (void*)&sCtx);
- if( rc!=SQLITE_OK ) goto offsets_out;
-
/* Loop through the table columns, appending offset information to
** string-buffer res for each column.
*/
@@ -218755,8 +218646,8 @@ static void rtreenode(sqlite3_context *ctx, int nArg, sqlite3_value **apArg){
sqlite3_str_append(pOut, "}", 1);
}
errCode = sqlite3_str_errcode(pOut);
- sqlite3_result_error_code(ctx, errCode);
sqlite3_result_text(ctx, sqlite3_str_finish(pOut), -1, sqlite3_free);
+ sqlite3_result_error_code(ctx, errCode);
}
/* This routine implements an SQL function that returns the "depth" parameter
@@ -221272,7 +221163,7 @@ SQLITE_API int sqlite3_rtree_query_callback(
);
}
-#ifndef SQLITE_CORE
+#if !SQLITE_CORE
#ifdef _WIN32
__declspec(dllexport)
#endif
@@ -221863,7 +221754,7 @@ SQLITE_PRIVATE int sqlite3IcuInit(sqlite3 *db){
return rc;
}
-#ifndef SQLITE_CORE
+#if !SQLITE_CORE
#ifdef _WIN32
__declspec(dllexport)
#endif
@@ -222874,10 +222765,6 @@ SQLITE_API void sqlite3rbu_destroy_vfs(const char *zName);
/************** End of sqlite3rbu.h ******************************************/
/************** Continuing where we left off in sqlite3rbu.c *****************/
-#ifdef SQLITE_ENABLE_WAL_BIGHASH
-# error "may not use SQLITE_ENABLE_RBU with SQLITE_ENABLE_WAL_BIGHASH"
-#endif
-
#if defined(_WIN32_WCE)
/* #include "windows.h" */
#endif
@@ -223125,27 +223012,6 @@ struct RbuFrame {
u32 iWalFrame;
};
-#ifndef UNUSED_PARAMETER
-/*
-** The following macros are used to suppress compiler warnings and to
-** make it clear to human readers when a function parameter is deliberately
-** left unused within the body of a function. This usually happens when
-** a function is called via a function pointer. For example the
-** implementation of an SQL aggregate step callback may not use the
-** parameter indicating the number of arguments passed to the aggregate,
-** if it knows that this is enforced elsewhere.
-**
-** When a function parameter is not used at all within the body of a function,
-** it is generally named "NotUsed" or "NotUsed2" to make things even clearer.
-** However, these macros may also be used to suppress warnings related to
-** parameters that may or may not be used depending on compilation options.
-** For example those parameters only used in assert() statements. In these
-** cases the parameters are named as per the usual conventions.
-*/
-#define UNUSED_PARAMETER(x) (void)(x)
-#define UNUSED_PARAMETER2(x,y) UNUSED_PARAMETER(x),UNUSED_PARAMETER(y)
-#endif
-
/*
** RBU handle.
**
@@ -223197,7 +223063,7 @@ struct sqlite3rbu {
int rc; /* Value returned by last rbu_step() call */
char *zErrmsg; /* Error message if rc!=SQLITE_OK */
int nStep; /* Rows processed for current object */
- sqlite3_int64 nProgress; /* Rows processed for all objects */
+ int nProgress; /* Rows processed for all objects */
RbuObjIter objiter; /* Iterator for skipping through tbl/idx */
const char *zVfsName; /* Name of automatically created rbu vfs */
rbu_file *pTargetFd; /* File handle open on target db */
@@ -223314,7 +223180,7 @@ static unsigned int rbuDeltaGetInt(const char **pz, int *pLen){
v = (v<<6) + c;
}
z--;
- *pLen -= (int)(z - zStart);
+ *pLen -= z - zStart;
*pz = (char*)z;
return v;
}
@@ -223499,7 +223365,6 @@ static void rbuFossilDeltaFunc(
char *aOut;
assert( argc==2 );
- UNUSED_PARAMETER(argc);
nOrig = sqlite3_value_bytes(argv[0]);
aOrig = (const char*)sqlite3_value_blob(argv[0]);
@@ -225079,13 +224944,13 @@ static char *rbuObjIterGetIndexWhere(sqlite3rbu *p, RbuObjIter *pIter){
else if( c==')' ){
nParen--;
if( nParen==0 ){
- int nSpan = (int)(&zSql[i] - pIter->aIdxCol[iIdxCol].zSpan);
+ int nSpan = &zSql[i] - pIter->aIdxCol[iIdxCol].zSpan;
pIter->aIdxCol[iIdxCol++].nSpan = nSpan;
i++;
break;
}
}else if( c==',' && nParen==1 ){
- int nSpan = (int)(&zSql[i] - pIter->aIdxCol[iIdxCol].zSpan);
+ int nSpan = &zSql[i] - pIter->aIdxCol[iIdxCol].zSpan;
pIter->aIdxCol[iIdxCol++].nSpan = nSpan;
pIter->aIdxCol[iIdxCol].zSpan = &zSql[i+1];
}else if( c=='"' || c=='\'' || c=='`' ){
@@ -225775,8 +225640,6 @@ static void rbuFileSuffix3(const char *zBase, char *z){
for(i=sz-1; i>0 && z[i]!='/' && z[i]!='.'; i--){}
if( z[i]=='.' && sz>i+4 ) memmove(&z[i+1], &z[sz-3], 4);
}
-#else
- UNUSED_PARAMETER2(zBase,z);
#endif
}
@@ -226361,7 +226224,7 @@ static void rbuSaveState(sqlite3rbu *p, int eStage){
"(%d, %Q), "
"(%d, %Q), "
"(%d, %d), "
- "(%d, %lld), "
+ "(%d, %d), "
"(%d, %lld), "
"(%d, %lld), "
"(%d, %lld), "
@@ -226719,7 +226582,6 @@ static void rbuIndexCntFunc(
sqlite3 *db = (rbuIsVacuum(p) ? p->dbRbu : p->dbMain);
assert( nVal==1 );
- UNUSED_PARAMETER(nVal);
rc = prepareFreeAndCollectError(db, &pStmt, &zErrmsg,
sqlite3_mprintf("SELECT count(*) FROM sqlite_schema "
@@ -226995,7 +226857,7 @@ SQLITE_API sqlite3rbu *sqlite3rbu_vacuum(
){
if( zTarget==0 ){ return rbuMisuseError(); }
if( zState ){
- size_t n = strlen(zState);
+ int n = strlen(zState);
if( n>=7 && 0==memcmp("-vactmp", &zState[n-7], 7) ){
return rbuMisuseError();
}
@@ -227212,7 +227074,6 @@ SQLITE_API int sqlite3rbu_savestate(sqlite3rbu *p){
*/
static int xDefaultRename(void *pArg, const char *zOld, const char *zNew){
int rc = SQLITE_OK;
- UNUSED_PARAMETER(pArg);
#if defined(_WIN32_WCE)
{
LPWSTR zWideOld;
@@ -228117,9 +227978,6 @@ static int rbuVfsCurrentTime(sqlite3_vfs *pVfs, double *pTimeOut){
** No-op.
*/
static int rbuVfsGetLastError(sqlite3_vfs *pVfs, int a, char *b){
- UNUSED_PARAMETER(pVfs);
- UNUSED_PARAMETER(a);
- UNUSED_PARAMETER(b);
return 0;
}
@@ -229176,13 +229034,7 @@ SQLITE_PRIVATE int sqlite3DbstatRegister(sqlite3 *db){ return SQLITE_OK; }
**
** The data field of sqlite_dbpage table can be updated. The new
** value must be a BLOB which is the correct page size, otherwise the
-** update fails. INSERT operations also work, and operate as if they
-** where REPLACE. The size of the database can be extended by INSERT-ing
-** new pages on the end.
-**
-** Rows may not be deleted. However, doing an INSERT to page number N
-** with NULL page data causes the N-th page and all subsequent pages to be
-** deleted and the database to be truncated.
+** update fails. Rows may not be deleted or inserted.
*/
/* #include "sqliteInt.h" ** Requires access to internal data structures ** */
@@ -229205,8 +229057,6 @@ struct DbpageCursor {
struct DbpageTable {
sqlite3_vtab base; /* Base class. Must be first */
sqlite3 *db; /* The database */
- int iDbTrunc; /* Database to truncate */
- Pgno pgnoTrunc; /* Size to truncate to */
};
/* Columns */
@@ -229215,6 +229065,7 @@ struct DbpageTable {
#define DBPAGE_COLUMN_SCHEMA 2
+
/*
** Connect to or create a dbpagevfs virtual table.
*/
@@ -229465,24 +229316,6 @@ static int dbpageRowid(sqlite3_vtab_cursor *pCursor, sqlite_int64 *pRowid){
return SQLITE_OK;
}
-/*
-** Open write transactions. Since we do not know in advance which database
-** files will be written by the sqlite_dbpage virtual table, start a write
-** transaction on them all.
-**
-** Return SQLITE_OK if successful, or an SQLite error code otherwise.
-*/
-static int dbpageBeginTrans(DbpageTable *pTab){
- sqlite3 *db = pTab->db;
- int rc = SQLITE_OK;
- int i;
- for(i=0; rc==SQLITE_OK && inDb; i++){
- Btree *pBt = db->aDb[i].pBt;
- if( pBt ) rc = sqlite3BtreeBeginTrans(pBt, 1, 0);
- }
- return rc;
-}
-
static int dbpageUpdate(
sqlite3_vtab *pVtab,
int argc,
@@ -229494,11 +229327,11 @@ static int dbpageUpdate(
DbPage *pDbPage = 0;
int rc = SQLITE_OK;
char *zErr = 0;
+ const char *zSchema;
int iDb;
Btree *pBt;
Pager *pPager;
int szPage;
- int isInsert;
(void)pRowid;
if( pTab->db->flags & SQLITE_Defensive ){
@@ -229509,29 +229342,21 @@ static int dbpageUpdate(
zErr = "cannot delete";
goto update_fail;
}
- if( sqlite3_value_type(argv[0])==SQLITE_NULL ){
- pgno = (Pgno)sqlite3_value_int(argv[2]);
- isInsert = 1;
- }else{
- pgno = sqlite3_value_int(argv[0]);
- if( (Pgno)sqlite3_value_int(argv[1])!=pgno ){
- zErr = "cannot insert";
- goto update_fail;
- }
- isInsert = 0;
+ pgno = sqlite3_value_int(argv[0]);
+ if( sqlite3_value_type(argv[0])==SQLITE_NULL
+ || (Pgno)sqlite3_value_int(argv[1])!=pgno
+ ){
+ zErr = "cannot insert";
+ goto update_fail;
}
- if( sqlite3_value_type(argv[4])==SQLITE_NULL ){
- iDb = 0;
- }else{
- const char *zSchema = (const char*)sqlite3_value_text(argv[4]);
- iDb = sqlite3FindDbName(pTab->db, zSchema);
- if( iDb<0 ){
- zErr = "no such schema";
- goto update_fail;
- }
+ zSchema = (const char*)sqlite3_value_text(argv[4]);
+ iDb = ALWAYS(zSchema) ? sqlite3FindDbName(pTab->db, zSchema) : -1;
+ if( NEVER(iDb<0) ){
+ zErr = "no such schema";
+ goto update_fail;
}
pBt = pTab->db->aDb[iDb].pBt;
- if( pgno<1 || NEVER(pBt==0) ){
+ if( NEVER(pgno<1) || NEVER(pBt==0) || NEVER(pgno>sqlite3BtreeLastPage(pBt)) ){
zErr = "bad page number";
goto update_fail;
}
@@ -229539,83 +229364,51 @@ static int dbpageUpdate(
if( sqlite3_value_type(argv[3])!=SQLITE_BLOB
|| sqlite3_value_bytes(argv[3])!=szPage
){
- if( sqlite3_value_type(argv[3])==SQLITE_NULL && isInsert && pgno>1 ){
- /* "INSERT INTO dbpage($PGNO,NULL)" causes page number $PGNO and
- ** all subsequent pages to be deleted. */
- pTab->iDbTrunc = iDb;
- pgno--;
- pTab->pgnoTrunc = pgno;
- }else{
- zErr = "bad page value";
- goto update_fail;
- }
- }
-
- if( dbpageBeginTrans(pTab)!=SQLITE_OK ){
- zErr = "failed to open transaction";
+ zErr = "bad page value";
goto update_fail;
}
-
pPager = sqlite3BtreePager(pBt);
rc = sqlite3PagerGet(pPager, pgno, (DbPage**)&pDbPage, 0);
if( rc==SQLITE_OK ){
const void *pData = sqlite3_value_blob(argv[3]);
- if( (rc = sqlite3PagerWrite(pDbPage))==SQLITE_OK && pData ){
- unsigned char *aPage = sqlite3PagerGetData(pDbPage);
- memcpy(aPage, pData, szPage);
- pTab->pgnoTrunc = 0;
+ assert( pData!=0 || pTab->db->mallocFailed );
+ if( pData
+ && (rc = sqlite3PagerWrite(pDbPage))==SQLITE_OK
+ ){
+ memcpy(sqlite3PagerGetData(pDbPage), pData, szPage);
}
- }else{
- pTab->pgnoTrunc = 0;
}
sqlite3PagerUnref(pDbPage);
return rc;
update_fail:
- pTab->pgnoTrunc = 0;
sqlite3_free(pVtab->zErrMsg);
pVtab->zErrMsg = sqlite3_mprintf("%s", zErr);
return SQLITE_ERROR;
}
-static int dbpageBegin(sqlite3_vtab *pVtab){
- DbpageTable *pTab = (DbpageTable *)pVtab;
- pTab->pgnoTrunc = 0;
- return SQLITE_OK;
-}
-
-/* Invoke sqlite3PagerTruncate() as necessary, just prior to COMMIT
+/* Since we do not know in advance which database files will be
+** written by the sqlite_dbpage virtual table, start a write transaction
+** on them all.
*/
-static int dbpageSync(sqlite3_vtab *pVtab){
+static int dbpageBegin(sqlite3_vtab *pVtab){
DbpageTable *pTab = (DbpageTable *)pVtab;
- if( pTab->pgnoTrunc>0 ){
- Btree *pBt = pTab->db->aDb[pTab->iDbTrunc].pBt;
- Pager *pPager = sqlite3BtreePager(pBt);
- sqlite3BtreeEnter(pBt);
- if( pTab->pgnoTruncpgnoTrunc);
- }
- sqlite3BtreeLeave(pBt);
+ sqlite3 *db = pTab->db;
+ int i;
+ for(i=0; inDb; i++){
+ Btree *pBt = db->aDb[i].pBt;
+ if( pBt ) (void)sqlite3BtreeBeginTrans(pBt, 1, 0);
}
- pTab->pgnoTrunc = 0;
return SQLITE_OK;
}
-/* Cancel any pending truncate.
-*/
-static int dbpageRollbackTo(sqlite3_vtab *pVtab, int notUsed1){
- DbpageTable *pTab = (DbpageTable *)pVtab;
- pTab->pgnoTrunc = 0;
- (void)notUsed1;
- return SQLITE_OK;
-}
/*
** Invoke this routine to register the "dbpage" virtual table module
*/
SQLITE_PRIVATE int sqlite3DbpageRegister(sqlite3 *db){
static sqlite3_module dbpage_module = {
- 2, /* iVersion */
+ 0, /* iVersion */
dbpageConnect, /* xCreate */
dbpageConnect, /* xConnect */
dbpageBestIndex, /* xBestIndex */
@@ -229630,14 +229423,14 @@ SQLITE_PRIVATE int sqlite3DbpageRegister(sqlite3 *db){
dbpageRowid, /* xRowid - read data */
dbpageUpdate, /* xUpdate */
dbpageBegin, /* xBegin */
- dbpageSync, /* xSync */
+ 0, /* xSync */
0, /* xCommit */
0, /* xRollback */
0, /* xFindMethod */
0, /* xRename */
0, /* xSavepoint */
0, /* xRelease */
- dbpageRollbackTo, /* xRollbackTo */
+ 0, /* xRollbackTo */
0, /* xShadowName */
0 /* xIntegrity */
};
@@ -229732,10 +229525,6 @@ struct SessionBuffer {
** input data. Input data may be supplied either as a single large buffer
** (e.g. sqlite3changeset_start()) or using a stream function (e.g.
** sqlite3changeset_start_strm()).
-**
-** bNoDiscard:
-** If true, then the only time data is discarded is as a result of explicit
-** sessionDiscardData() calls. Not within every sessionInputBuffer() call.
*/
struct SessionInput {
int bNoDiscard; /* If true, do not discard in InputBuffer() */
@@ -229798,13 +229587,11 @@ struct sqlite3_changeset_iter {
struct SessionTable {
SessionTable *pNext;
char *zName; /* Local name of table */
- int nCol; /* Number of non-hidden columns */
- int nTotalCol; /* Number of columns including hidden */
+ int nCol; /* Number of columns in table zName */
int bStat1; /* True if this is sqlite_stat1 */
int bRowid; /* True if this table uses rowid for PK */
const char **azCol; /* Column names */
const char **azDflt; /* Default value expressions */
- int *aiIdx; /* Index to pass to xNew/xOld */
u8 *abPK; /* Array of primary key flags */
int nEntry; /* Total number of entries in hash table */
int nChange; /* Size of apChange[] array */
@@ -230207,22 +229994,22 @@ static int sessionPreupdateHash(
unsigned int h = 0; /* Hash value to return */
int i; /* Used to iterate through columns */
- assert( pTab->nTotalCol==pSession->hook.xCount(pSession->hook.pCtx) );
if( pTab->bRowid ){
+ assert( pTab->nCol-1==pSession->hook.xCount(pSession->hook.pCtx) );
h = sessionHashAppendI64(h, iRowid);
}else{
assert( *pbNullPK==0 );
+ assert( pTab->nCol==pSession->hook.xCount(pSession->hook.pCtx) );
for(i=0; inCol; i++){
if( pTab->abPK[i] ){
int rc;
int eType;
sqlite3_value *pVal;
- int iIdx = pTab->aiIdx[i];
if( bNew ){
- rc = pSession->hook.xNew(pSession->hook.pCtx, iIdx, &pVal);
+ rc = pSession->hook.xNew(pSession->hook.pCtx, i, &pVal);
}else{
- rc = pSession->hook.xOld(pSession->hook.pCtx, iIdx, &pVal);
+ rc = pSession->hook.xOld(pSession->hook.pCtx, i, &pVal);
}
if( rc!=SQLITE_OK ) return rc;
@@ -230559,7 +230346,6 @@ static int sessionPreupdateEqual(
sqlite3_value *pVal; /* Value returned by preupdate_new/old */
int rc; /* Error code from preupdate_new/old */
int eType = *a++; /* Type of value from change record */
- int iIdx = pTab->aiIdx[iCol];
/* The following calls to preupdate_new() and preupdate_old() can not
** fail. This is because they cache their return values, and by the
@@ -230568,10 +230354,10 @@ static int sessionPreupdateEqual(
** this (that the method has already been called). */
if( op==SQLITE_INSERT ){
/* assert( db->pPreUpdate->pNewUnpacked || db->pPreUpdate->aNew ); */
- rc = pSession->hook.xNew(pSession->hook.pCtx, iIdx, &pVal);
+ rc = pSession->hook.xNew(pSession->hook.pCtx, iCol, &pVal);
}else{
/* assert( db->pPreUpdate->pUnpacked ); */
- rc = pSession->hook.xOld(pSession->hook.pCtx, iIdx, &pVal);
+ rc = pSession->hook.xOld(pSession->hook.pCtx, iCol, &pVal);
}
assert( rc==SQLITE_OK );
(void)rc; /* Suppress warning about unused variable */
@@ -230696,11 +230482,9 @@ static int sessionTableInfo(
const char *zDb, /* Name of attached database (e.g. "main") */
const char *zThis, /* Table name */
int *pnCol, /* OUT: number of columns */
- int *pnTotalCol, /* OUT: number of hidden columns */
const char **pzTab, /* OUT: Copy of zThis */
const char ***pazCol, /* OUT: Array of column names for table */
const char ***pazDflt, /* OUT: Array of default value expressions */
- int **paiIdx, /* OUT: Array of xNew/xOld indexes */
u8 **pabPK, /* OUT: Array of booleans - true for PK col */
int *pbRowid /* OUT: True if only PK is a rowid */
){
@@ -230715,7 +230499,6 @@ static int sessionTableInfo(
char **azCol = 0;
char **azDflt = 0;
u8 *abPK = 0;
- int *aiIdx = 0;
int bRowid = 0; /* Set to true to use rowid as PK */
assert( pazCol && pabPK );
@@ -230723,8 +230506,6 @@ static int sessionTableInfo(
*pazCol = 0;
*pabPK = 0;
*pnCol = 0;
- if( pnTotalCol ) *pnTotalCol = 0;
- if( paiIdx ) *paiIdx = 0;
if( pzTab ) *pzTab = 0;
if( pazDflt ) *pazDflt = 0;
@@ -230734,9 +230515,9 @@ static int sessionTableInfo(
if( rc==SQLITE_OK ){
/* For sqlite_stat1, pretend that (tbl,idx) is the PRIMARY KEY. */
zPragma = sqlite3_mprintf(
- "SELECT 0, 'tbl', '', 0, '', 1, 0 UNION ALL "
- "SELECT 1, 'idx', '', 0, '', 2, 0 UNION ALL "
- "SELECT 2, 'stat', '', 0, '', 0, 0"
+ "SELECT 0, 'tbl', '', 0, '', 1 UNION ALL "
+ "SELECT 1, 'idx', '', 0, '', 2 UNION ALL "
+ "SELECT 2, 'stat', '', 0, '', 0"
);
}else if( rc==SQLITE_ERROR ){
zPragma = sqlite3_mprintf("");
@@ -230744,7 +230525,7 @@ static int sessionTableInfo(
return rc;
}
}else{
- zPragma = sqlite3_mprintf("PRAGMA '%q'.table_xinfo('%q')", zDb, zThis);
+ zPragma = sqlite3_mprintf("PRAGMA '%q'.table_info('%q')", zDb, zThis);
}
if( !zPragma ){
return SQLITE_NOMEM;
@@ -230761,9 +230542,7 @@ static int sessionTableInfo(
while( SQLITE_ROW==sqlite3_step(pStmt) ){
nByte += sqlite3_column_bytes(pStmt, 1); /* name */
nByte += sqlite3_column_bytes(pStmt, 4); /* dflt_value */
- if( sqlite3_column_int(pStmt, 6)==0 ){ /* !hidden */
- nDbCol++;
- }
+ nDbCol++;
if( sqlite3_column_int(pStmt, 5) ) bRowid = 0; /* pk */
}
if( nDbCol==0 ) bRowid = 0;
@@ -230772,7 +230551,7 @@ static int sessionTableInfo(
rc = sqlite3_reset(pStmt);
if( rc==SQLITE_OK ){
- nByte += nDbCol * (sizeof(const char *)*2 +sizeof(int)+sizeof(u8) + 1 + 1);
+ nByte += nDbCol * (sizeof(const char *)*2 + sizeof(u8) + 1 + 1);
pAlloc = sessionMalloc64(pSession, nByte);
if( pAlloc==0 ){
rc = SQLITE_NOMEM;
@@ -230783,8 +230562,8 @@ static int sessionTableInfo(
if( rc==SQLITE_OK ){
azCol = (char **)pAlloc;
azDflt = (char**)&azCol[nDbCol];
- aiIdx = (int*)&azDflt[nDbCol];
- abPK = (u8 *)&aiIdx[nDbCol];
+ pAlloc = (u8 *)&azDflt[nDbCol];
+ abPK = (u8 *)pAlloc;
pAlloc = &abPK[nDbCol];
if( pzTab ){
memcpy(pAlloc, zThis, nThis+1);
@@ -230799,32 +230578,27 @@ static int sessionTableInfo(
azCol[i] = (char*)pAlloc;
pAlloc += nName+1;
abPK[i] = 1;
- aiIdx[i] = -1;
i++;
}
while( SQLITE_ROW==sqlite3_step(pStmt) ){
- if( sqlite3_column_int(pStmt, 6)==0 ){ /* !hidden */
- int nName = sqlite3_column_bytes(pStmt, 1);
- int nDflt = sqlite3_column_bytes(pStmt, 4);
- const unsigned char *zName = sqlite3_column_text(pStmt, 1);
- const unsigned char *zDflt = sqlite3_column_text(pStmt, 4);
-
- if( zName==0 ) break;
- memcpy(pAlloc, zName, nName+1);
- azCol[i] = (char *)pAlloc;
- pAlloc += nName+1;
- if( zDflt ){
- memcpy(pAlloc, zDflt, nDflt+1);
- azDflt[i] = (char *)pAlloc;
- pAlloc += nDflt+1;
- }else{
- azDflt[i] = 0;
- }
- abPK[i] = sqlite3_column_int(pStmt, 5);
- aiIdx[i] = sqlite3_column_int(pStmt, 0);
- i++;
+ int nName = sqlite3_column_bytes(pStmt, 1);
+ int nDflt = sqlite3_column_bytes(pStmt, 4);
+ const unsigned char *zName = sqlite3_column_text(pStmt, 1);
+ const unsigned char *zDflt = sqlite3_column_text(pStmt, 4);
+
+ if( zName==0 ) break;
+ memcpy(pAlloc, zName, nName+1);
+ azCol[i] = (char *)pAlloc;
+ pAlloc += nName+1;
+ if( zDflt ){
+ memcpy(pAlloc, zDflt, nDflt+1);
+ azDflt[i] = (char *)pAlloc;
+ pAlloc += nDflt+1;
+ }else{
+ azDflt[i] = 0;
}
- if( pnTotalCol ) (*pnTotalCol)++;
+ abPK[i] = sqlite3_column_int(pStmt, 5);
+ i++;
}
rc = sqlite3_reset(pStmt);
}
@@ -230837,7 +230611,6 @@ static int sessionTableInfo(
if( pazDflt ) *pazDflt = (const char**)azDflt;
*pabPK = abPK;
*pnCol = nDbCol;
- if( paiIdx ) *paiIdx = aiIdx;
}else{
sessionFree(pSession, azCol);
}
@@ -230869,8 +230642,7 @@ static int sessionInitTable(
u8 *abPK;
assert( pTab->azCol==0 || pTab->abPK==0 );
rc = sessionTableInfo(pSession, db, zDb,
- pTab->zName, &pTab->nCol, &pTab->nTotalCol, 0, &pTab->azCol,
- &pTab->azDflt, &pTab->aiIdx, &abPK,
+ pTab->zName, &pTab->nCol, 0, &pTab->azCol, &pTab->azDflt, &abPK,
((pSession==0 || pSession->bImplicitPK) ? &pTab->bRowid : 0)
);
if( rc==SQLITE_OK ){
@@ -230905,17 +230677,15 @@ static int sessionInitTable(
*/
static int sessionReinitTable(sqlite3_session *pSession, SessionTable *pTab){
int nCol = 0;
- int nTotalCol = 0;
const char **azCol = 0;
const char **azDflt = 0;
- int *aiIdx = 0;
u8 *abPK = 0;
int bRowid = 0;
assert( pSession->rc==SQLITE_OK );
pSession->rc = sessionTableInfo(pSession, pSession->db, pSession->zDb,
- pTab->zName, &nCol, &nTotalCol, 0, &azCol, &azDflt, &aiIdx, &abPK,
+ pTab->zName, &nCol, 0, &azCol, &azDflt, &abPK,
(pSession->bImplicitPK ? &bRowid : 0)
);
if( pSession->rc==SQLITE_OK ){
@@ -230938,10 +230708,8 @@ static int sessionReinitTable(sqlite3_session *pSession, SessionTable *pTab){
const char **a = pTab->azCol;
pTab->azCol = azCol;
pTab->nCol = nCol;
- pTab->nTotalCol = nTotalCol;
pTab->azDflt = azDflt;
pTab->abPK = abPK;
- pTab->aiIdx = aiIdx;
azCol = a;
}
if( pSession->bEnableSize ){
@@ -231259,7 +231027,7 @@ static int sessionUpdateMaxSize(
int ii;
for(ii=0; iinCol; ii++){
sqlite3_value *p = 0;
- pSession->hook.xNew(pSession->hook.pCtx, pTab->aiIdx[ii], &p);
+ pSession->hook.xNew(pSession->hook.pCtx, ii, &p);
sessionSerializeValue(0, p, &nNew);
}
}
@@ -231279,9 +231047,8 @@ static int sessionUpdateMaxSize(
int bChanged = 1;
int nOld = 0;
int eType;
- int iIdx = pTab->aiIdx[ii];
sqlite3_value *p = 0;
- pSession->hook.xNew(pSession->hook.pCtx, iIdx, &p);
+ pSession->hook.xNew(pSession->hook.pCtx, ii-pTab->bRowid, &p);
if( p==0 ){
return SQLITE_NOMEM;
}
@@ -231378,11 +231145,11 @@ static void sessionPreupdateOneChange(
/* Check the number of columns in this xPreUpdate call matches the
** number of columns in the table. */
nExpect = pSession->hook.xCount(pSession->hook.pCtx);
- if( pTab->nTotalColnCol-pTab->bRowid)nTotalCol!=nExpect ){
+ if( (pTab->nCol-pTab->bRowid)!=nExpect ){
pSession->rc = SQLITE_SCHEMA;
return;
}
@@ -231439,23 +231206,19 @@ static void sessionPreupdateOneChange(
/* Figure out how large an allocation is required */
nByte = sizeof(SessionChange);
- for(i=pTab->bRowid; inCol; i++){
- int iIdx = pTab->aiIdx[i];
+ for(i=0; i<(pTab->nCol-pTab->bRowid); i++){
sqlite3_value *p = 0;
if( op!=SQLITE_INSERT ){
- /* This may fail if the column has a non-NULL default and was added
- ** using ALTER TABLE ADD COLUMN after this record was created. */
- rc = pSession->hook.xOld(pSession->hook.pCtx, iIdx, &p);
+ TESTONLY(int trc = ) pSession->hook.xOld(pSession->hook.pCtx, i, &p);
+ assert( trc==SQLITE_OK );
}else if( pTab->abPK[i] ){
- TESTONLY(int trc = ) pSession->hook.xNew(pSession->hook.pCtx,iIdx,&p);
+ TESTONLY(int trc = ) pSession->hook.xNew(pSession->hook.pCtx, i, &p);
assert( trc==SQLITE_OK );
}
- if( rc==SQLITE_OK ){
- /* This may fail if SQLite value p contains a utf-16 string that must
- ** be converted to utf-8 and an OOM error occurs while doing so. */
- rc = sessionSerializeValue(0, p, &nByte);
- }
+ /* This may fail if SQLite value p contains a utf-16 string that must
+ ** be converted to utf-8 and an OOM error occurs while doing so. */
+ rc = sessionSerializeValue(0, p, &nByte);
if( rc!=SQLITE_OK ) goto error_out;
}
if( pTab->bRowid ){
@@ -231482,13 +231245,12 @@ static void sessionPreupdateOneChange(
sessionPutI64(&pC->aRecord[1], iRowid);
nByte = 9;
}
- for(i=pTab->bRowid; inCol; i++){
+ for(i=0; i<(pTab->nCol-pTab->bRowid); i++){
sqlite3_value *p = 0;
- int iIdx = pTab->aiIdx[i];
if( op!=SQLITE_INSERT ){
- pSession->hook.xOld(pSession->hook.pCtx, iIdx, &p);
+ pSession->hook.xOld(pSession->hook.pCtx, i, &p);
}else if( pTab->abPK[i] ){
- pSession->hook.xNew(pSession->hook.pCtx, iIdx, &p);
+ pSession->hook.xNew(pSession->hook.pCtx, i, &p);
}
sessionSerializeValue(&pC->aRecord[nByte], p, &nByte);
}
@@ -231890,8 +231652,7 @@ SQLITE_API int sqlite3session_diff(
int bRowid = 0;
u8 *abPK;
const char **azCol = 0;
- rc = sessionTableInfo(0, db, zFrom, zTbl,
- &nCol, 0, 0, &azCol, 0, 0, &abPK,
+ rc = sessionTableInfo(0, db, zFrom, zTbl, &nCol, 0, &azCol, 0, &abPK,
pSession->bImplicitPK ? &bRowid : 0
);
if( rc==SQLITE_OK ){
@@ -232215,11 +231976,9 @@ static void sessionAppendIdent(
char *zOut = (char *)&p->aBuf[p->nBuf];
const char *zIn = zStr;
*zOut++ = '"';
- if( zIn!=0 ){
- while( *zIn ){
- if( *zIn=='"' ) *zOut++ = '"';
- *zOut++ = *(zIn++);
- }
+ while( *zIn ){
+ if( *zIn=='"' ) *zOut++ = '"';
+ *zOut++ = *(zIn++);
}
*zOut++ = '"';
p->nBuf = (int)((u8 *)zOut - p->aBuf);
@@ -232470,10 +232229,10 @@ static int sessionSelectStmt(
int rc = SQLITE_OK;
char *zSql = 0;
const char *zSep = "";
+ const char *zCols = bRowid ? SESSIONS_ROWID ", *" : "*";
int nSql = -1;
int i;
- SessionBuffer cols = {0, 0, 0};
SessionBuffer nooptest = {0, 0, 0};
SessionBuffer pkfield = {0, 0, 0};
SessionBuffer pkvar = {0, 0, 0};
@@ -232486,16 +232245,9 @@ static int sessionSelectStmt(
sessionAppendStr(&pkvar,
"?1, (CASE WHEN ?2=X'' THEN NULL ELSE ?2 END)", &rc
);
- sessionAppendStr(&cols, "tbl, ?2, stat", &rc);
+ zCols = "tbl, ?2, stat";
}else{
- #if 0
- if( bRowid ){
- sessionAppendStr(&cols, SESSIONS_ROWID, &rc);
- }
- #endif
for(i=0; iflags & SQLITE_FkNoAction;
assert( xConflict!=0 );
- sqlite3_mutex_enter(sqlite3_db_mutex(db));
- if( flags & SQLITE_CHANGESETAPPLY_FKNOACTION ){
- db->flags |= ((u64)SQLITE_FkNoAction);
- db->aDb[0].pSchema->schema_cookie -= 32;
- }
-
pIter->in.bNoDiscard = 1;
memset(&sApply, 0, sizeof(sApply));
sApply.bRebase = (ppRebase && pnRebase);
sApply.bInvertConstraints = !!(flags & SQLITE_CHANGESETAPPLY_INVERT);
sApply.bIgnoreNoop = !!(flags & SQLITE_CHANGESETAPPLY_IGNORENOOP);
+ sqlite3_mutex_enter(sqlite3_db_mutex(db));
if( (flags & SQLITE_CHANGESETAPPLY_NOSAVEPOINT)==0 ){
rc = sqlite3_exec(db, "SAVEPOINT changeset_apply", 0, 0, 0);
}
@@ -234920,8 +234665,7 @@ static int sessionChangesetApply(
sqlite3changeset_pk(pIter, &abPK, 0);
rc = sessionTableInfo(0, db, "main", zNew,
- &sApply.nCol, 0, &zTab, &sApply.azCol, 0, 0,
- &sApply.abPK, &sApply.bRowid
+ &sApply.nCol, &zTab, &sApply.azCol, 0, &sApply.abPK, &sApply.bRowid
);
if( rc!=SQLITE_OK ) break;
for(i=0; iflags & SQLITE_FkNoAction );
- db->flags &= ~((u64)SQLITE_FkNoAction);
- db->aDb[0].pSchema->schema_cookie -= 32;
- }
sqlite3_mutex_leave(sqlite3_db_mutex(db));
return rc;
}
@@ -235064,6 +234797,12 @@ SQLITE_API int sqlite3changeset_apply_v2(
sqlite3_changeset_iter *pIter; /* Iterator to skip through changeset */
int bInv = !!(flags & SQLITE_CHANGESETAPPLY_INVERT);
int rc = sessionChangesetStart(&pIter, 0, 0, nChangeset, pChangeset, bInv, 1);
+ u64 savedFlag = db->flags & SQLITE_FkNoAction;
+
+ if( flags & SQLITE_CHANGESETAPPLY_FKNOACTION ){
+ db->flags |= ((u64)SQLITE_FkNoAction);
+ db->aDb[0].pSchema->schema_cookie -= 32;
+ }
if( rc==SQLITE_OK ){
rc = sessionChangesetApply(
@@ -235071,6 +234810,11 @@ SQLITE_API int sqlite3changeset_apply_v2(
);
}
+ if( (flags & SQLITE_CHANGESETAPPLY_FKNOACTION) && savedFlag==0 ){
+ assert( db->flags & SQLITE_FkNoAction );
+ db->flags &= ~((u64)SQLITE_FkNoAction);
+ db->aDb[0].pSchema->schema_cookie -= 32;
+ }
return rc;
}
@@ -235391,9 +235135,6 @@ static int sessionChangesetExtendRecord(
sessionAppendBlob(pOut, aRec, nRec, &rc);
if( rc==SQLITE_OK && pTab->pDfltStmt==0 ){
rc = sessionPrepareDfltStmt(pGrp->db, pTab, &pTab->pDfltStmt);
- if( rc==SQLITE_OK && SQLITE_ROW!=sqlite3_step(pTab->pDfltStmt) ){
- rc = sqlite3_errcode(pGrp->db);
- }
}
for(ii=nCol; rc==SQLITE_OK && iinCol; ii++){
int eType = sqlite3_column_type(pTab->pDfltStmt, ii);
@@ -235410,7 +235151,6 @@ static int sessionChangesetExtendRecord(
}
if( SQLITE_OK==sessionBufferGrow(pOut, 8, &rc) ){
sessionPutI64(&pOut->aBuf[pOut->nBuf], iVal);
- pOut->nBuf += 8;
}
break;
}
@@ -235550,8 +235290,6 @@ static int sessionOneChangeToHash(
u8 *aRec = &pIter->in.aData[pIter->in.iCurrent + 2];
int nRec = (pIter->in.iNext - pIter->in.iCurrent) - 2;
- assert( nRec>0 );
-
/* Ensure that only changesets, or only patchsets, but not a mixture
** of both, are being combined. It is an error to try to combine a
** changeset and a patchset. */
@@ -235629,7 +235367,6 @@ static int sessionChangesetToHash(
int nRec;
int rc = SQLITE_OK;
- pIter->in.bNoDiscard = 1;
while( SQLITE_ROW==(sessionChangesetNext(pIter, &aRec, &nRec, 0)) ){
rc = sessionOneChangeToHash(pGrp, pIter, bRebase);
if( rc!=SQLITE_OK ) break;
@@ -236262,27 +235999,7 @@ SQLITE_API int sqlite3session_config(int op, void *pArg){
/************** End of sqlite3session.c **************************************/
/************** Begin file fts5.c ********************************************/
-/*
-** This, the "fts5.c" source file, is a composite file that is itself
-** assembled from the following files:
-**
-** fts5.h
-** fts5Int.h
-** fts5parse.h <--- Generated from fts5parse.y by Lemon
-** fts5parse.c <--- Generated from fts5parse.y by Lemon
-** fts5_aux.c
-** fts5_buffer.c
-** fts5_config.c
-** fts5_expr.c
-** fts5_hash.c
-** fts5_index.c
-** fts5_main.c
-** fts5_storage.c
-** fts5_tokenize.c
-** fts5_unicode2.c
-** fts5_varint.c
-** fts5_vocab.c
-*/
+
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS5)
#if !defined(NDEBUG) && !defined(SQLITE_DEBUG)
@@ -236292,12 +236009,6 @@ SQLITE_API int sqlite3session_config(int op, void *pArg){
# undef NDEBUG
#endif
-#ifdef HAVE_STDINT_H
-/* #include */
-#endif
-#ifdef HAVE_INTTYPES_H
-/* #include */
-#endif
/*
** 2014 May 31
**
@@ -236598,29 +236309,14 @@ struct Fts5PhraseIter {
** value returned by xInstCount(), SQLITE_RANGE is returned. Otherwise,
** output variable (*ppToken) is set to point to a buffer containing the
** matching document token, and (*pnToken) to the size of that buffer in
-** bytes.
+** bytes. This API is not available if the specified token matches a
+** prefix query term. In that case both output variables are always set
+** to 0.
**
** The output text is not a copy of the document text that was tokenized.
** It is the output of the tokenizer module. For tokendata=1 tables, this
** includes any embedded 0x00 and trailing data.
**
-** This API may be slow in some cases if the token identified by parameters
-** iIdx and iToken matched a prefix token in the query. In most cases, the
-** first call to this API for each prefix token in the query is forced
-** to scan the portion of the full-text index that matches the prefix
-** token to collect the extra data required by this API. If the prefix
-** token matches a large number of token instances in the document set,
-** this may be a performance problem.
-**
-** If the user knows in advance that a query may use this API for a
-** prefix token, FTS5 may be configured to collect all required data as part
-** of the initial querying of the full-text index, avoiding the second scan
-** entirely. This also causes prefix queries that do not use this API to
-** run more slowly and use more memory. FTS5 may be configured in this way
-** either on a per-table basis using the [FTS5 insttoken | 'insttoken']
-** option, or on a per-query basis using the
-** [fts5_insttoken | fts5_insttoken()] user function.
-**
** This API can be quite slow if used with an FTS5 table created with the
** "detail=none" or "detail=column" option.
**
@@ -236711,6 +236407,7 @@ struct Fts5ExtensionApi {
** Applications may also register custom tokenizer types. A tokenizer
** is registered by providing fts5 with a populated instance of the
** following structure. All structure methods must be defined, setting
+**
** any member of the fts5_tokenizer struct to NULL leads to undefined
** behaviour. The structure methods are expected to function as follows:
**
@@ -237279,7 +236976,6 @@ struct Fts5Config {
int *aPrefix; /* Sizes in bytes of nPrefix prefix indexes */
int eContent; /* An FTS5_CONTENT value */
int bContentlessDelete; /* "contentless_delete=" option (dflt==0) */
- int bContentlessUnindexed; /* "contentless_unindexed=" option (dflt=0) */
char *zContent; /* content table */
char *zContentRowid; /* "content_rowid=" option value */
int bColumnsize; /* "columnsize=" option value (dflt==1) */
@@ -237302,8 +236998,7 @@ struct Fts5Config {
char *zRank; /* Name of rank function */
char *zRankArgs; /* Arguments to rank function */
int bSecureDelete; /* 'secure-delete' */
- int nDeleteMerge; /* 'deletemerge' */
- int bPrefixInsttoken; /* 'prefix-insttoken' */
+ int nDeleteMerge; /* 'deletemerge' */
/* If non-NULL, points to sqlite3_vtab.base.zErrmsg. Often NULL. */
char **pzErrmsg;
@@ -237319,10 +237014,9 @@ struct Fts5Config {
#define FTS5_CURRENT_VERSION 4
#define FTS5_CURRENT_VERSION_SECUREDELETE 5
-#define FTS5_CONTENT_NORMAL 0
-#define FTS5_CONTENT_NONE 1
-#define FTS5_CONTENT_EXTERNAL 2
-#define FTS5_CONTENT_UNINDEXED 3
+#define FTS5_CONTENT_NORMAL 0
+#define FTS5_CONTENT_NONE 1
+#define FTS5_CONTENT_EXTERNAL 2
#define FTS5_DETAIL_FULL 0
#define FTS5_DETAIL_NONE 1
@@ -237560,14 +237254,7 @@ static int sqlite3Fts5StructureTest(Fts5Index*, void*);
/*
** Used by xInstToken():
*/
-static int sqlite3Fts5IterToken(
- Fts5IndexIter *pIndexIter,
- const char *pToken, int nToken,
- i64 iRowid,
- int iCol,
- int iOff,
- const char **ppOut, int *pnOut
-);
+static int sqlite3Fts5IterToken(Fts5IndexIter*, i64, int, int, const char**, int*);
/*
** Insert or remove data to or from the index. Each time a document is
@@ -237701,14 +237388,17 @@ static Fts5Table *sqlite3Fts5TableFromCsrid(Fts5Global*, i64);
static int sqlite3Fts5FlushToDisk(Fts5Table*);
-static void sqlite3Fts5ClearLocale(Fts5Config *pConfig);
-static void sqlite3Fts5SetLocale(Fts5Config *pConfig, const char *pLoc, int nLoc);
-
-static int sqlite3Fts5IsLocaleValue(Fts5Config *pConfig, sqlite3_value *pVal);
-static int sqlite3Fts5DecodeLocaleValue(sqlite3_value *pVal,
- const char **ppText, int *pnText, const char **ppLoc, int *pnLoc
+static int sqlite3Fts5ExtractText(
+ Fts5Config *pConfig,
+ sqlite3_value *pVal, /* Value to extract text from */
+ int bContent, /* Loaded from content table */
+ int *pbResetTokenizer, /* OUT: True if ClearLocale() required */
+ const char **ppText, /* OUT: Pointer to text buffer */
+ int *pnText /* OUT: Size of (*ppText) in bytes */
);
+static void sqlite3Fts5ClearLocale(Fts5Config *pConfig);
+
/*
** End of interface to code in fts5.c.
**************************************************************************/
@@ -237789,7 +237479,7 @@ static int sqlite3Fts5DropAll(Fts5Config*);
static int sqlite3Fts5CreateTable(Fts5Config*, const char*, const char*, int, char **);
static int sqlite3Fts5StorageDelete(Fts5Storage *p, i64, sqlite3_value**, int);
-static int sqlite3Fts5StorageContentInsert(Fts5Storage *p, int, sqlite3_value**, i64*);
+static int sqlite3Fts5StorageContentInsert(Fts5Storage *p, sqlite3_value**, i64*);
static int sqlite3Fts5StorageIndexInsert(Fts5Storage *p, sqlite3_value**, i64);
static int sqlite3Fts5StorageIntegrity(Fts5Storage *p, int iArg);
@@ -240996,7 +240686,6 @@ static int fts5ConfigParseSpecial(
){
int rc = SQLITE_OK;
int nCmd = (int)strlen(zCmd);
-
if( sqlite3_strnicmp("prefix", zCmd, nCmd)==0 ){
const int nByte = sizeof(int) * FTS5_MAX_PREFIX_INDEXES;
const char *p;
@@ -241116,16 +240805,6 @@ static int fts5ConfigParseSpecial(
return rc;
}
- if( sqlite3_strnicmp("contentless_unindexed", zCmd, nCmd)==0 ){
- if( (zArg[0]!='0' && zArg[0]!='1') || zArg[1]!='\0' ){
- *pzErr = sqlite3_mprintf("malformed contentless_delete=... directive");
- rc = SQLITE_ERROR;
- }else{
- pConfig->bContentlessUnindexed = (zArg[0]=='1');
- }
- return rc;
- }
-
if( sqlite3_strnicmp("content_rowid", zCmd, nCmd)==0 ){
if( pConfig->zContentRowid ){
*pzErr = sqlite3_mprintf("multiple content_rowid=... directives");
@@ -241243,8 +240922,7 @@ static int fts5ConfigParseColumn(
Fts5Config *p,
char *zCol,
char *zArg,
- char **pzErr,
- int *pbUnindexed
+ char **pzErr
){
int rc = SQLITE_OK;
if( 0==sqlite3_stricmp(zCol, FTS5_RANK_NAME)
@@ -241255,7 +240933,6 @@ static int fts5ConfigParseColumn(
}else if( zArg ){
if( 0==sqlite3_stricmp(zArg, "unindexed") ){
p->abUnindexed[p->nCol] = 1;
- *pbUnindexed = 1;
}else{
*pzErr = sqlite3_mprintf("unrecognized column option: %s", zArg);
rc = SQLITE_ERROR;
@@ -241276,26 +240953,11 @@ static int fts5ConfigMakeExprlist(Fts5Config *p){
sqlite3Fts5BufferAppendPrintf(&rc, &buf, "T.%Q", p->zContentRowid);
if( p->eContent!=FTS5_CONTENT_NONE ){
- assert( p->eContent==FTS5_CONTENT_EXTERNAL
- || p->eContent==FTS5_CONTENT_NORMAL
- || p->eContent==FTS5_CONTENT_UNINDEXED
- );
for(i=0; inCol; i++){
if( p->eContent==FTS5_CONTENT_EXTERNAL ){
sqlite3Fts5BufferAppendPrintf(&rc, &buf, ", T.%Q", p->azCol[i]);
- }else if( p->eContent==FTS5_CONTENT_NORMAL || p->abUnindexed[i] ){
- sqlite3Fts5BufferAppendPrintf(&rc, &buf, ", T.c%d", i);
}else{
- sqlite3Fts5BufferAppendPrintf(&rc, &buf, ", NULL");
- }
- }
- }
- if( p->eContent==FTS5_CONTENT_NORMAL && p->bLocale ){
- for(i=0; inCol; i++){
- if( p->abUnindexed[i]==0 ){
- sqlite3Fts5BufferAppendPrintf(&rc, &buf, ", T.l%d", i);
- }else{
- sqlite3Fts5BufferAppendPrintf(&rc, &buf, ", NULL");
+ sqlite3Fts5BufferAppendPrintf(&rc, &buf, ", T.c%d", i);
}
}
}
@@ -241329,7 +240991,6 @@ static int sqlite3Fts5ConfigParse(
Fts5Config *pRet; /* New object to return */
int i;
sqlite3_int64 nByte;
- int bUnindexed = 0; /* True if there are one or more UNINDEXED */
*ppOut = pRet = (Fts5Config*)sqlite3_malloc(sizeof(Fts5Config));
if( pRet==0 ) return SQLITE_NOMEM;
@@ -241389,7 +241050,7 @@ static int sqlite3Fts5ConfigParse(
pzErr
);
}else{
- rc = fts5ConfigParseColumn(pRet, zOne, zTwo, pzErr, &bUnindexed);
+ rc = fts5ConfigParseColumn(pRet, zOne, zTwo, pzErr);
zOne = 0;
}
}
@@ -241421,19 +241082,6 @@ static int sqlite3Fts5ConfigParse(
rc = SQLITE_ERROR;
}
- /* We only allow contentless_unindexed=1 if the table is actually a
- ** contentless one.
- */
- if( rc==SQLITE_OK
- && pRet->bContentlessUnindexed
- && pRet->eContent!=FTS5_CONTENT_NONE
- ){
- *pzErr = sqlite3_mprintf(
- "contentless_unindexed=1 requires a contentless table"
- );
- rc = SQLITE_ERROR;
- }
-
/* If no zContent option was specified, fill in the default values. */
if( rc==SQLITE_OK && pRet->zContent==0 ){
const char *zTail = 0;
@@ -241442,9 +241090,6 @@ static int sqlite3Fts5ConfigParse(
);
if( pRet->eContent==FTS5_CONTENT_NORMAL ){
zTail = "content";
- }else if( bUnindexed && pRet->bContentlessUnindexed ){
- pRet->eContent = FTS5_CONTENT_UNINDEXED;
- zTail = "content";
}else if( pRet->bColumnsize ){
zTail = "docsize";
}
@@ -241781,19 +241426,6 @@ static int sqlite3Fts5ConfigSetValue(
}else{
pConfig->bSecureDelete = (bVal ? 1 : 0);
}
- }
-
- else if( 0==sqlite3_stricmp(zKey, "insttoken") ){
- int bVal = -1;
- if( SQLITE_INTEGER==sqlite3_value_numeric_type(pVal) ){
- bVal = sqlite3_value_int(pVal);
- }
- if( bVal<0 ){
- *pbBadkey = 1;
- }else{
- pConfig->bPrefixInsttoken = (bVal ? 1 : 0);
- }
-
}else{
*pbBadkey = 1;
}
@@ -244929,7 +244561,7 @@ static int fts5ExprPopulatePoslistsCb(
int rc = sqlite3Fts5PoslistWriterAppend(
&pExpr->apExprPhrase[i]->poslist, &p->aPopulator[i].writer, p->iOff
);
- if( rc==SQLITE_OK && (pExpr->pConfig->bTokendata || pT->bPrefix) ){
+ if( rc==SQLITE_OK && pExpr->pConfig->bTokendata && !pT->bPrefix ){
int iCol = p->iOff>>32;
int iTokOff = p->iOff & 0x7FFFFFFF;
rc = sqlite3Fts5IndexIterWriteTokendata(
@@ -245122,14 +244754,15 @@ static int sqlite3Fts5ExprInstToken(
return SQLITE_RANGE;
}
pTerm = &pPhrase->aTerm[iToken];
- if( pExpr->pConfig->bTokendata || pTerm->bPrefix ){
- rc = sqlite3Fts5IterToken(
- pTerm->pIter, pTerm->pTerm, pTerm->nQueryTerm,
- iRowid, iCol, iOff+iToken, ppOut, pnOut
- );
- }else{
- *ppOut = pTerm->pTerm;
- *pnOut = pTerm->nFullTerm;
+ if( pTerm->bPrefix==0 ){
+ if( pExpr->pConfig->bTokendata ){
+ rc = sqlite3Fts5IterToken(
+ pTerm->pIter, iRowid, iCol, iOff+iToken, ppOut, pnOut
+ );
+ }else{
+ *ppOut = pTerm->pTerm;
+ *pnOut = pTerm->nFullTerm;
+ }
}
return rc;
}
@@ -246519,13 +246152,11 @@ static int fts5LeafFirstTermOff(Fts5Data *pLeaf){
/*
** Close the read-only blob handle, if it is open.
*/
-static void fts5IndexCloseReader(Fts5Index *p){
+static void sqlite3Fts5IndexCloseReader(Fts5Index *p){
if( p->pReader ){
- int rc;
sqlite3_blob *pReader = p->pReader;
p->pReader = 0;
- rc = sqlite3_blob_close(pReader);
- if( p->rc==SQLITE_OK ) p->rc = rc;
+ sqlite3_blob_close(pReader);
}
}
@@ -246550,7 +246181,7 @@ static Fts5Data *fts5DataRead(Fts5Index *p, i64 iRowid){
assert( p->pReader==0 );
p->pReader = pBlob;
if( rc!=SQLITE_OK ){
- fts5IndexCloseReader(p);
+ sqlite3Fts5IndexCloseReader(p);
}
if( rc==SQLITE_ABORT ) rc = SQLITE_OK;
}
@@ -246634,13 +246265,9 @@ static int fts5IndexPrepareStmt(
){
if( p->rc==SQLITE_OK ){
if( zSql ){
- int rc = sqlite3_prepare_v3(p->pConfig->db, zSql, -1,
+ p->rc = sqlite3_prepare_v3(p->pConfig->db, zSql, -1,
SQLITE_PREPARE_PERSISTENT|SQLITE_PREPARE_NO_VTAB,
ppStmt, 0);
- /* If this prepare() call fails with SQLITE_ERROR, then one of the
- ** %_idx or %_data tables has been removed or modified. Call this
- ** corruption. */
- p->rc = (rc==SQLITE_ERROR ? SQLITE_CORRUPT : rc);
}else{
p->rc = SQLITE_NOMEM;
}
@@ -250636,11 +250263,6 @@ static int fts5IndexFindDeleteMerge(Fts5Index *p, Fts5Structure *pStruct){
nBest = nPercent;
}
}
-
- /* If pLvl is already the input level to an ongoing merge, look no
- ** further for a merge candidate. The caller should be allowed to
- ** continue merging from pLvl first. */
- if( pLvl->nMerge ) break;
}
}
return iRet;
@@ -250752,14 +250374,6 @@ static int fts5IndexReturn(Fts5Index *p){
return rc;
}
-/*
-** Close the read-only blob handle, if it is open.
-*/
-static void sqlite3Fts5IndexCloseReader(Fts5Index *p){
- fts5IndexCloseReader(p);
- fts5IndexReturn(p);
-}
-
typedef struct Fts5FlushCtx Fts5FlushCtx;
struct Fts5FlushCtx {
Fts5Index *pIdx;
@@ -251217,11 +250831,8 @@ static void fts5DoSecureDelete(
** This is called as part of flushing a delete to disk in 'secure-delete'
** mode. It edits the segments within the database described by argument
** pStruct to remove the entries for term zTerm, rowid iRowid.
-**
-** Return SQLITE_OK if successful, or an SQLite error code if an error
-** has occurred. Any error code is also stored in the Fts5Index handle.
*/
-static int fts5FlushSecureDelete(
+static void fts5FlushSecureDelete(
Fts5Index *p,
Fts5Structure *pStruct,
const char *zTerm,
@@ -251231,24 +250842,6 @@ static int fts5FlushSecureDelete(
const int f = FTS5INDEX_QUERY_SKIPHASH;
Fts5Iter *pIter = 0; /* Used to find term instance */
- /* If the version number has not been set to SECUREDELETE, do so now. */
- if( p->pConfig->iVersion!=FTS5_CURRENT_VERSION_SECUREDELETE ){
- Fts5Config *pConfig = p->pConfig;
- sqlite3_stmt *pStmt = 0;
- fts5IndexPrepareStmt(p, &pStmt, sqlite3_mprintf(
- "REPLACE INTO %Q.'%q_config' VALUES ('version', %d)",
- pConfig->zDb, pConfig->zName, FTS5_CURRENT_VERSION_SECUREDELETE
- ));
- if( p->rc==SQLITE_OK ){
- int rc;
- sqlite3_step(pStmt);
- rc = sqlite3_finalize(pStmt);
- if( p->rc==SQLITE_OK ) p->rc = rc;
- pConfig->iCookie++;
- pConfig->iVersion = FTS5_CURRENT_VERSION_SECUREDELETE;
- }
- }
-
fts5MultiIterNew(p, pStruct, f, 0, (const u8*)zTerm, nTerm, -1, 0, &pIter);
if( fts5MultiIterEof(p, pIter)==0 ){
i64 iThis = fts5MultiIterRowid(pIter);
@@ -251266,7 +250859,6 @@ static int fts5FlushSecureDelete(
}
fts5MultiIterFree(pIter);
- return p->rc;
}
@@ -251350,9 +250942,8 @@ static void fts5FlushOneHash(Fts5Index *p){
** using fts5FlushSecureDelete(). */
if( bSecureDelete ){
if( eDetail==FTS5_DETAIL_NONE ){
- if( iOffrc!=SQLITE_OK || pDoclist[iOff]==0x01 ){
iOff++;
continue;
@@ -251982,383 +251572,6 @@ static void fts5MergePrefixLists(
*p1 = out;
}
-
-/*
-** Iterate through a range of entries in the FTS index, invoking the xVisit
-** callback for each of them.
-**
-** Parameter pToken points to an nToken buffer containing an FTS index term
-** (i.e. a document term with the preceding 1 byte index identifier -
-** FTS5_MAIN_PREFIX or similar). If bPrefix is true, then the call visits
-** all entries for terms that have pToken/nToken as a prefix. If bPrefix
-** is false, then only entries with pToken/nToken as the entire key are
-** visited.
-**
-** If the current table is a tokendata=1 table, then if bPrefix is true then
-** each index term is treated separately. However, if bPrefix is false, then
-** all index terms corresponding to pToken/nToken are collapsed into a single
-** term before the callback is invoked.
-**
-** The callback invoked for each entry visited is specified by paramter xVisit.
-** Each time it is invoked, it is passed a pointer to the Fts5Index object,
-** a copy of the 7th paramter to this function (pCtx) and a pointer to the
-** iterator that indicates the current entry. If the current entry is the
-** first with a new term (i.e. different from that of the previous entry,
-** including the very first term), then the final two parameters are passed
-** a pointer to the term and its size in bytes, respectively. If the current
-** entry is not the first associated with its term, these two parameters
-** are passed 0.
-**
-** If parameter pColset is not NULL, then it is used to filter entries before
-** the callback is invoked.
-*/
-static int fts5VisitEntries(
- Fts5Index *p, /* Fts5 index object */
- Fts5Colset *pColset, /* Columns filter to apply, or NULL */
- u8 *pToken, /* Buffer containing token */
- int nToken, /* Size of buffer pToken in bytes */
- int bPrefix, /* True for a prefix scan */
- void (*xVisit)(Fts5Index*, void *pCtx, Fts5Iter *pIter, const u8*, int),
- void *pCtx /* Passed as second argument to xVisit() */
-){
- const int flags = (bPrefix ? FTS5INDEX_QUERY_SCAN : 0)
- | FTS5INDEX_QUERY_SKIPEMPTY
- | FTS5INDEX_QUERY_NOOUTPUT;
- Fts5Iter *p1 = 0; /* Iterator used to gather data from index */
- int bNewTerm = 1;
- Fts5Structure *pStruct = fts5StructureRead(p);
-
- fts5MultiIterNew(p, pStruct, flags, pColset, pToken, nToken, -1, 0, &p1);
- fts5IterSetOutputCb(&p->rc, p1);
- for( /* no-op */ ;
- fts5MultiIterEof(p, p1)==0;
- fts5MultiIterNext2(p, p1, &bNewTerm)
- ){
- Fts5SegIter *pSeg = &p1->aSeg[ p1->aFirst[1].iFirst ];
- int nNew = 0;
- const u8 *pNew = 0;
-
- p1->xSetOutputs(p1, pSeg);
- if( p->rc ) break;
-
- if( bNewTerm ){
- nNew = pSeg->term.n;
- pNew = pSeg->term.p;
- if( nNewrc;
-}
-
-
-/*
-** Usually, a tokendata=1 iterator (struct Fts5TokenDataIter) accumulates an
-** array of these for each row it visits (so all iRowid fields are the same).
-** Or, for an iterator used by an "ORDER BY rank" query, it accumulates an
-** array of these for the entire query (in which case iRowid fields may take
-** a variety of values).
-**
-** Each instance in the array indicates the iterator (and therefore term)
-** associated with position iPos of rowid iRowid. This is used by the
-** xInstToken() API.
-**
-** iRowid:
-** Rowid for the current entry.
-**
-** iPos:
-** Position of current entry within row. In the usual ((iCol<<32)+iOff)
-** format (e.g. see macros FTS5_POS2COLUMN() and FTS5_POS2OFFSET()).
-**
-** iIter:
-** If the Fts5TokenDataIter iterator that the entry is part of is
-** actually an iterator (i.e. with nIter>0, not just a container for
-** Fts5TokenDataMap structures), then this variable is an index into
-** the apIter[] array. The corresponding term is that which the iterator
-** at apIter[iIter] currently points to.
-**
-** Or, if the Fts5TokenDataIter iterator is just a container object
-** (nIter==0), then iIter is an index into the term.p[] buffer where
-** the term is stored.
-**
-** nByte:
-** In the case where iIter is an index into term.p[], this variable
-** is the size of the term in bytes. If iIter is an index into apIter[],
-** this variable is unused.
-*/
-struct Fts5TokenDataMap {
- i64 iRowid; /* Row this token is located in */
- i64 iPos; /* Position of token */
- int iIter; /* Iterator token was read from */
- int nByte; /* Length of token in bytes (or 0) */
-};
-
-/*
-** An object used to supplement Fts5Iter for tokendata=1 iterators.
-**
-** This object serves two purposes. The first is as a container for an array
-** of Fts5TokenDataMap structures, which are used to find the token required
-** when the xInstToken() API is used. This is done by the nMapAlloc, nMap and
-** aMap[] variables.
-*/
-struct Fts5TokenDataIter {
- int nMapAlloc; /* Allocated size of aMap[] in entries */
- int nMap; /* Number of valid entries in aMap[] */
- Fts5TokenDataMap *aMap; /* Array of (rowid+pos -> token) mappings */
-
- /* The following are used for prefix-queries only. */
- Fts5Buffer terms;
-
- /* The following are used for other full-token tokendata queries only. */
- int nIter;
- int nIterAlloc;
- Fts5PoslistReader *aPoslistReader;
- int *aPoslistToIter;
- Fts5Iter *apIter[1];
-};
-
-/*
-** The two input arrays - a1[] and a2[] - are in sorted order. This function
-** merges the two arrays together and writes the result to output array
-** aOut[]. aOut[] is guaranteed to be large enough to hold the result.
-**
-** Duplicate entries are copied into the output. So the size of the output
-** array is always (n1+n2) entries.
-*/
-static void fts5TokendataMerge(
- Fts5TokenDataMap *a1, int n1, /* Input array 1 */
- Fts5TokenDataMap *a2, int n2, /* Input array 2 */
- Fts5TokenDataMap *aOut /* Output array */
-){
- int i1 = 0;
- int i2 = 0;
-
- assert( n1>=0 && n2>=0 );
- while( i1=n2 || (i1rc==SQLITE_OK ){
- if( pT->nMap==pT->nMapAlloc ){
- int nNew = pT->nMapAlloc ? pT->nMapAlloc*2 : 64;
- int nAlloc = nNew * sizeof(Fts5TokenDataMap);
- Fts5TokenDataMap *aNew;
-
- aNew = (Fts5TokenDataMap*)sqlite3_realloc(pT->aMap, nAlloc);
- if( aNew==0 ){
- p->rc = SQLITE_NOMEM;
- return;
- }
-
- pT->aMap = aNew;
- pT->nMapAlloc = nNew;
- }
-
- pT->aMap[pT->nMap].iRowid = iRowid;
- pT->aMap[pT->nMap].iPos = iPos;
- pT->aMap[pT->nMap].iIter = iIter;
- pT->aMap[pT->nMap].nByte = nByte;
- pT->nMap++;
- }
-}
-
-/*
-** Sort the contents of the pT->aMap[] array.
-**
-** The sorting algorithm requries a malloc(). If this fails, an error code
-** is left in Fts5Index.rc before returning.
-*/
-static void fts5TokendataIterSortMap(Fts5Index *p, Fts5TokenDataIter *pT){
- Fts5TokenDataMap *aTmp = 0;
- int nByte = pT->nMap * sizeof(Fts5TokenDataMap);
-
- aTmp = (Fts5TokenDataMap*)sqlite3Fts5MallocZero(&p->rc, nByte);
- if( aTmp ){
- Fts5TokenDataMap *a1 = pT->aMap;
- Fts5TokenDataMap *a2 = aTmp;
- i64 nHalf;
-
- for(nHalf=1; nHalfnMap; nHalf=nHalf*2){
- int i1;
- for(i1=0; i1nMap; i1+=(nHalf*2)){
- int n1 = MIN(nHalf, pT->nMap-i1);
- int n2 = MIN(nHalf, pT->nMap-i1-n1);
- fts5TokendataMerge(&a1[i1], n1, &a1[i1+n1], n2, &a2[i1]);
- }
- SWAPVAL(Fts5TokenDataMap*, a1, a2);
- }
-
- if( a1!=pT->aMap ){
- memcpy(pT->aMap, a1, pT->nMap*sizeof(Fts5TokenDataMap));
- }
- sqlite3_free(aTmp);
-
-#ifdef SQLITE_DEBUG
- {
- int ii;
- for(ii=1; iinMap; ii++){
- Fts5TokenDataMap *p1 = &pT->aMap[ii-1];
- Fts5TokenDataMap *p2 = &pT->aMap[ii];
- assert( p1->iRowidiRowid
- || (p1->iRowid==p2->iRowid && p1->iPos<=p2->iPos)
- );
- }
- }
-#endif
- }
-}
-
-/*
-** Delete an Fts5TokenDataIter structure and its contents.
-*/
-static void fts5TokendataIterDelete(Fts5TokenDataIter *pSet){
- if( pSet ){
- int ii;
- for(ii=0; iinIter; ii++){
- fts5MultiIterFree(pSet->apIter[ii]);
- }
- fts5BufferFree(&pSet->terms);
- sqlite3_free(pSet->aPoslistReader);
- sqlite3_free(pSet->aMap);
- sqlite3_free(pSet);
- }
-}
-
-
-/*
-** fts5VisitEntries() context object used by fts5SetupPrefixIterTokendata()
-** to pass data to prefixIterSetupTokendataCb().
-*/
-typedef struct TokendataSetupCtx TokendataSetupCtx;
-struct TokendataSetupCtx {
- Fts5TokenDataIter *pT; /* Object being populated with mappings */
- int iTermOff; /* Offset of current term in terms.p[] */
- int nTermByte; /* Size of current term in bytes */
-};
-
-/*
-** fts5VisitEntries() callback used by fts5SetupPrefixIterTokendata(). This
-** callback adds an entry to the Fts5TokenDataIter.aMap[] array for each
-** position in the current position-list. It doesn't matter that some of
-** these may be out of order - they will be sorted later.
-*/
-static void prefixIterSetupTokendataCb(
- Fts5Index *p,
- void *pCtx,
- Fts5Iter *p1,
- const u8 *pNew,
- int nNew
-){
- TokendataSetupCtx *pSetup = (TokendataSetupCtx*)pCtx;
- int iPosOff = 0;
- i64 iPos = 0;
-
- if( pNew ){
- pSetup->nTermByte = nNew-1;
- pSetup->iTermOff = pSetup->pT->terms.n;
- fts5BufferAppendBlob(&p->rc, &pSetup->pT->terms, nNew-1, pNew+1);
- }
-
- while( 0==sqlite3Fts5PoslistNext64(
- p1->base.pData, p1->base.nData, &iPosOff, &iPos
- ) ){
- fts5TokendataIterAppendMap(p,
- pSetup->pT, pSetup->iTermOff, pSetup->nTermByte, p1->base.iRowid, iPos
- );
- }
-}
-
-
-/*
-** Context object passed by fts5SetupPrefixIter() to fts5VisitEntries().
-*/
-typedef struct PrefixSetupCtx PrefixSetupCtx;
-struct PrefixSetupCtx {
- void (*xMerge)(Fts5Index*, Fts5Buffer*, int, Fts5Buffer*);
- void (*xAppend)(Fts5Index*, u64, Fts5Iter*, Fts5Buffer*);
- i64 iLastRowid;
- int nMerge;
- Fts5Buffer *aBuf;
- int nBuf;
- Fts5Buffer doclist;
- TokendataSetupCtx *pTokendata;
-};
-
-/*
-** fts5VisitEntries() callback used by fts5SetupPrefixIter()
-*/
-static void prefixIterSetupCb(
- Fts5Index *p,
- void *pCtx,
- Fts5Iter *p1,
- const u8 *pNew,
- int nNew
-){
- PrefixSetupCtx *pSetup = (PrefixSetupCtx*)pCtx;
- const int nMerge = pSetup->nMerge;
-
- if( p1->base.nData>0 ){
- if( p1->base.iRowid<=pSetup->iLastRowid && pSetup->doclist.n>0 ){
- int i;
- for(i=0; p->rc==SQLITE_OK && pSetup->doclist.n; i++){
- int i1 = i*nMerge;
- int iStore;
- assert( i1+nMerge<=pSetup->nBuf );
- for(iStore=i1; iStoreaBuf[iStore].n==0 ){
- fts5BufferSwap(&pSetup->doclist, &pSetup->aBuf[iStore]);
- fts5BufferZero(&pSetup->doclist);
- break;
- }
- }
- if( iStore==i1+nMerge ){
- pSetup->xMerge(p, &pSetup->doclist, nMerge, &pSetup->aBuf[i1]);
- for(iStore=i1; iStoreaBuf[iStore]);
- }
- }
- }
- pSetup->iLastRowid = 0;
- }
-
- pSetup->xAppend(
- p, (u64)p1->base.iRowid-(u64)pSetup->iLastRowid, p1, &pSetup->doclist
- );
- pSetup->iLastRowid = p1->base.iRowid;
- }
-
- if( pSetup->pTokendata ){
- prefixIterSetupTokendataCb(p, (void*)pSetup->pTokendata, p1, pNew, nNew);
- }
-}
-
static void fts5SetupPrefixIter(
Fts5Index *p, /* Index to read from */
int bDesc, /* True for "ORDER BY rowid DESC" */
@@ -252369,41 +251582,38 @@ static void fts5SetupPrefixIter(
Fts5Iter **ppIter /* OUT: New iterator */
){
Fts5Structure *pStruct;
- PrefixSetupCtx s;
- TokendataSetupCtx s2;
-
- memset(&s, 0, sizeof(s));
- memset(&s2, 0, sizeof(s2));
-
- s.nMerge = 1;
- s.iLastRowid = 0;
- s.nBuf = 32;
- if( iIdx==0
- && p->pConfig->eDetail==FTS5_DETAIL_FULL
- && p->pConfig->bPrefixInsttoken
- ){
- s.pTokendata = &s2;
- s2.pT = (Fts5TokenDataIter*)fts5IdxMalloc(p, sizeof(*s2.pT));
- }
+ Fts5Buffer *aBuf;
+ int nBuf = 32;
+ int nMerge = 1;
+ void (*xMerge)(Fts5Index*, Fts5Buffer*, int, Fts5Buffer*);
+ void (*xAppend)(Fts5Index*, u64, Fts5Iter*, Fts5Buffer*);
if( p->pConfig->eDetail==FTS5_DETAIL_NONE ){
- s.xMerge = fts5MergeRowidLists;
- s.xAppend = fts5AppendRowid;
+ xMerge = fts5MergeRowidLists;
+ xAppend = fts5AppendRowid;
}else{
- s.nMerge = FTS5_MERGE_NLIST-1;
- s.nBuf = s.nMerge*8; /* Sufficient to merge (16^8)==(2^32) lists */
- s.xMerge = fts5MergePrefixLists;
- s.xAppend = fts5AppendPoslist;
+ nMerge = FTS5_MERGE_NLIST-1;
+ nBuf = nMerge*8; /* Sufficient to merge (16^8)==(2^32) lists */
+ xMerge = fts5MergePrefixLists;
+ xAppend = fts5AppendPoslist;
}
- s.aBuf = (Fts5Buffer*)fts5IdxMalloc(p, sizeof(Fts5Buffer)*s.nBuf);
+ aBuf = (Fts5Buffer*)fts5IdxMalloc(p, sizeof(Fts5Buffer)*nBuf);
pStruct = fts5StructureRead(p);
- assert( p->rc!=SQLITE_OK || (s.aBuf && pStruct) );
+ assert( p->rc!=SQLITE_OK || (aBuf && pStruct) );
if( p->rc==SQLITE_OK ){
- void *pCtx = (void*)&s;
+ const int flags = FTS5INDEX_QUERY_SCAN
+ | FTS5INDEX_QUERY_SKIPEMPTY
+ | FTS5INDEX_QUERY_NOOUTPUT;
int i;
+ i64 iLastRowid = 0;
+ Fts5Iter *p1 = 0; /* Iterator used to gather data from index */
Fts5Data *pData;
+ Fts5Buffer doclist;
+ int bNewTerm = 1;
+
+ memset(&doclist, 0, sizeof(doclist));
/* If iIdx is non-zero, then it is the number of a prefix-index for
** prefixes 1 character longer than the prefix being queried for. That
@@ -252411,45 +251621,94 @@ static void fts5SetupPrefixIter(
** corresponding to the prefix itself. That one is extracted from the
** main term index here. */
if( iIdx!=0 ){
+ int dummy = 0;
+ const int f2 = FTS5INDEX_QUERY_SKIPEMPTY|FTS5INDEX_QUERY_NOOUTPUT;
pToken[0] = FTS5_MAIN_PREFIX;
- fts5VisitEntries(p, pColset, pToken, nToken, 0, prefixIterSetupCb, pCtx);
+ fts5MultiIterNew(p, pStruct, f2, pColset, pToken, nToken, -1, 0, &p1);
+ fts5IterSetOutputCb(&p->rc, p1);
+ for(;
+ fts5MultiIterEof(p, p1)==0;
+ fts5MultiIterNext2(p, p1, &dummy)
+ ){
+ Fts5SegIter *pSeg = &p1->aSeg[ p1->aFirst[1].iFirst ];
+ p1->xSetOutputs(p1, pSeg);
+ if( p1->base.nData ){
+ xAppend(p, (u64)p1->base.iRowid-(u64)iLastRowid, p1, &doclist);
+ iLastRowid = p1->base.iRowid;
+ }
+ }
+ fts5MultiIterFree(p1);
}
pToken[0] = FTS5_MAIN_PREFIX + iIdx;
- fts5VisitEntries(p, pColset, pToken, nToken, 1, prefixIterSetupCb, pCtx);
+ fts5MultiIterNew(p, pStruct, flags, pColset, pToken, nToken, -1, 0, &p1);
+ fts5IterSetOutputCb(&p->rc, p1);
- assert( (s.nBuf%s.nMerge)==0 );
- for(i=0; iaSeg[ p1->aFirst[1].iFirst ];
+ int nTerm = pSeg->term.n;
+ const u8 *pTerm = pSeg->term.p;
+ p1->xSetOutputs(p1, pSeg);
+
+ assert_nc( memcmp(pToken, pTerm, MIN(nToken, nTerm))<=0 );
+ if( bNewTerm ){
+ if( nTermbase.nData==0 ) continue;
+ if( p1->base.iRowid<=iLastRowid && doclist.n>0 ){
+ for(i=0; p->rc==SQLITE_OK && doclist.n; i++){
+ int i1 = i*nMerge;
+ int iStore;
+ assert( i1+nMerge<=nBuf );
+ for(iStore=i1; iStorebase.iRowid-(u64)iLastRowid, p1, &doclist);
+ iLastRowid = p1->base.iRowid;
+ }
+
+ assert( (nBuf%nMerge)==0 );
+ for(i=0; irc==SQLITE_OK ){
- s.xMerge(p, &s.doclist, s.nMerge, &s.aBuf[i]);
+ xMerge(p, &doclist, nMerge, &aBuf[i]);
}
- for(iFree=i; iFreerc!=SQLITE_OK );
+ pData = fts5IdxMalloc(p, sizeof(*pData)+doclist.n+FTS5_DATA_ZERO_PADDING);
if( pData ){
pData->p = (u8*)&pData[1];
- pData->nn = pData->szLeaf = s.doclist.n;
- if( s.doclist.n ) memcpy(pData->p, s.doclist.p, s.doclist.n);
+ pData->nn = pData->szLeaf = doclist.n;
+ if( doclist.n ) memcpy(pData->p, doclist.p, doclist.n);
fts5MultiIterNew2(p, pData, bDesc, ppIter);
}
-
- assert( (*ppIter)!=0 || p->rc!=SQLITE_OK );
- if( p->rc==SQLITE_OK && s.pTokendata ){
- fts5TokendataIterSortMap(p, s2.pT);
- (*ppIter)->pTokenDataIter = s2.pT;
- s2.pT = 0;
- }
+ fts5BufferFree(&doclist);
}
- fts5TokendataIterDelete(s2.pT);
- fts5BufferFree(&s.doclist);
fts5StructureRelease(pStruct);
- sqlite3_free(s.aBuf);
+ sqlite3_free(aBuf);
}
@@ -252487,7 +251746,7 @@ static int sqlite3Fts5IndexBeginWrite(Fts5Index *p, int bDelete, i64 iRowid){
static int sqlite3Fts5IndexSync(Fts5Index *p){
assert( p->rc==SQLITE_OK );
fts5IndexFlush(p);
- fts5IndexCloseReader(p);
+ sqlite3Fts5IndexCloseReader(p);
return fts5IndexReturn(p);
}
@@ -252498,10 +251757,11 @@ static int sqlite3Fts5IndexSync(Fts5Index *p){
** records must be invalidated.
*/
static int sqlite3Fts5IndexRollback(Fts5Index *p){
- fts5IndexCloseReader(p);
+ sqlite3Fts5IndexCloseReader(p);
fts5IndexDiscardData(p);
fts5StructureInvalidate(p);
- return fts5IndexReturn(p);
+ /* assert( p->rc==SQLITE_OK ); */
+ return SQLITE_OK;
}
/*
@@ -252702,15 +251962,37 @@ static void fts5SegIterSetEOF(Fts5SegIter *pSeg){
pSeg->pLeaf = 0;
}
-static void fts5IterClose(Fts5IndexIter *pIndexIter){
- if( pIndexIter ){
- Fts5Iter *pIter = (Fts5Iter*)pIndexIter;
- Fts5Index *pIndex = pIter->pIndex;
- fts5TokendataIterDelete(pIter->pTokenDataIter);
- fts5MultiIterFree(pIter);
- fts5IndexCloseReader(pIndex);
- }
-}
+/*
+** Usually, a tokendata=1 iterator (struct Fts5TokenDataIter) accumulates an
+** array of these for each row it visits. Or, for an iterator used by an
+** "ORDER BY rank" query, it accumulates an array of these for the entire
+** query.
+**
+** Each instance in the array indicates the iterator (and therefore term)
+** associated with position iPos of rowid iRowid. This is used by the
+** xInstToken() API.
+*/
+struct Fts5TokenDataMap {
+ i64 iRowid; /* Row this token is located in */
+ i64 iPos; /* Position of token */
+ int iIter; /* Iterator token was read from */
+};
+
+/*
+** An object used to supplement Fts5Iter for tokendata=1 iterators.
+*/
+struct Fts5TokenDataIter {
+ int nIter;
+ int nIterAlloc;
+
+ int nMap;
+ int nMapAlloc;
+ Fts5TokenDataMap *aMap;
+
+ Fts5PoslistReader *aPoslistReader;
+ int *aPoslistToIter;
+ Fts5Iter *apIter[1];
+};
/*
** This function appends iterator pAppend to Fts5TokenDataIter pIn and
@@ -252739,7 +252021,7 @@ static Fts5TokenDataIter *fts5AppendTokendataIter(
}
}
if( p->rc ){
- fts5IterClose((Fts5IndexIter*)pAppend);
+ sqlite3Fts5IterClose((Fts5IndexIter*)pAppend);
}else{
pRet->apIter[pRet->nIter++] = pAppend;
}
@@ -252748,6 +252030,54 @@ static Fts5TokenDataIter *fts5AppendTokendataIter(
return pRet;
}
+/*
+** Delete an Fts5TokenDataIter structure and its contents.
+*/
+static void fts5TokendataIterDelete(Fts5TokenDataIter *pSet){
+ if( pSet ){
+ int ii;
+ for(ii=0; iinIter; ii++){
+ fts5MultiIterFree(pSet->apIter[ii]);
+ }
+ sqlite3_free(pSet->aPoslistReader);
+ sqlite3_free(pSet->aMap);
+ sqlite3_free(pSet);
+ }
+}
+
+/*
+** Append a mapping to the token-map belonging to object pT.
+*/
+static void fts5TokendataIterAppendMap(
+ Fts5Index *p,
+ Fts5TokenDataIter *pT,
+ int iIter,
+ i64 iRowid,
+ i64 iPos
+){
+ if( p->rc==SQLITE_OK ){
+ if( pT->nMap==pT->nMapAlloc ){
+ int nNew = pT->nMapAlloc ? pT->nMapAlloc*2 : 64;
+ int nByte = nNew * sizeof(Fts5TokenDataMap);
+ Fts5TokenDataMap *aNew;
+
+ aNew = (Fts5TokenDataMap*)sqlite3_realloc(pT->aMap, nByte);
+ if( aNew==0 ){
+ p->rc = SQLITE_NOMEM;
+ return;
+ }
+
+ pT->aMap = aNew;
+ pT->nMapAlloc = nNew;
+ }
+
+ pT->aMap[pT->nMap].iRowid = iRowid;
+ pT->aMap[pT->nMap].iPos = iPos;
+ pT->aMap[pT->nMap].iIter = iIter;
+ pT->nMap++;
+ }
+}
+
/*
** The iterator passed as the only argument must be a tokendata=1 iterator
** (pIter->pTokenDataIter!=0). This function sets the iterator output
@@ -252788,7 +252118,7 @@ static void fts5IterSetOutputsTokendata(Fts5Iter *pIter){
pIter->base.iRowid = iRowid;
if( nHit==1 && eDetail==FTS5_DETAIL_FULL ){
- fts5TokendataIterAppendMap(pIter->pIndex, pT, iMin, 0, iRowid, -1);
+ fts5TokendataIterAppendMap(pIter->pIndex, pT, iMin, iRowid, -1);
}else
if( nHit>1 && eDetail!=FTS5_DETAIL_NONE ){
int nReader = 0;
@@ -252952,7 +252282,7 @@ static Fts5Iter *fts5SetupTokendataIter(
fts5BufferSet(&p->rc, &bSeek, nToken, pToken);
}
if( p->rc ){
- fts5IterClose((Fts5IndexIter*)pNew);
+ sqlite3Fts5IterClose((Fts5IndexIter*)pNew);
break;
}
@@ -253017,7 +252347,7 @@ static Fts5Iter *fts5SetupTokendataIter(
** not point to any terms that match the query. So delete it and break
** out of the loop - all required iterators have been collected. */
if( pSmall==0 ){
- fts5IterClose((Fts5IndexIter*)pNew);
+ sqlite3Fts5IterClose((Fts5IndexIter*)pNew);
break;
}
@@ -253041,7 +252371,6 @@ static Fts5Iter *fts5SetupTokendataIter(
pRet = fts5MultiIterAlloc(p, 0);
}
if( pRet ){
- pRet->nSeg = 0;
pRet->pTokenDataIter = pSet;
if( pSet ){
fts5IterSetOutputsTokendata(pRet);
@@ -253057,6 +252386,7 @@ static Fts5Iter *fts5SetupTokendataIter(
return pRet;
}
+
/*
** Open a new iterator to iterate though all rowid that match the
** specified token or token prefix.
@@ -253079,14 +252409,8 @@ static int sqlite3Fts5IndexQuery(
int iIdx = 0; /* Index to search */
int iPrefixIdx = 0; /* +1 prefix index */
int bTokendata = pConfig->bTokendata;
- assert( buf.p!=0 );
if( nToken>0 ) memcpy(&buf.p[1], pToken, nToken);
- /* The NOTOKENDATA flag is set when each token in a tokendata=1 table
- ** should be treated individually, instead of merging all those with
- ** a common prefix into a single entry. This is used, for example, by
- ** queries performed as part of an integrity-check, or by the fts5vocab
- ** module. */
if( flags & (FTS5INDEX_QUERY_NOTOKENDATA|FTS5INDEX_QUERY_SCAN) ){
bTokendata = 0;
}
@@ -253117,7 +252441,7 @@ static int sqlite3Fts5IndexQuery(
}
if( bTokendata && iIdx==0 ){
- buf.p[0] = FTS5_MAIN_PREFIX;
+ buf.p[0] = '0';
pRet = fts5SetupTokendataIter(p, buf.p, nToken+1, pColset);
}else if( iIdx<=pConfig->nPrefix ){
/* Straight index lookup */
@@ -253130,7 +252454,7 @@ static int sqlite3Fts5IndexQuery(
fts5StructureRelease(pStruct);
}
}else{
- /* Scan multiple terms in the main index for a prefix query. */
+ /* Scan multiple terms in the main index */
int bDesc = (flags & FTS5INDEX_QUERY_DESC)!=0;
fts5SetupPrefixIter(p, bDesc, iPrefixIdx, buf.p, nToken+1, pColset,&pRet);
if( pRet==0 ){
@@ -253146,9 +252470,9 @@ static int sqlite3Fts5IndexQuery(
}
if( p->rc ){
- fts5IterClose((Fts5IndexIter*)pRet);
+ sqlite3Fts5IterClose((Fts5IndexIter*)pRet);
pRet = 0;
- fts5IndexCloseReader(p);
+ sqlite3Fts5IndexCloseReader(p);
}
*ppIter = (Fts5IndexIter*)pRet;
@@ -253166,8 +252490,7 @@ static int sqlite3Fts5IndexQuery(
static int sqlite3Fts5IterNext(Fts5IndexIter *pIndexIter){
Fts5Iter *pIter = (Fts5Iter*)pIndexIter;
assert( pIter->pIndex->rc==SQLITE_OK );
- if( pIter->nSeg==0 ){
- assert( pIter->pTokenDataIter );
+ if( pIter->pTokenDataIter ){
fts5TokendataIterNext(pIter, 0, 0);
}else{
fts5MultiIterNext(pIter->pIndex, pIter, 0, 0);
@@ -253204,8 +252527,7 @@ static int sqlite3Fts5IterNextScan(Fts5IndexIter *pIndexIter){
*/
static int sqlite3Fts5IterNextFrom(Fts5IndexIter *pIndexIter, i64 iMatch){
Fts5Iter *pIter = (Fts5Iter*)pIndexIter;
- if( pIter->nSeg==0 ){
- assert( pIter->pTokenDataIter );
+ if( pIter->pTokenDataIter ){
fts5TokendataIterNext(pIter, 1, iMatch);
}else{
fts5MultiIterNextFrom(pIter->pIndex, pIter, iMatch);
@@ -253224,61 +252546,14 @@ static const char *sqlite3Fts5IterTerm(Fts5IndexIter *pIndexIter, int *pn){
return (z ? &z[1] : 0);
}
-/*
-** pIter is a prefix query. This function populates pIter->pTokenDataIter
-** with an Fts5TokenDataIter object containing mappings for all rows
-** matched by the query.
-*/
-static int fts5SetupPrefixIterTokendata(
- Fts5Iter *pIter,
- const char *pToken, /* Token prefix to search for */
- int nToken /* Size of pToken in bytes */
-){
- Fts5Index *p = pIter->pIndex;
- Fts5Buffer token = {0, 0, 0};
- TokendataSetupCtx ctx;
-
- memset(&ctx, 0, sizeof(ctx));
-
- fts5BufferGrow(&p->rc, &token, nToken+1);
- assert( token.p!=0 || p->rc!=SQLITE_OK );
- ctx.pT = (Fts5TokenDataIter*)sqlite3Fts5MallocZero(&p->rc, sizeof(*ctx.pT));
-
- if( p->rc==SQLITE_OK ){
-
- /* Fill in the token prefix to search for */
- token.p[0] = FTS5_MAIN_PREFIX;
- memcpy(&token.p[1], pToken, nToken);
- token.n = nToken+1;
-
- fts5VisitEntries(
- p, 0, token.p, token.n, 1, prefixIterSetupTokendataCb, (void*)&ctx
- );
-
- fts5TokendataIterSortMap(p, ctx.pT);
- }
-
- if( p->rc==SQLITE_OK ){
- pIter->pTokenDataIter = ctx.pT;
- }else{
- fts5TokendataIterDelete(ctx.pT);
- }
- fts5BufferFree(&token);
-
- return fts5IndexReturn(p);
-}
-
/*
** This is used by xInstToken() to access the token at offset iOff, column
** iCol of row iRowid. The token is returned via output variables *ppOut
** and *pnOut. The iterator passed as the first argument must be a tokendata=1
** iterator (pIter->pTokenDataIter!=0).
-**
-** pToken/nToken:
*/
static int sqlite3Fts5IterToken(
Fts5IndexIter *pIndexIter,
- const char *pToken, int nToken,
i64 iRowid,
int iCol,
int iOff,
@@ -253286,22 +252561,13 @@ static int sqlite3Fts5IterToken(
){
Fts5Iter *pIter = (Fts5Iter*)pIndexIter;
Fts5TokenDataIter *pT = pIter->pTokenDataIter;
+ Fts5TokenDataMap *aMap = pT->aMap;
i64 iPos = (((i64)iCol)<<32) + iOff;
- Fts5TokenDataMap *aMap = 0;
+
int i1 = 0;
- int i2 = 0;
+ int i2 = pT->nMap;
int iTest = 0;
- assert( pT || (pToken && pIter->nSeg>0) );
- if( pT==0 ){
- int rc = fts5SetupPrefixIterTokendata(pIter, pToken, nToken);
- if( rc!=SQLITE_OK ) return rc;
- pT = pIter->pTokenDataIter;
- }
-
- i2 = pT->nMap;
- aMap = pT->aMap;
-
while( i2>i1 ){
iTest = (i1 + i2) / 2;
@@ -253324,15 +252590,9 @@ static int sqlite3Fts5IterToken(
}
if( i2>i1 ){
- if( pIter->nSeg==0 ){
- Fts5Iter *pMap = pT->apIter[aMap[iTest].iIter];
- *ppOut = (const char*)pMap->aSeg[0].term.p+1;
- *pnOut = pMap->aSeg[0].term.n-1;
- }else{
- Fts5TokenDataMap *p = &aMap[iTest];
- *ppOut = (const char*)&pT->terms.p[p->iIter];
- *pnOut = aMap[iTest].nByte;
- }
+ Fts5Iter *pMap = pT->apIter[aMap[iTest].iIter];
+ *ppOut = (const char*)pMap->aSeg[0].term.p+1;
+ *pnOut = pMap->aSeg[0].term.n-1;
}
return SQLITE_OK;
@@ -253344,9 +252604,7 @@ static int sqlite3Fts5IterToken(
*/
static void sqlite3Fts5IndexIterClearTokendata(Fts5IndexIter *pIndexIter){
Fts5Iter *pIter = (Fts5Iter*)pIndexIter;
- if( pIter && pIter->pTokenDataIter
- && (pIter->nSeg==0 || pIter->pIndex->pConfig->eDetail!=FTS5_DETAIL_FULL)
- ){
+ if( pIter && pIter->pTokenDataIter ){
pIter->pTokenDataIter->nMap = 0;
}
}
@@ -253366,29 +252624,17 @@ static int sqlite3Fts5IndexIterWriteTokendata(
Fts5Iter *pIter = (Fts5Iter*)pIndexIter;
Fts5TokenDataIter *pT = pIter->pTokenDataIter;
Fts5Index *p = pIter->pIndex;
- i64 iPos = (((i64)iCol)<<32) + iOff;
+ int ii;
assert( p->pConfig->eDetail!=FTS5_DETAIL_FULL );
- assert( pIter->pTokenDataIter || pIter->nSeg>0 );
- if( pIter->nSeg>0 ){
- /* This is a prefix term iterator. */
- if( pT==0 ){
- pT = (Fts5TokenDataIter*)sqlite3Fts5MallocZero(&p->rc, sizeof(*pT));
- pIter->pTokenDataIter = pT;
- }
- if( pT ){
- fts5TokendataIterAppendMap(p, pT, pT->terms.n, nToken, iRowid, iPos);
- fts5BufferAppendBlob(&p->rc, &pT->terms, nToken, (const u8*)pToken);
- }
- }else{
- int ii;
- for(ii=0; iinIter; ii++){
- Fts5Buffer *pTerm = &pT->apIter[ii]->aSeg[0].term;
- if( nToken==pTerm->n-1 && memcmp(pToken, pTerm->p+1, nToken)==0 ) break;
- }
- if( iinIter ){
- fts5TokendataIterAppendMap(p, pT, ii, 0, iRowid, iPos);
- }
+ assert( pIter->pTokenDataIter );
+
+ for(ii=0; iinIter; ii++){
+ Fts5Buffer *pTerm = &pT->apIter[ii]->aSeg[0].term;
+ if( nToken==pTerm->n-1 && memcmp(pToken, pTerm->p+1, nToken)==0 ) break;
+ }
+ if( iinIter ){
+ fts5TokendataIterAppendMap(p, pT, ii, iRowid, (((i64)iCol)<<32) + iOff);
}
return fts5IndexReturn(p);
}
@@ -253398,9 +252644,11 @@ static int sqlite3Fts5IndexIterWriteTokendata(
*/
static void sqlite3Fts5IterClose(Fts5IndexIter *pIndexIter){
if( pIndexIter ){
- Fts5Index *pIndex = ((Fts5Iter*)pIndexIter)->pIndex;
- fts5IterClose(pIndexIter);
- fts5IndexReturn(pIndex);
+ Fts5Iter *pIter = (Fts5Iter*)pIndexIter;
+ Fts5Index *pIndex = pIter->pIndex;
+ fts5TokendataIterDelete(pIter->pTokenDataIter);
+ fts5MultiIterFree(pIter);
+ sqlite3Fts5IndexCloseReader(pIndex);
}
}
@@ -253930,7 +253178,7 @@ static int fts5QueryCksum(
rc = sqlite3Fts5IterNext(pIter);
}
}
- fts5IterClose(pIter);
+ sqlite3Fts5IterClose(pIter);
*pCksum = cksum;
return rc;
@@ -254939,7 +254187,7 @@ static int fts5structConnectMethod(
/*
** We must have a single struct=? constraint that will be passed through
-** into the xFilter method. If there is no valid struct=? constraint,
+** into the xFilter method. If there is no valid stmt=? constraint,
** then return an SQLITE_CONSTRAINT error.
*/
static int fts5structBestIndexMethod(
@@ -255281,18 +254529,8 @@ struct Fts5Global {
Fts5TokenizerModule *pTok; /* First in list of all tokenizer modules */
Fts5TokenizerModule *pDfltTok; /* Default tokenizer module */
Fts5Cursor *pCsr; /* First in list of all open cursors */
- u32 aLocaleHdr[4];
};
-/*
-** Size of header on fts5_locale() values. And macro to access a buffer
-** containing a copy of the header from an Fts5Config pointer.
-*/
-#define FTS5_LOCALE_HDR_SIZE ((int)sizeof( ((Fts5Global*)0)->aLocaleHdr ))
-#define FTS5_LOCALE_HDR(pConfig) ((const u8*)(pConfig->pGlobal->aLocaleHdr))
-
-#define FTS5_INSTTOKEN_SUBTYPE 73
-
/*
** Each auxiliary function registered with the FTS5 module is represented
** by an object of the following type. All such objects are stored as part
@@ -255455,6 +254693,12 @@ struct Fts5Cursor {
#define BitFlagAllTest(x,y) (((x) & (y))==(y))
#define BitFlagTest(x,y) (((x) & (y))!=0)
+/*
+** The subtype value and header bytes used by fts5_locale().
+*/
+#define FTS5_LOCALE_SUBTYPE ((unsigned int)'L')
+#define FTS5_LOCALE_HEADER "\x00\xE0\xB2\xEB"
+
/*
** Macros to Set(), Clear() and Test() cursor flags.
@@ -255531,16 +254775,10 @@ static void fts5CheckTransactionState(Fts5FullTable *p, int op, int iSavepoint){
#endif
/*
-** Return true if pTab is a contentless table. If parameter bIncludeUnindexed
-** is true, this includes contentless tables that store UNINDEXED columns
-** only.
+** Return true if pTab is a contentless table.
*/
-static int fts5IsContentless(Fts5FullTable *pTab, int bIncludeUnindexed){
- int eContent = pTab->p.pConfig->eContent;
- return (
- eContent==FTS5_CONTENT_NONE
- || (bIncludeUnindexed && eContent==FTS5_CONTENT_UNINDEXED)
- );
+static int fts5IsContentless(Fts5FullTable *pTab){
+ return pTab->p.pConfig->eContent==FTS5_CONTENT_NONE;
}
/*
@@ -255831,7 +255069,6 @@ static int fts5BestIndexMethod(sqlite3_vtab *pVTab, sqlite3_index_info *pInfo){
if( p->usable==0 || iCol<0 ){
/* As there exists an unusable MATCH constraint this is an
** unusable plan. Return SQLITE_CONSTRAINT. */
- idxStr[iIdxStr] = 0;
return SQLITE_CONSTRAINT;
}else{
if( iCol==nCol+1 ){
@@ -256465,7 +255702,7 @@ static void fts5SetVtabError(Fts5FullTable *p, const char *zFormat, ...){
** valid until after the final call to sqlite3Fts5Tokenize() that will use
** the locale.
*/
-static void sqlite3Fts5SetLocale(
+static void fts5SetLocale(
Fts5Config *pConfig,
const char *zLocale,
int nLocale
@@ -256476,74 +255713,127 @@ static void sqlite3Fts5SetLocale(
}
/*
-** Clear any locale configured by an earlier call to sqlite3Fts5SetLocale().
+** Clear any locale configured by an earlier call to fts5SetLocale() or
+** sqlite3Fts5ExtractText().
*/
static void sqlite3Fts5ClearLocale(Fts5Config *pConfig){
- sqlite3Fts5SetLocale(pConfig, 0, 0);
+ fts5SetLocale(pConfig, 0, 0);
}
/*
-** Return true if the value passed as the only argument is an
-** fts5_locale() value.
+** This function is used to extract utf-8 text from an sqlite3_value. This
+** is usually done in order to tokenize it. For example, when:
+**
+** * a value is written to an fts5 table,
+** * a value is deleted from an FTS5_CONTENT_NORMAL table,
+** * a value containing a query expression is passed to xFilter()
+**
+** and so on.
+**
+** This function handles 2 cases:
+**
+** 1) Ordinary values. The text can be extracted from these using
+** sqlite3_value_text().
+**
+** 2) Combination text/locale blobs created by fts5_locale(). There
+** are several cases for these:
+**
+** * Blobs tagged with FTS5_LOCALE_SUBTYPE.
+** * Blobs read from the content table of a locale=1 external-content
+** table, and
+** * Blobs read from the content table of a locale=1 regular
+** content table.
+**
+** The first two cases above should have the 4 byte FTS5_LOCALE_HEADER
+** header. It is an error if a blob with the subtype or a blob read
+** from the content table of an external content table does not have
+** the required header. A blob read from the content table of a regular
+** locale=1 table does not have the header. This is to save space.
+**
+** If successful, SQLITE_OK is returned and output parameters (*ppText)
+** and (*pnText) are set to point to a buffer containing the extracted utf-8
+** text and its length in bytes, respectively. The buffer is not
+** nul-terminated. It has the same lifetime as the sqlite3_value object
+** from which it is extracted.
+**
+** Parameter bContent must be true if the value was read from an indexed
+** column (i.e. not UNINDEXED) of the on disk content.
+**
+** If pbResetTokenizer is not NULL and if case (2) is used, then
+** fts5SetLocale() is called to ensure subsequent sqlite3Fts5Tokenize() calls
+** use the locale. In this case (*pbResetTokenizer) is set to true before
+** returning, to indicate that the caller must call sqlite3Fts5ClearLocale()
+** to clear the locale after tokenizing the text.
*/
-static int sqlite3Fts5IsLocaleValue(Fts5Config *pConfig, sqlite3_value *pVal){
- int ret = 0;
+static int sqlite3Fts5ExtractText(
+ Fts5Config *pConfig,
+ sqlite3_value *pVal, /* Value to extract text from */
+ int bContent, /* True if indexed table content */
+ int *pbResetTokenizer, /* OUT: True if xSetLocale(NULL) required */
+ const char **ppText, /* OUT: Pointer to text buffer */
+ int *pnText /* OUT: Size of (*ppText) in bytes */
+){
+ const char *pText = 0;
+ int nText = 0;
+ int rc = SQLITE_OK;
+ int bDecodeBlob = 0;
+
+ assert( pbResetTokenizer==0 || *pbResetTokenizer==0 );
+ assert( bContent==0 || pConfig->eContent!=FTS5_CONTENT_NONE );
+ assert( bContent==0 || sqlite3_value_subtype(pVal)==0 );
+
if( sqlite3_value_type(pVal)==SQLITE_BLOB ){
- /* Call sqlite3_value_bytes() after sqlite3_value_blob() in this case.
- ** If the blob was created using zeroblob(), then sqlite3_value_blob()
- ** may call malloc(). If this malloc() fails, then the values returned
- ** by both value_blob() and value_bytes() will be 0. If value_bytes() were
- ** called first, then the NULL pointer returned by value_blob() might
- ** be dereferenced. */
- const u8 *pBlob = sqlite3_value_blob(pVal);
- int nBlob = sqlite3_value_bytes(pVal);
- if( nBlob>FTS5_LOCALE_HDR_SIZE
- && 0==memcmp(pBlob, FTS5_LOCALE_HDR(pConfig), FTS5_LOCALE_HDR_SIZE)
+ if( sqlite3_value_subtype(pVal)==FTS5_LOCALE_SUBTYPE
+ || (bContent && pConfig->bLocale)
){
- ret = 1;
+ bDecodeBlob = 1;
}
}
- return ret;
-}
-/*
-** Value pVal is guaranteed to be an fts5_locale() value, according to
-** sqlite3Fts5IsLocaleValue(). This function extracts the text and locale
-** from the value and returns them separately.
-**
-** If successful, SQLITE_OK is returned and (*ppText) and (*ppLoc) set
-** to point to buffers containing the text and locale, as utf-8,
-** respectively. In this case output parameters (*pnText) and (*pnLoc) are
-** set to the sizes in bytes of these two buffers.
-**
-** Or, if an error occurs, then an SQLite error code is returned. The final
-** value of the four output parameters is undefined in this case.
-*/
-static int sqlite3Fts5DecodeLocaleValue(
- sqlite3_value *pVal,
- const char **ppText,
- int *pnText,
- const char **ppLoc,
- int *pnLoc
-){
- const char *p = sqlite3_value_blob(pVal);
- int n = sqlite3_value_bytes(pVal);
- int nLoc = 0;
+ if( bDecodeBlob ){
+ const int SZHDR = sizeof(FTS5_LOCALE_HEADER)-1;
+ const u8 *pBlob = sqlite3_value_blob(pVal);
+ int nBlob = sqlite3_value_bytes(pVal);
+
+ /* Unless this blob was read from the %_content table of an
+ ** FTS5_CONTENT_NORMAL table, it should have the 4 byte fts5_locale()
+ ** header. Check for this. If it is not found, return an error. */
+ if( (!bContent || pConfig->eContent!=FTS5_CONTENT_NORMAL) ){
+ if( nBlobFTS5_LOCALE_HDR_SIZE );
+ for(nLocale=0; nLocale= ? expression (or NULL) */
int iCol; /* Column on LHS of MATCH operator */
char **pzErrmsg = pConfig->pzErrmsg;
- int bPrefixInsttoken = pConfig->bPrefixInsttoken;
int i;
int iIdxStr = 0;
Fts5Expr *pExpr = 0;
@@ -256653,9 +255944,6 @@ static int fts5FilterMethod(
rc = fts5ExtractExprText(pConfig, apVal[i], &zText, &bFreeAndReset);
if( rc!=SQLITE_OK ) goto filter_out;
if( zText==0 ) zText = "";
- if( sqlite3_value_subtype(apVal[i])==FTS5_INSTTOKEN_SUBTYPE ){
- pConfig->bPrefixInsttoken = 1;
- }
iCol = 0;
do{
@@ -256796,7 +256084,6 @@ static int fts5FilterMethod(
filter_out:
sqlite3Fts5ExprFree(pExpr);
pConfig->pzErrmsg = pzErrmsg;
- pConfig->bPrefixInsttoken = bPrefixInsttoken;
return rc;
}
@@ -256937,7 +256224,7 @@ static int fts5SpecialInsert(
}
bLoadConfig = 1;
}else if( 0==sqlite3_stricmp("rebuild", zCmd) ){
- if( fts5IsContentless(pTab, 1) ){
+ if( pConfig->eContent==FTS5_CONTENT_NONE ){
fts5SetVtabError(pTab,
"'rebuild' may not be used with a contentless fts5 table"
);
@@ -257006,7 +256293,7 @@ static void fts5StorageInsert(
){
int rc = *pRc;
if( rc==SQLITE_OK ){
- rc = sqlite3Fts5StorageContentInsert(pTab->pStorage, 0, apVal, piRowid);
+ rc = sqlite3Fts5StorageContentInsert(pTab->pStorage, apVal, piRowid);
}
if( rc==SQLITE_OK ){
rc = sqlite3Fts5StorageIndexInsert(pTab->pStorage, apVal, *piRowid);
@@ -257014,67 +256301,6 @@ static void fts5StorageInsert(
*pRc = rc;
}
-/*
-**
-** This function is called when the user attempts an UPDATE on a contentless
-** table. Parameter bRowidModified is true if the UPDATE statement modifies
-** the rowid value. Parameter apVal[] contains the new values for each user
-** defined column of the fts5 table. pConfig is the configuration object of the
-** table being updated (guaranteed to be contentless). The contentless_delete=1
-** and contentless_unindexed=1 options may or may not be set.
-**
-** This function returns SQLITE_OK if the UPDATE can go ahead, or an SQLite
-** error code if it cannot. In this case an error message is also loaded into
-** pConfig. Output parameter (*pbContent) is set to true if the caller should
-** update the %_content table only - not the FTS index or any other shadow
-** table. This occurs when an UPDATE modifies only UNINDEXED columns of the
-** table.
-**
-** An UPDATE may proceed if:
-**
-** * The only columns modified are UNINDEXED columns, or
-**
-** * The contentless_delete=1 option was specified and all of the indexed
-** columns (not a subset) have been modified.
-*/
-static int fts5ContentlessUpdate(
- Fts5Config *pConfig,
- sqlite3_value **apVal,
- int bRowidModified,
- int *pbContent
-){
- int ii;
- int bSeenIndex = 0; /* Have seen modified indexed column */
- int bSeenIndexNC = 0; /* Have seen unmodified indexed column */
- int rc = SQLITE_OK;
-
- for(ii=0; iinCol; ii++){
- if( pConfig->abUnindexed[ii]==0 ){
- if( sqlite3_value_nochange(apVal[ii]) ){
- bSeenIndexNC++;
- }else{
- bSeenIndex++;
- }
- }
- }
-
- if( bSeenIndex==0 && bRowidModified==0 ){
- *pbContent = 1;
- }else{
- if( bSeenIndexNC || pConfig->bContentlessDelete==0 ){
- rc = SQLITE_ERROR;
- sqlite3Fts5ConfigErrmsg(pConfig,
- (pConfig->bContentlessDelete ?
- "%s a subset of columns on fts5 contentless-delete table: %s" :
- "%s contentless fts5 table: %s")
- , "cannot UPDATE", pConfig->zName
- );
- }
- }
-
- return rc;
-}
-
/*
** This function is the implementation of the xUpdate callback used by
** FTS3 virtual tables. It is invoked by SQLite each time a row is to be
@@ -257099,6 +256325,7 @@ static int fts5UpdateMethod(
Fts5Config *pConfig = pTab->p.pConfig;
int eType0; /* value_type() of apVal[0] */
int rc = SQLITE_OK; /* Return code */
+ int bUpdateOrDelete = 0;
/* A transaction must be open when this is called. */
assert( pTab->ts.eState==1 || pTab->ts.eState==2 );
@@ -257110,7 +256337,7 @@ static int fts5UpdateMethod(
);
assert( pTab->p.pConfig->pzErrmsg==0 );
if( pConfig->pgsz==0 ){
- rc = sqlite3Fts5ConfigLoad(pTab->p.pConfig, pTab->p.pConfig->iCookie);
+ rc = sqlite3Fts5IndexLoadConfig(pTab->p.pIndex);
if( rc!=SQLITE_OK ) return rc;
}
@@ -257135,6 +256362,7 @@ static int fts5UpdateMethod(
rc = SQLITE_ERROR;
}else{
rc = fts5SpecialDelete(pTab, apVal);
+ bUpdateOrDelete = 1;
}
}else{
rc = fts5SpecialInsert(pTab, z, apVal[2 + pConfig->nCol + 1]);
@@ -257159,33 +256387,44 @@ static int fts5UpdateMethod(
assert( eType0==SQLITE_INTEGER || eType0==SQLITE_NULL );
assert( nArg!=1 || eType0==SQLITE_INTEGER );
+ /* Filter out attempts to run UPDATE or DELETE on contentless tables.
+ ** This is not suported. Except - they are both supported if the CREATE
+ ** VIRTUAL TABLE statement contained "contentless_delete=1". */
+ if( eType0==SQLITE_INTEGER
+ && pConfig->eContent==FTS5_CONTENT_NONE
+ && pConfig->bContentlessDelete==0
+ ){
+ pTab->p.base.zErrMsg = sqlite3_mprintf(
+ "cannot %s contentless fts5 table: %s",
+ (nArg>1 ? "UPDATE" : "DELETE from"), pConfig->zName
+ );
+ rc = SQLITE_ERROR;
+ }
+
/* DELETE */
- if( nArg==1 ){
- /* It is only possible to DELETE from a contentless table if the
- ** contentless_delete=1 flag is set. */
- if( fts5IsContentless(pTab, 1) && pConfig->bContentlessDelete==0 ){
- fts5SetVtabError(pTab,
- "cannot DELETE from contentless fts5 table: %s", pConfig->zName
- );
- rc = SQLITE_ERROR;
- }else{
- i64 iDel = sqlite3_value_int64(apVal[0]); /* Rowid to delete */
- rc = sqlite3Fts5StorageDelete(pTab->pStorage, iDel, 0, 0);
- }
+ else if( nArg==1 ){
+ i64 iDel = sqlite3_value_int64(apVal[0]); /* Rowid to delete */
+ rc = sqlite3Fts5StorageDelete(pTab->pStorage, iDel, 0, 0);
+ bUpdateOrDelete = 1;
}
/* INSERT or UPDATE */
else{
int eType1 = sqlite3_value_numeric_type(apVal[1]);
- /* It is an error to write an fts5_locale() value to a table without
- ** the locale=1 option. */
- if( pConfig->bLocale==0 ){
- int ii;
- for(ii=0; iinCol; ii++){
- sqlite3_value *pVal = apVal[ii+2];
- if( sqlite3Fts5IsLocaleValue(pConfig, pVal) ){
- fts5SetVtabError(pTab, "fts5_locale() requires locale=1");
+ /* Ensure that no fts5_locale() values are written to locale=0 tables.
+ ** And that no blobs except fts5_locale() blobs are written to indexed
+ ** (i.e. not UNINDEXED) columns of locale=1 tables. */
+ int ii;
+ for(ii=0; iinCol; ii++){
+ if( sqlite3_value_type(apVal[ii+2])==SQLITE_BLOB ){
+ int bSub = (sqlite3_value_subtype(apVal[ii+2])==FTS5_LOCALE_SUBTYPE);
+ if( (pConfig->bLocale && !bSub && pConfig->abUnindexed[ii]==0)
+ || (pConfig->bLocale==0 && bSub)
+ ){
+ if( pConfig->bLocale==0 ){
+ fts5SetVtabError(pTab, "fts5_locale() requires locale=1");
+ }
rc = SQLITE_MISMATCH;
goto update_out;
}
@@ -257198,61 +256437,57 @@ static int fts5UpdateMethod(
if( eConflict==SQLITE_REPLACE && eType1==SQLITE_INTEGER ){
i64 iNew = sqlite3_value_int64(apVal[1]); /* Rowid to delete */
rc = sqlite3Fts5StorageDelete(pTab->pStorage, iNew, 0, 0);
+ bUpdateOrDelete = 1;
}
fts5StorageInsert(&rc, pTab, apVal, pRowid);
}
/* UPDATE */
else{
- Fts5Storage *pStorage = pTab->pStorage;
i64 iOld = sqlite3_value_int64(apVal[0]); /* Old rowid */
i64 iNew = sqlite3_value_int64(apVal[1]); /* New rowid */
- int bContent = 0; /* Content only update */
-
- /* If this is a contentless table (including contentless_unindexed=1
- ** tables), check if the UPDATE may proceed. */
- if( fts5IsContentless(pTab, 1) ){
- rc = fts5ContentlessUpdate(pConfig, &apVal[2], iOld!=iNew, &bContent);
- if( rc!=SQLITE_OK ) goto update_out;
- }
-
if( eType1!=SQLITE_INTEGER ){
rc = SQLITE_MISMATCH;
}else if( iOld!=iNew ){
- assert( bContent==0 );
if( eConflict==SQLITE_REPLACE ){
- rc = sqlite3Fts5StorageDelete(pStorage, iOld, 0, 1);
+ rc = sqlite3Fts5StorageDelete(pTab->pStorage, iOld, 0, 1);
if( rc==SQLITE_OK ){
- rc = sqlite3Fts5StorageDelete(pStorage, iNew, 0, 0);
+ rc = sqlite3Fts5StorageDelete(pTab->pStorage, iNew, 0, 0);
}
fts5StorageInsert(&rc, pTab, apVal, pRowid);
}else{
- rc = sqlite3Fts5StorageFindDeleteRow(pStorage, iOld);
+ rc = sqlite3Fts5StorageFindDeleteRow(pTab->pStorage, iOld);
if( rc==SQLITE_OK ){
- rc = sqlite3Fts5StorageContentInsert(pStorage, 0, apVal, pRowid);
+ rc = sqlite3Fts5StorageContentInsert(pTab->pStorage,apVal,pRowid);
}
if( rc==SQLITE_OK ){
- rc = sqlite3Fts5StorageDelete(pStorage, iOld, 0, 0);
+ rc = sqlite3Fts5StorageDelete(pTab->pStorage, iOld, 0, 1);
}
if( rc==SQLITE_OK ){
- rc = sqlite3Fts5StorageIndexInsert(pStorage, apVal, *pRowid);
+ rc = sqlite3Fts5StorageIndexInsert(pTab->pStorage, apVal,*pRowid);
}
}
- }else if( bContent ){
- /* This occurs when an UPDATE on a contentless table affects *only*
- ** UNINDEXED columns. This is a no-op for contentless_unindexed=0
- ** tables, or a write to the %_content table only for =1 tables. */
- assert( fts5IsContentless(pTab, 1) );
- rc = sqlite3Fts5StorageFindDeleteRow(pStorage, iOld);
- if( rc==SQLITE_OK ){
- rc = sqlite3Fts5StorageContentInsert(pStorage, 1, apVal, pRowid);
- }
}else{
- rc = sqlite3Fts5StorageDelete(pStorage, iOld, 0, 1);
+ rc = sqlite3Fts5StorageDelete(pTab->pStorage, iOld, 0, 1);
fts5StorageInsert(&rc, pTab, apVal, pRowid);
}
- sqlite3Fts5StorageReleaseDeleteRow(pStorage);
+ bUpdateOrDelete = 1;
+ sqlite3Fts5StorageReleaseDeleteRow(pTab->pStorage);
}
+
+ }
+ }
+
+ if( rc==SQLITE_OK
+ && bUpdateOrDelete
+ && pConfig->bSecureDelete
+ && pConfig->iVersion==FTS5_CURRENT_VERSION
+ ){
+ rc = sqlite3Fts5StorageConfigValue(
+ pTab->pStorage, "version", 0, FTS5_CURRENT_VERSION_SECUREDELETE
+ );
+ if( rc==SQLITE_OK ){
+ pConfig->iVersion = FTS5_CURRENT_VERSION_SECUREDELETE;
}
}
@@ -257306,7 +256541,6 @@ static int fts5RollbackMethod(sqlite3_vtab *pVtab){
Fts5FullTable *pTab = (Fts5FullTable*)pVtab;
fts5CheckTransactionState(pTab, FTS5_ROLLBACK, 0);
rc = sqlite3Fts5StorageRollback(pTab->pStorage);
- pTab->p.pConfig->pgsz = 0;
return rc;
}
@@ -257352,11 +256586,11 @@ static int fts5ApiTokenize_v2(
Fts5Table *pTab = (Fts5Table*)(pCsr->base.pVtab);
int rc = SQLITE_OK;
- sqlite3Fts5SetLocale(pTab->pConfig, pLoc, nLoc);
+ fts5SetLocale(pTab->pConfig, pLoc, nLoc);
rc = sqlite3Fts5Tokenize(pTab->pConfig,
FTS5_TOKENIZE_AUX, pText, nText, pUserData, xToken
);
- sqlite3Fts5SetLocale(pTab->pConfig, 0, 0);
+ fts5SetLocale(pTab->pConfig, 0, 0);
return rc;
}
@@ -257384,49 +256618,6 @@ static int fts5ApiPhraseSize(Fts5Context *pCtx, int iPhrase){
return sqlite3Fts5ExprPhraseSize(pCsr->pExpr, iPhrase);
}
-/*
-** Argument pStmt is an SQL statement of the type used by Fts5Cursor. This
-** function extracts the text value of column iCol of the current row.
-** Additionally, if there is an associated locale, it invokes
-** sqlite3Fts5SetLocale() to configure the tokenizer. In all cases the caller
-** should invoke sqlite3Fts5ClearLocale() to clear the locale at some point
-** after this function returns.
-**
-** If successful, (*ppText) is set to point to a buffer containing the text
-** value as utf-8 and SQLITE_OK returned. (*pnText) is set to the size of that
-** buffer in bytes. It is not guaranteed to be nul-terminated. If an error
-** occurs, an SQLite error code is returned. The final values of the two
-** output parameters are undefined in this case.
-*/
-static int fts5TextFromStmt(
- Fts5Config *pConfig,
- sqlite3_stmt *pStmt,
- int iCol,
- const char **ppText,
- int *pnText
-){
- sqlite3_value *pVal = sqlite3_column_value(pStmt, iCol+1);
- const char *pLoc = 0;
- int nLoc = 0;
- int rc = SQLITE_OK;
-
- if( pConfig->bLocale
- && pConfig->eContent==FTS5_CONTENT_EXTERNAL
- && sqlite3Fts5IsLocaleValue(pConfig, pVal)
- ){
- rc = sqlite3Fts5DecodeLocaleValue(pVal, ppText, pnText, &pLoc, &nLoc);
- }else{
- *ppText = (const char*)sqlite3_value_text(pVal);
- *pnText = sqlite3_value_bytes(pVal);
- if( pConfig->bLocale && pConfig->eContent==FTS5_CONTENT_NORMAL ){
- pLoc = (const char*)sqlite3_column_text(pStmt, iCol+1+pConfig->nCol);
- nLoc = sqlite3_column_bytes(pStmt, iCol+1+pConfig->nCol);
- }
- }
- sqlite3Fts5SetLocale(pConfig, pLoc, nLoc);
- return rc;
-}
-
static int fts5ApiColumnText(
Fts5Context *pCtx,
int iCol,
@@ -257440,14 +256631,16 @@ static int fts5ApiColumnText(
assert( pCsr->ePlan!=FTS5_PLAN_SPECIAL );
if( iCol<0 || iCol>=pTab->pConfig->nCol ){
rc = SQLITE_RANGE;
- }else if( fts5IsContentless((Fts5FullTable*)(pCsr->base.pVtab), 0) ){
+ }else if( fts5IsContentless((Fts5FullTable*)(pCsr->base.pVtab)) ){
*pz = 0;
*pn = 0;
}else{
rc = fts5SeekCursor(pCsr, 0);
if( rc==SQLITE_OK ){
- rc = fts5TextFromStmt(pTab->pConfig, pCsr->pStmt, iCol, pz, pn);
- sqlite3Fts5ClearLocale(pTab->pConfig);
+ Fts5Config *pConfig = pTab->pConfig;
+ int bContent = (pConfig->abUnindexed[iCol]==0);
+ sqlite3_value *pVal = sqlite3_column_value(pCsr->pStmt, iCol+1);
+ sqlite3Fts5ExtractText(pConfig, pVal, bContent, 0, pz, pn);
}
}
return rc;
@@ -257473,7 +256666,7 @@ static int fts5CsrPoslist(
if( iPhrase<0 || iPhrase>=sqlite3Fts5ExprPhraseCount(pCsr->pExpr) ){
rc = SQLITE_RANGE;
}else if( pConfig->eDetail!=FTS5_DETAIL_FULL
- && fts5IsContentless((Fts5FullTable*)pCsr->base.pVtab, 1)
+ && pConfig->eContent==FTS5_CONTENT_NONE
){
*pa = 0;
*pn = 0;
@@ -257489,15 +256682,17 @@ static int fts5CsrPoslist(
rc = fts5SeekCursor(pCsr, 0);
}
for(i=0; inCol && rc==SQLITE_OK; i++){
+ sqlite3_value *pVal = sqlite3_column_value(pCsr->pStmt, i+1);
const char *z = 0;
int n = 0;
- rc = fts5TextFromStmt(pConfig, pCsr->pStmt, i, &z, &n);
+ int bReset = 0;
+ rc = sqlite3Fts5ExtractText(pConfig, pVal, 1, &bReset, &z, &n);
if( rc==SQLITE_OK ){
rc = sqlite3Fts5ExprPopulatePoslists(
pConfig, pCsr->pExpr, aPopulator, i, z, n
);
}
- sqlite3Fts5ClearLocale(pConfig);
+ if( bReset ) sqlite3Fts5ClearLocale(pConfig);
}
sqlite3_free(aPopulator);
@@ -257669,7 +256864,7 @@ static int fts5ApiColumnSize(Fts5Context *pCtx, int iCol, int *pnToken){
if( pConfig->bColumnsize ){
i64 iRowid = fts5CursorRowid(pCsr);
rc = sqlite3Fts5StorageDocsize(pTab->pStorage, iRowid, pCsr->aColumnSize);
- }else if( !pConfig->zContent || pConfig->eContent==FTS5_CONTENT_UNINDEXED ){
+ }else if( pConfig->zContent==0 ){
int i;
for(i=0; inCol; i++){
if( pConfig->abUnindexed[i]==0 ){
@@ -257683,14 +256878,17 @@ static int fts5ApiColumnSize(Fts5Context *pCtx, int iCol, int *pnToken){
if( pConfig->abUnindexed[i]==0 ){
const char *z = 0;
int n = 0;
+ int bReset = 0;
+ sqlite3_value *pVal = sqlite3_column_value(pCsr->pStmt, i+1);
+
pCsr->aColumnSize[i] = 0;
- rc = fts5TextFromStmt(pConfig, pCsr->pStmt, i, &z, &n);
+ rc = sqlite3Fts5ExtractText(pConfig, pVal, 1, &bReset, &z, &n);
if( rc==SQLITE_OK ){
rc = sqlite3Fts5Tokenize(pConfig, FTS5_TOKENIZE_AUX,
z, n, (void*)&pCsr->aColumnSize[i], fts5ColumnSizeCb
);
+ if( bReset ) sqlite3Fts5ClearLocale(pConfig);
}
- sqlite3Fts5ClearLocale(pConfig);
}
}
}
@@ -257957,19 +257155,42 @@ static int fts5ApiColumnLocale(
rc = SQLITE_RANGE;
}else if(
pConfig->abUnindexed[iCol]==0
- && 0==fts5IsContentless((Fts5FullTable*)pCsr->base.pVtab, 1)
+ && pConfig->eContent!=FTS5_CONTENT_NONE
&& pConfig->bLocale
){
rc = fts5SeekCursor(pCsr, 0);
if( rc==SQLITE_OK ){
- const char *zDummy = 0;
- int nDummy = 0;
- rc = fts5TextFromStmt(pConfig, pCsr->pStmt, iCol, &zDummy, &nDummy);
- if( rc==SQLITE_OK ){
- *pzLocale = pConfig->t.pLocale;
- *pnLocale = pConfig->t.nLocale;
+ /* Load the value into pVal. pVal is a locale/text pair iff:
+ **
+ ** 1) It is an SQLITE_BLOB, and
+ ** 2) Either the subtype is FTS5_LOCALE_SUBTYPE, or else the
+ ** value was loaded from an FTS5_CONTENT_NORMAL table, and
+ ** 3) It does not begin with an 0x00 byte.
+ */
+ sqlite3_value *pVal = sqlite3_column_value(pCsr->pStmt, iCol+1);
+ if( sqlite3_value_type(pVal)==SQLITE_BLOB ){
+ const u8 *pBlob = (const u8*)sqlite3_value_blob(pVal);
+ int nBlob = sqlite3_value_bytes(pVal);
+ if( pConfig->eContent==FTS5_CONTENT_EXTERNAL ){
+ const int SZHDR = sizeof(FTS5_LOCALE_HEADER)-1;
+ if( nBlobeContent!=FTS5_CONTENT_NONE );
+
+ if( pConfig->bLocale
+ && sqlite3_value_type(pVal)==SQLITE_BLOB
+ && pConfig->abUnindexed[iCol]==0
+ ){
+ const int SZHDR = sizeof(FTS5_LOCALE_HEADER)-1;
+ const u8 *pBlob = sqlite3_value_blob(pVal);
+ int nBlob = sqlite3_value_bytes(pVal);
+ int ii;
+
+ if( pConfig->eContent==FTS5_CONTENT_EXTERNAL ){
+ if( nBlobeContent!=FTS5_CONTENT_NONE ){
+ /* A column created by the user containing values. */
+ int bNochange = sqlite3_vtab_nochange(pCtx);
+
+ if( fts5IsContentless(pTab) ){
+ if( bNochange && pConfig->bContentlessDelete ){
+ fts5ResultError(pCtx, "cannot UPDATE a subset of "
+ "columns on fts5 contentless-delete table: %s", pConfig->zName
+ );
+ }
+ }else if( bNochange==0 || pConfig->eContent!=FTS5_CONTENT_NORMAL ){
pConfig->pzErrmsg = &pTab->p.base.zErrMsg;
rc = fts5SeekCursor(pCsr, 1);
if( rc==SQLITE_OK ){
sqlite3_value *pVal = sqlite3_column_value(pCsr->pStmt, iCol+1);
- if( pConfig->bLocale
- && pConfig->eContent==FTS5_CONTENT_EXTERNAL
- && sqlite3Fts5IsLocaleValue(pConfig, pVal)
- ){
- const char *z = 0;
- int n = 0;
- rc = fts5TextFromStmt(pConfig, pCsr->pStmt, iCol, &z, &n);
- if( rc==SQLITE_OK ){
- sqlite3_result_text(pCtx, z, n, SQLITE_TRANSIENT);
- }
- sqlite3Fts5ClearLocale(pConfig);
- }else{
- sqlite3_result_value(pCtx, pVal);
- }
+ fts5ExtractValueFromColumn(pCtx, pConfig, iCol, pVal);
}
-
pConfig->pzErrmsg = 0;
}
}
@@ -258775,7 +258042,7 @@ static void fts5SourceIdFunc(
){
assert( nArg==0 );
UNUSED_PARAM2(nArg, apUnused);
- sqlite3_result_text(pCtx, "fts5: 2025-02-06 12:46:51 cc3ce784b0feea2f7e86960d262a04c555df817192695d5760c2a83fb804a212", -1, SQLITE_TRANSIENT);
+ sqlite3_result_text(pCtx, "fts5: 2024-12-23 11:31:16 dc3a24a784c95398656e0d7885f7eb0ee626b86c896e759a6ac5c243fd6f0ab7", -1, SQLITE_TRANSIENT);
}
/*
@@ -258814,12 +258081,13 @@ static void fts5LocaleFunc(
if( zLocale==0 || zLocale[0]=='\0' ){
sqlite3_result_text(pCtx, zText, nText, SQLITE_TRANSIENT);
}else{
- Fts5Global *p = (Fts5Global*)sqlite3_user_data(pCtx);
u8 *pBlob = 0;
u8 *pCsr = 0;
int nBlob = 0;
+ const int nHdr = 4;
+ assert( sizeof(FTS5_LOCALE_HEADER)==nHdr+1 );
- nBlob = FTS5_LOCALE_HDR_SIZE + nLocale + 1 + nText;
+ nBlob = nHdr + nLocale + 1 + nText;
pBlob = (u8*)sqlite3_malloc(nBlob);
if( pBlob==0 ){
sqlite3_result_error_nomem(pCtx);
@@ -258827,8 +258095,8 @@ static void fts5LocaleFunc(
}
pCsr = pBlob;
- memcpy(pCsr, (const u8*)p->aLocaleHdr, FTS5_LOCALE_HDR_SIZE);
- pCsr += FTS5_LOCALE_HDR_SIZE;
+ memcpy(pCsr, FTS5_LOCALE_HEADER, nHdr);
+ pCsr += nHdr;
memcpy(pCsr, zLocale, nLocale);
pCsr += nLocale;
(*pCsr++) = 0x00;
@@ -258836,23 +258104,10 @@ static void fts5LocaleFunc(
assert( &pCsr[nText]==&pBlob[nBlob] );
sqlite3_result_blob(pCtx, pBlob, nBlob, sqlite3_free);
+ sqlite3_result_subtype(pCtx, FTS5_LOCALE_SUBTYPE);
}
}
-/*
-** Implementation of fts5_insttoken() function.
-*/
-static void fts5InsttokenFunc(
- sqlite3_context *pCtx, /* Function call context */
- int nArg, /* Number of args */
- sqlite3_value **apArg /* Function arguments */
-){
- assert( nArg==1 );
- (void)nArg;
- sqlite3_result_value(pCtx, apArg[0]);
- sqlite3_result_subtype(pCtx, FTS5_INSTTOKEN_SUBTYPE);
-}
-
/*
** Return true if zName is the extension on one of the shadow tables used
** by this module.
@@ -258951,16 +258206,6 @@ static int fts5Init(sqlite3 *db){
pGlobal->api.xFindTokenizer = fts5FindTokenizer;
pGlobal->api.xCreateTokenizer_v2 = fts5CreateTokenizer_v2;
pGlobal->api.xFindTokenizer_v2 = fts5FindTokenizer_v2;
-
- /* Initialize pGlobal->aLocaleHdr[] to a 128-bit pseudo-random vector.
- ** The constants below were generated randomly. */
- sqlite3_randomness(sizeof(pGlobal->aLocaleHdr), pGlobal->aLocaleHdr);
- pGlobal->aLocaleHdr[0] ^= 0xF924976D;
- pGlobal->aLocaleHdr[1] ^= 0x16596E13;
- pGlobal->aLocaleHdr[2] ^= 0x7C80BEAA;
- pGlobal->aLocaleHdr[3] ^= 0x9B03A67F;
- assert( sizeof(pGlobal->aLocaleHdr)==16 );
-
rc = sqlite3_create_module_v2(db, "fts5", &fts5Mod, p, fts5ModuleDestroy);
if( rc==SQLITE_OK ) rc = sqlite3Fts5IndexInit(db);
if( rc==SQLITE_OK ) rc = sqlite3Fts5ExprInit(pGlobal, db);
@@ -258982,15 +258227,8 @@ static int fts5Init(sqlite3 *db){
if( rc==SQLITE_OK ){
rc = sqlite3_create_function(
db, "fts5_locale", 2,
- SQLITE_UTF8|SQLITE_INNOCUOUS|SQLITE_RESULT_SUBTYPE|SQLITE_SUBTYPE,
- p, fts5LocaleFunc, 0, 0
- );
- }
- if( rc==SQLITE_OK ){
- rc = sqlite3_create_function(
- db, "fts5_insttoken", 1,
SQLITE_UTF8|SQLITE_INNOCUOUS|SQLITE_RESULT_SUBTYPE,
- p, fts5InsttokenFunc, 0, 0
+ p, fts5LocaleFunc, 0, 0
);
}
}
@@ -259194,35 +258432,20 @@ static int fts5StorageGetStmt(
case FTS5_STMT_INSERT_CONTENT:
case FTS5_STMT_REPLACE_CONTENT: {
- char *zBind = 0;
+ int nCol = pC->nCol + 1;
+ char *zBind;
int i;
- assert( pC->eContent==FTS5_CONTENT_NORMAL
- || pC->eContent==FTS5_CONTENT_UNINDEXED
- );
-
- /* Add bindings for the "c*" columns - those that store the actual
- ** table content. If eContent==NORMAL, then there is one binding
- ** for each column. Or, if eContent==UNINDEXED, then there are only
- ** bindings for the UNINDEXED columns. */
- for(i=0; rc==SQLITE_OK && i<(pC->nCol+1); i++){
- if( !i || pC->eContent==FTS5_CONTENT_NORMAL || pC->abUnindexed[i-1] ){
- zBind = sqlite3Fts5Mprintf(&rc, "%z%s?%d", zBind, zBind?",":"",i+1);
- }
- }
-
- /* Add bindings for any "l*" columns. Only non-UNINDEXED columns
- ** require these. */
- if( pC->bLocale && pC->eContent==FTS5_CONTENT_NORMAL ){
- for(i=0; rc==SQLITE_OK && inCol; i++){
- if( pC->abUnindexed[i]==0 ){
- zBind = sqlite3Fts5Mprintf(&rc, "%z,?%d", zBind, pC->nCol+i+2);
- }
+ zBind = sqlite3_malloc64(1 + nCol*2);
+ if( zBind ){
+ for(i=0; izDb, pC->zName, zBind);
+ sqlite3_free(zBind);
}
-
- zSql = sqlite3Fts5Mprintf(&rc, azStmt[eStmt], pC->zDb, pC->zName,zBind);
- sqlite3_free(zBind);
break;
}
@@ -259256,11 +258479,6 @@ static int fts5StorageGetStmt(
if( rc!=SQLITE_OK && pzErrMsg ){
*pzErrMsg = sqlite3_mprintf("%s", sqlite3_errmsg(pC->db));
}
- if( rc==SQLITE_ERROR && eStmt>FTS5_STMT_LOOKUP2 && eStmtpIndex = pIndex;
if( bCreate ){
- if( pConfig->eContent==FTS5_CONTENT_NORMAL
- || pConfig->eContent==FTS5_CONTENT_UNINDEXED
- ){
+ if( pConfig->eContent==FTS5_CONTENT_NORMAL ){
int nDefn = 32 + pConfig->nCol*10;
- char *zDefn = sqlite3_malloc64(32 + (sqlite3_int64)pConfig->nCol * 20);
+ char *zDefn = sqlite3_malloc64(32 + (sqlite3_int64)pConfig->nCol * 10);
if( zDefn==0 ){
rc = SQLITE_NOMEM;
}else{
@@ -259426,20 +258642,8 @@ static int sqlite3Fts5StorageOpen(
sqlite3_snprintf(nDefn, zDefn, "id INTEGER PRIMARY KEY");
iOff = (int)strlen(zDefn);
for(i=0; inCol; i++){
- if( pConfig->eContent==FTS5_CONTENT_NORMAL
- || pConfig->abUnindexed[i]
- ){
- sqlite3_snprintf(nDefn-iOff, &zDefn[iOff], ", c%d", i);
- iOff += (int)strlen(&zDefn[iOff]);
- }
- }
- if( pConfig->bLocale ){
- for(i=0; inCol; i++){
- if( pConfig->abUnindexed[i]==0 ){
- sqlite3_snprintf(nDefn-iOff, &zDefn[iOff], ", l%d", i);
- iOff += (int)strlen(&zDefn[iOff]);
- }
- }
+ sqlite3_snprintf(nDefn-iOff, &zDefn[iOff], ", c%d", i);
+ iOff += (int)strlen(&zDefn[iOff]);
}
rc = sqlite3Fts5CreateTable(pConfig, "content", zDefn, 0, pzErr);
}
@@ -259592,8 +258796,7 @@ static int fts5StorageDeleteFromIndex(
sqlite3_value *pVal = 0;
const char *pText = 0;
int nText = 0;
- const char *pLoc = 0;
- int nLoc = 0;
+ int bReset = 0;
assert( pSeek==0 || apVal==0 );
assert( pSeek!=0 || apVal!=0 );
@@ -259603,19 +258806,10 @@ static int fts5StorageDeleteFromIndex(
pVal = apVal[iCol-1];
}
- if( pConfig->bLocale && sqlite3Fts5IsLocaleValue(pConfig, pVal) ){
- rc = sqlite3Fts5DecodeLocaleValue(pVal, &pText, &nText, &pLoc, &nLoc);
- }else{
- pText = (const char*)sqlite3_value_text(pVal);
- nText = sqlite3_value_bytes(pVal);
- if( pConfig->bLocale && pSeek ){
- pLoc = (const char*)sqlite3_column_text(pSeek, iCol + pConfig->nCol);
- nLoc = sqlite3_column_bytes(pSeek, iCol + pConfig->nCol);
- }
- }
-
+ rc = sqlite3Fts5ExtractText(
+ pConfig, pVal, pSeek!=0, &bReset, &pText, &nText
+ );
if( rc==SQLITE_OK ){
- sqlite3Fts5SetLocale(pConfig, pLoc, nLoc);
ctx.szCol = 0;
rc = sqlite3Fts5Tokenize(pConfig, FTS5_TOKENIZE_DOCUMENT,
pText, nText, (void*)&ctx, fts5StorageInsertCallback
@@ -259624,7 +258818,7 @@ static int fts5StorageDeleteFromIndex(
if( rc==SQLITE_OK && p->aTotalSize[iCol-1]<0 ){
rc = FTS5_CORRUPT;
}
- sqlite3Fts5ClearLocale(pConfig);
+ if( bReset ) sqlite3Fts5ClearLocale(pConfig);
}
}
}
@@ -259669,9 +258863,7 @@ static int fts5StorageContentlessDelete(Fts5Storage *p, i64 iDel){
int rc = SQLITE_OK;
assert( p->pConfig->bContentlessDelete );
- assert( p->pConfig->eContent==FTS5_CONTENT_NONE
- || p->pConfig->eContent==FTS5_CONTENT_UNINDEXED
- );
+ assert( p->pConfig->eContent==FTS5_CONTENT_NONE );
/* Look up the origin of the document in the %_docsize table. Store
** this in stack variable iOrigin. */
@@ -259795,12 +258987,6 @@ static int sqlite3Fts5StorageDelete(
if( rc==SQLITE_OK ){
if( p->pConfig->bContentlessDelete ){
rc = fts5StorageContentlessDelete(p, iDel);
- if( rc==SQLITE_OK
- && bSaveRow
- && p->pConfig->eContent==FTS5_CONTENT_UNINDEXED
- ){
- rc = sqlite3Fts5StorageFindDeleteRow(p, iDel);
- }
}else{
rc = fts5StorageDeleteFromIndex(p, iDel, apVal, bSaveRow);
}
@@ -259817,9 +259003,7 @@ static int sqlite3Fts5StorageDelete(
}
/* Delete the %_content record */
- if( pConfig->eContent==FTS5_CONTENT_NORMAL
- || pConfig->eContent==FTS5_CONTENT_UNINDEXED
- ){
+ if( pConfig->eContent==FTS5_CONTENT_NORMAL ){
if( rc==SQLITE_OK ){
rc = fts5StorageGetStmt(p, FTS5_STMT_DELETE_CONTENT, &pDel, 0);
}
@@ -259851,13 +259035,8 @@ static int sqlite3Fts5StorageDeleteAll(Fts5Storage *p){
);
if( rc==SQLITE_OK && pConfig->bColumnsize ){
rc = fts5ExecPrintf(pConfig->db, 0,
- "DELETE FROM %Q.'%q_docsize';", pConfig->zDb, pConfig->zName
- );
- }
-
- if( rc==SQLITE_OK && pConfig->eContent==FTS5_CONTENT_UNINDEXED ){
- rc = fts5ExecPrintf(pConfig->db, 0,
- "DELETE FROM %Q.'%q_content';", pConfig->zDb, pConfig->zName
+ "DELETE FROM %Q.'%q_docsize';",
+ pConfig->zDb, pConfig->zName
);
}
@@ -259898,35 +259077,20 @@ static int sqlite3Fts5StorageRebuild(Fts5Storage *p){
for(ctx.iCol=0; rc==SQLITE_OK && ctx.iColnCol; ctx.iCol++){
ctx.szCol = 0;
if( pConfig->abUnindexed[ctx.iCol]==0 ){
+ int bReset = 0; /* True if tokenizer locale must be reset */
int nText = 0; /* Size of pText in bytes */
const char *pText = 0; /* Pointer to buffer containing text value */
- int nLoc = 0; /* Size of pLoc in bytes */
- const char *pLoc = 0; /* Pointer to buffer containing text value */
-
sqlite3_value *pVal = sqlite3_column_value(pScan, ctx.iCol+1);
- if( pConfig->eContent==FTS5_CONTENT_EXTERNAL
- && sqlite3Fts5IsLocaleValue(pConfig, pVal)
- ){
- rc = sqlite3Fts5DecodeLocaleValue(pVal, &pText, &nText, &pLoc, &nLoc);
- }else{
- pText = (const char*)sqlite3_value_text(pVal);
- nText = sqlite3_value_bytes(pVal);
- if( pConfig->bLocale ){
- int iCol = ctx.iCol + 1 + pConfig->nCol;
- pLoc = (const char*)sqlite3_column_text(pScan, iCol);
- nLoc = sqlite3_column_bytes(pScan, iCol);
- }
- }
+ rc = sqlite3Fts5ExtractText(pConfig, pVal, 1, &bReset, &pText, &nText);
if( rc==SQLITE_OK ){
- sqlite3Fts5SetLocale(pConfig, pLoc, nLoc);
rc = sqlite3Fts5Tokenize(pConfig,
FTS5_TOKENIZE_DOCUMENT,
pText, nText,
(void*)&ctx,
fts5StorageInsertCallback
);
- sqlite3Fts5ClearLocale(pConfig);
+ if( bReset ) sqlite3Fts5ClearLocale(pConfig);
}
}
sqlite3Fts5BufferAppendVarint(&rc, &buf, ctx.szCol);
@@ -259993,7 +259157,6 @@ static int fts5StorageNewRowid(Fts5Storage *p, i64 *piRowid){
*/
static int sqlite3Fts5StorageContentInsert(
Fts5Storage *p,
- int bReplace, /* True to use REPLACE instead of INSERT */
sqlite3_value **apVal,
i64 *piRowid
){
@@ -260001,9 +259164,7 @@ static int sqlite3Fts5StorageContentInsert(
int rc = SQLITE_OK;
/* Insert the new row into the %_content table. */
- if( pConfig->eContent!=FTS5_CONTENT_NORMAL
- && pConfig->eContent!=FTS5_CONTENT_UNINDEXED
- ){
+ if( pConfig->eContent!=FTS5_CONTENT_NORMAL ){
if( sqlite3_value_type(apVal[1])==SQLITE_INTEGER ){
*piRowid = sqlite3_value_int64(apVal[1]);
}else{
@@ -260012,52 +259173,33 @@ static int sqlite3Fts5StorageContentInsert(
}else{
sqlite3_stmt *pInsert = 0; /* Statement to write %_content table */
int i; /* Counter variable */
-
- assert( FTS5_STMT_INSERT_CONTENT+1==FTS5_STMT_REPLACE_CONTENT );
- assert( bReplace==0 || bReplace==1 );
- rc = fts5StorageGetStmt(p, FTS5_STMT_INSERT_CONTENT+bReplace, &pInsert, 0);
- if( pInsert ) sqlite3_clear_bindings(pInsert);
-
- /* Bind the rowid value */
- sqlite3_bind_value(pInsert, 1, apVal[1]);
-
- /* Loop through values for user-defined columns. i=2 is the leftmost
- ** user-defined column. As is column 1 of pSavedRow. */
- for(i=2; rc==SQLITE_OK && i<=pConfig->nCol+1; i++){
- int bUnindexed = pConfig->abUnindexed[i-2];
- if( pConfig->eContent==FTS5_CONTENT_NORMAL || bUnindexed ){
- sqlite3_value *pVal = apVal[i];
-
- if( sqlite3_value_nochange(pVal) && p->pSavedRow ){
- /* This is an UPDATE statement, and user-defined column (i-2) was not
- ** modified. Retrieve the value from Fts5Storage.pSavedRow. */
- pVal = sqlite3_column_value(p->pSavedRow, i-1);
- if( pConfig->bLocale && bUnindexed==0 ){
- sqlite3_bind_value(pInsert, pConfig->nCol + i,
- sqlite3_column_value(p->pSavedRow, pConfig->nCol + i - 1)
- );
- }
- }else if( sqlite3Fts5IsLocaleValue(pConfig, pVal) ){
+ rc = fts5StorageGetStmt(p, FTS5_STMT_INSERT_CONTENT, &pInsert, 0);
+ for(i=1; rc==SQLITE_OK && i<=pConfig->nCol+1; i++){
+ sqlite3_value *pVal = apVal[i];
+ if( sqlite3_value_nochange(pVal) && p->pSavedRow ){
+ /* This is an UPDATE statement, and column (i-2) was not modified.
+ ** Retrieve the value from Fts5Storage.pSavedRow instead. */
+ pVal = sqlite3_column_value(p->pSavedRow, i-1);
+ }else if( sqlite3_value_subtype(pVal)==FTS5_LOCALE_SUBTYPE ){
+ assert( pConfig->bLocale );
+ assert( i>1 );
+ if( pConfig->abUnindexed[i-2] ){
+ /* At attempt to insert an fts5_locale() value into an UNINDEXED
+ ** column. Strip the locale away and just bind the text. */
const char *pText = 0;
- const char *pLoc = 0;
int nText = 0;
- int nLoc = 0;
- assert( pConfig->bLocale );
-
- rc = sqlite3Fts5DecodeLocaleValue(pVal, &pText, &nText, &pLoc, &nLoc);
- if( rc==SQLITE_OK ){
- sqlite3_bind_text(pInsert, i, pText, nText, SQLITE_TRANSIENT);
- if( bUnindexed==0 ){
- int iLoc = pConfig->nCol + i;
- sqlite3_bind_text(pInsert, iLoc, pLoc, nLoc, SQLITE_TRANSIENT);
- }
- }
-
- continue;
+ rc = sqlite3Fts5ExtractText(pConfig, pVal, 0, 0, &pText, &nText);
+ sqlite3_bind_text(pInsert, i, pText, nText, SQLITE_TRANSIENT);
+ }else{
+ const u8 *pBlob = (const u8*)sqlite3_value_blob(pVal);
+ int nBlob = sqlite3_value_bytes(pVal);
+ assert( nBlob>4 );
+ sqlite3_bind_blob(pInsert, i, pBlob+4, nBlob-4, SQLITE_TRANSIENT);
}
-
- rc = sqlite3_bind_value(pInsert, i, pVal);
+ continue;
}
+
+ rc = sqlite3_bind_value(pInsert, i, pVal);
}
if( rc==SQLITE_OK ){
sqlite3_step(pInsert);
@@ -260092,37 +259234,23 @@ static int sqlite3Fts5StorageIndexInsert(
for(ctx.iCol=0; rc==SQLITE_OK && ctx.iColnCol; ctx.iCol++){
ctx.szCol = 0;
if( pConfig->abUnindexed[ctx.iCol]==0 ){
+ int bReset = 0; /* True if tokenizer locale must be reset */
int nText = 0; /* Size of pText in bytes */
const char *pText = 0; /* Pointer to buffer containing text value */
- int nLoc = 0; /* Size of pText in bytes */
- const char *pLoc = 0; /* Pointer to buffer containing text value */
-
sqlite3_value *pVal = apVal[ctx.iCol+2];
+ int bDisk = 0;
if( p->pSavedRow && sqlite3_value_nochange(pVal) ){
pVal = sqlite3_column_value(p->pSavedRow, ctx.iCol+1);
- if( pConfig->eContent==FTS5_CONTENT_NORMAL && pConfig->bLocale ){
- int iCol = ctx.iCol + 1 + pConfig->nCol;
- pLoc = (const char*)sqlite3_column_text(p->pSavedRow, iCol);
- nLoc = sqlite3_column_bytes(p->pSavedRow, iCol);
- }
- }else{
- pVal = apVal[ctx.iCol+2];
- }
-
- if( pConfig->bLocale && sqlite3Fts5IsLocaleValue(pConfig, pVal) ){
- rc = sqlite3Fts5DecodeLocaleValue(pVal, &pText, &nText, &pLoc, &nLoc);
- }else{
- pText = (const char*)sqlite3_value_text(pVal);
- nText = sqlite3_value_bytes(pVal);
+ bDisk = 1;
}
-
+ rc = sqlite3Fts5ExtractText(pConfig, pVal, bDisk, &bReset, &pText,&nText);
if( rc==SQLITE_OK ){
- sqlite3Fts5SetLocale(pConfig, pLoc, nLoc);
+ assert( bReset==0 || pConfig->bLocale );
rc = sqlite3Fts5Tokenize(pConfig,
FTS5_TOKENIZE_DOCUMENT, pText, nText, (void*)&ctx,
fts5StorageInsertCallback
);
- sqlite3Fts5ClearLocale(pConfig);
+ if( bReset ) sqlite3Fts5ClearLocale(pConfig);
}
}
sqlite3Fts5BufferAppendVarint(&rc, &buf, ctx.szCol);
@@ -260287,62 +259415,38 @@ static int sqlite3Fts5StorageIntegrity(Fts5Storage *p, int iArg){
rc = sqlite3Fts5TermsetNew(&ctx.pTermset);
}
for(i=0; rc==SQLITE_OK && inCol; i++){
- if( pConfig->abUnindexed[i]==0 ){
- const char *pText = 0;
- int nText = 0;
- const char *pLoc = 0;
- int nLoc = 0;
- sqlite3_value *pVal = sqlite3_column_value(pScan, i+1);
-
- if( pConfig->eContent==FTS5_CONTENT_EXTERNAL
- && sqlite3Fts5IsLocaleValue(pConfig, pVal)
- ){
- rc = sqlite3Fts5DecodeLocaleValue(
- pVal, &pText, &nText, &pLoc, &nLoc
- );
- }else{
- if( pConfig->eContent==FTS5_CONTENT_NORMAL && pConfig->bLocale ){
- int iCol = i + 1 + pConfig->nCol;
- pLoc = (const char*)sqlite3_column_text(pScan, iCol);
- nLoc = sqlite3_column_bytes(pScan, iCol);
- }
- pText = (const char*)sqlite3_value_text(pVal);
- nText = sqlite3_value_bytes(pVal);
- }
-
- ctx.iCol = i;
- ctx.szCol = 0;
-
- if( rc==SQLITE_OK && pConfig->eDetail==FTS5_DETAIL_COLUMNS ){
- rc = sqlite3Fts5TermsetNew(&ctx.pTermset);
- }
+ if( pConfig->abUnindexed[i] ) continue;
+ ctx.iCol = i;
+ ctx.szCol = 0;
+ if( pConfig->eDetail==FTS5_DETAIL_COLUMNS ){
+ rc = sqlite3Fts5TermsetNew(&ctx.pTermset);
+ }
+ if( rc==SQLITE_OK ){
+ int bReset = 0; /* True if tokenizer locale must be reset */
+ int nText = 0; /* Size of pText in bytes */
+ const char *pText = 0; /* Pointer to buffer containing text value */
+ rc = sqlite3Fts5ExtractText(pConfig,
+ sqlite3_column_value(pScan, i+1), 1, &bReset, &pText, &nText
+ );
if( rc==SQLITE_OK ){
- sqlite3Fts5SetLocale(pConfig, pLoc, nLoc);
rc = sqlite3Fts5Tokenize(pConfig,
FTS5_TOKENIZE_DOCUMENT,
pText, nText,
(void*)&ctx,
fts5StorageIntegrityCallback
);
- sqlite3Fts5ClearLocale(pConfig);
- }
-
- /* If this is not a columnsize=0 database, check that the number
- ** of tokens in the value matches the aColSize[] value read from
- ** the %_docsize table. */
- if( rc==SQLITE_OK
- && pConfig->bColumnsize
- && ctx.szCol!=aColSize[i]
- ){
- rc = FTS5_CORRUPT;
- }
- aTotalSize[i] += ctx.szCol;
- if( pConfig->eDetail==FTS5_DETAIL_COLUMNS ){
- sqlite3Fts5TermsetFree(ctx.pTermset);
- ctx.pTermset = 0;
+ if( bReset ) sqlite3Fts5ClearLocale(pConfig);
}
}
+ if( rc==SQLITE_OK && pConfig->bColumnsize && ctx.szCol!=aColSize[i] ){
+ rc = FTS5_CORRUPT;
+ }
+ aTotalSize[i] += ctx.szCol;
+ if( pConfig->eDetail==FTS5_DETAIL_COLUMNS ){
+ sqlite3Fts5TermsetFree(ctx.pTermset);
+ ctx.pTermset = 0;
+ }
}
sqlite3Fts5TermsetFree(ctx.pTermset);
ctx.pTermset = 0;
@@ -260767,7 +259871,7 @@ static const unsigned char sqlite3Utf8Trans1[] = {
c = *(zIn++); \
if( c>=0xc0 ){ \
c = sqlite3Utf8Trans1[c-0xc0]; \
- while( zIn=zEof ) return SQLITE_OK;
READ_UTF8(zIn, zEof, iCode);
+ if( iCode==0 ) return SQLITE_OK;
if( p->bFold ) iCode = sqlite3Fts5UnicodeFold(iCode, p->iFoldParam);
}while( iCode==0 );
WRITE_UTF8(zOut, iCode);
@@ -261954,11 +261058,8 @@ static int fts5TriTokenize(
/* Read characters from the input up until the first non-diacritic */
do {
iNext = zIn - (const unsigned char*)pText;
- if( zIn>=zEof ){
- iCode = 0;
- break;
- }
READ_UTF8(zIn, zEof, iCode);
+ if( iCode==0 ) break;
if( p->bFold ) iCode = sqlite3Fts5UnicodeFold(iCode, p->iFoldParam);
}while( iCode==0 );
@@ -263995,7 +263096,7 @@ static int sqlite3Fts5VocabInit(Fts5Global *pGlobal, sqlite3 *db){
}
-/* Here ends the fts5.c composite file. */
+
#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS5) */
/************** End of fts5.c ************************************************/
@@ -264351,5 +263452,4 @@ SQLITE_API int sqlite3_stmt_init(
/************** End of stmt.c ************************************************/
/* Return the source-id for this library */
SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
-#endif /* SQLITE_AMALGAMATION */
/************************** End of sqlite3.c ******************************/
diff --git a/libstuff/sqlite3.h b/libstuff/sqlite3.h
index 18d1aa97d..0f96f7dfd 100644
--- a/libstuff/sqlite3.h
+++ b/libstuff/sqlite3.h
@@ -146,9 +146,9 @@ extern "C" {
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
** [sqlite_version()] and [sqlite_source_id()].
*/
-#define SQLITE_VERSION "3.49.0"
-#define SQLITE_VERSION_NUMBER 3049000
-#define SQLITE_SOURCE_ID "2025-02-06 12:46:51 cc3ce784b0feea2f7e86960d262a04c555df817192695d5760c2a83fb804a212"
+#define SQLITE_VERSION "3.47.0"
+#define SQLITE_VERSION_NUMBER 3047000
+#define SQLITE_SOURCE_ID "2024-12-23 11:31:16 dc3a24a784c95398656e0d7885f7eb0ee626b86c896e759a6ac5c243fd6f0ab7"
/*
** CAPI3REF: Run-Time Library Version Numbers
@@ -652,13 +652,6 @@ SQLITE_API int sqlite3_exec(
** filesystem supports doing multiple write operations atomically when those
** write operations are bracketed by [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] and
** [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE].
-**
-** The SQLITE_IOCAP_SUBPAGE_READ property means that it is ok to read
-** from the database file in amounts that are not a multiple of the
-** page size and that do not begin at a page boundary. Without this
-** property, SQLite is careful to only do full-page reads and write
-** on aligned pages, with the one exception that it will do a sub-page
-** read of the first page to access the database header.
*/
#define SQLITE_IOCAP_ATOMIC 0x00000001
#define SQLITE_IOCAP_ATOMIC512 0x00000002
@@ -675,7 +668,6 @@ SQLITE_API int sqlite3_exec(
#define SQLITE_IOCAP_POWERSAFE_OVERWRITE 0x00001000
#define SQLITE_IOCAP_IMMUTABLE 0x00002000
#define SQLITE_IOCAP_BATCH_ATOMIC 0x00004000
-#define SQLITE_IOCAP_SUBPAGE_READ 0x00008000
/*
** CAPI3REF: File Locking Levels
@@ -822,7 +814,6 @@ struct sqlite3_file {
** [SQLITE_IOCAP_POWERSAFE_OVERWRITE]
** [SQLITE_IOCAP_IMMUTABLE]
** [SQLITE_IOCAP_BATCH_ATOMIC]
-** [SQLITE_IOCAP_SUBPAGE_READ]
**
**
** The SQLITE_IOCAP_ATOMIC property means that all writes of
@@ -1100,11 +1091,6 @@ struct sqlite3_io_methods {
** pointed to by the pArg argument. This capability is used during testing
** and only needs to be supported when SQLITE_TEST is defined.
**
-** [[SQLITE_FCNTL_NULL_IO]]
-** The [SQLITE_FCNTL_NULL_IO] opcode sets the low-level file descriptor
-** or file handle for the [sqlite3_file] object such that it will no longer
-** read or write to the database file.
-**
** [[SQLITE_FCNTL_WAL_BLOCK]]
** The [SQLITE_FCNTL_WAL_BLOCK] is a signal to the VFS layer that it might
** be advantageous to block on the next WAL lock if the lock is not immediately
@@ -1258,7 +1244,6 @@ struct sqlite3_io_methods {
#define SQLITE_FCNTL_EXTERNAL_READER 40
#define SQLITE_FCNTL_CKSM_FILE 41
#define SQLITE_FCNTL_RESET_CACHE 42
-#define SQLITE_FCNTL_NULL_IO 43
/* deprecated names */
#define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE
@@ -2211,15 +2196,7 @@ struct sqlite3_mem_methods {
** CAPI3REF: Database Connection Configuration Options
**
** These constants are the available integer configuration options that
-** can be passed as the second parameter to the [sqlite3_db_config()] interface.
-**
-** The [sqlite3_db_config()] interface is a var-args functions. It takes a
-** variable number of parameters, though always at least two. The number of
-** parameters passed into sqlite3_db_config() depends on which of these
-** constants is given as the second parameter. This documentation page
-** refers to parameters beyond the second as "arguments". Thus, when this
-** page says "the N-th argument" it means "the N-th parameter past the
-** configuration option" or "the (N+2)-th parameter to sqlite3_db_config()".
+** can be passed as the second argument to the [sqlite3_db_config()] interface.
**
** New configuration options may be added in future releases of SQLite.
** Existing configuration options might be discontinued. Applications
@@ -2231,14 +2208,8 @@ struct sqlite3_mem_methods {
**
** [[SQLITE_DBCONFIG_LOOKASIDE]]
** - SQLITE_DBCONFIG_LOOKASIDE
-** - The SQLITE_DBCONFIG_LOOKASIDE option is used to adjust the
-** configuration of the lookaside memory allocator within a database
-** connection.
-** The arguments to the SQLITE_DBCONFIG_LOOKASIDE option are not
-** in the [DBCONFIG arguments|usual format].
-** The SQLITE_DBCONFIG_LOOKASIDE option takes three arguments, not two,
-** so that a call to [sqlite3_db_config()] that uses SQLITE_DBCONFIG_LOOKASIDE
-** should have a total of five parameters.
+**
- ^This option takes three additional arguments that determine the
+** [lookaside memory allocator] configuration for the [database connection].
** ^The first argument (the third parameter to [sqlite3_db_config()] is a
** pointer to a memory buffer to use for lookaside memory.
** ^The first argument after the SQLITE_DBCONFIG_LOOKASIDE verb
@@ -2261,8 +2232,7 @@ struct sqlite3_mem_methods {
** [[SQLITE_DBCONFIG_ENABLE_FKEY]]
**
- SQLITE_DBCONFIG_ENABLE_FKEY
** - ^This option is used to enable or disable the enforcement of
-** [foreign key constraints]. This is the same setting that is
-** enabled or disabled by the [PRAGMA foreign_keys] statement.
+** [foreign key constraints]. There should be two additional arguments.
** The first argument is an integer which is 0 to disable FK enforcement,
** positive to enable FK enforcement or negative to leave FK enforcement
** unchanged. The second parameter is a pointer to an integer into which
@@ -2284,13 +2254,13 @@ struct sqlite3_mem_methods {
**
Originally this option disabled all triggers. ^(However, since
** SQLite version 3.35.0, TEMP triggers are still allowed even if
** this option is off. So, in other words, this option now only disables
-** triggers in the main database schema or in the schemas of [ATTACH]-ed
+** triggers in the main database schema or in the schemas of ATTACH-ed
** databases.)^
**
** [[SQLITE_DBCONFIG_ENABLE_VIEW]]
** - SQLITE_DBCONFIG_ENABLE_VIEW
** - ^This option is used to enable or disable [CREATE VIEW | views].
-** There must be two additional arguments.
+** There should be two additional arguments.
** The first argument is an integer which is 0 to disable views,
** positive to enable views or negative to leave the setting unchanged.
** The second parameter is a pointer to an integer into which
@@ -2309,7 +2279,7 @@ struct sqlite3_mem_methods {
**
- ^This option is used to enable or disable the
** [fts3_tokenizer()] function which is part of the
** [FTS3] full-text search engine extension.
-** There must be two additional arguments.
+** There should be two additional arguments.
** The first argument is an integer which is 0 to disable fts3_tokenizer() or
** positive to enable fts3_tokenizer() or negative to leave the setting
** unchanged.
@@ -2324,7 +2294,7 @@ struct sqlite3_mem_methods {
** interface independently of the [load_extension()] SQL function.
** The [sqlite3_enable_load_extension()] API enables or disables both the
** C-API [sqlite3_load_extension()] and the SQL function [load_extension()].
-** There must be two additional arguments.
+** There should be two additional arguments.
** When the first argument to this interface is 1, then only the C-API is
** enabled and the SQL function remains disabled. If the first argument to
** this interface is 0, then both the C-API and the SQL function are disabled.
@@ -2338,30 +2308,23 @@ struct sqlite3_mem_methods {
**
** [[SQLITE_DBCONFIG_MAINDBNAME]]
- SQLITE_DBCONFIG_MAINDBNAME
** - ^This option is used to change the name of the "main" database
-** schema. This option does not follow the
-** [DBCONFIG arguments|usual SQLITE_DBCONFIG argument format].
-** This option takes exactly one additional argument so that the
-** [sqlite3_db_config()] call has a total of three parameters. The
-** extra argument must be a pointer to a constant UTF8 string which
-** will become the new schema name in place of "main". ^SQLite does
-** not make a copy of the new main schema name string, so the application
-** must ensure that the argument passed into SQLITE_DBCONFIG MAINDBNAME
-** is unchanged until after the database connection closes.
+** schema. ^The sole argument is a pointer to a constant UTF8 string
+** which will become the new schema name in place of "main". ^SQLite
+** does not make a copy of the new main schema name string, so the application
+** must ensure that the argument passed into this DBCONFIG option is unchanged
+** until after the database connection closes.
**
**
** [[SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE]]
** - SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE
-** - Usually, when a database in [WAL mode] is closed or detached from a
-** database handle, SQLite checks if if there are other connections to the
-** same database, and if there are no other database connection (if the
-** connection being closed is the last open connection to the database),
-** then SQLite performs a [checkpoint] before closing the connection and
-** deletes the WAL file. The SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE option can
-** be used to override that behavior. The first argument passed to this
-** operation (the third parameter to [sqlite3_db_config()]) is an integer
-** which is positive to disable checkpoints-on-close, or zero (the default)
-** to enable them, and negative to leave the setting unchanged.
-** The second argument (the fourth parameter) is a pointer to an integer
+**
- Usually, when a database in wal mode is closed or detached from a
+** database handle, SQLite checks if this will mean that there are now no
+** connections at all to the database. If so, it performs a checkpoint
+** operation before closing the connection. This option may be used to
+** override this behavior. The first parameter passed to this operation
+** is an integer - positive to disable checkpoints-on-close, or zero (the
+** default) to enable them, and negative to leave the setting unchanged.
+** The second parameter is a pointer to an integer
** into which is written 0 or 1 to indicate whether checkpoints-on-close
** have been disabled - 0 if they are not disabled, 1 if they are.
**
@@ -2522,7 +2485,7 @@ struct sqlite3_mem_methods {
** statistics. For statistics to be collected, the flag must be set on
** the database handle both when the SQL statement is prepared and when it
** is stepped. The flag is set (collection of statistics is enabled)
-** by default. This option takes two arguments: an integer and a pointer to
+** by default. This option takes two arguments: an integer and a pointer to
** an integer.. The first argument is 1, 0, or -1 to enable, disable, or
** leave unchanged the statement scanstatus option. If the second argument
** is not NULL, then the value of the statement scanstatus setting after
@@ -2536,7 +2499,7 @@ struct sqlite3_mem_methods {
** in which tables and indexes are scanned so that the scans start at the end
** and work toward the beginning rather than starting at the beginning and
** working toward the end. Setting SQLITE_DBCONFIG_REVERSE_SCANORDER is the
-** same as setting [PRAGMA reverse_unordered_selects].
This option takes
+** same as setting [PRAGMA reverse_unordered_selects]. This option takes
** two arguments which are an integer and a pointer to an integer. The first
** argument is 1, 0, or -1 to enable, disable, or leave unchanged the
** reverse scan order flag, respectively. If the second argument is not NULL,
@@ -2545,76 +2508,7 @@ struct sqlite3_mem_methods {
** first argument.
**
**
-** [[SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE]]
-** - SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE
-** - The SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE option enables or disables
-** the ability of the [ATTACH DATABASE] SQL command to create a new database
-** file if the database filed named in the ATTACH command does not already
-** exist. This ability of ATTACH to create a new database is enabled by
-** default. Applications can disable or reenable the ability for ATTACH to
-** create new database files using this DBCONFIG option.
-** This option takes two arguments which are an integer and a pointer
-** to an integer. The first argument is 1, 0, or -1 to enable, disable, or
-** leave unchanged the attach-create flag, respectively. If the second
-** argument is not NULL, then 0 or 1 is written into the integer that the
-** second argument points to depending on if the attach-create flag is set
-** after processing the first argument.
-**
-**
-** [[SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE]]
-** - SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE
-** - The SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE option enables or disables the
-** ability of the [ATTACH DATABASE] SQL command to open a database for writing.
-** This capability is enabled by default. Applications can disable or
-** reenable this capability using the current DBCONFIG option. If the
-** the this capability is disabled, the [ATTACH] command will still work,
-** but the database will be opened read-only. If this option is disabled,
-** then the ability to create a new database using [ATTACH] is also disabled,
-** regardless of the value of the [SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE]
-** option.
-** This option takes two arguments which are an integer and a pointer
-** to an integer. The first argument is 1, 0, or -1 to enable, disable, or
-** leave unchanged the ability to ATTACH another database for writing,
-** respectively. If the second argument is not NULL, then 0 or 1 is written
-** into the integer to which the second argument points, depending on whether
-** the ability to ATTACH a read/write database is enabled or disabled
-** after processing the first argument.
-**
-**
-** [[SQLITE_DBCONFIG_ENABLE_COMMENTS]]
-** - SQLITE_DBCONFIG_ENABLE_COMMENTS
-** - The SQLITE_DBCONFIG_ENABLE_COMMENTS option enables or disables the
-** ability to include comments in SQL text. Comments are enabled by default.
-** An application can disable or reenable comments in SQL text using this
-** DBCONFIG option.
-** This option takes two arguments which are an integer and a pointer
-** to an integer. The first argument is 1, 0, or -1 to enable, disable, or
-** leave unchanged the ability to use comments in SQL text,
-** respectively. If the second argument is not NULL, then 0 or 1 is written
-** into the integer that the second argument points to depending on if
-** comments are allowed in SQL text after processing the first argument.
-**
-**
**
-**
-** [[DBCONFIG arguments]] Arguments To SQLITE_DBCONFIG Options
-**
-** Most of the SQLITE_DBCONFIG options take two arguments, so that the
-** overall call to [sqlite3_db_config()] has a total of four parameters.
-** The first argument (the third parameter to sqlite3_db_config()) is a integer.
-** The second argument is a pointer to an integer. If the first argument is 1,
-** then the option becomes enabled. If the first integer argument is 0, then the
-** option is disabled. If the first argument is -1, then the option setting
-** is unchanged. The second argument, the pointer to an integer, may be NULL.
-** If the second argument is not NULL, then a value of 0 or 1 is written into
-** the integer to which the second argument points, depending on whether the
-** setting is disabled or enabled after applying any changes specified by
-** the first argument.
-**
-**
While most SQLITE_DBCONFIG options use the argument format
-** described in the previous paragraph, the [SQLITE_DBCONFIG_MAINDBNAME]
-** and [SQLITE_DBCONFIG_LOOKASIDE] options are different. See the
-** documentation of those exceptional options for details.
*/
#define SQLITE_DBCONFIG_MAINDBNAME 1000 /* const char* */
#define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */
@@ -2636,10 +2530,7 @@ struct sqlite3_mem_methods {
#define SQLITE_DBCONFIG_TRUSTED_SCHEMA 1017 /* int int* */
#define SQLITE_DBCONFIG_STMT_SCANSTATUS 1018 /* int int* */
#define SQLITE_DBCONFIG_REVERSE_SCANORDER 1019 /* int int* */
-#define SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE 1020 /* int int* */
-#define SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE 1021 /* int int* */
-#define SQLITE_DBCONFIG_ENABLE_COMMENTS 1022 /* int int* */
-#define SQLITE_DBCONFIG_MAX 1022 /* Largest DBCONFIG */
+#define SQLITE_DBCONFIG_MAX 1019 /* Largest DBCONFIG */
/*
** CAPI3REF: Enable Or Disable Extended Result Codes
@@ -2731,14 +2622,10 @@ SQLITE_API void sqlite3_set_last_insert_rowid(sqlite3*,sqlite3_int64);
** deleted by the most recently completed INSERT, UPDATE or DELETE
** statement on the database connection specified by the only parameter.
** The two functions are identical except for the type of the return value
-** and that if the number of rows modified by the most recent INSERT, UPDATE,
+** and that if the number of rows modified by the most recent INSERT, UPDATE
** or DELETE is greater than the maximum value supported by type "int", then
** the return value of sqlite3_changes() is undefined. ^Executing any other
** type of SQL statement does not modify the value returned by these functions.
-** For the purposes of this interface, a CREATE TABLE AS SELECT statement
-** does not count as an INSERT, UPDATE or DELETE statement and hence the rows
-** added to the new table by the CREATE TABLE AS SELECT statement are not
-** counted.
**
** ^Only changes made directly by the INSERT, UPDATE or DELETE statement are
** considered - auxiliary changes caused by [CREATE TRIGGER | triggers],
@@ -4298,22 +4185,11 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
**
The SQLITE_PREPARE_NO_VTAB flag causes the SQL compiler
** to return an error (error code SQLITE_ERROR) if the statement uses
** any virtual tables.
-**
-** [[SQLITE_PREPARE_DONT_LOG]] SQLITE_PREPARE_DONT_LOG
-** The SQLITE_PREPARE_DONT_LOG flag prevents SQL compiler
-** errors from being sent to the error log defined by
-** [SQLITE_CONFIG_LOG]. This can be used, for example, to do test
-** compiles to see if some SQL syntax is well-formed, without generating
-** messages on the global error log when it is not. If the test compile
-** fails, the sqlite3_prepare_v3() call returns the same error indications
-** with or without this flag; it just omits the call to [sqlite3_log()] that
-** logs the error.
**
*/
#define SQLITE_PREPARE_PERSISTENT 0x01
#define SQLITE_PREPARE_NORMALIZE 0x02
#define SQLITE_PREPARE_NO_VTAB 0x04
-#define SQLITE_PREPARE_DONT_LOG 0x10
/*
** CAPI3REF: Compiling An SQL Statement
@@ -4346,17 +4222,13 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
** and sqlite3_prepare16_v3() use UTF-16.
**
** ^If the nByte argument is negative, then zSql is read up to the
-** first zero terminator. ^If nByte is positive, then it is the maximum
-** number of bytes read from zSql. When nByte is positive, zSql is read
-** up to the first zero terminator or until the nByte bytes have been read,
-** whichever comes first. ^If nByte is zero, then no prepared
+** first zero terminator. ^If nByte is positive, then it is the
+** number of bytes read from zSql. ^If nByte is zero, then no prepared
** statement is generated.
** If the caller knows that the supplied string is nul-terminated, then
** there is a small performance advantage to passing an nByte parameter that
** is the number of bytes in the input string including
** the nul-terminator.
-** Note that nByte measure the length of the input in bytes, not
-** characters, even for the UTF-16 interfaces.
**
** ^If pzTail is not NULL then *pzTail is made to point to the first byte
** past the end of the first SQL statement in zSql. These routines only
@@ -5727,7 +5599,7 @@ SQLITE_API int sqlite3_create_window_function(
** This flag instructs SQLite to omit some corner-case optimizations that
** might disrupt the operation of the [sqlite3_value_subtype()] function,
** causing it to return zero rather than the correct subtype().
-** All SQL functions that invoke [sqlite3_value_subtype()] should have this
+** SQL functions that invokes [sqlite3_value_subtype()] should have this
** property. If the SQLITE_SUBTYPE property is omitted, then the return
** value from [sqlite3_value_subtype()] might sometimes be zero even though
** a non-zero subtype was specified by the function argument expression.
@@ -8492,7 +8364,7 @@ SQLITE_API int sqlite3_test_control(int op, ...);
#define SQLITE_TESTCTRL_TRACEFLAGS 31
#define SQLITE_TESTCTRL_TUNE 32
#define SQLITE_TESTCTRL_LOGEST 33
-#define SQLITE_TESTCTRL_USELONGDOUBLE 34 /* NOT USED */
+#define SQLITE_TESTCTRL_USELONGDOUBLE 34
#define SQLITE_TESTCTRL_LAST 34 /* Largest TESTCTRL */
/*
@@ -9468,16 +9340,6 @@ typedef struct sqlite3_backup sqlite3_backup;
** APIs are not strictly speaking threadsafe. If they are invoked at the
** same time as another thread is invoking sqlite3_backup_step() it is
** possible that they return invalid values.
-**
-** Alternatives To Using The Backup API
-**
-** Other techniques for safely creating a consistent backup of an SQLite
-** database include:
-**
-**
-** - The [VACUUM INTO] command.
-**
- The [sqlite3_rsync] utility program.
-**
*/
SQLITE_API sqlite3_backup *sqlite3_backup_init(
sqlite3 *pDest, /* Destination database handle */
@@ -10677,14 +10539,6 @@ typedef struct sqlite3_snapshot {
** If there is not already a read-transaction open on schema S when
** this function is called, one is opened automatically.
**
-** If a read-transaction is opened by this function, then it is guaranteed
-** that the returned snapshot object may not be invalidated by a database
-** writer or checkpointer until after the read-transaction is closed. This
-** is not guaranteed if a read-transaction is already open when this
-** function is called. In that case, any subsequent write or checkpoint
-** operation on the database may invalidate the returned snapshot handle,
-** even while the read-transaction remains open.
-**
** The following must be true for this function to succeed. If any of
** the following statements are false when sqlite3_snapshot_get() is
** called, SQLITE_ERROR is returned. The final value of *P is undefined
@@ -10867,9 +10721,8 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_wal_info(
/*
** CAPI3REF: Serialize a database
**
-** The sqlite3_serialize(D,S,P,F) interface returns a pointer to
-** memory that is a serialization of the S database on
-** [database connection] D. If S is a NULL pointer, the main database is used.
+** The sqlite3_serialize(D,S,P,F) interface returns a pointer to memory
+** that is a serialization of the S database on [database connection] D.
** If P is not a NULL pointer, then the size of the database in bytes
** is written into *P.
**
@@ -11122,7 +10975,7 @@ SQLITE_API int sqlite3_commit_status(
#ifdef __cplusplus
} /* End of the 'extern "C"' block */
#endif
-/* #endif for SQLITE3_H will be added by mksqlite3.tcl */
+#endif /* SQLITE3_H */
/******** Begin file sqlite3rtree.h *********/
/*
@@ -13403,29 +13256,14 @@ struct Fts5PhraseIter {
** value returned by xInstCount(), SQLITE_RANGE is returned. Otherwise,
** output variable (*ppToken) is set to point to a buffer containing the
** matching document token, and (*pnToken) to the size of that buffer in
-** bytes.
+** bytes. This API is not available if the specified token matches a
+** prefix query term. In that case both output variables are always set
+** to 0.
**
** The output text is not a copy of the document text that was tokenized.
** It is the output of the tokenizer module. For tokendata=1 tables, this
** includes any embedded 0x00 and trailing data.
**
-** This API may be slow in some cases if the token identified by parameters
-** iIdx and iToken matched a prefix token in the query. In most cases, the
-** first call to this API for each prefix token in the query is forced
-** to scan the portion of the full-text index that matches the prefix
-** token to collect the extra data required by this API. If the prefix
-** token matches a large number of token instances in the document set,
-** this may be a performance problem.
-**
-** If the user knows in advance that a query may use this API for a
-** prefix token, FTS5 may be configured to collect all required data as part
-** of the initial querying of the full-text index, avoiding the second scan
-** entirely. This also causes prefix queries that do not use this API to
-** run more slowly and use more memory. FTS5 may be configured in this way
-** either on a per-table basis using the [FTS5 insttoken | 'insttoken']
-** option, or on a per-query basis using the
-** [fts5_insttoken | fts5_insttoken()] user function.
-**
** This API can be quite slow if used with an FTS5 table created with the
** "detail=none" or "detail=column" option.
**
@@ -13516,6 +13354,7 @@ struct Fts5ExtensionApi {
** Applications may also register custom tokenizer types. A tokenizer
** is registered by providing fts5 with a populated instance of the
** following structure. All structure methods must be defined, setting
+**
** any member of the fts5_tokenizer struct to NULL leads to undefined
** behaviour. The structure methods are expected to function as follows:
**
@@ -13859,4 +13698,3 @@ struct fts5_api {
#endif /* _FTS5_H */
/******** End of fts5.h *********/
-#endif /* SQLITE3_H */