Index: Doc/Extra/Core/images/syntax/expr.gif ================================================================== --- Doc/Extra/Core/images/syntax/expr.gif +++ Doc/Extra/Core/images/syntax/expr.gif cannot compute difference between binary files Index: Doc/Extra/Core/lang_expr.html ================================================================== --- Doc/Extra/Core/lang_expr.html +++ Doc/Extra/Core/lang_expr.html @@ -546,17 +546,14 @@ left and a vector operand on the right formed by an explicit list of zero or more scalars or by a single subquery. When the right operand of an IN or NOT IN operator is a subquery, the subquery must have a single result column. -The "subquery" on the right-hand side of an IN operator can be a -table name or table-valued function name in which case the -subquery is understood to be "(SELECT * FROM name)". When the right operand is an empty set, the result of IN is false and the result of NOT IN is true, regardless of the left operand and even if the left operand is NULL. -

The result of an IN or NOT IN operator is determined by the following +The result of an IN or NOT IN operator is determined by the following matrix:

Index: Doc/Extra/Provider/dbfactorysupport.html ================================================================== --- Doc/Extra/Provider/dbfactorysupport.html +++ Doc/Extra/Provider/dbfactorysupport.html @@ -83,11 +83,11 @@ <DbProviderFactories> <remove invariant="System.Data.SQLite"/> <add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite, - Version=1.0.103.0, Culture=neutral, + Version=1.0.102.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139"/> </DbProviderFactories> </system.data> </configuration> Index: Doc/Extra/Provider/environment.html ================================================================== --- Doc/Extra/Provider/environment.html +++ Doc/Extra/Provider/environment.html @@ -128,26 +128,10 @@ SQLiteFunction attribute will be skipped. Normally, this search is conducted only once per application domain by the static constructor of the SQLiteFunction class; however, these implementation details are subject to change. - - - - - - - - - Index: Doc/Extra/Provider/version.html ================================================================== --- Doc/Extra/Provider/version.html +++ Doc/Extra/Provider/version.html @@ -41,23 +41,10 @@
No_SQLiteGetSettingValueIf this environment variable is set [to anything], all calls to - the GetSettingValue method will return the default value. This will - effectively prevent all other setting values from having any effect, - including those specified via other supported environment variables - or in the associated XML configuration file.
No_SQLiteXmlConfigFileIf this environment variable is set [to anything], calls to the - GetSettingValue method will never result in the XML configuration - file being read; instead, the default value will be returned. This - will effectively prevent any setting values specified via the XML - configuration file from having any effect.
PreLoadSQLite_BaseDirectory If this environment variable is set [to anything], it will be used instead of the application base directory by the native library pre-loader. This environment variable can be especially @@ -155,11 +139,11 @@ of the location of the managed assemblies is not under the control of the application.
PreLoadSQLite_LibraryFileNameOnlyIf this environment variable is set [to anything], it will be + If this configuration variable is set [to anything], it will be used as the base file name (without directory information) for the native SQLite library to be pre-loaded (e.g. "sqlite3.dll" or "libsqlite3.so.0").

Version History

-

1.0.103.0 - August XX, 2016 (release scheduled)

-
    -
  • Updated to SQLite 3.14.
  • -
  • Add preliminary support for the .NET Framework 4.6.2.
  • -
  • Change the SQLiteReadValueCallback delegate "eventArgs" parameter to be of type SQLiteReadEventArgs. ** Potentially Incompatible Change **
  • -
  • Make SQLiteReadValueEventArgs and SQLiteReadArrayEventArgs derive from SQLiteReadEventArgs. ** Potentially Incompatible Change **
  • -
  • Rename SQLiteReadValueEventArgs.ArrayEventArgs property to ExtraEventArgs. ** Potentially Incompatible Change **
  • -
  • Add No_SQLiteGetSettingValue and No_SQLiteXmlConfigFile environment variables.
  • -
  • Reduce the number of calls to GetSettingValue from SQLiteConnection. Pursuant to [25d53b48f6]** Potentially Incompatible Change **
  • -
  • Add NoVerifyTypeAffinity connection flag to disable all type affinity checking.
  • -
  • Add support for incremental blob I/O.
  • -
  • Improve support for the sqlite3_db_config() interface. Pursuant to [f64f4aee95].
  • -

1.0.102.0 - June 23, 2016

- -

1.1. Usage

+

1.1 Usage

A virtual table is created using a CREATE VIRTUAL TABLE statement.

create-virtual-table-stmt:

@@ -246,11 +235,11 @@

Once a virtual table has been created, it can be used like any other table with the exceptions noted above and imposed by specific virtual table implementations. A virtual table is destroyed using the ordinary DROP TABLE syntax. -

1.1.1. Temporary virtual tables

+

1.1.1 Temporary virtual tables

There is no "CREATE TEMP VIRTUAL TABLE" statement. To create a temporary virtual table, add the "temp" schema before the virtual table name. @@ -258,11 +247,11 @@ CREATE VIRTUAL TABLE temp.tablename USING module(arg1, ...); -

1.1.2. Eponymous virtual tables

+

1.1.2 Eponymous virtual tables

Some virtual tables exist automatically in the "main" schema of every database connection in which their module is registered, even without a CREATE VIRTUAL TABLE statement. Such virtual tables are called "eponymous virtual tables". @@ -290,11 +279,11 @@ are the same, that indicates that the virtual table has no persistent state that needs to be created and destroyed. -

1.1.3. Eponymous-only virtual tables

+
1.1.2.1 Eponymous-only virtual tables

If the xCreate method is NULL, then CREATE VIRTUAL TABLE statements are prohibited for that virtual table, and the virtual table is an "eponymous-only virtual table". Eponymous-only virtual tables are useful as table-valued functions. @@ -304,11 +293,11 @@ for NULL before invoking it. So if an eponymous-only virtual table is registered with SQLite version 3.8.11.1 or earlier and a CREATE VIRTUAL TABLE command is attempted against that virtual table module, a jump to a NULL pointer will occur, resulting in a crash. -

1.2. Implementation

+

1.2 Implementation

Several new C-level objects are used by the virtual table implementation:

   typedef struct sqlite3_vtab sqlite3_vtab;
@@ -453,21 +442,21 @@
 
 

The rest of the module structure consists of methods used to implement various features of the virtual table. Details on what each of these methods do are provided in the sequel. -

1.3. Virtual Tables And Shared Cache

+

1.3 Virtual Tables And Shared Cache

Prior to SQLite version 3.6.17, the virtual table mechanism assumes that each database connection kept its own copy of the database schema. Hence, the virtual table mechanism could not be used in a database that has shared cache mode enabled. The sqlite3_create_module() interface would return an error if shared cache mode is enabled. That restriction was relaxed beginning with SQLite version 3.6.17. -

1.4. Creating New Virtual Table Implementations

+

1.4 Creating New Virtual Table Implementations

Follow these steps to create your own virtual table:

    @@ -488,32 +477,26 @@ for "sqlite3_create_module".

    You might also want to implement your new virtual table as a loadable extension. -

    2. Virtual Table Methods

    +

    2.0 Virtual Table Methods

    -

    2.1. The xCreate Method

    +

    2.1 The xCreate Method

       int (*xCreate)(sqlite3 *db, void *pAux,
                    int argc, char **argv,
                    sqlite3_vtab **ppVTab,
                    char **pzErr);
     
    -

    The xCreate method is called to create a new instance of a virtual table -in response to a CREATE VIRTUAL TABLE statement. -If the xCreate method is the same pointer as the xConnect method, then the -virtual table is an eponymous virtual table. -If the xCreate method is omitted (if it is a NULL pointer) then the virtual -table is an eponymous-only virtual table. - - -

    The db parameter is a pointer to the SQLite database connection that +

    This method is called to create a new instance of a virtual table +in response to a CREATE VIRTUAL TABLE statement. +The db parameter is a pointer to the SQLite database connection that is executing the CREATE VIRTUAL TABLE statement. The pAux argument is the copy of the client data pointer that was the fourth argument to the sqlite3_create_module() or sqlite3_create_module_v2() call that registered the virtual table module. @@ -584,11 +567,11 @@ store. Such a virtual table can be used as an eponymous virtual table or as a named virtual table using CREATE VIRTUAL TABLE or both. -

    2.1.1. Hidden columns in virtual tables

    +

    2.1.1 Hidden columns in virtual tables

    If a column datatype contains the special keyword "HIDDEN" (in any combination of upper and lower case letters) then that keyword it is omitted from the column datatype name and the column is marked as a hidden column internally. A hidden column differs from a normal column in three respects: @@ -617,11 +600,11 @@ contains an FTS hidden column that is used to pass information from the virtual table into FTS auxiliary functions and to the FTS MATCH operator. -

    2.1.2. Table-valued functions

    +

    2.1.2 Table-valued functions

    A virtual table that contains hidden columns can be used like a table-valued function in the FROM clause of a SELECT statement. The arguments to the table-valued function become constraints on the HIDDEN columns of the virtual table. @@ -660,39 +643,14 @@ in order. The number of arguments can be less than the number of hidden columns, in which case the latter hidden columns are unconstrained. However, an error results if there are more arguments than there are hidden columns in the virtual table. - - -

    2.1.3. WITHOUT ROWID Virtual Tables

    - -

    Beginning with SQLite version 3.14.0, the CREATE TABLE statement that -is passed into sqlite3_declare_vtab() may contain a WITHOUT ROWID clause. -This is useful for cases where the virtual table rows -cannot easily be mapped into unique integers. A CREATE TABLE -statement that includes WITHOUT ROWID must define one or more columns as -the PRIMARY KEY. Every column of the PRIMARY KEY must individually be -NOT NULL and all columns for each row must be collectively unique. - -

    Note that SQLite does not enforce the PRIMARY KEY for a WITHOUT ROWID -virtual table. Enforcement is the responsibility of the underlying -virtual table implementation. But SQLite does assume that the PRIMARY KEY -constraint is valid - that the identified columns really are UNIQUE and -NOT NULL - and it uses that assumption to optimize queries against the -virtual table. - -

    The rowid column is not accessible on a -WITHOUT ROWID virtual table (of course). Furthermore, since the -xUpdate method depends on having a valid rowid, the xUpdate method -must be NULL for a WITHOUT ROWID virtual table. That in turn means that -WITHOUT ROWID virtual tables must be read-only. - -

    2.2. The xConnect Method

    +

    2.2 The xConnect Method

       int (*xConnect)(sqlite3*, void *pAux,
                    int argc, char **argv,
                    sqlite3_vtab **ppVTab,
    @@ -744,11 +702,11 @@
     may point to the same function if the virtual table does not need to
     initialize backing store.
     
     
     
    -

    2.3. The xBestIndex Method

    +

    2.3 The xBestIndex Method

    SQLite uses the xBestIndex method of a virtual table module to determine the best way to access the virtual table. The xBestIndex method has a prototype like this: @@ -857,11 +815,11 @@ xFilter. However, there is no guarantee that xFilter will be called following a successful xBestIndex.

    The xBestIndex method is required for every virtual table implementation. -

    2.3.1. Inputs

    +

    2.3.1 Inputs

    The main thing that the SQLite core is trying to communicate to the virtual table is the constraints that are available to limit the number of rows that need to be searched. The aConstraint[] array contains one entry for each constraint. There will be exactly @@ -873,11 +831,11 @@

    column OP EXPR

    Where "column" is a column in the virtual table, OP is an operator -like "=" or "<", and EXPR is an arbitrary expression. So, for example, +like "=" or "<", and EXPR is an arbitrary expression. So, for example, if the WHERE clause contained a term like this:

          a = 5
     
    @@ -889,19 +847,19 @@ WHERE clause in order to extract as many constraints as it can. So, for example, if the WHERE clause contained something like this:
    -     x BETWEEN 10 AND 100 AND 999>y
    +     x BETWEEN 10 AND 100 AND 999>y
     

    The query optimizer might translate this into three separate constraints:

    -     x >= 10
    -     x <= 100
    -     y < 999
    +     x >= 10
    +     x <= 100
    +     y < 999
     

    For each constraint, the aConstraint[].iColumn field indicates which column appears on the left-hand side of the constraint. The first column of the virtual table is column 0. @@ -939,11 +897,11 @@ colUsed is set, that means that one or more columns other than the first 63 columns are used. If column usage information is needed by the xFilter method, then the required bits must be encoded into either the idxNum or idxStr output fields. -

    2.3.2. Outputs

    +

    2.3.2 Outputs

    Given all of the information above, the job of the xBestIndex method it to figure out the best way to search the virtual table.

    The xBestIndex method fills the idxNum and idxStr fields with @@ -1005,11 +963,11 @@ is redundant, the xBestFilter method can suppress that double-check by setting aConstraintUsage[].omit. -

    2.4. The xDisconnect Method

    +

    2.4 The xDisconnect Method

       int (*xDisconnect)(sqlite3_vtab *pVTab);
     
    @@ -1028,11 +986,11 @@ though it is acceptable for the xDisconnect and xDestroy methods to be the same function if that makes sense for the particular virtual table. -

    2.5. The xDestroy Method

    +

    2.5 The xDestroy Method

       int (*xDestroy)(sqlite3_vtab *pVTab);
     
    @@ -1048,11 +1006,11 @@ though it is acceptable for the xDisconnect and xDestroy methods to be the same function if that makes sense for the particular virtual table. -

    2.6. The xOpen Method

    +

    2.6 The xOpen Method

       int (*xOpen)(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor);
     
    @@ -1079,11 +1037,11 @@

    The xOpen method is required for every virtual table implementation. -

    2.7. The xClose Method

    +

    2.7 The xClose Method

       int (*xClose)(sqlite3_vtab_cursor*);
     
    @@ -1099,11 +1057,11 @@

    The xClose method is required for every virtual table implementation. -

    2.8. The xEof Method

    +

    2.8 The xEof Method

       int (*xEof)(sqlite3_vtab_cursor*);
     
    @@ -1114,11 +1072,11 @@

    The xEof method is required for every virtual table implementation. -

    2.9. The xFilter Method

    +

    2.9 The xFilter Method

       int (*xFilter)(sqlite3_vtab_cursor*, int idxNum, const char *idxStr,
                     int argc, sqlite3_value **argv);
     
    @@ -1149,11 +1107,11 @@

    The xFilter method is required for every virtual table implementation. -

    2.10. The xNext Method

    +

    2.10 The xNext Method

       int (*xNext)(sqlite3_vtab_cursor*);
     
    @@ -1170,11 +1128,11 @@

    The xNext method is required for every virtual table implementation. -

    2.11. The xColumn Method

    +

    2.11 The xColumn Method

       int (*xColumn)(sqlite3_vtab_cursor*, sqlite3_context*, int N);
     
    @@ -1208,11 +1166,11 @@

    The xColumn method is required for every virtual table implementation. -

    2.12. The xRowid Method

    +

    2.12 The xRowid Method

       int (*xRowid)(sqlite3_vtab_cursor *pCur, sqlite_int64 *pRowid);
     
    @@ -1224,11 +1182,11 @@

    The xRowid method is required for every virtual table implementation. -

    2.13. The xUpdate Method

    +

    2.13 The xUpdate Method

       int (*xUpdate)(
         sqlite3_vtab *pVTab,
         int argc,
    @@ -1322,11 +1280,11 @@
     is a NULL pointer, then the virtual table is read-only.
     
     
     
     
    -

    2.14. The xFindFunction Method

    +

    2.14 The xFindFunction Method

       int (*xFindFunction)(
         sqlite3_vtab *pVtab,
         int nArg,
    @@ -1358,11 +1316,11 @@
     

    The function pointer returned by this routine must be valid for the lifetime of the sqlite3_vtab object given in the first parameter. -

    2.15. The xBegin Method

    +

    2.15 The xBegin Method

       int (*xBegin)(sqlite3_vtab *pVTab);
     
    @@ -1378,11 +1336,11 @@ Multiple calls to other methods can and likely will occur in between the xBegin and the corresponding xCommit or xRollback. -

    2.16. The xSync Method

    +

    2.16 The xSync Method

       int (*xSync)(sqlite3_vtab *pVTab);
     
    @@ -1398,11 +1356,11 @@ invoking the xCommit method on any virtual table. If any of the xSync methods fail, the entire transaction is rolled back. -

    2.17. The xCommit Method

    +

    2.17 The xCommit Method

       int (*xCommit)(sqlite3_vtab *pVTab);
     
    @@ -1414,11 +1372,11 @@ xSync. -

    2.18. The xRollback Method

    +

    2.18 The xRollback Method

       int (*xRollback)(sqlite3_vtab *pVTab);
     
    @@ -1429,11 +1387,11 @@

    A call to this method always follows a prior call to xBegin. -

    2.19. The xRename Method

    +

    2.19 The xRename Method

       int (*xRename)(sqlite3_vtab *pVtab, const char *zNew);
     
    @@ -1444,11 +1402,11 @@

    The xRename method is required for every virtual table implementation. -

    2.20. The xSavepoint, xRelease, and xRollbackTo Methods

    +

    2.20 The xSavepoint, xRelease, and xRollbackTo Methods

       int (*xSavepoint)(sqlite3_vtab *pVtab, int);
       int (*xRelease)(sqlite3_vtab *pVtab, int);
       int (*xRollbackTo)(sqlite3_vtab *pVtab, int);
    
    Index: Doc/vtab.tcl
    ==================================================================
    --- Doc/vtab.tcl
    +++ Doc/vtab.tcl
    @@ -26,15 +26,10 @@
     proc escapeSubSpec { data } {
       regsub -all -- {&} $data {\\\&} data
       regsub -all -- {\\(\d+)} $data {\\\\\1} data
       return $data
     }
    -
    -proc removeSectionId { value } {
    -  regsub -- { id="section(?:_\d+)+"} $value "" value
    -  return $value
    -}
     
     proc englishToList { value } {
       set result [list]
     
       foreach element [split $value "\t\n ,"] {
    @@ -89,11 +84,11 @@
     
       array set levels {p 0}
       set length [llength $lines]
     
       while {$index < $length} {
    -    set line [removeSectionId [lindex $lines $index]]
    +    set line [lindex $lines $index]
     
         if {[regexp -- $pattern $line]} then {
           break; # stop on this line for outer loop.
         } else {
           set trimLine [string trim $line]; set data ""
    @@ -194,17 +189,16 @@
         {*** DRAFT ***} ""] $inputData]
     
     set inputData [string map [list {

    } ""] $inputData] set lines [split [string map [list \r\n \n] $inputData] \n] - -set patterns(method) {^

    2\.\d+\. The (.*) Method(?:s)?

    $} +set patterns(method) {^

    2\.\d+ The (.*) Method(?:s)?

    $} set prefix " /// " unset -nocomplain methods; set start false for {set index 0} {$index < [llength $lines]} {} { - set line [removeSectionId [lindex $lines $index]] + set line [lindex $lines $index] if {$start} then { if {[regexp -- $patterns(method) $line dummy capture]} then { foreach method [englishToList $capture] { set methodIndex [expr {$index + 1}] @@ -215,11 +209,11 @@ set index $methodIndex } else { incr index } - } elseif {[regexp -- {^

    2\. Virtual Table Methods

    $} $line]} then { + } elseif {[regexp -- {^

    2\.0 Virtual Table Methods

    $} $line]} then { set start true; incr index } else { incr index } } ADDED Externals/MSVCPP/vcredist_x64_2015_VSU2.exe Index: Externals/MSVCPP/vcredist_x64_2015_VSU2.exe ================================================================== --- /dev/null +++ Externals/MSVCPP/vcredist_x64_2015_VSU2.exe cannot compute difference between binary files DELETED Externals/MSVCPP/vcredist_x64_2015_VSU3.exe Index: Externals/MSVCPP/vcredist_x64_2015_VSU3.exe ================================================================== --- Externals/MSVCPP/vcredist_x64_2015_VSU3.exe +++ /dev/null cannot compute difference between binary files ADDED Externals/MSVCPP/vcredist_x86_2015_VSU2.exe Index: Externals/MSVCPP/vcredist_x86_2015_VSU2.exe ================================================================== --- /dev/null +++ Externals/MSVCPP/vcredist_x86_2015_VSU2.exe cannot compute difference between binary files DELETED Externals/MSVCPP/vcredist_x86_2015_VSU3.exe Index: Externals/MSVCPP/vcredist_x86_2015_VSU3.exe ================================================================== --- Externals/MSVCPP/vcredist_x86_2015_VSU3.exe +++ /dev/null cannot compute difference between binary files Index: NuGet/SQLite.Beta.nuspec ================================================================== --- NuGet/SQLite.Beta.nuspec +++ NuGet/SQLite.Beta.nuspec @@ -9,11 +9,11 @@ --> System.Data.SQLite.Beta System.Data.SQLite (x86/x64) Beta - 1.0.103.0 + 1.0.102.0 SQLite Development Team This is a "beta" package and is not intended for production use. The official SQLite database engine for both x86 and x64 along with the ADO.NET provider. This package includes support for LINQ and Entity Framework 6. en-US https://system.data.sqlite.org/ https://system.data.sqlite.org/images/sqlite128.png @@ -20,50 +20,50 @@ https://www.sqlite.org/copyright.html sqlite database ado.net provider interop Public Domain - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + Index: NuGet/SQLite.Core.Beta.nuspec ================================================================== --- NuGet/SQLite.Core.Beta.nuspec +++ NuGet/SQLite.Core.Beta.nuspec @@ -9,11 +9,11 @@ --> System.Data.SQLite.Core.Beta System.Data.SQLite Core (x86/x64) Beta - 1.0.103.0 + 1.0.102.0 SQLite Development Team This is a "beta" package and is not intended for production use. The official SQLite database engine for both x86 and x64 along with the ADO.NET provider. en-US https://system.data.sqlite.org/ https://system.data.sqlite.org/images/sqlite128.png Index: NuGet/SQLite.Core.MSIL.Beta.nuspec ================================================================== --- NuGet/SQLite.Core.MSIL.Beta.nuspec +++ NuGet/SQLite.Core.MSIL.Beta.nuspec @@ -9,11 +9,11 @@ --> System.Data.SQLite.Core.MSIL.Beta System.Data.SQLite (MSIL) Beta - 1.0.103.0 + 1.0.102.0 SQLite Development Team This is a "beta" package and is not intended for production use. An ADO.NET provider for SQLite (managed-only). en-US https://system.data.sqlite.org/ https://system.data.sqlite.org/images/sqlite128.png Index: NuGet/SQLite.Core.MSIL.Test.nuspec ================================================================== --- NuGet/SQLite.Core.MSIL.Test.nuspec +++ NuGet/SQLite.Core.MSIL.Test.nuspec @@ -9,11 +9,11 @@ --> System.Data.SQLite.Core.MSIL.Test System.Data.SQLite (MSIL) Test - 1.0.103.0 + 1.0.102.0 SQLite Development Team This is a pre-release package and is not intended for production use. An ADO.NET provider for SQLite (managed-only). en-US https://system.data.sqlite.org/ https://system.data.sqlite.org/images/sqlite128.png Index: NuGet/SQLite.Core.MSIL.nuspec ================================================================== --- NuGet/SQLite.Core.MSIL.nuspec +++ NuGet/SQLite.Core.MSIL.nuspec @@ -9,11 +9,11 @@ --> System.Data.SQLite.Core.MSIL System.Data.SQLite Core (MSIL) - 1.0.103.0 + 1.0.102.0 SQLite Development Team An ADO.NET provider for SQLite (managed-only). en-US https://system.data.sqlite.org/ https://system.data.sqlite.org/images/sqlite128.png Index: NuGet/SQLite.Core.Test.nuspec ================================================================== --- NuGet/SQLite.Core.Test.nuspec +++ NuGet/SQLite.Core.Test.nuspec @@ -9,11 +9,11 @@ --> System.Data.SQLite.Core.Test System.Data.SQLite Core (x86/x64) Test - 1.0.103.0 + 1.0.102.0 SQLite Development Team This is a pre-release package and is not intended for production use. The official SQLite database engine for both x86 and x64 along with the ADO.NET provider. en-US https://system.data.sqlite.org/ https://system.data.sqlite.org/images/sqlite128.png Index: NuGet/SQLite.Core.nuspec ================================================================== --- NuGet/SQLite.Core.nuspec +++ NuGet/SQLite.Core.nuspec @@ -9,11 +9,11 @@ --> System.Data.SQLite.Core System.Data.SQLite Core (x86/x64) - 1.0.103.0 + 1.0.102.0 SQLite Development Team The official SQLite database engine for both x86 and x64 along with the ADO.NET provider. en-US https://system.data.sqlite.org/ https://system.data.sqlite.org/images/sqlite128.png Index: NuGet/SQLite.EF6.Beta.nuspec ================================================================== --- NuGet/SQLite.EF6.Beta.nuspec +++ NuGet/SQLite.EF6.Beta.nuspec @@ -9,11 +9,11 @@ --> System.Data.SQLite.EF6.Beta System.Data.SQLite EF6 Beta - 1.0.103.0 + 1.0.102.0 SQLite Development Team This is a "beta" package and is not intended for production use. Support for Entity Framework 6 using System.Data.SQLite. en-US https://system.data.sqlite.org/ https://system.data.sqlite.org/images/sqlite128.png Index: NuGet/SQLite.EF6.Test.nuspec ================================================================== --- NuGet/SQLite.EF6.Test.nuspec +++ NuGet/SQLite.EF6.Test.nuspec @@ -9,11 +9,11 @@ --> System.Data.SQLite.EF6.Test System.Data.SQLite EF6 Test - 1.0.103.0 + 1.0.102.0 SQLite Development Team This is a pre-release package and is not intended for production use. Support for Entity Framework 6 using System.Data.SQLite. en-US https://system.data.sqlite.org/ https://system.data.sqlite.org/images/sqlite128.png Index: NuGet/SQLite.EF6.nuspec ================================================================== --- NuGet/SQLite.EF6.nuspec +++ NuGet/SQLite.EF6.nuspec @@ -9,11 +9,11 @@ --> System.Data.SQLite.EF6 System.Data.SQLite EF6 - 1.0.103.0 + 1.0.102.0 SQLite Development Team Support for Entity Framework 6 using System.Data.SQLite. en-US https://system.data.sqlite.org/ https://system.data.sqlite.org/images/sqlite128.png Index: NuGet/SQLite.Linq.Beta.nuspec ================================================================== --- NuGet/SQLite.Linq.Beta.nuspec +++ NuGet/SQLite.Linq.Beta.nuspec @@ -9,11 +9,11 @@ --> System.Data.SQLite.Linq.Beta System.Data.SQLite LINQ Beta - 1.0.103.0 + 1.0.102.0 SQLite Development Team This is a "beta" package and is not intended for production use. Support for LINQ using System.Data.SQLite. en-US https://system.data.sqlite.org/ https://system.data.sqlite.org/images/sqlite128.png Index: NuGet/SQLite.Linq.Test.nuspec ================================================================== --- NuGet/SQLite.Linq.Test.nuspec +++ NuGet/SQLite.Linq.Test.nuspec @@ -9,11 +9,11 @@ --> System.Data.SQLite.Linq.Test System.Data.SQLite LINQ Test - 1.0.103.0 + 1.0.102.0 SQLite Development Team This is a pre-release package and is not intended for production use. Support for LINQ using System.Data.SQLite. en-US https://system.data.sqlite.org/ https://system.data.sqlite.org/images/sqlite128.png Index: NuGet/SQLite.Linq.nuspec ================================================================== --- NuGet/SQLite.Linq.nuspec +++ NuGet/SQLite.Linq.nuspec @@ -9,11 +9,11 @@ --> System.Data.SQLite.Linq System.Data.SQLite LINQ - 1.0.103.0 + 1.0.102.0 SQLite Development Team Support for LINQ using System.Data.SQLite. en-US https://system.data.sqlite.org/ https://system.data.sqlite.org/images/sqlite128.png Index: NuGet/SQLite.MSIL.Beta.nuspec ================================================================== --- NuGet/SQLite.MSIL.Beta.nuspec +++ NuGet/SQLite.MSIL.Beta.nuspec @@ -9,11 +9,11 @@ --> System.Data.SQLite.MSIL.Beta System.Data.SQLite (MSIL) Beta - 1.0.103.0 + 1.0.102.0 SQLite Development Team This is a "beta" package and is not intended for production use. This is a legacy package; if possible, please use either the "System.Data.SQLite.Beta" or "System.Data.SQLite.Core.Beta" package instead. An ADO.NET provider for SQLite (managed-only). en-US https://system.data.sqlite.org/ https://system.data.sqlite.org/images/sqlite128.png @@ -20,50 +20,50 @@ https://www.sqlite.org/copyright.html sqlite database ado.net provider interop Public Domain - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + Index: NuGet/SQLite.MSIL.Test.nuspec ================================================================== --- NuGet/SQLite.MSIL.Test.nuspec +++ NuGet/SQLite.MSIL.Test.nuspec @@ -9,11 +9,11 @@ --> System.Data.SQLite.MSIL.Test System.Data.SQLite (MSIL) Test - 1.0.103.0 + 1.0.102.0 SQLite Development Team This is a pre-release package and is not intended for production use. This is a legacy package; if possible, please use either the "System.Data.SQLite.Test" or "System.Data.SQLite.Core.Test" package instead. An ADO.NET provider for SQLite (managed-only). en-US https://system.data.sqlite.org/ https://system.data.sqlite.org/images/sqlite128.png @@ -20,50 +20,50 @@ https://www.sqlite.org/copyright.html sqlite database ado.net provider interop Public Domain - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + Index: NuGet/SQLite.MSIL.nuspec ================================================================== --- NuGet/SQLite.MSIL.nuspec +++ NuGet/SQLite.MSIL.nuspec @@ -9,11 +9,11 @@ --> System.Data.SQLite.MSIL System.Data.SQLite (MSIL) - 1.0.103.0 + 1.0.102.0 SQLite Development Team This is a legacy package; if possible, please use either the "System.Data.SQLite" or "System.Data.SQLite.Core" package instead. An ADO.NET provider for SQLite (managed-only). en-US https://system.data.sqlite.org/ https://system.data.sqlite.org/images/sqlite128.png @@ -20,50 +20,50 @@ https://www.sqlite.org/copyright.html sqlite database ado.net provider interop Public Domain - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + Index: NuGet/SQLite.Test.nuspec ================================================================== --- NuGet/SQLite.Test.nuspec +++ NuGet/SQLite.Test.nuspec @@ -9,11 +9,11 @@ --> System.Data.SQLite.Test System.Data.SQLite (x86/x64) Test - 1.0.103.0 + 1.0.102.0 SQLite Development Team This is a pre-release package and is not intended for production use. The official SQLite database engine for both x86 and x64 along with the ADO.NET provider. This package includes support for LINQ and Entity Framework 6. en-US https://system.data.sqlite.org/ https://system.data.sqlite.org/images/sqlite128.png @@ -20,50 +20,50 @@ https://www.sqlite.org/copyright.html sqlite database ado.net provider interop Public Domain - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + Index: NuGet/SQLite.nuspec ================================================================== --- NuGet/SQLite.nuspec +++ NuGet/SQLite.nuspec @@ -9,11 +9,11 @@ --> System.Data.SQLite System.Data.SQLite (x86/x64) - 1.0.103.0 + 1.0.102.0 SQLite Development Team The official SQLite database engine for both x86 and x64 along with the ADO.NET provider. This package includes support for LINQ and Entity Framework 6. en-US https://system.data.sqlite.org/ https://system.data.sqlite.org/images/sqlite128.png @@ -20,50 +20,50 @@ https://www.sqlite.org/copyright.html sqlite database ado.net provider interop Public Domain - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + Index: NuGet/SQLite.x64.nuspec ================================================================== --- NuGet/SQLite.x64.nuspec +++ NuGet/SQLite.x64.nuspec @@ -8,11 +8,11 @@ * --> System.Data.SQLite.x64 - 1.0.103.0 + 1.0.102.0 SQLite Development Team This is a legacy package; if possible, please use either the "System.Data.SQLite" or "System.Data.SQLite.Core" package instead. The official SQLite database engine combined with a complete ADO.NET provider all rolled into a single mixed-mode assembly for x64. en-US https://system.data.sqlite.org/ https://system.data.sqlite.org/images/sqlite128.png @@ -19,35 +19,35 @@ https://www.sqlite.org/copyright.html sqlite database ado.net provider interop Public Domain - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + Index: NuGet/SQLite.x86.nuspec ================================================================== --- NuGet/SQLite.x86.nuspec +++ NuGet/SQLite.x86.nuspec @@ -8,11 +8,11 @@ * --> System.Data.SQLite.x86 - 1.0.103.0 + 1.0.102.0 SQLite Development Team This is a legacy package; if possible, please use either the "System.Data.SQLite" or "System.Data.SQLite.Core" package instead. The official SQLite database engine combined with a complete ADO.NET provider all rolled into a single mixed-mode assembly for x86. en-US https://system.data.sqlite.org/ https://system.data.sqlite.org/images/sqlite128.png @@ -19,35 +19,35 @@ https://www.sqlite.org/copyright.html sqlite database ado.net provider interop Public Domain - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + Index: SQLite.Designer/AssemblyInfo.cs ================================================================== --- SQLite.Designer/AssemblyInfo.cs +++ SQLite.Designer/AssemblyInfo.cs @@ -41,7 +41,7 @@ // Build Number // Revision // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.103.0")] -[assembly: AssemblyFileVersion("1.0.103.0")] +[assembly: AssemblyVersion("1.0.102.0")] +[assembly: AssemblyFileVersion("1.0.102.0")] Index: SQLite.Designer/source.extension.vsixmanifest ================================================================== --- SQLite.Designer/source.extension.vsixmanifest +++ SQLite.Designer/source.extension.vsixmanifest @@ -1,11 +1,11 @@ System.Data.SQLite Designer https://system.data.sqlite.org/ - 1.0.103.0 + 1.0.102.0 ADO.NET Data Designer for SQLite 1033 false Index: SQLite.Interop/props/SQLite.Interop.2005.vsprops ================================================================== --- SQLite.Interop/props/SQLite.Interop.2005.vsprops +++ SQLite.Interop/props/SQLite.Interop.2005.vsprops @@ -17,26 +17,26 @@ Value="2005" PerformEnvironmentSet="true" /> 2010 - 103 + 102 1.0 - 1.0.103.0 - 1,0,103,0 + 1.0.102.0 + 1,0,102,0 src\core INTEROP_DEBUG=0x31F;INTEROP_LOG=1;INTEROP_TEST_EXTENSION=1 INTEROP_PLACEHOLDER=1;INTEROP_EXTENSION_FUNCTIONS=1;INTEROP_CODEC=1;INTEROP_VIRTUAL_TABLE=1;INTEROP_FTS5_EXTENSION=1;INTEROP_PERCENTILE_EXTENSION=1;INTEROP_TOTYPE_EXTENSION=1;INTEROP_REGEXP_EXTENSION=1;INTEROP_JSON1_EXTENSION=1 Index: SQLite.Interop/props/SQLite.Interop.2012.props ================================================================== --- SQLite.Interop/props/SQLite.Interop.2012.props +++ SQLite.Interop/props/SQLite.Interop.2012.props @@ -8,14 +8,14 @@ * --> 2012 - 103 + 102 1.0 - 1.0.103.0 - 1,0,103,0 + 1.0.102.0 + 1,0,102,0 src\core INTEROP_DEBUG=0x31F;INTEROP_LOG=1;INTEROP_TEST_EXTENSION=1 INTEROP_PLACEHOLDER=1;INTEROP_EXTENSION_FUNCTIONS=1;INTEROP_CODEC=1;INTEROP_VIRTUAL_TABLE=1;INTEROP_FTS5_EXTENSION=1;INTEROP_PERCENTILE_EXTENSION=1;INTEROP_TOTYPE_EXTENSION=1;INTEROP_REGEXP_EXTENSION=1;INTEROP_JSON1_EXTENSION=1 Index: SQLite.Interop/props/SQLite.Interop.2013.props ================================================================== --- SQLite.Interop/props/SQLite.Interop.2013.props +++ SQLite.Interop/props/SQLite.Interop.2013.props @@ -8,14 +8,14 @@ * --> 2013 - 103 + 102 1.0 - 1.0.103.0 - 1,0,103,0 + 1.0.102.0 + 1,0,102,0 src\core INTEROP_DEBUG=0x31F;INTEROP_LOG=1;INTEROP_TEST_EXTENSION=1 INTEROP_PLACEHOLDER=1;INTEROP_EXTENSION_FUNCTIONS=1;INTEROP_CODEC=1;INTEROP_VIRTUAL_TABLE=1;INTEROP_FTS5_EXTENSION=1;INTEROP_PERCENTILE_EXTENSION=1;INTEROP_TOTYPE_EXTENSION=1;INTEROP_REGEXP_EXTENSION=1;INTEROP_JSON1_EXTENSION=1 Index: SQLite.Interop/props/SQLite.Interop.2015.props ================================================================== --- SQLite.Interop/props/SQLite.Interop.2015.props +++ SQLite.Interop/props/SQLite.Interop.2015.props @@ -8,14 +8,14 @@ * --> 2015 - 103 + 102 1.0 - 1.0.103.0 - 1,0,103,0 + 1.0.102.0 + 1,0,102,0 src\core INTEROP_DEBUG=0x31F;INTEROP_LOG=1;INTEROP_TEST_EXTENSION=1 INTEROP_PLACEHOLDER=1;INTEROP_EXTENSION_FUNCTIONS=1;INTEROP_CODEC=1;INTEROP_VIRTUAL_TABLE=1;INTEROP_FTS5_EXTENSION=1;INTEROP_PERCENTILE_EXTENSION=1;INTEROP_TOTYPE_EXTENSION=1;INTEROP_REGEXP_EXTENSION=1;INTEROP_JSON1_EXTENSION=1 Index: SQLite.Interop/props/sqlite3.props ================================================================== --- SQLite.Interop/props/sqlite3.props +++ SQLite.Interop/props/sqlite3.props @@ -7,12 +7,12 @@ * Released to the public domain, use at your own risk! * --> - 3.14.0.0 - 3,14,0,0 + 3.13.0.0 + 3,13,0,0 _CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;SQLITE_THREADSAFE=1;SQLITE_USE_URI=1;SQLITE_ENABLE_COLUMN_METADATA=1;SQLITE_ENABLE_STAT4=1;SQLITE_ENABLE_FTS3=1;SQLITE_ENABLE_LOAD_EXTENSION=1;SQLITE_ENABLE_RTREE=1;SQLITE_SOUNDEX=1;SQLITE_ENABLE_MEMORY_MANAGEMENT=1;SQLITE_ENABLE_API_ARMOR=1;SQLITE_ENABLE_DBSTAT_VTAB=1 SQLITE_PLACEHOLDER=1;SQLITE_HAS_CODEC=1 SQLITE_OMIT_WAL=1 HAVE_ERRNO_H=1;SQLITE_MSVC_LOCALTIME_API=1 SQLITE_DEBUG=1;SQLITE_MEMDEBUG=1;SQLITE_ENABLE_EXPENSIVE_ASSERT=1 Index: SQLite.Interop/props/sqlite3.vsprops ================================================================== --- SQLite.Interop/props/sqlite3.vsprops +++ SQLite.Interop/props/sqlite3.vsprops @@ -12,16 +12,16 @@ Version="8.00" Name="sqlite3" > =1400 @@ -103,12 +95,12 @@ ** ****************************************************************************** ** ** This file contains code that is specific to MSVC. */ -#ifndef SQLITE_MSVC_H -#define SQLITE_MSVC_H +#ifndef _MSVC_H_ +#define _MSVC_H_ #if defined(_MSC_VER) #pragma warning(disable : 4054) #pragma warning(disable : 4055) #pragma warning(disable : 4100) @@ -124,11 +116,11 @@ #pragma warning(disable : 4306) #pragma warning(disable : 4702) #pragma warning(disable : 4706) #endif /* defined(_MSC_VER) */ -#endif /* SQLITE_MSVC_H */ +#endif /* _MSVC_H_ */ /************** End of msvc.h ************************************************/ /************** Continuing where we left off in sqliteInt.h ******************/ /* @@ -288,12 +280,12 @@ ** The name of this file under configuration management is "sqlite.h.in". ** The makefile makes some minor changes to this file (such as inserting ** the version number) and changes its name to "sqlite3.h" as ** part of the build process. */ -#ifndef SQLITE3_H -#define SQLITE3_H +#ifndef _SQLITE3_H_ +#define _SQLITE3_H_ #include /* Needed for the definition of va_list */ /* ** Make sure we can call this stuff from C++. */ @@ -312,21 +304,12 @@ # define SQLITE_API #endif #ifndef SQLITE_CDECL # define SQLITE_CDECL #endif -#ifndef SQLITE_APICALL -# define SQLITE_APICALL -#endif #ifndef SQLITE_STDCALL -# define SQLITE_STDCALL SQLITE_APICALL -#endif -#ifndef SQLITE_CALLBACK -# define SQLITE_CALLBACK -#endif -#ifndef SQLITE_SYSAPI -# define SQLITE_SYSAPI +# define SQLITE_STDCALL #endif /* ** These no-op macros are used in front of interfaces to mark those ** interfaces as either deprecated or experimental. New applications @@ -378,13 +361,13 @@ ** ** See also: [sqlite3_libversion()], ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ -#define SQLITE_VERSION "3.14.0" -#define SQLITE_VERSION_NUMBER 3014000 -#define SQLITE_SOURCE_ID "2016-08-08 13:40:27 d5e98057028abcf7217d0d2b2e29bbbcdf09d6de" +#define SQLITE_VERSION "3.13.0" +#define SQLITE_VERSION_NUMBER 3013000 +#define SQLITE_SOURCE_ID "2016-05-18 10:57:30 fc49f556e48970561d7ab6a2f24fdd7d9eb81ff2" /* ** CAPI3REF: Run-Time Library Version Numbers ** KEYWORDS: sqlite3_version, sqlite3_sourceid ** @@ -773,11 +756,10 @@ #define SQLITE_CONSTRAINT_ROWID (SQLITE_CONSTRAINT |(10<<8)) #define SQLITE_NOTICE_RECOVER_WAL (SQLITE_NOTICE | (1<<8)) #define SQLITE_NOTICE_RECOVER_ROLLBACK (SQLITE_NOTICE | (2<<8)) #define SQLITE_WARNING_AUTOINDEX (SQLITE_WARNING | (1<<8)) #define SQLITE_AUTH_USER (SQLITE_AUTH | (1<<8)) -#define SQLITE_OK_LOAD_PERMANENTLY (SQLITE_OK | (1<<8)) /* ** CAPI3REF: Flags For File Open Operations ** ** These bit values are intended for use in the @@ -1303,20 +1285,10 @@ ** ** Mutexes are created using [sqlite3_mutex_alloc()]. */ typedef struct sqlite3_mutex sqlite3_mutex; -/* -** CAPI3REF: Loadable Extension Thunk -** -** A pointer to the opaque sqlite3_api_routines structure is passed as -** the third parameter to entry points of [loadable extensions]. This -** structure must be typedefed in order to work around compiler warnings -** on some platforms. -*/ -typedef struct sqlite3_api_routines sqlite3_api_routines; - /* ** CAPI3REF: OS Interface Object ** ** An instance of the sqlite3_vfs object defines the interface between ** the SQLite core and the underlying operating system. The "vfs" @@ -2217,11 +2189,11 @@ ** 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 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 +** enabled and the SQL function remains disabled. If the first argment to ** this interface is 0, then both the C-API and the SQL function are disabled. ** If the first argument is -1, then no changes are made to state of either the ** C-API or the SQL function. ** The second parameter is a pointer to an integer into which ** is written 0 or 1 to indicate whether [sqlite3_load_extension()] interface @@ -2510,11 +2482,11 @@ ** result in undefined behavior. ** ** A busy handler must not close the database connection ** or [prepared statement] that invoked the busy handler. */ -SQLITE_API int SQLITE_STDCALL sqlite3_busy_handler(sqlite3*,int(*)(void*,int),void*); +SQLITE_API int SQLITE_STDCALL sqlite3_busy_handler(sqlite3*, int(*)(void*,int), void*); /* ** CAPI3REF: Set A Busy Timeout ** METHOD: sqlite3 ** @@ -3032,13 +3004,10 @@ /* ** CAPI3REF: Tracing And Profiling Functions ** METHOD: sqlite3 ** -** These routines are deprecated. Use the [sqlite3_trace_v2()] interface -** instead of the routines described here. -** ** These routines register callback functions that can be used for ** tracing and profiling the execution of SQL statements. ** ** ^The callback function registered by sqlite3_trace() is invoked at ** various times when an SQL statement is being run by [sqlite3_step()]. @@ -3060,108 +3029,14 @@ ** digits in the time are meaningless. Future versions of SQLite ** might provide greater resolution on the profiler callback. The ** sqlite3_profile() function is considered experimental and is ** subject to change in future versions of SQLite. */ -SQLITE_API SQLITE_DEPRECATED void *SQLITE_STDCALL sqlite3_trace(sqlite3*, - void(*xTrace)(void*,const char*), void*); -SQLITE_API SQLITE_DEPRECATED void *SQLITE_STDCALL sqlite3_profile(sqlite3*, +SQLITE_API void *SQLITE_STDCALL sqlite3_trace(sqlite3*, void(*xTrace)(void*,const char*), void*); +SQLITE_API SQLITE_EXPERIMENTAL void *SQLITE_STDCALL sqlite3_profile(sqlite3*, void(*xProfile)(void*,const char*,sqlite3_uint64), void*); -/* -** CAPI3REF: SQL Trace Event Codes -** KEYWORDS: SQLITE_TRACE -** -** These constants identify classes of events that can be monitored -** using the [sqlite3_trace_v2()] tracing logic. The third argument -** to [sqlite3_trace_v2()] is an OR-ed combination of one or more of -** the following constants. ^The first argument to the trace callback -** is one of the following constants. -** -** New tracing constants may be added in future releases. -** -** ^A trace callback has four arguments: xCallback(T,C,P,X). -** ^The T argument is one of the integer type codes above. -** ^The C argument is a copy of the context pointer passed in as the -** fourth argument to [sqlite3_trace_v2()]. -** The P and X arguments are pointers whose meanings depend on T. -** -**
    -** [[SQLITE_TRACE_STMT]]
    SQLITE_TRACE_STMT
    -**
    ^An SQLITE_TRACE_STMT callback is invoked when a prepared statement -** first begins running and possibly at other times during the -** execution of the prepared statement, such as at the start of each -** trigger subprogram. ^The P argument is a pointer to the -** [prepared statement]. ^The X argument is a pointer to a string which -** is the unexpanded SQL text of the prepared statement or an SQL comment -** that indicates the invocation of a trigger. ^The callback can compute -** the same text that would have been returned by the legacy [sqlite3_trace()] -** interface by using the X argument when X begins with "--" and invoking -** [sqlite3_expanded_sql(P)] otherwise. -** -** [[SQLITE_TRACE_PROFILE]]
    SQLITE_TRACE_PROFILE
    -**
    ^An SQLITE_TRACE_PROFILE callback provides approximately the same -** information as is provided by the [sqlite3_profile()] callback. -** ^The P argument is a pointer to the [prepared statement] and the -** X argument points to a 64-bit integer which is the estimated of -** the number of nanosecond that the prepared statement took to run. -** ^The SQLITE_TRACE_PROFILE callback is invoked when the statement finishes. -** -** [[SQLITE_TRACE_ROW]]
    SQLITE_TRACE_ROW
    -**
    ^An SQLITE_TRACE_ROW callback is invoked whenever a prepared -** statement generates a single row of result. -** ^The P argument is a pointer to the [prepared statement] and the -** X argument is unused. -** -** [[SQLITE_TRACE_CLOSE]]
    SQLITE_TRACE_CLOSE
    -**
    ^An SQLITE_TRACE_CLOSE callback is invoked when a database -** connection closes. -** ^The P argument is a pointer to the [database connection] object -** and the X argument is unused. -**
    -*/ -#define SQLITE_TRACE_STMT 0x01 -#define SQLITE_TRACE_PROFILE 0x02 -#define SQLITE_TRACE_ROW 0x04 -#define SQLITE_TRACE_CLOSE 0x08 - -/* -** CAPI3REF: SQL Trace Hook -** METHOD: sqlite3 -** -** ^The sqlite3_trace_v2(D,M,X,P) interface registers a trace callback -** function X against [database connection] D, using property mask M -** and context pointer P. ^If the X callback is -** NULL or if the M mask is zero, then tracing is disabled. The -** M argument should be the bitwise OR-ed combination of -** zero or more [SQLITE_TRACE] constants. -** -** ^Each call to either sqlite3_trace() or sqlite3_trace_v2() overrides -** (cancels) any prior calls to sqlite3_trace() or sqlite3_trace_v2(). -** -** ^The X callback is invoked whenever any of the events identified by -** mask M occur. ^The integer return value from the callback is currently -** ignored, though this may change in future releases. Callback -** implementations should return zero to ensure future compatibility. -** -** ^A trace callback is invoked with four arguments: callback(T,C,P,X). -** ^The T argument is one of the [SQLITE_TRACE] -** constants to indicate why the callback was invoked. -** ^The C argument is a copy of the context pointer. -** The P and X arguments are pointers whose meanings depend on T. -** -** The sqlite3_trace_v2() interface is intended to replace the legacy -** interfaces [sqlite3_trace()] and [sqlite3_profile()], both of which -** are deprecated. -*/ -SQLITE_API int SQLITE_STDCALL sqlite3_trace_v2( - sqlite3*, - unsigned uMask, - int(*xCallback)(unsigned,void*,void*,void*), - void *pCtx -); - /* ** CAPI3REF: Query Progress Callbacks ** METHOD: sqlite3 ** ** ^The sqlite3_progress_handler(D,N,X,P) interface causes the callback @@ -3776,39 +3651,15 @@ /* ** CAPI3REF: Retrieving Statement SQL ** METHOD: sqlite3_stmt ** -** ^The sqlite3_sql(P) interface returns a pointer to a copy of the UTF-8 -** SQL text used to create [prepared statement] P if P was -** created by either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()]. -** ^The sqlite3_expanded_sql(P) interface returns a pointer to a UTF-8 -** string containing the SQL text of prepared statement P with -** [bound parameters] expanded. -** -** ^(For example, if a prepared statement is created using the SQL -** text "SELECT $abc,:xyz" and if parameter $abc is bound to integer 2345 -** and parameter :xyz is unbound, then sqlite3_sql() will return -** the original string, "SELECT $abc,:xyz" but sqlite3_expanded_sql() -** will return "SELECT 2345,NULL".)^ -** -** ^The sqlite3_expanded_sql() interface returns NULL if insufficient memory -** is available to hold the result, or if the result would exceed the -** the maximum string length determined by the [SQLITE_LIMIT_LENGTH]. -** -** ^The [SQLITE_TRACE_SIZE_LIMIT] compile-time option limits the size of -** bound parameter expansions. ^The [SQLITE_OMIT_TRACE] compile-time -** option causes sqlite3_expanded_sql() to always return NULL. -** -** ^The string returned by sqlite3_sql(P) is managed by SQLite and is -** automatically freed when the prepared statement is finalized. -** ^The string returned by sqlite3_expanded_sql(P), on the other hand, -** is obtained from [sqlite3_malloc()] and must be free by the application -** by passing it to [sqlite3_free()]. +** ^This interface can be used to retrieve a saved copy of the original +** SQL text used to create a [prepared statement] if that statement was +** compiled using either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()]. */ SQLITE_API const char *SQLITE_STDCALL sqlite3_sql(sqlite3_stmt *pStmt); -SQLITE_API char *SQLITE_STDCALL sqlite3_expanded_sql(sqlite3_stmt *pStmt); /* ** CAPI3REF: Determine If An SQL Statement Writes The Database ** METHOD: sqlite3_stmt ** @@ -4962,17 +4813,16 @@ ** NULL if the metadata has been discarded. ** ^After each call to sqlite3_set_auxdata(C,N,P,X) where X is not NULL, ** SQLite will invoke the destructor function X with parameter P exactly ** once, when the metadata is discarded. ** SQLite is free to discard the metadata at any time, including:
      -**
    • ^(when the corresponding function parameter changes)^, or -**
    • ^(when [sqlite3_reset()] or [sqlite3_finalize()] is called for the -** SQL statement)^, or -**
    • ^(when sqlite3_set_auxdata() is invoked again on the same -** parameter)^, or -**
    • ^(during the original sqlite3_set_auxdata() call when a memory -** allocation error occurs.)^
    +**
  1. when the corresponding function parameter changes, or +**
  2. when [sqlite3_reset()] or [sqlite3_finalize()] is called for the +** SQL statement, or +**
  3. when sqlite3_set_auxdata() is invoked again on the same parameter, or +**
  4. during the original sqlite3_set_auxdata() call when a memory +** allocation error occurs. )^ ** ** Note the last bullet in particular. The destructor X in ** sqlite3_set_auxdata(C,N,P,X) might be called immediately, before the ** sqlite3_set_auxdata() interface even returns. Hence sqlite3_set_auxdata() ** should be called near the end of the function implementation and the @@ -5795,11 +5645,11 @@ ** interface returns SQLITE_OK and fills in the non-NULL pointers in ** the final five arguments with appropriate values if the specified ** column exists. ^The sqlite3_table_column_metadata() interface returns ** SQLITE_ERROR and if the specified column does not exist. ** ^If the column-name parameter to sqlite3_table_column_metadata() is a -** NULL pointer, then this routine simply checks for the existence of the +** NULL pointer, then this routine simply checks for the existance of the ** table and returns SQLITE_OK if the table exists and SQLITE_ERROR if it ** does not. ** ** ^The column is identified by the second, third and fourth parameters to ** this function. ^(The second parameter is either the name of the database @@ -5929,12 +5779,12 @@ ** to turn extension loading on and call it with onoff==0 to turn ** it back off again. ** ** ^This interface enables or disables both the C-API ** [sqlite3_load_extension()] and the SQL function [load_extension()]. -** ^(Use [sqlite3_db_config](db,[SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION],..) -** to enable or disable only the C-API.)^ +** Use [sqlite3_db_config](db,[SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION],..) +** to enable or disable only the C-API. ** ** Security warning: It is recommended that extension loading ** be disabled using the [SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION] method ** rather than this interface, so the [load_extension()] SQL function ** remains disabled. This will prevent SQL injections from giving attackers @@ -5950,11 +5800,11 @@ ** xEntryPoint() is the entry point for a statically linked [SQLite extension] ** that is to be automatically loaded into all new database connections. ** ** ^(Even though the function prototype shows that xEntryPoint() takes ** no arguments and returns void, SQLite invokes xEntryPoint() with three -** arguments and expects an integer result as if the signature of the +** arguments and expects and integer result as if the signature of the ** entry point where as follows: ** **
     **    int xEntryPoint(
     **      sqlite3 *db,
    @@ -5976,11 +5826,11 @@
     ** will be called more than once for each database connection that is opened.
     **
     ** See also: [sqlite3_reset_auto_extension()]
     ** and [sqlite3_cancel_auto_extension()]
     */
    -SQLITE_API int SQLITE_STDCALL sqlite3_auto_extension(void(*xEntryPoint)(void));
    +SQLITE_API int SQLITE_STDCALL sqlite3_auto_extension(void (*xEntryPoint)(void));
     
     /*
     ** CAPI3REF: Cancel Automatic Extension Loading
     **
     ** ^The [sqlite3_cancel_auto_extension(X)] interface unregisters the
    @@ -5988,11 +5838,11 @@
     ** [sqlite3_auto_extension(X)].  ^The [sqlite3_cancel_auto_extension(X)]
     ** routine returns 1 if initialization routine X was successfully 
     ** unregistered and it returns 0 if X was not on the list of initialization
     ** routines.
     */
    -SQLITE_API int SQLITE_STDCALL sqlite3_cancel_auto_extension(void(*xEntryPoint)(void));
    +SQLITE_API int SQLITE_STDCALL sqlite3_cancel_auto_extension(void (*xEntryPoint)(void));
     
     /*
     ** CAPI3REF: Reset Automatic Extension Loading
     **
     ** ^This interface disables all automatic extensions previously
    @@ -7164,22 +7014,10 @@
     ** [[SQLITE_DBSTATUS_CACHE_USED]] ^(
    SQLITE_DBSTATUS_CACHE_USED
    **
    This parameter returns the approximate number of bytes of heap ** memory used by all pager caches associated with the database connection.)^ ** ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_USED is always 0. ** -** [[SQLITE_DBSTATUS_CACHE_USED_SHARED]] -** ^(
    SQLITE_DBSTATUS_CACHE_USED_SHARED
    -**
    This parameter is similar to DBSTATUS_CACHE_USED, except that if a -** pager cache is shared between two or more connections the bytes of heap -** memory used by that pager cache is divided evenly between the attached -** connections.)^ In other words, if none of the pager caches associated -** with the database connection are shared, this request returns the same -** value as DBSTATUS_CACHE_USED. Or, if one or more or the pager caches are -** shared, the value returned by this call will be smaller than that returned -** by DBSTATUS_CACHE_USED. ^The highwater mark associated with -** SQLITE_DBSTATUS_CACHE_USED_SHARED is always 0. -** ** [[SQLITE_DBSTATUS_SCHEMA_USED]] ^(
    SQLITE_DBSTATUS_SCHEMA_USED
    **
    This parameter returns the approximate number of bytes of heap ** memory used to store the schema for all databases associated ** with the connection - main, temp, and any [ATTACH]-ed databases.)^ ** ^The full amount of memory used by the schemas is reported, even if the @@ -7233,12 +7071,11 @@ #define SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL 6 #define SQLITE_DBSTATUS_CACHE_HIT 7 #define SQLITE_DBSTATUS_CACHE_MISS 8 #define SQLITE_DBSTATUS_CACHE_WRITE 9 #define SQLITE_DBSTATUS_DEFERRED_FKS 10 -#define SQLITE_DBSTATUS_CACHE_USED_SHARED 11 -#define SQLITE_DBSTATUS_MAX 11 /* Largest defined DBSTATUS */ +#define SQLITE_DBSTATUS_MAX 10 /* Largest defined DBSTATUS */ /* ** CAPI3REF: Prepared Statement Status ** METHOD: sqlite3_stmt @@ -8390,11 +8227,11 @@ ** tables. ** ** ^The second parameter to the preupdate callback is a pointer to ** the [database connection] that registered the preupdate hook. ** ^The third parameter to the preupdate callback is one of the constants -** [SQLITE_INSERT], [SQLITE_DELETE], or [SQLITE_UPDATE] to identify the +** [SQLITE_INSERT], [SQLITE_DELETE], or [SQLITE_UPDATE] to indentify the ** kind of update operation that is about to occur. ** ^(The fourth parameter to the preupdate callback is the name of the ** database within the database connection that is being modified. This ** will be "main" for the main database or "temp" for TEMP tables or ** the name given after the AS keyword in the [ATTACH] statement for attached @@ -8617,11 +8454,11 @@ #endif #if 0 } /* End of the 'extern "C"' block */ #endif -#endif /* SQLITE3_H */ +#endif /* _SQLITE3_H_ */ /******** Begin file sqlite3rtree.h *********/ /* ** 2010 August 30 ** @@ -10337,11 +10174,11 @@ ** 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: ** ** xCreate: -** This function is used to allocate and initialize a tokenizer instance. +** This function is used to allocate and inititalize a tokenizer instance. ** A tokenizer instance is required to actually tokenize text. ** ** The first argument passed to this function is a copy of the (void*) ** pointer provided by the application when the fts5_tokenizer object ** was registered with FTS5 (the third argument to xCreateTokenizer()). @@ -10596,10 +10433,11 @@ #if 0 } /* end of the 'extern "C"' block */ #endif #endif /* _FTS5_H */ + /******** End of fts5.h *********/ /************** End of sqlite3.h *********************************************/ /************** Continuing where we left off in sqliteInt.h ******************/ @@ -10894,11 +10732,11 @@ ** Make sure that the compiler intrinsics we desire are enabled when ** compiling with an appropriate version of MSVC unless prevented by ** the SQLITE_DISABLE_INTRINSIC define. */ #if !defined(SQLITE_DISABLE_INTRINSIC) -# if defined(_MSC_VER) && _MSC_VER>=1400 +# if defined(_MSC_VER) && _MSC_VER>=1300 # if !defined(_WIN32_WCE) # include # pragma intrinsic(_byteswap_ushort) # pragma intrinsic(_byteswap_ulong) # pragma intrinsic(_ReadWriteBarrier) @@ -11171,12 +11009,12 @@ ** ************************************************************************* ** This is the header file for the generic hash-table implementation ** used in SQLite. */ -#ifndef SQLITE_HASH_H -#define SQLITE_HASH_H +#ifndef _SQLITE_HASH_H_ +#define _SQLITE_HASH_H_ /* Forward declarations of structures. */ typedef struct Hash Hash; typedef struct HashElem HashElem; @@ -11252,11 +11090,11 @@ /* ** Number of entries in a hash table */ /* #define sqliteHashCount(H) ((H)->count) // NOT USED */ -#endif /* SQLITE_HASH_H */ +#endif /* _SQLITE_HASH_H_ */ /************** End of hash.h ************************************************/ /************** Continuing where we left off in sqliteInt.h ******************/ /************** Include parse.h in the middle of sqliteInt.h *****************/ /************** Begin file parse.h *******************************************/ @@ -12000,12 +11838,12 @@ ************************************************************************* ** This header file defines the interface that the sqlite B-Tree file ** subsystem. See comments in the source code for a detailed description ** of what each interface routine does. */ -#ifndef SQLITE_BTREE_H -#define SQLITE_BTREE_H +#ifndef _BTREE_H_ +#define _BTREE_H_ /* TODO: This definition is just included so other modules compile. It ** needs to be revisited. */ #define SQLITE_N_BTREE_META 16 @@ -12026,11 +11864,10 @@ ** Forward declarations of structure */ typedef struct Btree Btree; typedef struct BtCursor BtCursor; typedef struct BtShared BtShared; -typedef struct BtreePayload BtreePayload; SQLITE_PRIVATE int sqlite3BtreeOpen( sqlite3_vfs *pVfs, /* VFS to use with this b-tree */ const char *zFilename, /* Name of database file to open */ @@ -12238,47 +12075,23 @@ /* Allowed flags for the 2nd argument to sqlite3BtreeDelete() */ #define BTREE_SAVEPOSITION 0x02 /* Leave cursor pointing at NEXT or PREV */ #define BTREE_AUXDELETE 0x04 /* not the primary delete operation */ -/* An instance of the BtreePayload object describes the content of a single -** entry in either an index or table btree. -** -** Index btrees (used for indexes and also WITHOUT ROWID tables) contain -** an arbitrary key and no data. These btrees have pKey,nKey set to their -** key and pData,nData,nZero set to zero. -** -** Table btrees (used for rowid tables) contain an integer rowid used as -** the key and passed in the nKey field. The pKey field is zero. -** pData,nData hold the content of the new entry. nZero extra zero bytes -** are appended to the end of the content when constructing the entry. -** -** This object is used to pass information into sqlite3BtreeInsert(). The -** same information used to be passed as five separate parameters. But placing -** the information into this object helps to keep the interface more -** organized and understandable, and it also helps the resulting code to -** run a little faster by using fewer registers for parameter passing. -*/ -struct BtreePayload { - const void *pKey; /* Key content for indexes. NULL for tables */ - sqlite3_int64 nKey; /* Size of pKey for indexes. PRIMARY KEY for tabs */ - const void *pData; /* Data for tables. NULL for indexes */ - int nData; /* Size of pData. 0 if none. */ - int nZero; /* Extra zero data appended after pData,nData */ -}; - -SQLITE_PRIVATE int sqlite3BtreeInsert(BtCursor*, const BtreePayload *pPayload, - int bias, int seekResult); +SQLITE_PRIVATE int sqlite3BtreeInsert(BtCursor*, const void *pKey, i64 nKey, + const void *pData, int nData, + int nZero, int bias, int seekResult); SQLITE_PRIVATE int sqlite3BtreeFirst(BtCursor*, int *pRes); SQLITE_PRIVATE int sqlite3BtreeLast(BtCursor*, int *pRes); SQLITE_PRIVATE int sqlite3BtreeNext(BtCursor*, int *pRes); SQLITE_PRIVATE int sqlite3BtreeEof(BtCursor*); SQLITE_PRIVATE int sqlite3BtreePrevious(BtCursor*, int *pRes); -SQLITE_PRIVATE i64 sqlite3BtreeIntegerKey(BtCursor*); +SQLITE_PRIVATE int sqlite3BtreeKeySize(BtCursor*, i64 *pSize); SQLITE_PRIVATE int sqlite3BtreeKey(BtCursor*, u32 offset, u32 amt, void*); -SQLITE_PRIVATE const void *sqlite3BtreePayloadFetch(BtCursor*, u32 *pAmt); -SQLITE_PRIVATE u32 sqlite3BtreePayloadSize(BtCursor*); +SQLITE_PRIVATE const void *sqlite3BtreeKeyFetch(BtCursor*, u32 *pAmt); +SQLITE_PRIVATE const void *sqlite3BtreeDataFetch(BtCursor*, u32 *pAmt); +SQLITE_PRIVATE int sqlite3BtreeDataSize(BtCursor*, u32 *pSize); SQLITE_PRIVATE int sqlite3BtreeData(BtCursor*, u32 offset, u32 amt, void*); SQLITE_PRIVATE char *sqlite3BtreeIntegrityCheck(Btree*, int *aRoot, int nRoot, int, int*); SQLITE_PRIVATE struct Pager *sqlite3BtreePager(Btree*); @@ -12315,17 +12128,15 @@ #ifndef SQLITE_OMIT_SHARED_CACHE SQLITE_PRIVATE void sqlite3BtreeEnter(Btree*); SQLITE_PRIVATE void sqlite3BtreeEnterAll(sqlite3*); SQLITE_PRIVATE int sqlite3BtreeSharable(Btree*); SQLITE_PRIVATE void sqlite3BtreeEnterCursor(BtCursor*); -SQLITE_PRIVATE int sqlite3BtreeConnectionCount(Btree*); #else # define sqlite3BtreeEnter(X) # define sqlite3BtreeEnterAll(X) # define sqlite3BtreeSharable(X) 0 # define sqlite3BtreeEnterCursor(X) -# define sqlite3BtreeConnectionCount(X) 1 #endif #if !defined(SQLITE_OMIT_SHARED_CACHE) && SQLITE_THREADSAFE SQLITE_PRIVATE void sqlite3BtreeLeave(Btree*); SQLITE_PRIVATE void sqlite3BtreeLeaveCursor(BtCursor*); @@ -12346,11 +12157,11 @@ # define sqlite3BtreeHoldsAllMutexes(X) 1 # define sqlite3SchemaMutexHeld(X,Y,Z) 1 #endif -#endif /* SQLITE_BTREE_H */ +#endif /* _BTREE_H_ */ /************** End of btree.h ***********************************************/ /************** Continuing where we left off in sqliteInt.h ******************/ /************** Include vdbe.h in the middle of sqliteInt.h ******************/ /************** Begin file vdbe.h ********************************************/ @@ -12369,12 +12180,12 @@ ** ** This header defines the interface to the virtual database engine ** or VDBE. The VDBE implements an abstract machine that runs a ** simple program to access and modify the underlying database. */ -#ifndef SQLITE_VDBE_H -#define SQLITE_VDBE_H +#ifndef _SQLITE_VDBE_H_ +#define _SQLITE_VDBE_H_ /* #include */ /* ** A single VDBE is an opaque structure named "Vdbe". Only routines ** in the source file sqliteVdbe.c are allowed to see the insides @@ -12555,21 +12366,21 @@ #define OP_Or 27 /* same as TK_OR, synopsis: r[P3]=(r[P1] || r[P2]) */ #define OP_And 28 /* same as TK_AND, synopsis: r[P3]=(r[P1] && r[P2]) */ #define OP_NoConflict 29 /* synopsis: key=r[P3@P4] */ #define OP_NotFound 30 /* synopsis: key=r[P3@P4] */ #define OP_Found 31 /* synopsis: key=r[P3@P4] */ -#define OP_SeekRowid 32 /* synopsis: intkey=r[P3] */ -#define OP_NotExists 33 /* synopsis: intkey=r[P3] */ +#define OP_NotExists 32 /* synopsis: intkey=r[P3] */ +#define OP_Last 33 #define OP_IsNull 34 /* same as TK_ISNULL, synopsis: if r[P1]==NULL goto P2 */ #define OP_NotNull 35 /* same as TK_NOTNULL, synopsis: if r[P1]!=NULL goto P2 */ #define OP_Ne 36 /* same as TK_NE, synopsis: if r[P1]!=r[P3] goto P2 */ #define OP_Eq 37 /* same as TK_EQ, synopsis: if r[P1]==r[P3] goto P2 */ #define OP_Gt 38 /* same as TK_GT, synopsis: if r[P1]>r[P3] goto P2 */ #define OP_Le 39 /* same as TK_LE, synopsis: if r[P1]<=r[P3] goto P2 */ #define OP_Lt 40 /* same as TK_LT, synopsis: if r[P1]=r[P3] goto P2 */ -#define OP_Last 42 +#define OP_SorterSort 42 #define OP_BitAnd 43 /* same as TK_BITAND, synopsis: r[P3]=r[P1]&r[P2] */ #define OP_BitOr 44 /* same as TK_BITOR, synopsis: r[P3]=r[P1]|r[P2] */ #define OP_ShiftLeft 45 /* same as TK_LSHIFT, synopsis: r[P3]=r[P2]<>r[P1] */ #define OP_Add 47 /* same as TK_PLUS, synopsis: r[P3]=r[P1]+r[P2] */ @@ -12576,119 +12387,118 @@ #define OP_Subtract 48 /* same as TK_MINUS, synopsis: r[P3]=r[P2]-r[P1] */ #define OP_Multiply 49 /* same as TK_STAR, synopsis: r[P3]=r[P1]*r[P2] */ #define OP_Divide 50 /* same as TK_SLASH, synopsis: r[P3]=r[P2]/r[P1] */ #define OP_Remainder 51 /* same as TK_REM, synopsis: r[P3]=r[P2]%r[P1] */ #define OP_Concat 52 /* same as TK_CONCAT, synopsis: r[P3]=r[P2]+r[P1] */ -#define OP_SorterSort 53 +#define OP_Sort 53 #define OP_BitNot 54 /* same as TK_BITNOT, synopsis: r[P1]= ~r[P1] */ -#define OP_Sort 55 -#define OP_Rewind 56 -#define OP_IdxLE 57 /* synopsis: key=r[P3@P4] */ -#define OP_IdxGT 58 /* synopsis: key=r[P3@P4] */ -#define OP_IdxLT 59 /* synopsis: key=r[P3@P4] */ -#define OP_IdxGE 60 /* synopsis: key=r[P3@P4] */ -#define OP_RowSetRead 61 /* synopsis: r[P3]=rowset(P1) */ -#define OP_RowSetTest 62 /* synopsis: if r[P3] in rowset(P1) goto P2 */ -#define OP_Program 63 -#define OP_FkIfZero 64 /* synopsis: if fkctr[P1]==0 goto P2 */ -#define OP_IfPos 65 /* synopsis: if r[P1]>0 then r[P1]-=P3, goto P2 */ -#define OP_IfNotZero 66 /* synopsis: if r[P1]!=0 then r[P1]-=P3, goto P2 */ -#define OP_DecrJumpZero 67 /* synopsis: if (--r[P1])==0 goto P2 */ -#define OP_IncrVacuum 68 -#define OP_VNext 69 -#define OP_Init 70 /* synopsis: Start at P2 */ -#define OP_Return 71 -#define OP_EndCoroutine 72 -#define OP_HaltIfNull 73 /* synopsis: if r[P3]=null halt */ -#define OP_Halt 74 -#define OP_Integer 75 /* synopsis: r[P2]=P1 */ -#define OP_Int64 76 /* synopsis: r[P2]=P4 */ -#define OP_String 77 /* synopsis: r[P2]='P4' (len=P1) */ -#define OP_Null 78 /* synopsis: r[P2..P3]=NULL */ -#define OP_SoftNull 79 /* synopsis: r[P1]=NULL */ -#define OP_Blob 80 /* synopsis: r[P2]=P4 (len=P1) */ -#define OP_Variable 81 /* synopsis: r[P2]=parameter(P1,P4) */ -#define OP_Move 82 /* synopsis: r[P2@P3]=r[P1@P3] */ -#define OP_Copy 83 /* synopsis: r[P2@P3+1]=r[P1@P3+1] */ -#define OP_SCopy 84 /* synopsis: r[P2]=r[P1] */ -#define OP_IntCopy 85 /* synopsis: r[P2]=r[P1] */ -#define OP_ResultRow 86 /* synopsis: output=r[P1@P2] */ -#define OP_CollSeq 87 -#define OP_Function0 88 /* synopsis: r[P3]=func(r[P2@P5]) */ -#define OP_Function 89 /* synopsis: r[P3]=func(r[P2@P5]) */ -#define OP_AddImm 90 /* synopsis: r[P1]=r[P1]+P2 */ -#define OP_RealAffinity 91 -#define OP_Cast 92 /* synopsis: affinity(r[P1]) */ -#define OP_Permutation 93 -#define OP_Compare 94 /* synopsis: r[P1@P3] <-> r[P2@P3] */ -#define OP_Column 95 /* synopsis: r[P3]=PX */ -#define OP_Affinity 96 /* synopsis: affinity(r[P1@P2]) */ +#define OP_Rewind 55 +#define OP_IdxLE 56 /* synopsis: key=r[P3@P4] */ +#define OP_IdxGT 57 /* synopsis: key=r[P3@P4] */ +#define OP_IdxLT 58 /* synopsis: key=r[P3@P4] */ +#define OP_IdxGE 59 /* synopsis: key=r[P3@P4] */ +#define OP_RowSetRead 60 /* synopsis: r[P3]=rowset(P1) */ +#define OP_RowSetTest 61 /* synopsis: if r[P3] in rowset(P1) goto P2 */ +#define OP_Program 62 +#define OP_FkIfZero 63 /* synopsis: if fkctr[P1]==0 goto P2 */ +#define OP_IfPos 64 /* synopsis: if r[P1]>0 then r[P1]-=P3, goto P2 */ +#define OP_IfNotZero 65 /* synopsis: if r[P1]!=0 then r[P1]-=P3, goto P2 */ +#define OP_DecrJumpZero 66 /* synopsis: if (--r[P1])==0 goto P2 */ +#define OP_IncrVacuum 67 +#define OP_VNext 68 +#define OP_Init 69 /* synopsis: Start at P2 */ +#define OP_Return 70 +#define OP_EndCoroutine 71 +#define OP_HaltIfNull 72 /* synopsis: if r[P3]=null halt */ +#define OP_Halt 73 +#define OP_Integer 74 /* synopsis: r[P2]=P1 */ +#define OP_Int64 75 /* synopsis: r[P2]=P4 */ +#define OP_String 76 /* synopsis: r[P2]='P4' (len=P1) */ +#define OP_Null 77 /* synopsis: r[P2..P3]=NULL */ +#define OP_SoftNull 78 /* synopsis: r[P1]=NULL */ +#define OP_Blob 79 /* synopsis: r[P2]=P4 (len=P1) */ +#define OP_Variable 80 /* synopsis: r[P2]=parameter(P1,P4) */ +#define OP_Move 81 /* synopsis: r[P2@P3]=r[P1@P3] */ +#define OP_Copy 82 /* synopsis: r[P2@P3+1]=r[P1@P3+1] */ +#define OP_SCopy 83 /* synopsis: r[P2]=r[P1] */ +#define OP_IntCopy 84 /* synopsis: r[P2]=r[P1] */ +#define OP_ResultRow 85 /* synopsis: output=r[P1@P2] */ +#define OP_CollSeq 86 +#define OP_Function0 87 /* synopsis: r[P3]=func(r[P2@P5]) */ +#define OP_Function 88 /* synopsis: r[P3]=func(r[P2@P5]) */ +#define OP_AddImm 89 /* synopsis: r[P1]=r[P1]+P2 */ +#define OP_RealAffinity 90 +#define OP_Cast 91 /* synopsis: affinity(r[P1]) */ +#define OP_Permutation 92 +#define OP_Compare 93 /* synopsis: r[P1@P3] <-> r[P2@P3] */ +#define OP_Column 94 /* synopsis: r[P3]=PX */ +#define OP_Affinity 95 /* synopsis: affinity(r[P1@P2]) */ +#define OP_MakeRecord 96 /* synopsis: r[P3]=mkrec(r[P1@P2]) */ #define OP_String8 97 /* same as TK_STRING, synopsis: r[P2]='P4' */ -#define OP_MakeRecord 98 /* synopsis: r[P3]=mkrec(r[P1@P2]) */ -#define OP_Count 99 /* synopsis: r[P2]=count() */ -#define OP_ReadCookie 100 -#define OP_SetCookie 101 -#define OP_ReopenIdx 102 /* synopsis: root=P2 iDb=P3 */ -#define OP_OpenRead 103 /* synopsis: root=P2 iDb=P3 */ -#define OP_OpenWrite 104 /* synopsis: root=P2 iDb=P3 */ -#define OP_OpenAutoindex 105 /* synopsis: nColumn=P2 */ -#define OP_OpenEphemeral 106 /* synopsis: nColumn=P2 */ -#define OP_SorterOpen 107 -#define OP_SequenceTest 108 /* synopsis: if( cursor[P1].ctr++ ) pc = P2 */ -#define OP_OpenPseudo 109 /* synopsis: P3 columns in r[P2] */ -#define OP_Close 110 -#define OP_ColumnsUsed 111 -#define OP_Sequence 112 /* synopsis: r[P2]=cursor[P1].ctr++ */ -#define OP_NewRowid 113 /* synopsis: r[P2]=rowid */ -#define OP_Insert 114 /* synopsis: intkey=r[P3] data=r[P2] */ -#define OP_InsertInt 115 /* synopsis: intkey=P3 data=r[P2] */ -#define OP_Delete 116 -#define OP_ResetCount 117 -#define OP_SorterCompare 118 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */ -#define OP_SorterData 119 /* synopsis: r[P2]=data */ -#define OP_RowKey 120 /* synopsis: r[P2]=key */ -#define OP_RowData 121 /* synopsis: r[P2]=data */ -#define OP_Rowid 122 /* synopsis: r[P2]=rowid */ -#define OP_NullRow 123 -#define OP_SorterInsert 124 -#define OP_IdxInsert 125 /* synopsis: key=r[P2] */ -#define OP_IdxDelete 126 /* synopsis: key=r[P2@P3] */ -#define OP_Seek 127 /* synopsis: Move P3 to P1.rowid */ -#define OP_IdxRowid 128 /* synopsis: r[P2]=rowid */ -#define OP_Destroy 129 -#define OP_Clear 130 -#define OP_ResetSorter 131 -#define OP_CreateIndex 132 /* synopsis: r[P2]=root iDb=P1 */ +#define OP_Count 98 /* synopsis: r[P2]=count() */ +#define OP_ReadCookie 99 +#define OP_SetCookie 100 +#define OP_ReopenIdx 101 /* synopsis: root=P2 iDb=P3 */ +#define OP_OpenRead 102 /* synopsis: root=P2 iDb=P3 */ +#define OP_OpenWrite 103 /* synopsis: root=P2 iDb=P3 */ +#define OP_OpenAutoindex 104 /* synopsis: nColumn=P2 */ +#define OP_OpenEphemeral 105 /* synopsis: nColumn=P2 */ +#define OP_SorterOpen 106 +#define OP_SequenceTest 107 /* synopsis: if( cursor[P1].ctr++ ) pc = P2 */ +#define OP_OpenPseudo 108 /* synopsis: P3 columns in r[P2] */ +#define OP_Close 109 +#define OP_ColumnsUsed 110 +#define OP_Sequence 111 /* synopsis: r[P2]=cursor[P1].ctr++ */ +#define OP_NewRowid 112 /* synopsis: r[P2]=rowid */ +#define OP_Insert 113 /* synopsis: intkey=r[P3] data=r[P2] */ +#define OP_InsertInt 114 /* synopsis: intkey=P3 data=r[P2] */ +#define OP_Delete 115 +#define OP_ResetCount 116 +#define OP_SorterCompare 117 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */ +#define OP_SorterData 118 /* synopsis: r[P2]=data */ +#define OP_RowKey 119 /* synopsis: r[P2]=key */ +#define OP_RowData 120 /* synopsis: r[P2]=data */ +#define OP_Rowid 121 /* synopsis: r[P2]=rowid */ +#define OP_NullRow 122 +#define OP_SorterInsert 123 +#define OP_IdxInsert 124 /* synopsis: key=r[P2] */ +#define OP_IdxDelete 125 /* synopsis: key=r[P2@P3] */ +#define OP_Seek 126 /* synopsis: Move P3 to P1.rowid */ +#define OP_IdxRowid 127 /* synopsis: r[P2]=rowid */ +#define OP_Destroy 128 +#define OP_Clear 129 +#define OP_ResetSorter 130 +#define OP_CreateIndex 131 /* synopsis: r[P2]=root iDb=P1 */ +#define OP_CreateTable 132 /* synopsis: r[P2]=root iDb=P1 */ #define OP_Real 133 /* same as TK_FLOAT, synopsis: r[P2]=P4 */ -#define OP_CreateTable 134 /* synopsis: r[P2]=root iDb=P1 */ -#define OP_ParseSchema 135 -#define OP_LoadAnalysis 136 -#define OP_DropTable 137 -#define OP_DropIndex 138 -#define OP_DropTrigger 139 -#define OP_IntegrityCk 140 -#define OP_RowSetAdd 141 /* synopsis: rowset(P1)=r[P2] */ -#define OP_Param 142 -#define OP_FkCounter 143 /* synopsis: fkctr[P1]+=P2 */ -#define OP_MemMax 144 /* synopsis: r[P1]=max(r[P1],r[P2]) */ -#define OP_OffsetLimit 145 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */ -#define OP_AggStep0 146 /* synopsis: accum=r[P3] step(r[P2@P5]) */ -#define OP_AggStep 147 /* synopsis: accum=r[P3] step(r[P2@P5]) */ -#define OP_AggFinal 148 /* synopsis: accum=r[P1] N=P2 */ -#define OP_Expire 149 -#define OP_TableLock 150 /* synopsis: iDb=P1 root=P2 write=P3 */ -#define OP_VBegin 151 -#define OP_VCreate 152 -#define OP_VDestroy 153 -#define OP_VOpen 154 -#define OP_VColumn 155 /* synopsis: r[P3]=vcolumn(P2) */ -#define OP_VRename 156 -#define OP_Pagecount 157 -#define OP_MaxPgcnt 158 -#define OP_CursorHint 159 -#define OP_Noop 160 -#define OP_Explain 161 +#define OP_ParseSchema 134 +#define OP_LoadAnalysis 135 +#define OP_DropTable 136 +#define OP_DropIndex 137 +#define OP_DropTrigger 138 +#define OP_IntegrityCk 139 +#define OP_RowSetAdd 140 /* synopsis: rowset(P1)=r[P2] */ +#define OP_Param 141 +#define OP_FkCounter 142 /* synopsis: fkctr[P1]+=P2 */ +#define OP_MemMax 143 /* synopsis: r[P1]=max(r[P1],r[P2]) */ +#define OP_OffsetLimit 144 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */ +#define OP_AggStep0 145 /* synopsis: accum=r[P3] step(r[P2@P5]) */ +#define OP_AggStep 146 /* synopsis: accum=r[P3] step(r[P2@P5]) */ +#define OP_AggFinal 147 /* synopsis: accum=r[P1] N=P2 */ +#define OP_Expire 148 +#define OP_TableLock 149 /* synopsis: iDb=P1 root=P2 write=P3 */ +#define OP_VBegin 150 +#define OP_VCreate 151 +#define OP_VDestroy 152 +#define OP_VOpen 153 +#define OP_VColumn 154 /* synopsis: r[P3]=vcolumn(P2) */ +#define OP_VRename 155 +#define OP_Pagecount 156 +#define OP_MaxPgcnt 157 +#define OP_CursorHint 158 +#define OP_Noop 159 +#define OP_Explain 160 /* Properties such as "out2" or "jump" that are specified in ** comments following the "case" for each opcode in the vdbe.c ** are encoded into bitvectors as follows: */ @@ -12701,35 +12511,35 @@ #define OPFLG_INITIALIZER {\ /* 0 */ 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01,\ /* 8 */ 0x00, 0x10, 0x00, 0x01, 0x00, 0x01, 0x01, 0x01,\ /* 16 */ 0x03, 0x03, 0x01, 0x12, 0x01, 0x03, 0x03, 0x09,\ /* 24 */ 0x09, 0x09, 0x09, 0x26, 0x26, 0x09, 0x09, 0x09,\ -/* 32 */ 0x09, 0x09, 0x03, 0x03, 0x0b, 0x0b, 0x0b, 0x0b,\ +/* 32 */ 0x09, 0x01, 0x03, 0x03, 0x0b, 0x0b, 0x0b, 0x0b,\ /* 40 */ 0x0b, 0x0b, 0x01, 0x26, 0x26, 0x26, 0x26, 0x26,\ /* 48 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x01, 0x12, 0x01,\ -/* 56 */ 0x01, 0x01, 0x01, 0x01, 0x01, 0x23, 0x0b, 0x01,\ -/* 64 */ 0x01, 0x03, 0x03, 0x03, 0x01, 0x01, 0x01, 0x02,\ -/* 72 */ 0x02, 0x08, 0x00, 0x10, 0x10, 0x10, 0x10, 0x00,\ -/* 80 */ 0x10, 0x10, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00,\ -/* 88 */ 0x00, 0x00, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00,\ -/* 96 */ 0x00, 0x10, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00,\ -/* 104 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ -/* 112 */ 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ -/* 120 */ 0x00, 0x00, 0x10, 0x00, 0x04, 0x04, 0x00, 0x00,\ -/* 128 */ 0x10, 0x10, 0x00, 0x00, 0x10, 0x10, 0x10, 0x00,\ -/* 136 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x00,\ -/* 144 */ 0x04, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ -/* 152 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00,\ -/* 160 */ 0x00, 0x00,} +/* 56 */ 0x01, 0x01, 0x01, 0x01, 0x23, 0x0b, 0x01, 0x01,\ +/* 64 */ 0x03, 0x03, 0x03, 0x01, 0x01, 0x01, 0x02, 0x02,\ +/* 72 */ 0x08, 0x00, 0x10, 0x10, 0x10, 0x10, 0x00, 0x10,\ +/* 80 */ 0x10, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00,\ +/* 88 */ 0x00, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00,\ +/* 96 */ 0x00, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00,\ +/* 104 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,\ +/* 112 */ 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ +/* 120 */ 0x00, 0x10, 0x00, 0x04, 0x04, 0x00, 0x00, 0x10,\ +/* 128 */ 0x10, 0x00, 0x00, 0x10, 0x10, 0x10, 0x00, 0x00,\ +/* 136 */ 0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x00, 0x04,\ +/* 144 */ 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ +/* 152 */ 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00,\ +/* 160 */ 0x00,} /* The sqlite3P2Values() routine is able to run faster if it knows ** the value of the largest JUMP opcode. The smaller the maximum ** JUMP opcode the better, so the mkopcodeh.tcl script that ** generated this include file strives to group all JUMP opcodes ** together near the beginning of the list. */ -#define SQLITE_MX_JUMP_OPCODE 70 /* Maximum JUMP opcode */ +#define SQLITE_MX_JUMP_OPCODE 69 /* Maximum JUMP opcode */ /************** End of opcodes.h *********************************************/ /************** Continuing where we left off in vdbe.h ***********************/ /* @@ -12872,11 +12682,11 @@ SQLITE_PRIVATE void sqlite3VdbeScanStatus(Vdbe*, int, int, int, LogEst, const char*); #else # define sqlite3VdbeScanStatus(a,b,c,d,e) #endif -#endif /* SQLITE_VDBE_H */ +#endif /************** End of vdbe.h ************************************************/ /************** Continuing where we left off in sqliteInt.h ******************/ /************** Include pager.h in the middle of sqliteInt.h *****************/ /************** Begin file pager.h *******************************************/ @@ -12894,12 +12704,12 @@ ** This header file defines the interface that the sqlite page cache ** subsystem. The page cache subsystem reads and writes a file a page ** at a time and provides a journal for rollback. */ -#ifndef SQLITE_PAGER_H -#define SQLITE_PAGER_H +#ifndef _PAGER_H_ +#define _PAGER_H_ /* ** Default maximum size for persistent journal files. A negative ** value means no limit. This value may be overridden using the ** sqlite3PagerJournalSizeLimit() API. See also "PRAGMA journal_size_limit". @@ -13083,11 +12893,11 @@ SQLITE_PRIVATE sqlite3_file *sqlite3PagerJrnlFile(Pager*); SQLITE_PRIVATE const char *sqlite3PagerJournalname(Pager*); SQLITE_PRIVATE void *sqlite3PagerTempSpace(Pager*); SQLITE_PRIVATE int sqlite3PagerIsMemdb(Pager*); SQLITE_PRIVATE void sqlite3PagerCacheStat(Pager *, int, int, int *); -SQLITE_PRIVATE void sqlite3PagerClearCache(Pager*); +SQLITE_PRIVATE void sqlite3PagerClearCache(Pager *); SQLITE_PRIVATE int sqlite3SectorSize(sqlite3_file *); /* Functions used to truncate the database file. */ SQLITE_PRIVATE void sqlite3PagerTruncateImage(Pager*,Pgno); @@ -13110,11 +12920,11 @@ #else # define disable_simulated_io_errors() # define enable_simulated_io_errors() #endif -#endif /* SQLITE_PAGER_H */ +#endif /* _PAGER_H_ */ /************** End of pager.h ***********************************************/ /************** Continuing where we left off in sqliteInt.h ******************/ /************** Include pcache.h in the middle of sqliteInt.h ****************/ /************** Begin file pcache.h ******************************************/ @@ -13348,12 +13158,12 @@ ****************************************************************************** ** ** This file contains pre-processor directives related to operating system ** detection and/or setup. */ -#ifndef SQLITE_OS_SETUP_H -#define SQLITE_OS_SETUP_H +#ifndef _OS_SETUP_H_ +#define _OS_SETUP_H_ /* ** Figure out if we are dealing with Unix, Windows, or some other operating ** system. ** @@ -13389,11 +13199,11 @@ # ifndef SQLITE_OS_WIN # define SQLITE_OS_WIN 0 # endif #endif -#endif /* SQLITE_OS_SETUP_H */ +#endif /* _OS_SETUP_H_ */ /************** End of os_setup.h ********************************************/ /************** Continuing where we left off in os.h *************************/ /* If the SET_FULLSYNC macro is not defined above, then make it @@ -13846,19 +13656,10 @@ #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 -** in the style of sqlite3_trace() -*/ -#define SQLITE_TRACE_LEGACY 0x80 -#else -#define SQLITE_TRACE_LEGACY 0 -#endif /* SQLITE_OMIT_DEPRECATED */ - /* ** Each database connection is an instance of the following structure. */ struct sqlite3 { @@ -13884,11 +13685,10 @@ u8 dfltLockMode; /* Default locking-mode for attached dbs */ signed char nextAutovac; /* Autovac setting after VACUUM if >=0 */ u8 suppressErr; /* Do not issue error messages if true */ u8 vtabOnConflict; /* Value to return for s3_vtab_on_conflict() */ u8 isTransactionSavepoint; /* True if the outermost savepoint is a TS */ - u8 mTrace; /* zero or more SQLITE_TRACE flags */ int nextPagesize; /* Pagesize after VACUUM if >0 */ u32 magic; /* Magic number for detect library misuse */ int nChange; /* Value returned by sqlite3_changes() */ int nTotalChange; /* Value returned by sqlite3_total_changes() */ int aLimit[SQLITE_N_LIMIT]; /* Limits */ @@ -13905,11 +13705,11 @@ int nVdbeWrite; /* Number of active VDBEs that read and write */ int nVdbeExec; /* Number of nested calls to VdbeExec() */ int nVDestroy; /* Number of active OP_VDestroy operations */ int nExtension; /* Number of loaded extensions */ void **aExtension; /* Array of shared library handles */ - int (*xTrace)(u32,void*,void*,void*); /* Trace function */ + void (*xTrace)(void*,const char*); /* Trace function */ void *pTraceArg; /* Argument to the trace function */ void (*xProfile)(void*,const char*,u64); /* Profiling function */ void *pProfileArg; /* Argument to profile function */ void *pCommitArg; /* Argument to xCommitCallback() */ int (*xCommitCallback)(void*); /* Invoked at every commit. */ @@ -15100,11 +14900,11 @@ Select *pSelect; /* A SELECT statement used in place of a table name */ int addrFillSub; /* Address of subroutine to manifest a subquery */ int regReturn; /* Register holding return address of addrFillSub */ int regResult; /* Registers holding results of a co-routine */ struct { - u8 jointype; /* Type of join between this table and the previous */ + u8 jointype; /* Type of join between this able and the previous */ unsigned notIndexed :1; /* True if there is a NOT INDEXED clause */ unsigned isIndexedBy :1; /* True if there is an INDEXED BY clause */ unsigned isTabFunc :1; /* True if table-valued-function syntax */ unsigned isCorrelated :1; /* True if sub-query is correlated */ unsigned viaCoroutine :1; /* Implemented as a co-routine */ @@ -15146,24 +14946,23 @@ */ #define WHERE_ORDERBY_NORMAL 0x0000 /* No-op */ #define WHERE_ORDERBY_MIN 0x0001 /* ORDER BY processing for min() func */ #define WHERE_ORDERBY_MAX 0x0002 /* ORDER BY processing for max() func */ #define WHERE_ONEPASS_DESIRED 0x0004 /* Want to do one-pass UPDATE/DELETE */ -#define WHERE_ONEPASS_MULTIROW 0x0008 /* ONEPASS is ok with multiple rows */ -#define WHERE_DUPLICATES_OK 0x0010 /* Ok to return a row more than once */ -#define WHERE_OR_SUBCLAUSE 0x0020 /* Processing a sub-WHERE as part of - ** the OR optimization */ -#define WHERE_GROUPBY 0x0040 /* pOrderBy is really a GROUP BY */ -#define WHERE_DISTINCTBY 0x0080 /* pOrderby is really a DISTINCT clause */ -#define WHERE_WANT_DISTINCT 0x0100 /* All output needs to be distinct */ -#define WHERE_SORTBYGROUP 0x0200 /* Support sqlite3WhereIsSorted() */ -#define WHERE_SEEK_TABLE 0x0400 /* Do not defer seeks on main table */ -#define WHERE_ORDERBY_LIMIT 0x0800 /* ORDERBY+LIMIT on the inner loop */ - /* 0x1000 not currently used */ - /* 0x2000 not currently used */ -#define WHERE_USE_LIMIT 0x4000 /* Use the LIMIT in cost estimates */ - /* 0x8000 not currently used */ +#define WHERE_DUPLICATES_OK 0x0008 /* Ok to return a row more than once */ +#define WHERE_OMIT_OPEN_CLOSE 0x0010 /* Table cursors are already open */ +#define WHERE_FORCE_TABLE 0x0020 /* Do not use an index-only search */ +#define WHERE_ONETABLE_ONLY 0x0040 /* Only code the 1st table in pTabList */ +#define WHERE_NO_AUTOINDEX 0x0080 /* Disallow automatic indexes */ +#define WHERE_GROUPBY 0x0100 /* pOrderBy is really a GROUP BY */ +#define WHERE_DISTINCTBY 0x0200 /* pOrderby is really a DISTINCT clause */ +#define WHERE_WANT_DISTINCT 0x0400 /* All output needs to be distinct */ +#define WHERE_SORTBYGROUP 0x0800 /* Support sqlite3WhereIsSorted() */ +#define WHERE_REOPEN_IDX 0x1000 /* Try to use OP_ReopenIdx */ +#define WHERE_ONEPASS_MULTIROW 0x2000 /* ONEPASS is ok with multiple rows */ +#define WHERE_USE_LIMIT 0x4000 /* There is a constant LIMIT clause */ +#define WHERE_SEEK_TABLE 0x8000 /* Do not defer seeks on main table */ /* Allowed return values from sqlite3WhereIsDistinct() */ #define WHERE_DISTINCT_NOOP 0 /* DISTINCT keyword not used */ #define WHERE_DISTINCT_UNIQUE 1 /* No duplicates */ @@ -15862,11 +15661,10 @@ int iCur; /* A cursor number */ SrcList *pSrcList; /* FROM clause */ struct SrcCount *pSrcCount; /* Counting column references */ struct CCurHint *pCCurHint; /* Used by codeCursorHint() */ int *aiCol; /* array of column indexes */ - struct IdxCover *pIdxCover; /* Check for index coverage */ } u; }; /* Forward declarations */ SQLITE_PRIVATE int sqlite3WalkExpr(Walker*, Expr*); @@ -16046,19 +15844,15 @@ # define sqlite3StackAllocRaw(D,N) sqlite3DbMallocRaw(D,N) # define sqlite3StackAllocZero(D,N) sqlite3DbMallocZero(D,N) # define sqlite3StackFree(D,P) sqlite3DbFree(D,P) #endif -/* Do not allow both MEMSYS5 and MEMSYS3 to be defined together. If they -** are, disable MEMSYS3 -*/ +#ifdef SQLITE_ENABLE_MEMSYS3 +SQLITE_PRIVATE const sqlite3_mem_methods *sqlite3MemGetMemsys3(void); +#endif #ifdef SQLITE_ENABLE_MEMSYS5 SQLITE_PRIVATE const sqlite3_mem_methods *sqlite3MemGetMemsys5(void); -#undef SQLITE_ENABLE_MEMSYS3 -#endif -#ifdef SQLITE_ENABLE_MEMSYS3 -SQLITE_PRIVATE const sqlite3_mem_methods *sqlite3MemGetMemsys3(void); #endif #ifndef SQLITE_MUTEX_OMIT SQLITE_PRIVATE sqlite3_mutex_methods const *sqlite3DefaultMutex(void); @@ -16237,12 +16031,12 @@ SQLITE_PRIVATE void sqlite3SrcListShiftJoinType(SrcList*); SQLITE_PRIVATE void sqlite3SrcListAssignCursors(Parse*, SrcList*); SQLITE_PRIVATE void sqlite3IdListDelete(sqlite3*, IdList*); SQLITE_PRIVATE void sqlite3SrcListDelete(sqlite3*, SrcList*); SQLITE_PRIVATE Index *sqlite3AllocateIndexObject(sqlite3*,i16,int,char**); -SQLITE_PRIVATE void sqlite3CreateIndex(Parse*,Token*,Token*,SrcList*,ExprList*,int,Token*, - Expr*, int, int, u8); +SQLITE_PRIVATE Index *sqlite3CreateIndex(Parse*,Token*,Token*,SrcList*,ExprList*,int,Token*, + Expr*, int, int); SQLITE_PRIVATE void sqlite3DropIndex(Parse*, SrcList*, int); SQLITE_PRIVATE int sqlite3Select(Parse*, Select*, SelectDest*); SQLITE_PRIVATE Select *sqlite3SelectNew(Parse*,ExprList*,SrcList*,Expr*,ExprList*, Expr*,ExprList*,u32,Expr*,Expr*); SQLITE_PRIVATE void sqlite3SelectDelete(sqlite3*, Select*); @@ -16257,11 +16051,10 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(Parse*,SrcList*,Expr*,ExprList*,ExprList*,u16,int); SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo*); SQLITE_PRIVATE LogEst sqlite3WhereOutputRowCount(WhereInfo*); SQLITE_PRIVATE int sqlite3WhereIsDistinct(WhereInfo*); SQLITE_PRIVATE int sqlite3WhereIsOrdered(WhereInfo*); -SQLITE_PRIVATE int sqlite3WhereOrderedInnerLoop(WhereInfo*); SQLITE_PRIVATE int sqlite3WhereIsSorted(WhereInfo*); SQLITE_PRIVATE int sqlite3WhereContinueLabel(WhereInfo*); SQLITE_PRIVATE int sqlite3WhereBreakLabel(WhereInfo*); SQLITE_PRIVATE int sqlite3WhereOkOnePass(WhereInfo*, int*); #define ONEPASS_OFF 0 /* Use of ONEPASS not allowed */ @@ -16291,14 +16084,12 @@ #define SQLITE_ECEL_REF 0x04 /* Use ExprList.u.x.iOrderByCol */ SQLITE_PRIVATE void sqlite3ExprIfTrue(Parse*, Expr*, int, int); SQLITE_PRIVATE void sqlite3ExprIfFalse(Parse*, Expr*, int, int); SQLITE_PRIVATE void sqlite3ExprIfFalseDup(Parse*, Expr*, int, int); SQLITE_PRIVATE Table *sqlite3FindTable(sqlite3*,const char*, const char*); -#define LOCATE_VIEW 0x01 -#define LOCATE_NOERR 0x02 -SQLITE_PRIVATE Table *sqlite3LocateTable(Parse*,u32 flags,const char*, const char*); -SQLITE_PRIVATE Table *sqlite3LocateTableItem(Parse*,u32 flags,struct SrcList_item *); +SQLITE_PRIVATE Table *sqlite3LocateTable(Parse*,int isView,const char*, const char*); +SQLITE_PRIVATE Table *sqlite3LocateTableItem(Parse*,int isView,struct SrcList_item *); SQLITE_PRIVATE Index *sqlite3FindIndex(sqlite3*,const char*, const char*); SQLITE_PRIVATE void sqlite3UnlinkAndDeleteTable(sqlite3*,int,const char*); SQLITE_PRIVATE void sqlite3UnlinkAndDeleteIndex(sqlite3*,int,const char*); SQLITE_PRIVATE void sqlite3Vacuum(Parse*); SQLITE_PRIVATE int sqlite3RunVacuum(char**, sqlite3*); @@ -16306,11 +16097,10 @@ SQLITE_PRIVATE int sqlite3ExprCompare(Expr*, Expr*, int); SQLITE_PRIVATE int sqlite3ExprListCompare(ExprList*, ExprList*, int); SQLITE_PRIVATE int sqlite3ExprImpliesExpr(Expr*, Expr*, int); SQLITE_PRIVATE void sqlite3ExprAnalyzeAggregates(NameContext*, Expr*); SQLITE_PRIVATE void sqlite3ExprAnalyzeAggList(NameContext*,ExprList*); -SQLITE_PRIVATE int sqlite3ExprCoveredByIndex(Expr*, int iCur, Index *pIdx); SQLITE_PRIVATE int sqlite3FunctionUsesThisSrc(Expr*, SrcList*); SQLITE_PRIVATE Vdbe *sqlite3GetVdbe(Parse*); #ifndef SQLITE_OMIT_BUILTIN_TEST SQLITE_PRIVATE void sqlite3PrngSaveState(void); SQLITE_PRIVATE void sqlite3PrngRestoreState(void); @@ -16858,11 +16648,11 @@ #if defined(SQLITE_ENABLE_DBSTAT_VTAB) || defined(SQLITE_TEST) SQLITE_PRIVATE int sqlite3DbstatRegister(sqlite3*); #endif -#endif /* SQLITEINT_H */ +#endif /* _SQLITEINT_H_ */ /************** End of sqliteInt.h *******************************************/ /************** Begin file global.c ******************************************/ /* ** 2008 June 13 @@ -17193,19 +16983,10 @@ "CASE_SENSITIVE_LIKE", #endif #if SQLITE_CHECK_PAGES "CHECK_PAGES", #endif -#if defined(__clang__) && defined(__clang_major__) - "COMPILER=clang-" CTIMEOPT_VAL(__clang_major__) "." - CTIMEOPT_VAL(__clang_minor__) "." - CTIMEOPT_VAL(__clang_patchlevel__), -#elif defined(_MSC_VER) - "COMPILER=msvc-" CTIMEOPT_VAL(_MSC_VER), -#elif defined(__GNUC__) && defined(__VERSION__) - "COMPILER=gcc-" __VERSION__, -#endif #if SQLITE_COVERAGE_TEST "COVERAGE_TEST", #endif #if SQLITE_DEBUG "DEBUG", @@ -17221,11 +17002,11 @@ #endif #if SQLITE_DISABLE_LFS "DISABLE_LFS", #endif #if SQLITE_ENABLE_8_3_NAMES - "ENABLE_8_3_NAMES=" CTIMEOPT_VAL(SQLITE_ENABLE_8_3_NAMES), + "ENABLE_8_3_NAMES", #endif #if SQLITE_ENABLE_API_ARMOR "ENABLE_API_ARMOR", #endif #if SQLITE_ENABLE_ATOMIC_WRITE @@ -17635,12 +17416,12 @@ ** VDBE. This information used to all be at the top of the single ** source code file "vdbe.c". When that file became too big (over ** 6000 lines long) it was split up into several smaller files and ** this header information was factored out. */ -#ifndef SQLITE_VDBEINT_H -#define SQLITE_VDBEINT_H +#ifndef _VDBEINT_H_ +#define _VDBEINT_H_ /* ** The maximum number of times that a statement will try to reparse ** itself before giving up and returning SQLITE_SCHEMA. */ @@ -18178,11 +17959,11 @@ #else #define sqlite3VdbeMemExpandBlob(x) SQLITE_OK #define ExpandBlob(P) SQLITE_OK #endif -#endif /* !defined(SQLITE_VDBEINT_H) */ +#endif /* !defined(_VDBEINT_H_) */ /************** End of vdbeInt.h *********************************************/ /************** Continuing where we left off in status.c *********************/ /* @@ -18325,11 +18106,11 @@ sqlite3_mutex_leave(pMutex); (void)pMutex; /* Prevent warning when SQLITE_THREADSAFE=0 */ return SQLITE_OK; } SQLITE_API int SQLITE_STDCALL sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag){ - sqlite3_int64 iCur = 0, iHwtr = 0; + sqlite3_int64 iCur, iHwtr; int rc; #ifdef SQLITE_ENABLE_API_ARMOR if( pCurrent==0 || pHighwater==0 ) return SQLITE_MISUSE_BKPT; #endif rc = sqlite3_status64(op, &iCur, &iHwtr, resetFlag); @@ -18386,24 +18167,19 @@ /* ** Return an approximation for the amount of memory currently used ** by all pagers associated with the given database connection. The ** highwater mark is meaningless and is returned as zero. */ - case SQLITE_DBSTATUS_CACHE_USED_SHARED: case SQLITE_DBSTATUS_CACHE_USED: { int totalUsed = 0; int i; sqlite3BtreeEnterAll(db); for(i=0; inDb; i++){ Btree *pBt = db->aDb[i].pBt; if( pBt ){ Pager *pPager = sqlite3BtreePager(pBt); - int nByte = sqlite3PagerMemUsed(pPager); - if( op==SQLITE_DBSTATUS_CACHE_USED_SHARED ){ - nByte = nByte / sqlite3BtreeConnectionCount(pBt); - } - totalUsed += nByte; + totalUsed += sqlite3PagerMemUsed(pPager); } } sqlite3BtreeLeaveAll(db); *pCurrent = totalUsed; *pHighwater = 0; @@ -19633,10 +19409,11 @@ int argc, sqlite3_value **argv ){ time_t t; char *zFormat = (char *)sqlite3_user_data(context); + sqlite3 *db; sqlite3_int64 iT; struct tm *pTm; struct tm sNow; char zBuf[20]; @@ -19701,11 +19478,13 @@ ****************************************************************************** ** ** This file contains OS interface code that is common to all ** architectures. */ +#define _SQLITE_OS_C_ 1 /* #include "sqliteInt.h" */ +#undef _SQLITE_OS_C_ /* ** If we compile with the SQLITE_TEST macro set, then the following block ** of code will give us the ability to simulate a disk I/O error. This ** is used for testing the I/O recovery logic. @@ -23214,12 +22993,12 @@ ****************************************************************************** ** ** This file contains inline asm code for retrieving "high-performance" ** counters for x86 class CPUs. */ -#ifndef SQLITE_HWTIME_H -#define SQLITE_HWTIME_H +#ifndef _HWTIME_H_ +#define _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 @@ -23283,11 +23062,11 @@ */ SQLITE_PRIVATE sqlite_uint64 sqlite3Hwtime(void){ return ((sqlite_uint64)0); } #endif -#endif /* !defined(SQLITE_HWTIME_H) */ +#endif /* !defined(_HWTIME_H_) */ /************** End of hwtime.h **********************************************/ /************** Continuing where we left off in os_common.h ******************/ static sqlite_uint64 g_start; @@ -23373,12 +23152,12 @@ ** ****************************************************************************** ** ** This file contains code that is specific to Windows. */ -#ifndef SQLITE_OS_WIN_H -#define SQLITE_OS_WIN_H +#ifndef _OS_WIN_H_ +#define _OS_WIN_H_ /* ** Include the primary Windows SDK header file. */ #include "windows.h" @@ -23446,11 +23225,11 @@ # define SQLITE_OS_WIN_THREADS 1 #else # define SQLITE_OS_WIN_THREADS 0 #endif -#endif /* SQLITE_OS_WIN_H */ +#endif /* _OS_WIN_H_ */ /************** End of os_win.h **********************************************/ /************** Continuing where we left off in mutex_w32.c ******************/ #endif @@ -26197,16 +25976,10 @@ } sqlite3TreeViewLine(pView, "RAISE %s(%Q)", zType, pExpr->u.zToken); break; } #endif - case TK_MATCH: { - sqlite3TreeViewLine(pView, "MATCH {%d:%d}%s", - pExpr->iTable, pExpr->iColumn, zFlgs); - sqlite3TreeViewExpr(pView, pExpr->pRight, 0); - break; - } default: { sqlite3TreeViewLine(pView, "op=%d", pExpr->op); break; } } @@ -28986,21 +28759,21 @@ /* 27 */ "Or" OpHelp("r[P3]=(r[P1] || r[P2])"), /* 28 */ "And" OpHelp("r[P3]=(r[P1] && r[P2])"), /* 29 */ "NoConflict" OpHelp("key=r[P3@P4]"), /* 30 */ "NotFound" OpHelp("key=r[P3@P4]"), /* 31 */ "Found" OpHelp("key=r[P3@P4]"), - /* 32 */ "SeekRowid" OpHelp("intkey=r[P3]"), - /* 33 */ "NotExists" OpHelp("intkey=r[P3]"), + /* 32 */ "NotExists" OpHelp("intkey=r[P3]"), + /* 33 */ "Last" OpHelp(""), /* 34 */ "IsNull" OpHelp("if r[P1]==NULL goto P2"), /* 35 */ "NotNull" OpHelp("if r[P1]!=NULL goto P2"), /* 36 */ "Ne" OpHelp("if r[P1]!=r[P3] goto P2"), /* 37 */ "Eq" OpHelp("if r[P1]==r[P3] goto P2"), /* 38 */ "Gt" OpHelp("if r[P1]>r[P3] goto P2"), /* 39 */ "Le" OpHelp("if r[P1]<=r[P3] goto P2"), /* 40 */ "Lt" OpHelp("if r[P1]=r[P3] goto P2"), - /* 42 */ "Last" OpHelp(""), + /* 42 */ "SorterSort" OpHelp(""), /* 43 */ "BitAnd" OpHelp("r[P3]=r[P1]&r[P2]"), /* 44 */ "BitOr" OpHelp("r[P3]=r[P1]|r[P2]"), /* 45 */ "ShiftLeft" OpHelp("r[P3]=r[P2]<>r[P1]"), /* 47 */ "Add" OpHelp("r[P3]=r[P1]+r[P2]"), @@ -29007,119 +28780,118 @@ /* 48 */ "Subtract" OpHelp("r[P3]=r[P2]-r[P1]"), /* 49 */ "Multiply" OpHelp("r[P3]=r[P1]*r[P2]"), /* 50 */ "Divide" OpHelp("r[P3]=r[P2]/r[P1]"), /* 51 */ "Remainder" OpHelp("r[P3]=r[P2]%r[P1]"), /* 52 */ "Concat" OpHelp("r[P3]=r[P2]+r[P1]"), - /* 53 */ "SorterSort" OpHelp(""), + /* 53 */ "Sort" OpHelp(""), /* 54 */ "BitNot" OpHelp("r[P1]= ~r[P1]"), - /* 55 */ "Sort" OpHelp(""), - /* 56 */ "Rewind" OpHelp(""), - /* 57 */ "IdxLE" OpHelp("key=r[P3@P4]"), - /* 58 */ "IdxGT" OpHelp("key=r[P3@P4]"), - /* 59 */ "IdxLT" OpHelp("key=r[P3@P4]"), - /* 60 */ "IdxGE" OpHelp("key=r[P3@P4]"), - /* 61 */ "RowSetRead" OpHelp("r[P3]=rowset(P1)"), - /* 62 */ "RowSetTest" OpHelp("if r[P3] in rowset(P1) goto P2"), - /* 63 */ "Program" OpHelp(""), - /* 64 */ "FkIfZero" OpHelp("if fkctr[P1]==0 goto P2"), - /* 65 */ "IfPos" OpHelp("if r[P1]>0 then r[P1]-=P3, goto P2"), - /* 66 */ "IfNotZero" OpHelp("if r[P1]!=0 then r[P1]-=P3, goto P2"), - /* 67 */ "DecrJumpZero" OpHelp("if (--r[P1])==0 goto P2"), - /* 68 */ "IncrVacuum" OpHelp(""), - /* 69 */ "VNext" OpHelp(""), - /* 70 */ "Init" OpHelp("Start at P2"), - /* 71 */ "Return" OpHelp(""), - /* 72 */ "EndCoroutine" OpHelp(""), - /* 73 */ "HaltIfNull" OpHelp("if r[P3]=null halt"), - /* 74 */ "Halt" OpHelp(""), - /* 75 */ "Integer" OpHelp("r[P2]=P1"), - /* 76 */ "Int64" OpHelp("r[P2]=P4"), - /* 77 */ "String" OpHelp("r[P2]='P4' (len=P1)"), - /* 78 */ "Null" OpHelp("r[P2..P3]=NULL"), - /* 79 */ "SoftNull" OpHelp("r[P1]=NULL"), - /* 80 */ "Blob" OpHelp("r[P2]=P4 (len=P1)"), - /* 81 */ "Variable" OpHelp("r[P2]=parameter(P1,P4)"), - /* 82 */ "Move" OpHelp("r[P2@P3]=r[P1@P3]"), - /* 83 */ "Copy" OpHelp("r[P2@P3+1]=r[P1@P3+1]"), - /* 84 */ "SCopy" OpHelp("r[P2]=r[P1]"), - /* 85 */ "IntCopy" OpHelp("r[P2]=r[P1]"), - /* 86 */ "ResultRow" OpHelp("output=r[P1@P2]"), - /* 87 */ "CollSeq" OpHelp(""), - /* 88 */ "Function0" OpHelp("r[P3]=func(r[P2@P5])"), - /* 89 */ "Function" OpHelp("r[P3]=func(r[P2@P5])"), - /* 90 */ "AddImm" OpHelp("r[P1]=r[P1]+P2"), - /* 91 */ "RealAffinity" OpHelp(""), - /* 92 */ "Cast" OpHelp("affinity(r[P1])"), - /* 93 */ "Permutation" OpHelp(""), - /* 94 */ "Compare" OpHelp("r[P1@P3] <-> r[P2@P3]"), - /* 95 */ "Column" OpHelp("r[P3]=PX"), - /* 96 */ "Affinity" OpHelp("affinity(r[P1@P2])"), + /* 55 */ "Rewind" OpHelp(""), + /* 56 */ "IdxLE" OpHelp("key=r[P3@P4]"), + /* 57 */ "IdxGT" OpHelp("key=r[P3@P4]"), + /* 58 */ "IdxLT" OpHelp("key=r[P3@P4]"), + /* 59 */ "IdxGE" OpHelp("key=r[P3@P4]"), + /* 60 */ "RowSetRead" OpHelp("r[P3]=rowset(P1)"), + /* 61 */ "RowSetTest" OpHelp("if r[P3] in rowset(P1) goto P2"), + /* 62 */ "Program" OpHelp(""), + /* 63 */ "FkIfZero" OpHelp("if fkctr[P1]==0 goto P2"), + /* 64 */ "IfPos" OpHelp("if r[P1]>0 then r[P1]-=P3, goto P2"), + /* 65 */ "IfNotZero" OpHelp("if r[P1]!=0 then r[P1]-=P3, goto P2"), + /* 66 */ "DecrJumpZero" OpHelp("if (--r[P1])==0 goto P2"), + /* 67 */ "IncrVacuum" OpHelp(""), + /* 68 */ "VNext" OpHelp(""), + /* 69 */ "Init" OpHelp("Start at P2"), + /* 70 */ "Return" OpHelp(""), + /* 71 */ "EndCoroutine" OpHelp(""), + /* 72 */ "HaltIfNull" OpHelp("if r[P3]=null halt"), + /* 73 */ "Halt" OpHelp(""), + /* 74 */ "Integer" OpHelp("r[P2]=P1"), + /* 75 */ "Int64" OpHelp("r[P2]=P4"), + /* 76 */ "String" OpHelp("r[P2]='P4' (len=P1)"), + /* 77 */ "Null" OpHelp("r[P2..P3]=NULL"), + /* 78 */ "SoftNull" OpHelp("r[P1]=NULL"), + /* 79 */ "Blob" OpHelp("r[P2]=P4 (len=P1)"), + /* 80 */ "Variable" OpHelp("r[P2]=parameter(P1,P4)"), + /* 81 */ "Move" OpHelp("r[P2@P3]=r[P1@P3]"), + /* 82 */ "Copy" OpHelp("r[P2@P3+1]=r[P1@P3+1]"), + /* 83 */ "SCopy" OpHelp("r[P2]=r[P1]"), + /* 84 */ "IntCopy" OpHelp("r[P2]=r[P1]"), + /* 85 */ "ResultRow" OpHelp("output=r[P1@P2]"), + /* 86 */ "CollSeq" OpHelp(""), + /* 87 */ "Function0" OpHelp("r[P3]=func(r[P2@P5])"), + /* 88 */ "Function" OpHelp("r[P3]=func(r[P2@P5])"), + /* 89 */ "AddImm" OpHelp("r[P1]=r[P1]+P2"), + /* 90 */ "RealAffinity" OpHelp(""), + /* 91 */ "Cast" OpHelp("affinity(r[P1])"), + /* 92 */ "Permutation" OpHelp(""), + /* 93 */ "Compare" OpHelp("r[P1@P3] <-> r[P2@P3]"), + /* 94 */ "Column" OpHelp("r[P3]=PX"), + /* 95 */ "Affinity" OpHelp("affinity(r[P1@P2])"), + /* 96 */ "MakeRecord" OpHelp("r[P3]=mkrec(r[P1@P2])"), /* 97 */ "String8" OpHelp("r[P2]='P4'"), - /* 98 */ "MakeRecord" OpHelp("r[P3]=mkrec(r[P1@P2])"), - /* 99 */ "Count" OpHelp("r[P2]=count()"), - /* 100 */ "ReadCookie" OpHelp(""), - /* 101 */ "SetCookie" OpHelp(""), - /* 102 */ "ReopenIdx" OpHelp("root=P2 iDb=P3"), - /* 103 */ "OpenRead" OpHelp("root=P2 iDb=P3"), - /* 104 */ "OpenWrite" OpHelp("root=P2 iDb=P3"), - /* 105 */ "OpenAutoindex" OpHelp("nColumn=P2"), - /* 106 */ "OpenEphemeral" OpHelp("nColumn=P2"), - /* 107 */ "SorterOpen" OpHelp(""), - /* 108 */ "SequenceTest" OpHelp("if( cursor[P1].ctr++ ) pc = P2"), - /* 109 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"), - /* 110 */ "Close" OpHelp(""), - /* 111 */ "ColumnsUsed" OpHelp(""), - /* 112 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"), - /* 113 */ "NewRowid" OpHelp("r[P2]=rowid"), - /* 114 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"), - /* 115 */ "InsertInt" OpHelp("intkey=P3 data=r[P2]"), - /* 116 */ "Delete" OpHelp(""), - /* 117 */ "ResetCount" OpHelp(""), - /* 118 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"), - /* 119 */ "SorterData" OpHelp("r[P2]=data"), - /* 120 */ "RowKey" OpHelp("r[P2]=key"), - /* 121 */ "RowData" OpHelp("r[P2]=data"), - /* 122 */ "Rowid" OpHelp("r[P2]=rowid"), - /* 123 */ "NullRow" OpHelp(""), - /* 124 */ "SorterInsert" OpHelp(""), - /* 125 */ "IdxInsert" OpHelp("key=r[P2]"), - /* 126 */ "IdxDelete" OpHelp("key=r[P2@P3]"), - /* 127 */ "Seek" OpHelp("Move P3 to P1.rowid"), - /* 128 */ "IdxRowid" OpHelp("r[P2]=rowid"), - /* 129 */ "Destroy" OpHelp(""), - /* 130 */ "Clear" OpHelp(""), - /* 131 */ "ResetSorter" OpHelp(""), - /* 132 */ "CreateIndex" OpHelp("r[P2]=root iDb=P1"), + /* 98 */ "Count" OpHelp("r[P2]=count()"), + /* 99 */ "ReadCookie" OpHelp(""), + /* 100 */ "SetCookie" OpHelp(""), + /* 101 */ "ReopenIdx" OpHelp("root=P2 iDb=P3"), + /* 102 */ "OpenRead" OpHelp("root=P2 iDb=P3"), + /* 103 */ "OpenWrite" OpHelp("root=P2 iDb=P3"), + /* 104 */ "OpenAutoindex" OpHelp("nColumn=P2"), + /* 105 */ "OpenEphemeral" OpHelp("nColumn=P2"), + /* 106 */ "SorterOpen" OpHelp(""), + /* 107 */ "SequenceTest" OpHelp("if( cursor[P1].ctr++ ) pc = P2"), + /* 108 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"), + /* 109 */ "Close" OpHelp(""), + /* 110 */ "ColumnsUsed" OpHelp(""), + /* 111 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"), + /* 112 */ "NewRowid" OpHelp("r[P2]=rowid"), + /* 113 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"), + /* 114 */ "InsertInt" OpHelp("intkey=P3 data=r[P2]"), + /* 115 */ "Delete" OpHelp(""), + /* 116 */ "ResetCount" OpHelp(""), + /* 117 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"), + /* 118 */ "SorterData" OpHelp("r[P2]=data"), + /* 119 */ "RowKey" OpHelp("r[P2]=key"), + /* 120 */ "RowData" OpHelp("r[P2]=data"), + /* 121 */ "Rowid" OpHelp("r[P2]=rowid"), + /* 122 */ "NullRow" OpHelp(""), + /* 123 */ "SorterInsert" OpHelp(""), + /* 124 */ "IdxInsert" OpHelp("key=r[P2]"), + /* 125 */ "IdxDelete" OpHelp("key=r[P2@P3]"), + /* 126 */ "Seek" OpHelp("Move P3 to P1.rowid"), + /* 127 */ "IdxRowid" OpHelp("r[P2]=rowid"), + /* 128 */ "Destroy" OpHelp(""), + /* 129 */ "Clear" OpHelp(""), + /* 130 */ "ResetSorter" OpHelp(""), + /* 131 */ "CreateIndex" OpHelp("r[P2]=root iDb=P1"), + /* 132 */ "CreateTable" OpHelp("r[P2]=root iDb=P1"), /* 133 */ "Real" OpHelp("r[P2]=P4"), - /* 134 */ "CreateTable" OpHelp("r[P2]=root iDb=P1"), - /* 135 */ "ParseSchema" OpHelp(""), - /* 136 */ "LoadAnalysis" OpHelp(""), - /* 137 */ "DropTable" OpHelp(""), - /* 138 */ "DropIndex" OpHelp(""), - /* 139 */ "DropTrigger" OpHelp(""), - /* 140 */ "IntegrityCk" OpHelp(""), - /* 141 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"), - /* 142 */ "Param" OpHelp(""), - /* 143 */ "FkCounter" OpHelp("fkctr[P1]+=P2"), - /* 144 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"), - /* 145 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"), - /* 146 */ "AggStep0" OpHelp("accum=r[P3] step(r[P2@P5])"), - /* 147 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"), - /* 148 */ "AggFinal" OpHelp("accum=r[P1] N=P2"), - /* 149 */ "Expire" OpHelp(""), - /* 150 */ "TableLock" OpHelp("iDb=P1 root=P2 write=P3"), - /* 151 */ "VBegin" OpHelp(""), - /* 152 */ "VCreate" OpHelp(""), - /* 153 */ "VDestroy" OpHelp(""), - /* 154 */ "VOpen" OpHelp(""), - /* 155 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"), - /* 156 */ "VRename" OpHelp(""), - /* 157 */ "Pagecount" OpHelp(""), - /* 158 */ "MaxPgcnt" OpHelp(""), - /* 159 */ "CursorHint" OpHelp(""), - /* 160 */ "Noop" OpHelp(""), - /* 161 */ "Explain" OpHelp(""), + /* 134 */ "ParseSchema" OpHelp(""), + /* 135 */ "LoadAnalysis" OpHelp(""), + /* 136 */ "DropTable" OpHelp(""), + /* 137 */ "DropIndex" OpHelp(""), + /* 138 */ "DropTrigger" OpHelp(""), + /* 139 */ "IntegrityCk" OpHelp(""), + /* 140 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"), + /* 141 */ "Param" OpHelp(""), + /* 142 */ "FkCounter" OpHelp("fkctr[P1]+=P2"), + /* 143 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"), + /* 144 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"), + /* 145 */ "AggStep0" OpHelp("accum=r[P3] step(r[P2@P5])"), + /* 146 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"), + /* 147 */ "AggFinal" OpHelp("accum=r[P1] N=P2"), + /* 148 */ "Expire" OpHelp(""), + /* 149 */ "TableLock" OpHelp("iDb=P1 root=P2 write=P3"), + /* 150 */ "VBegin" OpHelp(""), + /* 151 */ "VCreate" OpHelp(""), + /* 152 */ "VDestroy" OpHelp(""), + /* 153 */ "VOpen" OpHelp(""), + /* 154 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"), + /* 155 */ "VRename" OpHelp(""), + /* 156 */ "Pagecount" OpHelp(""), + /* 157 */ "MaxPgcnt" OpHelp(""), + /* 158 */ "CursorHint" OpHelp(""), + /* 159 */ "Noop" OpHelp(""), + /* 160 */ "Explain" OpHelp(""), }; return azName[i]; } #endif @@ -29465,12 +29237,12 @@ ****************************************************************************** ** ** This file contains inline asm code for retrieving "high-performance" ** counters for x86 class CPUs. */ -#ifndef SQLITE_HWTIME_H -#define SQLITE_HWTIME_H +#ifndef _HWTIME_H_ +#define _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 @@ -29534,11 +29306,11 @@ */ SQLITE_PRIVATE sqlite_uint64 sqlite3Hwtime(void){ return ((sqlite_uint64)0); } #endif -#endif /* !defined(SQLITE_HWTIME_H) */ +#endif /* !defined(_HWTIME_H_) */ /************** End of hwtime.h **********************************************/ /************** Continuing where we left off in os_common.h ******************/ static sqlite_uint64 g_start; @@ -36994,12 +36766,12 @@ ****************************************************************************** ** ** This file contains inline asm code for retrieving "high-performance" ** counters for x86 class CPUs. */ -#ifndef SQLITE_HWTIME_H -#define SQLITE_HWTIME_H +#ifndef _HWTIME_H_ +#define _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 @@ -37063,11 +36835,11 @@ */ SQLITE_PRIVATE sqlite_uint64 sqlite3Hwtime(void){ return ((sqlite_uint64)0); } #endif -#endif /* !defined(SQLITE_HWTIME_H) */ +#endif /* !defined(_HWTIME_H_) */ /************** End of hwtime.h **********************************************/ /************** Continuing where we left off in os_common.h ******************/ static sqlite_uint64 g_start; @@ -37404,21 +37176,10 @@ sqlite3_int64 mmapSizeActual; /* Actual size of mapped region */ sqlite3_int64 mmapSizeMax; /* Configured FCNTL_MMAP_SIZE value */ #endif }; -/* -** The winVfsAppData structure is used for the pAppData member for all of the -** Win32 VFS variants. -*/ -typedef struct winVfsAppData winVfsAppData; -struct winVfsAppData { - const sqlite3_io_methods *pMethod; /* The file I/O methods to use. */ - void *pAppData; /* The extra pAppData, if any. */ - BOOL bNoLock; /* Non-zero if locking is disabled. */ -}; - /* ** Allowed values for winFile.ctrlFlags */ #define WINFILE_RDONLY 0x02 /* Connection is read only */ #define WINFILE_PERSIST_WAL 0x04 /* Persistent WAL mode */ @@ -39736,16 +39497,11 @@ rc = osCloseHandle(pFile->h); /* SimulateIOError( rc=0; cnt=MX_CLOSE_ATTEMPT; ); */ }while( rc==0 && ++cnt < MX_CLOSE_ATTEMPT && (sqlite3_win32_sleep(100), 1) ); #if SQLITE_OS_WINCE #define WINCE_DELETION_ATTEMPTS 3 - { - winVfsAppData *pAppData = (winVfsAppData*)pFile->pVfs->pAppData; - if( pAppData==NULL || !pAppData->bNoLock ){ - winceDestroyLock(pFile); - } - } + winceDestroyLock(pFile); if( pFile->zDeleteOnClose ){ int cnt = 0; while( osDeleteFileW(pFile->zDeleteOnClose)==0 && osGetFileAttributesW(pFile->zDeleteOnClose)!=0xffffffff @@ -40473,48 +40229,10 @@ OSTRACE(("UNLOCK file=%p, lock=%d, rc=%s\n", pFile->h, pFile->locktype, sqlite3ErrName(rc))); return rc; } -/****************************************************************************** -****************************** No-op Locking ********************************** -** -** Of the various locking implementations available, this is by far the -** simplest: locking is ignored. No attempt is made to lock the database -** file for reading or writing. -** -** This locking mode is appropriate for use on read-only databases -** (ex: databases that are burned into CD-ROM, for example.) It can -** also be used if the application employs some external mechanism to -** prevent simultaneous access of the same database by two or more -** database connections. But there is a serious risk of database -** corruption if this locking mode is used in situations where multiple -** database connections are accessing the same database file at the same -** time and one or more of those connections are writing. -*/ - -static int winNolockLock(sqlite3_file *id, int locktype){ - UNUSED_PARAMETER(id); - UNUSED_PARAMETER(locktype); - return SQLITE_OK; -} - -static int winNolockCheckReservedLock(sqlite3_file *id, int *pResOut){ - UNUSED_PARAMETER(id); - UNUSED_PARAMETER(pResOut); - return SQLITE_OK; -} - -static int winNolockUnlock(sqlite3_file *id, int locktype){ - UNUSED_PARAMETER(id); - UNUSED_PARAMETER(locktype); - return SQLITE_OK; -} - -/******************* End of the no-op lock implementation ********************* -******************************************************************************/ - /* ** If *pArg is initially negative then this is a query. Set *pArg to ** 1 or 0 depending on whether or not bit mask of pFile->ctrlFlags is set. ** ** If *pArg is 0 or 1, then clear or set the mask bit of pFile->ctrlFlags. @@ -40789,16 +40507,16 @@ #define WIN_SHM_DMS (WIN_SHM_BASE+SQLITE_SHM_NLOCK) /* deadman switch */ /* ** Apply advisory locks for all n bytes beginning at ofst. */ -#define WINSHM_UNLCK 1 -#define WINSHM_RDLCK 2 -#define WINSHM_WRLCK 3 +#define _SHM_UNLCK 1 +#define _SHM_RDLCK 2 +#define _SHM_WRLCK 3 static int winShmSystemLock( winShmNode *pFile, /* Apply locks to this open shared-memory segment */ - int lockType, /* WINSHM_UNLCK, WINSHM_RDLCK, or WINSHM_WRLCK */ + int lockType, /* _SHM_UNLCK, _SHM_RDLCK, or _SHM_WRLCK */ int ofst, /* Offset to first byte to be locked/unlocked */ int nByte /* Number of bytes to lock or unlock */ ){ int rc = 0; /* Result code form Lock/UnlockFileEx() */ @@ -40807,16 +40525,16 @@ OSTRACE(("SHM-LOCK file=%p, lock=%d, offset=%d, size=%d\n", pFile->hFile.h, lockType, ofst, nByte)); /* Release/Acquire the system-level lock */ - if( lockType==WINSHM_UNLCK ){ + if( lockType==_SHM_UNLCK ){ rc = winUnlockFile(&pFile->hFile.h, ofst, 0, nByte, 0); }else{ /* Initialize the locking parameters */ DWORD dwFlags = LOCKFILE_FAIL_IMMEDIATELY; - if( lockType == WINSHM_WRLCK ) dwFlags |= LOCKFILE_EXCLUSIVE_LOCK; + if( lockType == _SHM_WRLCK ) dwFlags |= LOCKFILE_EXCLUSIVE_LOCK; rc = winLockFile(&pFile->hFile.h, dwFlags, ofst, 0, nByte, 0); } if( rc!= 0 ){ rc = SQLITE_OK; @@ -40824,11 +40542,11 @@ pFile->lastErrno = osGetLastError(); rc = SQLITE_BUSY; } OSTRACE(("SHM-LOCK file=%p, func=%s, errno=%lu, rc=%s\n", - pFile->hFile.h, (lockType == WINSHM_UNLCK) ? "winUnlockFile" : + pFile->hFile.h, (lockType == _SHM_UNLCK) ? "winUnlockFile" : "winLockFile", pFile->lastErrno, sqlite3ErrName(rc))); return rc; } @@ -40952,20 +40670,20 @@ } /* Check to see if another process is holding the dead-man switch. ** If not, truncate the file to zero length. */ - if( winShmSystemLock(pShmNode, WINSHM_WRLCK, WIN_SHM_DMS, 1)==SQLITE_OK ){ + if( winShmSystemLock(pShmNode, _SHM_WRLCK, WIN_SHM_DMS, 1)==SQLITE_OK ){ rc = winTruncate((sqlite3_file *)&pShmNode->hFile, 0); if( rc!=SQLITE_OK ){ rc = winLogError(SQLITE_IOERR_SHMOPEN, osGetLastError(), "winOpenShm", pDbFd->zPath); } } if( rc==SQLITE_OK ){ - winShmSystemLock(pShmNode, WINSHM_UNLCK, WIN_SHM_DMS, 1); - rc = winShmSystemLock(pShmNode, WINSHM_RDLCK, WIN_SHM_DMS, 1); + winShmSystemLock(pShmNode, _SHM_UNLCK, WIN_SHM_DMS, 1); + rc = winShmSystemLock(pShmNode, _SHM_RDLCK, WIN_SHM_DMS, 1); } if( rc ) goto shm_open_err; } /* Make the new connection a child of the winShmNode */ @@ -40990,11 +40708,11 @@ sqlite3_mutex_leave(pShmNode->mutex); return SQLITE_OK; /* Jump here on any error */ shm_open_err: - winShmSystemLock(pShmNode, WINSHM_UNLCK, WIN_SHM_DMS, 1); + winShmSystemLock(pShmNode, _SHM_UNLCK, WIN_SHM_DMS, 1); winShmPurge(pDbFd->pVfs, 0); /* This call frees pShmNode if required */ sqlite3_free(p); sqlite3_free(pNew); winShmLeaveMutex(); return rc; @@ -41079,11 +40797,11 @@ allMask |= pX->sharedMask; } /* Unlock the system-level locks */ if( (mask & allMask)==0 ){ - rc = winShmSystemLock(pShmNode, WINSHM_UNLCK, ofst+WIN_SHM_BASE, n); + rc = winShmSystemLock(pShmNode, _SHM_UNLCK, ofst+WIN_SHM_BASE, n); }else{ rc = SQLITE_OK; } /* Undo the local locks */ @@ -41107,11 +40825,11 @@ } /* Get shared locks at the system level, if necessary */ if( rc==SQLITE_OK ){ if( (allShared & mask)==0 ){ - rc = winShmSystemLock(pShmNode, WINSHM_RDLCK, ofst+WIN_SHM_BASE, n); + rc = winShmSystemLock(pShmNode, _SHM_RDLCK, ofst+WIN_SHM_BASE, n); }else{ rc = SQLITE_OK; } } @@ -41132,11 +40850,11 @@ /* Get the exclusive locks at the system level. Then if successful ** also mark the local connection as being locked. */ if( rc==SQLITE_OK ){ - rc = winShmSystemLock(pShmNode, WINSHM_WRLCK, ofst+WIN_SHM_BASE, n); + rc = winShmSystemLock(pShmNode, _SHM_WRLCK, ofst+WIN_SHM_BASE, n); if( rc==SQLITE_OK ){ assert( (p->sharedMask & mask)==0 ); p->exclMask |= mask; } } @@ -41575,48 +41293,10 @@ winShmUnmap, /* xShmUnmap */ winFetch, /* xFetch */ winUnfetch /* xUnfetch */ }; -/* -** This vector defines all the methods that can operate on an -** sqlite3_file for win32 without performing any locking. -*/ -static const sqlite3_io_methods winIoNolockMethod = { - 3, /* iVersion */ - winClose, /* xClose */ - winRead, /* xRead */ - winWrite, /* xWrite */ - winTruncate, /* xTruncate */ - winSync, /* xSync */ - winFileSize, /* xFileSize */ - winNolockLock, /* xLock */ - winNolockUnlock, /* xUnlock */ - winNolockCheckReservedLock, /* xCheckReservedLock */ - winFileControl, /* xFileControl */ - winSectorSize, /* xSectorSize */ - winDeviceCharacteristics, /* xDeviceCharacteristics */ - winShmMap, /* xShmMap */ - winShmLock, /* xShmLock */ - winShmBarrier, /* xShmBarrier */ - winShmUnmap, /* xShmUnmap */ - winFetch, /* xFetch */ - winUnfetch /* xUnfetch */ -}; - -static winVfsAppData winAppData = { - &winIoMethod, /* pMethod */ - 0, /* pAppData */ - 0 /* bNoLock */ -}; - -static winVfsAppData winNolockAppData = { - &winIoNolockMethod, /* pMethod */ - 0, /* pAppData */ - 1 /* bNoLock */ -}; - /**************************************************************************** **************************** sqlite3_vfs methods **************************** ** ** This division contains the implementation of methods on the ** sqlite3_vfs object. @@ -41945,11 +41625,11 @@ /* ** Open a file. */ static int winOpen( - sqlite3_vfs *pVfs, /* Used to get maximum path length and AppData */ + sqlite3_vfs *pVfs, /* Used to get maximum path name length */ const char *zName, /* Name of the file (UTF-8) */ sqlite3_file *id, /* Write the SQLite file handle here */ int flags, /* Open mode flags */ int *pOutFlags /* Status return flags */ ){ @@ -41960,11 +41640,10 @@ DWORD dwCreationDisposition; DWORD dwFlagsAndAttributes = 0; #if SQLITE_OS_WINCE int isTemp = 0; #endif - winVfsAppData *pAppData; winFile *pFile = (winFile*)id; void *zConverted; /* Filename in OS encoding */ const char *zUtf8Name = zName; /* Filename in UTF-8 encoding */ int cnt = 0; @@ -42182,24 +41861,19 @@ OSTRACE(("OPEN file=%p, name=%s, access=%lx, pOutFlags=%p, *pOutFlags=%d, " "rc=%s\n", h, zUtf8Name, dwDesiredAccess, pOutFlags, pOutFlags ? *pOutFlags : 0, (h==INVALID_HANDLE_VALUE) ? "failed" : "ok")); - pAppData = (winVfsAppData*)pVfs->pAppData; - #if SQLITE_OS_WINCE - { - if( isReadWrite && eType==SQLITE_OPEN_MAIN_DB - && ((pAppData==NULL) || !pAppData->bNoLock) - && (rc = winceCreateLock(zName, pFile))!=SQLITE_OK - ){ - osCloseHandle(h); - sqlite3_free(zConverted); - sqlite3_free(zTmpname); - OSTRACE(("OPEN-CE-LOCK name=%s, rc=%s\n", zName, sqlite3ErrName(rc))); - return rc; - } + if( isReadWrite && eType==SQLITE_OPEN_MAIN_DB + && (rc = winceCreateLock(zName, pFile))!=SQLITE_OK + ){ + osCloseHandle(h); + sqlite3_free(zConverted); + sqlite3_free(zTmpname); + OSTRACE(("OPEN-CE-LOCK name=%s, rc=%s\n", zName, sqlite3ErrName(rc))); + return rc; } if( isTemp ){ pFile->zDeleteOnClose = zConverted; }else #endif @@ -42206,11 +41880,11 @@ { sqlite3_free(zConverted); } sqlite3_free(zTmpname); - pFile->pMethod = pAppData ? pAppData->pMethod : &winIoMethod; + pFile->pMethod = &winIoMethod; pFile->pVfs = pVfs; pFile->h = h; if( isReadonly ){ pFile->ctrlFlags |= WINFILE_RDONLY; } @@ -42481,22 +42155,10 @@ sqlite3_vfs *pVfs, /* Pointer to vfs object */ const char *zRelative, /* Possibly relative input path */ int nFull, /* Size of output buffer in bytes */ char *zFull /* Output buffer */ ){ -#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && !defined(__CYGWIN__) - DWORD nByte; - void *zConverted; - char *zOut; -#endif - - /* If this path name begins with "/X:", where "X" is any alphabetic - ** character, discard the initial "/" from the pathname. - */ - if( zRelative[0]=='/' && winIsDriveLetterAndColon(zRelative+1) ){ - zRelative++; - } #if defined(__CYGWIN__) SimulateIOError( return SQLITE_ERROR ); UNUSED_PARAMETER(nFull); assert( nFull>=pVfs->mxPathname ); @@ -42571,10 +42233,21 @@ } return SQLITE_OK; #endif #if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && !defined(__CYGWIN__) + DWORD nByte; + void *zConverted; + char *zOut; + + /* If this path name begins with "/X:", where "X" is any alphabetic + ** character, discard the initial "/" from the pathname. + */ + if( zRelative[0]=='/' && winIsDriveLetterAndColon(zRelative+1) ){ + zRelative++; + } + /* It's odd to simulate an io-error here, but really this is just ** using the io-error infrastructure to test that SQLite handles this ** function failing. This function could fail if, for example, the ** current working directory has been unlinked. */ @@ -42929,107 +42602,57 @@ /* ** Initialize and deinitialize the operating system interface. */ SQLITE_API int SQLITE_STDCALL sqlite3_os_init(void){ static sqlite3_vfs winVfs = { - 3, /* iVersion */ - sizeof(winFile), /* szOsFile */ + 3, /* iVersion */ + sizeof(winFile), /* szOsFile */ SQLITE_WIN32_MAX_PATH_BYTES, /* mxPathname */ - 0, /* pNext */ - "win32", /* zName */ - &winAppData, /* pAppData */ - winOpen, /* xOpen */ - winDelete, /* xDelete */ - winAccess, /* xAccess */ - winFullPathname, /* xFullPathname */ - winDlOpen, /* xDlOpen */ - winDlError, /* xDlError */ - winDlSym, /* xDlSym */ - winDlClose, /* xDlClose */ - winRandomness, /* xRandomness */ - winSleep, /* xSleep */ - winCurrentTime, /* xCurrentTime */ - winGetLastError, /* xGetLastError */ - winCurrentTimeInt64, /* xCurrentTimeInt64 */ - winSetSystemCall, /* xSetSystemCall */ - winGetSystemCall, /* xGetSystemCall */ - winNextSystemCall, /* xNextSystemCall */ + 0, /* pNext */ + "win32", /* zName */ + 0, /* pAppData */ + winOpen, /* xOpen */ + winDelete, /* xDelete */ + winAccess, /* xAccess */ + winFullPathname, /* xFullPathname */ + winDlOpen, /* xDlOpen */ + winDlError, /* xDlError */ + winDlSym, /* xDlSym */ + winDlClose, /* xDlClose */ + winRandomness, /* xRandomness */ + winSleep, /* xSleep */ + winCurrentTime, /* xCurrentTime */ + winGetLastError, /* xGetLastError */ + winCurrentTimeInt64, /* xCurrentTimeInt64 */ + winSetSystemCall, /* xSetSystemCall */ + winGetSystemCall, /* xGetSystemCall */ + winNextSystemCall, /* xNextSystemCall */ }; #if defined(SQLITE_WIN32_HAS_WIDE) static sqlite3_vfs winLongPathVfs = { - 3, /* iVersion */ - sizeof(winFile), /* szOsFile */ - SQLITE_WINNT_MAX_PATH_BYTES, /* mxPathname */ - 0, /* pNext */ - "win32-longpath", /* zName */ - &winAppData, /* pAppData */ - winOpen, /* xOpen */ - winDelete, /* xDelete */ - winAccess, /* xAccess */ - winFullPathname, /* xFullPathname */ - winDlOpen, /* xDlOpen */ - winDlError, /* xDlError */ - winDlSym, /* xDlSym */ - winDlClose, /* xDlClose */ - winRandomness, /* xRandomness */ - winSleep, /* xSleep */ - winCurrentTime, /* xCurrentTime */ - winGetLastError, /* xGetLastError */ - winCurrentTimeInt64, /* xCurrentTimeInt64 */ - winSetSystemCall, /* xSetSystemCall */ - winGetSystemCall, /* xGetSystemCall */ - winNextSystemCall, /* xNextSystemCall */ - }; -#endif - static sqlite3_vfs winNolockVfs = { - 3, /* iVersion */ - sizeof(winFile), /* szOsFile */ - SQLITE_WIN32_MAX_PATH_BYTES, /* mxPathname */ - 0, /* pNext */ - "win32-none", /* zName */ - &winNolockAppData, /* pAppData */ - winOpen, /* xOpen */ - winDelete, /* xDelete */ - winAccess, /* xAccess */ - winFullPathname, /* xFullPathname */ - winDlOpen, /* xDlOpen */ - winDlError, /* xDlError */ - winDlSym, /* xDlSym */ - winDlClose, /* xDlClose */ - winRandomness, /* xRandomness */ - winSleep, /* xSleep */ - winCurrentTime, /* xCurrentTime */ - winGetLastError, /* xGetLastError */ - winCurrentTimeInt64, /* xCurrentTimeInt64 */ - winSetSystemCall, /* xSetSystemCall */ - winGetSystemCall, /* xGetSystemCall */ - winNextSystemCall, /* xNextSystemCall */ - }; -#if defined(SQLITE_WIN32_HAS_WIDE) - static sqlite3_vfs winLongPathNolockVfs = { - 3, /* iVersion */ - sizeof(winFile), /* szOsFile */ - SQLITE_WINNT_MAX_PATH_BYTES, /* mxPathname */ - 0, /* pNext */ - "win32-longpath-none", /* zName */ - &winNolockAppData, /* pAppData */ - winOpen, /* xOpen */ - winDelete, /* xDelete */ - winAccess, /* xAccess */ - winFullPathname, /* xFullPathname */ - winDlOpen, /* xDlOpen */ - winDlError, /* xDlError */ - winDlSym, /* xDlSym */ - winDlClose, /* xDlClose */ - winRandomness, /* xRandomness */ - winSleep, /* xSleep */ - winCurrentTime, /* xCurrentTime */ - winGetLastError, /* xGetLastError */ - winCurrentTimeInt64, /* xCurrentTimeInt64 */ - winSetSystemCall, /* xSetSystemCall */ - winGetSystemCall, /* xGetSystemCall */ - winNextSystemCall, /* xNextSystemCall */ + 3, /* iVersion */ + sizeof(winFile), /* szOsFile */ + SQLITE_WINNT_MAX_PATH_BYTES, /* mxPathname */ + 0, /* pNext */ + "win32-longpath", /* zName */ + 0, /* pAppData */ + winOpen, /* xOpen */ + winDelete, /* xDelete */ + winAccess, /* xAccess */ + winFullPathname, /* xFullPathname */ + winDlOpen, /* xDlOpen */ + winDlError, /* xDlError */ + winDlSym, /* xDlSym */ + winDlClose, /* xDlClose */ + winRandomness, /* xRandomness */ + winSleep, /* xSleep */ + winCurrentTime, /* xCurrentTime */ + winGetLastError, /* xGetLastError */ + winCurrentTimeInt64, /* xCurrentTimeInt64 */ + winSetSystemCall, /* xSetSystemCall */ + winGetSystemCall, /* xGetSystemCall */ + winNextSystemCall, /* xNextSystemCall */ }; #endif /* Double-check that the aSyscall[] array has been constructed ** correctly. See ticket [bb3a86e890c8e96ab] */ @@ -43049,16 +42672,10 @@ #if defined(SQLITE_WIN32_HAS_WIDE) sqlite3_vfs_register(&winLongPathVfs, 0); #endif - sqlite3_vfs_register(&winNolockVfs, 0); - -#if defined(SQLITE_WIN32_HAS_WIDE) - sqlite3_vfs_register(&winLongPathNolockVfs, 0); -#endif - return SQLITE_OK; } SQLITE_API int SQLITE_STDCALL sqlite3_os_end(void){ #if SQLITE_OS_WINRT @@ -44175,35 +43792,33 @@ sqlite3PcacheTruncate(pCache, 0); } /* ** Merge two lists of pages connected by pDirty and in pgno order. -** Do not bother fixing the pDirtyPrev pointers. +** Do not both fixing the pDirtyPrev pointers. */ static PgHdr *pcacheMergeDirtyList(PgHdr *pA, PgHdr *pB){ PgHdr result, *pTail; pTail = &result; - assert( pA!=0 && pB!=0 ); - for(;;){ + while( pA && pB ){ if( pA->pgnopgno ){ pTail->pDirty = pA; pTail = pA; pA = pA->pDirty; - if( pA==0 ){ - pTail->pDirty = pB; - break; - } }else{ pTail->pDirty = pB; pTail = pB; pB = pB->pDirty; - if( pB==0 ){ - pTail->pDirty = pA; - break; - } } } + if( pA ){ + pTail->pDirty = pA; + }else if( pB ){ + pTail->pDirty = pB; + }else{ + pTail->pDirty = 0; + } return result.pDirty; } /* ** Sort the list of pages in accending order by pgno. Pages are @@ -44240,12 +43855,11 @@ a[i] = pcacheMergeDirtyList(a[i], p); } } p = a[0]; for(i=1; ipRight==0 || pA->v<=pA->pRight->v ); assert( pB->pRight==0 || pB->v<=pB->pRight->v ); - if( pA->v<=pB->v ){ - if( pA->vv ) pTail = pTail->pRight = pA; + if( pA->vv ){ + pTail->pRight = pA; pA = pA->pRight; - if( pA==0 ){ - pTail->pRight = pB; - break; - } - }else{ - pTail = pTail->pRight = pB; + pTail = pTail->pRight; + }else if( pB->vv ){ + pTail->pRight = pB; pB = pB->pRight; - if( pB==0 ){ - pTail->pRight = pA; - break; - } + pTail = pTail->pRight; + }else{ + pA = pA->pRight; } } + if( pA ){ + assert( pA->pRight==0 || pA->v<=pA->pRight->v ); + pTail->pRight = pA; + }else{ + assert( pB==0 || pB->pRight==0 || pB->v<=pB->pRight->v ); + pTail->pRight = pB; + } return head.pRight; } /* ** Sort all elements on the list of RowSetEntry objects into order of @@ -45888,14 +45504,13 @@ aBucket[i] = 0; } aBucket[i] = pIn; pIn = pNext; } - pIn = aBucket[0]; - for(i=1; itempFile ); if( pPager->tempFile==0 ) pager_reset(pPager); } #endif - #ifndef SQLITE_OMIT_WAL /* ** This function is called when the user invokes "PRAGMA wal_checkpoint", ** "PRAGMA wal_blocking_checkpoint" or calls the sqlite3_wal_checkpoint() ** or wal_blocking_checkpoint() API functions. @@ -53647,10 +53261,11 @@ SQLITE_PRIVATE int sqlite3PagerWalFramesize(Pager *pPager){ assert( pPager->eState>=PAGER_READER ); return sqlite3WalFramesize(pPager->pWal); } #endif + #endif /* SQLITE_OMIT_DISKIO */ /************** End of pager.c ***********************************************/ /************** Begin file wal.c *********************************************/ @@ -56763,25 +56378,20 @@ ** boundary is crossed. Only the part of the WAL prior to the last ** sector boundary is synced; the part of the last frame that extends ** past the sector boundary is written after the sync. */ if( isCommit && (sync_flags & WAL_SYNC_TRANSACTIONS)!=0 ){ - int bSync = 1; if( pWal->padToSectorBoundary ){ int sectorSize = sqlite3SectorSize(pWal->pWalFd); w.iSyncPoint = ((iOffset+sectorSize-1)/sectorSize)*sectorSize; - bSync = (w.iSyncPoint==iOffset); - testcase( bSync ); while( iOffsetpBt->mutex); } - -/* Verify that the cursor and the BtShared agree about what is the current -** database connetion. This is important in shared-cache mode. If the database -** connection pointers get out-of-sync, it is possible for routines like -** btreeInitPage() to reference an stale connection pointer that references a -** a connection that has already closed. This routine is used inside assert() -** statements only and for the purpose of double-checking that the btree code -** does keep the database connection pointers up-to-date. -*/ static int cursorOwnsBtShared(BtCursor *p){ assert( cursorHoldsMutex(p) ); return (p->pBtree->db==p->pBt->db); } #endif @@ -58732,23 +58333,25 @@ ** NULL. If the cursor is open on a non-intkey table, then pCur->pKey is ** set to point to a malloced buffer pCur->nKey bytes in size containing ** the key. */ static int saveCursorKey(BtCursor *pCur){ - int rc = SQLITE_OK; + int rc; assert( CURSOR_VALID==pCur->eState ); assert( 0==pCur->pKey ); assert( cursorHoldsMutex(pCur) ); - if( pCur->curIntKey ){ - /* Only the rowid is required for a table btree */ - pCur->nKey = sqlite3BtreeIntegerKey(pCur); - }else{ - /* For an index btree, save the complete key content */ - void *pKey; - pCur->nKey = sqlite3BtreePayloadSize(pCur); - pKey = sqlite3Malloc( pCur->nKey ); + rc = sqlite3BtreeKeySize(pCur, &pCur->nKey); + assert( rc==SQLITE_OK ); /* KeySize() cannot fail */ + + /* If this is an intKey table, then the above call to BtreeKeySize() + ** stores the integer key in pCur->nKey. In this case this value is + ** all that is required. Otherwise, if pCur is not open on an intKey + ** table, then malloc space for and store the pCur->nKey bytes of key + ** data. */ + if( 0==pCur->curIntKey ){ + void *pKey = sqlite3Malloc( pCur->nKey ); if( pKey ){ rc = sqlite3BtreeKey(pCur, 0, (int)pCur->nKey, pKey); if( rc==SQLITE_OK ){ pCur->pKey = pKey; }else{ @@ -60451,13 +60054,13 @@ assert( (pBt->pageSize & 7)==0 ); /* 8-byte alignment of pageSize */ #if !defined(SQLITE_OMIT_SHARED_CACHE) && !defined(SQLITE_OMIT_DISKIO) /* Add the new BtShared object to the linked list sharable BtShareds. */ - pBt->nRef = 1; if( p->sharable ){ MUTEX_LOGIC( sqlite3_mutex *mutexShared; ) + pBt->nRef = 1; MUTEX_LOGIC( mutexShared = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);) if( SQLITE_THREADSAFE && sqlite3GlobalConfig.bCoreMutex ){ pBt->mutex = sqlite3MutexAlloc(SQLITE_MUTEX_FAST); if( pBt->mutex==0 ){ rc = SQLITE_NOMEM_BKPT; @@ -60524,11 +60127,10 @@ } if( mutexOpen ){ assert( sqlite3_mutex_held(mutexOpen) ); sqlite3_mutex_leave(mutexOpen); } - assert( rc!=SQLITE_OK || sqlite3BtreeConnectionCount(*ppBtree)>0 ); return rc; } /* ** Decrement the BtShared.nRef counter. When it reaches zero, @@ -62384,37 +61986,50 @@ return pCur && pCur->eState==CURSOR_VALID; } #endif /* NDEBUG */ /* -** Return the value of the integer key or "rowid" for a table btree. -** This routine is only valid for a cursor that is pointing into a -** ordinary table btree. If the cursor points to an index btree or -** is invalid, the result of this routine is undefined. +** Set *pSize to the size of the buffer needed to hold the value of +** the key for the current entry. If the cursor is not pointing +** to a valid entry, *pSize is set to 0. +** +** For a table with the INTKEY flag set, this routine returns the key +** itself, not the number of bytes in the key. +** +** The caller must position the cursor prior to invoking this routine. +** +** This routine cannot fail. It always returns SQLITE_OK. */ -SQLITE_PRIVATE i64 sqlite3BtreeIntegerKey(BtCursor *pCur){ +SQLITE_PRIVATE int sqlite3BtreeKeySize(BtCursor *pCur, i64 *pSize){ assert( cursorHoldsMutex(pCur) ); assert( pCur->eState==CURSOR_VALID ); - assert( pCur->curIntKey ); getCellInfo(pCur); - return pCur->info.nKey; + *pSize = pCur->info.nKey; + return SQLITE_OK; } /* -** Return the number of bytes of payload for the entry that pCur is -** currently pointing to. For table btrees, this will be the amount -** of data. For index btrees, this will be the size of the key. +** Set *pSize to the number of bytes of data in the entry the +** cursor currently points to. ** ** The caller must guarantee that the cursor is pointing to a non-NULL ** valid entry. In other words, the calling procedure must guarantee ** that the cursor has Cursor.eState==CURSOR_VALID. +** +** Failure is not possible. This function always returns SQLITE_OK. +** It might just as well be a procedure (returning void) but we continue +** to return an integer result code for historical reasons. */ -SQLITE_PRIVATE u32 sqlite3BtreePayloadSize(BtCursor *pCur){ - assert( cursorHoldsMutex(pCur) ); +SQLITE_PRIVATE int sqlite3BtreeDataSize(BtCursor *pCur, u32 *pSize){ + assert( cursorOwnsBtShared(pCur) ); assert( pCur->eState==CURSOR_VALID ); + assert( pCur->iPage>=0 ); + assert( pCur->iPageapPage[pCur->iPage]->intKeyLeaf==1 ); getCellInfo(pCur); - return pCur->info.nPayload; + *pSize = pCur->info.nPayload; + return SQLITE_OK; } /* ** Given the page number of an overflow page in the database (parameter ** ovfl), this function finds the page number of the next page in the @@ -62852,11 +62467,14 @@ ** this routine. ** ** These routines is used to get quick access to key and data ** in the common case where no overflow pages are used. */ -SQLITE_PRIVATE const void *sqlite3BtreePayloadFetch(BtCursor *pCur, u32 *pAmt){ +SQLITE_PRIVATE const void *sqlite3BtreeKeyFetch(BtCursor *pCur, u32 *pAmt){ + return fetchPayload(pCur, pAmt); +} +SQLITE_PRIVATE const void *sqlite3BtreeDataFetch(BtCursor *pCur, u32 *pAmt){ return fetchPayload(pCur, pAmt); } /* @@ -63185,16 +62803,15 @@ assert( cursorOwnsBtShared(pCur) ); assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) ); assert( pRes ); assert( (pIdxKey==0)==(pCur->pKeyInfo==0) ); - assert( pCur->eState!=CURSOR_VALID || (pIdxKey==0)==(pCur->curIntKey!=0) ); /* If the cursor is already positioned at the point we are trying ** to move to, then just return without doing any work */ - if( pIdxKey==0 - && pCur->eState==CURSOR_VALID && (pCur->curFlags & BTCF_ValidNKey)!=0 + if( pCur->eState==CURSOR_VALID && (pCur->curFlags & BTCF_ValidNKey)!=0 + && pCur->curIntKey ){ if( pCur->info.nKey==intKey ){ *pRes = 0; return SQLITE_OK; } @@ -64179,11 +63796,13 @@ ** later. */ static int fillInCell( MemPage *pPage, /* The page that contains the cell */ unsigned char *pCell, /* Complete text of the cell */ - const BtreePayload *pX, /* Payload with which to construct the cell */ + const void *pKey, i64 nKey, /* The key */ + const void *pData,int nData, /* The data */ + int nZero, /* Extra zero bytes to append to pData */ int *pnSize /* Write cell size here */ ){ int nPayload; const u8 *pSrc; int nSrc, n, rc; @@ -64203,27 +63822,30 @@ assert( pCellaData || pCell>=&pPage->aData[pBt->pageSize] || sqlite3PagerIswriteable(pPage->pDbPage) ); /* Fill in the header. */ nHeader = pPage->childPtrSize; + nPayload = nData + nZero; + if( pPage->intKeyLeaf ){ + nHeader += putVarint32(&pCell[nHeader], nPayload); + }else{ + assert( nData==0 ); + assert( nZero==0 ); + } + nHeader += putVarint(&pCell[nHeader], *(u64*)&nKey); + + /* Fill in the payload size */ if( pPage->intKey ){ - nPayload = pX->nData + pX->nZero; - pSrc = pX->pData; - nSrc = pX->nData; - assert( pPage->intKeyLeaf ); /* fillInCell() only called for leaves */ - nHeader += putVarint32(&pCell[nHeader], nPayload); - nHeader += putVarint(&pCell[nHeader], *(u64*)&pX->nKey); - }else{ - assert( pX->nData==0 ); - assert( pX->nZero==0 ); - assert( pX->nKey<=0x7fffffff && pX->pKey!=0 ); - nSrc = nPayload = (int)pX->nKey; - pSrc = pX->pKey; - nHeader += putVarint32(&pCell[nHeader], nPayload); - } - - /* Fill in the payload */ + pSrc = pData; + nSrc = nData; + nData = 0; + }else{ + assert( nKey<=0x7fffffff && pKey!=0 ); + nPayload = (int)nKey; + pSrc = pKey; + nSrc = (int)nKey; + } if( nPayload<=pPage->maxLocal ){ n = nHeader + nPayload; testcase( n==3 ); testcase( n==4 ); if( n<4 ) n = 4; @@ -64257,11 +63879,11 @@ #if SQLITE_DEBUG { CellInfo info; pPage->xParseCell(pPage, pCell, &info); assert( nHeader==(int)(info.pPayload - pCell) ); - assert( info.nKey==pX->nKey ); + assert( info.nKey==nKey ); assert( *pnSize == info.nSize ); assert( spaceLeft == info.nLocal ); } #endif @@ -64342,10 +63964,14 @@ nPayload -= n; pPayload += n; pSrc += n; nSrc -= n; spaceLeft -= n; + if( nSrc==0 ){ + nSrc = nData; + pSrc = pData; + } } releasePage(pToRelease); return SQLITE_OK; } @@ -64408,12 +64034,10 @@ ** pTemp is not null. Regardless of pTemp, allocate a new entry ** in pPage->apOvfl[] and make it point to the cell content (either ** in pTemp or the original pCell) and also record its index. ** Allocating a new entry in pPage->aCell[] implies that ** pPage->nOverflow is incremented. -** -** *pRC must be SQLITE_OK when this routine is called. */ static void insertCell( MemPage *pPage, /* Page into which we are copying */ int i, /* New cell becomes the i-th cell of the page */ u8 *pCell, /* Content of the new cell */ @@ -64425,11 +64049,12 @@ int idx = 0; /* Where to write new cell content in data[] */ int j; /* Loop counter */ u8 *data; /* The content of the whole page */ u8 *pIns; /* The point in pPage->aCellIdx[] where no cell inserted */ - assert( *pRC==SQLITE_OK ); + if( *pRC ) return; + assert( i>=0 && i<=pPage->nCell+pPage->nOverflow ); assert( MX_CELL(pPage->pBt)<=10921 ); assert( pPage->nCell<=MX_CELL(pPage->pBt) || CORRUPT_DB ); assert( pPage->nOverflow<=ArraySize(pPage->apOvfl) ); assert( ArraySize(pPage->apOvfl)==ArraySize(pPage->aiOvfl) ); @@ -64499,11 +64124,11 @@ } } /* ** A CellArray object contains a cache of pointers and sizes for a -** consecutive sequence of cells that might be held on multiple pages. +** consecutive sequence of cells that might be held multiple pages. */ typedef struct CellArray CellArray; struct CellArray { int nCell; /* Number of cells in apCell[] */ MemPage *pRef; /* Reference page */ @@ -64931,14 +64556,12 @@ while( (*(pCell++)&0x80) && pCellnCell, pSpace, (int)(pOut-pSpace), - 0, pPage->pgno, &rc); - } + insertCell(pParent, pParent->nCell, pSpace, (int)(pOut-pSpace), + 0, pPage->pgno, &rc); /* Set the right-child pointer of pParent to point to the new page. */ put4byte(&pParent->aData[pParent->hdrOffset+8], pgnoNew); /* Release the reference to the new page. */ @@ -65454,11 +65077,11 @@ do{ assert( d szLeft-(b.szCell[r]+(i==k-1?0:2)))){ + && (bBulk || szRight+b.szCell[d]+2 > szLeft-(b.szCell[r]+2)) ){ break; } szRight += b.szCell[d] + 2; szLeft -= b.szCell[r] + 2; cntNew[i-1] = r; @@ -66026,23 +65649,17 @@ return rc; } /* -** Insert a new record into the BTree. The content of the new record -** is described by the pX object. The pCur cursor is used only to -** define what table the record should be inserted into, and is left -** pointing at a random location. -** -** For a table btree (used for rowid tables), only the pX.nKey value of -** the key is used. The pX.pKey value must be NULL. The pX.nKey is the -** rowid or INTEGER PRIMARY KEY of the row. The pX.nData,pData,nZero fields -** hold the content of the row. -** -** For an index btree (used for indexes and WITHOUT ROWID tables), the -** key is an arbitrary byte sequence stored in pX.pKey,nKey. The -** pX.pData,nData,nZero fields must be zero. +** Insert a new record into the BTree. The key is given by (pKey,nKey) +** and the data is given by (pData,nData). The cursor is used only to +** define what table the record should be inserted into. The cursor +** is left pointing at a random location. +** +** For an INTKEY table, only the nKey value of the key is used. pKey is +** ignored. For a ZERODATA table, the pData and nData are both ignored. ** ** If the seekResult parameter is non-zero, then a successful call to ** MovetoUnpacked() to seek cursor pCur to (pKey, nKey) has already ** been performed. seekResult is the search result returned (a negative ** number if pCur points at an entry that is smaller than (pKey, nKey), or @@ -66055,11 +65672,13 @@ ** point to any entry or to no entry at all and so this function has to seek ** the cursor before the new key can be inserted. */ SQLITE_PRIVATE int sqlite3BtreeInsert( BtCursor *pCur, /* Insert data into the table of this cursor */ - const BtreePayload *pX, /* Content of the row to be inserted */ + const void *pKey, i64 nKey, /* The key of the new record */ + const void *pData, int nData, /* The data of the new record */ + int nZero, /* Number of extra 0 bytes to append to data */ int appendBias, /* True if this is likely an append */ int seekResult /* Result of prior MovetoUnpacked() call */ ){ int rc; int loc = seekResult; /* -1: before desired location +1: after */ @@ -66085,11 +65704,11 @@ /* Assert that the caller has been consistent. If this cursor was opened ** expecting an index b-tree, then the caller should be inserting blob ** keys with no associated data. If the cursor was opened expecting an ** intkey table, the caller should be inserting integer keys with a ** blob of associated data. */ - assert( (pX->pKey==0)==(pCur->pKeyInfo==0) ); + assert( (pKey==0)==(pCur->pKeyInfo==0) ); /* Save the positions of any other cursors open on this table. ** ** In some cases, the call to btreeMoveto() below is a no-op. For ** example, when inserting data into a table with auto-generated integer @@ -66104,42 +65723,42 @@ rc = saveAllCursors(pBt, pCur->pgnoRoot, pCur); if( rc ) return rc; } if( pCur->pKeyInfo==0 ){ - assert( pX->pKey==0 ); + assert( pKey==0 ); /* If this is an insert into a table b-tree, invalidate any incrblob ** cursors open on the row being replaced */ - invalidateIncrblobCursors(p, pX->nKey, 0); + invalidateIncrblobCursors(p, nKey, 0); /* If the cursor is currently on the last row and we are appending a ** new row onto the end, set the "loc" to avoid an unnecessary ** btreeMoveto() call */ - if( (pCur->curFlags&BTCF_ValidNKey)!=0 && pX->nKey>0 - && pCur->info.nKey==pX->nKey-1 ){ + if( (pCur->curFlags&BTCF_ValidNKey)!=0 && nKey>0 + && pCur->info.nKey==nKey-1 ){ loc = -1; }else if( loc==0 ){ - rc = sqlite3BtreeMovetoUnpacked(pCur, 0, pX->nKey, appendBias, &loc); + rc = sqlite3BtreeMovetoUnpacked(pCur, 0, nKey, appendBias, &loc); if( rc ) return rc; } }else if( loc==0 ){ - rc = btreeMoveto(pCur, pX->pKey, pX->nKey, appendBias, &loc); + rc = btreeMoveto(pCur, pKey, nKey, appendBias, &loc); if( rc ) return rc; } assert( pCur->eState==CURSOR_VALID || (pCur->eState==CURSOR_INVALID && loc) ); pPage = pCur->apPage[pCur->iPage]; - assert( pPage->intKey || pX->nKey>=0 ); + assert( pPage->intKey || nKey>=0 ); assert( pPage->leaf || !pPage->intKey ); TRACE(("INSERT: table=%d nkey=%lld ndata=%d page=%d %s\n", - pCur->pgnoRoot, pX->nKey, pX->nData, pPage->pgno, + pCur->pgnoRoot, nKey, nData, pPage->pgno, loc==0 ? "overwrite" : "new entry")); assert( pPage->isInit ); newCell = pBt->pTmpSpace; assert( newCell!=0 ); - rc = fillInCell(pPage, newCell, pX, &szNew); + rc = fillInCell(pPage, newCell, pKey, nKey, pData, nData, nZero, &szNew); if( rc ) goto end_insert; assert( szNew==pPage->xCellSize(pPage, newCell) ); assert( szNew <= MX_CELL_SIZE(pBt) ); idx = pCur->aiIdx[pCur->iPage]; if( loc==0 ){ @@ -66161,11 +65780,10 @@ idx = ++pCur->aiIdx[pCur->iPage]; }else{ assert( pPage->leaf ); } insertCell(pPage, idx, newCell, szNew, 0, 0, &rc); - assert( pPage->nOverflow==0 || rc==SQLITE_OK ); assert( rc!=SQLITE_OK || pPage->nCell>0 || pPage->nOverflow>0 ); /* If no error has occurred and pPage has an overflow cell, call balance() ** to redistribute the cells within the tree. Since balance() may move ** the cursor, zero the BtCursor.info.nSize and BTCF_ValidNKey @@ -66185,12 +65803,11 @@ ** entry in the table, and the next row inserted has an integer key ** larger than the largest existing key, it is possible to insert the ** row without seeking the cursor. This can be a big performance boost. */ pCur->info.nSize = 0; - if( pPage->nOverflow ){ - assert( rc==SQLITE_OK ); + if( rc==SQLITE_OK && pPage->nOverflow ){ pCur->curFlags &= ~(BTCF_ValidNKey); rc = balance(pCur); /* Must make sure nOverflow is reset to zero even if the balance() ** fails. Internal data structure corruption will result otherwise. @@ -66322,13 +65939,11 @@ nCell = pLeaf->xCellSize(pLeaf, pCell); assert( MX_CELL_SIZE(pBt) >= nCell ); pTmp = pBt->pTmpSpace; assert( pTmp!=0 ); rc = sqlite3PagerWrite(pLeaf->pDbPage); - if( rc==SQLITE_OK ){ - insertCell(pPage, iCellIdx, pCell-4, nCell+4, pTmp, n, &rc); - } + insertCell(pPage, iCellIdx, pCell-4, nCell+4, pTmp, n, &rc); dropCell(pLeaf, pLeaf->nCell-1, nCell, &rc); if( rc ) return rc; } /* Balance the tree. If the entry deleted was located on a leaf page, @@ -67813,20 +67428,10 @@ ** Return true if the Btree passed as the only argument is sharable. */ SQLITE_PRIVATE int sqlite3BtreeSharable(Btree *p){ return p->sharable; } - -/* -** Return the number of connections to the BtShared object accessed by -** the Btree handle passed as the only argument. For private caches -** this is always 1. For shared caches it may be 1 or greater. -*/ -SQLITE_PRIVATE int sqlite3BtreeConnectionCount(Btree *p){ - testcase( p->sharable ); - return p->pBt->nRef; -} #endif /************** End of btree.c ***********************************************/ /************** Begin file backup.c ******************************************/ /* @@ -68606,14 +68211,14 @@ /* 0x7FFFFFFF is the hard limit for the number of pages in a database ** file. By passing this as the number of pages to copy to ** sqlite3_backup_step(), we can guarantee that the copy finishes ** within a single call (unless an error occurs). The assert() statement ** checks this assumption - (p->rc) should be set to either SQLITE_DONE - ** or an error code. */ + ** or an error code. + */ sqlite3_backup_step(&b, 0x7FFFFFFF); assert( b.rc!=SQLITE_OK ); - rc = sqlite3_backup_finish(&b); if( rc==SQLITE_OK ){ pTo->pBt->btsFlags &= ~BTS_PAGESIZE_FIXED; }else{ sqlite3PagerClearCache(sqlite3BtreePager(b.pDest)); @@ -69620,11 +69225,15 @@ assert( !VdbeMemDynamic(pMem) ); /* Note: the calls to BtreeKeyFetch() and DataFetch() below assert() ** that both the BtShared and database handle mutexes are held. */ assert( (pMem->flags & MEM_RowSet)==0 ); - zData = (char *)sqlite3BtreePayloadFetch(pCur, &available); + if( key ){ + zData = (char *)sqlite3BtreeKeyFetch(pCur, &available); + }else{ + zData = (char *)sqlite3BtreeDataFetch(pCur, &available); + } assert( zData!=0 ); if( offset+amt<=available ){ pMem->z = &zData[offset]; pMem->flags = MEM_Blob|MEM_Ephem; @@ -70399,10 +70008,18 @@ #endif assert( p->zSql==0 ); p->zSql = sqlite3DbStrNDup(p->db, z, n); p->isPrepareV2 = (u8)isPrepareV2; } + +/* +** Return the SQL associated with a prepared statement +*/ +SQLITE_API const char *SQLITE_STDCALL sqlite3_sql(sqlite3_stmt *pStmt){ + Vdbe *p = (Vdbe *)pStmt; + return p ? p->zSql : 0; +} /* ** Swap all content between two VDBE structures. */ SQLITE_PRIVATE void sqlite3VdbeSwap(Vdbe *pA, Vdbe *pB){ @@ -71119,34 +70736,26 @@ /* ** If the input FuncDef structure is ephemeral, then free it. If ** the FuncDef is not ephermal, then do nothing. */ static void freeEphemeralFunction(sqlite3 *db, FuncDef *pDef){ - if( (pDef->funcFlags & SQLITE_FUNC_EPHEM)!=0 ){ + if( ALWAYS(pDef) && (pDef->funcFlags & SQLITE_FUNC_EPHEM)!=0 ){ sqlite3DbFree(db, pDef); } } static void vdbeFreeOpArray(sqlite3 *, Op *, int); /* ** Delete a P4 value if necessary. */ -static SQLITE_NOINLINE void freeP4Mem(sqlite3 *db, Mem *p){ - if( p->szMalloc ) sqlite3DbFree(db, p->zMalloc); - sqlite3DbFree(db, p); -} -static SQLITE_NOINLINE void freeP4FuncCtx(sqlite3 *db, sqlite3_context *p){ - freeEphemeralFunction(db, p->pFunc); - sqlite3DbFree(db, p); -} static void freeP4(sqlite3 *db, int p4type, void *p4){ assert( db ); switch( p4type ){ case P4_FUNCCTX: { - freeP4FuncCtx(db, (sqlite3_context*)p4); - break; + freeEphemeralFunction(db, ((sqlite3_context*)p4)->pFunc); + /* Fall through into the next case */ } case P4_REAL: case P4_INT64: case P4_DYNAMIC: case P4_INTARRAY: { @@ -71173,11 +70782,13 @@ } case P4_MEM: { if( db->pnBytesFreed==0 ){ sqlite3ValueFree((sqlite3_value*)p4); }else{ - freeP4Mem(db, (Mem*)p4); + Mem *p = (Mem*)p4; + if( p->szMalloc ) sqlite3DbFree(db, p->zMalloc); + sqlite3DbFree(db, p); } break; } case P4_VTAB : { if( db->pnBytesFreed==0 ) sqlite3VtabUnlock((VTable *)p4); @@ -74643,11 +74254,12 @@ ** than 2GiB are support - anything large must be database corruption. ** Any corruption is detected in sqlite3BtreeParseCellPtr(), though, so ** this code can safely assume that nCellKey is 32-bits */ assert( sqlite3BtreeCursorIsValid(pCur) ); - nCellKey = sqlite3BtreePayloadSize(pCur); + VVA_ONLY(rc =) sqlite3BtreeKeySize(pCur, &nCellKey); + assert( rc==SQLITE_OK ); /* pCur is always valid so KeySize cannot fail */ assert( (nCellKey & SQLITE_MAX_U32)==(u64)nCellKey ); /* Read in the complete content of the index entry */ sqlite3VdbeMemInit(&m, db, 0); rc = sqlite3VdbeMemFromBtree(pCur, 0, (u32)nCellKey, 1, &m); @@ -74720,11 +74332,12 @@ Mem m; assert( pC->eCurType==CURTYPE_BTREE ); pCur = pC->uc.pCursor; assert( sqlite3BtreeCursorIsValid(pCur) ); - nCellKey = sqlite3BtreePayloadSize(pCur); + VVA_ONLY(rc =) sqlite3BtreeKeySize(pCur, &nCellKey); + assert( rc==SQLITE_OK ); /* pCur is always valid so KeySize cannot fail */ /* nCellKey will always be between 0 and 0xffffffff because of the way ** that btreeParseCellPtr() and sqlite3GetVarint32() are implemented */ if( nCellKey<=0 || nCellKey>0x7fffffff ){ *res = 0; return SQLITE_CORRUPT_BKPT; @@ -74982,23 +74595,16 @@ ** Invoke the profile callback. This routine is only called if we already ** know that the profile callback is defined and needs to be invoked. */ static SQLITE_NOINLINE void invokeProfileCallback(sqlite3 *db, Vdbe *p){ sqlite3_int64 iNow; - sqlite3_int64 iElapse; assert( p->startTime>0 ); - assert( db->xProfile!=0 || (db->mTrace & SQLITE_TRACE_PROFILE)!=0 ); + assert( db->xProfile!=0 ); assert( db->init.busy==0 ); assert( p->zSql!=0 ); sqlite3OsCurrentTimeInt64(db->pVfs, &iNow); - iElapse = (iNow - p->startTime)*1000000; - if( db->xProfile ){ - db->xProfile(db->pProfileArg, p->zSql, iElapse); - } - if( db->mTrace & SQLITE_TRACE_PROFILE ){ - db->xTrace(SQLITE_TRACE_PROFILE, db->pTraceArg, p, (void*)&iElapse); - } + db->xProfile(db->pProfileArg, p->zSql, (iNow - p->startTime)*1000000); p->startTime = 0; } /* ** The checkProfileCallback(DB,P) macro checks to see if a profile callback ** is needed, and it invokes the callback if it is needed. @@ -75498,12 +75104,11 @@ assert( db->nVdbeWrite>0 || db->autoCommit==0 || (db->nDeferredCons==0 && db->nDeferredImmCons==0) ); #ifndef SQLITE_OMIT_TRACE - if( (db->xProfile || (db->mTrace & SQLITE_TRACE_PROFILE)!=0) - && !db->init.busy && p->zSql ){ + if( db->xProfile && !db->init.busy && p->zSql ){ sqlite3OsCurrentTimeInt64(db->pVfs, &p->startTime); }else{ assert( p->startTime==0 ); } #endif @@ -76534,43 +76139,10 @@ v = pVdbe->aCounter[op]; if( resetFlag ) pVdbe->aCounter[op] = 0; return (int)v; } -/* -** Return the SQL associated with a prepared statement -*/ -SQLITE_API const char *SQLITE_STDCALL sqlite3_sql(sqlite3_stmt *pStmt){ - Vdbe *p = (Vdbe *)pStmt; - return p ? p->zSql : 0; -} - -/* -** Return the SQL associated with a prepared statement with -** bound parameters expanded. Space to hold the returned string is -** obtained from sqlite3_malloc(). The caller is responsible for -** freeing the returned string by passing it to sqlite3_free(). -** -** The SQLITE_TRACE_SIZE_LIMIT puts an upper bound on the size of -** expanded bound parameters. -*/ -SQLITE_API char *SQLITE_STDCALL sqlite3_expanded_sql(sqlite3_stmt *pStmt){ -#ifdef SQLITE_OMIT_TRACE - return 0; -#else - char *z = 0; - const char *zSql = sqlite3_sql(pStmt); - if( zSql ){ - Vdbe *p = (Vdbe *)pStmt; - sqlite3_mutex_enter(p->db->mutex); - z = sqlite3VdbeExpandSql(p, zSql); - sqlite3_mutex_leave(p->db->mutex); - } - return z; -#endif -} - #ifdef SQLITE_ENABLE_PREUPDATE_HOOK /* ** Allocate and populate an UnpackedRecord structure based on the serialized ** record in nKey/pKey. Return a pointer to the new UnpackedRecord structure ** if successful, or a NULL pointer if an OOM error is encountered. @@ -76613,11 +76185,12 @@ /* If the old.* record has not yet been loaded into memory, do so now. */ if( p->pUnpacked==0 ){ u32 nRec; u8 *aRec; - nRec = sqlite3BtreePayloadSize(p->pCsr->uc.pCursor); + rc = sqlite3BtreeDataSize(p->pCsr->uc.pCursor, &nRec); + if( rc!=SQLITE_OK ) goto preupdate_old_out; aRec = sqlite3DbMallocRaw(db, nRec); if( !aRec ) goto preupdate_old_out; rc = sqlite3BtreeData(p->pCsr->uc.pCursor, 0, nRec, aRec); if( rc==SQLITE_OK ){ p->pUnpacked = vdbeUnpackRecord(&p->keyinfo, nRec, aRec); @@ -76901,17 +76474,14 @@ int n; /* Length of a token prefix */ int nToken; /* Length of the parameter token */ int i; /* Loop counter */ Mem *pVar; /* Value of a host parameter */ StrAccum out; /* Accumulate the output here */ -#ifndef SQLITE_OMIT_UTF16 - Mem utf8; /* Used to convert UTF16 parameters into UTF8 for display */ -#endif char zBase[100]; /* Initial working space */ db = p->db; - sqlite3StrAccumInit(&out, 0, zBase, sizeof(zBase), + sqlite3StrAccumInit(&out, db, zBase, sizeof(zBase), db->aLimit[SQLITE_LIMIT_LENGTH]); if( db->nVdbeExec>1 ){ while( *zRawSql ){ const char *zStart = zRawSql; while( *(zRawSql++)!='\n' && *zRawSql ); @@ -76958,18 +76528,16 @@ sqlite3XPrintf(&out, "%!.15g", pVar->u.r); }else if( pVar->flags & MEM_Str ){ int nOut; /* Number of bytes of the string text to include in output */ #ifndef SQLITE_OMIT_UTF16 u8 enc = ENC(db); + Mem utf8; if( enc!=SQLITE_UTF8 ){ memset(&utf8, 0, sizeof(utf8)); utf8.db = db; sqlite3VdbeMemSetStr(&utf8, pVar->z, pVar->n, enc, SQLITE_STATIC); - if( SQLITE_NOMEM==sqlite3VdbeChangeEncoding(&utf8, SQLITE_UTF8) ){ - out.accError = STRACCUM_NOMEM; - out.nAlloc = 0; - } + sqlite3VdbeChangeEncoding(&utf8, SQLITE_UTF8); pVar = &utf8; } #endif nOut = pVar->n; #ifdef SQLITE_TRACE_SIZE_LIMIT @@ -77007,11 +76575,10 @@ } #endif } } } - if( out.accError ) sqlite3StrAccumReset(&out); return sqlite3StrAccumFinish(&out); } #endif /* #ifndef SQLITE_OMIT_TRACE */ @@ -77540,12 +77107,12 @@ ****************************************************************************** ** ** This file contains inline asm code for retrieving "high-performance" ** counters for x86 class CPUs. */ -#ifndef SQLITE_HWTIME_H -#define SQLITE_HWTIME_H +#ifndef _HWTIME_H_ +#define _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 @@ -77609,11 +77176,11 @@ */ SQLITE_PRIVATE sqlite_uint64 sqlite3Hwtime(void){ return ((sqlite_uint64)0); } #endif -#endif /* !defined(SQLITE_HWTIME_H) */ +#endif /* !defined(_HWTIME_H_) */ /************** End of hwtime.h **********************************************/ /************** Continuing where we left off in vdbe.c ***********************/ #endif @@ -78489,14 +78056,10 @@ sqlite3VdbeMemNulTerminate(&pMem[i]); REGISTER_TRACE(pOp->p1+i, &pMem[i]); } if( db->mallocFailed ) goto no_mem; - if( db->mTrace & SQLITE_TRACE_ROW ){ - db->xTrace(SQLITE_TRACE_ROW, db->pTraceArg, p, 0); - } - /* Return SQLITE_ROW */ p->pc = (int)(pOp - aOp) + 1; rc = SQLITE_ROW; goto vdbe_return; @@ -79126,11 +78689,10 @@ affinity = pOp->p5 & SQLITE_AFF_MASK; if( affinity>=SQLITE_AFF_NUMERIC ){ if( (flags1 | flags3)&MEM_Str ){ if( (flags1 & (MEM_Int|MEM_Real|MEM_Str))==MEM_Str ){ applyNumericAffinity(pIn1,0); - flags3 = pIn3->flags; } if( (flags3 & (MEM_Int|MEM_Real|MEM_Str))==MEM_Str ){ applyNumericAffinity(pIn3,0); } } @@ -79139,11 +78701,10 @@ testcase( pIn1->flags & MEM_Int ); testcase( pIn1->flags & MEM_Real ); sqlite3VdbeMemStringify(pIn1, encoding, 1); testcase( (flags1&MEM_Dyn) != (pIn1->flags&MEM_Dyn) ); flags1 = (pIn1->flags & ~MEM_TypeMask) | (flags1 & MEM_TypeMask); - flags3 = pIn3->flags; } if( (flags3 & MEM_Str)==0 && (flags3 & (MEM_Int|MEM_Real))!=0 ){ testcase( pIn3->flags & MEM_Int ); testcase( pIn3->flags & MEM_Real ); sqlite3VdbeMemStringify(pIn3, encoding, 1); @@ -79492,10 +79053,11 @@ ** the result is guaranteed to only be used as the argument of a length() ** or typeof() function, respectively. The loading of large blobs can be ** skipped for length() and all content loading can be skipped for typeof(). */ case OP_Column: { + i64 payloadSize64; /* Number of bytes in the record */ int p2; /* column number to retrieve */ VdbeCursor *pC; /* The VDBE cursor */ BtCursor *pCrsr; /* The BTree cursor */ u32 *aOffset; /* aOffset[i] is offset to start of data for i-th column */ int len; /* The length of the serialized data for the column */ @@ -79514,11 +79076,10 @@ pC = p->apCsr[pOp->p1]; p2 = pOp->p2; /* If the cursor cache is stale, bring it up-to-date */ rc = sqlite3VdbeCursorMoveto(&pC, &p2); - if( rc ) goto abort_due_to_error; assert( pOp->p3>0 && pOp->p3<=(p->nMem+1 - p->nCursor) ); pDest = &aMem[pOp->p3]; memAboutToChange(p, pDest); assert( pOp->p1>=0 && pOp->p1nCursor ); @@ -79528,11 +79089,12 @@ assert( pC->eCurType!=CURTYPE_VTAB ); assert( pC->eCurType!=CURTYPE_PSEUDO || pC->nullRow ); assert( pC->eCurType!=CURTYPE_SORTER ); pCrsr = pC->uc.pCursor; - if( pC->cacheStatus!=p->cacheCtr ){ /*OPTIMIZATION-IF-FALSE*/ + if( rc ) goto abort_due_to_error; + if( pC->cacheStatus!=p->cacheCtr ){ if( pC->nullRow ){ if( pC->eCurType==CURTYPE_PSEUDO ){ assert( pC->uc.pseudoTableReg>0 ); pReg = &aMem[pC->uc.pseudoTableReg]; assert( pReg->flags & MEM_Blob ); @@ -79544,13 +79106,26 @@ goto op_column_out; } }else{ assert( pC->eCurType==CURTYPE_BTREE ); assert( pCrsr ); - assert( sqlite3BtreeCursorIsValid(pCrsr) ); - pC->payloadSize = sqlite3BtreePayloadSize(pCrsr); - pC->aRow = sqlite3BtreePayloadFetch(pCrsr, &avail); + if( pC->isTable==0 ){ + assert( sqlite3BtreeCursorIsValid(pCrsr) ); + VVA_ONLY(rc =) sqlite3BtreeKeySize(pCrsr, &payloadSize64); + assert( rc==SQLITE_OK ); /* True because of CursorMoveto() call above */ + /* sqlite3BtreeParseCellPtr() uses getVarint32() to extract the + ** payload size, so it is impossible for payloadSize64 to be + ** larger than 32 bits. */ + assert( (payloadSize64 & SQLITE_MAX_U32)==(u64)payloadSize64 ); + pC->aRow = sqlite3BtreeKeyFetch(pCrsr, &avail); + pC->payloadSize = (u32)payloadSize64; + }else{ + assert( sqlite3BtreeCursorIsValid(pCrsr) ); + VVA_ONLY(rc =) sqlite3BtreeDataSize(pCrsr, &pC->payloadSize); + assert( rc==SQLITE_OK ); /* DataSize() cannot fail */ + pC->aRow = sqlite3BtreeDataFetch(pCrsr, &avail); + } assert( avail<=65536 ); /* Maximum page size is 64KiB */ if( pC->payloadSize <= (u32)avail ){ pC->szRow = pC->payloadSize; }else if( pC->payloadSize > (u32)db->aLimit[SQLITE_LIMIT_LENGTH] ){ goto too_big; @@ -79562,11 +79137,11 @@ pC->iHdrOffset = getVarint32(pC->aRow, offset); pC->nHdrParsed = 0; aOffset[0] = offset; - if( availaRow does not have to hold the entire row, but it does at least ** need to cover the header of the record. If pC->aRow does not contain ** the complete header, then set it to zero, forcing the header to be ** dynamically allocated. */ pC->aRow = 0; @@ -79583,28 +79158,28 @@ */ if( offset > 98307 || offset > pC->payloadSize ){ rc = SQLITE_CORRUPT_BKPT; goto abort_due_to_error; } - }else if( offset>0 ){ /*OPTIMIZATION-IF-TRUE*/ - /* The following goto is an optimization. It can be omitted and - ** everything will still work. But OP_Column is measurably faster - ** by skipping the subsequent conditional, which is always true. - */ - zData = pC->aRow; - assert( pC->nHdrParsed<=p2 ); /* Conditional skipped */ - goto op_column_read_header; - } + } + + /* The following goto is an optimization. It can be omitted and + ** everything will still work. But OP_Column is measurably faster + ** by skipping the subsequent conditional, which is always true. + */ + assert( pC->nHdrParsed<=p2 ); /* Conditional skipped */ + goto op_column_read_header; } /* Make sure at least the first p2+1 entries of the header have been ** parsed and valid information is in aOffset[] and pC->aType[]. */ if( pC->nHdrParsed<=p2 ){ /* If there is more header available for parsing in the record, try ** to extract additional fields up through the p2+1-th field */ + op_column_read_header: if( pC->iHdrOffsetaRow==0 ){ memset(&sMem, 0, sizeof(sMem)); rc = sqlite3VdbeMemFromBtree(pCrsr, 0, aOffset[0], !pC->isTable, &sMem); @@ -79613,15 +79188,15 @@ }else{ zData = pC->aRow; } /* Fill in pC->aType[i] and aOffset[i] values through the p2-th field. */ - op_column_read_header: i = pC->nHdrParsed; offset64 = aOffset[i]; zHdr = zData + pC->iHdrOffset; zEndHdr = zData + aOffset[0]; + assert( i<=p2 && zHdraType[i++] = t; aOffset[i] = (u32)(offset64 & 0xffffffff); }while( i<=p2 && zHdrnHdrParsed = i; + pC->iHdrOffset = (u32)(zHdr - zData); + /* The record is corrupt if any of the following are true: ** (1) the bytes of the header extend past the declared header size ** (2) the entire header was used but not all data was used ** (3) the end of the data extends beyond the end of the record. */ @@ -79642,14 +79219,12 @@ ){ if( pC->aRow==0 ) sqlite3VdbeMemRelease(&sMem); rc = SQLITE_CORRUPT_BKPT; goto abort_due_to_error; } - - pC->nHdrParsed = i; - pC->iHdrOffset = (u32)(zHdr - zData); if( pC->aRow==0 ) sqlite3VdbeMemRelease(&sMem); + }else{ t = 0; } /* If after trying to extract new entries from the header, nHdrParsed is @@ -79673,14 +79248,13 @@ ** all valid. */ assert( p2nHdrParsed ); assert( rc==SQLITE_OK ); assert( sqlite3VdbeCheckMemInvariants(pDest) ); - if( VdbeMemDynamic(pDest) ){ - sqlite3VdbeMemSetNull(pDest); - } + if( VdbeMemDynamic(pDest) ) sqlite3VdbeMemSetNull(pDest); assert( t==pC->aType[p2] ); + pDest->enc = encoding; if( pC->szRow>=aOffset[p2+1] ){ /* This is the common case where the desired content fits on the original ** page - where the content is not on an overflow page */ zData = pC->aRow + aOffset[p2]; if( t<12 ){ @@ -79690,11 +79264,10 @@ ** a MEM_Ephem value. This branch is a fast short-cut that is equivalent ** to calling sqlite3VdbeSerialGet() and sqlite3VdbeDeephemeralize(). */ static const u16 aFlag[] = { MEM_Blob, MEM_Str|MEM_Term }; pDest->n = len = (t-12)/2; - pDest->enc = encoding; if( pDest->szMalloc < len+2 ){ pDest->flags = MEM_Null; if( sqlite3VdbeMemGrow(pDest, len+2, 0) ) goto no_mem; }else{ pDest->z = pDest->zMalloc; @@ -79703,11 +79276,10 @@ pDest->z[len] = 0; pDest->z[len+1] = 0; pDest->flags = aFlag[t&1]; } }else{ - pDest->enc = encoding; /* This branch happens only when content is on overflow pages */ if( ((pOp->p5 & (OPFLAG_LENGTHARG|OPFLAG_TYPEOFARG))!=0 && ((t>=12 && (t&1)==0) || (pOp->p5 & OPFLAG_TYPEOFARG)!=0)) || (len = sqlite3VdbeSerialTypeLen(t))==0 ){ @@ -81121,34 +80693,10 @@ if( takeJump || !alreadyExists ) goto jump_to_p2; } break; } -/* Opcode: SeekRowid P1 P2 P3 * * -** Synopsis: intkey=r[P3] -** -** P1 is the index of a cursor open on an SQL table btree (with integer -** keys). If register P3 does not contain an integer or if P1 does not -** contain a record with rowid P3 then jump immediately to P2. -** Or, if P2 is 0, raise an SQLITE_CORRUPT error. If P1 does contain -** a record with rowid P3 then -** leave the cursor pointing at that record and fall through to the next -** instruction. -** -** The OP_NotExists opcode performs the same operation, but with OP_NotExists -** the P3 register must be guaranteed to contain an integer value. With this -** opcode, register P3 might not contain an integer. -** -** The OP_NotFound opcode performs the same operation on index btrees -** (with arbitrary multi-value keys). -** -** This opcode leaves the cursor in a state where it cannot be advanced -** in either direction. In other words, the Next and Prev opcodes will -** not work following this opcode. -** -** See also: Found, NotFound, NoConflict, SeekRowid -*/ /* Opcode: NotExists P1 P2 P3 * * ** Synopsis: intkey=r[P3] ** ** P1 is the index of a cursor open on an SQL table btree (with integer ** keys). P3 is an integer rowid. If P1 does not contain a record with @@ -81155,37 +80703,26 @@ ** rowid P3 then jump immediately to P2. Or, if P2 is 0, raise an ** SQLITE_CORRUPT error. If P1 does contain a record with rowid P3 then ** leave the cursor pointing at that record and fall through to the next ** instruction. ** -** The OP_SeekRowid opcode performs the same operation but also allows the -** P3 register to contain a non-integer value, in which case the jump is -** always taken. This opcode requires that P3 always contain an integer. -** ** The OP_NotFound opcode performs the same operation on index btrees ** (with arbitrary multi-value keys). ** ** This opcode leaves the cursor in a state where it cannot be advanced ** in either direction. In other words, the Next and Prev opcodes will ** not work following this opcode. ** -** See also: Found, NotFound, NoConflict, SeekRowid +** See also: Found, NotFound, NoConflict */ -case OP_SeekRowid: { /* jump, in3 */ +case OP_NotExists: { /* jump, in3 */ VdbeCursor *pC; BtCursor *pCrsr; int res; u64 iKey; pIn3 = &aMem[pOp->p3]; - if( (pIn3->flags & MEM_Int)==0 ){ - applyAffinity(pIn3, SQLITE_AFF_NUMERIC, encoding); - if( (pIn3->flags & MEM_Int)==0 ) goto jump_to_p2; - } - /* Fall through into OP_NotExists */ -case OP_NotExists: /* jump, in3 */ - pIn3 = &aMem[pOp->p3]; assert( pIn3->flags & MEM_Int ); assert( pOp->p1>=0 && pOp->p1nCursor ); pC = p->apCsr[pOp->p1]; assert( pC!=0 ); #ifdef SQLITE_DEBUG @@ -81299,11 +80836,12 @@ } if( res ){ v = 1; /* IMP: R-61914-48074 */ }else{ assert( sqlite3BtreeCursorIsValid(pC->uc.pCursor) ); - v = sqlite3BtreeIntegerKey(pC->uc.pCursor); + rc = sqlite3BtreeKeySize(pC->uc.pCursor, &v); + assert( rc==SQLITE_OK ); /* Cannot fail following BtreeLast() */ if( v>=MAX_ROWID ){ pC->useRandomRowid = 1; }else{ v++; /* IMP: R-29538-34987 */ } @@ -81382,16 +80920,14 @@ ** incremented (otherwise not). If the OPFLAG_LASTROWID flag of P5 is set, ** then rowid is stored for subsequent return by the ** sqlite3_last_insert_rowid() function (otherwise it is unmodified). ** ** If the OPFLAG_USESEEKRESULT flag of P5 is set and if the result of -** the last seek operation (OP_NotExists or OP_SeekRowid) was a success, -** then this +** the last seek operation (OP_NotExists) was a success, then this ** operation will not attempt to find the appropriate row before doing ** the insert but will instead overwrite the row that the cursor is -** currently pointing to. Presumably, the prior OP_NotExists or -** OP_SeekRowid opcode +** currently pointing to. Presumably, the prior OP_NotExists opcode ** has already positioned the cursor correctly. This is an optimization ** that boosts performance by avoiding redundant seeks. ** ** If the OPFLAG_ISUPDATE flag is set, then this opcode is part of an ** UPDATE operation. Otherwise (if the flag is clear) then this opcode @@ -81419,16 +80955,17 @@ */ case OP_Insert: case OP_InsertInt: { Mem *pData; /* MEM cell holding data for the record to be inserted */ Mem *pKey; /* MEM cell holding key for the record */ + i64 iKey; /* The integer ROWID or key for the record to be inserted */ VdbeCursor *pC; /* Cursor to table into which insert is written */ + int nZero; /* Number of zero-bytes to append */ int seekResult; /* Result of prior seek or 0 if no USESEEKRESULT flag */ const char *zDb; /* database name - used by the update hook */ Table *pTab; /* Table structure - used by update and pre-update hooks */ int op; /* Opcode for update hook: SQLITE_UPDATE or SQLITE_INSERT */ - BtreePayload x; /* Payload to be inserted */ op = 0; pData = &aMem[pOp->p2]; assert( pOp->p1>=0 && pOp->p1nCursor ); assert( memIsValid(pData) ); @@ -81443,14 +80980,14 @@ if( pOp->opcode==OP_Insert ){ pKey = &aMem[pOp->p3]; assert( pKey->flags & MEM_Int ); assert( memIsValid(pKey) ); REGISTER_TRACE(pOp->p3, pKey); - x.nKey = pKey->u.i; + iKey = pKey->u.i; }else{ assert( pOp->opcode==OP_InsertInt ); - x.nKey = pOp->p3; + iKey = pOp->p3; } if( pOp->p4type==P4_TABLE && HAS_UPDATE_HOOK(db) ){ assert( pC->isTable ); assert( pC->iDb>=0 ); @@ -81467,41 +81004,39 @@ /* Invoke the pre-update hook, if any */ if( db->xPreUpdateCallback && pOp->p4type==P4_TABLE && !(pOp->p5 & OPFLAG_ISUPDATE) ){ - sqlite3VdbePreUpdateHook(p, pC, SQLITE_INSERT, zDb, pTab, x.nKey, pOp->p2); + sqlite3VdbePreUpdateHook(p, pC, SQLITE_INSERT, zDb, pTab, iKey, pOp->p2); } #endif if( pOp->p5 & OPFLAG_NCHANGE ) p->nChange++; - if( pOp->p5 & OPFLAG_LASTROWID ) db->lastRowid = lastRowid = x.nKey; + if( pOp->p5 & OPFLAG_LASTROWID ) db->lastRowid = lastRowid = iKey; if( pData->flags & MEM_Null ){ - x.pData = 0; - x.nData = 0; + pData->z = 0; + pData->n = 0; }else{ assert( pData->flags & (MEM_Blob|MEM_Str) ); - x.pData = pData->z; - x.nData = pData->n; } seekResult = ((pOp->p5 & OPFLAG_USESEEKRESULT) ? pC->seekResult : 0); if( pData->flags & MEM_Zero ){ - x.nZero = pData->u.nZero; + nZero = pData->u.nZero; }else{ - x.nZero = 0; + nZero = 0; } - x.pKey = 0; - rc = sqlite3BtreeInsert(pC->uc.pCursor, &x, + rc = sqlite3BtreeInsert(pC->uc.pCursor, 0, iKey, + pData->z, pData->n, nZero, (pOp->p5 & OPFLAG_APPEND)!=0, seekResult ); pC->deferredMoveto = 0; pC->cacheStatus = CACHE_STALE; /* Invoke the update-hook if required. */ if( rc ) goto abort_due_to_error; if( db->xUpdateCallback && op ){ - db->xUpdateCallback(db->pUpdateArg, op, zDb, pTab->zName, x.nKey); + db->xUpdateCallback(db->pUpdateArg, op, zDb, pTab->zName, iKey); } break; } /* Opcode: Delete P1 P2 P3 P4 P5 @@ -81556,11 +81091,12 @@ #ifdef SQLITE_DEBUG if( pOp->p4type==P4_TABLE && HasRowid(pOp->p4.pTab) && pOp->p5==0 ){ /* If p5 is zero, the seek operation that positioned the cursor prior to ** OP_Delete will have also set the pC->movetoTarget field to the rowid of ** the row that is being deleted */ - i64 iKey = sqlite3BtreeIntegerKey(pC->uc.pCursor); + i64 iKey = 0; + sqlite3BtreeKeySize(pC->uc.pCursor, &iKey); assert( pC->movetoTarget==iKey ); } #endif /* If the update-hook or pre-update-hook will be invoked, set zDb to @@ -81572,11 +81108,11 @@ assert( pC->iDb>=0 ); assert( pOp->p4.pTab!=0 ); zDb = db->aDb[pC->iDb].zName; pTab = pOp->p4.pTab; if( (pOp->p5 & OPFLAG_SAVEPOSITION)!=0 && pC->isTable ){ - pC->movetoTarget = sqlite3BtreeIntegerKey(pC->uc.pCursor); + sqlite3BtreeKeySize(pC->uc.pCursor, &pC->movetoTarget); } }else{ zDb = 0; /* Not needed. Silence a compiler warning. */ pTab = 0; /* Not needed. Silence a compiler warning. */ } @@ -81726,10 +81262,11 @@ case OP_RowKey: case OP_RowData: { VdbeCursor *pC; BtCursor *pCrsr; u32 n; + i64 n64; pOut = &aMem[pOp->p2]; memAboutToChange(p, pOut); /* Note that RowKey and RowData are really exactly the same instruction */ @@ -81743,13 +81280,12 @@ assert( pC->nullRow==0 ); assert( pC->uc.pCursor!=0 ); pCrsr = pC->uc.pCursor; /* The OP_RowKey and OP_RowData opcodes always follow OP_NotExists or - ** OP_SeekRowid or OP_Rewind/Op_Next with no intervening instructions - ** that might invalidate the cursor. - ** If this where not the case, on of the following assert()s + ** OP_Rewind/Op_Next with no intervening instructions that might invalidate + ** the cursor. If this where not the case, on of the following assert()s ** would fail. Should this ever change (because of changes in the code ** generator) then the fix would be to insert a call to ** sqlite3VdbeCursorMoveto(). */ assert( pC->deferredMoveto==0 ); @@ -81757,13 +81293,24 @@ #if 0 /* Not required due to the previous to assert() statements */ rc = sqlite3VdbeCursorMoveto(pC); if( rc!=SQLITE_OK ) goto abort_due_to_error; #endif - n = sqlite3BtreePayloadSize(pCrsr); - if( n>(u32)db->aLimit[SQLITE_LIMIT_LENGTH] ){ - goto too_big; + if( pC->isTable==0 ){ + assert( !pC->isTable ); + VVA_ONLY(rc =) sqlite3BtreeKeySize(pCrsr, &n64); + assert( rc==SQLITE_OK ); /* True because of CursorMoveto() call above */ + if( n64>db->aLimit[SQLITE_LIMIT_LENGTH] ){ + goto too_big; + } + n = (u32)n64; + }else{ + VVA_ONLY(rc =) sqlite3BtreeDataSize(pCrsr, &n); + assert( rc==SQLITE_OK ); /* DataSize() cannot fail */ + if( n>(u32)db->aLimit[SQLITE_LIMIT_LENGTH] ){ + goto too_big; + } } testcase( n==0 ); if( sqlite3VdbeMemClearAndResize(pOut, MAX(n,32)) ){ goto no_mem; } @@ -81824,11 +81371,12 @@ if( rc ) goto abort_due_to_error; if( pC->nullRow ){ pOut->flags = MEM_Null; break; } - v = sqlite3BtreeIntegerKey(pC->uc.pCursor); + rc = sqlite3BtreeKeySize(pC->uc.pCursor, &v); + assert( rc==SQLITE_OK ); /* Always so because of CursorRestore() above */ } pOut->u.i = v; break; } @@ -82099,11 +81647,12 @@ ** for tables is OP_Insert. */ case OP_SorterInsert: /* in2 */ case OP_IdxInsert: { /* in2 */ VdbeCursor *pC; - BtreePayload x; + int nKey; + const char *zKey; assert( pOp->p1>=0 && pOp->p1nCursor ); pC = p->apCsr[pOp->p1]; assert( pC!=0 ); assert( isSorter(pC)==(pOp->opcode==OP_SorterInsert) ); @@ -82115,16 +81664,13 @@ rc = ExpandBlob(pIn2); if( rc ) goto abort_due_to_error; if( pOp->opcode==OP_SorterInsert ){ rc = sqlite3VdbeSorterWrite(pC, pIn2); }else{ - x.nKey = pIn2->n; - x.pKey = pIn2->z; - x.nData = 0; - x.nZero = 0; - x.pData = 0; - rc = sqlite3BtreeInsert(pC->uc.pCursor, &x, pOp->p3, + nKey = pIn2->n; + zKey = pIn2->z; + rc = sqlite3BtreeInsert(pC->uc.pCursor, zKey, nKey, "", 0, 0, pOp->p3, ((pOp->p5 & OPFLAG_USESEEKRESULT) ? pC->seekResult : 0) ); assert( pC->deferredMoveto==0 ); pC->cacheStatus = CACHE_STALE; } @@ -83888,38 +83434,20 @@ ** ** If P2 is not zero, jump to instruction P2. */ case OP_Init: { /* jump */ char *zTrace; - - /* If the P4 argument is not NULL, then it must be an SQL comment string. - ** The "--" string is broken up to prevent false-positives with srcck1.c. - ** - ** This assert() provides evidence for: - ** EVIDENCE-OF: R-50676-09860 The callback can compute the same text that - ** would have been returned by the legacy sqlite3_trace() interface by - ** using the X argument when X begins with "--" and invoking - ** sqlite3_expanded_sql(P) otherwise. - */ - assert( pOp->p4.z==0 || strncmp(pOp->p4.z, "-" "- ", 3)==0 ); + char *z; #ifndef SQLITE_OMIT_TRACE - if( (db->mTrace & (SQLITE_TRACE_STMT|SQLITE_TRACE_LEGACY))!=0 + if( db->xTrace && !p->doingRerun && (zTrace = (pOp->p4.z ? pOp->p4.z : p->zSql))!=0 ){ -#ifndef SQLITE_OMIT_DEPRECATED - if( db->mTrace & SQLITE_TRACE_LEGACY ){ - void (*x)(void*,const char*) = (void(*)(void*,const char*))db->xTrace; - char *z = sqlite3VdbeExpandSql(p, zTrace); - x(db->pTraceArg, z); - sqlite3_free(z); - }else -#endif - { - (void)db->xTrace(SQLITE_TRACE_STMT, db->pTraceArg, p, zTrace); - } + z = sqlite3VdbeExpandSql(p, zTrace); + db->xTrace(db->pTraceArg, z); + sqlite3DbFree(db, z); } #ifdef SQLITE_USE_FCNTL_TRACE zTrace = (pOp->p4.z ? pOp->p4.z : p->zSql); if( zTrace ){ int i; @@ -84498,11 +84026,11 @@ ** slightly more efficient). Since you cannot write to a PK column ** using the incremental-blob API, this works. For the sessions module ** anyhow. */ sqlite3_int64 iKey; - iKey = sqlite3BtreeIntegerKey(p->pCsr); + sqlite3BtreeKeySize(p->pCsr, &iKey); sqlite3VdbePreUpdateHook( v, v->apCsr[0], SQLITE_DELETE, p->zDb, p->pTab, iKey, -1 ); } #endif @@ -85933,47 +85461,41 @@ } /* ** Merge the two sorted lists p1 and p2 into a single list. +** Set *ppOut to the head of the new list. */ -static SorterRecord *vdbeSorterMerge( +static void vdbeSorterMerge( SortSubtask *pTask, /* Calling thread context */ SorterRecord *p1, /* First list to merge */ - SorterRecord *p2 /* Second list to merge */ + SorterRecord *p2, /* Second list to merge */ + SorterRecord **ppOut /* OUT: Head of merged list */ ){ SorterRecord *pFinal = 0; SorterRecord **pp = &pFinal; int bCached = 0; - assert( p1!=0 && p2!=0 ); - for(;;){ + while( p1 && p2 ){ int res; res = pTask->xCompare( pTask, &bCached, SRVAL(p1), p1->nVal, SRVAL(p2), p2->nVal ); if( res<=0 ){ *pp = p1; pp = &p1->u.pNext; p1 = p1->u.pNext; - if( p1==0 ){ - *pp = p2; - break; - } }else{ *pp = p2; pp = &p2->u.pNext; p2 = p2->u.pNext; bCached = 0; - if( p2==0 ){ - *pp = p1; - break; - } } } - return pFinal; + *pp = p1 ? p1 : p2; + *ppOut = pFinal; } /* ** Return the SorterCompare function to compare values collected by the ** sorter object passed as the only argument. @@ -86022,21 +85544,20 @@ pNext = p->u.pNext; } p->u.pNext = 0; for(i=0; aSlot[i]; i++){ - p = vdbeSorterMerge(pTask, p, aSlot[i]); + vdbeSorterMerge(pTask, p, aSlot[i], &p); aSlot[i] = 0; } aSlot[i] = p; p = pNext; } p = 0; for(i=0; i<64; i++){ - if( aSlot[i]==0 ) continue; - p = p ? vdbeSorterMerge(pTask, p, aSlot[i]) : aSlot[i]; + vdbeSorterMerge(pTask, p, aSlot[i], &p); } pList->pList = p; sqlite3_free(aSlot); assert( pTask->pUnpacked->errCode==SQLITE_OK @@ -88652,15 +88173,11 @@ } if( is_agg && (pNC->ncFlags & NC_AllowAgg)==0 ){ sqlite3ErrorMsg(pParse, "misuse of aggregate function %.*s()", nId,zId); pNC->nErr++; is_agg = 0; - }else if( no_such_func && pParse->db->init.busy==0 -#ifdef SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION - && pParse->explain==0 -#endif - ){ + }else if( no_such_func && pParse->db->init.busy==0 ){ sqlite3ErrorMsg(pParse, "no such function: %.*s", nId, zId); pNC->nErr++; }else if( wrong_num_args ){ sqlite3ErrorMsg(pParse,"wrong number of arguments to function %.*s()", nId, zId); @@ -91256,15 +90773,10 @@ VdbeComment((v, "%s", pIdx->zName)); assert( IN_INDEX_INDEX_DESC == IN_INDEX_INDEX_ASC+1 ); eType = IN_INDEX_INDEX_ASC + pIdx->aSortOrder[0]; if( prRhsHasNull && !pTab->aCol[iCol].notNull ){ -#ifdef SQLITE_ENABLE_COLUMN_USED_MASK - const i64 sOne = 1; - sqlite3VdbeAddOp4Dup8(v, OP_ColumnsUsed, - iTab, 0, 0, (u8*)&sOne, P4_INT64); -#endif *prRhsHasNull = ++pParse->nMem; sqlite3SetHasNullFlag(v, iTab, *prRhsHasNull); } sqlite3VdbeJumpHere(v, iAddr); } @@ -91273,11 +90785,11 @@ } /* If no preexisting index is available for the IN clause ** and IN_INDEX_NOOP is an allowed reply ** and the RHS of the IN operator is a list, not a subquery - ** and the RHS is not constant or has two or fewer terms, + ** and the RHS is not contant or has two or fewer terms, ** then it is not worth creating an ephemeral table to evaluate ** the IN operator so return IN_INDEX_NOOP. */ if( eType==0 && (inFlags & IN_INDEX_NOOP_OK) @@ -91665,11 +91177,12 @@ } if( eType==IN_INDEX_ROWID ){ /* In this case, the RHS is the ROWID of table b-tree */ - sqlite3VdbeAddOp3(v, OP_SeekRowid, pExpr->iTable, destIfFalse, r1); + sqlite3VdbeAddOp2(v, OP_MustBeInt, r1, destIfFalse); VdbeCoverage(v); + sqlite3VdbeAddOp3(v, OP_NotExists, pExpr->iTable, destIfFalse, r1); VdbeCoverage(v); }else{ /* In this case, the RHS is an index b-tree. */ sqlite3VdbeAddOp4(v, OP_Affinity, r1, 1, 0, &affinity, 1); @@ -91978,11 +91491,11 @@ if( iCol<0 || iCol==pTab->iPKey ){ sqlite3VdbeAddOp2(v, OP_Rowid, iTabCur, regOut); }else{ int op = IsVirtual(pTab) ? OP_VColumn : OP_Column; int x = iCol; - if( !HasRowid(pTab) && !IsVirtual(pTab) ){ + if( !HasRowid(pTab) ){ x = sqlite3ColumnOfIndex(sqlite3PrimaryKeyIndex(pTab), iCol); } sqlite3VdbeAddOp3(v, op, iTabCur, x, regOut); } if( iCol>=0 ){ @@ -92381,15 +91894,10 @@ } nFarg = pFarg ? pFarg->nExpr : 0; assert( !ExprHasProperty(pExpr, EP_IntValue) ); zId = pExpr->u.zToken; pDef = sqlite3FindFunction(db, zId, nFarg, enc, 0); -#ifdef SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION - if( pDef==0 && pParse->explain ){ - pDef = sqlite3FindFunction(db, "unknown", nFarg, enc, 0); - } -#endif if( pDef==0 || pDef->xFinalize!=0 ){ sqlite3ErrorMsg(pParse, "unknown function: %s()", zId); break; } @@ -93407,65 +92915,10 @@ ){ return 1; } return 0; } - -/* -** An instance of the following structure is used by the tree walker -** to determine if an expression can be evaluated by reference to the -** index only, without having to do a search for the corresponding -** table entry. The IdxCover.pIdx field is the index. IdxCover.iCur -** is the cursor for the table. -*/ -struct IdxCover { - Index *pIdx; /* The index to be tested for coverage */ - int iCur; /* Cursor number for the table corresponding to the index */ -}; - -/* -** Check to see if there are references to columns in table -** pWalker->u.pIdxCover->iCur can be satisfied using the index -** pWalker->u.pIdxCover->pIdx. -*/ -static int exprIdxCover(Walker *pWalker, Expr *pExpr){ - if( pExpr->op==TK_COLUMN - && pExpr->iTable==pWalker->u.pIdxCover->iCur - && sqlite3ColumnOfIndex(pWalker->u.pIdxCover->pIdx, pExpr->iColumn)<0 - ){ - pWalker->eCode = 1; - return WRC_Abort; - } - return WRC_Continue; -} - -/* -** Determine if an index pIdx on table with cursor iCur contains will -** the expression pExpr. Return true if the index does cover the -** expression and false if the pExpr expression references table columns -** that are not found in the index pIdx. -** -** An index covering an expression means that the expression can be -** evaluated using only the index and without having to lookup the -** corresponding table entry. -*/ -SQLITE_PRIVATE int sqlite3ExprCoveredByIndex( - Expr *pExpr, /* The index to be tested */ - int iCur, /* The cursor number for the corresponding table */ - Index *pIdx /* The index that might be used for coverage */ -){ - Walker w; - struct IdxCover xcov; - memset(&w, 0, sizeof(w)); - xcov.iCur = iCur; - xcov.pIdx = pIdx; - w.xExprCallback = exprIdxCover; - w.u.pIdxCover = &xcov; - sqlite3WalkExpr(&w, pExpr); - return !w.eCode; -} - /* ** An instance of the following structure is used by the tree walker ** to count references to table columns in the arguments of an ** aggregate function, in order to implement the @@ -94417,11 +93870,10 @@ char *zCol; /* Null-terminated column definition */ Column *pCol; /* The new column */ Expr *pDflt; /* Default value for the new column */ sqlite3 *db; /* The database connection; */ Vdbe *v = pParse->pVdbe; /* The prepared statement under construction */ - int r1; /* Temporary registers */ db = pParse->db; if( pParse->nErr || db->mallocFailed ) return; assert( v!=0 ); pNew = pParse->pNewTable; @@ -94512,22 +93964,20 @@ ); sqlite3DbFree(db, zCol); db->flags = savedDbFlags; } - /* Make sure the schema version is at least 3. But do not upgrade - ** from less than 3 to 4, as that will corrupt any preexisting DESC - ** index. + /* If the default value of the new column is NULL, then the file + ** format to 2. If the default value of the new column is not NULL, + ** the file format be 3. Back when this feature was first added + ** in 2006, we went to the trouble to upgrade the file format to the + ** minimum support values. But 10-years on, we can assume that all + ** extent versions of SQLite support file-format 4, so we always and + ** unconditionally upgrade to 4. */ - r1 = sqlite3GetTempReg(pParse); - sqlite3VdbeAddOp3(v, OP_ReadCookie, iDb, r1, BTREE_FILE_FORMAT); - sqlite3VdbeUsesBtree(v, iDb); - sqlite3VdbeAddOp2(v, OP_AddImm, r1, -2); - sqlite3VdbeAddOp2(v, OP_IfPos, r1, sqlite3VdbeCurrentAddr(v)+2); - VdbeCoverage(v); - sqlite3VdbeAddOp3(v, OP_SetCookie, iDb, BTREE_FILE_FORMAT, 3); - sqlite3ReleaseTempReg(pParse, r1); + sqlite3VdbeAddOp3(v, OP_SetCookie, iDb, BTREE_FILE_FORMAT, + SQLITE_MAX_FILE_FORMAT); /* Reload the schema of the modified table. */ reloadTableSchema(pParse, pTab, pTab->zName); } @@ -97212,11 +96662,10 @@ ){ sqlite3 *db = pParse->db; /* Database handle */ char *zDb = db->aDb[iDb].zName; /* Name of attached database */ 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 #ifdef SQLITE_USER_AUTHENTICATION ,db->auth.zAuthUser #endif ); @@ -97703,11 +97152,11 @@ ** routine leaves an error message in pParse->zErrMsg where ** sqlite3FindTable() does not. */ SQLITE_PRIVATE Table *sqlite3LocateTable( Parse *pParse, /* context in which to report errors */ - u32 flags, /* LOCATE_VIEW or LOCATE_NOERR */ + int isView, /* True if looking for a VIEW rather than a TABLE */ const char *zName, /* Name of the table we are looking for */ const char *zDbase /* Name of the database. Might be NULL */ ){ Table *p; @@ -97717,11 +97166,11 @@ return 0; } p = sqlite3FindTable(pParse->db, zName, zDbase); if( p==0 ){ - const char *zMsg = flags & LOCATE_VIEW ? "no such view" : "no such table"; + const char *zMsg = isView ? "no such view" : "no such table"; #ifndef SQLITE_OMIT_VIRTUALTABLE if( sqlite3FindDbName(pParse->db, zDbase)<1 ){ /* If zName is the not the name of a table in the schema created using ** CREATE, then check to see if it is the name of an virtual table that ** can be an eponymous virtual table. */ @@ -97729,18 +97178,16 @@ if( pMod && sqlite3VtabEponymousTableInit(pParse, pMod) ){ return pMod->pEpoTab; } } #endif - if( (flags & LOCATE_NOERR)==0 ){ - if( zDbase ){ - sqlite3ErrorMsg(pParse, "%s: %s.%s", zMsg, zDbase, zName); - }else{ - sqlite3ErrorMsg(pParse, "%s: %s", zMsg, zName); - } - pParse->checkSchema = 1; - } + if( zDbase ){ + sqlite3ErrorMsg(pParse, "%s: %s.%s", zMsg, zDbase, zName); + }else{ + sqlite3ErrorMsg(pParse, "%s: %s", zMsg, zName); + } + pParse->checkSchema = 1; } return p; } @@ -97753,11 +97200,11 @@ ** non-NULL if it is part of a view or trigger program definition. See ** sqlite3FixSrcList() for details. */ SQLITE_PRIVATE Table *sqlite3LocateTableItem( Parse *pParse, - u32 flags, + int isView, struct SrcList_item *p ){ const char *zDb; assert( p->pSchema==0 || p->zDatabase==0 ); if( p->pSchema ){ @@ -97764,11 +97211,11 @@ int iDb = sqlite3SchemaToIndex(pParse->db, p->pSchema); zDb = pParse->db->aDb[iDb].zName; }else{ zDb = p->zDatabase; } - return sqlite3LocateTable(pParse, flags, p->zName, zDb); + return sqlite3LocateTable(pParse, isView, p->zName, zDb); } /* ** Locate the in-memory structure that describes ** a particular index given the name of that index @@ -97972,13 +97419,12 @@ db->lookaside.nOut : 0 ); /* Delete all indices associated with this table. */ for(pIndex = pTable->pIndex; pIndex; pIndex=pNext){ pNext = pIndex->pNext; - assert( pIndex->pSchema==pTable->pSchema - || (IsVirtual(pTable) && pIndex->idxType!=SQLITE_IDXTYPE_APPDEF) ); - if( (db==0 || db->pnBytesFreed==0) && !IsVirtual(pTable) ){ + assert( pIndex->pSchema==pTable->pSchema ); + if( !db || db->pnBytesFreed==0 ){ char *zName = pIndex->zName; TESTONLY ( Index *pOld = ) sqlite3HashInsert( &pIndex->pSchema->idxHash, zName, 0 ); assert( db==0 || sqlite3SchemaMutexHeld(db, 0, pIndex->pSchema) ); @@ -98656,11 +98102,11 @@ ){ Table *pTab = pParse->pNewTable; Column *pCol = 0; int iCol = -1, i; int nTerm; - if( pTab==0 ) goto primary_key_exit; + if( pTab==0 || IN_DECLARE_VTAB ) goto primary_key_exit; if( pTab->tabFlags & TF_HasPrimaryKey ){ sqlite3ErrorMsg(pParse, "table \"%s\" has more than one primary key", pTab->zName); goto primary_key_exit; } @@ -98702,12 +98148,16 @@ #ifndef SQLITE_OMIT_AUTOINCREMENT sqlite3ErrorMsg(pParse, "AUTOINCREMENT is only allowed on an " "INTEGER PRIMARY KEY"); #endif }else{ - sqlite3CreateIndex(pParse, 0, 0, 0, pList, onError, 0, - 0, sortOrder, 0, SQLITE_IDXTYPE_PRIMARYKEY); + Index *p; + p = sqlite3CreateIndex(pParse, 0, 0, 0, pList, onError, 0, + 0, sortOrder, 0); + if( p ){ + p->idxType = SQLITE_IDXTYPE_PRIMARYKEY; + } pList = 0; } primary_key_exit: sqlite3ExprListDelete(pParse->db, pList); @@ -99020,50 +98470,34 @@ ** has a WITHOUT ROWID clause. The job of this routine is to convert both ** internal schema data structures and the generated VDBE code so that they ** are appropriate for a WITHOUT ROWID table instead of a rowid table. ** Changes include: ** -** (1) Set all columns of the PRIMARY KEY schema object to be NOT NULL. -** (2) Convert the OP_CreateTable into an OP_CreateIndex. There is +** (1) Convert the OP_CreateTable into an OP_CreateIndex. There is ** no rowid btree for a WITHOUT ROWID. Instead, the canonical ** data storage is a covering index btree. -** (3) Bypass the creation of the sqlite_master table entry +** (2) Bypass the creation of the sqlite_master table entry ** for the PRIMARY KEY as the primary key index is now ** identified by the sqlite_master table entry of the table itself. -** (4) Set the Index.tnum of the PRIMARY KEY Index object in the +** (3) Set the Index.tnum of the PRIMARY KEY Index object in the ** schema to the rootpage from the main table. +** (4) Set all columns of the PRIMARY KEY schema object to be NOT NULL. ** (5) Add all table columns to the PRIMARY KEY Index object ** so that the PRIMARY KEY is a covering index. The surplus ** columns are part of KeyInfo.nXField and are not used for ** sorting or lookup or uniqueness checks. ** (6) Replace the rowid tail on all automatically generated UNIQUE ** indices with the PRIMARY KEY columns. -** -** For virtual tables, only (1) is performed. */ static void convertToWithoutRowidTable(Parse *pParse, Table *pTab){ Index *pIdx; Index *pPk; int nPk; int i, j; sqlite3 *db = pParse->db; Vdbe *v = pParse->pVdbe; - /* Mark every PRIMARY KEY column as NOT NULL (except for imposter tables) - */ - if( !db->init.imposterTable ){ - for(i=0; inCol; i++){ - if( (pTab->aCol[i].colFlags & COLFLAG_PRIMKEY)!=0 ){ - pTab->aCol[i].notNull = OE_Abort; - } - } - } - - /* The remaining transformations only apply to b-tree tables, not to - ** virtual tables */ - if( IN_DECLARE_VTAB ) return; - /* Convert the OP_CreateTable opcode that would normally create the ** root-page for the table into an OP_CreateIndex opcode. The index ** created will become the PRIMARY KEY index. */ if( pParse->addrCrTab ){ @@ -99081,14 +98515,13 @@ pList = sqlite3ExprListAppend(pParse, 0, sqlite3ExprAlloc(db, TK_ID, &ipkToken, 0)); if( pList==0 ) return; pList->a[0].sortOrder = pParse->iPkSortOrder; assert( pParse->pNewTable==pTab ); - sqlite3CreateIndex(pParse, 0, 0, 0, pList, pTab->keyConf, 0, 0, 0, 0, - SQLITE_IDXTYPE_PRIMARYKEY); - if( db->mallocFailed ) return; - pPk = sqlite3PrimaryKeyIndex(pTab); + pPk = sqlite3CreateIndex(pParse, 0, 0, 0, pList, pTab->keyConf, 0, 0, 0, 0); + if( pPk==0 ) return; + pPk->idxType = SQLITE_IDXTYPE_PRIMARYKEY; pTab->iPKey = -1; }else{ pPk = sqlite3PrimaryKeyIndex(pTab); /* Bypass the creation of the PRIMARY KEY btree and the sqlite_master @@ -99112,14 +98545,22 @@ pPk->aiColumn[j++] = pPk->aiColumn[i]; } } pPk->nKeyCol = j; } - assert( pPk!=0 ); pPk->isCovering = 1; - if( !db->init.imposterTable ) pPk->uniqNotNull = 1; + assert( pPk!=0 ); nPk = pPk->nKeyCol; + + /* Make sure every column of the PRIMARY KEY is NOT NULL. (Except, + ** do not enforce this for imposter tables.) */ + if( !db->init.imposterTable ){ + for(i=0; iaCol[pPk->aiColumn[i]].notNull = OE_Abort; + } + pPk->uniqNotNull = 1; + } /* The root page of the PRIMARY KEY is the table root page */ pPk->tnum = pTab->tnum; /* Update the in-memory representation of all UNIQUE indices by converting @@ -99871,11 +99312,10 @@ } assert( pParse->nErr==0 ); assert( pName->nSrc==1 ); if( sqlite3ReadSchema(pParse) ) goto exit_drop_table; if( noErr ) db->suppressErr++; - assert( isView==0 || isView==LOCATE_VIEW ); pTab = sqlite3LocateTableItem(pParse, isView, &pName->a[0]); if( noErr ) db->suppressErr--; if( pTab==0 ){ if( noErr ) sqlite3CodeVerifyNamedSchema(pParse, pName->a[0].zDatabase); @@ -100242,24 +99682,28 @@ ** currently being constructed by a CREATE TABLE statement. ** ** pList is a list of columns to be indexed. pList will be NULL if this ** is a primary key or unique-constraint on the most recent column added ** to the table currently under construction. +** +** If the index is created successfully, return a pointer to the new Index +** structure. This is used by sqlite3AddPrimaryKey() to mark the index +** as the tables primary key (Index.idxType==SQLITE_IDXTYPE_PRIMARYKEY) */ -SQLITE_PRIVATE void sqlite3CreateIndex( +SQLITE_PRIVATE Index *sqlite3CreateIndex( Parse *pParse, /* All information about this parse */ Token *pName1, /* First part of index name. May be NULL */ Token *pName2, /* Second part of index name. May be NULL */ SrcList *pTblName, /* Table to index. Use pParse->pNewTable if 0 */ ExprList *pList, /* A list of columns to be indexed */ int onError, /* OE_Abort, OE_Ignore, OE_Replace, or OE_None */ Token *pStart, /* The CREATE token that begins this statement */ Expr *pPIWhere, /* WHERE clause for partial indices */ int sortOrder, /* Sort order of primary key when pList==NULL */ - int ifNotExist, /* Omit error if index already exists */ - u8 idxType /* The index type */ + int ifNotExist /* Omit error if index already exists */ ){ + Index *pRet = 0; /* Pointer to return */ Table *pTab = 0; /* Table to be indexed */ Index *pIndex = 0; /* The index to be created */ char *zName = 0; /* Name of the index */ int nName; /* Number of characters in zName */ int i, j; @@ -100273,14 +99717,11 @@ int nExtra = 0; /* Space allocated for zExtra[] */ int nExtraCol; /* Number of extra columns needed */ char *zExtra = 0; /* Extra space after the Index object */ Index *pPk = 0; /* PRIMARY KEY index for WITHOUT ROWID tables */ - if( db->mallocFailed || pParse->nErr>0 ){ - goto exit_create_index; - } - if( IN_DECLARE_VTAB && idxType!=SQLITE_IDXTYPE_PRIMARYKEY ){ + if( db->mallocFailed || IN_DECLARE_VTAB || pParse->nErr>0 ){ goto exit_create_index; } if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){ goto exit_create_index; } @@ -100402,17 +99843,10 @@ for(pLoop=pTab->pIndex, n=1; pLoop; pLoop=pLoop->pNext, n++){} zName = sqlite3MPrintf(db, "sqlite_autoindex_%s_%d", pTab->zName, n); if( zName==0 ){ goto exit_create_index; } - - /* Automatic index names generated from within sqlite3_declare_vtab() - ** must have names that are distinct from normal automatic index names. - ** The following statement converts "sqlite3_autoindex..." into - ** "sqlite3_butoindex..." in order to make the names distinct. - ** The "vtab_err.test" test demonstrates the need of this statement. */ - if( IN_DECLARE_VTAB ) zName[7]++; } /* Check for authorization to create an index. */ #ifndef SQLITE_OMIT_AUTHORIZATION @@ -100472,11 +99906,11 @@ zExtra += nName + 1; memcpy(pIndex->zName, zName, nName+1); pIndex->pTable = pTab; pIndex->onError = (u8)onError; pIndex->uniqNotNull = onError!=OE_None; - pIndex->idxType = idxType; + pIndex->idxType = pName ? SQLITE_IDXTYPE_APPDEF : SQLITE_IDXTYPE_UNIQUE; pIndex->pSchema = db->aDb[iDb].pSchema; pIndex->nKeyCol = pList->nExpr; if( pPIWhere ){ sqlite3ResolveSelfReference(pParse, pTab, NC_PartIdx, pPIWhere, 0); pIndex->pPartIdxWhere = pPIWhere; @@ -100652,11 +100086,11 @@ } if( pIdx->onError==OE_Default ){ pIdx->onError = pIndex->onError; } } - if( idxType==SQLITE_IDXTYPE_PRIMARYKEY ) pIdx->idxType = idxType; + pRet = pIdx; goto exit_create_index; } } } @@ -100664,11 +100098,10 @@ ** in-memory database structures. */ assert( pParse->nErr==0 ); if( db->init.busy ){ Index *p; - assert( !IN_DECLARE_VTAB ); assert( sqlite3SchemaMutexHeld(db, 0, pIndex->pSchema) ); p = sqlite3HashInsert(&pIndex->pSchema->idxHash, pIndex->zName, pIndex); if( p ){ assert( p==pIndex ); /* Malloc must have failed */ @@ -100746,11 +100179,11 @@ if( pTblName ){ sqlite3RefillIndex(pParse, pIndex, iMem); sqlite3ChangeCookie(pParse, iDb); sqlite3VdbeAddParseSchemaOp(v, iDb, sqlite3MPrintf(db, "name='%q' AND type='index'", pIndex->zName)); - sqlite3VdbeAddOp0(v, OP_Expire); + sqlite3VdbeAddOp1(v, OP_Expire, 0); } sqlite3VdbeJumpHere(v, pIndex->tnum); } @@ -100771,10 +100204,11 @@ pOther = pOther->pNext; } pIndex->pNext = pOther->pNext; pOther->pNext = pIndex; } + pRet = pIndex; pIndex = 0; } /* Clean up before exiting */ exit_create_index: @@ -100781,10 +100215,11 @@ if( pIndex ) freeIndex(db, pIndex); sqlite3ExprDelete(db, pPIWhere); sqlite3ExprListDelete(db, pList); sqlite3SrcListDelete(db, pTblName); sqlite3DbFree(db, zName); + return pRet; } /* ** Fill the Index.aiRowEst[] array with default information - information ** to be used when we have not run the ANALYZE command. @@ -100809,15 +100244,14 @@ LogEst *a = pIdx->aiRowLogEst; int nCopy = MIN(ArraySize(aVal), pIdx->nKeyCol); int i; /* Set the first entry (number of rows in the index) to the estimated - ** number of rows in the table, or half the number of rows in the table - ** for a partial index. But do not let the estimate drop below 10. */ + ** number of rows in the table. Or 10, if the estimated number of rows + ** in the table is less than that. */ a[0] = pIdx->pTable->nRowLogEst; - if( pIdx->pPartIdxWhere!=0 ) a[0] -= 10; assert( 10==sqlite3LogEst(2) ); - if( a[0]<33 ) a[0] = 33; assert( 33==sqlite3LogEst(10) ); + if( a[0]<33 ) a[0] = 33; assert( 33==sqlite3LogEst(10) ); /* Estimate that a[1] is 10, a[2] is 9, a[3] is 8, a[4] is 7, a[5] is ** 6 and each subsequent value (if any) is 5. */ memcpy(&a[1], aVal, nCopy*sizeof(LogEst)); for(i=nCopy+1; i<=pIdx->nKeyCol; i++){ @@ -101694,10 +101128,14 @@ } #endif /* ** Return a KeyInfo structure that is appropriate for the given Index. +** +** The KeyInfo structure for an index is cached in the Index object. +** So there might be multiple references to the returned pointer. The +** caller should not try to modify the KeyInfo object. ** ** The caller should invoke sqlite3KeyInfoUnref() on the returned object ** when it has finished using it. */ SQLITE_PRIVATE KeyInfo *sqlite3KeyInfoOfIndex(Parse *pParse, Index *pIdx){ @@ -103926,11 +103364,11 @@ continue; } } c2 = Utf8Read(zString); if( c==c2 ) continue; - if( noCase && sqlite3Tolower(c)==sqlite3Tolower(c2) && c<0x80 && c2<0x80 ){ + if( noCase && c<0x80 && c2<0x80 && sqlite3Tolower(c)==sqlite3Tolower(c2) ){ continue; } if( c==matchOne && zPattern!=zEscaped && c2!=0 ) continue; return 0; } @@ -104501,30 +103939,10 @@ } } sqlite3_result_text(context, (char*)zIn, nIn, SQLITE_TRANSIENT); } - -#ifdef SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION -/* -** The "unknown" function is automatically substituted in place of -** any unrecognized function name when doing an EXPLAIN or EXPLAIN QUERY PLAN -** when the SQLITE_ENABLE_UNKNOWN_FUNCTION compile-time option is used. -** When the "sqlite3" command-line shell is built using this functionality, -** that allows an EXPLAIN or EXPLAIN QUERY PLAN for complex queries -** involving application-defined functions to be examined in a generic -** sqlite3 shell. -*/ -static void unknownFunc( - sqlite3_context *context, - int argc, - sqlite3_value **argv -){ - /* no-op */ -} -#endif /*SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION*/ - /* IMP: R-25361-16150 This function is omitted from SQLite by default. It ** is only available if the SQLITE_SOUNDEX compile-time option is used ** when SQLite is built. */ @@ -104992,20 +104410,17 @@ AGGREGATE(count, 1, 0, 0, countStep, countFinalize ), AGGREGATE(group_concat, 1, 0, 0, groupConcatStep, groupConcatFinalize), AGGREGATE(group_concat, 2, 0, 0, groupConcatStep, groupConcatFinalize), LIKEFUNC(glob, 2, &globInfo, SQLITE_FUNC_LIKE|SQLITE_FUNC_CASE), -#ifdef SQLITE_CASE_SENSITIVE_LIKE + #ifdef SQLITE_CASE_SENSITIVE_LIKE LIKEFUNC(like, 2, &likeInfoAlt, SQLITE_FUNC_LIKE|SQLITE_FUNC_CASE), LIKEFUNC(like, 3, &likeInfoAlt, SQLITE_FUNC_LIKE|SQLITE_FUNC_CASE), -#else + #else LIKEFUNC(like, 2, &likeInfoNorm, SQLITE_FUNC_LIKE), LIKEFUNC(like, 3, &likeInfoNorm, SQLITE_FUNC_LIKE), -#endif -#ifdef SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION - FUNCTION(unknown, -1, 0, 0, unknownFunc ), -#endif + #endif FUNCTION(coalesce, 1, 0, 0, 0 ), FUNCTION(coalesce, 0, 0, 0, 0 ), FUNCTION2(coalesce, -1, 0, 0, noopFunc, SQLITE_FUNC_COALESCE), }; #ifndef SQLITE_OMIT_ALTERTABLE @@ -106408,12 +105823,11 @@ */ SQLITE_PRIVATE void sqlite3FkDelete(sqlite3 *db, Table *pTab){ FKey *pFKey; /* Iterator variable */ FKey *pNext; /* Copy of pFKey->pNextFrom */ - assert( db==0 || IsVirtual(pTab) - || sqlite3SchemaMutexHeld(db, 0, pTab->pSchema) ); + assert( db==0 || sqlite3SchemaMutexHeld(db, 0, pTab->pSchema) ); for(pFKey=pTab->pFKey; pFKey; pFKey=pNext){ /* Remove the FK from the fkeyHash hash table. */ if( !db || db->pnBytesFreed==0 ){ if( pFKey->pPrevTo ){ @@ -108819,13 +108233,15 @@ ** shared libraries that want to be imported as extensions into ** an SQLite instance. Shared libraries that intend to be loaded ** as extensions by SQLite should #include this file instead of ** sqlite3.h. */ -#ifndef SQLITE3EXT_H -#define SQLITE3EXT_H +#ifndef _SQLITE3EXT_H_ +#define _SQLITE3EXT_H_ /* #include "sqlite3.h" */ + +typedef struct sqlite3_api_routines sqlite3_api_routines; /* ** The following structure holds pointers to all of the SQLite API ** routines. ** @@ -109083,25 +108499,12 @@ int (*status64)(int,sqlite3_int64*,sqlite3_int64*,int); int (*strlike)(const char*,const char*,unsigned int); int (*db_cacheflush)(sqlite3*); /* Version 3.12.0 and later */ int (*system_errno)(sqlite3*); - /* Version 3.14.0 and later */ - int (*trace_v2)(sqlite3*,unsigned,int(*)(unsigned,void*,void*,void*),void*); - char *(*expanded_sql)(sqlite3_stmt*); }; -/* -** This is the function signature used for all extension entry points. It -** is also defined in the file "loadext.c". -*/ -typedef int (*sqlite3_loadext_entry)( - sqlite3 *db, /* Handle to the database. */ - char **pzErrMsg, /* Used to set error string on failure. */ - const sqlite3_api_routines *pThunk /* Extension API function pointers. */ -); - /* ** The following macros redefine the API routines so that they are ** redirected through the global sqlite3_api structure. ** ** This header file is also used by the loadext.c source file @@ -109341,13 +108744,10 @@ #define sqlite3_status64 sqlite3_api->status64 #define sqlite3_strlike sqlite3_api->strlike #define sqlite3_db_cacheflush sqlite3_api->db_cacheflush /* Version 3.12.0 and later */ #define sqlite3_system_errno sqlite3_api->system_errno -/* Version 3.14.0 and later */ -#define sqlite3_trace_v2 sqlite3_api->trace_v2 -#define sqlite3_expanded_sql sqlite3_api->expanded_sql #endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */ #if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) /* This case when the file really is being compiled as a loadable ** extension */ @@ -109361,18 +108761,19 @@ # define SQLITE_EXTENSION_INIT1 /*no-op*/ # define SQLITE_EXTENSION_INIT2(v) (void)v; /* unused parameter */ # define SQLITE_EXTENSION_INIT3 /*no-op*/ #endif -#endif /* SQLITE3EXT_H */ +#endif /* _SQLITE3EXT_H_ */ /************** End of sqlite3ext.h ******************************************/ /************** Continuing where we left off in loadext.c ********************/ /* #include "sqliteInt.h" */ /* #include */ #ifndef SQLITE_OMIT_LOAD_EXTENSION + /* ** Some API routines are omitted when various features are ** excluded from a build of SQLite. Substitute a NULL pointer ** for any missing APIs. */ @@ -109438,11 +108839,11 @@ #ifdef SQLITE_OMIT_SHARED_CACHE # define sqlite3_enable_shared_cache 0 #endif -#if defined(SQLITE_OMIT_TRACE) || defined(SQLITE_OMIT_DEPRECATED) +#ifdef SQLITE_OMIT_TRACE # define sqlite3_profile 0 # define sqlite3_trace 0 #endif #ifdef SQLITE_OMIT_GET_TABLE @@ -109458,14 +108859,10 @@ #define sqlite3_blob_read 0 #define sqlite3_blob_write 0 #define sqlite3_blob_reopen 0 #endif -#if defined(SQLITE_OMIT_TRACE) -# define sqlite3_trace_v2 0 -#endif - /* ** The following structure contains pointers to all SQLite API routines. ** A pointer to this structure is passed into extensions when they are ** loaded so that the extension can make calls back into the SQLite ** library. @@ -109767,14 +109164,11 @@ /* Version 3.10.0 and later */ sqlite3_status64, sqlite3_strlike, sqlite3_db_cacheflush, /* Version 3.12.0 and later */ - sqlite3_system_errno, - /* Version 3.14.0 and later */ - sqlite3_trace_v2, - sqlite3_expanded_sql + sqlite3_system_errno }; /* ** Attempt to load an SQLite extension library contained in the file ** zFile. The entry point is zProc. zProc may be 0 in which case a @@ -109793,18 +109187,17 @@ const char *zProc, /* Entry point. Use "sqlite3_extension_init" if 0 */ char **pzErrMsg /* Put error message here if not 0 */ ){ sqlite3_vfs *pVfs = db->pVfs; void *handle; - sqlite3_loadext_entry xInit; + int (*xInit)(sqlite3*,char**,const sqlite3_api_routines*); char *zErrmsg = 0; const char *zEntry; char *zAltEntry = 0; void **aHandle; u64 nMsg = 300 + sqlite3Strlen30(zFile); int ii; - int rc; /* Shared library endings to try if zFile cannot be loaded as written */ static const char *azEndings[] = { #if SQLITE_OS_WIN "dll" @@ -109852,11 +109245,12 @@ sqlite3OsDlError(pVfs, nMsg-1, zErrmsg); } } return SQLITE_ERROR; } - xInit = (sqlite3_loadext_entry)sqlite3OsDlSym(pVfs, handle, zEntry); + xInit = (int(*)(sqlite3*,char**,const sqlite3_api_routines*)) + sqlite3OsDlSym(pVfs, handle, zEntry); /* If no entry point was specified and the default legacy ** entry point name "sqlite3_extension_init" was not found, then ** construct an entry point name "sqlite3_X_init" where the X is ** replaced by the lowercase value of every ASCII alphabetic @@ -109884,11 +109278,12 @@ zAltEntry[iEntry++] = (char)sqlite3UpperToLower[(unsigned)c]; } } memcpy(zAltEntry+iEntry, "_init", 6); zEntry = zAltEntry; - xInit = (sqlite3_loadext_entry)sqlite3OsDlSym(pVfs, handle, zEntry); + xInit = (int(*)(sqlite3*,char**,const sqlite3_api_routines*)) + sqlite3OsDlSym(pVfs, handle, zEntry); } if( xInit==0 ){ if( pzErrMsg ){ nMsg += sqlite3Strlen30(zEntry); *pzErrMsg = zErrmsg = sqlite3_malloc64(nMsg); @@ -109901,13 +109296,11 @@ sqlite3OsDlClose(pVfs, handle); sqlite3_free(zAltEntry); return SQLITE_ERROR; } sqlite3_free(zAltEntry); - rc = xInit(db, &zErrmsg, &sqlite3Apis); - if( rc ){ - if( rc==SQLITE_OK_LOAD_PERMANENTLY ) return SQLITE_OK; + if( xInit(db, &zErrmsg, &sqlite3Apis) ){ if( pzErrMsg ){ *pzErrMsg = sqlite3_mprintf("error during initialization: %s", zErrmsg); } sqlite3_free(zErrmsg); sqlite3OsDlClose(pVfs, handle); @@ -110014,13 +109407,11 @@ /* ** Register a statically linked extension that is automatically ** loaded by every new database connection. */ -SQLITE_API int SQLITE_STDCALL sqlite3_auto_extension( - void (*xInit)(void) -){ +SQLITE_API int SQLITE_STDCALL sqlite3_auto_extension(void (*xInit)(void)){ int rc = SQLITE_OK; #ifndef SQLITE_OMIT_AUTOINIT rc = sqlite3_initialize(); if( rc ){ return rc; @@ -110061,13 +109452,11 @@ ** routine is a no-op. ** ** Return 1 if xInit was found on the list and removed. Return 0 if xInit ** was not on the list. */ -SQLITE_API int SQLITE_STDCALL sqlite3_cancel_auto_extension( - void (*xInit)(void) -){ +SQLITE_API int SQLITE_STDCALL sqlite3_cancel_auto_extension(void (*xInit)(void)){ #if SQLITE_THREADSAFE sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); #endif int i; int n = 0; @@ -110112,11 +109501,11 @@ */ SQLITE_PRIVATE void sqlite3AutoLoadExtensions(sqlite3 *db){ u32 i; int go = 1; int rc; - sqlite3_loadext_entry xInit; + int (*xInit)(sqlite3*,char**,const sqlite3_api_routines*); wsdAutoextInit; if( wsdAutoext.nExt==0 ){ /* Common case: early out without every having to acquire a mutex */ return; @@ -110129,11 +109518,12 @@ sqlite3_mutex_enter(mutex); if( i>=wsdAutoext.nExt ){ xInit = 0; go = 0; }else{ - xInit = (sqlite3_loadext_entry)wsdAutoext.aExt[i]; + xInit = (int(*)(sqlite3*,char**,const sqlite3_api_routines*)) + wsdAutoext.aExt[i]; } sqlite3_mutex_leave(mutex); zErrmsg = 0; if( xInit && (rc = xInit(db, &zErrmsg, &sqlite3Apis))!=0 ){ sqlite3ErrorWithMsg(db, rc, @@ -111644,11 +111034,11 @@ /* Many of the flag-pragmas modify the code generated by the SQL ** compiler (eg. count_changes). So add an opcode to expire all ** compiled SQL statements after modifying a pragma value. */ - sqlite3VdbeAddOp0(v, OP_Expire); + sqlite3VdbeAddOp2(v, OP_Expire, 0, 0); setAllPagerFlags(db); } break; } #endif /* SQLITE_OMIT_FLAG_PRAGMAS */ @@ -111666,11 +111056,11 @@ ** notnull: True if 'NOT NULL' is part of column declaration ** dflt_value: The default value for the column, if any. */ case PragTyp_TABLE_INFO: if( zRight ){ Table *pTab; - pTab = sqlite3LocateTable(pParse, LOCATE_NOERR, zRight, zDb); + pTab = sqlite3FindTable(db, zRight, zDb); if( pTab ){ static const char *azCol[] = { "cid", "name", "type", "notnull", "dflt_value", "pk" }; int i, k; @@ -111948,14 +111338,16 @@ assert( iKey>=0 && iKeynCol ); if( iKey!=pTab->iPKey ){ sqlite3VdbeAddOp3(v, OP_Column, 0, iKey, regRow); sqlite3ColumnDefault(v, pTab, iKey, regRow); sqlite3VdbeAddOp2(v, OP_IsNull, regRow, addrOk); VdbeCoverage(v); + sqlite3VdbeAddOp2(v, OP_MustBeInt, regRow, + sqlite3VdbeCurrentAddr(v)+3); VdbeCoverage(v); }else{ sqlite3VdbeAddOp2(v, OP_Rowid, 0, regRow); } - sqlite3VdbeAddOp3(v, OP_SeekRowid, i, 0, regRow); VdbeCoverage(v); + sqlite3VdbeAddOp3(v, OP_NotExists, i, 0, regRow); VdbeCoverage(v); sqlite3VdbeGoto(v, addrOk); sqlite3VdbeJumpHere(v, sqlite3VdbeCurrentAddr(v)-2); }else{ for(j=0; jnCol; j++){ sqlite3ExprCodeGetColumnOfTable(v, pTab, 0, @@ -113522,11 +112914,10 @@ int regReturn; /* Register holding block-output return address */ int labelBkOut; /* Start label for the block-output subroutine */ int addrSortIndex; /* Address of the OP_SorterOpen or OP_OpenEphemeral */ int labelDone; /* Jump here when done, ex: LIMIT reached */ u8 sortFlags; /* Zero or more SORTFLAG_* bits */ - u8 bOrderedInnerLoop; /* ORDER BY correctly sorts the inner loop */ }; #define SORTFLAG_UseSorter 0x01 /* Use SorterOpen instead of OpenEphemeral */ /* ** Delete all the content of a Select structure. Deallocate the structure @@ -114056,34 +113447,13 @@ op = OP_IdxInsert; } sqlite3VdbeAddOp2(v, op, pSort->iECursor, regRecord); if( iLimit ){ int addr; - int r1 = 0; - /* Fill the sorter until it contains LIMIT+OFFSET entries. (The iLimit - ** register is initialized with value of LIMIT+OFFSET.) After the sorter - ** fills up, delete the least entry in the sorter after each insert. - ** Thus we never hold more than the LIMIT+OFFSET rows in memory at once */ addr = sqlite3VdbeAddOp3(v, OP_IfNotZero, iLimit, 0, 1); VdbeCoverage(v); sqlite3VdbeAddOp1(v, OP_Last, pSort->iECursor); - if( pSort->bOrderedInnerLoop ){ - r1 = ++pParse->nMem; - sqlite3VdbeAddOp3(v, OP_Column, pSort->iECursor, nExpr, r1); - VdbeComment((v, "seq")); - } sqlite3VdbeAddOp1(v, OP_Delete, pSort->iECursor); - if( pSort->bOrderedInnerLoop ){ - /* If the inner loop is driven by an index such that values from - ** the same iteration of the inner loop are in sorted order, then - ** immediately jump to the next iteration of an inner loop if the - ** entry from the current iteration does not fit into the top - ** LIMIT+OFFSET entries of the sorter. */ - int iBrk = sqlite3VdbeCurrentAddr(v) + 2; - sqlite3VdbeAddOp3(v, OP_Eq, regBase+nExpr, iBrk, r1); - sqlite3VdbeChangeP5(v, SQLITE_NULLEQ); - VdbeCoverage(v); - } sqlite3VdbeJumpHere(v, addr); } } /* @@ -114494,11 +113864,11 @@ ** Allocate a KeyInfo object sufficient for an index of N key columns and ** X extra columns. */ SQLITE_PRIVATE KeyInfo *sqlite3KeyInfoAlloc(sqlite3 *db, int N, int X){ int nExtra = (N+X)*(sizeof(CollSeq*)+1); - KeyInfo *p = sqlite3DbMallocRaw(db, sizeof(KeyInfo) + nExtra); + KeyInfo *p = sqlite3Malloc(sizeof(KeyInfo) + nExtra); if( p ){ p->aSortOrder = (u8*)&p->aColl[N+X]; p->nField = (u16)N; p->nXField = (u16)X; p->enc = ENC(db); @@ -114516,11 +113886,11 @@ */ SQLITE_PRIVATE void sqlite3KeyInfoUnref(KeyInfo *p){ if( p ){ assert( p->nRef>0 ); p->nRef--; - if( p->nRef==0 ) sqlite3DbFree(p->db, p); + if( p->nRef==0 ) sqlite3DbFree(0, p); } } /* ** Make a new pointer to a KeyInfo object @@ -118664,11 +118034,10 @@ if( sDistinct.isTnct && sqlite3WhereIsDistinct(pWInfo) ){ sDistinct.eTnctType = sqlite3WhereIsDistinct(pWInfo); } if( sSort.pOrderBy ){ sSort.nOBSat = sqlite3WhereIsOrdered(pWInfo); - sSort.bOrderedInnerLoop = sqlite3WhereOrderedInnerLoop(pWInfo); if( sSort.nOBSat==sSort.pOrderBy->nExpr ){ sSort.pOrderBy = 0; } } @@ -121434,11 +120803,11 @@ Btree *pTemp; /* The temporary database we vacuum into */ char *zSql = 0; /* SQL statements */ int saved_flags; /* Saved value of the db->flags */ int saved_nChange; /* Saved value of db->nChange */ int saved_nTotalChange; /* Saved value of db->nTotalChange */ - u8 saved_mTrace; /* Saved trace settings */ + void (*saved_xTrace)(void*,const char*); /* Saved db->xTrace */ Db *pDb = 0; /* Database to detach at end of vacuum */ int isMemDb; /* True if vacuuming a :memory: database */ int nRes; /* Bytes of reserved space at the end of each page */ int nDb; /* Number of attached databases */ @@ -121455,14 +120824,14 @@ ** restored before returning. Then set the writable-schema flag, and ** disable CHECK and foreign key constraints. */ saved_flags = db->flags; saved_nChange = db->nChange; saved_nTotalChange = db->nTotalChange; - saved_mTrace = db->mTrace; + saved_xTrace = db->xTrace; db->flags |= SQLITE_WriteSchema | SQLITE_IgnoreChecks | SQLITE_PreferBuiltin; db->flags &= ~(SQLITE_ForeignKeys | SQLITE_ReverseOrder); - db->mTrace = 0; + db->xTrace = 0; pMain = db->aDb[0].pBt; isMemDb = sqlite3PagerIsMemdb(sqlite3BtreePager(pMain)); /* Attach the temporary database as 'vacuum_db'. The synchronous pragma @@ -121510,12 +120879,10 @@ sqlite3CodecGetKey(db, 0, (void**)&zKey, &nKey); if( nKey ) db->nextPagesize = 0; } #endif - sqlite3BtreeSetCacheSize(pTemp, db->aDb[0].pSchema->cache_size); - sqlite3BtreeSetSpillSize(pTemp, sqlite3BtreeSetSpillSize(pMain,0)); rc = execSql(db, pzErrMsg, "PRAGMA vacuum_db.synchronous=OFF"); if( rc!=SQLITE_OK ) goto end_of_vacuum; /* Begin a transaction and take an exclusive lock on the main database ** file. This is done before the sqlite3BtreeGetPageSize(pMain) call below, @@ -121660,11 +121027,11 @@ end_of_vacuum: /* Restore the original value of db->flags */ db->flags = saved_flags; db->nChange = saved_nChange; db->nTotalChange = saved_nTotalChange; - db->mTrace = saved_mTrace; + db->xTrace = saved_xTrace; sqlite3BtreeSetPageSize(pMain, -1, -1, 1); /* Currently there is an SQL level transaction open on the vacuum ** database. No locks are held on any other files (since the main file ** was committed at the btree level). So it safe to end the transaction @@ -122109,11 +121476,11 @@ ); sqlite3DbFree(db, zStmt); v = sqlite3GetVdbe(pParse); sqlite3ChangeCookie(pParse, iDb); - sqlite3VdbeAddOp0(v, OP_Expire); + sqlite3VdbeAddOp2(v, OP_Expire, 0, 0); zWhere = sqlite3MPrintf(db, "name='%q' AND type='table'", pTab->zName); sqlite3VdbeAddParseSchemaOp(v, iDb, zWhere); iReg = ++pParse->nMem; sqlite3VdbeLoadString(v, iReg, pTab->zName); @@ -122445,28 +121812,14 @@ && !db->mallocFailed && !pParse->pNewTable->pSelect && (pParse->pNewTable->tabFlags & TF_Virtual)==0 ){ if( !pTab->aCol ){ - Table *pNew = pParse->pNewTable; - Index *pIdx; - pTab->aCol = pNew->aCol; - pTab->nCol = pNew->nCol; - pTab->tabFlags |= pNew->tabFlags & (TF_WithoutRowid|TF_NoVisibleRowid); - pNew->nCol = 0; - pNew->aCol = 0; - assert( pTab->pIndex==0 ); - if( !HasRowid(pNew) && pCtx->pVTable->pMod->pModule->xUpdate!=0 ){ - rc = SQLITE_ERROR; - } - pIdx = pNew->pIndex; - if( pIdx ){ - assert( pIdx->pNext==0 ); - pTab->pIndex = pIdx; - pNew->pIndex = 0; - pIdx->pTable = pTab; - } + pTab->aCol = pParse->pNewTable->aCol; + pTab->nCol = pParse->pNewTable->nCol; + pParse->pNewTable->nCol = 0; + pParse->pNewTable->aCol = 0; } pCtx->bDeclared = 1; }else{ sqlite3ErrorWithMsg(db, SQLITE_ERROR, (zErr ? "%s" : 0), zErr); sqlite3DbFree(db, zErr); @@ -122498,11 +121851,11 @@ SQLITE_PRIVATE int sqlite3VtabCallDestroy(sqlite3 *db, int iDb, const char *zTab){ int rc = SQLITE_OK; Table *pTab; pTab = sqlite3FindTable(db, zTab, db->aDb[iDb].zName); - if( pTab!=0 && ALWAYS(pTab->pVTable!=0) ){ + if( ALWAYS(pTab!=0 && pTab->pVTable!=0) ){ VTable *p; int (*xDestroy)(sqlite3_vtab *); for(p=pTab->pVTable; p; p=p->pNext){ assert( p->pVtab ); if( p->pVtab->nRef>0 ){ @@ -122638,14 +121991,11 @@ if( rc==SQLITE_OK ){ rc = pModule->xBegin(pVTab->pVtab); if( rc==SQLITE_OK ){ int iSvpt = db->nStatement + db->nSavepoint; addToVTrans(db, pVTab); - if( iSvpt && pModule->xSavepoint ){ - pVTab->iSavepoint = iSvpt; - rc = pModule->xSavepoint(pVTab->pVtab, iSvpt-1); - } + if( iSvpt ) rc = sqlite3VtabSavepoint(db, SAVEPOINT_BEGIN, iSvpt-1); } } } return rc; } @@ -122795,11 +122145,11 @@ sqlite3OomFault(pToplevel->db); } } /* -** Check to see if virtual table module pMod can be have an eponymous +** Check to see if virtual tale module pMod can be have an eponymous ** virtual table instance. If it can, create one if one does not already ** exist. Return non-zero if the eponymous virtual table instance exists ** when this routine returns, and return zero if it does not exist. ** ** An eponymous virtual table instance is one that is named after its @@ -122812,22 +122162,21 @@ */ SQLITE_PRIVATE int sqlite3VtabEponymousTableInit(Parse *pParse, Module *pMod){ const sqlite3_module *pModule = pMod->pModule; Table *pTab; char *zErr = 0; + int nName; int rc; sqlite3 *db = pParse->db; if( pMod->pEpoTab ) return 1; if( pModule->xCreate!=0 && pModule->xCreate!=pModule->xConnect ) return 0; - pTab = sqlite3DbMallocZero(db, sizeof(Table)); + nName = sqlite3Strlen30(pMod->zName) + 1; + pTab = sqlite3DbMallocZero(db, sizeof(Table) + nName); if( pTab==0 ) return 0; - pTab->zName = sqlite3DbStrDup(db, pMod->zName); - if( pTab->zName==0 ){ - sqlite3DbFree(db, pTab); - return 0; - } pMod->pEpoTab = pTab; + pTab->zName = (char*)&pTab[1]; + memcpy(pTab->zName, pMod->zName, nName); pTab->nRef = 1; pTab->pSchema = db->aDb[0].pSchema; pTab->tabFlags |= TF_Virtual; pTab->nModuleArg = 0; pTab->iPKey = -1; @@ -122849,15 +122198,13 @@ ** virtual table module pMod, if it exists. */ SQLITE_PRIVATE void sqlite3VtabEponymousTableClear(sqlite3 *db, Module *pMod){ Table *pTab = pMod->pEpoTab; if( pTab!=0 ){ - /* Mark the table as Ephemeral prior to deleting it, so that the - ** sqlite3DeleteTable() routine will know that it is not stored in - ** the schema. */ - pTab->tabFlags |= TF_Ephemeral; - sqlite3DeleteTable(db, pTab); + sqlite3DeleteColumnNames(db, pTab); + sqlite3VtabClear(db, pTab); + sqlite3DbFree(db, pTab); pMod->pEpoTab = 0; } } /* @@ -123360,13 +122707,12 @@ u16 wctrlFlags; /* Flags originally passed to sqlite3WhereBegin() */ i8 nOBSat; /* Number of ORDER BY terms satisfied by indices */ u8 sorted; /* True if really sorted (not just grouped) */ u8 eOnePass; /* ONEPASS_OFF, or _SINGLE, or _MULTI */ u8 untestedTerms; /* Not all WHERE terms resolved by outer loop */ - u8 eDistinct; /* One of the WHERE_DISTINCT_* values */ + u8 eDistinct; /* One of the WHERE_DISTINCT_* values below */ u8 nLevel; /* Number of nested loop */ - u8 bOrderedInnerLoop; /* True if only the inner-most loop is ordered */ int iTop; /* The very beginning of the WHERE loop */ int iContinue; /* Jump here to continue with next record */ int iBreak; /* Jump here to break out of the loop */ int savedNQueryLoop; /* pParse->nQueryLoop outside the WHERE loop */ int aiCurOnePass[2]; /* OP_OpenWrite cursors for the ONEPASS opt */ @@ -123379,13 +122725,10 @@ ** Private interfaces - callable only by other where.c routines. ** ** where.c: */ SQLITE_PRIVATE Bitmask sqlite3WhereGetMask(WhereMaskSet*,int); -#ifdef WHERETRACE_ENABLED -SQLITE_PRIVATE void sqlite3WhereClausePrint(WhereClause *pWC); -#endif SQLITE_PRIVATE WhereTerm *sqlite3WhereFindTerm( WhereClause *pWC, /* The WHERE clause to be searched */ int iCur, /* Cursor number of LHS */ int iColumn, /* Column number of LHS */ Bitmask notReady, /* RHS must not overlap with this mask */ @@ -123598,11 +122941,11 @@ StrAccum str; /* EQP output string */ char zBuf[100]; /* Initial space for EQP output string */ pLoop = pLevel->pWLoop; flags = pLoop->wsFlags; - if( (flags&WHERE_MULTI_OR) || (wctrlFlags&WHERE_OR_SUBCLAUSE) ) return 0; + if( (flags&WHERE_MULTI_OR) || (wctrlFlags&WHERE_ONETABLE_ONLY) ) return 0; isSearch = (flags&(WHERE_BTM_LIMIT|WHERE_TOP_LIMIT))!=0 || ((flags&WHERE_VIRTUALTABLE)==0 && (pLoop->u.btree.nEq>0)) || (wctrlFlags&(WHERE_ORDERBY_MIN|WHERE_ORDERBY_MAX)); @@ -124041,11 +123384,11 @@ ** ** The LIKE optimization trys to evaluate "x LIKE 'abc%'" as a range ** expression: "x>='ABC' AND x<'abd'". But this requires that the range ** scan loop run twice, once for strings and a second time for BLOBs. ** The OP_String opcodes on the second pass convert the upper and lower -** bound string constants to blobs. This routine makes the necessary changes +** bound string contants to blobs. This routine makes the necessary changes ** to the OP_String opcodes for that to happen. ** ** Except, of course, if SQLITE_LIKE_DOESNT_MATCH_BLOBS is defined, then ** only the one pass through the string space is required, so this routine ** becomes a no-op. @@ -124098,42 +123441,10 @@ pWalker->eCode = 1; } return WRC_Continue; } -/* -** Test whether or not expression pExpr, which was part of a WHERE clause, -** should be included in the cursor-hint for a table that is on the rhs -** of a LEFT JOIN. Set Walker.eCode to non-zero before returning if the -** expression is not suitable. -** -** An expression is unsuitable if it might evaluate to non NULL even if -** a TK_COLUMN node that does affect the value of the expression is set -** to NULL. For example: -** -** col IS NULL -** col IS NOT NULL -** coalesce(col, 1) -** CASE WHEN col THEN 0 ELSE 1 END -*/ -static int codeCursorHintIsOrFunction(Walker *pWalker, Expr *pExpr){ - if( pExpr->op==TK_IS - || pExpr->op==TK_ISNULL || pExpr->op==TK_ISNOT - || pExpr->op==TK_NOTNULL || pExpr->op==TK_CASE - ){ - pWalker->eCode = 1; - }else if( pExpr->op==TK_FUNCTION ){ - int d1; - char d2[3]; - if( 0==sqlite3IsLikeFunction(pWalker->pParse->db, pExpr, &d1, d2) ){ - pWalker->eCode = 1; - } - } - - return WRC_Continue; -} - /* ** This function is called on every node of an expression tree used as an ** argument to the OP_CursorHint instruction. If the node is a TK_COLUMN ** that accesses any table other than the one identified by @@ -124182,11 +123493,10 @@ /* ** Insert an OP_CursorHint instruction if it is appropriate to do so. */ static void codeCursorHint( - struct SrcList_item *pTabItem, /* FROM clause item */ WhereInfo *pWInfo, /* The where clause */ WhereLevel *pLevel, /* Which loop to provide hints for */ WhereTerm *pEndRange /* Hint this end-of-scan boundary term if not NULL */ ){ Parse *pParse = pWInfo->pParse; @@ -124213,46 +123523,11 @@ pWC = &pWInfo->sWC; for(i=0; inTerm; i++){ pTerm = &pWC->a[i]; if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue; if( pTerm->prereqAll & pLevel->notReady ) continue; - - /* Any terms specified as part of the ON(...) clause for any LEFT - ** JOIN for which the current table is not the rhs are omitted - ** from the cursor-hint. - ** - ** If this table is the rhs of a LEFT JOIN, "IS" or "IS NULL" terms - ** that were specified as part of the WHERE clause must be excluded. - ** This is to address the following: - ** - ** SELECT ... t1 LEFT JOIN t2 ON (t1.a=t2.b) WHERE t2.c IS NULL; - ** - ** Say there is a single row in t2 that matches (t1.a=t2.b), but its - ** t2.c values is not NULL. If the (t2.c IS NULL) constraint is - ** pushed down to the cursor, this row is filtered out, causing - ** SQLite to synthesize a row of NULL values. Which does match the - ** WHERE clause, and so the query returns a row. Which is incorrect. - ** - ** For the same reason, WHERE terms such as: - ** - ** WHERE 1 = (t2.c IS NULL) - ** - ** are also excluded. See codeCursorHintIsOrFunction() for details. - */ - if( pTabItem->fg.jointype & JT_LEFT ){ - Expr *pExpr = pTerm->pExpr; - if( !ExprHasProperty(pExpr, EP_FromJoin) - || pExpr->iRightJoinTable!=pTabItem->iCursor - ){ - sWalker.eCode = 0; - sWalker.xExprCallback = codeCursorHintIsOrFunction; - sqlite3WalkExpr(&sWalker, pTerm->pExpr); - if( sWalker.eCode ) continue; - } - }else{ - if( ExprHasProperty(pTerm->pExpr, EP_FromJoin) ) continue; - } + if( ExprHasProperty(pTerm->pExpr, EP_FromJoin) ) continue; /* All terms in pWLoop->aLTerm[] except pEndRange are used to initialize ** the cursor. These terms are not needed as hints for a pure range ** scan (that has no == terms) so omit them. */ if( pLoop->u.btree.nEq==0 && pTerm!=pEndRange ){ @@ -124282,11 +123557,11 @@ (sHint.pIdx ? sHint.iIdxCur : sHint.iTabCur), 0, 0, (const char*)pExpr, P4_EXPR); } } #else -# define codeCursorHint(A,B,C,D) /* No-op */ +# define codeCursorHint(A,B,C) /* No-op */ #endif /* SQLITE_ENABLE_CURSOR_HINTS */ /* ** Cursor iCur is open on an intkey b-tree (a table). Register iRowid contains ** a rowid value just read from cursor iIdxCur, open on index pIdx. This @@ -124316,11 +123591,11 @@ assert( iIdxCur>0 ); assert( pIdx->aiColumn[pIdx->nColumn-1]==-1 ); sqlite3VdbeAddOp3(v, OP_Seek, iIdxCur, 0, iCur); - if( (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE) + if( (pWInfo->wctrlFlags & WHERE_FORCE_TABLE) && DbMaskAllZero(sqlite3ParseToplevel(pParse)->writeMask) ){ int i; Table *pTab = pIdx->pTable; int *ai = (int*)sqlite3DbMallocZero(pParse->db, sizeof(int)*(pTab->nCol+1)); @@ -124371,11 +123646,11 @@ pTabItem = &pWInfo->pTabList->a[pLevel->iFrom]; iCur = pTabItem->iCursor; pLevel->notReady = notReady & ~sqlite3WhereGetMask(&pWInfo->sMaskSet, iCur); bRev = (pWInfo->revMask>>iLevel)&1; omitTable = (pLoop->wsFlags & WHERE_IDX_ONLY)!=0 - && (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE)==0; + && (pWInfo->wctrlFlags & WHERE_FORCE_TABLE)==0; VdbeModuleComment((v, "Begin WHERE-loop%d: %s",iLevel,pTabItem->pTab->zName)); /* Create labels for the "break" and "continue" instructions ** for the current loop. Jump to addrBrk to break out of a loop. ** Jump to cont to go immediately to the next iteration of the @@ -124511,11 +123786,12 @@ testcase( pTerm->wtFlags & TERM_VIRTUAL ); iReleaseReg = ++pParse->nMem; iRowidReg = codeEqualityTerm(pParse, pTerm, pLevel, 0, bRev, iReleaseReg); if( iRowidReg!=iReleaseReg ) sqlite3ReleaseTempReg(pParse, iReleaseReg); addrNxt = pLevel->addrNxt; - sqlite3VdbeAddOp3(v, OP_SeekRowid, iCur, addrNxt, iRowidReg); + sqlite3VdbeAddOp2(v, OP_MustBeInt, iRowidReg, addrNxt); VdbeCoverage(v); + sqlite3VdbeAddOp3(v, OP_NotExists, iCur, addrNxt, iRowidReg); VdbeCoverage(v); sqlite3ExprCacheAffinityChange(pParse, iRowidReg, 1); sqlite3ExprCacheStore(pParse, iCur, -1, iRowidReg); VdbeComment((v, "pk")); pLevel->op = OP_Noop; @@ -124538,11 +123814,11 @@ if( bRev ){ pTerm = pStart; pStart = pEnd; pEnd = pTerm; } - codeCursorHint(pTabItem, pWInfo, pLevel, pEnd); + codeCursorHint(pWInfo, pLevel, pEnd); if( pStart ){ Expr *pX; /* The expression that defines the start bound */ int r1, rTemp; /* Registers for holding the start boundary */ /* The following constant maps TK_xx codes into corresponding @@ -124752,11 +124028,11 @@ /* Generate code to evaluate all constraint terms using == or IN ** and store the values of those terms in an array of registers ** starting at regBase. */ - codeCursorHint(pTabItem, pWInfo, pLevel, pRangeEnd); + codeCursorHint(pWInfo, pLevel, pRangeEnd); regBase = codeAllEqualityTerms(pParse,pLevel,bRev,nExtraReg,&zStartAff); assert( zStartAff==0 || sqlite3Strlen30(zStartAff)>=nEq ); if( zStartAff ) cEndAff = zStartAff[nEq]; addrNxt = pLevel->addrNxt; @@ -124791,11 +124067,10 @@ zStartAff[nEq] = SQLITE_AFF_BLOB; } } nConstraint++; testcase( pRangeStart->wtFlags & TERM_VIRTUAL ); - bSeekPastNull = 0; }else if( bSeekPastNull ){ sqlite3VdbeAddOp2(v, OP_Null, 0, regBase+nEq); nConstraint++; startEq = 0; start_constraints = 1; @@ -125057,11 +124332,15 @@ /* Run a separate WHERE clause for each term of the OR clause. After ** eliminating duplicates from other WHERE clauses, the action for each ** sub-WHERE clause is to to invoke the main loop body as a subroutine. */ - wctrlFlags = WHERE_OR_SUBCLAUSE | (pWInfo->wctrlFlags & WHERE_SEEK_TABLE); + wctrlFlags = WHERE_OMIT_OPEN_CLOSE + | WHERE_FORCE_TABLE + | WHERE_ONETABLE_ONLY + | WHERE_NO_AUTOINDEX + | (pWInfo->wctrlFlags & WHERE_SEEK_TABLE); for(ii=0; iinTerm; ii++){ WhereTerm *pOrTerm = &pOrWc->a[ii]; if( pOrTerm->leftCursor==iCur || (pOrTerm->eOperator & WO_AND)!=0 ){ WhereInfo *pSubWInfo; /* Info for single OR-term scan */ Expr *pOrExpr = pOrTerm->pExpr; /* Current OR clause term */ @@ -125165,10 +124444,11 @@ && (ii==0 || pSubLoop->u.btree.pIndex==pCov) && (HasRowid(pTab) || !IsPrimaryKeyIndex(pSubLoop->u.btree.pIndex)) ){ assert( pSubWInfo->a[0].iIdxCur==iCovCur ); pCov = pSubLoop->u.btree.pIndex; + wctrlFlags |= WHERE_REOPEN_IDX; }else{ pCov = 0; } /* Finish the loop through table entries that match term pOrTerm. */ @@ -125201,11 +124481,11 @@ if( pTabItem->fg.isRecursive ){ /* Tables marked isRecursive have only a single row that is stored in ** a pseudo-cursor. No need to Rewind or Next such cursors. */ pLevel->op = OP_Noop; }else{ - codeCursorHint(pTabItem, pWInfo, pLevel, 0); + codeCursorHint(pWInfo, pLevel, 0); pLevel->op = aStep[bRev]; pLevel->p1 = iCur; pLevel->p2 = 1 + sqlite3VdbeAddOp2(v, aStart[bRev], iCur, addrBrk); VdbeCoverageIf(v, bRev==0); VdbeCoverageIf(v, bRev!=0); @@ -125226,11 +124506,11 @@ testcase( pTerm->wtFlags & TERM_VIRTUAL ); testcase( pTerm->wtFlags & TERM_CODED ); if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue; if( (pTerm->prereqAll & pLevel->notReady)!=0 ){ testcase( pWInfo->untestedTerms==0 - && (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE)!=0 ); + && (pWInfo->wctrlFlags & WHERE_ONETABLE_ONLY)!=0 ); pWInfo->untestedTerms = 1; continue; } pE = pTerm->pExpr; assert( pE!=0 ); @@ -125888,13 +125168,11 @@ sqlite3WhereExprAnalyze(pSrc, pAndWC); pAndWC->pOuter = pWC; if( !db->mallocFailed ){ for(j=0, pAndTerm=pAndWC->a; jnTerm; j++, pAndTerm++){ assert( pAndTerm->pExpr ); - if( allowedOp(pAndTerm->pExpr->op) - || pAndTerm->eOperator==WO_MATCH - ){ + if( allowedOp(pAndTerm->pExpr->op) ){ b |= sqlite3WhereGetMask(&pWInfo->sMaskSet, pAndTerm->leftCursor); } } } indexable &= b; @@ -126105,14 +125383,16 @@ return 0; } pColl = sqlite3BinaryCompareCollSeq(pParse, pExpr->pLeft, pExpr->pRight); if( pColl==0 || sqlite3StrICmp(pColl->zName, "BINARY")==0 ) return 1; pColl = sqlite3ExprCollSeq(pParse, pExpr->pLeft); - zColl1 = pColl ? pColl->zName : 0; + /* Since pLeft and pRight are both a column references, their collating + ** sequence should always be defined. */ + zColl1 = ALWAYS(pColl) ? pColl->zName : 0; pColl = sqlite3ExprCollSeq(pParse, pExpr->pRight); - zColl2 = pColl ? pColl->zName : 0; - return sqlite3_stricmp(zColl1, zColl2)==0; + zColl2 = ALWAYS(pColl) ? pColl->zName : 0; + return sqlite3StrICmp(zColl1, zColl2)==0; } /* ** Recursively walk the expressions of a SELECT statement and generate ** a bitmask indicating which tables are used in that expression @@ -126442,11 +125722,11 @@ ** current expression is of the form: column MATCH expr. ** This information is used by the xBestIndex methods of ** virtual tables. The native query optimizer does not attempt ** to do anything with MATCH functions. */ - if( pWC->op==TK_AND && isMatchOfColumn(pExpr, &eOp2) ){ + if( isMatchOfColumn(pExpr, &eOp2) ){ int idxNew; Expr *pRight, *pLeft; WhereTerm *pNewTerm; Bitmask prereqColumn, prereqExpr; @@ -126735,22 +126015,10 @@ */ SQLITE_PRIVATE int sqlite3WhereIsOrdered(WhereInfo *pWInfo){ return pWInfo->nOBSat; } -/* -** Return TRUE if the innermost loop of the WHERE clause implementation -** returns rows in ORDER BY order for complete run of the inner loop. -** -** Across multiple iterations of outer loops, the output rows need not be -** sorted. As long as rows are sorted for just the innermost loop, this -** routine can return TRUE. -*/ -SQLITE_PRIVATE int sqlite3WhereOrderedInnerLoop(WhereInfo *pWInfo){ - return pWInfo->bOrderedInnerLoop; -} - /* ** Return the VDBE address or label to jump to in order to continue ** immediately with the next row of a WHERE clause. */ SQLITE_PRIVATE int sqlite3WhereContinueLabel(WhereInfo *pWInfo){ @@ -128332,43 +127600,21 @@ static void whereTermPrint(WhereTerm *pTerm, int iTerm){ if( pTerm==0 ){ sqlite3DebugPrintf("TERM-%-3d NULL\n", iTerm); }else{ char zType[4]; - char zLeft[50]; memcpy(zType, "...", 4); if( pTerm->wtFlags & TERM_VIRTUAL ) zType[0] = 'V'; if( pTerm->eOperator & WO_EQUIV ) zType[1] = 'E'; if( ExprHasProperty(pTerm->pExpr, EP_FromJoin) ) zType[2] = 'L'; - if( pTerm->eOperator & WO_SINGLE ){ - sqlite3_snprintf(sizeof(zLeft),zLeft,"left={%d:%d}", - pTerm->leftCursor, pTerm->u.leftColumn); - }else if( (pTerm->eOperator & WO_OR)!=0 && pTerm->u.pOrInfo!=0 ){ - sqlite3_snprintf(sizeof(zLeft),zLeft,"indexable=0x%lld", - pTerm->u.pOrInfo->indexable); - }else{ - sqlite3_snprintf(sizeof(zLeft),zLeft,"left=%d", pTerm->leftCursor); - } sqlite3DebugPrintf( - "TERM-%-3d %p %s %-12s prob=%-3d op=0x%03x wtFlags=0x%04x\n", - iTerm, pTerm, zType, zLeft, pTerm->truthProb, + "TERM-%-3d %p %s cursor=%-3d prob=%-3d op=0x%03x wtFlags=0x%04x\n", + iTerm, pTerm, zType, pTerm->leftCursor, pTerm->truthProb, pTerm->eOperator, pTerm->wtFlags); sqlite3TreeViewExpr(0, pTerm->pExpr, 0); } } -#endif - -#ifdef WHERETRACE_ENABLED -/* -** Show the complete content of a WhereClause -*/ -SQLITE_PRIVATE void sqlite3WhereClausePrint(WhereClause *pWC){ - int i; - for(i=0; inTerm; i++){ - whereTermPrint(&pWC->a[i], i); - } -} #endif #ifdef WHERETRACE_ENABLED /* ** Print a WhereLoop object for debugging purposes @@ -129353,11 +128599,11 @@ rLogSize = estLog(rSize); #ifndef SQLITE_OMIT_AUTOMATIC_INDEX /* Automatic indexes */ if( !pBuilder->pOrSet /* Not part of an OR optimization */ - && (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE)==0 + && (pWInfo->wctrlFlags & WHERE_NO_AUTOINDEX)==0 && (pWInfo->pParse->db->flags & SQLITE_AutoIndex)!=0 && pSrc->pIBIndex==0 /* 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 */ @@ -129385,11 +128631,10 @@ pNew->rSetup = rLogSize + rSize + 4; if( pTab->pSelect==0 && (pTab->tabFlags & TF_Ephemeral)==0 ){ pNew->rSetup += 24; } ApplyCostMultiplier(pNew->rSetup, pTab->costMult); - if( pNew->rSetup<0 ) pNew->rSetup = 0; /* TUNING: Each index lookup yields 20 rows in the table. This ** is more than the usual guess of 10 rows, since we have no way ** of knowing how selective the index will ultimately be. It would ** not be unreasonable to make this value much larger. */ pNew->nOut = 43; assert( 43==sqlite3LogEst(20) ); @@ -129446,11 +128691,10 @@ } /* Full scan via index */ if( b || !HasRowid(pTab) - || pProbe->pPartIdxWhere!=0 || ( m==0 && pProbe->bUnordered==0 && (pProbe->szIdxRowszTabRow) && (pWInfo->wctrlFlags & WHERE_ONEPASS_DESIRED)==0 && sqlite3GlobalConfig.bUseCis @@ -129459,38 +128703,15 @@ ){ pNew->iSortIdx = b ? iSortIdx : 0; /* The cost of visiting the index rows is N*K, where K is ** between 1.1 and 3.0, depending on the relative sizes of the - ** index and table rows. */ + ** index and table rows. If this is a non-covering index scan, + ** also add the cost of visiting table rows (N*3.0). */ pNew->rRun = rSize + 1 + (15*pProbe->szIdxRow)/pTab->szTabRow; if( m!=0 ){ - /* If this is a non-covering index scan, add in the cost of - ** doing table lookups. The cost will be 3x the number of - ** lookups. Take into account WHERE clause terms that can be - ** satisfied using just the index, and that do not require a - ** table lookup. */ - LogEst nLookup = rSize + 16; /* Base cost: N*3 */ - int ii; - int iCur = pSrc->iCursor; - WhereClause *pWC2 = &pWInfo->sWC; - for(ii=0; iinTerm; ii++){ - WhereTerm *pTerm = &pWC2->a[ii]; - if( !sqlite3ExprCoveredByIndex(pTerm->pExpr, iCur, pProbe) ){ - break; - } - /* pTerm can be evaluated using just the index. So reduce - ** the expected number of table lookups accordingly */ - if( pTerm->truthProb<=0 ){ - nLookup += pTerm->truthProb; - }else{ - nLookup--; - if( pTerm->eOperator & (WO_EQ|WO_IS) ) nLookup -= 19; - } - } - - pNew->rRun = sqlite3LogEstAdd(pNew->rRun, nLookup); + pNew->rRun = sqlite3LogEstAdd(pNew->rRun, rSize+16); } ApplyCostMultiplier(pNew->rRun, pTab->costMult); whereLoopOutputAdjust(pWC, pNew, rSize); rc = whereLoopInsert(pBuilder, pNew); pNew->nOut = rSize; @@ -129855,11 +129076,13 @@ sCur.n = 0; #ifdef WHERETRACE_ENABLED WHERETRACE(0x200, ("OR-term %d of %p has %d subterms:\n", (int)(pOrTerm-pOrWC->a), pTerm, sSubBuild.pWC->nTerm)); if( sqlite3WhereTrace & 0x400 ){ - sqlite3WhereClausePrint(sSubBuild.pWC); + for(i=0; inTerm; i++){ + whereTermPrint(&sSubBuild.pWC->a[i], i); + } } #endif #ifndef SQLITE_OMIT_VIRTUALTABLE if( IsVirtual(pItem->pTab) ){ rc = whereLoopAddVirtual(&sSubBuild, mPrereq, mUnusable); @@ -129948,22 +129171,19 @@ /* This condition is true when pItem is the FROM clause term on the ** right-hand-side of a LEFT or CROSS JOIN. */ mPrereq = mPrior; } priorJointype = pItem->fg.jointype; -#ifndef SQLITE_OMIT_VIRTUALTABLE if( IsVirtual(pItem->pTab) ){ struct SrcList_item *p; for(p=&pItem[1]; pfg.jointype & (JT_LEFT|JT_CROSS)) ){ mUnusable |= sqlite3WhereGetMask(&pWInfo->sMaskSet, p->iCursor); } } rc = whereLoopAddVirtual(pBuilder, mPrereq, mUnusable); - }else -#endif /* SQLITE_OMIT_VIRTUALTABLE */ - { + }else{ rc = whereLoopAddBtree(pBuilder, mPrereq); } if( rc==SQLITE_OK ){ rc = whereLoopAddOr(pBuilder, mPrereq, mUnusable); } @@ -129994,11 +129214,11 @@ */ static i8 wherePathSatisfiesOrderBy( WhereInfo *pWInfo, /* The WHERE clause */ ExprList *pOrderBy, /* ORDER BY or GROUP BY or DISTINCT clause to check */ WherePath *pPath, /* The WherePath to check */ - u16 wctrlFlags, /* WHERE_GROUPBY or _DISTINCTBY or _ORDERBY_LIMIT */ + u16 wctrlFlags, /* Might contain WHERE_GROUPBY or WHERE_DISTINCTBY */ u16 nLoop, /* Number of entries in pPath->aLoop[] */ WhereLoop *pLast, /* Add this WhereLoop to the end of pPath->aLoop[] */ Bitmask *pRevMask /* OUT: Mask of WhereLoops to run in reverse order */ ){ u8 revSet; /* True if rev is known */ @@ -130005,11 +129225,10 @@ u8 rev; /* Composite sort order */ u8 revIdx; /* Index sort order */ u8 isOrderDistinct; /* All prior WhereLoops are order-distinct */ u8 distinctColumns; /* True if the loop has UNIQUE NOT NULL columns */ u8 isMatch; /* iColumn matches a term of the ORDER BY clause */ - u16 eqOpMask; /* Allowed equality operators */ u16 nKeyCol; /* Number of key columns in pIndex */ u16 nColumn; /* Total number of ordered columns in the index */ u16 nOrderBy; /* Number terms in the ORDER BY clause */ int iLoop; /* Index of WhereLoop in pPath being processed */ int i, j; /* Loop counters */ @@ -130056,20 +129275,13 @@ if( nOrderBy>BMS-1 ) return 0; /* Cannot optimize overly large ORDER BYs */ isOrderDistinct = 1; obDone = MASKBIT(nOrderBy)-1; orderDistinctMask = 0; ready = 0; - eqOpMask = WO_EQ | WO_IS | WO_ISNULL; - if( wctrlFlags & WHERE_ORDERBY_LIMIT ) eqOpMask |= WO_IN; for(iLoop=0; isOrderDistinct && obSat0 ) ready |= pLoop->maskSelf; - if( iLoopaLoop[iLoop]; - if( wctrlFlags & WHERE_ORDERBY_LIMIT ) continue; - }else{ - pLoop = pLast; - } + pLoop = iLoopaLoop[iLoop] : pLast; if( pLoop->wsFlags & WHERE_VIRTUALTABLE ){ if( pLoop->u.vtab.isOrdered ) obSat = obDone; break; } iCur = pWInfo->pTabList->a[pLoop->iTab].iCursor; @@ -130083,11 +129295,11 @@ if( MASKBIT(i) & obSat ) continue; pOBExpr = sqlite3ExprSkipCollate(pOrderBy->a[i].pExpr); if( pOBExpr->op!=TK_COLUMN ) continue; if( pOBExpr->iTable!=iCur ) continue; pTerm = sqlite3WhereFindTerm(&pWInfo->sWC, iCur, pOBExpr->iColumn, - ~ready, eqOpMask, 0); + ~ready, WO_EQ|WO_ISNULL|WO_IS, 0); if( pTerm==0 ) continue; if( (pTerm->eOperator&(WO_EQ|WO_IS))!=0 && pOBExpr->iColumn>=0 ){ const char *z1, *z2; pColl = sqlite3ExprCollSeq(pWInfo->pParse, pOrderBy->a[i].pExpr); if( !pColl ) pColl = db->pDfltColl; @@ -130123,16 +129335,14 @@ rev = revSet = 0; distinctColumns = 0; for(j=0; ju.btree.nEq && pLoop->nSkip==0 - && ((i = pLoop->aLTerm[j]->eOperator) & eqOpMask)!=0 + && ((i = pLoop->aLTerm[j]->eOperator) & (WO_EQ|WO_ISNULL|WO_IS))!=0 ){ if( i & WO_ISNULL ){ testcase( isOrderDistinct ); isOrderDistinct = 0; } @@ -130652,23 +129862,12 @@ if( pFrom->isOrdered==pWInfo->pOrderBy->nExpr ){ pWInfo->eDistinct = WHERE_DISTINCT_ORDERED; } }else{ pWInfo->nOBSat = pFrom->isOrdered; + if( pWInfo->nOBSat<0 ) pWInfo->nOBSat = 0; pWInfo->revMask = pFrom->revLoop; - if( pWInfo->nOBSat<=0 ){ - pWInfo->nOBSat = 0; - if( nLoop>0 && (pFrom->aLoop[nLoop-1]->wsFlags & WHERE_ONEROW)==0 ){ - Bitmask m = 0; - int rc = wherePathSatisfiesOrderBy(pWInfo, pWInfo->pOrderBy, pFrom, - WHERE_ORDERBY_LIMIT, nLoop-1, pFrom->aLoop[nLoop-1], &m); - if( rc==pWInfo->pOrderBy->nExpr ){ - pWInfo->bOrderedInnerLoop = 1; - pWInfo->revMask = m; - } - } - } } if( (pWInfo->wctrlFlags & WHERE_SORTBYGROUP) && pWInfo->nOBSat==pWInfo->pOrderBy->nExpr && nLoop>0 ){ Bitmask revMask = 0; @@ -130712,11 +129911,11 @@ int j; Table *pTab; Index *pIdx; pWInfo = pBuilder->pWInfo; - if( pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE ) return 0; + if( pWInfo->wctrlFlags & WHERE_FORCE_TABLE ) return 0; assert( pWInfo->pTabList->nSrc>=1 ); pItem = pWInfo->pTabList->a; pTab = pItem->pTab; if( IsVirtual(pTab) ) return 0; if( pItem->fg.isIndexedBy ) return 0; @@ -130859,11 +130058,11 @@ ** if the WHERE_GROUPBY flag is set in wctrlFlags) of a SELECT statement ** if there is one. If there is no ORDER BY clause or if this routine ** is called from an UPDATE or DELETE statement, then pOrderBy is NULL. ** ** The iIdxCur parameter is the cursor number of an index. If -** WHERE_OR_SUBCLAUSE is set, iIdxCur is the cursor number of an index +** WHERE_ONETABLE_ONLY is set, iIdxCur is the cursor number of an index ** to use for OR clause processing. The WHERE clause should use this ** specific cursor. If WHERE_ONEPASS_DESIRED is set, then iIdxCur is ** the first cursor in an array of cursors for all indices. iIdxCur should ** be used to compute the appropriate cursor depending on which index is ** used. @@ -130873,11 +130072,11 @@ SrcList *pTabList, /* FROM clause: A list of all tables to be scanned */ Expr *pWhere, /* The WHERE clause */ ExprList *pOrderBy, /* An ORDER BY (or GROUP BY) clause, or NULL */ ExprList *pDistinctSet, /* Try not to output two rows that duplicate these */ u16 wctrlFlags, /* The WHERE_* flags defined in sqliteInt.h */ - int iAuxArg /* If WHERE_OR_SUBCLAUSE is set, index cursor number + int iAuxArg /* If WHERE_ONETABLE_ONLY is set, index cursor number ** If WHERE_USE_LIMIT, then the limit amount */ ){ int nByteWInfo; /* Num. bytes allocated for WhereInfo struct */ int nTabList; /* Number of elements in pTabList */ WhereInfo *pWInfo; /* Will become the return value of this function */ @@ -130892,15 +130091,15 @@ int rc; /* Return code */ u8 bFordelete = 0; /* OPFLAG_FORDELETE or zero, as appropriate */ assert( (wctrlFlags & WHERE_ONEPASS_MULTIROW)==0 || ( (wctrlFlags & WHERE_ONEPASS_DESIRED)!=0 - && (wctrlFlags & WHERE_OR_SUBCLAUSE)==0 + && (wctrlFlags & WHERE_OMIT_OPEN_CLOSE)==0 )); - /* Only one of WHERE_OR_SUBCLAUSE or WHERE_USE_LIMIT */ - assert( (wctrlFlags & WHERE_OR_SUBCLAUSE)==0 + /* Only one of WHERE_ONETABLE_ONLY or WHERE_USE_LIMIT */ + assert( (wctrlFlags & WHERE_ONETABLE_ONLY)==0 || (wctrlFlags & WHERE_USE_LIMIT)==0 ); /* Variable initialization */ db = pParse->db; memset(&sWLB, 0, sizeof(sWLB)); @@ -130924,15 +130123,15 @@ sqlite3ErrorMsg(pParse, "at most %d tables in a join", BMS); return 0; } /* This function normally generates a nested loop for all tables in - ** pTabList. But if the WHERE_OR_SUBCLAUSE flag is set, then we should + ** pTabList. But if the WHERE_ONETABLE_ONLY flag is set, then we should ** only generate code for the first table in pTabList and assume that ** any cursors associated with subsequent tables are uninitialized. */ - nTabList = (wctrlFlags & WHERE_OR_SUBCLAUSE) ? 1 : pTabList->nSrc; + nTabList = (wctrlFlags & WHERE_ONETABLE_ONLY) ? 1 : pTabList->nSrc; /* Allocate and initialize the WhereInfo structure that will become the ** return value. A single allocation is used to store the WhereInfo ** struct, the contents of WhereInfo.a[], the WhereClause structure ** and the WhereMaskSet structure. Since WhereClause contains an 8-byte @@ -131004,11 +130203,11 @@ ** important. Ticket #3015. ** ** Note that bitmasks are created for all pTabList->nSrc tables in ** pTabList, not just the first nTabList tables. nTabList is normally ** equal to pTabList->nSrc but might be shortened to 1 if the - ** WHERE_OR_SUBCLAUSE flag is set. + ** WHERE_ONETABLE_ONLY flag is set. */ for(ii=0; iinSrc; ii++){ createMask(pMaskSet, pTabList->a[ii].iCursor); sqlite3WhereTabFuncArgs(pParse, &pTabList->a[ii], &pWInfo->sWC); } @@ -131042,11 +130241,14 @@ sqlite3DebugPrintf(", limit: %d", iAuxArg); } sqlite3DebugPrintf(")\n"); } if( sqlite3WhereTrace & 0x100 ){ /* Display all terms of the WHERE clause */ - sqlite3WhereClausePrint(sWLB.pWC); + int i; + for(i=0; inTerm; i++){ + whereTermPrint(&sWLB.pWC->a[i], i); + } } #endif if( nTabList!=1 || whereShortCut(&sWLB)==0 ){ rc = whereLoopAddAll(&sWLB); @@ -131184,11 +130386,11 @@ }else if( IsVirtual(pTab) ){ /* noop */ }else #endif if( (pLoop->wsFlags & WHERE_IDX_ONLY)==0 - && (wctrlFlags & WHERE_OR_SUBCLAUSE)==0 ){ + && (wctrlFlags & WHERE_OMIT_OPEN_CLOSE)==0 ){ int op = OP_OpenRead; if( pWInfo->eOnePass!=ONEPASS_OFF ){ op = OP_OpenWrite; pWInfo->aiCurOnePass[0] = pTabItem->iCursor; }; @@ -131223,11 +130425,11 @@ int iIndexCur; int op = OP_OpenRead; /* iAuxArg is always set if to a positive value if ONEPASS is possible */ assert( iAuxArg!=0 || (pWInfo->wctrlFlags & WHERE_ONEPASS_DESIRED)==0 ); if( !HasRowid(pTab) && IsPrimaryKeyIndex(pIx) - && (wctrlFlags & WHERE_OR_SUBCLAUSE)!=0 + && (wctrlFlags & WHERE_ONETABLE_ONLY)!=0 ){ /* This is one term of an OR-optimization using the PRIMARY KEY of a ** WITHOUT ROWID table. No need for a separate index */ iIndexCur = pLevel->iTabCur; op = 0; @@ -131239,13 +130441,13 @@ iIndexCur++; pJ = pJ->pNext; } op = OP_OpenWrite; pWInfo->aiCurOnePass[1] = iIndexCur; - }else if( iAuxArg && (wctrlFlags & WHERE_OR_SUBCLAUSE)!=0 ){ + }else if( iAuxArg && (wctrlFlags & WHERE_ONETABLE_ONLY)!=0 ){ iIndexCur = iAuxArg; - op = OP_ReopenIdx; + if( wctrlFlags & WHERE_REOPEN_IDX ) op = OP_ReopenIdx; }else{ iIndexCur = pParse->nTab++; } pLevel->iIdxCur = iIndexCur; assert( pIx->pSchema==pTab->pSchema ); @@ -131303,11 +130505,11 @@ pParse, pTabList, pLevel, ii, pLevel->iFrom, wctrlFlags ); pLevel->addrBody = sqlite3VdbeCurrentAddr(v); notReady = sqlite3WhereCodeOneLoopStart(pWInfo, ii, notReady); pWInfo->iContinue = pLevel->addrCont; - if( (wsFlags&WHERE_MULTI_OR)==0 && (wctrlFlags&WHERE_OR_SUBCLAUSE)==0 ){ + if( (wsFlags&WHERE_MULTI_OR)==0 && (wctrlFlags&WHERE_ONETABLE_ONLY)==0 ){ sqlite3WhereAddScanStatus(v, pTabList, pLevel, addrExplain); } } /* Done. */ @@ -131426,16 +130628,16 @@ continue; } /* Close all of the cursors that were opened by sqlite3WhereBegin. ** Except, do not close cursors that will be reused by the OR optimization - ** (WHERE_OR_SUBCLAUSE). And do not close the OP_OpenWrite cursors + ** (WHERE_OMIT_OPEN_CLOSE). And do not close the OP_OpenWrite cursors ** created for the ONEPASS optimization. */ if( (pTab->tabFlags & TF_Ephemeral)==0 && pTab->pSelect==0 - && (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE)==0 + && (pWInfo->wctrlFlags & WHERE_OMIT_OPEN_CLOSE)==0 ){ int ws = pLoop->wsFlags; if( pWInfo->eOnePass==ONEPASS_OFF && (ws & WHERE_IDX_ONLY)==0 ){ sqlite3VdbeAddOp1(v, OP_Close, pTabItem->iCursor); } @@ -131778,49 +130980,49 @@ #ifndef INTERFACE # define INTERFACE 1 #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned char -#define YYNOCODE 252 +#define YYNOCODE 251 #define YYACTIONTYPE unsigned short int #define YYWILDCARD 96 #define sqlite3ParserTOKENTYPE Token typedef union { int yyinit; sqlite3ParserTOKENTYPE yy0; - Expr* yy72; - TriggerStep* yy145; - ExprList* yy148; - SrcList* yy185; - ExprSpan yy190; - int yy194; - Select* yy243; - IdList* yy254; - With* yy285; - struct TrigEvent yy332; - struct LimitVal yy354; - struct LikeOp yy392; - struct {int value; int mask;} yy497; + struct LimitVal yy64; + Expr* yy122; + Select* yy159; + IdList* yy180; + struct {int value; int mask;} yy207; + struct LikeOp yy318; + TriggerStep* yy327; + With* yy331; + ExprSpan yy342; + SrcList* yy347; + int yy392; + struct TrigEvent yy410; + ExprList* yy442; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 #endif #define sqlite3ParserARG_SDECL Parse *pParse; #define sqlite3ParserARG_PDECL ,Parse *pParse #define sqlite3ParserARG_FETCH Parse *pParse = yypParser->pParse #define sqlite3ParserARG_STORE yypParser->pParse = pParse #define YYFALLBACK 1 -#define YYNSTATE 443 -#define YYNRULE 328 -#define YY_MAX_SHIFT 442 -#define YY_MIN_SHIFTREDUCE 653 -#define YY_MAX_SHIFTREDUCE 980 -#define YY_MIN_REDUCE 981 -#define YY_MAX_REDUCE 1308 -#define YY_ERROR_ACTION 1309 -#define YY_ACCEPT_ACTION 1310 -#define YY_NO_ACTION 1311 +#define YYNSTATE 440 +#define YYNRULE 326 +#define YY_MAX_SHIFT 439 +#define YY_MIN_SHIFTREDUCE 649 +#define YY_MAX_SHIFTREDUCE 974 +#define YY_MIN_REDUCE 975 +#define YY_MAX_REDUCE 1300 +#define YY_ERROR_ACTION 1301 +#define YY_ACCEPT_ACTION 1302 +#define YY_NO_ACTION 1303 /************* End control #defines *******************************************/ /* Define the yytestcase() macro to be a no-op if is not already defined ** otherwise. ** @@ -131884,452 +131086,450 @@ ** yy_reduce_ofst[] For each state, the offset into yy_action for ** shifting non-terminals after a reduce. ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (1507) +#define YY_ACTTAB_COUNT (1501) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 317, 814, 341, 808, 5, 195, 195, 802, 93, 94, - /* 10 */ 84, 823, 823, 835, 838, 827, 827, 91, 91, 92, - /* 20 */ 92, 92, 92, 293, 90, 90, 90, 90, 89, 89, - /* 30 */ 88, 88, 88, 87, 341, 317, 958, 958, 807, 807, - /* 40 */ 807, 928, 344, 93, 94, 84, 823, 823, 835, 838, - /* 50 */ 827, 827, 91, 91, 92, 92, 92, 92, 328, 90, - /* 60 */ 90, 90, 90, 89, 89, 88, 88, 88, 87, 341, - /* 70 */ 89, 89, 88, 88, 88, 87, 341, 776, 958, 958, - /* 80 */ 317, 88, 88, 88, 87, 341, 777, 69, 93, 94, - /* 90 */ 84, 823, 823, 835, 838, 827, 827, 91, 91, 92, - /* 100 */ 92, 92, 92, 437, 90, 90, 90, 90, 89, 89, - /* 110 */ 88, 88, 88, 87, 341, 1310, 147, 147, 2, 317, - /* 120 */ 76, 25, 74, 49, 49, 87, 341, 93, 94, 84, - /* 130 */ 823, 823, 835, 838, 827, 827, 91, 91, 92, 92, - /* 140 */ 92, 92, 95, 90, 90, 90, 90, 89, 89, 88, - /* 150 */ 88, 88, 87, 341, 939, 939, 317, 260, 415, 400, - /* 160 */ 398, 58, 737, 737, 93, 94, 84, 823, 823, 835, - /* 170 */ 838, 827, 827, 91, 91, 92, 92, 92, 92, 57, - /* 180 */ 90, 90, 90, 90, 89, 89, 88, 88, 88, 87, - /* 190 */ 341, 317, 1253, 928, 344, 269, 940, 941, 242, 93, - /* 200 */ 94, 84, 823, 823, 835, 838, 827, 827, 91, 91, - /* 210 */ 92, 92, 92, 92, 293, 90, 90, 90, 90, 89, - /* 220 */ 89, 88, 88, 88, 87, 341, 317, 919, 1303, 793, - /* 230 */ 691, 1303, 724, 724, 93, 94, 84, 823, 823, 835, - /* 240 */ 838, 827, 827, 91, 91, 92, 92, 92, 92, 337, - /* 250 */ 90, 90, 90, 90, 89, 89, 88, 88, 88, 87, - /* 260 */ 341, 317, 114, 919, 1304, 684, 395, 1304, 124, 93, - /* 270 */ 94, 84, 823, 823, 835, 838, 827, 827, 91, 91, - /* 280 */ 92, 92, 92, 92, 683, 90, 90, 90, 90, 89, - /* 290 */ 89, 88, 88, 88, 87, 341, 317, 86, 83, 169, - /* 300 */ 801, 917, 234, 399, 93, 94, 84, 823, 823, 835, - /* 310 */ 838, 827, 827, 91, 91, 92, 92, 92, 92, 686, - /* 320 */ 90, 90, 90, 90, 89, 89, 88, 88, 88, 87, - /* 330 */ 341, 317, 436, 742, 86, 83, 169, 917, 741, 93, - /* 340 */ 94, 84, 823, 823, 835, 838, 827, 827, 91, 91, - /* 350 */ 92, 92, 92, 92, 902, 90, 90, 90, 90, 89, - /* 360 */ 89, 88, 88, 88, 87, 341, 317, 321, 434, 434, - /* 370 */ 434, 1, 722, 722, 93, 94, 84, 823, 823, 835, - /* 380 */ 838, 827, 827, 91, 91, 92, 92, 92, 92, 190, - /* 390 */ 90, 90, 90, 90, 89, 89, 88, 88, 88, 87, - /* 400 */ 341, 317, 685, 292, 939, 939, 150, 977, 310, 93, - /* 410 */ 94, 84, 823, 823, 835, 838, 827, 827, 91, 91, - /* 420 */ 92, 92, 92, 92, 437, 90, 90, 90, 90, 89, - /* 430 */ 89, 88, 88, 88, 87, 341, 926, 2, 372, 719, - /* 440 */ 698, 369, 950, 317, 49, 49, 940, 941, 719, 177, - /* 450 */ 72, 93, 94, 84, 823, 823, 835, 838, 827, 827, - /* 460 */ 91, 91, 92, 92, 92, 92, 322, 90, 90, 90, - /* 470 */ 90, 89, 89, 88, 88, 88, 87, 341, 317, 415, - /* 480 */ 405, 824, 824, 836, 839, 75, 93, 82, 84, 823, - /* 490 */ 823, 835, 838, 827, 827, 91, 91, 92, 92, 92, - /* 500 */ 92, 430, 90, 90, 90, 90, 89, 89, 88, 88, - /* 510 */ 88, 87, 341, 317, 340, 340, 340, 658, 659, 660, - /* 520 */ 333, 288, 94, 84, 823, 823, 835, 838, 827, 827, - /* 530 */ 91, 91, 92, 92, 92, 92, 437, 90, 90, 90, - /* 540 */ 90, 89, 89, 88, 88, 88, 87, 341, 317, 882, - /* 550 */ 882, 375, 828, 66, 330, 409, 49, 49, 84, 823, - /* 560 */ 823, 835, 838, 827, 827, 91, 91, 92, 92, 92, - /* 570 */ 92, 351, 90, 90, 90, 90, 89, 89, 88, 88, - /* 580 */ 88, 87, 341, 80, 432, 742, 3, 1180, 351, 350, - /* 590 */ 741, 334, 796, 939, 939, 761, 80, 432, 278, 3, - /* 600 */ 204, 161, 279, 393, 274, 392, 191, 362, 437, 277, - /* 610 */ 745, 77, 78, 272, 800, 254, 355, 243, 79, 342, - /* 620 */ 342, 86, 83, 169, 77, 78, 234, 399, 49, 49, - /* 630 */ 435, 79, 342, 342, 437, 940, 941, 186, 442, 655, - /* 640 */ 390, 387, 386, 435, 235, 213, 108, 421, 761, 351, - /* 650 */ 437, 385, 167, 732, 10, 10, 124, 124, 671, 814, - /* 660 */ 421, 439, 438, 415, 414, 802, 362, 168, 327, 124, - /* 670 */ 49, 49, 814, 219, 439, 438, 800, 186, 802, 326, - /* 680 */ 390, 387, 386, 437, 1248, 1248, 23, 939, 939, 80, - /* 690 */ 432, 385, 3, 761, 416, 876, 807, 807, 807, 809, - /* 700 */ 19, 290, 149, 49, 49, 415, 396, 260, 910, 807, - /* 710 */ 807, 807, 809, 19, 312, 237, 145, 77, 78, 746, - /* 720 */ 168, 702, 437, 149, 79, 342, 342, 114, 358, 940, - /* 730 */ 941, 302, 223, 397, 345, 313, 435, 260, 415, 417, - /* 740 */ 858, 374, 31, 31, 80, 432, 761, 3, 348, 92, - /* 750 */ 92, 92, 92, 421, 90, 90, 90, 90, 89, 89, - /* 760 */ 88, 88, 88, 87, 341, 814, 114, 439, 438, 796, - /* 770 */ 367, 802, 77, 78, 701, 796, 124, 1187, 220, 79, - /* 780 */ 342, 342, 124, 747, 734, 939, 939, 775, 404, 939, - /* 790 */ 939, 435, 254, 360, 253, 402, 895, 346, 254, 360, - /* 800 */ 253, 774, 807, 807, 807, 809, 19, 800, 421, 90, - /* 810 */ 90, 90, 90, 89, 89, 88, 88, 88, 87, 341, - /* 820 */ 814, 114, 439, 438, 939, 939, 802, 940, 941, 114, - /* 830 */ 437, 940, 941, 86, 83, 169, 192, 166, 309, 979, - /* 840 */ 70, 432, 700, 3, 382, 870, 238, 86, 83, 169, - /* 850 */ 10, 10, 361, 406, 763, 190, 222, 807, 807, 807, - /* 860 */ 809, 19, 870, 872, 329, 24, 940, 941, 77, 78, - /* 870 */ 359, 437, 335, 260, 218, 79, 342, 342, 437, 307, - /* 880 */ 306, 305, 207, 303, 339, 338, 668, 435, 339, 338, - /* 890 */ 407, 10, 10, 762, 216, 216, 939, 939, 49, 49, - /* 900 */ 437, 260, 97, 241, 421, 225, 402, 189, 188, 187, - /* 910 */ 309, 918, 980, 149, 221, 898, 814, 868, 439, 438, - /* 920 */ 10, 10, 802, 870, 915, 316, 898, 163, 162, 171, - /* 930 */ 249, 240, 322, 410, 412, 687, 687, 272, 940, 941, - /* 940 */ 239, 965, 901, 437, 226, 403, 226, 437, 963, 367, - /* 950 */ 964, 173, 248, 807, 807, 807, 809, 19, 174, 367, - /* 960 */ 899, 124, 172, 48, 48, 9, 9, 35, 35, 966, - /* 970 */ 966, 899, 363, 966, 966, 814, 900, 808, 725, 939, - /* 980 */ 939, 802, 895, 318, 980, 324, 125, 900, 726, 420, - /* 990 */ 92, 92, 92, 92, 85, 90, 90, 90, 90, 89, - /* 1000 */ 89, 88, 88, 88, 87, 341, 216, 216, 437, 946, - /* 1010 */ 349, 292, 807, 807, 807, 114, 291, 693, 402, 705, - /* 1020 */ 890, 940, 941, 437, 245, 889, 247, 437, 36, 36, - /* 1030 */ 437, 353, 391, 437, 260, 252, 260, 437, 361, 437, - /* 1040 */ 706, 437, 370, 12, 12, 224, 437, 27, 27, 437, - /* 1050 */ 37, 37, 437, 38, 38, 752, 368, 39, 39, 28, - /* 1060 */ 28, 29, 29, 215, 166, 331, 40, 40, 437, 41, - /* 1070 */ 41, 437, 42, 42, 437, 866, 246, 731, 437, 879, - /* 1080 */ 437, 256, 437, 878, 437, 267, 437, 261, 11, 11, - /* 1090 */ 437, 43, 43, 437, 99, 99, 437, 373, 44, 44, - /* 1100 */ 45, 45, 32, 32, 46, 46, 47, 47, 437, 426, - /* 1110 */ 33, 33, 776, 116, 116, 437, 117, 117, 437, 124, - /* 1120 */ 437, 777, 437, 260, 437, 957, 437, 352, 118, 118, - /* 1130 */ 437, 195, 437, 111, 437, 53, 53, 264, 34, 34, - /* 1140 */ 100, 100, 50, 50, 101, 101, 102, 102, 437, 260, - /* 1150 */ 98, 98, 115, 115, 113, 113, 437, 262, 437, 265, - /* 1160 */ 437, 943, 958, 437, 727, 437, 681, 437, 106, 106, - /* 1170 */ 68, 437, 893, 730, 437, 365, 105, 105, 103, 103, - /* 1180 */ 104, 104, 217, 52, 52, 54, 54, 51, 51, 694, - /* 1190 */ 259, 26, 26, 266, 30, 30, 677, 323, 433, 323, - /* 1200 */ 674, 423, 427, 943, 958, 114, 114, 431, 681, 865, - /* 1210 */ 1277, 233, 366, 714, 112, 20, 154, 704, 703, 810, - /* 1220 */ 914, 55, 159, 311, 798, 255, 383, 194, 68, 200, - /* 1230 */ 21, 694, 268, 114, 114, 114, 270, 711, 712, 68, - /* 1240 */ 114, 739, 770, 715, 71, 194, 861, 875, 875, 200, - /* 1250 */ 696, 865, 874, 874, 679, 699, 273, 110, 229, 419, - /* 1260 */ 768, 810, 799, 378, 748, 759, 418, 210, 294, 281, - /* 1270 */ 295, 806, 283, 682, 676, 665, 664, 666, 933, 151, - /* 1280 */ 285, 7, 1267, 308, 251, 790, 354, 244, 892, 364, - /* 1290 */ 287, 422, 300, 164, 160, 936, 974, 127, 197, 137, - /* 1300 */ 909, 907, 971, 388, 276, 863, 862, 56, 698, 325, - /* 1310 */ 148, 59, 122, 66, 356, 381, 357, 176, 152, 62, - /* 1320 */ 371, 130, 877, 181, 377, 760, 211, 182, 132, 133, - /* 1330 */ 134, 135, 258, 146, 140, 795, 787, 263, 183, 379, - /* 1340 */ 667, 394, 184, 332, 894, 314, 718, 717, 857, 716, - /* 1350 */ 696, 315, 709, 690, 65, 196, 6, 408, 289, 708, - /* 1360 */ 275, 689, 688, 948, 756, 757, 280, 282, 425, 755, - /* 1370 */ 284, 336, 73, 67, 754, 429, 411, 96, 286, 413, - /* 1380 */ 205, 934, 673, 22, 209, 440, 119, 120, 109, 206, - /* 1390 */ 208, 441, 662, 661, 656, 843, 654, 343, 158, 236, - /* 1400 */ 170, 347, 107, 227, 121, 738, 873, 298, 296, 297, - /* 1410 */ 299, 871, 794, 128, 129, 728, 230, 131, 175, 250, - /* 1420 */ 888, 136, 138, 231, 232, 139, 60, 61, 891, 178, - /* 1430 */ 179, 887, 8, 13, 180, 257, 880, 968, 194, 141, - /* 1440 */ 142, 376, 153, 670, 380, 185, 143, 277, 63, 384, - /* 1450 */ 14, 707, 271, 15, 389, 64, 319, 320, 126, 228, - /* 1460 */ 813, 812, 841, 736, 123, 16, 401, 740, 4, 769, - /* 1470 */ 165, 212, 214, 193, 144, 764, 71, 68, 17, 18, - /* 1480 */ 856, 842, 840, 897, 845, 896, 199, 198, 923, 155, - /* 1490 */ 424, 929, 924, 156, 201, 202, 428, 844, 157, 203, - /* 1500 */ 811, 680, 81, 1269, 1268, 301, 304, + /* 0 */ 315, 810, 339, 804, 5, 194, 194, 798, 92, 93, + /* 10 */ 83, 819, 819, 831, 834, 823, 823, 90, 90, 91, + /* 20 */ 91, 91, 91, 290, 89, 89, 89, 89, 88, 88, + /* 30 */ 87, 87, 87, 86, 339, 315, 952, 952, 803, 803, + /* 40 */ 803, 922, 342, 92, 93, 83, 819, 819, 831, 834, + /* 50 */ 823, 823, 90, 90, 91, 91, 91, 91, 123, 89, + /* 60 */ 89, 89, 89, 88, 88, 87, 87, 87, 86, 339, + /* 70 */ 88, 88, 87, 87, 87, 86, 339, 772, 952, 952, + /* 80 */ 315, 87, 87, 87, 86, 339, 773, 68, 92, 93, + /* 90 */ 83, 819, 819, 831, 834, 823, 823, 90, 90, 91, + /* 100 */ 91, 91, 91, 434, 89, 89, 89, 89, 88, 88, + /* 110 */ 87, 87, 87, 86, 339, 1302, 146, 921, 2, 315, + /* 120 */ 427, 24, 679, 953, 48, 86, 339, 92, 93, 83, + /* 130 */ 819, 819, 831, 834, 823, 823, 90, 90, 91, 91, + /* 140 */ 91, 91, 94, 89, 89, 89, 89, 88, 88, 87, + /* 150 */ 87, 87, 86, 339, 933, 933, 315, 259, 412, 398, + /* 160 */ 396, 57, 733, 733, 92, 93, 83, 819, 819, 831, + /* 170 */ 834, 823, 823, 90, 90, 91, 91, 91, 91, 56, + /* 180 */ 89, 89, 89, 89, 88, 88, 87, 87, 87, 86, + /* 190 */ 339, 315, 1245, 922, 342, 268, 934, 935, 241, 92, + /* 200 */ 93, 83, 819, 819, 831, 834, 823, 823, 90, 90, + /* 210 */ 91, 91, 91, 91, 291, 89, 89, 89, 89, 88, + /* 220 */ 88, 87, 87, 87, 86, 339, 315, 913, 1295, 682, + /* 230 */ 687, 1295, 233, 397, 92, 93, 83, 819, 819, 831, + /* 240 */ 834, 823, 823, 90, 90, 91, 91, 91, 91, 326, + /* 250 */ 89, 89, 89, 89, 88, 88, 87, 87, 87, 86, + /* 260 */ 339, 315, 85, 82, 168, 680, 431, 938, 939, 92, + /* 270 */ 93, 83, 819, 819, 831, 834, 823, 823, 90, 90, + /* 280 */ 91, 91, 91, 91, 291, 89, 89, 89, 89, 88, + /* 290 */ 88, 87, 87, 87, 86, 339, 315, 319, 913, 1296, + /* 300 */ 797, 911, 1296, 681, 92, 93, 83, 819, 819, 831, + /* 310 */ 834, 823, 823, 90, 90, 91, 91, 91, 91, 335, + /* 320 */ 89, 89, 89, 89, 88, 88, 87, 87, 87, 86, + /* 330 */ 339, 315, 876, 876, 373, 85, 82, 168, 944, 92, + /* 340 */ 93, 83, 819, 819, 831, 834, 823, 823, 90, 90, + /* 350 */ 91, 91, 91, 91, 896, 89, 89, 89, 89, 88, + /* 360 */ 88, 87, 87, 87, 86, 339, 315, 370, 307, 973, + /* 370 */ 367, 1, 911, 433, 92, 93, 83, 819, 819, 831, + /* 380 */ 834, 823, 823, 90, 90, 91, 91, 91, 91, 189, + /* 390 */ 89, 89, 89, 89, 88, 88, 87, 87, 87, 86, + /* 400 */ 339, 315, 720, 948, 933, 933, 149, 718, 948, 92, + /* 410 */ 93, 83, 819, 819, 831, 834, 823, 823, 90, 90, + /* 420 */ 91, 91, 91, 91, 434, 89, 89, 89, 89, 88, + /* 430 */ 88, 87, 87, 87, 86, 339, 338, 938, 939, 947, + /* 440 */ 694, 940, 974, 315, 953, 48, 934, 935, 715, 689, + /* 450 */ 71, 92, 93, 83, 819, 819, 831, 834, 823, 823, + /* 460 */ 90, 90, 91, 91, 91, 91, 320, 89, 89, 89, + /* 470 */ 89, 88, 88, 87, 87, 87, 86, 339, 315, 412, + /* 480 */ 403, 820, 820, 832, 835, 74, 92, 81, 83, 819, + /* 490 */ 819, 831, 834, 823, 823, 90, 90, 91, 91, 91, + /* 500 */ 91, 698, 89, 89, 89, 89, 88, 88, 87, 87, + /* 510 */ 87, 86, 339, 315, 259, 654, 655, 656, 393, 111, + /* 520 */ 331, 153, 93, 83, 819, 819, 831, 834, 823, 823, + /* 530 */ 90, 90, 91, 91, 91, 91, 434, 89, 89, 89, + /* 540 */ 89, 88, 88, 87, 87, 87, 86, 339, 315, 188, + /* 550 */ 187, 186, 824, 937, 328, 219, 953, 48, 83, 819, + /* 560 */ 819, 831, 834, 823, 823, 90, 90, 91, 91, 91, + /* 570 */ 91, 956, 89, 89, 89, 89, 88, 88, 87, 87, + /* 580 */ 87, 86, 339, 79, 429, 738, 3, 1174, 955, 348, + /* 590 */ 737, 332, 792, 933, 933, 937, 79, 429, 730, 3, + /* 600 */ 203, 160, 278, 391, 273, 390, 190, 892, 434, 400, + /* 610 */ 741, 76, 77, 271, 287, 253, 353, 242, 78, 340, + /* 620 */ 340, 85, 82, 168, 76, 77, 233, 397, 953, 48, + /* 630 */ 432, 78, 340, 340, 277, 934, 935, 185, 439, 651, + /* 640 */ 388, 385, 384, 432, 234, 276, 107, 418, 349, 337, + /* 650 */ 336, 383, 893, 728, 215, 949, 123, 971, 308, 810, + /* 660 */ 418, 436, 435, 412, 394, 798, 400, 873, 894, 123, + /* 670 */ 721, 872, 810, 889, 436, 435, 215, 949, 798, 351, + /* 680 */ 722, 697, 380, 434, 771, 371, 22, 434, 400, 79, + /* 690 */ 429, 232, 3, 189, 413, 870, 803, 803, 803, 805, + /* 700 */ 18, 54, 148, 953, 48, 956, 113, 953, 9, 803, + /* 710 */ 803, 803, 805, 18, 310, 123, 748, 76, 77, 742, + /* 720 */ 123, 325, 955, 866, 78, 340, 340, 113, 350, 359, + /* 730 */ 85, 82, 168, 343, 960, 960, 432, 770, 412, 414, + /* 740 */ 407, 23, 1240, 1240, 79, 429, 357, 3, 166, 91, + /* 750 */ 91, 91, 91, 418, 89, 89, 89, 89, 88, 88, + /* 760 */ 87, 87, 87, 86, 339, 810, 434, 436, 435, 792, + /* 770 */ 320, 798, 76, 77, 789, 271, 123, 434, 360, 78, + /* 780 */ 340, 340, 864, 85, 82, 168, 953, 9, 395, 743, + /* 790 */ 360, 432, 253, 358, 252, 933, 933, 953, 30, 889, + /* 800 */ 327, 216, 803, 803, 803, 805, 18, 113, 418, 89, + /* 810 */ 89, 89, 89, 88, 88, 87, 87, 87, 86, 339, + /* 820 */ 810, 113, 436, 435, 792, 185, 798, 288, 388, 385, + /* 830 */ 384, 123, 113, 920, 2, 796, 696, 934, 935, 383, + /* 840 */ 69, 429, 434, 3, 218, 110, 738, 253, 358, 252, + /* 850 */ 434, 737, 933, 933, 892, 359, 222, 803, 803, 803, + /* 860 */ 805, 18, 953, 47, 933, 933, 933, 933, 76, 77, + /* 870 */ 953, 9, 366, 904, 217, 78, 340, 340, 677, 305, + /* 880 */ 304, 303, 206, 301, 224, 259, 664, 432, 337, 336, + /* 890 */ 434, 228, 247, 144, 934, 935, 933, 933, 667, 893, + /* 900 */ 324, 1259, 96, 434, 418, 796, 934, 935, 934, 935, + /* 910 */ 953, 48, 401, 148, 289, 894, 810, 417, 436, 435, + /* 920 */ 677, 759, 798, 953, 9, 314, 220, 162, 161, 170, + /* 930 */ 402, 239, 953, 8, 194, 683, 683, 410, 934, 935, + /* 940 */ 238, 959, 933, 933, 225, 408, 945, 365, 957, 212, + /* 950 */ 958, 172, 757, 803, 803, 803, 805, 18, 173, 365, + /* 960 */ 176, 123, 171, 113, 244, 952, 246, 434, 356, 796, + /* 970 */ 372, 365, 236, 960, 960, 810, 290, 804, 191, 165, + /* 980 */ 852, 798, 259, 316, 934, 935, 237, 953, 34, 404, + /* 990 */ 91, 91, 91, 91, 84, 89, 89, 89, 89, 88, + /* 1000 */ 88, 87, 87, 87, 86, 339, 701, 952, 434, 240, + /* 1010 */ 347, 758, 803, 803, 803, 434, 245, 1179, 434, 389, + /* 1020 */ 434, 376, 434, 895, 167, 434, 405, 702, 953, 35, + /* 1030 */ 673, 321, 221, 434, 333, 953, 11, 434, 953, 26, + /* 1040 */ 953, 36, 953, 37, 251, 953, 38, 434, 259, 434, + /* 1050 */ 757, 434, 329, 953, 27, 434, 223, 953, 28, 434, + /* 1060 */ 690, 434, 67, 434, 65, 434, 862, 953, 39, 953, + /* 1070 */ 40, 953, 41, 423, 434, 953, 10, 434, 772, 953, + /* 1080 */ 42, 953, 98, 953, 43, 953, 44, 773, 434, 346, + /* 1090 */ 434, 75, 434, 73, 953, 31, 434, 953, 45, 434, + /* 1100 */ 259, 434, 690, 434, 757, 434, 887, 434, 953, 46, + /* 1110 */ 953, 32, 953, 115, 434, 266, 953, 116, 951, 953, + /* 1120 */ 117, 953, 52, 953, 33, 953, 99, 953, 49, 726, + /* 1130 */ 434, 909, 434, 19, 953, 100, 434, 344, 434, 113, + /* 1140 */ 434, 258, 692, 434, 259, 434, 670, 434, 20, 434, + /* 1150 */ 953, 101, 953, 97, 434, 259, 953, 114, 953, 112, + /* 1160 */ 953, 105, 113, 953, 104, 953, 102, 953, 103, 953, + /* 1170 */ 51, 434, 148, 434, 953, 53, 167, 434, 259, 113, + /* 1180 */ 300, 307, 912, 363, 311, 860, 248, 261, 209, 264, + /* 1190 */ 416, 953, 50, 953, 25, 420, 727, 953, 29, 430, + /* 1200 */ 321, 424, 757, 428, 322, 124, 1269, 214, 165, 710, + /* 1210 */ 859, 908, 806, 794, 309, 158, 193, 361, 254, 723, + /* 1220 */ 364, 67, 381, 269, 735, 199, 67, 70, 113, 700, + /* 1230 */ 699, 707, 708, 884, 113, 766, 113, 855, 193, 883, + /* 1240 */ 199, 869, 869, 675, 868, 868, 109, 368, 255, 260, + /* 1250 */ 263, 280, 859, 265, 806, 974, 267, 711, 695, 272, + /* 1260 */ 764, 282, 795, 284, 150, 744, 755, 415, 292, 293, + /* 1270 */ 802, 678, 672, 661, 660, 662, 927, 6, 306, 386, + /* 1280 */ 352, 786, 243, 250, 886, 362, 163, 286, 419, 298, + /* 1290 */ 930, 159, 968, 196, 126, 903, 901, 965, 55, 58, + /* 1300 */ 323, 275, 857, 136, 147, 694, 856, 121, 65, 354, + /* 1310 */ 355, 379, 175, 61, 151, 369, 180, 871, 375, 129, + /* 1320 */ 257, 756, 210, 181, 145, 131, 132, 377, 262, 663, + /* 1330 */ 133, 134, 139, 783, 791, 182, 392, 183, 312, 330, + /* 1340 */ 714, 888, 713, 851, 692, 195, 712, 406, 686, 705, + /* 1350 */ 313, 685, 64, 839, 274, 72, 684, 334, 942, 95, + /* 1360 */ 752, 279, 281, 704, 753, 751, 422, 283, 411, 750, + /* 1370 */ 426, 66, 204, 409, 21, 285, 928, 669, 437, 205, + /* 1380 */ 207, 208, 438, 658, 657, 652, 118, 108, 119, 226, + /* 1390 */ 650, 341, 157, 235, 169, 345, 106, 734, 790, 296, + /* 1400 */ 294, 295, 120, 297, 867, 865, 127, 128, 130, 724, + /* 1410 */ 229, 174, 249, 882, 137, 230, 138, 135, 885, 231, + /* 1420 */ 59, 60, 177, 881, 7, 178, 12, 179, 256, 874, + /* 1430 */ 140, 193, 962, 374, 141, 152, 666, 378, 276, 184, + /* 1440 */ 270, 122, 142, 382, 387, 62, 13, 14, 703, 63, + /* 1450 */ 125, 317, 318, 227, 809, 808, 837, 732, 15, 164, + /* 1460 */ 736, 4, 765, 211, 399, 213, 192, 143, 760, 70, + /* 1470 */ 67, 16, 17, 838, 836, 891, 841, 890, 198, 197, + /* 1480 */ 917, 154, 421, 923, 918, 155, 200, 977, 425, 840, + /* 1490 */ 156, 201, 807, 676, 80, 302, 299, 977, 202, 1261, + /* 1500 */ 1260, }; static const YYCODETYPE yy_lookahead[] = { /* 0 */ 19, 95, 53, 97, 22, 24, 24, 101, 27, 28, /* 10 */ 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, /* 20 */ 39, 40, 41, 152, 43, 44, 45, 46, 47, 48, /* 30 */ 49, 50, 51, 52, 53, 19, 55, 55, 132, 133, /* 40 */ 134, 1, 2, 27, 28, 29, 30, 31, 32, 33, - /* 50 */ 34, 35, 36, 37, 38, 39, 40, 41, 187, 43, + /* 50 */ 34, 35, 36, 37, 38, 39, 40, 41, 92, 43, /* 60 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, /* 70 */ 47, 48, 49, 50, 51, 52, 53, 61, 97, 97, /* 80 */ 19, 49, 50, 51, 52, 53, 70, 26, 27, 28, /* 90 */ 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, /* 100 */ 39, 40, 41, 152, 43, 44, 45, 46, 47, 48, /* 110 */ 49, 50, 51, 52, 53, 144, 145, 146, 147, 19, - /* 120 */ 137, 22, 139, 172, 173, 52, 53, 27, 28, 29, + /* 120 */ 249, 22, 172, 172, 173, 52, 53, 27, 28, 29, /* 130 */ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, /* 140 */ 40, 41, 81, 43, 44, 45, 46, 47, 48, 49, /* 150 */ 50, 51, 52, 53, 55, 56, 19, 152, 207, 208, /* 160 */ 115, 24, 117, 118, 27, 28, 29, 30, 31, 32, /* 170 */ 33, 34, 35, 36, 37, 38, 39, 40, 41, 79, /* 180 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, /* 190 */ 53, 19, 0, 1, 2, 23, 97, 98, 193, 27, /* 200 */ 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, /* 210 */ 38, 39, 40, 41, 152, 43, 44, 45, 46, 47, - /* 220 */ 48, 49, 50, 51, 52, 53, 19, 22, 23, 163, - /* 230 */ 23, 26, 190, 191, 27, 28, 29, 30, 31, 32, + /* 220 */ 48, 49, 50, 51, 52, 53, 19, 22, 23, 172, + /* 230 */ 23, 26, 119, 120, 27, 28, 29, 30, 31, 32, /* 240 */ 33, 34, 35, 36, 37, 38, 39, 40, 41, 187, /* 250 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - /* 260 */ 53, 19, 196, 22, 23, 23, 49, 26, 92, 27, + /* 260 */ 53, 19, 221, 222, 223, 23, 168, 169, 170, 27, /* 270 */ 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, - /* 280 */ 38, 39, 40, 41, 172, 43, 44, 45, 46, 47, - /* 290 */ 48, 49, 50, 51, 52, 53, 19, 221, 222, 223, - /* 300 */ 23, 96, 119, 120, 27, 28, 29, 30, 31, 32, - /* 310 */ 33, 34, 35, 36, 37, 38, 39, 40, 41, 172, + /* 280 */ 38, 39, 40, 41, 152, 43, 44, 45, 46, 47, + /* 290 */ 48, 49, 50, 51, 52, 53, 19, 157, 22, 23, + /* 300 */ 23, 96, 26, 172, 27, 28, 29, 30, 31, 32, + /* 310 */ 33, 34, 35, 36, 37, 38, 39, 40, 41, 187, /* 320 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - /* 330 */ 53, 19, 152, 116, 221, 222, 223, 96, 121, 27, + /* 330 */ 53, 19, 108, 109, 110, 221, 222, 223, 185, 27, /* 340 */ 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, - /* 350 */ 38, 39, 40, 41, 241, 43, 44, 45, 46, 47, - /* 360 */ 48, 49, 50, 51, 52, 53, 19, 157, 168, 169, - /* 370 */ 170, 22, 190, 191, 27, 28, 29, 30, 31, 32, + /* 350 */ 38, 39, 40, 41, 240, 43, 44, 45, 46, 47, + /* 360 */ 48, 49, 50, 51, 52, 53, 19, 227, 22, 23, + /* 370 */ 230, 22, 96, 152, 27, 28, 29, 30, 31, 32, /* 380 */ 33, 34, 35, 36, 37, 38, 39, 40, 41, 30, /* 390 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - /* 400 */ 53, 19, 172, 152, 55, 56, 24, 247, 248, 27, + /* 400 */ 53, 19, 190, 191, 55, 56, 24, 190, 191, 27, /* 410 */ 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, /* 420 */ 38, 39, 40, 41, 152, 43, 44, 45, 46, 47, - /* 430 */ 48, 49, 50, 51, 52, 53, 146, 147, 228, 179, - /* 440 */ 180, 231, 185, 19, 172, 173, 97, 98, 188, 26, + /* 430 */ 48, 49, 50, 51, 52, 53, 168, 169, 170, 179, + /* 440 */ 180, 171, 96, 19, 172, 173, 97, 98, 188, 179, /* 450 */ 138, 27, 28, 29, 30, 31, 32, 33, 34, 35, /* 460 */ 36, 37, 38, 39, 40, 41, 107, 43, 44, 45, /* 470 */ 46, 47, 48, 49, 50, 51, 52, 53, 19, 207, /* 480 */ 208, 30, 31, 32, 33, 138, 27, 28, 29, 30, /* 490 */ 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - /* 500 */ 41, 250, 43, 44, 45, 46, 47, 48, 49, 50, - /* 510 */ 51, 52, 53, 19, 168, 169, 170, 7, 8, 9, - /* 520 */ 19, 152, 28, 29, 30, 31, 32, 33, 34, 35, + /* 500 */ 41, 181, 43, 44, 45, 46, 47, 48, 49, 50, + /* 510 */ 51, 52, 53, 19, 152, 7, 8, 9, 49, 22, + /* 520 */ 19, 24, 28, 29, 30, 31, 32, 33, 34, 35, /* 530 */ 36, 37, 38, 39, 40, 41, 152, 43, 44, 45, /* 540 */ 46, 47, 48, 49, 50, 51, 52, 53, 19, 108, - /* 550 */ 109, 110, 101, 130, 53, 152, 172, 173, 29, 30, + /* 550 */ 109, 110, 101, 55, 53, 193, 172, 173, 29, 30, /* 560 */ 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, /* 570 */ 41, 152, 43, 44, 45, 46, 47, 48, 49, 50, /* 580 */ 51, 52, 53, 19, 20, 116, 22, 23, 169, 170, - /* 590 */ 121, 207, 85, 55, 56, 26, 19, 20, 101, 22, - /* 600 */ 99, 100, 101, 102, 103, 104, 105, 152, 152, 112, + /* 590 */ 121, 207, 85, 55, 56, 97, 19, 20, 195, 22, + /* 600 */ 99, 100, 101, 102, 103, 104, 105, 12, 152, 206, /* 610 */ 210, 47, 48, 112, 152, 108, 109, 110, 54, 55, /* 620 */ 56, 221, 222, 223, 47, 48, 119, 120, 172, 173, - /* 630 */ 66, 54, 55, 56, 152, 97, 98, 99, 148, 149, - /* 640 */ 102, 103, 104, 66, 154, 23, 156, 83, 26, 230, - /* 650 */ 152, 113, 152, 163, 172, 173, 92, 92, 21, 95, - /* 660 */ 83, 97, 98, 207, 208, 101, 152, 98, 186, 92, - /* 670 */ 172, 173, 95, 218, 97, 98, 152, 99, 101, 217, - /* 680 */ 102, 103, 104, 152, 119, 120, 196, 55, 56, 19, - /* 690 */ 20, 113, 22, 124, 163, 11, 132, 133, 134, 135, - /* 700 */ 136, 152, 152, 172, 173, 207, 208, 152, 152, 132, - /* 710 */ 133, 134, 135, 136, 164, 152, 84, 47, 48, 49, - /* 720 */ 98, 181, 152, 152, 54, 55, 56, 196, 91, 97, - /* 730 */ 98, 160, 218, 163, 244, 164, 66, 152, 207, 208, - /* 740 */ 103, 217, 172, 173, 19, 20, 124, 22, 193, 38, + /* 630 */ 66, 54, 55, 56, 101, 97, 98, 99, 148, 149, + /* 640 */ 102, 103, 104, 66, 154, 112, 156, 83, 229, 47, + /* 650 */ 48, 113, 57, 163, 194, 195, 92, 246, 247, 95, + /* 660 */ 83, 97, 98, 207, 208, 101, 206, 59, 73, 92, + /* 670 */ 75, 63, 95, 163, 97, 98, 194, 195, 101, 219, + /* 680 */ 85, 181, 19, 152, 175, 77, 196, 152, 206, 19, + /* 690 */ 20, 199, 22, 30, 163, 11, 132, 133, 134, 135, + /* 700 */ 136, 209, 152, 172, 173, 152, 196, 172, 173, 132, + /* 710 */ 133, 134, 135, 136, 164, 92, 213, 47, 48, 49, + /* 720 */ 92, 186, 169, 170, 54, 55, 56, 196, 100, 219, + /* 730 */ 221, 222, 223, 243, 132, 133, 66, 175, 207, 208, + /* 740 */ 152, 231, 119, 120, 19, 20, 236, 22, 152, 38, /* 750 */ 39, 40, 41, 83, 43, 44, 45, 46, 47, 48, - /* 760 */ 49, 50, 51, 52, 53, 95, 196, 97, 98, 85, - /* 770 */ 152, 101, 47, 48, 181, 85, 92, 140, 193, 54, - /* 780 */ 55, 56, 92, 49, 195, 55, 56, 175, 163, 55, - /* 790 */ 56, 66, 108, 109, 110, 206, 163, 242, 108, 109, - /* 800 */ 110, 175, 132, 133, 134, 135, 136, 152, 83, 43, + /* 760 */ 49, 50, 51, 52, 53, 95, 152, 97, 98, 85, + /* 770 */ 107, 101, 47, 48, 163, 112, 92, 152, 152, 54, + /* 780 */ 55, 56, 229, 221, 222, 223, 172, 173, 163, 49, + /* 790 */ 152, 66, 108, 109, 110, 55, 56, 172, 173, 163, + /* 800 */ 186, 22, 132, 133, 134, 135, 136, 196, 83, 43, /* 810 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - /* 820 */ 95, 196, 97, 98, 55, 56, 101, 97, 98, 196, - /* 830 */ 152, 97, 98, 221, 222, 223, 211, 212, 22, 23, - /* 840 */ 19, 20, 181, 22, 19, 152, 152, 221, 222, 223, - /* 850 */ 172, 173, 219, 19, 124, 30, 238, 132, 133, 134, - /* 860 */ 135, 136, 169, 170, 186, 232, 97, 98, 47, 48, - /* 870 */ 237, 152, 217, 152, 5, 54, 55, 56, 152, 10, - /* 880 */ 11, 12, 13, 14, 47, 48, 17, 66, 47, 48, - /* 890 */ 56, 172, 173, 124, 194, 195, 55, 56, 172, 173, - /* 900 */ 152, 152, 22, 152, 83, 186, 206, 108, 109, 110, - /* 910 */ 22, 23, 96, 152, 193, 12, 95, 152, 97, 98, - /* 920 */ 172, 173, 101, 230, 152, 164, 12, 47, 48, 60, - /* 930 */ 152, 62, 107, 207, 186, 55, 56, 112, 97, 98, - /* 940 */ 71, 100, 193, 152, 183, 152, 185, 152, 107, 152, - /* 950 */ 109, 82, 16, 132, 133, 134, 135, 136, 89, 152, - /* 960 */ 57, 92, 93, 172, 173, 172, 173, 172, 173, 132, - /* 970 */ 133, 57, 152, 132, 133, 95, 73, 97, 75, 55, - /* 980 */ 56, 101, 163, 114, 96, 245, 246, 73, 85, 75, + /* 820 */ 95, 196, 97, 98, 85, 99, 101, 152, 102, 103, + /* 830 */ 104, 92, 196, 146, 147, 152, 181, 97, 98, 113, + /* 840 */ 19, 20, 152, 22, 218, 22, 116, 108, 109, 110, + /* 850 */ 152, 121, 55, 56, 12, 219, 218, 132, 133, 134, + /* 860 */ 135, 136, 172, 173, 55, 56, 55, 56, 47, 48, + /* 870 */ 172, 173, 236, 152, 5, 54, 55, 56, 55, 10, + /* 880 */ 11, 12, 13, 14, 186, 152, 17, 66, 47, 48, + /* 890 */ 152, 210, 16, 84, 97, 98, 55, 56, 21, 57, + /* 900 */ 217, 122, 22, 152, 83, 152, 97, 98, 97, 98, + /* 910 */ 172, 173, 152, 152, 224, 73, 95, 75, 97, 98, + /* 920 */ 97, 124, 101, 172, 173, 164, 193, 47, 48, 60, + /* 930 */ 163, 62, 172, 173, 24, 55, 56, 186, 97, 98, + /* 940 */ 71, 100, 55, 56, 183, 207, 185, 152, 107, 23, + /* 950 */ 109, 82, 26, 132, 133, 134, 135, 136, 89, 152, + /* 960 */ 26, 92, 93, 196, 88, 55, 90, 152, 91, 152, + /* 970 */ 217, 152, 152, 132, 133, 95, 152, 97, 211, 212, + /* 980 */ 103, 101, 152, 114, 97, 98, 152, 172, 173, 19, /* 990 */ 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - /* 1000 */ 48, 49, 50, 51, 52, 53, 194, 195, 152, 171, - /* 1010 */ 141, 152, 132, 133, 134, 196, 225, 179, 206, 65, - /* 1020 */ 152, 97, 98, 152, 88, 152, 90, 152, 172, 173, - /* 1030 */ 152, 219, 78, 152, 152, 238, 152, 152, 219, 152, - /* 1040 */ 86, 152, 152, 172, 173, 238, 152, 172, 173, 152, - /* 1050 */ 172, 173, 152, 172, 173, 213, 237, 172, 173, 172, - /* 1060 */ 173, 172, 173, 211, 212, 111, 172, 173, 152, 172, - /* 1070 */ 173, 152, 172, 173, 152, 193, 140, 193, 152, 59, - /* 1080 */ 152, 152, 152, 63, 152, 16, 152, 152, 172, 173, - /* 1090 */ 152, 172, 173, 152, 172, 173, 152, 77, 172, 173, - /* 1100 */ 172, 173, 172, 173, 172, 173, 172, 173, 152, 250, - /* 1110 */ 172, 173, 61, 172, 173, 152, 172, 173, 152, 92, - /* 1120 */ 152, 70, 152, 152, 152, 26, 152, 100, 172, 173, - /* 1130 */ 152, 24, 152, 22, 152, 172, 173, 152, 172, 173, - /* 1140 */ 172, 173, 172, 173, 172, 173, 172, 173, 152, 152, - /* 1150 */ 172, 173, 172, 173, 172, 173, 152, 88, 152, 90, - /* 1160 */ 152, 55, 55, 152, 193, 152, 55, 152, 172, 173, - /* 1170 */ 26, 152, 163, 163, 152, 19, 172, 173, 172, 173, - /* 1180 */ 172, 173, 22, 172, 173, 172, 173, 172, 173, 55, - /* 1190 */ 193, 172, 173, 152, 172, 173, 166, 167, 166, 167, - /* 1200 */ 163, 163, 163, 97, 97, 196, 196, 163, 97, 55, - /* 1210 */ 23, 199, 56, 26, 22, 22, 24, 100, 101, 55, - /* 1220 */ 23, 209, 123, 26, 23, 23, 23, 26, 26, 26, - /* 1230 */ 37, 97, 152, 196, 196, 196, 23, 7, 8, 26, - /* 1240 */ 196, 23, 23, 152, 26, 26, 23, 132, 133, 26, - /* 1250 */ 106, 97, 132, 133, 23, 152, 152, 26, 210, 191, - /* 1260 */ 152, 97, 152, 234, 152, 152, 152, 233, 152, 210, - /* 1270 */ 152, 152, 210, 152, 152, 152, 152, 152, 152, 197, - /* 1280 */ 210, 198, 122, 150, 239, 201, 214, 214, 201, 239, - /* 1290 */ 214, 227, 200, 184, 198, 155, 67, 243, 122, 22, - /* 1300 */ 159, 159, 69, 176, 175, 175, 175, 240, 180, 159, - /* 1310 */ 220, 240, 27, 130, 18, 18, 159, 158, 220, 137, - /* 1320 */ 159, 189, 236, 158, 74, 159, 159, 158, 192, 192, - /* 1330 */ 192, 192, 235, 22, 189, 189, 201, 159, 158, 177, - /* 1340 */ 159, 107, 158, 76, 201, 177, 174, 174, 201, 174, - /* 1350 */ 106, 177, 182, 174, 107, 159, 22, 125, 159, 182, - /* 1360 */ 174, 176, 174, 174, 216, 216, 215, 215, 177, 216, - /* 1370 */ 215, 53, 137, 128, 216, 177, 127, 129, 215, 126, - /* 1380 */ 25, 13, 162, 26, 6, 161, 165, 165, 178, 153, - /* 1390 */ 153, 151, 151, 151, 151, 224, 4, 3, 22, 142, - /* 1400 */ 15, 94, 16, 178, 165, 205, 23, 202, 204, 203, - /* 1410 */ 201, 23, 120, 131, 111, 20, 226, 123, 125, 16, - /* 1420 */ 1, 123, 131, 229, 229, 111, 37, 37, 56, 64, - /* 1430 */ 122, 1, 5, 22, 107, 140, 80, 87, 26, 80, - /* 1440 */ 107, 72, 24, 20, 19, 105, 22, 112, 22, 79, - /* 1450 */ 22, 58, 23, 22, 79, 22, 249, 249, 246, 79, - /* 1460 */ 23, 23, 23, 116, 68, 22, 26, 23, 22, 56, - /* 1470 */ 122, 23, 23, 64, 22, 124, 26, 26, 64, 64, - /* 1480 */ 23, 23, 23, 23, 11, 23, 22, 26, 23, 22, - /* 1490 */ 24, 1, 23, 22, 26, 122, 24, 23, 22, 122, - /* 1500 */ 23, 23, 22, 122, 122, 23, 15, + /* 1000 */ 48, 49, 50, 51, 52, 53, 65, 97, 152, 152, + /* 1010 */ 141, 124, 132, 133, 134, 152, 140, 140, 152, 78, + /* 1020 */ 152, 233, 152, 193, 98, 152, 56, 86, 172, 173, + /* 1030 */ 166, 167, 237, 152, 217, 172, 173, 152, 172, 173, + /* 1040 */ 172, 173, 172, 173, 237, 172, 173, 152, 152, 152, + /* 1050 */ 124, 152, 111, 172, 173, 152, 237, 172, 173, 152, + /* 1060 */ 55, 152, 26, 152, 130, 152, 152, 172, 173, 172, + /* 1070 */ 173, 172, 173, 249, 152, 172, 173, 152, 61, 172, + /* 1080 */ 173, 172, 173, 172, 173, 172, 173, 70, 152, 193, + /* 1090 */ 152, 137, 152, 139, 172, 173, 152, 172, 173, 152, + /* 1100 */ 152, 152, 97, 152, 26, 152, 163, 152, 172, 173, + /* 1110 */ 172, 173, 172, 173, 152, 16, 172, 173, 26, 172, + /* 1120 */ 173, 172, 173, 172, 173, 172, 173, 172, 173, 163, + /* 1130 */ 152, 152, 152, 22, 172, 173, 152, 241, 152, 196, + /* 1140 */ 152, 193, 106, 152, 152, 152, 163, 152, 37, 152, + /* 1150 */ 172, 173, 172, 173, 152, 152, 172, 173, 172, 173, + /* 1160 */ 172, 173, 196, 172, 173, 172, 173, 172, 173, 172, + /* 1170 */ 173, 152, 152, 152, 172, 173, 98, 152, 152, 196, + /* 1180 */ 160, 22, 23, 19, 164, 193, 152, 88, 232, 90, + /* 1190 */ 191, 172, 173, 172, 173, 163, 193, 172, 173, 166, + /* 1200 */ 167, 163, 124, 163, 244, 245, 23, 211, 212, 26, + /* 1210 */ 55, 23, 55, 23, 26, 123, 26, 152, 23, 193, + /* 1220 */ 56, 26, 23, 23, 23, 26, 26, 26, 196, 100, + /* 1230 */ 101, 7, 8, 152, 196, 23, 196, 23, 26, 152, + /* 1240 */ 26, 132, 133, 23, 132, 133, 26, 152, 152, 152, + /* 1250 */ 152, 210, 97, 152, 97, 96, 152, 152, 152, 152, + /* 1260 */ 152, 210, 152, 210, 197, 152, 152, 152, 152, 152, + /* 1270 */ 152, 152, 152, 152, 152, 152, 152, 198, 150, 176, + /* 1280 */ 214, 201, 214, 238, 201, 238, 184, 214, 226, 200, + /* 1290 */ 155, 198, 67, 122, 242, 159, 159, 69, 239, 239, + /* 1300 */ 159, 175, 175, 22, 220, 180, 175, 27, 130, 18, + /* 1310 */ 159, 18, 158, 137, 220, 159, 158, 235, 74, 189, + /* 1320 */ 234, 159, 159, 158, 22, 192, 192, 177, 159, 159, + /* 1330 */ 192, 192, 189, 201, 189, 158, 107, 158, 177, 76, + /* 1340 */ 174, 201, 174, 201, 106, 159, 174, 125, 174, 182, + /* 1350 */ 177, 176, 107, 159, 174, 137, 174, 53, 174, 129, + /* 1360 */ 216, 215, 215, 182, 216, 216, 177, 215, 126, 216, + /* 1370 */ 177, 128, 25, 127, 26, 215, 13, 162, 161, 153, + /* 1380 */ 153, 6, 151, 151, 151, 151, 165, 178, 165, 178, + /* 1390 */ 4, 3, 22, 142, 15, 94, 16, 205, 120, 202, + /* 1400 */ 204, 203, 165, 201, 23, 23, 131, 111, 123, 20, + /* 1410 */ 225, 125, 16, 1, 131, 228, 111, 123, 56, 228, + /* 1420 */ 37, 37, 64, 1, 5, 122, 22, 107, 140, 80, + /* 1430 */ 80, 26, 87, 72, 107, 24, 20, 19, 112, 105, + /* 1440 */ 23, 68, 22, 79, 79, 22, 22, 22, 58, 22, + /* 1450 */ 245, 248, 248, 79, 23, 23, 23, 116, 22, 122, + /* 1460 */ 23, 22, 56, 23, 26, 23, 64, 22, 124, 26, + /* 1470 */ 26, 64, 64, 23, 23, 23, 11, 23, 22, 26, + /* 1480 */ 23, 22, 24, 1, 23, 22, 26, 250, 24, 23, + /* 1490 */ 22, 122, 23, 23, 22, 15, 23, 250, 122, 122, + /* 1500 */ 122, }; #define YY_SHIFT_USE_DFLT (-95) -#define YY_SHIFT_COUNT (442) +#define YY_SHIFT_COUNT (439) #define YY_SHIFT_MIN (-94) -#define YY_SHIFT_MAX (1491) +#define YY_SHIFT_MAX (1482) static const short yy_shift_ofst[] = { - /* 0 */ 40, 564, 869, 577, 725, 725, 725, 725, 690, -19, - /* 10 */ 16, 16, 100, 725, 725, 725, 725, 725, 725, 725, - /* 20 */ 841, 841, 538, 507, 684, 565, 61, 137, 172, 207, - /* 30 */ 242, 277, 312, 347, 382, 424, 424, 424, 424, 424, - /* 40 */ 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, - /* 50 */ 459, 424, 494, 529, 529, 670, 725, 725, 725, 725, + /* 0 */ 40, 564, 869, 577, 725, 725, 725, 739, -19, 16, + /* 10 */ 16, 100, 725, 725, 725, 725, 725, 725, 725, 841, + /* 20 */ 841, 538, 507, 684, 623, 61, 137, 172, 207, 242, + /* 30 */ 277, 312, 347, 382, 424, 424, 424, 424, 424, 424, + /* 40 */ 424, 424, 424, 424, 424, 424, 424, 424, 424, 459, + /* 50 */ 424, 494, 529, 529, 670, 725, 725, 725, 725, 725, /* 60 */ 725, 725, 725, 725, 725, 725, 725, 725, 725, 725, /* 70 */ 725, 725, 725, 725, 725, 725, 725, 725, 725, 725, - /* 80 */ 725, 725, 725, 725, 821, 725, 725, 725, 725, 725, - /* 90 */ 725, 725, 725, 725, 725, 725, 725, 725, 952, 711, - /* 100 */ 711, 711, 711, 711, 766, 23, 32, 924, 637, 825, - /* 110 */ 837, 837, 924, 73, 183, -51, -95, -95, -95, 501, - /* 120 */ 501, 501, 903, 903, 632, 205, 241, 924, 924, 924, - /* 130 */ 924, 924, 924, 924, 924, 924, 924, 924, 924, 924, - /* 140 */ 924, 924, 924, 924, 924, 924, 924, 192, 1027, 1106, - /* 150 */ 1106, 183, 176, 176, 176, 176, 176, 176, -95, -95, - /* 160 */ -95, 880, -94, -94, 578, 734, 99, 730, 769, 349, - /* 170 */ 924, 924, 924, 924, 924, 924, 924, 924, 924, 924, - /* 180 */ 924, 924, 924, 924, 924, 924, 924, 954, 954, 954, - /* 190 */ 924, 924, 622, 924, 924, 924, -18, 924, 924, 914, - /* 200 */ 924, 924, 924, 924, 924, 924, 924, 924, 924, 924, - /* 210 */ 441, 1020, 1107, 1107, 1107, 569, 45, 217, 510, 423, - /* 220 */ 834, 834, 1156, 423, 1156, 1144, 1187, 359, 1051, 834, - /* 230 */ -17, 1051, 1051, 1099, 469, 1192, 1229, 1176, 1176, 1233, - /* 240 */ 1233, 1176, 1277, 1285, 1183, 1296, 1296, 1296, 1296, 1176, - /* 250 */ 1297, 1183, 1277, 1285, 1285, 1183, 1176, 1297, 1182, 1250, - /* 260 */ 1176, 1176, 1297, 1311, 1176, 1297, 1176, 1297, 1311, 1234, - /* 270 */ 1234, 1234, 1267, 1311, 1234, 1244, 1234, 1267, 1234, 1234, - /* 280 */ 1232, 1247, 1232, 1247, 1232, 1247, 1232, 1247, 1176, 1334, - /* 290 */ 1176, 1235, 1311, 1318, 1318, 1311, 1248, 1253, 1245, 1249, - /* 300 */ 1183, 1355, 1357, 1368, 1368, 1378, 1378, 1378, 1378, -95, - /* 310 */ -95, -95, -95, -95, -95, -95, -95, 451, 936, 816, - /* 320 */ 888, 1069, 799, 1111, 1197, 1193, 1201, 1202, 1203, 1213, - /* 330 */ 1134, 1117, 1230, 497, 1218, 1219, 1154, 1223, 1115, 1120, - /* 340 */ 1231, 1164, 1160, 1392, 1394, 1376, 1257, 1385, 1307, 1386, - /* 350 */ 1383, 1388, 1292, 1282, 1303, 1294, 1395, 1293, 1403, 1419, - /* 360 */ 1298, 1291, 1389, 1390, 1314, 1372, 1365, 1308, 1430, 1427, - /* 370 */ 1411, 1327, 1295, 1356, 1412, 1359, 1350, 1369, 1333, 1418, - /* 380 */ 1423, 1425, 1335, 1340, 1424, 1370, 1426, 1428, 1429, 1431, - /* 390 */ 1375, 1393, 1433, 1380, 1396, 1437, 1438, 1439, 1347, 1443, - /* 400 */ 1444, 1446, 1440, 1348, 1448, 1449, 1413, 1409, 1452, 1351, - /* 410 */ 1450, 1414, 1451, 1415, 1457, 1450, 1458, 1459, 1460, 1461, - /* 420 */ 1462, 1464, 1473, 1465, 1467, 1466, 1468, 1469, 1471, 1472, - /* 430 */ 1468, 1474, 1476, 1477, 1478, 1480, 1373, 1377, 1381, 1382, - /* 440 */ 1482, 1491, 1490, + /* 80 */ 725, 725, 725, 821, 725, 725, 725, 725, 725, 725, + /* 90 */ 725, 725, 725, 725, 725, 725, 725, 952, 711, 711, + /* 100 */ 711, 711, 711, 766, 23, 32, 811, 877, 663, 602, + /* 110 */ 602, 811, 73, 113, -51, -95, -95, -95, 501, 501, + /* 120 */ 501, 595, 595, 809, 205, 276, 811, 811, 811, 811, + /* 130 */ 811, 811, 811, 811, 811, 811, 811, 811, 811, 811, + /* 140 */ 811, 811, 811, 811, 811, 811, 192, 628, 498, 498, + /* 150 */ 113, -34, -34, -34, -34, -34, -34, -95, -95, -95, + /* 160 */ 880, -94, -94, 726, 740, 99, 797, 887, 349, 811, + /* 170 */ 811, 811, 811, 811, 811, 811, 811, 811, 811, 811, + /* 180 */ 811, 811, 811, 811, 811, 811, 941, 941, 941, 811, + /* 190 */ 811, 926, 811, 811, 811, -18, 811, 811, 842, 811, + /* 200 */ 811, 811, 811, 811, 811, 811, 811, 811, 811, 224, + /* 210 */ 608, 910, 910, 910, 1078, 45, 469, 508, 934, 970, + /* 220 */ 970, 1164, 934, 1164, 1036, 1183, 359, 1017, 970, 954, + /* 230 */ 1017, 1017, 1092, 730, 497, 1225, 1171, 1171, 1228, 1228, + /* 240 */ 1171, 1281, 1280, 1178, 1291, 1291, 1291, 1291, 1171, 1293, + /* 250 */ 1178, 1281, 1280, 1280, 1178, 1171, 1293, 1176, 1244, 1171, + /* 260 */ 1171, 1293, 1302, 1171, 1293, 1171, 1293, 1302, 1229, 1229, + /* 270 */ 1229, 1263, 1302, 1229, 1238, 1229, 1263, 1229, 1229, 1222, + /* 280 */ 1245, 1222, 1245, 1222, 1245, 1222, 1245, 1171, 1171, 1218, + /* 290 */ 1302, 1304, 1304, 1302, 1230, 1242, 1243, 1246, 1178, 1347, + /* 300 */ 1348, 1363, 1363, 1375, 1375, 1375, 1375, -95, -95, -95, + /* 310 */ -95, -95, -95, -95, -95, 451, 876, 346, 1159, 1099, + /* 320 */ 441, 823, 1188, 1111, 1190, 1195, 1199, 1200, 1005, 1129, + /* 330 */ 1224, 533, 1201, 1212, 1155, 1214, 1109, 1112, 1220, 1157, + /* 340 */ 779, 1386, 1388, 1370, 1251, 1379, 1301, 1380, 1381, 1382, + /* 350 */ 1278, 1275, 1296, 1285, 1389, 1286, 1396, 1412, 1294, 1283, + /* 360 */ 1383, 1384, 1305, 1362, 1358, 1303, 1422, 1419, 1404, 1320, + /* 370 */ 1288, 1349, 1405, 1350, 1345, 1361, 1327, 1411, 1416, 1418, + /* 380 */ 1326, 1334, 1420, 1364, 1423, 1424, 1417, 1425, 1365, 1390, + /* 390 */ 1427, 1374, 1373, 1431, 1432, 1433, 1341, 1436, 1437, 1439, + /* 400 */ 1438, 1337, 1440, 1442, 1406, 1402, 1445, 1344, 1443, 1407, + /* 410 */ 1444, 1408, 1443, 1450, 1451, 1452, 1453, 1454, 1456, 1465, + /* 420 */ 1457, 1459, 1458, 1460, 1461, 1463, 1464, 1460, 1466, 1468, + /* 430 */ 1469, 1470, 1472, 1369, 1376, 1377, 1378, 1473, 1480, 1482, }; #define YY_REDUCE_USE_DFLT (-130) -#define YY_REDUCE_COUNT (316) +#define YY_REDUCE_COUNT (314) #define YY_REDUCE_MIN (-129) -#define YY_REDUCE_MAX (1243) +#define YY_REDUCE_MAX (1237) static const short yy_reduce_ofst[] = { - /* 0 */ -29, 531, 490, 570, -49, 272, 456, 498, 633, 400, - /* 10 */ 612, 626, 113, 482, 678, 719, 384, 726, 748, 791, - /* 20 */ 419, 693, 761, 812, 819, 625, 76, 76, 76, 76, - /* 30 */ 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, - /* 40 */ 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, - /* 50 */ 76, 76, 76, 76, 76, 793, 795, 856, 871, 875, - /* 60 */ 878, 881, 885, 887, 889, 894, 897, 900, 916, 919, - /* 70 */ 922, 926, 928, 930, 932, 934, 938, 941, 944, 956, - /* 80 */ 963, 966, 968, 970, 972, 974, 978, 980, 982, 996, - /* 90 */ 1004, 1006, 1008, 1011, 1013, 1015, 1019, 1022, 76, 76, - /* 100 */ 76, 76, 76, 76, 76, 76, 76, 555, 210, 260, - /* 110 */ 200, 346, 571, 76, 700, 76, 76, 76, 76, 838, - /* 120 */ 838, 838, 42, 182, 251, 160, 160, 550, 5, 455, - /* 130 */ 585, 721, 749, 882, 884, 971, 618, 462, 797, 514, - /* 140 */ 807, 524, 997, -129, 655, 859, 62, 290, 66, 1030, - /* 150 */ 1032, 589, 1009, 1010, 1037, 1038, 1039, 1044, 740, 852, - /* 160 */ 1012, 112, 147, 230, 257, 180, 369, 403, 500, 549, - /* 170 */ 556, 563, 694, 751, 765, 772, 778, 820, 868, 873, - /* 180 */ 890, 929, 935, 985, 1041, 1080, 1091, 540, 593, 661, - /* 190 */ 1103, 1104, 842, 1108, 1110, 1112, 1048, 1113, 1114, 1068, - /* 200 */ 1116, 1118, 1119, 180, 1121, 1122, 1123, 1124, 1125, 1126, - /* 210 */ 1029, 1034, 1059, 1062, 1070, 842, 1082, 1083, 1133, 1084, - /* 220 */ 1072, 1073, 1045, 1087, 1050, 1127, 1109, 1128, 1129, 1076, - /* 230 */ 1064, 1130, 1131, 1092, 1096, 1140, 1054, 1141, 1142, 1067, - /* 240 */ 1071, 1150, 1090, 1132, 1135, 1136, 1137, 1138, 1139, 1157, - /* 250 */ 1159, 1143, 1098, 1145, 1146, 1147, 1161, 1165, 1086, 1097, - /* 260 */ 1166, 1167, 1169, 1162, 1178, 1180, 1181, 1184, 1168, 1172, - /* 270 */ 1173, 1175, 1170, 1174, 1179, 1185, 1186, 1177, 1188, 1189, - /* 280 */ 1148, 1151, 1149, 1152, 1153, 1155, 1158, 1163, 1196, 1171, - /* 290 */ 1199, 1190, 1191, 1194, 1195, 1198, 1200, 1204, 1206, 1205, - /* 300 */ 1209, 1220, 1224, 1236, 1237, 1240, 1241, 1242, 1243, 1207, - /* 310 */ 1208, 1212, 1221, 1222, 1210, 1225, 1239, + /* 0 */ -29, 531, 490, 625, -49, 272, 456, 510, 400, 509, + /* 10 */ 562, 114, 535, 614, 698, 384, 738, 751, 690, 419, + /* 20 */ 553, 761, 460, 636, 767, 41, 41, 41, 41, 41, + /* 30 */ 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, + /* 40 */ 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, + /* 50 */ 41, 41, 41, 41, 760, 815, 856, 863, 866, 868, + /* 60 */ 870, 873, 881, 885, 895, 897, 899, 903, 907, 909, + /* 70 */ 911, 913, 922, 925, 936, 938, 940, 944, 947, 949, + /* 80 */ 951, 953, 955, 962, 978, 980, 984, 986, 988, 991, + /* 90 */ 993, 995, 997, 1002, 1019, 1021, 1025, 41, 41, 41, + /* 100 */ 41, 41, 41, 41, 41, 41, 896, 140, 260, 98, + /* 110 */ 268, 1020, 41, 482, 41, 41, 41, 41, 270, 270, + /* 120 */ 270, 212, 217, -129, 411, 411, 550, 5, 626, 362, + /* 130 */ 733, 830, 992, 1003, 1026, 795, 683, 807, 638, 819, + /* 140 */ 753, 948, 62, 817, 824, 132, 687, 611, 864, 1033, + /* 150 */ 403, 943, 966, 983, 1032, 1038, 1040, 960, 996, 492, + /* 160 */ -50, 57, 131, 153, 221, 462, 588, 596, 675, 721, + /* 170 */ 820, 834, 857, 914, 979, 1034, 1065, 1081, 1087, 1095, + /* 180 */ 1096, 1097, 1098, 1101, 1104, 1105, 320, 500, 655, 1106, + /* 190 */ 1107, 503, 1108, 1110, 1113, 681, 1114, 1115, 999, 1116, + /* 200 */ 1117, 1118, 221, 1119, 1120, 1121, 1122, 1123, 1124, 788, + /* 210 */ 956, 1041, 1051, 1053, 503, 1067, 1079, 1128, 1080, 1066, + /* 220 */ 1068, 1045, 1083, 1047, 1103, 1102, 1125, 1126, 1073, 1062, + /* 230 */ 1127, 1131, 1089, 1093, 1135, 1052, 1136, 1137, 1059, 1060, + /* 240 */ 1141, 1084, 1130, 1132, 1133, 1134, 1138, 1139, 1151, 1154, + /* 250 */ 1140, 1094, 1143, 1145, 1142, 1156, 1158, 1082, 1086, 1162, + /* 260 */ 1163, 1165, 1150, 1169, 1177, 1170, 1179, 1161, 1166, 1168, + /* 270 */ 1172, 1167, 1173, 1174, 1175, 1180, 1181, 1182, 1184, 1144, + /* 280 */ 1146, 1148, 1147, 1149, 1152, 1153, 1160, 1186, 1194, 1185, + /* 290 */ 1189, 1187, 1191, 1193, 1192, 1196, 1198, 1197, 1202, 1215, + /* 300 */ 1217, 1226, 1227, 1231, 1232, 1233, 1234, 1203, 1204, 1205, + /* 310 */ 1221, 1223, 1209, 1211, 1237, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 1258, 1248, 1248, 1248, 1180, 1180, 1180, 1180, 1248, 1077, - /* 10 */ 1106, 1106, 1232, 1309, 1309, 1309, 1309, 1309, 1309, 1179, - /* 20 */ 1309, 1309, 1309, 1309, 1248, 1081, 1112, 1309, 1309, 1309, - /* 30 */ 1309, 1309, 1309, 1309, 1309, 1231, 1233, 1120, 1119, 1214, - /* 40 */ 1093, 1117, 1110, 1114, 1181, 1175, 1176, 1174, 1178, 1182, - /* 50 */ 1309, 1113, 1144, 1159, 1143, 1309, 1309, 1309, 1309, 1309, - /* 60 */ 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, - /* 70 */ 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, - /* 80 */ 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, - /* 90 */ 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1153, 1158, - /* 100 */ 1165, 1157, 1154, 1146, 1145, 1147, 1148, 1309, 1000, 1048, - /* 110 */ 1309, 1309, 1309, 1149, 1309, 1150, 1162, 1161, 1160, 1239, - /* 120 */ 1266, 1265, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, - /* 130 */ 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, - /* 140 */ 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1258, 1248, 1006, - /* 150 */ 1006, 1309, 1248, 1248, 1248, 1248, 1248, 1248, 1244, 1081, - /* 160 */ 1072, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, - /* 170 */ 1309, 1236, 1234, 1309, 1195, 1309, 1309, 1309, 1309, 1309, - /* 180 */ 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, - /* 190 */ 1309, 1309, 1309, 1309, 1309, 1309, 1077, 1309, 1309, 1309, - /* 200 */ 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1260, - /* 210 */ 1309, 1209, 1077, 1077, 1077, 1079, 1061, 1071, 985, 1116, - /* 220 */ 1095, 1095, 1298, 1116, 1298, 1023, 1280, 1020, 1106, 1095, - /* 230 */ 1177, 1106, 1106, 1078, 1071, 1309, 1301, 1086, 1086, 1300, - /* 240 */ 1300, 1086, 1125, 1051, 1116, 1057, 1057, 1057, 1057, 1086, - /* 250 */ 997, 1116, 1125, 1051, 1051, 1116, 1086, 997, 1213, 1295, - /* 260 */ 1086, 1086, 997, 1188, 1086, 997, 1086, 997, 1188, 1049, - /* 270 */ 1049, 1049, 1038, 1188, 1049, 1023, 1049, 1038, 1049, 1049, - /* 280 */ 1099, 1094, 1099, 1094, 1099, 1094, 1099, 1094, 1086, 1183, - /* 290 */ 1086, 1309, 1188, 1192, 1192, 1188, 1111, 1100, 1109, 1107, - /* 300 */ 1116, 1003, 1041, 1263, 1263, 1259, 1259, 1259, 1259, 1306, - /* 310 */ 1306, 1244, 1275, 1275, 1025, 1025, 1275, 1309, 1309, 1309, - /* 320 */ 1309, 1309, 1309, 1270, 1309, 1197, 1309, 1309, 1309, 1309, - /* 330 */ 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, - /* 340 */ 1309, 1309, 1131, 1309, 981, 1241, 1309, 1309, 1240, 1309, - /* 350 */ 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, - /* 360 */ 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1297, 1309, 1309, - /* 370 */ 1309, 1309, 1309, 1309, 1212, 1211, 1309, 1309, 1309, 1309, - /* 380 */ 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, - /* 390 */ 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1063, 1309, - /* 400 */ 1309, 1309, 1284, 1309, 1309, 1309, 1309, 1309, 1309, 1309, - /* 410 */ 1108, 1309, 1101, 1309, 1309, 1288, 1309, 1309, 1309, 1309, - /* 420 */ 1309, 1309, 1309, 1309, 1309, 1309, 1250, 1309, 1309, 1309, - /* 430 */ 1249, 1309, 1309, 1309, 1309, 1309, 1133, 1309, 1132, 1136, - /* 440 */ 1309, 991, 1309, + /* 0 */ 1250, 1240, 1240, 1240, 1174, 1174, 1174, 1240, 1071, 1100, + /* 10 */ 1100, 1224, 1301, 1301, 1301, 1301, 1301, 1301, 1173, 1301, + /* 20 */ 1301, 1301, 1301, 1240, 1075, 1106, 1301, 1301, 1301, 1301, + /* 30 */ 1301, 1301, 1301, 1301, 1223, 1225, 1114, 1113, 1206, 1087, + /* 40 */ 1111, 1104, 1108, 1175, 1169, 1170, 1168, 1172, 1176, 1301, + /* 50 */ 1107, 1138, 1153, 1137, 1301, 1301, 1301, 1301, 1301, 1301, + /* 60 */ 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, + /* 70 */ 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, + /* 80 */ 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, + /* 90 */ 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1147, 1152, 1159, + /* 100 */ 1151, 1148, 1140, 1139, 1141, 1142, 1301, 994, 1042, 1301, + /* 110 */ 1301, 1301, 1143, 1301, 1144, 1156, 1155, 1154, 1231, 1258, + /* 120 */ 1257, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, + /* 130 */ 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, + /* 140 */ 1301, 1301, 1301, 1301, 1301, 1301, 1250, 1240, 1000, 1000, + /* 150 */ 1301, 1240, 1240, 1240, 1240, 1240, 1240, 1236, 1075, 1066, + /* 160 */ 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, + /* 170 */ 1228, 1226, 1301, 1187, 1301, 1301, 1301, 1301, 1301, 1301, + /* 180 */ 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, + /* 190 */ 1301, 1301, 1301, 1301, 1301, 1071, 1301, 1301, 1301, 1301, + /* 200 */ 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1252, 1301, + /* 210 */ 1201, 1071, 1071, 1071, 1073, 1055, 1065, 979, 1110, 1089, + /* 220 */ 1089, 1290, 1110, 1290, 1017, 1272, 1014, 1100, 1089, 1171, + /* 230 */ 1100, 1100, 1072, 1065, 1301, 1293, 1080, 1080, 1292, 1292, + /* 240 */ 1080, 1119, 1045, 1110, 1051, 1051, 1051, 1051, 1080, 991, + /* 250 */ 1110, 1119, 1045, 1045, 1110, 1080, 991, 1205, 1287, 1080, + /* 260 */ 1080, 991, 1180, 1080, 991, 1080, 991, 1180, 1043, 1043, + /* 270 */ 1043, 1032, 1180, 1043, 1017, 1043, 1032, 1043, 1043, 1093, + /* 280 */ 1088, 1093, 1088, 1093, 1088, 1093, 1088, 1080, 1080, 1301, + /* 290 */ 1180, 1184, 1184, 1180, 1105, 1094, 1103, 1101, 1110, 997, + /* 300 */ 1035, 1255, 1255, 1251, 1251, 1251, 1251, 1298, 1298, 1236, + /* 310 */ 1267, 1267, 1019, 1019, 1267, 1301, 1301, 1301, 1301, 1301, + /* 320 */ 1301, 1262, 1301, 1189, 1301, 1301, 1301, 1301, 1301, 1301, + /* 330 */ 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, + /* 340 */ 1125, 1301, 975, 1233, 1301, 1301, 1232, 1301, 1301, 1301, + /* 350 */ 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, + /* 360 */ 1301, 1301, 1301, 1301, 1301, 1289, 1301, 1301, 1301, 1301, + /* 370 */ 1301, 1301, 1204, 1203, 1301, 1301, 1301, 1301, 1301, 1301, + /* 380 */ 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, + /* 390 */ 1301, 1301, 1301, 1301, 1301, 1301, 1057, 1301, 1301, 1301, + /* 400 */ 1276, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1102, 1301, + /* 410 */ 1095, 1301, 1280, 1301, 1301, 1301, 1301, 1301, 1301, 1301, + /* 420 */ 1301, 1301, 1301, 1242, 1301, 1301, 1301, 1241, 1301, 1301, + /* 430 */ 1301, 1301, 1301, 1127, 1301, 1126, 1130, 1301, 985, 1301, }; /********** End of lemon-generated parsing tables *****************************/ /* The next table maps tokens (terminal symbols) into fallback tokens. ** If a construct like the following: @@ -132472,22 +131672,21 @@ typedef struct yyStackEntry yyStackEntry; /* The state of the parser is completely contained in an instance of ** the following structure */ struct yyParser { - yyStackEntry *yytos; /* Pointer to top element of the stack */ + int yyidx; /* Index of top element in stack */ #ifdef YYTRACKMAXSTACKDEPTH - int yyhwm; /* High-water mark of the stack */ + int yyidxMax; /* Maximum value of yyidx */ #endif #ifndef YYNOERRORRECOVERY int yyerrcnt; /* Shifts left before out of the error */ #endif sqlite3ParserARG_SDECL /* A place to hold %extra_argument */ #if YYSTACKDEPTH<=0 int yystksz; /* Current side of the stack */ yyStackEntry *yystack; /* The parser's stack */ - yyStackEntry yystk0; /* First stack entry */ #else yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */ #endif }; typedef struct yyParser yyParser; @@ -132582,17 +131781,17 @@ "orderby_opt", "limit_opt", "values", "nexprlist", "exprlist", "sclp", "as", "seltablist", "stl_prefix", "joinop", "indexed_opt", "on_opt", "using_opt", "idlist", "setlist", "insert_cmd", "idlist_opt", "likeop", "between_op", "in_op", - "paren_exprlist", "case_operand", "case_exprlist", "case_else", - "uniqueflag", "collate", "nmnum", "trigger_decl", - "trigger_cmd_list", "trigger_time", "trigger_event", "foreach_clause", - "when_clause", "trigger_cmd", "trnm", "tridxby", - "database_kw_opt", "key_opt", "add_column_fullname", "kwcolumn_opt", - "create_vtab", "vtabarglist", "vtabarg", "vtabargtoken", - "lp", "anylist", "wqlist", + "case_operand", "case_exprlist", "case_else", "uniqueflag", + "collate", "nmnum", "trigger_decl", "trigger_cmd_list", + "trigger_time", "trigger_event", "foreach_clause", "when_clause", + "trigger_cmd", "trnm", "tridxby", "database_kw_opt", + "key_opt", "add_column_fullname", "kwcolumn_opt", "create_vtab", + "vtabarglist", "vtabarg", "vtabargtoken", "lp", + "anylist", "wqlist", }; #endif /* NDEBUG */ #ifndef NDEBUG /* For tracing reduce actions, the names of all rules are required. @@ -132786,11 +131985,11 @@ /* 185 */ "in_op ::= IN", /* 186 */ "in_op ::= NOT IN", /* 187 */ "expr ::= expr in_op LP exprlist RP", /* 188 */ "expr ::= LP select RP", /* 189 */ "expr ::= expr in_op LP select RP", - /* 190 */ "expr ::= expr in_op nm dbnm paren_exprlist", + /* 190 */ "expr ::= expr in_op nm dbnm", /* 191 */ "expr ::= EXISTS LP select RP", /* 192 */ "expr ::= CASE case_operand case_exprlist case_else END", /* 193 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr", /* 194 */ "case_exprlist ::= WHEN expr THEN expr", /* 195 */ "case_else ::= ELSE expr", @@ -132798,170 +131997,158 @@ /* 197 */ "case_operand ::= expr", /* 198 */ "case_operand ::=", /* 199 */ "exprlist ::=", /* 200 */ "nexprlist ::= nexprlist COMMA expr", /* 201 */ "nexprlist ::= expr", - /* 202 */ "paren_exprlist ::=", - /* 203 */ "paren_exprlist ::= LP exprlist RP", - /* 204 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt", - /* 205 */ "uniqueflag ::= UNIQUE", - /* 206 */ "uniqueflag ::=", - /* 207 */ "eidlist_opt ::=", - /* 208 */ "eidlist_opt ::= LP eidlist RP", - /* 209 */ "eidlist ::= eidlist COMMA nm collate sortorder", - /* 210 */ "eidlist ::= nm collate sortorder", - /* 211 */ "collate ::=", - /* 212 */ "collate ::= COLLATE ID|STRING", - /* 213 */ "cmd ::= DROP INDEX ifexists fullname", - /* 214 */ "cmd ::= VACUUM", - /* 215 */ "cmd ::= VACUUM nm", - /* 216 */ "cmd ::= PRAGMA nm dbnm", - /* 217 */ "cmd ::= PRAGMA nm dbnm EQ nmnum", - /* 218 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP", - /* 219 */ "cmd ::= PRAGMA nm dbnm EQ minus_num", - /* 220 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP", - /* 221 */ "plus_num ::= PLUS INTEGER|FLOAT", - /* 222 */ "minus_num ::= MINUS INTEGER|FLOAT", - /* 223 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END", - /* 224 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause", - /* 225 */ "trigger_time ::= BEFORE", - /* 226 */ "trigger_time ::= AFTER", - /* 227 */ "trigger_time ::= INSTEAD OF", - /* 228 */ "trigger_time ::=", - /* 229 */ "trigger_event ::= DELETE|INSERT", - /* 230 */ "trigger_event ::= UPDATE", - /* 231 */ "trigger_event ::= UPDATE OF idlist", - /* 232 */ "when_clause ::=", - /* 233 */ "when_clause ::= WHEN expr", - /* 234 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI", - /* 235 */ "trigger_cmd_list ::= trigger_cmd SEMI", - /* 236 */ "trnm ::= nm DOT nm", - /* 237 */ "tridxby ::= INDEXED BY nm", - /* 238 */ "tridxby ::= NOT INDEXED", - /* 239 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt", - /* 240 */ "trigger_cmd ::= insert_cmd INTO trnm idlist_opt select", - /* 241 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt", - /* 242 */ "trigger_cmd ::= select", - /* 243 */ "expr ::= RAISE LP IGNORE RP", - /* 244 */ "expr ::= RAISE LP raisetype COMMA nm RP", - /* 245 */ "raisetype ::= ROLLBACK", - /* 246 */ "raisetype ::= ABORT", - /* 247 */ "raisetype ::= FAIL", - /* 248 */ "cmd ::= DROP TRIGGER ifexists fullname", - /* 249 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt", - /* 250 */ "cmd ::= DETACH database_kw_opt expr", - /* 251 */ "key_opt ::=", - /* 252 */ "key_opt ::= KEY expr", - /* 253 */ "cmd ::= REINDEX", - /* 254 */ "cmd ::= REINDEX nm dbnm", - /* 255 */ "cmd ::= ANALYZE", - /* 256 */ "cmd ::= ANALYZE nm dbnm", - /* 257 */ "cmd ::= ALTER TABLE fullname RENAME TO nm", - /* 258 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist", - /* 259 */ "add_column_fullname ::= fullname", - /* 260 */ "cmd ::= create_vtab", - /* 261 */ "cmd ::= create_vtab LP vtabarglist RP", - /* 262 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm", - /* 263 */ "vtabarg ::=", - /* 264 */ "vtabargtoken ::= ANY", - /* 265 */ "vtabargtoken ::= lp anylist RP", - /* 266 */ "lp ::= LP", - /* 267 */ "with ::=", - /* 268 */ "with ::= WITH wqlist", - /* 269 */ "with ::= WITH RECURSIVE wqlist", - /* 270 */ "wqlist ::= nm eidlist_opt AS LP select RP", - /* 271 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP", - /* 272 */ "input ::= cmdlist", - /* 273 */ "cmdlist ::= cmdlist ecmd", - /* 274 */ "cmdlist ::= ecmd", - /* 275 */ "ecmd ::= SEMI", - /* 276 */ "ecmd ::= explain cmdx SEMI", - /* 277 */ "explain ::=", - /* 278 */ "trans_opt ::=", - /* 279 */ "trans_opt ::= TRANSACTION", - /* 280 */ "trans_opt ::= TRANSACTION nm", - /* 281 */ "savepoint_opt ::= SAVEPOINT", - /* 282 */ "savepoint_opt ::=", - /* 283 */ "cmd ::= create_table create_table_args", - /* 284 */ "columnlist ::= columnlist COMMA columnname carglist", - /* 285 */ "columnlist ::= columnname carglist", - /* 286 */ "nm ::= ID|INDEXED", - /* 287 */ "nm ::= STRING", - /* 288 */ "nm ::= JOIN_KW", - /* 289 */ "typetoken ::= typename", - /* 290 */ "typename ::= ID|STRING", - /* 291 */ "signed ::= plus_num", - /* 292 */ "signed ::= minus_num", - /* 293 */ "carglist ::= carglist ccons", - /* 294 */ "carglist ::=", - /* 295 */ "ccons ::= NULL onconf", - /* 296 */ "conslist_opt ::= COMMA conslist", - /* 297 */ "conslist ::= conslist tconscomma tcons", - /* 298 */ "conslist ::= tcons", - /* 299 */ "tconscomma ::=", - /* 300 */ "defer_subclause_opt ::= defer_subclause", - /* 301 */ "resolvetype ::= raisetype", - /* 302 */ "selectnowith ::= oneselect", - /* 303 */ "oneselect ::= values", - /* 304 */ "sclp ::= selcollist COMMA", - /* 305 */ "as ::= ID|STRING", - /* 306 */ "expr ::= term", - /* 307 */ "exprlist ::= nexprlist", - /* 308 */ "nmnum ::= plus_num", - /* 309 */ "nmnum ::= nm", - /* 310 */ "nmnum ::= ON", - /* 311 */ "nmnum ::= DELETE", - /* 312 */ "nmnum ::= DEFAULT", - /* 313 */ "plus_num ::= INTEGER|FLOAT", - /* 314 */ "foreach_clause ::=", - /* 315 */ "foreach_clause ::= FOR EACH ROW", - /* 316 */ "trnm ::= nm", - /* 317 */ "tridxby ::=", - /* 318 */ "database_kw_opt ::= DATABASE", - /* 319 */ "database_kw_opt ::=", - /* 320 */ "kwcolumn_opt ::=", - /* 321 */ "kwcolumn_opt ::= COLUMNKW", - /* 322 */ "vtabarglist ::= vtabarg", - /* 323 */ "vtabarglist ::= vtabarglist COMMA vtabarg", - /* 324 */ "vtabarg ::= vtabarg vtabargtoken", - /* 325 */ "anylist ::=", - /* 326 */ "anylist ::= anylist LP anylist RP", - /* 327 */ "anylist ::= anylist ANY", + /* 202 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt", + /* 203 */ "uniqueflag ::= UNIQUE", + /* 204 */ "uniqueflag ::=", + /* 205 */ "eidlist_opt ::=", + /* 206 */ "eidlist_opt ::= LP eidlist RP", + /* 207 */ "eidlist ::= eidlist COMMA nm collate sortorder", + /* 208 */ "eidlist ::= nm collate sortorder", + /* 209 */ "collate ::=", + /* 210 */ "collate ::= COLLATE ID|STRING", + /* 211 */ "cmd ::= DROP INDEX ifexists fullname", + /* 212 */ "cmd ::= VACUUM", + /* 213 */ "cmd ::= VACUUM nm", + /* 214 */ "cmd ::= PRAGMA nm dbnm", + /* 215 */ "cmd ::= PRAGMA nm dbnm EQ nmnum", + /* 216 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP", + /* 217 */ "cmd ::= PRAGMA nm dbnm EQ minus_num", + /* 218 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP", + /* 219 */ "plus_num ::= PLUS INTEGER|FLOAT", + /* 220 */ "minus_num ::= MINUS INTEGER|FLOAT", + /* 221 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END", + /* 222 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause", + /* 223 */ "trigger_time ::= BEFORE", + /* 224 */ "trigger_time ::= AFTER", + /* 225 */ "trigger_time ::= INSTEAD OF", + /* 226 */ "trigger_time ::=", + /* 227 */ "trigger_event ::= DELETE|INSERT", + /* 228 */ "trigger_event ::= UPDATE", + /* 229 */ "trigger_event ::= UPDATE OF idlist", + /* 230 */ "when_clause ::=", + /* 231 */ "when_clause ::= WHEN expr", + /* 232 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI", + /* 233 */ "trigger_cmd_list ::= trigger_cmd SEMI", + /* 234 */ "trnm ::= nm DOT nm", + /* 235 */ "tridxby ::= INDEXED BY nm", + /* 236 */ "tridxby ::= NOT INDEXED", + /* 237 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt", + /* 238 */ "trigger_cmd ::= insert_cmd INTO trnm idlist_opt select", + /* 239 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt", + /* 240 */ "trigger_cmd ::= select", + /* 241 */ "expr ::= RAISE LP IGNORE RP", + /* 242 */ "expr ::= RAISE LP raisetype COMMA nm RP", + /* 243 */ "raisetype ::= ROLLBACK", + /* 244 */ "raisetype ::= ABORT", + /* 245 */ "raisetype ::= FAIL", + /* 246 */ "cmd ::= DROP TRIGGER ifexists fullname", + /* 247 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt", + /* 248 */ "cmd ::= DETACH database_kw_opt expr", + /* 249 */ "key_opt ::=", + /* 250 */ "key_opt ::= KEY expr", + /* 251 */ "cmd ::= REINDEX", + /* 252 */ "cmd ::= REINDEX nm dbnm", + /* 253 */ "cmd ::= ANALYZE", + /* 254 */ "cmd ::= ANALYZE nm dbnm", + /* 255 */ "cmd ::= ALTER TABLE fullname RENAME TO nm", + /* 256 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist", + /* 257 */ "add_column_fullname ::= fullname", + /* 258 */ "cmd ::= create_vtab", + /* 259 */ "cmd ::= create_vtab LP vtabarglist RP", + /* 260 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm", + /* 261 */ "vtabarg ::=", + /* 262 */ "vtabargtoken ::= ANY", + /* 263 */ "vtabargtoken ::= lp anylist RP", + /* 264 */ "lp ::= LP", + /* 265 */ "with ::=", + /* 266 */ "with ::= WITH wqlist", + /* 267 */ "with ::= WITH RECURSIVE wqlist", + /* 268 */ "wqlist ::= nm eidlist_opt AS LP select RP", + /* 269 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP", + /* 270 */ "input ::= cmdlist", + /* 271 */ "cmdlist ::= cmdlist ecmd", + /* 272 */ "cmdlist ::= ecmd", + /* 273 */ "ecmd ::= SEMI", + /* 274 */ "ecmd ::= explain cmdx SEMI", + /* 275 */ "explain ::=", + /* 276 */ "trans_opt ::=", + /* 277 */ "trans_opt ::= TRANSACTION", + /* 278 */ "trans_opt ::= TRANSACTION nm", + /* 279 */ "savepoint_opt ::= SAVEPOINT", + /* 280 */ "savepoint_opt ::=", + /* 281 */ "cmd ::= create_table create_table_args", + /* 282 */ "columnlist ::= columnlist COMMA columnname carglist", + /* 283 */ "columnlist ::= columnname carglist", + /* 284 */ "nm ::= ID|INDEXED", + /* 285 */ "nm ::= STRING", + /* 286 */ "nm ::= JOIN_KW", + /* 287 */ "typetoken ::= typename", + /* 288 */ "typename ::= ID|STRING", + /* 289 */ "signed ::= plus_num", + /* 290 */ "signed ::= minus_num", + /* 291 */ "carglist ::= carglist ccons", + /* 292 */ "carglist ::=", + /* 293 */ "ccons ::= NULL onconf", + /* 294 */ "conslist_opt ::= COMMA conslist", + /* 295 */ "conslist ::= conslist tconscomma tcons", + /* 296 */ "conslist ::= tcons", + /* 297 */ "tconscomma ::=", + /* 298 */ "defer_subclause_opt ::= defer_subclause", + /* 299 */ "resolvetype ::= raisetype", + /* 300 */ "selectnowith ::= oneselect", + /* 301 */ "oneselect ::= values", + /* 302 */ "sclp ::= selcollist COMMA", + /* 303 */ "as ::= ID|STRING", + /* 304 */ "expr ::= term", + /* 305 */ "exprlist ::= nexprlist", + /* 306 */ "nmnum ::= plus_num", + /* 307 */ "nmnum ::= nm", + /* 308 */ "nmnum ::= ON", + /* 309 */ "nmnum ::= DELETE", + /* 310 */ "nmnum ::= DEFAULT", + /* 311 */ "plus_num ::= INTEGER|FLOAT", + /* 312 */ "foreach_clause ::=", + /* 313 */ "foreach_clause ::= FOR EACH ROW", + /* 314 */ "trnm ::= nm", + /* 315 */ "tridxby ::=", + /* 316 */ "database_kw_opt ::= DATABASE", + /* 317 */ "database_kw_opt ::=", + /* 318 */ "kwcolumn_opt ::=", + /* 319 */ "kwcolumn_opt ::= COLUMNKW", + /* 320 */ "vtabarglist ::= vtabarg", + /* 321 */ "vtabarglist ::= vtabarglist COMMA vtabarg", + /* 322 */ "vtabarg ::= vtabarg vtabargtoken", + /* 323 */ "anylist ::=", + /* 324 */ "anylist ::= anylist LP anylist RP", + /* 325 */ "anylist ::= anylist ANY", }; #endif /* NDEBUG */ #if YYSTACKDEPTH<=0 /* -** Try to increase the size of the parser stack. Return the number -** of errors. Return 0 on success. +** Try to increase the size of the parser stack. */ -static int yyGrowStack(yyParser *p){ +static void yyGrowStack(yyParser *p){ int newSize; - int idx; yyStackEntry *pNew; newSize = p->yystksz*2 + 100; - idx = p->yytos ? (int)(p->yytos - p->yystack) : 0; - if( p->yystack==&p->yystk0 ){ - pNew = malloc(newSize*sizeof(pNew[0])); - if( pNew ) pNew[0] = p->yystk0; - }else{ - pNew = realloc(p->yystack, newSize*sizeof(pNew[0])); - } + pNew = realloc(p->yystack, newSize*sizeof(pNew[0])); if( pNew ){ p->yystack = pNew; - p->yytos = &p->yystack[idx]; + p->yystksz = newSize; #ifndef NDEBUG if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sStack grows from %d to %d entries.\n", - yyTracePrompt, p->yystksz, newSize); + fprintf(yyTraceFILE,"%sStack grows to %d entries!\n", + yyTracePrompt, p->yystksz); } #endif - p->yystksz = newSize; } - return pNew==0; } #endif /* Datatype of the argument to the memory allocated passed as the ** second argument to sqlite3ParserAlloc() below. This can be changed by @@ -132986,28 +132173,19 @@ */ SQLITE_PRIVATE void *sqlite3ParserAlloc(void *(*mallocProc)(YYMALLOCARGTYPE)){ yyParser *pParser; pParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) ); if( pParser ){ + pParser->yyidx = -1; #ifdef YYTRACKMAXSTACKDEPTH - pParser->yyhwm = 0; + pParser->yyidxMax = 0; #endif #if YYSTACKDEPTH<=0 - pParser->yytos = NULL; pParser->yystack = NULL; pParser->yystksz = 0; - if( yyGrowStack(pParser) ){ - pParser->yystack = &pParser->yystk0; - pParser->yystksz = 1; - } -#endif -#ifndef YYNOERRORRECOVERY - pParser->yyerrcnt = -1; -#endif - pParser->yytos = pParser->yystack; - pParser->yystack[0].stateno = 0; - pParser->yystack[0].major = 0; + yyGrowStack(pParser); +#endif } return pParser; } /* The following function deletes the "minor type" or semantic value @@ -133038,17 +132216,17 @@ case 163: /* select */ case 194: /* selectnowith */ case 195: /* oneselect */ case 206: /* values */ { -sqlite3SelectDelete(pParse->db, (yypminor->yy243)); +sqlite3SelectDelete(pParse->db, (yypminor->yy159)); } break; case 172: /* term */ case 173: /* expr */ { -sqlite3ExprDelete(pParse->db, (yypminor->yy190).pExpr); +sqlite3ExprDelete(pParse->db, (yypminor->yy342).pExpr); } break; case 177: /* eidlist_opt */ case 186: /* sortlist */ case 187: /* eidlist */ @@ -133057,57 +132235,56 @@ case 204: /* orderby_opt */ case 207: /* nexprlist */ case 208: /* exprlist */ case 209: /* sclp */ case 218: /* setlist */ - case 224: /* paren_exprlist */ - case 226: /* case_exprlist */ + case 225: /* case_exprlist */ { -sqlite3ExprListDelete(pParse->db, (yypminor->yy148)); +sqlite3ExprListDelete(pParse->db, (yypminor->yy442)); } break; case 193: /* fullname */ case 200: /* from */ case 211: /* seltablist */ case 212: /* stl_prefix */ { -sqlite3SrcListDelete(pParse->db, (yypminor->yy185)); +sqlite3SrcListDelete(pParse->db, (yypminor->yy347)); } break; case 196: /* with */ - case 250: /* wqlist */ + case 249: /* wqlist */ { -sqlite3WithDelete(pParse->db, (yypminor->yy285)); +sqlite3WithDelete(pParse->db, (yypminor->yy331)); } break; case 201: /* where_opt */ case 203: /* having_opt */ case 215: /* on_opt */ - case 225: /* case_operand */ - case 227: /* case_else */ - case 236: /* when_clause */ - case 241: /* key_opt */ + case 224: /* case_operand */ + case 226: /* case_else */ + case 235: /* when_clause */ + case 240: /* key_opt */ { -sqlite3ExprDelete(pParse->db, (yypminor->yy72)); +sqlite3ExprDelete(pParse->db, (yypminor->yy122)); } break; case 216: /* using_opt */ case 217: /* idlist */ case 220: /* idlist_opt */ { -sqlite3IdListDelete(pParse->db, (yypminor->yy254)); +sqlite3IdListDelete(pParse->db, (yypminor->yy180)); } break; - case 232: /* trigger_cmd_list */ - case 237: /* trigger_cmd */ + case 231: /* trigger_cmd_list */ + case 236: /* trigger_cmd */ { -sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy145)); +sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy327)); } break; - case 234: /* trigger_event */ + case 233: /* trigger_event */ { -sqlite3IdListDelete(pParse->db, (yypminor->yy332).b); +sqlite3IdListDelete(pParse->db, (yypminor->yy410).b); } break; /********* End destructor definitions *****************************************/ default: break; /* If no destructor action specified: do nothing */ } @@ -133119,13 +132296,12 @@ ** If there is a destructor routine associated with the token which ** is popped from the stack, then call it. */ static void yy_pop_parser_stack(yyParser *pParser){ yyStackEntry *yytos; - assert( pParser->yytos!=0 ); - assert( pParser->yytos > pParser->yystack ); - yytos = pParser->yytos--; + assert( pParser->yyidx>=0 ); + yytos = &pParser->yystack[pParser->yyidx--]; #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE,"%sPopping %s\n", yyTracePrompt, yyTokenName[yytos->major]); @@ -133148,13 +132324,13 @@ ){ yyParser *pParser = (yyParser*)p; #ifndef YYPARSEFREENEVERNULL if( pParser==0 ) return; #endif - while( pParser->yytos>pParser->yystack ) yy_pop_parser_stack(pParser); + while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser); #if YYSTACKDEPTH<=0 - if( pParser->yystack!=&pParser->yystk0 ) free(pParser->yystack); + free(pParser->yystack); #endif (*freeProc)((void*)pParser); } /* @@ -133161,11 +132337,11 @@ ** Return the peak depth of the stack for a parser. */ #ifdef YYTRACKMAXSTACKDEPTH SQLITE_PRIVATE int sqlite3ParserStackPeak(void *p){ yyParser *pParser = (yyParser*)p; - return pParser->yyhwm; + return pParser->yyidxMax; } #endif /* ** Find the appropriate action for a parser given the terminal @@ -133174,11 +132350,11 @@ static unsigned int yy_find_shift_action( yyParser *pParser, /* The parser */ YYCODETYPE iLookAhead /* The look-ahead token */ ){ int i; - int stateno = pParser->yytos->stateno; + int stateno = pParser->yystack[pParser->yyidx].stateno; if( stateno>=YY_MIN_REDUCE ) return stateno; assert( stateno <= YY_SHIFT_COUNT ); do{ i = yy_shift_ofst[stateno]; @@ -133267,17 +132443,17 @@ /* ** The following routine is called if the stack overflows. */ static void yyStackOverflow(yyParser *yypParser){ sqlite3ParserARG_FETCH; - yypParser->yytos--; + yypParser->yyidx--; #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt); } #endif - while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser); + while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); /* Here code is inserted which will execute if the parser ** stack every overflows */ /******** Begin %stack_overflow code ******************************************/ sqlite3ErrorMsg(pParse, "parser stack overflow"); @@ -133291,15 +132467,15 @@ #ifndef NDEBUG static void yyTraceShift(yyParser *yypParser, int yyNewState){ if( yyTraceFILE ){ if( yyNewStateyytos->major], + yyTracePrompt,yyTokenName[yypParser->yystack[yypParser->yyidx].major], yyNewState); }else{ fprintf(yyTraceFILE,"%sShift '%s'\n", - yyTracePrompt,yyTokenName[yypParser->yytos->major]); + yyTracePrompt,yyTokenName[yypParser->yystack[yypParser->yyidx].major]); } } } #else # define yyTraceShift(X,Y) @@ -133313,34 +132489,31 @@ int yyNewState, /* The new state to shift in */ int yyMajor, /* The major token to shift in */ sqlite3ParserTOKENTYPE yyMinor /* The minor token to shift in */ ){ yyStackEntry *yytos; - yypParser->yytos++; + yypParser->yyidx++; #ifdef YYTRACKMAXSTACKDEPTH - if( (int)(yypParser->yytos - yypParser->yystack)>yypParser->yyhwm ){ - yypParser->yyhwm++; - assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack) ); + if( yypParser->yyidx>yypParser->yyidxMax ){ + yypParser->yyidxMax = yypParser->yyidx; } #endif #if YYSTACKDEPTH>0 - if( yypParser->yytos>=&yypParser->yystack[YYSTACKDEPTH] ){ + if( yypParser->yyidx>=YYSTACKDEPTH ){ yyStackOverflow(yypParser); return; } #else - if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz] ){ - if( yyGrowStack(yypParser) ){ + if( yypParser->yyidx>=yypParser->yystksz ){ + yyGrowStack(yypParser); + if( yypParser->yyidx>=yypParser->yystksz ){ yyStackOverflow(yypParser); return; } } #endif - if( yyNewState > YY_MAX_SHIFT ){ - yyNewState += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE; - } - yytos = yypParser->yytos; + yytos = &yypParser->yystack[yypParser->yyidx]; yytos->stateno = (YYACTIONTYPE)yyNewState; yytos->major = (YYCODETYPE)yyMajor; yytos->minor.yy0 = yyMinor; yyTraceShift(yypParser, yyNewState); } @@ -133540,33 +132713,31 @@ { 223, 1 }, { 223, 2 }, { 173, 5 }, { 173, 3 }, { 173, 5 }, - { 173, 5 }, + { 173, 4 }, { 173, 4 }, { 173, 5 }, - { 226, 5 }, - { 226, 4 }, - { 227, 2 }, - { 227, 0 }, - { 225, 1 }, - { 225, 0 }, + { 225, 5 }, + { 225, 4 }, + { 226, 2 }, + { 226, 0 }, + { 224, 1 }, + { 224, 0 }, { 208, 0 }, { 207, 3 }, { 207, 1 }, - { 224, 0 }, - { 224, 3 }, { 149, 12 }, - { 228, 1 }, - { 228, 0 }, + { 227, 1 }, + { 227, 0 }, { 177, 0 }, { 177, 3 }, { 187, 5 }, { 187, 3 }, - { 229, 0 }, - { 229, 2 }, + { 228, 0 }, + { 228, 2 }, { 149, 4 }, { 149, 1 }, { 149, 2 }, { 149, 3 }, { 149, 5 }, @@ -133574,58 +132745,58 @@ { 149, 5 }, { 149, 6 }, { 169, 2 }, { 170, 2 }, { 149, 5 }, - { 231, 11 }, + { 230, 11 }, + { 232, 1 }, + { 232, 1 }, + { 232, 2 }, + { 232, 0 }, { 233, 1 }, { 233, 1 }, - { 233, 2 }, - { 233, 0 }, - { 234, 1 }, - { 234, 1 }, - { 234, 3 }, - { 236, 0 }, - { 236, 2 }, - { 232, 3 }, - { 232, 2 }, + { 233, 3 }, + { 235, 0 }, + { 235, 2 }, + { 231, 3 }, + { 231, 2 }, + { 237, 3 }, { 238, 3 }, - { 239, 3 }, - { 239, 2 }, - { 237, 7 }, - { 237, 5 }, - { 237, 5 }, - { 237, 1 }, + { 238, 2 }, + { 236, 7 }, + { 236, 5 }, + { 236, 5 }, + { 236, 1 }, { 173, 4 }, { 173, 6 }, { 191, 1 }, { 191, 1 }, { 191, 1 }, { 149, 4 }, { 149, 6 }, { 149, 3 }, - { 241, 0 }, - { 241, 2 }, + { 240, 0 }, + { 240, 2 }, { 149, 1 }, { 149, 3 }, { 149, 1 }, { 149, 3 }, { 149, 6 }, { 149, 7 }, - { 242, 1 }, + { 241, 1 }, { 149, 1 }, { 149, 4 }, - { 244, 8 }, - { 246, 0 }, + { 243, 8 }, + { 245, 0 }, + { 246, 1 }, + { 246, 3 }, { 247, 1 }, - { 247, 3 }, - { 248, 1 }, { 196, 0 }, { 196, 2 }, { 196, 3 }, - { 250, 6 }, - { 250, 8 }, + { 249, 6 }, + { 249, 8 }, { 144, 1 }, { 145, 2 }, { 145, 1 }, { 146, 1 }, { 146, 3 }, @@ -133658,30 +132829,30 @@ { 195, 1 }, { 209, 2 }, { 210, 1 }, { 173, 1 }, { 208, 1 }, - { 230, 1 }, - { 230, 1 }, - { 230, 1 }, - { 230, 1 }, - { 230, 1 }, + { 229, 1 }, + { 229, 1 }, + { 229, 1 }, + { 229, 1 }, + { 229, 1 }, { 169, 1 }, - { 235, 0 }, - { 235, 3 }, - { 238, 1 }, + { 234, 0 }, + { 234, 3 }, + { 237, 1 }, + { 238, 0 }, + { 239, 1 }, { 239, 0 }, - { 240, 1 }, - { 240, 0 }, - { 243, 0 }, - { 243, 1 }, - { 245, 1 }, - { 245, 3 }, - { 246, 2 }, - { 249, 0 }, - { 249, 4 }, - { 249, 2 }, + { 242, 0 }, + { 242, 1 }, + { 244, 1 }, + { 244, 3 }, + { 245, 2 }, + { 248, 0 }, + { 248, 4 }, + { 248, 2 }, }; static void yy_accept(yyParser*); /* Forward Declaration */ /* @@ -133695,11 +132866,11 @@ int yygoto; /* The next state */ int yyact; /* The next action */ yyStackEntry *yymsp; /* The top of the parser's stack */ int yysize; /* Amount to pop the stack */ sqlite3ParserARG_FETCH; - yymsp = yypParser->yytos; + yymsp = &yypParser->yystack[yypParser->yyidx]; #ifndef NDEBUG if( yyTraceFILE && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){ yysize = yyRuleInfo[yyruleno].nrhs; fprintf(yyTraceFILE, "%sReduce [%s], go to state %d.\n", yyTracePrompt, yyRuleName[yyruleno], yymsp[-yysize].stateno); @@ -133709,27 +132880,26 @@ /* Check that the stack is large enough to grow by a single entry ** if the RHS of the rule is empty. This ensures that there is room ** enough on the stack to push the LHS value */ if( yyRuleInfo[yyruleno].nrhs==0 ){ #ifdef YYTRACKMAXSTACKDEPTH - if( (int)(yypParser->yytos - yypParser->yystack)>yypParser->yyhwm ){ - yypParser->yyhwm++; - assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack)); + if( yypParser->yyidx>yypParser->yyidxMax ){ + yypParser->yyidxMax = yypParser->yyidx; } #endif #if YYSTACKDEPTH>0 - if( yypParser->yytos>=&yypParser->yystack[YYSTACKDEPTH-1] ){ + if( yypParser->yyidx>=YYSTACKDEPTH-1 ){ yyStackOverflow(yypParser); return; } #else - if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){ - if( yyGrowStack(yypParser) ){ + if( yypParser->yyidx>=yypParser->yystksz-1 ){ + yyGrowStack(yypParser); + if( yypParser->yyidx>=yypParser->yystksz-1 ){ yyStackOverflow(yypParser); return; } - yymsp = yypParser->yytos; } #endif } switch( yyruleno ){ @@ -133751,19 +132921,19 @@ break; case 2: /* cmdx ::= cmd */ { sqlite3FinishCoding(pParse); } break; case 3: /* cmd ::= BEGIN transtype trans_opt */ -{sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy194);} +{sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy392);} break; case 4: /* transtype ::= */ -{yymsp[1].minor.yy194 = TK_DEFERRED;} +{yymsp[1].minor.yy392 = TK_DEFERRED;} break; case 5: /* transtype ::= DEFERRED */ case 6: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==6); case 7: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==7); -{yymsp[0].minor.yy194 = yymsp[0].major; /*A-overwrites-X*/} +{yymsp[0].minor.yy392 = yymsp[0].major; /*A-overwrites-X*/} break; case 8: /* cmd ::= COMMIT trans_opt */ case 9: /* cmd ::= END trans_opt */ yytestcase(yyruleno==9); {sqlite3CommitTransaction(pParse);} break; @@ -133785,11 +132955,11 @@ sqlite3Savepoint(pParse, SAVEPOINT_ROLLBACK, &yymsp[0].minor.yy0); } break; case 14: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */ { - sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy194,0,0,yymsp[-2].minor.yy194); + sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy392,0,0,yymsp[-2].minor.yy392); } break; case 15: /* createkw ::= CREATE */ {disableLookaside(pParse);} break; @@ -133799,37 +132969,37 @@ case 42: /* autoinc ::= */ yytestcase(yyruleno==42); case 57: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==57); case 67: /* defer_subclause_opt ::= */ yytestcase(yyruleno==67); case 76: /* ifexists ::= */ yytestcase(yyruleno==76); case 90: /* distinct ::= */ yytestcase(yyruleno==90); - case 211: /* collate ::= */ yytestcase(yyruleno==211); -{yymsp[1].minor.yy194 = 0;} + case 209: /* collate ::= */ yytestcase(yyruleno==209); +{yymsp[1].minor.yy392 = 0;} break; case 17: /* ifnotexists ::= IF NOT EXISTS */ -{yymsp[-2].minor.yy194 = 1;} +{yymsp[-2].minor.yy392 = 1;} break; case 18: /* temp ::= TEMP */ case 43: /* autoinc ::= AUTOINCR */ yytestcase(yyruleno==43); -{yymsp[0].minor.yy194 = 1;} +{yymsp[0].minor.yy392 = 1;} break; case 20: /* create_table_args ::= LP columnlist conslist_opt RP table_options */ { - sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy194,0); + sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy392,0); } break; case 21: /* create_table_args ::= AS select */ { - sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy243); - sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy243); + sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy159); + sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy159); } break; case 23: /* table_options ::= WITHOUT nm */ { if( yymsp[0].minor.yy0.n==5 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"rowid",5)==0 ){ - yymsp[-1].minor.yy194 = TF_WithoutRowid | TF_NoVisibleRowid; + yymsp[-1].minor.yy392 = TF_WithoutRowid | TF_NoVisibleRowid; }else{ - yymsp[-1].minor.yy194 = 0; + yymsp[-1].minor.yy392 = 0; sqlite3ErrorMsg(pParse, "unknown table option: %.*s", yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.z); } } break; case 24: /* columnname ::= nm typetoken */ @@ -133857,21 +133027,21 @@ case 62: /* tcons ::= CONSTRAINT nm */ yytestcase(yyruleno==62); {pParse->constraintName = yymsp[0].minor.yy0;} break; case 30: /* ccons ::= DEFAULT term */ case 32: /* ccons ::= DEFAULT PLUS term */ yytestcase(yyruleno==32); -{sqlite3AddDefaultValue(pParse,&yymsp[0].minor.yy190);} +{sqlite3AddDefaultValue(pParse,&yymsp[0].minor.yy342);} break; case 31: /* ccons ::= DEFAULT LP expr RP */ -{sqlite3AddDefaultValue(pParse,&yymsp[-1].minor.yy190);} +{sqlite3AddDefaultValue(pParse,&yymsp[-1].minor.yy342);} break; case 33: /* ccons ::= DEFAULT MINUS term */ { ExprSpan v; - v.pExpr = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy190.pExpr, 0, 0); + v.pExpr = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy342.pExpr, 0, 0); v.zStart = yymsp[-1].minor.yy0.z; - v.zEnd = yymsp[0].minor.yy190.zEnd; + v.zEnd = yymsp[0].minor.yy342.zEnd; sqlite3AddDefaultValue(pParse,&v); } break; case 34: /* ccons ::= DEFAULT ID|INDEXED */ { @@ -133879,186 +133049,184 @@ spanExpr(&v, pParse, TK_STRING, yymsp[0].minor.yy0); sqlite3AddDefaultValue(pParse,&v); } break; case 35: /* ccons ::= NOT NULL onconf */ -{sqlite3AddNotNull(pParse, yymsp[0].minor.yy194);} +{sqlite3AddNotNull(pParse, yymsp[0].minor.yy392);} break; case 36: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */ -{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy194,yymsp[0].minor.yy194,yymsp[-2].minor.yy194);} +{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy392,yymsp[0].minor.yy392,yymsp[-2].minor.yy392);} break; case 37: /* ccons ::= UNIQUE onconf */ -{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy194,0,0,0,0, - SQLITE_IDXTYPE_UNIQUE);} +{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy392,0,0,0,0);} break; case 38: /* ccons ::= CHECK LP expr RP */ -{sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy190.pExpr);} +{sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy342.pExpr);} break; case 39: /* ccons ::= REFERENCES nm eidlist_opt refargs */ -{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy148,yymsp[0].minor.yy194);} +{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy442,yymsp[0].minor.yy392);} break; case 40: /* ccons ::= defer_subclause */ -{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy194);} +{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy392);} break; case 41: /* ccons ::= COLLATE ID|STRING */ {sqlite3AddCollateType(pParse, &yymsp[0].minor.yy0);} break; case 44: /* refargs ::= */ -{ yymsp[1].minor.yy194 = OE_None*0x0101; /* EV: R-19803-45884 */} +{ yymsp[1].minor.yy392 = OE_None*0x0101; /* EV: R-19803-45884 */} break; case 45: /* refargs ::= refargs refarg */ -{ yymsp[-1].minor.yy194 = (yymsp[-1].minor.yy194 & ~yymsp[0].minor.yy497.mask) | yymsp[0].minor.yy497.value; } +{ yymsp[-1].minor.yy392 = (yymsp[-1].minor.yy392 & ~yymsp[0].minor.yy207.mask) | yymsp[0].minor.yy207.value; } break; case 46: /* refarg ::= MATCH nm */ -{ yymsp[-1].minor.yy497.value = 0; yymsp[-1].minor.yy497.mask = 0x000000; } +{ yymsp[-1].minor.yy207.value = 0; yymsp[-1].minor.yy207.mask = 0x000000; } break; case 47: /* refarg ::= ON INSERT refact */ -{ yymsp[-2].minor.yy497.value = 0; yymsp[-2].minor.yy497.mask = 0x000000; } +{ yymsp[-2].minor.yy207.value = 0; yymsp[-2].minor.yy207.mask = 0x000000; } break; case 48: /* refarg ::= ON DELETE refact */ -{ yymsp[-2].minor.yy497.value = yymsp[0].minor.yy194; yymsp[-2].minor.yy497.mask = 0x0000ff; } +{ yymsp[-2].minor.yy207.value = yymsp[0].minor.yy392; yymsp[-2].minor.yy207.mask = 0x0000ff; } break; case 49: /* refarg ::= ON UPDATE refact */ -{ yymsp[-2].minor.yy497.value = yymsp[0].minor.yy194<<8; yymsp[-2].minor.yy497.mask = 0x00ff00; } +{ yymsp[-2].minor.yy207.value = yymsp[0].minor.yy392<<8; yymsp[-2].minor.yy207.mask = 0x00ff00; } break; case 50: /* refact ::= SET NULL */ -{ yymsp[-1].minor.yy194 = OE_SetNull; /* EV: R-33326-45252 */} +{ yymsp[-1].minor.yy392 = OE_SetNull; /* EV: R-33326-45252 */} break; case 51: /* refact ::= SET DEFAULT */ -{ yymsp[-1].minor.yy194 = OE_SetDflt; /* EV: R-33326-45252 */} +{ yymsp[-1].minor.yy392 = OE_SetDflt; /* EV: R-33326-45252 */} break; case 52: /* refact ::= CASCADE */ -{ yymsp[0].minor.yy194 = OE_Cascade; /* EV: R-33326-45252 */} +{ yymsp[0].minor.yy392 = OE_Cascade; /* EV: R-33326-45252 */} break; case 53: /* refact ::= RESTRICT */ -{ yymsp[0].minor.yy194 = OE_Restrict; /* EV: R-33326-45252 */} +{ yymsp[0].minor.yy392 = OE_Restrict; /* EV: R-33326-45252 */} break; case 54: /* refact ::= NO ACTION */ -{ yymsp[-1].minor.yy194 = OE_None; /* EV: R-33326-45252 */} +{ yymsp[-1].minor.yy392 = OE_None; /* EV: R-33326-45252 */} break; case 55: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ -{yymsp[-2].minor.yy194 = 0;} +{yymsp[-2].minor.yy392 = 0;} break; case 56: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ case 71: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==71); case 142: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==142); -{yymsp[-1].minor.yy194 = yymsp[0].minor.yy194;} +{yymsp[-1].minor.yy392 = yymsp[0].minor.yy392;} break; case 58: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */ case 75: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==75); case 183: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==183); case 186: /* in_op ::= NOT IN */ yytestcase(yyruleno==186); - case 212: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==212); -{yymsp[-1].minor.yy194 = 1;} + case 210: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==210); +{yymsp[-1].minor.yy392 = 1;} break; case 59: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ -{yymsp[-1].minor.yy194 = 0;} +{yymsp[-1].minor.yy392 = 0;} break; case 61: /* tconscomma ::= COMMA */ {pParse->constraintName.n = 0;} break; case 63: /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */ -{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy148,yymsp[0].minor.yy194,yymsp[-2].minor.yy194,0);} +{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy442,yymsp[0].minor.yy392,yymsp[-2].minor.yy392,0);} break; case 64: /* tcons ::= UNIQUE LP sortlist RP onconf */ -{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy148,yymsp[0].minor.yy194,0,0,0,0, - SQLITE_IDXTYPE_UNIQUE);} +{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy442,yymsp[0].minor.yy392,0,0,0,0);} break; case 65: /* tcons ::= CHECK LP expr RP onconf */ -{sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy190.pExpr);} +{sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy342.pExpr);} break; case 66: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */ { - sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy148, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy148, yymsp[-1].minor.yy194); - sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy194); + sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy442, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy442, yymsp[-1].minor.yy392); + sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy392); } break; case 68: /* onconf ::= */ case 70: /* orconf ::= */ yytestcase(yyruleno==70); -{yymsp[1].minor.yy194 = OE_Default;} +{yymsp[1].minor.yy392 = OE_Default;} break; case 69: /* onconf ::= ON CONFLICT resolvetype */ -{yymsp[-2].minor.yy194 = yymsp[0].minor.yy194;} +{yymsp[-2].minor.yy392 = yymsp[0].minor.yy392;} break; case 72: /* resolvetype ::= IGNORE */ -{yymsp[0].minor.yy194 = OE_Ignore;} +{yymsp[0].minor.yy392 = OE_Ignore;} break; case 73: /* resolvetype ::= REPLACE */ case 143: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==143); -{yymsp[0].minor.yy194 = OE_Replace;} +{yymsp[0].minor.yy392 = OE_Replace;} break; case 74: /* cmd ::= DROP TABLE ifexists fullname */ { - sqlite3DropTable(pParse, yymsp[0].minor.yy185, 0, yymsp[-1].minor.yy194); + sqlite3DropTable(pParse, yymsp[0].minor.yy347, 0, yymsp[-1].minor.yy392); } break; case 77: /* 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.yy148, yymsp[0].minor.yy243, yymsp[-7].minor.yy194, yymsp[-5].minor.yy194); + sqlite3CreateView(pParse, &yymsp[-8].minor.yy0, &yymsp[-4].minor.yy0, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy442, yymsp[0].minor.yy159, yymsp[-7].minor.yy392, yymsp[-5].minor.yy392); } break; case 78: /* cmd ::= DROP VIEW ifexists fullname */ { - sqlite3DropTable(pParse, yymsp[0].minor.yy185, 1, yymsp[-1].minor.yy194); + sqlite3DropTable(pParse, yymsp[0].minor.yy347, 1, yymsp[-1].minor.yy392); } break; case 79: /* cmd ::= select */ { SelectDest dest = {SRT_Output, 0, 0, 0, 0, 0}; - sqlite3Select(pParse, yymsp[0].minor.yy243, &dest); - sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy243); + sqlite3Select(pParse, yymsp[0].minor.yy159, &dest); + sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy159); } break; case 80: /* select ::= with selectnowith */ { - Select *p = yymsp[0].minor.yy243; + Select *p = yymsp[0].minor.yy159; if( p ){ - p->pWith = yymsp[-1].minor.yy285; + p->pWith = yymsp[-1].minor.yy331; parserDoubleLinkSelect(pParse, p); }else{ - sqlite3WithDelete(pParse->db, yymsp[-1].minor.yy285); + sqlite3WithDelete(pParse->db, yymsp[-1].minor.yy331); } - yymsp[-1].minor.yy243 = p; /*A-overwrites-W*/ + yymsp[-1].minor.yy159 = p; /*A-overwrites-W*/ } break; case 81: /* selectnowith ::= selectnowith multiselect_op oneselect */ { - Select *pRhs = yymsp[0].minor.yy243; - Select *pLhs = yymsp[-2].minor.yy243; + Select *pRhs = yymsp[0].minor.yy159; + Select *pLhs = yymsp[-2].minor.yy159; if( pRhs && pRhs->pPrior ){ SrcList *pFrom; Token x; x.n = 0; parserDoubleLinkSelect(pParse, pRhs); pFrom = sqlite3SrcListAppendFromTerm(pParse,0,0,0,&x,pRhs,0,0); pRhs = sqlite3SelectNew(pParse,0,pFrom,0,0,0,0,0,0,0); } if( pRhs ){ - pRhs->op = (u8)yymsp[-1].minor.yy194; + pRhs->op = (u8)yymsp[-1].minor.yy392; pRhs->pPrior = pLhs; if( ALWAYS(pLhs) ) pLhs->selFlags &= ~SF_MultiValue; pRhs->selFlags &= ~SF_MultiValue; - if( yymsp[-1].minor.yy194!=TK_ALL ) pParse->hasCompound = 1; + if( yymsp[-1].minor.yy392!=TK_ALL ) pParse->hasCompound = 1; }else{ sqlite3SelectDelete(pParse->db, pLhs); } - yymsp[-2].minor.yy243 = pRhs; + yymsp[-2].minor.yy159 = pRhs; } break; case 82: /* multiselect_op ::= UNION */ case 84: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==84); -{yymsp[0].minor.yy194 = yymsp[0].major; /*A-overwrites-OP*/} +{yymsp[0].minor.yy392 = yymsp[0].major; /*A-overwrites-OP*/} break; case 83: /* multiselect_op ::= UNION ALL */ -{yymsp[-1].minor.yy194 = TK_ALL;} +{yymsp[-1].minor.yy392 = TK_ALL;} break; case 85: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ { #if SELECTTRACE_ENABLED Token s = yymsp[-8].minor.yy0; /*A-overwrites-S*/ #endif - yymsp[-8].minor.yy243 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy148,yymsp[-5].minor.yy185,yymsp[-4].minor.yy72,yymsp[-3].minor.yy148,yymsp[-2].minor.yy72,yymsp[-1].minor.yy148,yymsp[-7].minor.yy194,yymsp[0].minor.yy354.pLimit,yymsp[0].minor.yy354.pOffset); + yymsp[-8].minor.yy159 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy442,yymsp[-5].minor.yy347,yymsp[-4].minor.yy122,yymsp[-3].minor.yy442,yymsp[-2].minor.yy122,yymsp[-1].minor.yy442,yymsp[-7].minor.yy392,yymsp[0].minor.yy64.pLimit,yymsp[0].minor.yy64.pOffset); #if SELECTTRACE_ENABLED /* Populate the Select.zSelName[] string that is used to help with ** query planner debugging, to differentiate between multiple Select ** objects in a complex query. ** @@ -134065,465 +133233,464 @@ ** If the SELECT keyword is immediately followed by a C-style comment ** then extract the first few alphanumeric characters from within that ** comment to be the zSelName value. Otherwise, the label is #N where ** is an integer that is incremented with each SELECT statement seen. */ - if( yymsp[-8].minor.yy243!=0 ){ + if( yymsp[-8].minor.yy159!=0 ){ const char *z = s.z+6; int i; - sqlite3_snprintf(sizeof(yymsp[-8].minor.yy243->zSelName), yymsp[-8].minor.yy243->zSelName, "#%d", + sqlite3_snprintf(sizeof(yymsp[-8].minor.yy159->zSelName), yymsp[-8].minor.yy159->zSelName, "#%d", ++pParse->nSelect); while( z[0]==' ' ) z++; if( z[0]=='/' && z[1]=='*' ){ z += 2; while( z[0]==' ' ) z++; for(i=0; sqlite3Isalnum(z[i]); i++){} - sqlite3_snprintf(sizeof(yymsp[-8].minor.yy243->zSelName), yymsp[-8].minor.yy243->zSelName, "%.*s", i, z); + sqlite3_snprintf(sizeof(yymsp[-8].minor.yy159->zSelName), yymsp[-8].minor.yy159->zSelName, "%.*s", i, z); } } #endif /* SELECTRACE_ENABLED */ } break; case 86: /* values ::= VALUES LP nexprlist RP */ { - yymsp[-3].minor.yy243 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy148,0,0,0,0,0,SF_Values,0,0); + yymsp[-3].minor.yy159 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy442,0,0,0,0,0,SF_Values,0,0); } break; case 87: /* values ::= values COMMA LP exprlist RP */ { - Select *pRight, *pLeft = yymsp[-4].minor.yy243; - pRight = sqlite3SelectNew(pParse,yymsp[-1].minor.yy148,0,0,0,0,0,SF_Values|SF_MultiValue,0,0); + Select *pRight, *pLeft = yymsp[-4].minor.yy159; + pRight = sqlite3SelectNew(pParse,yymsp[-1].minor.yy442,0,0,0,0,0,SF_Values|SF_MultiValue,0,0); if( ALWAYS(pLeft) ) pLeft->selFlags &= ~SF_MultiValue; if( pRight ){ pRight->op = TK_ALL; pRight->pPrior = pLeft; - yymsp[-4].minor.yy243 = pRight; + yymsp[-4].minor.yy159 = pRight; }else{ - yymsp[-4].minor.yy243 = pLeft; + yymsp[-4].minor.yy159 = pLeft; } } break; case 88: /* distinct ::= DISTINCT */ -{yymsp[0].minor.yy194 = SF_Distinct;} +{yymsp[0].minor.yy392 = SF_Distinct;} break; case 89: /* distinct ::= ALL */ -{yymsp[0].minor.yy194 = SF_All;} +{yymsp[0].minor.yy392 = SF_All;} break; case 91: /* sclp ::= */ case 119: /* orderby_opt ::= */ yytestcase(yyruleno==119); case 126: /* groupby_opt ::= */ yytestcase(yyruleno==126); case 199: /* exprlist ::= */ yytestcase(yyruleno==199); - case 202: /* paren_exprlist ::= */ yytestcase(yyruleno==202); - case 207: /* eidlist_opt ::= */ yytestcase(yyruleno==207); -{yymsp[1].minor.yy148 = 0;} + case 205: /* eidlist_opt ::= */ yytestcase(yyruleno==205); +{yymsp[1].minor.yy442 = 0;} break; case 92: /* selcollist ::= sclp expr as */ { - yymsp[-2].minor.yy148 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy148, yymsp[-1].minor.yy190.pExpr); - if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-2].minor.yy148, &yymsp[0].minor.yy0, 1); - sqlite3ExprListSetSpan(pParse,yymsp[-2].minor.yy148,&yymsp[-1].minor.yy190); + yymsp[-2].minor.yy442 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy442, yymsp[-1].minor.yy342.pExpr); + if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-2].minor.yy442, &yymsp[0].minor.yy0, 1); + sqlite3ExprListSetSpan(pParse,yymsp[-2].minor.yy442,&yymsp[-1].minor.yy342); } break; case 93: /* selcollist ::= sclp STAR */ { Expr *p = sqlite3Expr(pParse->db, TK_ASTERISK, 0); - yymsp[-1].minor.yy148 = sqlite3ExprListAppend(pParse, yymsp[-1].minor.yy148, p); + yymsp[-1].minor.yy442 = sqlite3ExprListAppend(pParse, yymsp[-1].minor.yy442, p); } break; case 94: /* selcollist ::= sclp nm DOT STAR */ { Expr *pRight = sqlite3PExpr(pParse, TK_ASTERISK, 0, 0, &yymsp[0].minor.yy0); Expr *pLeft = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy0); Expr *pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight, 0); - yymsp[-3].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy148, pDot); + yymsp[-3].minor.yy442 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy442, pDot); } break; case 95: /* as ::= AS nm */ case 106: /* dbnm ::= DOT nm */ yytestcase(yyruleno==106); - case 221: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==221); - case 222: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==222); + case 219: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==219); + case 220: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==220); {yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;} break; case 97: /* from ::= */ -{yymsp[1].minor.yy185 = sqlite3DbMallocZero(pParse->db, sizeof(*yymsp[1].minor.yy185));} +{yymsp[1].minor.yy347 = sqlite3DbMallocZero(pParse->db, sizeof(*yymsp[1].minor.yy347));} break; case 98: /* from ::= FROM seltablist */ { - yymsp[-1].minor.yy185 = yymsp[0].minor.yy185; - sqlite3SrcListShiftJoinType(yymsp[-1].minor.yy185); + yymsp[-1].minor.yy347 = yymsp[0].minor.yy347; + sqlite3SrcListShiftJoinType(yymsp[-1].minor.yy347); } break; case 99: /* stl_prefix ::= seltablist joinop */ { - if( ALWAYS(yymsp[-1].minor.yy185 && yymsp[-1].minor.yy185->nSrc>0) ) yymsp[-1].minor.yy185->a[yymsp[-1].minor.yy185->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy194; + if( ALWAYS(yymsp[-1].minor.yy347 && yymsp[-1].minor.yy347->nSrc>0) ) yymsp[-1].minor.yy347->a[yymsp[-1].minor.yy347->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy392; } break; case 100: /* stl_prefix ::= */ -{yymsp[1].minor.yy185 = 0;} +{yymsp[1].minor.yy347 = 0;} break; case 101: /* seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */ { - yymsp[-6].minor.yy185 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy185,&yymsp[-5].minor.yy0,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,0,yymsp[-1].minor.yy72,yymsp[0].minor.yy254); - sqlite3SrcListIndexedBy(pParse, yymsp[-6].minor.yy185, &yymsp[-2].minor.yy0); + yymsp[-6].minor.yy347 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy347,&yymsp[-5].minor.yy0,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,0,yymsp[-1].minor.yy122,yymsp[0].minor.yy180); + sqlite3SrcListIndexedBy(pParse, yymsp[-6].minor.yy347, &yymsp[-2].minor.yy0); } break; case 102: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */ { - yymsp[-8].minor.yy185 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-8].minor.yy185,&yymsp[-7].minor.yy0,&yymsp[-6].minor.yy0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy72,yymsp[0].minor.yy254); - sqlite3SrcListFuncArgs(pParse, yymsp[-8].minor.yy185, yymsp[-4].minor.yy148); + yymsp[-8].minor.yy347 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-8].minor.yy347,&yymsp[-7].minor.yy0,&yymsp[-6].minor.yy0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy122,yymsp[0].minor.yy180); + sqlite3SrcListFuncArgs(pParse, yymsp[-8].minor.yy347, yymsp[-4].minor.yy442); } break; case 103: /* seltablist ::= stl_prefix LP select RP as on_opt using_opt */ { - yymsp[-6].minor.yy185 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy185,0,0,&yymsp[-2].minor.yy0,yymsp[-4].minor.yy243,yymsp[-1].minor.yy72,yymsp[0].minor.yy254); + yymsp[-6].minor.yy347 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy347,0,0,&yymsp[-2].minor.yy0,yymsp[-4].minor.yy159,yymsp[-1].minor.yy122,yymsp[0].minor.yy180); } break; case 104: /* seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */ { - if( yymsp[-6].minor.yy185==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy72==0 && yymsp[0].minor.yy254==0 ){ - yymsp[-6].minor.yy185 = yymsp[-4].minor.yy185; - }else if( yymsp[-4].minor.yy185->nSrc==1 ){ - yymsp[-6].minor.yy185 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy185,0,0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy72,yymsp[0].minor.yy254); - if( yymsp[-6].minor.yy185 ){ - struct SrcList_item *pNew = &yymsp[-6].minor.yy185->a[yymsp[-6].minor.yy185->nSrc-1]; - struct SrcList_item *pOld = yymsp[-4].minor.yy185->a; + if( yymsp[-6].minor.yy347==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy122==0 && yymsp[0].minor.yy180==0 ){ + yymsp[-6].minor.yy347 = yymsp[-4].minor.yy347; + }else if( yymsp[-4].minor.yy347->nSrc==1 ){ + yymsp[-6].minor.yy347 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy347,0,0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy122,yymsp[0].minor.yy180); + if( yymsp[-6].minor.yy347 ){ + struct SrcList_item *pNew = &yymsp[-6].minor.yy347->a[yymsp[-6].minor.yy347->nSrc-1]; + struct SrcList_item *pOld = yymsp[-4].minor.yy347->a; pNew->zName = pOld->zName; pNew->zDatabase = pOld->zDatabase; pNew->pSelect = pOld->pSelect; pOld->zName = pOld->zDatabase = 0; pOld->pSelect = 0; } - sqlite3SrcListDelete(pParse->db, yymsp[-4].minor.yy185); + sqlite3SrcListDelete(pParse->db, yymsp[-4].minor.yy347); }else{ Select *pSubquery; - sqlite3SrcListShiftJoinType(yymsp[-4].minor.yy185); - pSubquery = sqlite3SelectNew(pParse,0,yymsp[-4].minor.yy185,0,0,0,0,SF_NestedFrom,0,0); - yymsp[-6].minor.yy185 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy185,0,0,&yymsp[-2].minor.yy0,pSubquery,yymsp[-1].minor.yy72,yymsp[0].minor.yy254); + sqlite3SrcListShiftJoinType(yymsp[-4].minor.yy347); + pSubquery = sqlite3SelectNew(pParse,0,yymsp[-4].minor.yy347,0,0,0,0,SF_NestedFrom,0,0); + yymsp[-6].minor.yy347 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy347,0,0,&yymsp[-2].minor.yy0,pSubquery,yymsp[-1].minor.yy122,yymsp[0].minor.yy180); } } break; case 105: /* dbnm ::= */ case 114: /* indexed_opt ::= */ yytestcase(yyruleno==114); {yymsp[1].minor.yy0.z=0; yymsp[1].minor.yy0.n=0;} break; case 107: /* fullname ::= nm dbnm */ -{yymsp[-1].minor.yy185 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/} +{yymsp[-1].minor.yy347 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/} break; case 108: /* joinop ::= COMMA|JOIN */ -{ yymsp[0].minor.yy194 = JT_INNER; } +{ yymsp[0].minor.yy392 = JT_INNER; } break; case 109: /* joinop ::= JOIN_KW JOIN */ -{yymsp[-1].minor.yy194 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); /*X-overwrites-A*/} +{yymsp[-1].minor.yy392 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); /*X-overwrites-A*/} break; case 110: /* joinop ::= JOIN_KW nm JOIN */ -{yymsp[-2].minor.yy194 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/} +{yymsp[-2].minor.yy392 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/} break; case 111: /* joinop ::= JOIN_KW nm nm JOIN */ -{yymsp[-3].minor.yy194 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/} +{yymsp[-3].minor.yy392 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/} break; case 112: /* on_opt ::= ON expr */ case 129: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==129); case 136: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==136); case 195: /* case_else ::= ELSE expr */ yytestcase(yyruleno==195); -{yymsp[-1].minor.yy72 = yymsp[0].minor.yy190.pExpr;} +{yymsp[-1].minor.yy122 = yymsp[0].minor.yy342.pExpr;} break; case 113: /* on_opt ::= */ case 128: /* having_opt ::= */ yytestcase(yyruleno==128); case 135: /* where_opt ::= */ yytestcase(yyruleno==135); case 196: /* case_else ::= */ yytestcase(yyruleno==196); case 198: /* case_operand ::= */ yytestcase(yyruleno==198); -{yymsp[1].minor.yy72 = 0;} +{yymsp[1].minor.yy122 = 0;} break; case 115: /* indexed_opt ::= INDEXED BY nm */ {yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;} break; case 116: /* indexed_opt ::= NOT INDEXED */ {yymsp[-1].minor.yy0.z=0; yymsp[-1].minor.yy0.n=1;} break; case 117: /* using_opt ::= USING LP idlist RP */ -{yymsp[-3].minor.yy254 = yymsp[-1].minor.yy254;} +{yymsp[-3].minor.yy180 = yymsp[-1].minor.yy180;} break; case 118: /* using_opt ::= */ case 144: /* idlist_opt ::= */ yytestcase(yyruleno==144); -{yymsp[1].minor.yy254 = 0;} +{yymsp[1].minor.yy180 = 0;} break; case 120: /* orderby_opt ::= ORDER BY sortlist */ case 127: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==127); -{yymsp[-2].minor.yy148 = yymsp[0].minor.yy148;} +{yymsp[-2].minor.yy442 = yymsp[0].minor.yy442;} break; case 121: /* sortlist ::= sortlist COMMA expr sortorder */ { - yymsp[-3].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy148,yymsp[-1].minor.yy190.pExpr); - sqlite3ExprListSetSortOrder(yymsp[-3].minor.yy148,yymsp[0].minor.yy194); + yymsp[-3].minor.yy442 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy442,yymsp[-1].minor.yy342.pExpr); + sqlite3ExprListSetSortOrder(yymsp[-3].minor.yy442,yymsp[0].minor.yy392); } break; case 122: /* sortlist ::= expr sortorder */ { - yymsp[-1].minor.yy148 = sqlite3ExprListAppend(pParse,0,yymsp[-1].minor.yy190.pExpr); /*A-overwrites-Y*/ - sqlite3ExprListSetSortOrder(yymsp[-1].minor.yy148,yymsp[0].minor.yy194); + yymsp[-1].minor.yy442 = sqlite3ExprListAppend(pParse,0,yymsp[-1].minor.yy342.pExpr); /*A-overwrites-Y*/ + sqlite3ExprListSetSortOrder(yymsp[-1].minor.yy442,yymsp[0].minor.yy392); } break; case 123: /* sortorder ::= ASC */ -{yymsp[0].minor.yy194 = SQLITE_SO_ASC;} +{yymsp[0].minor.yy392 = SQLITE_SO_ASC;} break; case 124: /* sortorder ::= DESC */ -{yymsp[0].minor.yy194 = SQLITE_SO_DESC;} +{yymsp[0].minor.yy392 = SQLITE_SO_DESC;} break; case 125: /* sortorder ::= */ -{yymsp[1].minor.yy194 = SQLITE_SO_UNDEFINED;} +{yymsp[1].minor.yy392 = SQLITE_SO_UNDEFINED;} break; case 130: /* limit_opt ::= */ -{yymsp[1].minor.yy354.pLimit = 0; yymsp[1].minor.yy354.pOffset = 0;} +{yymsp[1].minor.yy64.pLimit = 0; yymsp[1].minor.yy64.pOffset = 0;} break; case 131: /* limit_opt ::= LIMIT expr */ -{yymsp[-1].minor.yy354.pLimit = yymsp[0].minor.yy190.pExpr; yymsp[-1].minor.yy354.pOffset = 0;} +{yymsp[-1].minor.yy64.pLimit = yymsp[0].minor.yy342.pExpr; yymsp[-1].minor.yy64.pOffset = 0;} break; case 132: /* limit_opt ::= LIMIT expr OFFSET expr */ -{yymsp[-3].minor.yy354.pLimit = yymsp[-2].minor.yy190.pExpr; yymsp[-3].minor.yy354.pOffset = yymsp[0].minor.yy190.pExpr;} +{yymsp[-3].minor.yy64.pLimit = yymsp[-2].minor.yy342.pExpr; yymsp[-3].minor.yy64.pOffset = yymsp[0].minor.yy342.pExpr;} break; case 133: /* limit_opt ::= LIMIT expr COMMA expr */ -{yymsp[-3].minor.yy354.pOffset = yymsp[-2].minor.yy190.pExpr; yymsp[-3].minor.yy354.pLimit = yymsp[0].minor.yy190.pExpr;} +{yymsp[-3].minor.yy64.pOffset = yymsp[-2].minor.yy342.pExpr; yymsp[-3].minor.yy64.pLimit = yymsp[0].minor.yy342.pExpr;} break; case 134: /* cmd ::= with DELETE FROM fullname indexed_opt where_opt */ { - sqlite3WithPush(pParse, yymsp[-5].minor.yy285, 1); - sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy185, &yymsp[-1].minor.yy0); - sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy185,yymsp[0].minor.yy72); + sqlite3WithPush(pParse, yymsp[-5].minor.yy331, 1); + sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy347, &yymsp[-1].minor.yy0); + sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy347,yymsp[0].minor.yy122); } break; case 137: /* cmd ::= with UPDATE orconf fullname indexed_opt SET setlist where_opt */ { - sqlite3WithPush(pParse, yymsp[-7].minor.yy285, 1); - sqlite3SrcListIndexedBy(pParse, yymsp[-4].minor.yy185, &yymsp[-3].minor.yy0); - sqlite3ExprListCheckLength(pParse,yymsp[-1].minor.yy148,"set list"); - sqlite3Update(pParse,yymsp[-4].minor.yy185,yymsp[-1].minor.yy148,yymsp[0].minor.yy72,yymsp[-5].minor.yy194); + sqlite3WithPush(pParse, yymsp[-7].minor.yy331, 1); + sqlite3SrcListIndexedBy(pParse, yymsp[-4].minor.yy347, &yymsp[-3].minor.yy0); + sqlite3ExprListCheckLength(pParse,yymsp[-1].minor.yy442,"set list"); + sqlite3Update(pParse,yymsp[-4].minor.yy347,yymsp[-1].minor.yy442,yymsp[0].minor.yy122,yymsp[-5].minor.yy392); } break; case 138: /* setlist ::= setlist COMMA nm EQ expr */ { - yymsp[-4].minor.yy148 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy148, yymsp[0].minor.yy190.pExpr); - sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy148, &yymsp[-2].minor.yy0, 1); + yymsp[-4].minor.yy442 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy442, yymsp[0].minor.yy342.pExpr); + sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy442, &yymsp[-2].minor.yy0, 1); } break; case 139: /* setlist ::= nm EQ expr */ { - yylhsminor.yy148 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy190.pExpr); - sqlite3ExprListSetName(pParse, yylhsminor.yy148, &yymsp[-2].minor.yy0, 1); + yylhsminor.yy442 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy342.pExpr); + sqlite3ExprListSetName(pParse, yylhsminor.yy442, &yymsp[-2].minor.yy0, 1); } - yymsp[-2].minor.yy148 = yylhsminor.yy148; + yymsp[-2].minor.yy442 = yylhsminor.yy442; break; case 140: /* cmd ::= with insert_cmd INTO fullname idlist_opt select */ { - sqlite3WithPush(pParse, yymsp[-5].minor.yy285, 1); - sqlite3Insert(pParse, yymsp[-2].minor.yy185, yymsp[0].minor.yy243, yymsp[-1].minor.yy254, yymsp[-4].minor.yy194); + sqlite3WithPush(pParse, yymsp[-5].minor.yy331, 1); + sqlite3Insert(pParse, yymsp[-2].minor.yy347, yymsp[0].minor.yy159, yymsp[-1].minor.yy180, yymsp[-4].minor.yy392); } break; case 141: /* cmd ::= with insert_cmd INTO fullname idlist_opt DEFAULT VALUES */ { - sqlite3WithPush(pParse, yymsp[-6].minor.yy285, 1); - sqlite3Insert(pParse, yymsp[-3].minor.yy185, 0, yymsp[-2].minor.yy254, yymsp[-5].minor.yy194); + sqlite3WithPush(pParse, yymsp[-6].minor.yy331, 1); + sqlite3Insert(pParse, yymsp[-3].minor.yy347, 0, yymsp[-2].minor.yy180, yymsp[-5].minor.yy392); } break; case 145: /* idlist_opt ::= LP idlist RP */ -{yymsp[-2].minor.yy254 = yymsp[-1].minor.yy254;} +{yymsp[-2].minor.yy180 = yymsp[-1].minor.yy180;} break; case 146: /* idlist ::= idlist COMMA nm */ -{yymsp[-2].minor.yy254 = sqlite3IdListAppend(pParse->db,yymsp[-2].minor.yy254,&yymsp[0].minor.yy0);} +{yymsp[-2].minor.yy180 = sqlite3IdListAppend(pParse->db,yymsp[-2].minor.yy180,&yymsp[0].minor.yy0);} break; case 147: /* idlist ::= nm */ -{yymsp[0].minor.yy254 = sqlite3IdListAppend(pParse->db,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/} +{yymsp[0].minor.yy180 = sqlite3IdListAppend(pParse->db,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/} break; case 148: /* expr ::= LP expr RP */ -{spanSet(&yymsp[-2].minor.yy190,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-B*/ yymsp[-2].minor.yy190.pExpr = yymsp[-1].minor.yy190.pExpr;} +{spanSet(&yymsp[-2].minor.yy342,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-B*/ yymsp[-2].minor.yy342.pExpr = yymsp[-1].minor.yy342.pExpr;} break; case 149: /* term ::= NULL */ case 154: /* term ::= INTEGER|FLOAT|BLOB */ yytestcase(yyruleno==154); case 155: /* term ::= STRING */ yytestcase(yyruleno==155); -{spanExpr(&yymsp[0].minor.yy190,pParse,yymsp[0].major,yymsp[0].minor.yy0);/*A-overwrites-X*/} +{spanExpr(&yymsp[0].minor.yy342,pParse,yymsp[0].major,yymsp[0].minor.yy0);/*A-overwrites-X*/} break; case 150: /* expr ::= ID|INDEXED */ case 151: /* expr ::= JOIN_KW */ yytestcase(yyruleno==151); -{spanExpr(&yymsp[0].minor.yy190,pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/} +{spanExpr(&yymsp[0].minor.yy342,pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/} break; case 152: /* expr ::= nm DOT nm */ { Expr *temp1 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy0); Expr *temp2 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[0].minor.yy0); - spanSet(&yymsp[-2].minor.yy190,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/ - yymsp[-2].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_DOT, temp1, temp2, 0); + spanSet(&yymsp[-2].minor.yy342,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/ + yymsp[-2].minor.yy342.pExpr = sqlite3PExpr(pParse, TK_DOT, temp1, temp2, 0); } break; case 153: /* expr ::= nm DOT nm DOT nm */ { Expr *temp1 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-4].minor.yy0); Expr *temp2 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy0); Expr *temp3 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[0].minor.yy0); Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3, 0); - spanSet(&yymsp[-4].minor.yy190,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/ - yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_DOT, temp1, temp4, 0); + spanSet(&yymsp[-4].minor.yy342,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/ + yymsp[-4].minor.yy342.pExpr = sqlite3PExpr(pParse, TK_DOT, temp1, temp4, 0); } break; case 156: /* expr ::= VARIABLE */ { if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){ - spanExpr(&yymsp[0].minor.yy190, pParse, TK_VARIABLE, yymsp[0].minor.yy0); - sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy190.pExpr); + spanExpr(&yymsp[0].minor.yy342, pParse, TK_VARIABLE, yymsp[0].minor.yy0); + sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy342.pExpr); }else{ /* When doing a nested parse, one can include terms in an expression ** that look like this: #1 #2 ... These terms refer to registers ** in the virtual machine. #N is the N-th register. */ Token t = yymsp[0].minor.yy0; /*A-overwrites-X*/ assert( t.n>=2 ); - spanSet(&yymsp[0].minor.yy190, &t, &t); + spanSet(&yymsp[0].minor.yy342, &t, &t); if( pParse->nested==0 ){ sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &t); - yymsp[0].minor.yy190.pExpr = 0; + yymsp[0].minor.yy342.pExpr = 0; }else{ - yymsp[0].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_REGISTER, 0, 0, &t); - if( yymsp[0].minor.yy190.pExpr ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy190.pExpr->iTable); + yymsp[0].minor.yy342.pExpr = sqlite3PExpr(pParse, TK_REGISTER, 0, 0, &t); + if( yymsp[0].minor.yy342.pExpr ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy342.pExpr->iTable); } } } break; case 157: /* expr ::= expr COLLATE ID|STRING */ { - yymsp[-2].minor.yy190.pExpr = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy190.pExpr, &yymsp[0].minor.yy0, 1); - yymsp[-2].minor.yy190.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n]; + yymsp[-2].minor.yy342.pExpr = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy342.pExpr, &yymsp[0].minor.yy0, 1); + yymsp[-2].minor.yy342.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n]; } break; case 158: /* expr ::= CAST LP expr AS typetoken RP */ { - spanSet(&yymsp[-5].minor.yy190,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/ - yymsp[-5].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_CAST, yymsp[-3].minor.yy190.pExpr, 0, &yymsp[-1].minor.yy0); + spanSet(&yymsp[-5].minor.yy342,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/ + yymsp[-5].minor.yy342.pExpr = sqlite3PExpr(pParse, TK_CAST, yymsp[-3].minor.yy342.pExpr, 0, &yymsp[-1].minor.yy0); } break; case 159: /* expr ::= ID|INDEXED LP distinct exprlist RP */ { - if( yymsp[-1].minor.yy148 && yymsp[-1].minor.yy148->nExpr>pParse->db->aLimit[SQLITE_LIMIT_FUNCTION_ARG] ){ + if( yymsp[-1].minor.yy442 && yymsp[-1].minor.yy442->nExpr>pParse->db->aLimit[SQLITE_LIMIT_FUNCTION_ARG] ){ sqlite3ErrorMsg(pParse, "too many arguments on function %T", &yymsp[-4].minor.yy0); } - yylhsminor.yy190.pExpr = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy148, &yymsp[-4].minor.yy0); - spanSet(&yylhsminor.yy190,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0); - if( yymsp[-2].minor.yy194==SF_Distinct && yylhsminor.yy190.pExpr ){ - yylhsminor.yy190.pExpr->flags |= EP_Distinct; + yylhsminor.yy342.pExpr = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy442, &yymsp[-4].minor.yy0); + spanSet(&yylhsminor.yy342,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0); + if( yymsp[-2].minor.yy392==SF_Distinct && yylhsminor.yy342.pExpr ){ + yylhsminor.yy342.pExpr->flags |= EP_Distinct; } } - yymsp[-4].minor.yy190 = yylhsminor.yy190; + yymsp[-4].minor.yy342 = yylhsminor.yy342; break; case 160: /* expr ::= ID|INDEXED LP STAR RP */ { - yylhsminor.yy190.pExpr = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0); - spanSet(&yylhsminor.yy190,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0); + yylhsminor.yy342.pExpr = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0); + spanSet(&yylhsminor.yy342,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0); } - yymsp[-3].minor.yy190 = yylhsminor.yy190; + yymsp[-3].minor.yy342 = yylhsminor.yy342; break; case 161: /* term ::= CTIME_KW */ { - yylhsminor.yy190.pExpr = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0); - spanSet(&yylhsminor.yy190, &yymsp[0].minor.yy0, &yymsp[0].minor.yy0); + yylhsminor.yy342.pExpr = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0); + spanSet(&yylhsminor.yy342, &yymsp[0].minor.yy0, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy190 = yylhsminor.yy190; + yymsp[0].minor.yy342 = yylhsminor.yy342; break; case 162: /* expr ::= expr AND expr */ case 163: /* expr ::= expr OR expr */ yytestcase(yyruleno==163); case 164: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==164); case 165: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==165); case 166: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==166); case 167: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==167); case 168: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==168); case 169: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==169); -{spanBinaryExpr(pParse,yymsp[-1].major,&yymsp[-2].minor.yy190,&yymsp[0].minor.yy190);} +{spanBinaryExpr(pParse,yymsp[-1].major,&yymsp[-2].minor.yy342,&yymsp[0].minor.yy342);} break; case 170: /* likeop ::= LIKE_KW|MATCH */ -{yymsp[0].minor.yy392.eOperator = yymsp[0].minor.yy0; yymsp[0].minor.yy392.bNot = 0;/*A-overwrites-X*/} +{yymsp[0].minor.yy318.eOperator = yymsp[0].minor.yy0; yymsp[0].minor.yy318.bNot = 0;/*A-overwrites-X*/} break; case 171: /* likeop ::= NOT LIKE_KW|MATCH */ -{yymsp[-1].minor.yy392.eOperator = yymsp[0].minor.yy0; yymsp[-1].minor.yy392.bNot = 1;} +{yymsp[-1].minor.yy318.eOperator = yymsp[0].minor.yy0; yymsp[-1].minor.yy318.bNot = 1;} break; case 172: /* expr ::= expr likeop expr */ { ExprList *pList; - pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy190.pExpr); - pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy190.pExpr); - yymsp[-2].minor.yy190.pExpr = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy392.eOperator); - exprNot(pParse, yymsp[-1].minor.yy392.bNot, &yymsp[-2].minor.yy190); - yymsp[-2].minor.yy190.zEnd = yymsp[0].minor.yy190.zEnd; - if( yymsp[-2].minor.yy190.pExpr ) yymsp[-2].minor.yy190.pExpr->flags |= EP_InfixFunc; + pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy342.pExpr); + pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy342.pExpr); + yymsp[-2].minor.yy342.pExpr = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy318.eOperator); + exprNot(pParse, yymsp[-1].minor.yy318.bNot, &yymsp[-2].minor.yy342); + yymsp[-2].minor.yy342.zEnd = yymsp[0].minor.yy342.zEnd; + if( yymsp[-2].minor.yy342.pExpr ) yymsp[-2].minor.yy342.pExpr->flags |= EP_InfixFunc; } break; case 173: /* expr ::= expr likeop expr ESCAPE expr */ { ExprList *pList; - pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy190.pExpr); - pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy190.pExpr); - pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy190.pExpr); - yymsp[-4].minor.yy190.pExpr = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy392.eOperator); - exprNot(pParse, yymsp[-3].minor.yy392.bNot, &yymsp[-4].minor.yy190); - yymsp[-4].minor.yy190.zEnd = yymsp[0].minor.yy190.zEnd; - if( yymsp[-4].minor.yy190.pExpr ) yymsp[-4].minor.yy190.pExpr->flags |= EP_InfixFunc; + pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy342.pExpr); + pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy342.pExpr); + pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy342.pExpr); + yymsp[-4].minor.yy342.pExpr = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy318.eOperator); + exprNot(pParse, yymsp[-3].minor.yy318.bNot, &yymsp[-4].minor.yy342); + yymsp[-4].minor.yy342.zEnd = yymsp[0].minor.yy342.zEnd; + if( yymsp[-4].minor.yy342.pExpr ) yymsp[-4].minor.yy342.pExpr->flags |= EP_InfixFunc; } break; case 174: /* expr ::= expr ISNULL|NOTNULL */ -{spanUnaryPostfix(pParse,yymsp[0].major,&yymsp[-1].minor.yy190,&yymsp[0].minor.yy0);} +{spanUnaryPostfix(pParse,yymsp[0].major,&yymsp[-1].minor.yy342,&yymsp[0].minor.yy0);} break; case 175: /* expr ::= expr NOT NULL */ -{spanUnaryPostfix(pParse,TK_NOTNULL,&yymsp[-2].minor.yy190,&yymsp[0].minor.yy0);} +{spanUnaryPostfix(pParse,TK_NOTNULL,&yymsp[-2].minor.yy342,&yymsp[0].minor.yy0);} break; case 176: /* expr ::= expr IS expr */ { - spanBinaryExpr(pParse,TK_IS,&yymsp[-2].minor.yy190,&yymsp[0].minor.yy190); - binaryToUnaryIfNull(pParse, yymsp[0].minor.yy190.pExpr, yymsp[-2].minor.yy190.pExpr, TK_ISNULL); + spanBinaryExpr(pParse,TK_IS,&yymsp[-2].minor.yy342,&yymsp[0].minor.yy342); + binaryToUnaryIfNull(pParse, yymsp[0].minor.yy342.pExpr, yymsp[-2].minor.yy342.pExpr, TK_ISNULL); } break; case 177: /* expr ::= expr IS NOT expr */ { - spanBinaryExpr(pParse,TK_ISNOT,&yymsp[-3].minor.yy190,&yymsp[0].minor.yy190); - binaryToUnaryIfNull(pParse, yymsp[0].minor.yy190.pExpr, yymsp[-3].minor.yy190.pExpr, TK_NOTNULL); + spanBinaryExpr(pParse,TK_ISNOT,&yymsp[-3].minor.yy342,&yymsp[0].minor.yy342); + binaryToUnaryIfNull(pParse, yymsp[0].minor.yy342.pExpr, yymsp[-3].minor.yy342.pExpr, TK_NOTNULL); } break; case 178: /* expr ::= NOT expr */ case 179: /* expr ::= BITNOT expr */ yytestcase(yyruleno==179); -{spanUnaryPrefix(&yymsp[-1].minor.yy190,pParse,yymsp[-1].major,&yymsp[0].minor.yy190,&yymsp[-1].minor.yy0);/*A-overwrites-B*/} +{spanUnaryPrefix(&yymsp[-1].minor.yy342,pParse,yymsp[-1].major,&yymsp[0].minor.yy342,&yymsp[-1].minor.yy0);/*A-overwrites-B*/} break; case 180: /* expr ::= MINUS expr */ -{spanUnaryPrefix(&yymsp[-1].minor.yy190,pParse,TK_UMINUS,&yymsp[0].minor.yy190,&yymsp[-1].minor.yy0);/*A-overwrites-B*/} +{spanUnaryPrefix(&yymsp[-1].minor.yy342,pParse,TK_UMINUS,&yymsp[0].minor.yy342,&yymsp[-1].minor.yy0);/*A-overwrites-B*/} break; case 181: /* expr ::= PLUS expr */ -{spanUnaryPrefix(&yymsp[-1].minor.yy190,pParse,TK_UPLUS,&yymsp[0].minor.yy190,&yymsp[-1].minor.yy0);/*A-overwrites-B*/} +{spanUnaryPrefix(&yymsp[-1].minor.yy342,pParse,TK_UPLUS,&yymsp[0].minor.yy342,&yymsp[-1].minor.yy0);/*A-overwrites-B*/} break; case 182: /* between_op ::= BETWEEN */ case 185: /* in_op ::= IN */ yytestcase(yyruleno==185); -{yymsp[0].minor.yy194 = 0;} +{yymsp[0].minor.yy392 = 0;} break; case 184: /* expr ::= expr between_op expr AND expr */ { - ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy190.pExpr); - pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy190.pExpr); - yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy190.pExpr, 0, 0); - if( yymsp[-4].minor.yy190.pExpr ){ - yymsp[-4].minor.yy190.pExpr->x.pList = pList; + ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy342.pExpr); + pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy342.pExpr); + yymsp[-4].minor.yy342.pExpr = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy342.pExpr, 0, 0); + if( yymsp[-4].minor.yy342.pExpr ){ + yymsp[-4].minor.yy342.pExpr->x.pList = pList; }else{ sqlite3ExprListDelete(pParse->db, pList); } - exprNot(pParse, yymsp[-3].minor.yy194, &yymsp[-4].minor.yy190); - yymsp[-4].minor.yy190.zEnd = yymsp[0].minor.yy190.zEnd; + exprNot(pParse, yymsp[-3].minor.yy392, &yymsp[-4].minor.yy342); + yymsp[-4].minor.yy342.zEnd = yymsp[0].minor.yy342.zEnd; } break; case 187: /* expr ::= expr in_op LP exprlist RP */ { - if( yymsp[-1].minor.yy148==0 ){ + if( yymsp[-1].minor.yy442==0 ){ /* Expressions of the form ** ** expr1 IN () ** expr1 NOT IN () ** ** simplify to constants 0 (false) and 1 (true), respectively, ** regardless of the value of expr1. */ - sqlite3ExprDelete(pParse->db, yymsp[-4].minor.yy190.pExpr); - yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_INTEGER, 0, 0, &sqlite3IntTokens[yymsp[-3].minor.yy194]); - }else if( yymsp[-1].minor.yy148->nExpr==1 ){ + sqlite3ExprDelete(pParse->db, yymsp[-4].minor.yy342.pExpr); + yymsp[-4].minor.yy342.pExpr = sqlite3PExpr(pParse, TK_INTEGER, 0, 0, &sqlite3IntTokens[yymsp[-3].minor.yy392]); + }else if( yymsp[-1].minor.yy442->nExpr==1 ){ /* Expressions of the form: ** ** expr1 IN (?1) ** expr1 NOT IN (?2) ** @@ -134536,421 +133703,417 @@ ** But, the RHS of the == or <> is marked with the EP_Generic flag ** so that it may not contribute to the computation of comparison ** affinity or the collating sequence to use for comparison. Otherwise, ** the semantics would be subtly different from IN or NOT IN. */ - Expr *pRHS = yymsp[-1].minor.yy148->a[0].pExpr; - yymsp[-1].minor.yy148->a[0].pExpr = 0; - sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy148); + Expr *pRHS = yymsp[-1].minor.yy442->a[0].pExpr; + yymsp[-1].minor.yy442->a[0].pExpr = 0; + sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy442); /* pRHS cannot be NULL because a malloc error would have been detected ** before now and control would have never reached this point */ if( ALWAYS(pRHS) ){ pRHS->flags &= ~EP_Collate; pRHS->flags |= EP_Generic; } - yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, yymsp[-3].minor.yy194 ? TK_NE : TK_EQ, yymsp[-4].minor.yy190.pExpr, pRHS, 0); - }else{ - yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy190.pExpr, 0, 0); - if( yymsp[-4].minor.yy190.pExpr ){ - yymsp[-4].minor.yy190.pExpr->x.pList = yymsp[-1].minor.yy148; - sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy190.pExpr); - }else{ - sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy148); - } - exprNot(pParse, yymsp[-3].minor.yy194, &yymsp[-4].minor.yy190); - } - yymsp[-4].minor.yy190.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n]; + yymsp[-4].minor.yy342.pExpr = sqlite3PExpr(pParse, yymsp[-3].minor.yy392 ? TK_NE : TK_EQ, yymsp[-4].minor.yy342.pExpr, pRHS, 0); + }else{ + yymsp[-4].minor.yy342.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy342.pExpr, 0, 0); + if( yymsp[-4].minor.yy342.pExpr ){ + yymsp[-4].minor.yy342.pExpr->x.pList = yymsp[-1].minor.yy442; + sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy342.pExpr); + }else{ + sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy442); + } + exprNot(pParse, yymsp[-3].minor.yy392, &yymsp[-4].minor.yy342); + } + yymsp[-4].minor.yy342.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n]; } break; case 188: /* expr ::= LP select RP */ { - spanSet(&yymsp[-2].minor.yy190,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-B*/ - yymsp[-2].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_SELECT, 0, 0, 0); - sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy190.pExpr, yymsp[-1].minor.yy243); + spanSet(&yymsp[-2].minor.yy342,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-B*/ + yymsp[-2].minor.yy342.pExpr = sqlite3PExpr(pParse, TK_SELECT, 0, 0, 0); + sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy342.pExpr, yymsp[-1].minor.yy159); } break; case 189: /* expr ::= expr in_op LP select RP */ { - yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy190.pExpr, 0, 0); - sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy190.pExpr, yymsp[-1].minor.yy243); - exprNot(pParse, yymsp[-3].minor.yy194, &yymsp[-4].minor.yy190); - yymsp[-4].minor.yy190.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n]; - } - break; - case 190: /* expr ::= expr in_op nm dbnm paren_exprlist */ -{ - SrcList *pSrc = sqlite3SrcListAppend(pParse->db, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0); + yymsp[-4].minor.yy342.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy342.pExpr, 0, 0); + sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy342.pExpr, yymsp[-1].minor.yy159); + exprNot(pParse, yymsp[-3].minor.yy392, &yymsp[-4].minor.yy342); + yymsp[-4].minor.yy342.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n]; + } + break; + case 190: /* expr ::= expr in_op nm dbnm */ +{ + SrcList *pSrc = sqlite3SrcListAppend(pParse->db, 0,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0); Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0,0); - if( yymsp[0].minor.yy148 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy148); - yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy190.pExpr, 0, 0); - sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy190.pExpr, pSelect); - exprNot(pParse, yymsp[-3].minor.yy194, &yymsp[-4].minor.yy190); - yymsp[-4].minor.yy190.zEnd = yymsp[-1].minor.yy0.z ? &yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n] : &yymsp[-2].minor.yy0.z[yymsp[-2].minor.yy0.n]; + yymsp[-3].minor.yy342.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-3].minor.yy342.pExpr, 0, 0); + sqlite3PExprAddSelect(pParse, yymsp[-3].minor.yy342.pExpr, pSelect); + exprNot(pParse, yymsp[-2].minor.yy392, &yymsp[-3].minor.yy342); + yymsp[-3].minor.yy342.zEnd = yymsp[0].minor.yy0.z ? &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] : &yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]; } break; case 191: /* expr ::= EXISTS LP select RP */ { Expr *p; - spanSet(&yymsp[-3].minor.yy190,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-B*/ - p = yymsp[-3].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_EXISTS, 0, 0, 0); - sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy243); + spanSet(&yymsp[-3].minor.yy342,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-B*/ + p = yymsp[-3].minor.yy342.pExpr = sqlite3PExpr(pParse, TK_EXISTS, 0, 0, 0); + sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy159); } break; case 192: /* expr ::= CASE case_operand case_exprlist case_else END */ { - spanSet(&yymsp[-4].minor.yy190,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-C*/ - yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy72, 0, 0); - if( yymsp[-4].minor.yy190.pExpr ){ - yymsp[-4].minor.yy190.pExpr->x.pList = yymsp[-1].minor.yy72 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy148,yymsp[-1].minor.yy72) : yymsp[-2].minor.yy148; - sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy190.pExpr); + spanSet(&yymsp[-4].minor.yy342,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-C*/ + yymsp[-4].minor.yy342.pExpr = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy122, 0, 0); + if( yymsp[-4].minor.yy342.pExpr ){ + yymsp[-4].minor.yy342.pExpr->x.pList = yymsp[-1].minor.yy122 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy442,yymsp[-1].minor.yy122) : yymsp[-2].minor.yy442; + sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy342.pExpr); }else{ - sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy148); - sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy72); + sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy442); + sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy122); } } break; case 193: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */ { - yymsp[-4].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy148, yymsp[-2].minor.yy190.pExpr); - yymsp[-4].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy148, yymsp[0].minor.yy190.pExpr); + yymsp[-4].minor.yy442 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy442, yymsp[-2].minor.yy342.pExpr); + yymsp[-4].minor.yy442 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy442, yymsp[0].minor.yy342.pExpr); } break; case 194: /* case_exprlist ::= WHEN expr THEN expr */ { - yymsp[-3].minor.yy148 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy190.pExpr); - yymsp[-3].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy148, yymsp[0].minor.yy190.pExpr); + yymsp[-3].minor.yy442 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy342.pExpr); + yymsp[-3].minor.yy442 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy442, yymsp[0].minor.yy342.pExpr); } break; case 197: /* case_operand ::= expr */ -{yymsp[0].minor.yy72 = yymsp[0].minor.yy190.pExpr; /*A-overwrites-X*/} +{yymsp[0].minor.yy122 = yymsp[0].minor.yy342.pExpr; /*A-overwrites-X*/} break; case 200: /* nexprlist ::= nexprlist COMMA expr */ -{yymsp[-2].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy148,yymsp[0].minor.yy190.pExpr);} +{yymsp[-2].minor.yy442 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy442,yymsp[0].minor.yy342.pExpr);} break; case 201: /* nexprlist ::= expr */ -{yymsp[0].minor.yy148 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy190.pExpr); /*A-overwrites-Y*/} +{yymsp[0].minor.yy442 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy342.pExpr); /*A-overwrites-Y*/} break; - case 203: /* paren_exprlist ::= LP exprlist RP */ - case 208: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==208); -{yymsp[-2].minor.yy148 = yymsp[-1].minor.yy148;} - break; - case 204: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ + case 202: /* 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->db,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy148, yymsp[-10].minor.yy194, - &yymsp[-11].minor.yy0, yymsp[0].minor.yy72, SQLITE_SO_ASC, yymsp[-8].minor.yy194, SQLITE_IDXTYPE_APPDEF); -} - break; - case 205: /* uniqueflag ::= UNIQUE */ - case 246: /* raisetype ::= ABORT */ yytestcase(yyruleno==246); -{yymsp[0].minor.yy194 = OE_Abort;} - break; - case 206: /* uniqueflag ::= */ -{yymsp[1].minor.yy194 = OE_None;} - break; - case 209: /* eidlist ::= eidlist COMMA nm collate sortorder */ -{ - yymsp[-4].minor.yy148 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy148, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy194, yymsp[0].minor.yy194); -} - break; - case 210: /* eidlist ::= nm collate sortorder */ -{ - yymsp[-2].minor.yy148 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy194, yymsp[0].minor.yy194); /*A-overwrites-Y*/ -} - break; - case 213: /* cmd ::= DROP INDEX ifexists fullname */ -{sqlite3DropIndex(pParse, yymsp[0].minor.yy185, yymsp[-1].minor.yy194);} - break; - case 214: /* cmd ::= VACUUM */ - case 215: /* cmd ::= VACUUM nm */ yytestcase(yyruleno==215); + sqlite3SrcListAppend(pParse->db,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy442, yymsp[-10].minor.yy392, + &yymsp[-11].minor.yy0, yymsp[0].minor.yy122, SQLITE_SO_ASC, yymsp[-8].minor.yy392); +} + break; + case 203: /* uniqueflag ::= UNIQUE */ + case 244: /* raisetype ::= ABORT */ yytestcase(yyruleno==244); +{yymsp[0].minor.yy392 = OE_Abort;} + break; + case 204: /* uniqueflag ::= */ +{yymsp[1].minor.yy392 = OE_None;} + break; + case 206: /* eidlist_opt ::= LP eidlist RP */ +{yymsp[-2].minor.yy442 = yymsp[-1].minor.yy442;} + break; + case 207: /* eidlist ::= eidlist COMMA nm collate sortorder */ +{ + yymsp[-4].minor.yy442 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy442, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy392, yymsp[0].minor.yy392); +} + break; + case 208: /* eidlist ::= nm collate sortorder */ +{ + yymsp[-2].minor.yy442 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy392, yymsp[0].minor.yy392); /*A-overwrites-Y*/ +} + break; + case 211: /* cmd ::= DROP INDEX ifexists fullname */ +{sqlite3DropIndex(pParse, yymsp[0].minor.yy347, yymsp[-1].minor.yy392);} + break; + case 212: /* cmd ::= VACUUM */ + case 213: /* cmd ::= VACUUM nm */ yytestcase(yyruleno==213); {sqlite3Vacuum(pParse);} break; - case 216: /* cmd ::= PRAGMA nm dbnm */ + case 214: /* cmd ::= PRAGMA nm dbnm */ {sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);} break; - case 217: /* cmd ::= PRAGMA nm dbnm EQ nmnum */ + case 215: /* cmd ::= PRAGMA nm dbnm EQ nmnum */ {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);} break; - case 218: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */ + case 216: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */ {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);} break; - case 219: /* cmd ::= PRAGMA nm dbnm EQ minus_num */ + case 217: /* cmd ::= PRAGMA nm dbnm EQ minus_num */ {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);} break; - case 220: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */ + case 218: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */ {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);} break; - case 223: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ + case 221: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ { 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.yy145, &all); + sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy327, &all); } break; - case 224: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ + case 222: /* 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.yy194, yymsp[-4].minor.yy332.a, yymsp[-4].minor.yy332.b, yymsp[-2].minor.yy185, yymsp[0].minor.yy72, yymsp[-10].minor.yy194, yymsp[-8].minor.yy194); + sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy392, yymsp[-4].minor.yy410.a, yymsp[-4].minor.yy410.b, yymsp[-2].minor.yy347, yymsp[0].minor.yy122, yymsp[-10].minor.yy392, yymsp[-8].minor.yy392); yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/ } break; - case 225: /* trigger_time ::= BEFORE */ -{ yymsp[0].minor.yy194 = TK_BEFORE; } - break; - case 226: /* trigger_time ::= AFTER */ -{ yymsp[0].minor.yy194 = TK_AFTER; } - break; - case 227: /* trigger_time ::= INSTEAD OF */ -{ yymsp[-1].minor.yy194 = TK_INSTEAD;} - break; - case 228: /* trigger_time ::= */ -{ yymsp[1].minor.yy194 = TK_BEFORE; } - break; - case 229: /* trigger_event ::= DELETE|INSERT */ - case 230: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==230); -{yymsp[0].minor.yy332.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy332.b = 0;} - break; - case 231: /* trigger_event ::= UPDATE OF idlist */ -{yymsp[-2].minor.yy332.a = TK_UPDATE; yymsp[-2].minor.yy332.b = yymsp[0].minor.yy254;} - break; - case 232: /* when_clause ::= */ - case 251: /* key_opt ::= */ yytestcase(yyruleno==251); -{ yymsp[1].minor.yy72 = 0; } - break; - case 233: /* when_clause ::= WHEN expr */ - case 252: /* key_opt ::= KEY expr */ yytestcase(yyruleno==252); -{ yymsp[-1].minor.yy72 = yymsp[0].minor.yy190.pExpr; } - break; - case 234: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ -{ - assert( yymsp[-2].minor.yy145!=0 ); - yymsp[-2].minor.yy145->pLast->pNext = yymsp[-1].minor.yy145; - yymsp[-2].minor.yy145->pLast = yymsp[-1].minor.yy145; -} - break; - case 235: /* trigger_cmd_list ::= trigger_cmd SEMI */ -{ - assert( yymsp[-1].minor.yy145!=0 ); - yymsp[-1].minor.yy145->pLast = yymsp[-1].minor.yy145; -} - break; - case 236: /* trnm ::= nm DOT nm */ + case 223: /* trigger_time ::= BEFORE */ +{ yymsp[0].minor.yy392 = TK_BEFORE; } + break; + case 224: /* trigger_time ::= AFTER */ +{ yymsp[0].minor.yy392 = TK_AFTER; } + break; + case 225: /* trigger_time ::= INSTEAD OF */ +{ yymsp[-1].minor.yy392 = TK_INSTEAD;} + break; + case 226: /* trigger_time ::= */ +{ yymsp[1].minor.yy392 = TK_BEFORE; } + break; + case 227: /* trigger_event ::= DELETE|INSERT */ + case 228: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==228); +{yymsp[0].minor.yy410.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy410.b = 0;} + break; + case 229: /* trigger_event ::= UPDATE OF idlist */ +{yymsp[-2].minor.yy410.a = TK_UPDATE; yymsp[-2].minor.yy410.b = yymsp[0].minor.yy180;} + break; + case 230: /* when_clause ::= */ + case 249: /* key_opt ::= */ yytestcase(yyruleno==249); +{ yymsp[1].minor.yy122 = 0; } + break; + case 231: /* when_clause ::= WHEN expr */ + case 250: /* key_opt ::= KEY expr */ yytestcase(yyruleno==250); +{ yymsp[-1].minor.yy122 = yymsp[0].minor.yy342.pExpr; } + break; + case 232: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ +{ + assert( yymsp[-2].minor.yy327!=0 ); + yymsp[-2].minor.yy327->pLast->pNext = yymsp[-1].minor.yy327; + yymsp[-2].minor.yy327->pLast = yymsp[-1].minor.yy327; +} + break; + case 233: /* trigger_cmd_list ::= trigger_cmd SEMI */ +{ + assert( yymsp[-1].minor.yy327!=0 ); + yymsp[-1].minor.yy327->pLast = yymsp[-1].minor.yy327; +} + break; + case 234: /* trnm ::= nm DOT nm */ { yymsp[-2].minor.yy0 = yymsp[0].minor.yy0; sqlite3ErrorMsg(pParse, "qualified table names are not allowed on INSERT, UPDATE, and DELETE " "statements within triggers"); } break; - case 237: /* tridxby ::= INDEXED BY nm */ + case 235: /* tridxby ::= INDEXED BY nm */ { sqlite3ErrorMsg(pParse, "the INDEXED BY clause is not allowed on UPDATE or DELETE statements " "within triggers"); } break; - case 238: /* tridxby ::= NOT INDEXED */ + case 236: /* tridxby ::= NOT INDEXED */ { sqlite3ErrorMsg(pParse, "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements " "within triggers"); } break; - case 239: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt */ -{yymsp[-6].minor.yy145 = sqlite3TriggerUpdateStep(pParse->db, &yymsp[-4].minor.yy0, yymsp[-1].minor.yy148, yymsp[0].minor.yy72, yymsp[-5].minor.yy194);} - break; - case 240: /* trigger_cmd ::= insert_cmd INTO trnm idlist_opt select */ -{yymsp[-4].minor.yy145 = sqlite3TriggerInsertStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy254, yymsp[0].minor.yy243, yymsp[-4].minor.yy194);/*A-overwrites-R*/} - break; - case 241: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt */ -{yymsp[-4].minor.yy145 = sqlite3TriggerDeleteStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[0].minor.yy72);} - break; - case 242: /* trigger_cmd ::= select */ -{yymsp[0].minor.yy145 = sqlite3TriggerSelectStep(pParse->db, yymsp[0].minor.yy243); /*A-overwrites-X*/} - break; - case 243: /* expr ::= RAISE LP IGNORE RP */ -{ - spanSet(&yymsp[-3].minor.yy190,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/ - yymsp[-3].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_RAISE, 0, 0, 0); - if( yymsp[-3].minor.yy190.pExpr ){ - yymsp[-3].minor.yy190.pExpr->affinity = OE_Ignore; - } -} - break; - case 244: /* expr ::= RAISE LP raisetype COMMA nm RP */ -{ - spanSet(&yymsp[-5].minor.yy190,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/ - yymsp[-5].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_RAISE, 0, 0, &yymsp[-1].minor.yy0); - if( yymsp[-5].minor.yy190.pExpr ) { - yymsp[-5].minor.yy190.pExpr->affinity = (char)yymsp[-3].minor.yy194; - } -} - break; - case 245: /* raisetype ::= ROLLBACK */ -{yymsp[0].minor.yy194 = OE_Rollback;} - break; - case 247: /* raisetype ::= FAIL */ -{yymsp[0].minor.yy194 = OE_Fail;} - break; - case 248: /* cmd ::= DROP TRIGGER ifexists fullname */ -{ - sqlite3DropTrigger(pParse,yymsp[0].minor.yy185,yymsp[-1].minor.yy194); -} - break; - case 249: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ -{ - sqlite3Attach(pParse, yymsp[-3].minor.yy190.pExpr, yymsp[-1].minor.yy190.pExpr, yymsp[0].minor.yy72); -} - break; - case 250: /* cmd ::= DETACH database_kw_opt expr */ -{ - sqlite3Detach(pParse, yymsp[0].minor.yy190.pExpr); -} - break; - case 253: /* cmd ::= REINDEX */ + case 237: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt */ +{yymsp[-6].minor.yy327 = sqlite3TriggerUpdateStep(pParse->db, &yymsp[-4].minor.yy0, yymsp[-1].minor.yy442, yymsp[0].minor.yy122, yymsp[-5].minor.yy392);} + break; + case 238: /* trigger_cmd ::= insert_cmd INTO trnm idlist_opt select */ +{yymsp[-4].minor.yy327 = sqlite3TriggerInsertStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy180, yymsp[0].minor.yy159, yymsp[-4].minor.yy392);/*A-overwrites-R*/} + break; + case 239: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt */ +{yymsp[-4].minor.yy327 = sqlite3TriggerDeleteStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[0].minor.yy122);} + break; + case 240: /* trigger_cmd ::= select */ +{yymsp[0].minor.yy327 = sqlite3TriggerSelectStep(pParse->db, yymsp[0].minor.yy159); /*A-overwrites-X*/} + break; + case 241: /* expr ::= RAISE LP IGNORE RP */ +{ + spanSet(&yymsp[-3].minor.yy342,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/ + yymsp[-3].minor.yy342.pExpr = sqlite3PExpr(pParse, TK_RAISE, 0, 0, 0); + if( yymsp[-3].minor.yy342.pExpr ){ + yymsp[-3].minor.yy342.pExpr->affinity = OE_Ignore; + } +} + break; + case 242: /* expr ::= RAISE LP raisetype COMMA nm RP */ +{ + spanSet(&yymsp[-5].minor.yy342,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/ + yymsp[-5].minor.yy342.pExpr = sqlite3PExpr(pParse, TK_RAISE, 0, 0, &yymsp[-1].minor.yy0); + if( yymsp[-5].minor.yy342.pExpr ) { + yymsp[-5].minor.yy342.pExpr->affinity = (char)yymsp[-3].minor.yy392; + } +} + break; + case 243: /* raisetype ::= ROLLBACK */ +{yymsp[0].minor.yy392 = OE_Rollback;} + break; + case 245: /* raisetype ::= FAIL */ +{yymsp[0].minor.yy392 = OE_Fail;} + break; + case 246: /* cmd ::= DROP TRIGGER ifexists fullname */ +{ + sqlite3DropTrigger(pParse,yymsp[0].minor.yy347,yymsp[-1].minor.yy392); +} + break; + case 247: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ +{ + sqlite3Attach(pParse, yymsp[-3].minor.yy342.pExpr, yymsp[-1].minor.yy342.pExpr, yymsp[0].minor.yy122); +} + break; + case 248: /* cmd ::= DETACH database_kw_opt expr */ +{ + sqlite3Detach(pParse, yymsp[0].minor.yy342.pExpr); +} + break; + case 251: /* cmd ::= REINDEX */ {sqlite3Reindex(pParse, 0, 0);} break; - case 254: /* cmd ::= REINDEX nm dbnm */ + case 252: /* cmd ::= REINDEX nm dbnm */ {sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);} break; - case 255: /* cmd ::= ANALYZE */ + case 253: /* cmd ::= ANALYZE */ {sqlite3Analyze(pParse, 0, 0);} break; - case 256: /* cmd ::= ANALYZE nm dbnm */ + case 254: /* cmd ::= ANALYZE nm dbnm */ {sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);} break; - case 257: /* cmd ::= ALTER TABLE fullname RENAME TO nm */ + case 255: /* cmd ::= ALTER TABLE fullname RENAME TO nm */ { - sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy185,&yymsp[0].minor.yy0); + sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy347,&yymsp[0].minor.yy0); } break; - case 258: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ + case 256: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ { yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n; sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0); } break; - case 259: /* add_column_fullname ::= fullname */ + case 257: /* add_column_fullname ::= fullname */ { disableLookaside(pParse); - sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy185); + sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy347); } break; - case 260: /* cmd ::= create_vtab */ + case 258: /* cmd ::= create_vtab */ {sqlite3VtabFinishParse(pParse,0);} break; - case 261: /* cmd ::= create_vtab LP vtabarglist RP */ + case 259: /* cmd ::= create_vtab LP vtabarglist RP */ {sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);} break; - case 262: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ + case 260: /* 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.yy194); + sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy392); } break; - case 263: /* vtabarg ::= */ + case 261: /* vtabarg ::= */ {sqlite3VtabArgInit(pParse);} break; - case 264: /* vtabargtoken ::= ANY */ - case 265: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==265); - case 266: /* lp ::= LP */ yytestcase(yyruleno==266); + case 262: /* vtabargtoken ::= ANY */ + case 263: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==263); + case 264: /* lp ::= LP */ yytestcase(yyruleno==264); {sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);} break; - case 267: /* with ::= */ -{yymsp[1].minor.yy285 = 0;} - break; - case 268: /* with ::= WITH wqlist */ -{ yymsp[-1].minor.yy285 = yymsp[0].minor.yy285; } - break; - case 269: /* with ::= WITH RECURSIVE wqlist */ -{ yymsp[-2].minor.yy285 = yymsp[0].minor.yy285; } - break; - case 270: /* wqlist ::= nm eidlist_opt AS LP select RP */ -{ - yymsp[-5].minor.yy285 = sqlite3WithAdd(pParse, 0, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy148, yymsp[-1].minor.yy243); /*A-overwrites-X*/ -} - break; - case 271: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */ -{ - yymsp[-7].minor.yy285 = sqlite3WithAdd(pParse, yymsp[-7].minor.yy285, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy148, yymsp[-1].minor.yy243); + case 265: /* with ::= */ +{yymsp[1].minor.yy331 = 0;} + break; + case 266: /* with ::= WITH wqlist */ +{ yymsp[-1].minor.yy331 = yymsp[0].minor.yy331; } + break; + case 267: /* with ::= WITH RECURSIVE wqlist */ +{ yymsp[-2].minor.yy331 = yymsp[0].minor.yy331; } + break; + case 268: /* wqlist ::= nm eidlist_opt AS LP select RP */ +{ + yymsp[-5].minor.yy331 = sqlite3WithAdd(pParse, 0, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy442, yymsp[-1].minor.yy159); /*A-overwrites-X*/ +} + break; + case 269: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */ +{ + yymsp[-7].minor.yy331 = sqlite3WithAdd(pParse, yymsp[-7].minor.yy331, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy442, yymsp[-1].minor.yy159); } break; default: - /* (272) input ::= cmdlist */ yytestcase(yyruleno==272); - /* (273) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==273); - /* (274) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=274); - /* (275) ecmd ::= SEMI */ yytestcase(yyruleno==275); - /* (276) ecmd ::= explain cmdx SEMI */ yytestcase(yyruleno==276); - /* (277) explain ::= */ yytestcase(yyruleno==277); - /* (278) trans_opt ::= */ yytestcase(yyruleno==278); - /* (279) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==279); - /* (280) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==280); - /* (281) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==281); - /* (282) savepoint_opt ::= */ yytestcase(yyruleno==282); - /* (283) cmd ::= create_table create_table_args */ yytestcase(yyruleno==283); - /* (284) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==284); - /* (285) columnlist ::= columnname carglist */ yytestcase(yyruleno==285); - /* (286) nm ::= ID|INDEXED */ yytestcase(yyruleno==286); - /* (287) nm ::= STRING */ yytestcase(yyruleno==287); - /* (288) nm ::= JOIN_KW */ yytestcase(yyruleno==288); - /* (289) typetoken ::= typename */ yytestcase(yyruleno==289); - /* (290) typename ::= ID|STRING */ yytestcase(yyruleno==290); - /* (291) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=291); - /* (292) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=292); - /* (293) carglist ::= carglist ccons */ yytestcase(yyruleno==293); - /* (294) carglist ::= */ yytestcase(yyruleno==294); - /* (295) ccons ::= NULL onconf */ yytestcase(yyruleno==295); - /* (296) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==296); - /* (297) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==297); - /* (298) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=298); - /* (299) tconscomma ::= */ yytestcase(yyruleno==299); - /* (300) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=300); - /* (301) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=301); - /* (302) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=302); - /* (303) oneselect ::= values */ yytestcase(yyruleno==303); - /* (304) sclp ::= selcollist COMMA */ yytestcase(yyruleno==304); - /* (305) as ::= ID|STRING */ yytestcase(yyruleno==305); - /* (306) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=306); - /* (307) exprlist ::= nexprlist */ yytestcase(yyruleno==307); - /* (308) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=308); - /* (309) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=309); - /* (310) nmnum ::= ON */ yytestcase(yyruleno==310); - /* (311) nmnum ::= DELETE */ yytestcase(yyruleno==311); - /* (312) nmnum ::= DEFAULT */ yytestcase(yyruleno==312); - /* (313) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==313); - /* (314) foreach_clause ::= */ yytestcase(yyruleno==314); - /* (315) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==315); - /* (316) trnm ::= nm */ yytestcase(yyruleno==316); - /* (317) tridxby ::= */ yytestcase(yyruleno==317); - /* (318) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==318); - /* (319) database_kw_opt ::= */ yytestcase(yyruleno==319); - /* (320) kwcolumn_opt ::= */ yytestcase(yyruleno==320); - /* (321) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==321); - /* (322) vtabarglist ::= vtabarg */ yytestcase(yyruleno==322); - /* (323) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==323); - /* (324) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==324); - /* (325) anylist ::= */ yytestcase(yyruleno==325); - /* (326) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==326); - /* (327) anylist ::= anylist ANY */ yytestcase(yyruleno==327); + /* (270) input ::= cmdlist */ yytestcase(yyruleno==270); + /* (271) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==271); + /* (272) cmdlist ::= ecmd */ yytestcase(yyruleno==272); + /* (273) ecmd ::= SEMI */ yytestcase(yyruleno==273); + /* (274) ecmd ::= explain cmdx SEMI */ yytestcase(yyruleno==274); + /* (275) explain ::= */ yytestcase(yyruleno==275); + /* (276) trans_opt ::= */ yytestcase(yyruleno==276); + /* (277) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==277); + /* (278) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==278); + /* (279) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==279); + /* (280) savepoint_opt ::= */ yytestcase(yyruleno==280); + /* (281) cmd ::= create_table create_table_args */ yytestcase(yyruleno==281); + /* (282) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==282); + /* (283) columnlist ::= columnname carglist */ yytestcase(yyruleno==283); + /* (284) nm ::= ID|INDEXED */ yytestcase(yyruleno==284); + /* (285) nm ::= STRING */ yytestcase(yyruleno==285); + /* (286) nm ::= JOIN_KW */ yytestcase(yyruleno==286); + /* (287) typetoken ::= typename */ yytestcase(yyruleno==287); + /* (288) typename ::= ID|STRING */ yytestcase(yyruleno==288); + /* (289) signed ::= plus_num */ yytestcase(yyruleno==289); + /* (290) signed ::= minus_num */ yytestcase(yyruleno==290); + /* (291) carglist ::= carglist ccons */ yytestcase(yyruleno==291); + /* (292) carglist ::= */ yytestcase(yyruleno==292); + /* (293) ccons ::= NULL onconf */ yytestcase(yyruleno==293); + /* (294) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==294); + /* (295) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==295); + /* (296) conslist ::= tcons */ yytestcase(yyruleno==296); + /* (297) tconscomma ::= */ yytestcase(yyruleno==297); + /* (298) defer_subclause_opt ::= defer_subclause */ yytestcase(yyruleno==298); + /* (299) resolvetype ::= raisetype */ yytestcase(yyruleno==299); + /* (300) selectnowith ::= oneselect */ yytestcase(yyruleno==300); + /* (301) oneselect ::= values */ yytestcase(yyruleno==301); + /* (302) sclp ::= selcollist COMMA */ yytestcase(yyruleno==302); + /* (303) as ::= ID|STRING */ yytestcase(yyruleno==303); + /* (304) expr ::= term */ yytestcase(yyruleno==304); + /* (305) exprlist ::= nexprlist */ yytestcase(yyruleno==305); + /* (306) nmnum ::= plus_num */ yytestcase(yyruleno==306); + /* (307) nmnum ::= nm */ yytestcase(yyruleno==307); + /* (308) nmnum ::= ON */ yytestcase(yyruleno==308); + /* (309) nmnum ::= DELETE */ yytestcase(yyruleno==309); + /* (310) nmnum ::= DEFAULT */ yytestcase(yyruleno==310); + /* (311) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==311); + /* (312) foreach_clause ::= */ yytestcase(yyruleno==312); + /* (313) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==313); + /* (314) trnm ::= nm */ yytestcase(yyruleno==314); + /* (315) tridxby ::= */ yytestcase(yyruleno==315); + /* (316) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==316); + /* (317) database_kw_opt ::= */ yytestcase(yyruleno==317); + /* (318) kwcolumn_opt ::= */ yytestcase(yyruleno==318); + /* (319) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==319); + /* (320) vtabarglist ::= vtabarg */ yytestcase(yyruleno==320); + /* (321) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==321); + /* (322) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==322); + /* (323) anylist ::= */ yytestcase(yyruleno==323); + /* (324) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==324); + /* (325) anylist ::= anylist ANY */ yytestcase(yyruleno==325); break; /********** End reduce actions ************************************************/ }; assert( yyrulenoYY_MAX_SHIFT ){ - yyact += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE; - } + if( yyact>YY_MAX_SHIFT ) yyact += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE; + yypParser->yyidx -= yysize - 1; yymsp -= yysize-1; - yypParser->yytos = yymsp; yymsp->stateno = (YYACTIONTYPE)yyact; yymsp->major = (YYCODETYPE)yygoto; yyTraceShift(yypParser, yyact); }else{ assert( yyact == YY_ACCEPT_ACTION ); - yypParser->yytos -= yysize; + yypParser->yyidx -= yysize; yy_accept(yypParser); } } /* @@ -134964,11 +134127,11 @@ #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); } #endif - while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser); + while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); /* Here code is inserted which will be executed whenever the ** parser fails */ /************ Begin %parse_failure code ***************************************/ /************ End %parse_failure code *****************************************/ sqlite3ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */ @@ -135004,14 +134167,11 @@ #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); } #endif -#ifndef YYNOERRORRECOVERY - yypParser->yyerrcnt = -1; -#endif - assert( yypParser->yytos==yypParser->yystack ); + while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); /* Here code is inserted which will be executed whenever the ** parser accepts */ /*********** Begin %parse_accept code *****************************************/ /*********** End %parse_accept code *******************************************/ sqlite3ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */ @@ -135050,12 +134210,32 @@ #ifdef YYERRORSYMBOL int yyerrorhit = 0; /* True if yymajor has invoked an error */ #endif yyParser *yypParser; /* The parser */ + /* (re)initialize the parser, if necessary */ yypParser = (yyParser*)yyp; - assert( yypParser->yytos!=0 ); + if( yypParser->yyidx<0 ){ +#if YYSTACKDEPTH<=0 + if( yypParser->yystksz <=0 ){ + yyStackOverflow(yypParser); + return; + } +#endif + yypParser->yyidx = 0; +#ifndef YYNOERRORRECOVERY + yypParser->yyerrcnt = -1; +#endif + yypParser->yystack[0].stateno = 0; + yypParser->yystack[0].major = 0; +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sInitialize. Empty stack. State 0\n", + yyTracePrompt); + } +#endif + } #if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) yyendofinput = (yymajor==0); #endif sqlite3ParserARG_STORE; @@ -135066,10 +134246,11 @@ #endif do{ yyact = yy_find_shift_action(yypParser,(YYCODETYPE)yymajor); if( yyact <= YY_MAX_SHIFTREDUCE ){ + if( yyact > YY_MAX_SHIFT ) yyact += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE; yy_shift(yypParser,yyact,yymajor,yyminor); #ifndef YYNOERRORRECOVERY yypParser->yyerrcnt--; #endif yymajor = YYNOCODE; @@ -135107,11 +134288,11 @@ ** */ if( yypParser->yyerrcnt<0 ){ yy_syntax_error(yypParser,yymajor,yyminor); } - yymx = yypParser->yytos->major; + yymx = yypParser->yystack[yypParser->yyidx].major; if( yymx==YYERRORSYMBOL || yyerrorhit ){ #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE,"%sDiscard input token %s\n", yyTracePrompt,yyTokenName[yymajor]); @@ -135118,24 +134299,22 @@ } #endif yy_destructor(yypParser, (YYCODETYPE)yymajor, &yyminorunion); yymajor = YYNOCODE; }else{ - while( yypParser->yytos >= &yypParser->yystack - && yymx != YYERRORSYMBOL - && (yyact = yy_find_reduce_action( - yypParser->yytos->stateno, + while( + yypParser->yyidx >= 0 && + yymx != YYERRORSYMBOL && + (yyact = yy_find_reduce_action( + yypParser->yystack[yypParser->yyidx].stateno, YYERRORSYMBOL)) >= YY_MIN_REDUCE ){ yy_pop_parser_stack(yypParser); } - if( yypParser->yytos < yypParser->yystack || yymajor==0 ){ + if( yypParser->yyidx < 0 || yymajor==0 ){ yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); yy_parse_failed(yypParser); -#ifndef YYNOERRORRECOVERY - yypParser->yyerrcnt = -1; -#endif yymajor = YYNOCODE; }else if( yymx!=YYERRORSYMBOL ){ yy_shift(yypParser,yyact,YYERRORSYMBOL,yyminor); } } @@ -135168,27 +134347,22 @@ } yypParser->yyerrcnt = 3; yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); if( yyendofinput ){ yy_parse_failed(yypParser); -#ifndef YYNOERRORRECOVERY - yypParser->yyerrcnt = -1; -#endif } yymajor = YYNOCODE; #endif } - }while( yymajor!=YYNOCODE && yypParser->yytos>yypParser->yystack ); + }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 ); #ifndef NDEBUG if( yyTraceFILE ){ - yyStackEntry *i; - char cDiv = '['; + int i; fprintf(yyTraceFILE,"%sReturn. Stack=",yyTracePrompt); - for(i=&yypParser->yystack[1]; i<=yypParser->yytos; i++){ - fprintf(yyTraceFILE,"%c%s", cDiv, yyTokenName[i->major]); - cDiv = ' '; - } + for(i=1; i<=yypParser->yyidx; i++) + fprintf(yyTraceFILE,"%c%s", i==1 ? '[' : ' ', + yyTokenName[yypParser->yystack[i].major]); fprintf(yyTraceFILE,"]\n"); } #endif return; } @@ -137506,13 +136680,10 @@ } if( !sqlite3SafetyCheckSickOrOk(db) ){ return SQLITE_MISUSE_BKPT; } sqlite3_mutex_enter(db->mutex); - if( db->mTrace & SQLITE_TRACE_CLOSE ){ - db->xTrace(SQLITE_TRACE_CLOSE, db->pTraceArg, db, 0); - } /* Force xDisconnect calls on all virtual tables */ disconnectAllVtab(db); /* If a transaction is open, the disconnectAllVtab() call above @@ -138277,12 +137448,11 @@ ** ** A NULL trace function means that no tracing is executes. A non-NULL ** trace is a pointer to a function that is invoked at the start of each ** SQL statement. */ -#ifndef SQLITE_OMIT_DEPRECATED -SQLITE_API void *SQLITE_STDCALL sqlite3_trace(sqlite3 *db, void(*xTrace)(void*,const char*), void *pArg){ +SQLITE_API void *SQLITE_STDCALL sqlite3_trace(sqlite3 *db, void (*xTrace)(void*,const char*), void *pArg){ void *pOld; #ifdef SQLITE_ENABLE_API_ARMOR if( !sqlite3SafetyCheckOk(db) ){ (void)SQLITE_MISUSE_BKPT; @@ -138289,40 +137459,15 @@ return 0; } #endif sqlite3_mutex_enter(db->mutex); pOld = db->pTraceArg; - db->mTrace = xTrace ? SQLITE_TRACE_LEGACY : 0; - db->xTrace = (int(*)(u32,void*,void*,void*))xTrace; + db->xTrace = xTrace; db->pTraceArg = pArg; sqlite3_mutex_leave(db->mutex); return pOld; } -#endif /* SQLITE_OMIT_DEPRECATED */ - -/* Register a trace callback using the version-2 interface. -*/ -SQLITE_API int SQLITE_STDCALL sqlite3_trace_v2( - sqlite3 *db, /* Trace this connection */ - unsigned mTrace, /* Mask of events to be traced */ - int(*xTrace)(unsigned,void*,void*,void*), /* Callback to invoke */ - void *pArg /* Context */ -){ -#ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) ){ - return SQLITE_MISUSE_BKPT; - } -#endif - sqlite3_mutex_enter(db->mutex); - db->mTrace = mTrace; - db->xTrace = xTrace; - db->pTraceArg = pArg; - sqlite3_mutex_leave(db->mutex); - return SQLITE_OK; -} - -#ifndef SQLITE_OMIT_DEPRECATED /* ** Register a profile function. The pArg from the previously registered ** profile function is returned. ** ** A NULL profile function means that no profiling is executes. A non-NULL @@ -138347,11 +137492,10 @@ db->xProfile = xProfile; db->pProfileArg = pArg; sqlite3_mutex_leave(db->mutex); return pOld; } -#endif /* SQLITE_OMIT_DEPRECATED */ #endif /* SQLITE_OMIT_TRACE */ /* ** Register a function to be invoked when a transaction commits. ** If the invoked function returns non-zero, then the commit becomes a @@ -150798,15 +149942,11 @@ } #ifdef SQLITE_TEST -#if defined(INCLUDE_SQLITE_TCL_H) -# include "sqlite_tcl.h" -#else -# include "tcl.h" -#endif +#include /* #include */ /* ** Implementation of a special SQL scalar function for testing tokenizers ** designed to be used in concert with the Tcl testing framework. This @@ -162740,57 +161880,10 @@ f = (float)(d*(d<0 ? RNDTOWARDS : RNDAWAY)); } return f; } #endif /* !defined(SQLITE_RTREE_INT_ONLY) */ - -/* -** A constraint has failed while inserting a row into an rtree table. -** Assuming no OOM error occurs, this function sets the error message -** (at pRtree->base.zErrMsg) to an appropriate value and returns -** SQLITE_CONSTRAINT. -** -** Parameter iCol is the index of the leftmost column involved in the -** constraint failure. If it is 0, then the constraint that failed is -** the unique constraint on the id column. Otherwise, it is the rtree -** (c1<=c2) constraint on columns iCol and iCol+1 that has failed. -** -** If an OOM occurs, SQLITE_NOMEM is returned instead of SQLITE_CONSTRAINT. -*/ -static int rtreeConstraintError(Rtree *pRtree, int iCol){ - sqlite3_stmt *pStmt = 0; - char *zSql; - int rc; - - assert( iCol==0 || iCol%2 ); - zSql = sqlite3_mprintf("SELECT * FROM %Q.%Q", pRtree->zDb, pRtree->zName); - if( zSql ){ - rc = sqlite3_prepare_v2(pRtree->db, zSql, -1, &pStmt, 0); - }else{ - rc = SQLITE_NOMEM; - } - sqlite3_free(zSql); - - if( rc==SQLITE_OK ){ - if( iCol==0 ){ - const char *zCol = sqlite3_column_name(pStmt, 0); - pRtree->base.zErrMsg = sqlite3_mprintf( - "UNIQUE constraint failed: %s.%s", pRtree->zName, zCol - ); - }else{ - const char *zCol1 = sqlite3_column_name(pStmt, iCol); - const char *zCol2 = sqlite3_column_name(pStmt, iCol+1); - pRtree->base.zErrMsg = sqlite3_mprintf( - "rtree constraint failed: %s.(%s<=%s)", pRtree->zName, zCol1, zCol2 - ); - } - } - - sqlite3_finalize(pStmt); - return (rc==SQLITE_OK ? SQLITE_CONSTRAINT : rc); -} - /* ** The xUpdate method for rtree module virtual tables. */ @@ -162838,11 +161931,11 @@ if( pRtree->eCoordType==RTREE_COORD_REAL32 ){ for(ii=0; iicell.aCoord[ii+1].f ){ - rc = rtreeConstraintError(pRtree, ii+1); + rc = SQLITE_CONSTRAINT; goto constraint; } } }else #endif @@ -162849,11 +161942,11 @@ { for(ii=0; iicell.aCoord[ii+1].i ){ - rc = rtreeConstraintError(pRtree, ii+1); + rc = SQLITE_CONSTRAINT; goto constraint; } } } @@ -162870,11 +161963,11 @@ rc = sqlite3_reset(pRtree->pReadRowid); if( SQLITE_ROW==steprc ){ if( sqlite3_vtab_on_conflict(pRtree->db)==SQLITE_REPLACE ){ rc = rtreeDeleteRowid(pRtree, cell.iRowid); }else{ - rc = rtreeConstraintError(pRtree, 0); + rc = SQLITE_CONSTRAINT; goto constraint; } } } bHaveRowid = 1; @@ -162953,15 +162046,10 @@ char *zSql; sqlite3_stmt *p; int rc; i64 nRow = 0; - if( sqlite3_table_column_metadata(db,pRtree->zDb,"sqlite_stat1", - 0,0,0,0,0,0)==SQLITE_ERROR ){ - pRtree->nRowEst = RTREE_DEFAULT_ROWEST; - return SQLITE_OK; - } zSql = sqlite3_mprintf(zFmt, pRtree->zDb, pRtree->zName); if( zSql==0 ){ rc = SQLITE_NOMEM; }else{ rc = sqlite3_prepare_v2(db, zSql, -1, &p, 0); @@ -164889,48 +163977,10 @@ ** table exists but is not correctly populated, the value of the *pnOne ** output variable during stage 1 is undefined. */ SQLITE_API void SQLITE_STDCALL sqlite3rbu_bp_progress(sqlite3rbu *pRbu, int *pnOne, int *pnTwo); -/* -** Obtain an indication as to the current stage of an RBU update or vacuum. -** This function always returns one of the SQLITE_RBU_STATE_XXX constants -** defined in this file. Return values should be interpreted as follows: -** -** SQLITE_RBU_STATE_OAL: -** RBU is currently building a *-oal file. The next call to sqlite3rbu_step() -** may either add further data to the *-oal file, or compute data that will -** be added by a subsequent call. -** -** SQLITE_RBU_STATE_MOVE: -** RBU has finished building the *-oal file. The next call to sqlite3rbu_step() -** will move the *-oal file to the equivalent *-wal path. If the current -** operation is an RBU update, then the updated version of the database -** file will become visible to ordinary SQLite clients following the next -** call to sqlite3rbu_step(). -** -** SQLITE_RBU_STATE_CHECKPOINT: -** RBU is currently performing an incremental checkpoint. The next call to -** sqlite3rbu_step() will copy a page of data from the *-wal file into -** the target database file. -** -** SQLITE_RBU_STATE_DONE: -** The RBU operation has finished. Any subsequent calls to sqlite3rbu_step() -** will immediately return SQLITE_DONE. -** -** SQLITE_RBU_STATE_ERROR: -** An error has occurred. Any subsequent calls to sqlite3rbu_step() will -** immediately return the SQLite error code associated with the error. -*/ -#define SQLITE_RBU_STATE_OAL 1 -#define SQLITE_RBU_STATE_MOVE 2 -#define SQLITE_RBU_STATE_CHECKPOINT 3 -#define SQLITE_RBU_STATE_DONE 4 -#define SQLITE_RBU_STATE_ERROR 5 - -SQLITE_API int SQLITE_STDCALL sqlite3rbu_state(sqlite3rbu *pRbu); - /* ** Create an RBU VFS named zName that accesses the underlying file-system ** via existing VFS zParent. Or, if the zParent parameter is passed NULL, ** then the new RBU VFS uses the default system VFS to access the file-system. ** The new object is registered as a non-default VFS with SQLite before @@ -165822,18 +164872,16 @@ */ static int rbuObjIterFirst(sqlite3rbu *p, RbuObjIter *pIter){ int rc; memset(pIter, 0, sizeof(RbuObjIter)); - rc = prepareFreeAndCollectError(p->dbRbu, &pIter->pTblIter, &p->zErrmsg, - sqlite3_mprintf( + rc = prepareAndCollectError(p->dbRbu, &pIter->pTblIter, &p->zErrmsg, "SELECT rbu_target_name(name, type='view') AS target, name " "FROM sqlite_master " "WHERE type IN ('table', 'view') AND target IS NOT NULL " - " %s " "ORDER BY name" - , rbuIsVacuum(p) ? "AND rootpage!=0 AND rootpage IS NOT NULL" : "")); + ); if( rc==SQLITE_OK ){ rc = prepareAndCollectError(p->dbMain, &pIter->pIdxIter, &p->zErrmsg, "SELECT name, rootpage, sql IS NULL OR substr(8, 6)=='UNIQUE' " " FROM main.sqlite_master " @@ -167408,13 +166456,13 @@ #if SQLITE_ENABLE_8_3_NAMES<2 if( sqlite3_uri_boolean(zBase, "8_3_names", 0) ) #endif { int i, sz; - sz = (int)strlen(z)&0xffffff; + sz = sqlite3Strlen30(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); + if( z[i]=='.' && ALWAYS(sz>i+4) ) memmove(&z[i+1], &z[sz-3], 4); } #endif } /* @@ -168456,11 +167504,34 @@ } if( p->rc==SQLITE_OK ){ if( p->eStage==RBU_STAGE_OAL ){ sqlite3 *db = p->dbMain; - p->rc = sqlite3_exec(p->dbRbu, "BEGIN", 0, 0, &p->zErrmsg); + + if( pState->eStage==0 && rbuIsVacuum(p) ){ + rbuCopyPragma(p, "page_size"); + rbuCopyPragma(p, "auto_vacuum"); + } + + /* Open transactions both databases. The *-oal file is opened or + ** created at this point. */ + if( p->rc==SQLITE_OK ){ + p->rc = sqlite3_exec(db, "BEGIN IMMEDIATE", 0, 0, &p->zErrmsg); + } + if( p->rc==SQLITE_OK ){ + p->rc = sqlite3_exec(p->dbRbu, "BEGIN", 0, 0, &p->zErrmsg); + } + + /* Check if the main database is a zipvfs db. If it is, set the upper + ** level pager to use "journal_mode=off". This prevents it from + ** generating a large journal using a temp file. */ + if( p->rc==SQLITE_OK ){ + int frc = sqlite3_file_control(db, "main", SQLITE_FCNTL_ZIPVFS, 0); + if( frc==SQLITE_OK ){ + p->rc = sqlite3_exec(db, "PRAGMA journal_mode=off",0,0,&p->zErrmsg); + } + } /* Point the object iterator at the first object */ if( p->rc==SQLITE_OK ){ p->rc = rbuObjIterFirst(p, &p->objiter); } @@ -168467,38 +167538,16 @@ /* If the RBU database contains no data_xxx tables, declare the RBU ** update finished. */ if( p->rc==SQLITE_OK && p->objiter.zTbl==0 ){ p->rc = SQLITE_DONE; - p->eStage = RBU_STAGE_DONE; - }else{ - if( p->rc==SQLITE_OK && pState->eStage==0 && rbuIsVacuum(p) ){ - rbuCopyPragma(p, "page_size"); - rbuCopyPragma(p, "auto_vacuum"); - } - - /* Open transactions both databases. The *-oal file is opened or - ** created at this point. */ - if( p->rc==SQLITE_OK ){ - p->rc = sqlite3_exec(db, "BEGIN IMMEDIATE", 0, 0, &p->zErrmsg); - } - - /* Check if the main database is a zipvfs db. If it is, set the upper - ** level pager to use "journal_mode=off". This prevents it from - ** generating a large journal using a temp file. */ - if( p->rc==SQLITE_OK ){ - int frc = sqlite3_file_control(db, "main", SQLITE_FCNTL_ZIPVFS, 0); - if( frc==SQLITE_OK ){ - p->rc = sqlite3_exec( - db, "PRAGMA journal_mode=off",0,0,&p->zErrmsg); - } - } - - if( p->rc==SQLITE_OK ){ - rbuSetupOal(p, pState); - } - } + } + + if( p->rc==SQLITE_OK ){ + rbuSetupOal(p, pState); + } + }else if( p->eStage==RBU_STAGE_MOVE ){ /* no-op */ }else if( p->eStage==RBU_STAGE_CKPT ){ rbuSetupCheckpoint(p, pState); }else if( p->eStage==RBU_STAGE_DONE ){ @@ -168661,43 +167710,13 @@ default: assert( 0 ); } } -/* -** Return the current state of the RBU vacuum or update operation. -*/ -SQLITE_API int SQLITE_STDCALL sqlite3rbu_state(sqlite3rbu *p){ - int aRes[] = { - 0, SQLITE_RBU_STATE_OAL, SQLITE_RBU_STATE_MOVE, - 0, SQLITE_RBU_STATE_CHECKPOINT, SQLITE_RBU_STATE_DONE - }; - - assert( RBU_STAGE_OAL==1 ); - assert( RBU_STAGE_MOVE==2 ); - assert( RBU_STAGE_CKPT==4 ); - assert( RBU_STAGE_DONE==5 ); - assert( aRes[RBU_STAGE_OAL]==SQLITE_RBU_STATE_OAL ); - assert( aRes[RBU_STAGE_MOVE]==SQLITE_RBU_STATE_MOVE ); - assert( aRes[RBU_STAGE_CKPT]==SQLITE_RBU_STATE_CHECKPOINT ); - assert( aRes[RBU_STAGE_DONE]==SQLITE_RBU_STATE_DONE ); - - if( p->rc!=SQLITE_OK && p->rc!=SQLITE_DONE ){ - return SQLITE_RBU_STATE_ERROR; - }else{ - assert( p->rc!=SQLITE_DONE || p->eStage==RBU_STAGE_DONE ); - assert( p->eStage==RBU_STAGE_OAL - || p->eStage==RBU_STAGE_MOVE - || p->eStage==RBU_STAGE_CKPT - || p->eStage==RBU_STAGE_DONE - ); - return aRes[p->eStage]; - } -} - SQLITE_API int SQLITE_STDCALL sqlite3rbu_savestate(sqlite3rbu *p){ int rc = p->rc; + if( rc==SQLITE_DONE ) return SQLITE_OK; assert( p->eStage>=RBU_STAGE_OAL && p->eStage<=RBU_STAGE_DONE ); if( p->eStage==RBU_STAGE_OAL ){ assert( rc!=SQLITE_DONE ); @@ -169675,14 +168694,14 @@ ** ** '/1c2/000/' // Left-most child of 451st child of root */ #define VTAB_SCHEMA \ "CREATE TABLE xx( " \ - " name TEXT, /* Name of table or index */" \ - " path TEXT, /* Path to page from root */" \ + " name STRING, /* Name of table or index */" \ + " path INTEGER, /* Path to page from root */" \ " pageno INTEGER, /* Page number */" \ - " pagetype TEXT, /* 'internal', 'leaf' or 'overflow' */" \ + " pagetype STRING, /* 'internal', 'leaf' or 'overflow' */" \ " ncell INTEGER, /* Cells on page (0 for overflow) */" \ " payload INTEGER, /* Bytes of payload on this page */" \ " unused INTEGER, /* Bytes of unused space on this page */" \ " mx_payload INTEGER, /* Largest payload size of all cells */" \ " pgoffset INTEGER, /* Offset of page in file */" \ @@ -176177,30 +175196,10 @@ /**************************************************************************** ** Scalar SQL function implementations ****************************************************************************/ -/* -** Implementation of the json_QUOTE(VALUE) function. Return a JSON value -** corresponding to the SQL value input. Mostly this means putting -** double-quotes around strings and returning the unquoted string "null" -** when given a NULL input. -*/ -static void jsonQuoteFunc( - sqlite3_context *ctx, - int argc, - sqlite3_value **argv -){ - JsonString jx; - UNUSED_PARAM(argc); - - jsonInit(&jx, ctx); - jsonAppendValue(&jx, argv[0]); - jsonResult(&jx); - sqlite3_result_subtype(ctx, JSON_SUBTYPE); -} - /* ** Implementation of the json_array(VALUE,...) function. Return a JSON ** array that contains all values given in arguments. Or if any argument ** is a BLOB, throw an error. */ @@ -177110,11 +176109,10 @@ { "json_array_length", 1, 0, jsonArrayLengthFunc }, { "json_array_length", 2, 0, jsonArrayLengthFunc }, { "json_extract", -1, 0, jsonExtractFunc }, { "json_insert", -1, 0, jsonSetFunc }, { "json_object", -1, 0, jsonObjectFunc }, - { "json_quote", 1, 0, jsonQuoteFunc }, { "json_remove", -1, 0, jsonRemoveFunc }, { "json_replace", -1, 0, jsonReplaceFunc }, { "json_set", -1, 1, jsonSetFunc }, { "json_type", 1, 0, jsonTypeFunc }, { "json_type", 2, 0, jsonTypeFunc }, @@ -177511,11 +176509,11 @@ ** 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: ** ** xCreate: -** This function is used to allocate and initialize a tokenizer instance. +** This function is used to allocate and inititalize a tokenizer instance. ** A tokenizer instance is required to actually tokenize text. ** ** The first argument passed to this function is a copy of the (void*) ** pointer provided by the application when the fts5_tokenizer object ** was registered with FTS5 (the third argument to xCreateTokenizer()). @@ -177770,10 +176768,11 @@ #if 0 } /* end of the 'extern "C"' block */ #endif #endif /* _FTS5_H */ + /* ** 2014 May 31 ** ** The author disclaims copyright to this source code. In place of @@ -178459,10 +177458,11 @@ static Fts5PoslistPopulator *sqlite3Fts5ExprClearPoslists(Fts5Expr*, int); static int sqlite3Fts5ExprPopulatePoslists( Fts5Config*, Fts5Expr*, Fts5PoslistPopulator*, int, const char*, int ); static void sqlite3Fts5ExprCheckPoslists(Fts5Expr*, i64); +static void sqlite3Fts5ExprClearEof(Fts5Expr*); static int sqlite3Fts5ExprClonePhrase(Fts5Expr*, int, Fts5Expr**); static int sqlite3Fts5ExprPhraseCollist(Fts5Expr *, int, const u8 **, int *); @@ -178874,22 +177874,21 @@ typedef struct fts5yyStackEntry fts5yyStackEntry; /* The state of the parser is completely contained in an instance of ** the following structure */ struct fts5yyParser { - fts5yyStackEntry *fts5yytos; /* Pointer to top element of the stack */ + int fts5yyidx; /* Index of top element in stack */ #ifdef fts5YYTRACKMAXSTACKDEPTH - int fts5yyhwm; /* High-water mark of the stack */ + int fts5yyidxMax; /* Maximum value of fts5yyidx */ #endif #ifndef fts5YYNOERRORRECOVERY int fts5yyerrcnt; /* Shifts left before out of the error */ #endif sqlite3Fts5ParserARG_SDECL /* A place to hold %extra_argument */ #if fts5YYSTACKDEPTH<=0 int fts5yystksz; /* Current side of the stack */ fts5yyStackEntry *fts5yystack; /* The parser's stack */ - fts5yyStackEntry fts5yystk0; /* First stack entry */ #else fts5yyStackEntry fts5yystack[fts5YYSTACKDEPTH]; /* The parser's stack */ #endif }; typedef struct fts5yyParser fts5yyParser; @@ -178972,38 +177971,28 @@ #endif /* NDEBUG */ #if fts5YYSTACKDEPTH<=0 /* -** Try to increase the size of the parser stack. Return the number -** of errors. Return 0 on success. +** Try to increase the size of the parser stack. */ -static int fts5yyGrowStack(fts5yyParser *p){ +static void fts5yyGrowStack(fts5yyParser *p){ int newSize; - int idx; fts5yyStackEntry *pNew; newSize = p->fts5yystksz*2 + 100; - idx = p->fts5yytos ? (int)(p->fts5yytos - p->fts5yystack) : 0; - if( p->fts5yystack==&p->fts5yystk0 ){ - pNew = malloc(newSize*sizeof(pNew[0])); - if( pNew ) pNew[0] = p->fts5yystk0; - }else{ - pNew = realloc(p->fts5yystack, newSize*sizeof(pNew[0])); - } + pNew = realloc(p->fts5yystack, newSize*sizeof(pNew[0])); if( pNew ){ p->fts5yystack = pNew; - p->fts5yytos = &p->fts5yystack[idx]; + p->fts5yystksz = newSize; #ifndef NDEBUG if( fts5yyTraceFILE ){ - fprintf(fts5yyTraceFILE,"%sStack grows from %d to %d entries.\n", - fts5yyTracePrompt, p->fts5yystksz, newSize); + fprintf(fts5yyTraceFILE,"%sStack grows to %d entries!\n", + fts5yyTracePrompt, p->fts5yystksz); } #endif - p->fts5yystksz = newSize; } - return pNew==0; } #endif /* Datatype of the argument to the memory allocated passed as the ** second argument to sqlite3Fts5ParserAlloc() below. This can be changed by @@ -179028,28 +178017,19 @@ */ static void *sqlite3Fts5ParserAlloc(void *(*mallocProc)(fts5YYMALLOCARGTYPE)){ fts5yyParser *pParser; pParser = (fts5yyParser*)(*mallocProc)( (fts5YYMALLOCARGTYPE)sizeof(fts5yyParser) ); if( pParser ){ + pParser->fts5yyidx = -1; #ifdef fts5YYTRACKMAXSTACKDEPTH - pParser->fts5yyhwm = 0; + pParser->fts5yyidxMax = 0; #endif #if fts5YYSTACKDEPTH<=0 - pParser->fts5yytos = NULL; pParser->fts5yystack = NULL; pParser->fts5yystksz = 0; - if( fts5yyGrowStack(pParser) ){ - pParser->fts5yystack = &pParser->fts5yystk0; - pParser->fts5yystksz = 1; - } -#endif -#ifndef fts5YYNOERRORRECOVERY - pParser->fts5yyerrcnt = -1; -#endif - pParser->fts5yytos = pParser->fts5yystack; - pParser->fts5yystack[0].stateno = 0; - pParser->fts5yystack[0].major = 0; + fts5yyGrowStack(pParser); +#endif } return pParser; } /* The following function deletes the "minor type" or semantic value @@ -179117,13 +178097,12 @@ ** If there is a destructor routine associated with the token which ** is popped from the stack, then call it. */ static void fts5yy_pop_parser_stack(fts5yyParser *pParser){ fts5yyStackEntry *fts5yytos; - assert( pParser->fts5yytos!=0 ); - assert( pParser->fts5yytos > pParser->fts5yystack ); - fts5yytos = pParser->fts5yytos--; + assert( pParser->fts5yyidx>=0 ); + fts5yytos = &pParser->fts5yystack[pParser->fts5yyidx--]; #ifndef NDEBUG if( fts5yyTraceFILE ){ fprintf(fts5yyTraceFILE,"%sPopping %s\n", fts5yyTracePrompt, fts5yyTokenName[fts5yytos->major]); @@ -179146,13 +178125,13 @@ ){ fts5yyParser *pParser = (fts5yyParser*)p; #ifndef fts5YYPARSEFREENEVERNULL if( pParser==0 ) return; #endif - while( pParser->fts5yytos>pParser->fts5yystack ) fts5yy_pop_parser_stack(pParser); + while( pParser->fts5yyidx>=0 ) fts5yy_pop_parser_stack(pParser); #if fts5YYSTACKDEPTH<=0 - if( pParser->fts5yystack!=&pParser->fts5yystk0 ) free(pParser->fts5yystack); + free(pParser->fts5yystack); #endif (*freeProc)((void*)pParser); } /* @@ -179159,11 +178138,11 @@ ** Return the peak depth of the stack for a parser. */ #ifdef fts5YYTRACKMAXSTACKDEPTH static int sqlite3Fts5ParserStackPeak(void *p){ fts5yyParser *pParser = (fts5yyParser*)p; - return pParser->fts5yyhwm; + return pParser->fts5yyidxMax; } #endif /* ** Find the appropriate action for a parser given the terminal @@ -179172,11 +178151,11 @@ static unsigned int fts5yy_find_shift_action( fts5yyParser *pParser, /* The parser */ fts5YYCODETYPE iLookAhead /* The look-ahead token */ ){ int i; - int stateno = pParser->fts5yytos->stateno; + int stateno = pParser->fts5yystack[pParser->fts5yyidx].stateno; if( stateno>=fts5YY_MIN_REDUCE ) return stateno; assert( stateno <= fts5YY_SHIFT_COUNT ); do{ i = fts5yy_shift_ofst[stateno]; @@ -179265,17 +178244,17 @@ /* ** The following routine is called if the stack overflows. */ static void fts5yyStackOverflow(fts5yyParser *fts5yypParser){ sqlite3Fts5ParserARG_FETCH; - fts5yypParser->fts5yytos--; + fts5yypParser->fts5yyidx--; #ifndef NDEBUG if( fts5yyTraceFILE ){ fprintf(fts5yyTraceFILE,"%sStack Overflow!\n",fts5yyTracePrompt); } #endif - while( fts5yypParser->fts5yytos>fts5yypParser->fts5yystack ) fts5yy_pop_parser_stack(fts5yypParser); + while( fts5yypParser->fts5yyidx>=0 ) fts5yy_pop_parser_stack(fts5yypParser); /* Here code is inserted which will execute if the parser ** stack every overflows */ /******** Begin %stack_overflow code ******************************************/ sqlite3Fts5ParseError(pParse, "fts5: parser stack overflow"); @@ -179289,15 +178268,15 @@ #ifndef NDEBUG static void fts5yyTraceShift(fts5yyParser *fts5yypParser, int fts5yyNewState){ if( fts5yyTraceFILE ){ if( fts5yyNewStatefts5yytos->major], + fts5yyTracePrompt,fts5yyTokenName[fts5yypParser->fts5yystack[fts5yypParser->fts5yyidx].major], fts5yyNewState); }else{ fprintf(fts5yyTraceFILE,"%sShift '%s'\n", - fts5yyTracePrompt,fts5yyTokenName[fts5yypParser->fts5yytos->major]); + fts5yyTracePrompt,fts5yyTokenName[fts5yypParser->fts5yystack[fts5yypParser->fts5yyidx].major]); } } } #else # define fts5yyTraceShift(X,Y) @@ -179311,34 +178290,31 @@ int fts5yyNewState, /* The new state to shift in */ int fts5yyMajor, /* The major token to shift in */ sqlite3Fts5ParserFTS5TOKENTYPE fts5yyMinor /* The minor token to shift in */ ){ fts5yyStackEntry *fts5yytos; - fts5yypParser->fts5yytos++; + fts5yypParser->fts5yyidx++; #ifdef fts5YYTRACKMAXSTACKDEPTH - if( (int)(fts5yypParser->fts5yytos - fts5yypParser->fts5yystack)>fts5yypParser->fts5yyhwm ){ - fts5yypParser->fts5yyhwm++; - assert( fts5yypParser->fts5yyhwm == (int)(fts5yypParser->fts5yytos - fts5yypParser->fts5yystack) ); + if( fts5yypParser->fts5yyidx>fts5yypParser->fts5yyidxMax ){ + fts5yypParser->fts5yyidxMax = fts5yypParser->fts5yyidx; } #endif #if fts5YYSTACKDEPTH>0 - if( fts5yypParser->fts5yytos>=&fts5yypParser->fts5yystack[fts5YYSTACKDEPTH] ){ + if( fts5yypParser->fts5yyidx>=fts5YYSTACKDEPTH ){ fts5yyStackOverflow(fts5yypParser); return; } #else - if( fts5yypParser->fts5yytos>=&fts5yypParser->fts5yystack[fts5yypParser->fts5yystksz] ){ - if( fts5yyGrowStack(fts5yypParser) ){ + if( fts5yypParser->fts5yyidx>=fts5yypParser->fts5yystksz ){ + fts5yyGrowStack(fts5yypParser); + if( fts5yypParser->fts5yyidx>=fts5yypParser->fts5yystksz ){ fts5yyStackOverflow(fts5yypParser); return; } } #endif - if( fts5yyNewState > fts5YY_MAX_SHIFT ){ - fts5yyNewState += fts5YY_MIN_REDUCE - fts5YY_MIN_SHIFTREDUCE; - } - fts5yytos = fts5yypParser->fts5yytos; + fts5yytos = &fts5yypParser->fts5yystack[fts5yypParser->fts5yyidx]; fts5yytos->stateno = (fts5YYACTIONTYPE)fts5yyNewState; fts5yytos->major = (fts5YYCODETYPE)fts5yyMajor; fts5yytos->minor.fts5yy0 = fts5yyMinor; fts5yyTraceShift(fts5yypParser, fts5yyNewState); } @@ -179389,11 +178365,11 @@ int fts5yygoto; /* The next state */ int fts5yyact; /* The next action */ fts5yyStackEntry *fts5yymsp; /* The top of the parser's stack */ int fts5yysize; /* Amount to pop the stack */ sqlite3Fts5ParserARG_FETCH; - fts5yymsp = fts5yypParser->fts5yytos; + fts5yymsp = &fts5yypParser->fts5yystack[fts5yypParser->fts5yyidx]; #ifndef NDEBUG if( fts5yyTraceFILE && fts5yyruleno<(int)(sizeof(fts5yyRuleName)/sizeof(fts5yyRuleName[0])) ){ fts5yysize = fts5yyRuleInfo[fts5yyruleno].nrhs; fprintf(fts5yyTraceFILE, "%sReduce [%s], go to state %d.\n", fts5yyTracePrompt, fts5yyRuleName[fts5yyruleno], fts5yymsp[-fts5yysize].stateno); @@ -179403,27 +178379,26 @@ /* Check that the stack is large enough to grow by a single entry ** if the RHS of the rule is empty. This ensures that there is room ** enough on the stack to push the LHS value */ if( fts5yyRuleInfo[fts5yyruleno].nrhs==0 ){ #ifdef fts5YYTRACKMAXSTACKDEPTH - if( (int)(fts5yypParser->fts5yytos - fts5yypParser->fts5yystack)>fts5yypParser->fts5yyhwm ){ - fts5yypParser->fts5yyhwm++; - assert( fts5yypParser->fts5yyhwm == (int)(fts5yypParser->fts5yytos - fts5yypParser->fts5yystack)); + if( fts5yypParser->fts5yyidx>fts5yypParser->fts5yyidxMax ){ + fts5yypParser->fts5yyidxMax = fts5yypParser->fts5yyidx; } #endif #if fts5YYSTACKDEPTH>0 - if( fts5yypParser->fts5yytos>=&fts5yypParser->fts5yystack[fts5YYSTACKDEPTH-1] ){ + if( fts5yypParser->fts5yyidx>=fts5YYSTACKDEPTH-1 ){ fts5yyStackOverflow(fts5yypParser); return; } #else - if( fts5yypParser->fts5yytos>=&fts5yypParser->fts5yystack[fts5yypParser->fts5yystksz-1] ){ - if( fts5yyGrowStack(fts5yypParser) ){ + if( fts5yypParser->fts5yyidx>=fts5yypParser->fts5yystksz-1 ){ + fts5yyGrowStack(fts5yypParser); + if( fts5yypParser->fts5yyidx>=fts5yypParser->fts5yystksz-1 ){ fts5yyStackOverflow(fts5yypParser); return; } - fts5yymsp = fts5yypParser->fts5yytos; } #endif } switch( fts5yyruleno ){ @@ -179560,21 +178535,19 @@ assert( fts5yyrulenofts5YY_MAX_SHIFT ){ - fts5yyact += fts5YY_MIN_REDUCE - fts5YY_MIN_SHIFTREDUCE; - } + if( fts5yyact>fts5YY_MAX_SHIFT ) fts5yyact += fts5YY_MIN_REDUCE - fts5YY_MIN_SHIFTREDUCE; + fts5yypParser->fts5yyidx -= fts5yysize - 1; fts5yymsp -= fts5yysize-1; - fts5yypParser->fts5yytos = fts5yymsp; fts5yymsp->stateno = (fts5YYACTIONTYPE)fts5yyact; fts5yymsp->major = (fts5YYCODETYPE)fts5yygoto; fts5yyTraceShift(fts5yypParser, fts5yyact); }else{ assert( fts5yyact == fts5YY_ACCEPT_ACTION ); - fts5yypParser->fts5yytos -= fts5yysize; + fts5yypParser->fts5yyidx -= fts5yysize; fts5yy_accept(fts5yypParser); } } /* @@ -179588,11 +178561,11 @@ #ifndef NDEBUG if( fts5yyTraceFILE ){ fprintf(fts5yyTraceFILE,"%sFail!\n",fts5yyTracePrompt); } #endif - while( fts5yypParser->fts5yytos>fts5yypParser->fts5yystack ) fts5yy_pop_parser_stack(fts5yypParser); + while( fts5yypParser->fts5yyidx>=0 ) fts5yy_pop_parser_stack(fts5yypParser); /* Here code is inserted which will be executed whenever the ** parser fails */ /************ Begin %parse_failure code ***************************************/ /************ End %parse_failure code *****************************************/ sqlite3Fts5ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */ @@ -179629,14 +178602,11 @@ #ifndef NDEBUG if( fts5yyTraceFILE ){ fprintf(fts5yyTraceFILE,"%sAccept!\n",fts5yyTracePrompt); } #endif -#ifndef fts5YYNOERRORRECOVERY - fts5yypParser->fts5yyerrcnt = -1; -#endif - assert( fts5yypParser->fts5yytos==fts5yypParser->fts5yystack ); + while( fts5yypParser->fts5yyidx>=0 ) fts5yy_pop_parser_stack(fts5yypParser); /* Here code is inserted which will be executed whenever the ** parser accepts */ /*********** Begin %parse_accept code *****************************************/ /*********** End %parse_accept code *******************************************/ sqlite3Fts5ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */ @@ -179675,12 +178645,32 @@ #ifdef fts5YYERRORSYMBOL int fts5yyerrorhit = 0; /* True if fts5yymajor has invoked an error */ #endif fts5yyParser *fts5yypParser; /* The parser */ + /* (re)initialize the parser, if necessary */ fts5yypParser = (fts5yyParser*)fts5yyp; - assert( fts5yypParser->fts5yytos!=0 ); + if( fts5yypParser->fts5yyidx<0 ){ +#if fts5YYSTACKDEPTH<=0 + if( fts5yypParser->fts5yystksz <=0 ){ + fts5yyStackOverflow(fts5yypParser); + return; + } +#endif + fts5yypParser->fts5yyidx = 0; +#ifndef fts5YYNOERRORRECOVERY + fts5yypParser->fts5yyerrcnt = -1; +#endif + fts5yypParser->fts5yystack[0].stateno = 0; + fts5yypParser->fts5yystack[0].major = 0; +#ifndef NDEBUG + if( fts5yyTraceFILE ){ + fprintf(fts5yyTraceFILE,"%sInitialize. Empty stack. State 0\n", + fts5yyTracePrompt); + } +#endif + } #if !defined(fts5YYERRORSYMBOL) && !defined(fts5YYNOERRORRECOVERY) fts5yyendofinput = (fts5yymajor==0); #endif sqlite3Fts5ParserARG_STORE; @@ -179691,10 +178681,11 @@ #endif do{ fts5yyact = fts5yy_find_shift_action(fts5yypParser,(fts5YYCODETYPE)fts5yymajor); if( fts5yyact <= fts5YY_MAX_SHIFTREDUCE ){ + if( fts5yyact > fts5YY_MAX_SHIFT ) fts5yyact += fts5YY_MIN_REDUCE - fts5YY_MIN_SHIFTREDUCE; fts5yy_shift(fts5yypParser,fts5yyact,fts5yymajor,fts5yyminor); #ifndef fts5YYNOERRORRECOVERY fts5yypParser->fts5yyerrcnt--; #endif fts5yymajor = fts5YYNOCODE; @@ -179732,11 +178723,11 @@ ** */ if( fts5yypParser->fts5yyerrcnt<0 ){ fts5yy_syntax_error(fts5yypParser,fts5yymajor,fts5yyminor); } - fts5yymx = fts5yypParser->fts5yytos->major; + fts5yymx = fts5yypParser->fts5yystack[fts5yypParser->fts5yyidx].major; if( fts5yymx==fts5YYERRORSYMBOL || fts5yyerrorhit ){ #ifndef NDEBUG if( fts5yyTraceFILE ){ fprintf(fts5yyTraceFILE,"%sDiscard input token %s\n", fts5yyTracePrompt,fts5yyTokenName[fts5yymajor]); @@ -179743,24 +178734,22 @@ } #endif fts5yy_destructor(fts5yypParser, (fts5YYCODETYPE)fts5yymajor, &fts5yyminorunion); fts5yymajor = fts5YYNOCODE; }else{ - while( fts5yypParser->fts5yytos >= &fts5yypParser->fts5yystack - && fts5yymx != fts5YYERRORSYMBOL - && (fts5yyact = fts5yy_find_reduce_action( - fts5yypParser->fts5yytos->stateno, + while( + fts5yypParser->fts5yyidx >= 0 && + fts5yymx != fts5YYERRORSYMBOL && + (fts5yyact = fts5yy_find_reduce_action( + fts5yypParser->fts5yystack[fts5yypParser->fts5yyidx].stateno, fts5YYERRORSYMBOL)) >= fts5YY_MIN_REDUCE ){ fts5yy_pop_parser_stack(fts5yypParser); } - if( fts5yypParser->fts5yytos < fts5yypParser->fts5yystack || fts5yymajor==0 ){ + if( fts5yypParser->fts5yyidx < 0 || fts5yymajor==0 ){ fts5yy_destructor(fts5yypParser,(fts5YYCODETYPE)fts5yymajor,&fts5yyminorunion); fts5yy_parse_failed(fts5yypParser); -#ifndef fts5YYNOERRORRECOVERY - fts5yypParser->fts5yyerrcnt = -1; -#endif fts5yymajor = fts5YYNOCODE; }else if( fts5yymx!=fts5YYERRORSYMBOL ){ fts5yy_shift(fts5yypParser,fts5yyact,fts5YYERRORSYMBOL,fts5yyminor); } } @@ -179793,27 +178782,22 @@ } fts5yypParser->fts5yyerrcnt = 3; fts5yy_destructor(fts5yypParser,(fts5YYCODETYPE)fts5yymajor,&fts5yyminorunion); if( fts5yyendofinput ){ fts5yy_parse_failed(fts5yypParser); -#ifndef fts5YYNOERRORRECOVERY - fts5yypParser->fts5yyerrcnt = -1; -#endif } fts5yymajor = fts5YYNOCODE; #endif } - }while( fts5yymajor!=fts5YYNOCODE && fts5yypParser->fts5yytos>fts5yypParser->fts5yystack ); + }while( fts5yymajor!=fts5YYNOCODE && fts5yypParser->fts5yyidx>=0 ); #ifndef NDEBUG if( fts5yyTraceFILE ){ - fts5yyStackEntry *i; - char cDiv = '['; + int i; fprintf(fts5yyTraceFILE,"%sReturn. Stack=",fts5yyTracePrompt); - for(i=&fts5yypParser->fts5yystack[1]; i<=fts5yypParser->fts5yytos; i++){ - fprintf(fts5yyTraceFILE,"%c%s", cDiv, fts5yyTokenName[i->major]); - cDiv = ' '; - } + for(i=1; i<=fts5yypParser->fts5yyidx; i++) + fprintf(fts5yyTraceFILE,"%c%s", i==1 ? '[' : ' ', + fts5yyTokenName[fts5yypParser->fts5yystack[i].major]); fprintf(fts5yyTraceFILE,"]\n"); } #endif return; } @@ -184352,10 +183336,21 @@ } static void sqlite3Fts5ExprCheckPoslists(Fts5Expr *pExpr, i64 iRowid){ fts5ExprCheckPoslists(pExpr->pRoot, iRowid); } + +static void fts5ExprClearEof(Fts5ExprNode *pNode){ + int i; + for(i=0; inChild; i++){ + fts5ExprClearEof(pNode->apChild[i]); + } + pNode->bEof = 0; +} +static void sqlite3Fts5ExprClearEof(Fts5Expr *pExpr){ + fts5ExprClearEof(pExpr->pRoot); +} /* ** This function is only called for detail=columns tables. */ static int sqlite3Fts5ExprPhraseCollist( @@ -192570,10 +191565,11 @@ assert( pCsr->iLastRowid==LARGEST_INT64 ); assert( pCsr->iFirstRowid==SMALLEST_INT64 ); pCsr->ePlan = FTS5_PLAN_SOURCE; pCsr->pExpr = pTab->pSortCsr->pExpr; rc = fts5CursorFirst(pTab, pCsr, bDesc); + sqlite3Fts5ExprClearEof(pCsr->pExpr); }else if( pMatch ){ const char *zExpr = (const char*)sqlite3_value_text(apVal[0]); if( zExpr==0 ) zExpr = ""; rc = fts5CursorParseRank(pConfig, pCsr, pRank); @@ -193998,11 +192994,11 @@ int nArg, /* Number of args */ sqlite3_value **apUnused /* Function arguments */ ){ assert( nArg==0 ); UNUSED_PARAM2(nArg, apUnused); - sqlite3_result_text(pCtx, "fts5: 2016-08-08 13:40:27 d5e98057028abcf7217d0d2b2e29bbbcdf09d6de", -1, SQLITE_TRANSIENT); + sqlite3_result_text(pCtx, "fts5: 2016-05-18 10:57:30 fc49f556e48970561d7ab6a2f24fdd7d9eb81ff2", -1, SQLITE_TRANSIENT); } static int fts5Init(sqlite3 *db){ static const sqlite3_module fts5Mod = { /* iVersion */ 2, @@ -194363,15 +193359,11 @@ ){ int rc; char *zErr = 0; rc = fts5ExecPrintf(pConfig->db, &zErr, "CREATE TABLE %Q.'%q_%q'(%s)%s", - pConfig->zDb, pConfig->zName, zPost, zDefn, -#ifndef SQLITE_FTS5_NO_WITHOUT_ROWID - bWithout?" WITHOUT ROWID": -#endif - "" + pConfig->zDb, pConfig->zName, zPost, zDefn, bWithout?" WITHOUT ROWID":"" ); if( zErr ){ *pzErr = sqlite3_mprintf( "fts5: error creating shadow table %q_%s: %s", pConfig->zName, zPost, zErr Index: SQLite.Interop/src/core/sqlite3.h ================================================================== --- SQLite.Interop/src/core/sqlite3.h +++ SQLite.Interop/src/core/sqlite3.h @@ -28,12 +28,12 @@ ** The name of this file under configuration management is "sqlite.h.in". ** The makefile makes some minor changes to this file (such as inserting ** the version number) and changes its name to "sqlite3.h" as ** part of the build process. */ -#ifndef SQLITE3_H -#define SQLITE3_H +#ifndef _SQLITE3_H_ +#define _SQLITE3_H_ #include /* Needed for the definition of va_list */ /* ** Make sure we can call this stuff from C++. */ @@ -52,21 +52,12 @@ # define SQLITE_API #endif #ifndef SQLITE_CDECL # define SQLITE_CDECL #endif -#ifndef SQLITE_APICALL -# define SQLITE_APICALL -#endif #ifndef SQLITE_STDCALL -# define SQLITE_STDCALL SQLITE_APICALL -#endif -#ifndef SQLITE_CALLBACK -# define SQLITE_CALLBACK -#endif -#ifndef SQLITE_SYSAPI -# define SQLITE_SYSAPI +# define SQLITE_STDCALL #endif /* ** These no-op macros are used in front of interfaces to mark those ** interfaces as either deprecated or experimental. New applications @@ -118,13 +109,13 @@ ** ** See also: [sqlite3_libversion()], ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ -#define SQLITE_VERSION "3.14.0" -#define SQLITE_VERSION_NUMBER 3014000 -#define SQLITE_SOURCE_ID "2016-08-08 13:40:27 d5e98057028abcf7217d0d2b2e29bbbcdf09d6de" +#define SQLITE_VERSION "3.13.0" +#define SQLITE_VERSION_NUMBER 3013000 +#define SQLITE_SOURCE_ID "2016-05-18 10:57:30 fc49f556e48970561d7ab6a2f24fdd7d9eb81ff2" /* ** CAPI3REF: Run-Time Library Version Numbers ** KEYWORDS: sqlite3_version, sqlite3_sourceid ** @@ -513,11 +504,10 @@ #define SQLITE_CONSTRAINT_ROWID (SQLITE_CONSTRAINT |(10<<8)) #define SQLITE_NOTICE_RECOVER_WAL (SQLITE_NOTICE | (1<<8)) #define SQLITE_NOTICE_RECOVER_ROLLBACK (SQLITE_NOTICE | (2<<8)) #define SQLITE_WARNING_AUTOINDEX (SQLITE_WARNING | (1<<8)) #define SQLITE_AUTH_USER (SQLITE_AUTH | (1<<8)) -#define SQLITE_OK_LOAD_PERMANENTLY (SQLITE_OK | (1<<8)) /* ** CAPI3REF: Flags For File Open Operations ** ** These bit values are intended for use in the @@ -1043,20 +1033,10 @@ ** ** Mutexes are created using [sqlite3_mutex_alloc()]. */ typedef struct sqlite3_mutex sqlite3_mutex; -/* -** CAPI3REF: Loadable Extension Thunk -** -** A pointer to the opaque sqlite3_api_routines structure is passed as -** the third parameter to entry points of [loadable extensions]. This -** structure must be typedefed in order to work around compiler warnings -** on some platforms. -*/ -typedef struct sqlite3_api_routines sqlite3_api_routines; - /* ** CAPI3REF: OS Interface Object ** ** An instance of the sqlite3_vfs object defines the interface between ** the SQLite core and the underlying operating system. The "vfs" @@ -1957,11 +1937,11 @@ ** 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 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 +** enabled and the SQL function remains disabled. If the first argment to ** this interface is 0, then both the C-API and the SQL function are disabled. ** If the first argument is -1, then no changes are made to state of either the ** C-API or the SQL function. ** The second parameter is a pointer to an integer into which ** is written 0 or 1 to indicate whether [sqlite3_load_extension()] interface @@ -2250,11 +2230,11 @@ ** result in undefined behavior. ** ** A busy handler must not close the database connection ** or [prepared statement] that invoked the busy handler. */ -SQLITE_API int SQLITE_STDCALL sqlite3_busy_handler(sqlite3*,int(*)(void*,int),void*); +SQLITE_API int SQLITE_STDCALL sqlite3_busy_handler(sqlite3*, int(*)(void*,int), void*); /* ** CAPI3REF: Set A Busy Timeout ** METHOD: sqlite3 ** @@ -2772,13 +2752,10 @@ /* ** CAPI3REF: Tracing And Profiling Functions ** METHOD: sqlite3 ** -** These routines are deprecated. Use the [sqlite3_trace_v2()] interface -** instead of the routines described here. -** ** These routines register callback functions that can be used for ** tracing and profiling the execution of SQL statements. ** ** ^The callback function registered by sqlite3_trace() is invoked at ** various times when an SQL statement is being run by [sqlite3_step()]. @@ -2800,108 +2777,14 @@ ** digits in the time are meaningless. Future versions of SQLite ** might provide greater resolution on the profiler callback. The ** sqlite3_profile() function is considered experimental and is ** subject to change in future versions of SQLite. */ -SQLITE_API SQLITE_DEPRECATED void *SQLITE_STDCALL sqlite3_trace(sqlite3*, - void(*xTrace)(void*,const char*), void*); -SQLITE_API SQLITE_DEPRECATED void *SQLITE_STDCALL sqlite3_profile(sqlite3*, +SQLITE_API void *SQLITE_STDCALL sqlite3_trace(sqlite3*, void(*xTrace)(void*,const char*), void*); +SQLITE_API SQLITE_EXPERIMENTAL void *SQLITE_STDCALL sqlite3_profile(sqlite3*, void(*xProfile)(void*,const char*,sqlite3_uint64), void*); -/* -** CAPI3REF: SQL Trace Event Codes -** KEYWORDS: SQLITE_TRACE -** -** These constants identify classes of events that can be monitored -** using the [sqlite3_trace_v2()] tracing logic. The third argument -** to [sqlite3_trace_v2()] is an OR-ed combination of one or more of -** the following constants. ^The first argument to the trace callback -** is one of the following constants. -** -** New tracing constants may be added in future releases. -** -** ^A trace callback has four arguments: xCallback(T,C,P,X). -** ^The T argument is one of the integer type codes above. -** ^The C argument is a copy of the context pointer passed in as the -** fourth argument to [sqlite3_trace_v2()]. -** The P and X arguments are pointers whose meanings depend on T. -** -**
    -** [[SQLITE_TRACE_STMT]]
    SQLITE_TRACE_STMT
    -**
    ^An SQLITE_TRACE_STMT callback is invoked when a prepared statement -** first begins running and possibly at other times during the -** execution of the prepared statement, such as at the start of each -** trigger subprogram. ^The P argument is a pointer to the -** [prepared statement]. ^The X argument is a pointer to a string which -** is the unexpanded SQL text of the prepared statement or an SQL comment -** that indicates the invocation of a trigger. ^The callback can compute -** the same text that would have been returned by the legacy [sqlite3_trace()] -** interface by using the X argument when X begins with "--" and invoking -** [sqlite3_expanded_sql(P)] otherwise. -** -** [[SQLITE_TRACE_PROFILE]]
    SQLITE_TRACE_PROFILE
    -**
    ^An SQLITE_TRACE_PROFILE callback provides approximately the same -** information as is provided by the [sqlite3_profile()] callback. -** ^The P argument is a pointer to the [prepared statement] and the -** X argument points to a 64-bit integer which is the estimated of -** the number of nanosecond that the prepared statement took to run. -** ^The SQLITE_TRACE_PROFILE callback is invoked when the statement finishes. -** -** [[SQLITE_TRACE_ROW]]
    SQLITE_TRACE_ROW
    -**
    ^An SQLITE_TRACE_ROW callback is invoked whenever a prepared -** statement generates a single row of result. -** ^The P argument is a pointer to the [prepared statement] and the -** X argument is unused. -** -** [[SQLITE_TRACE_CLOSE]]
    SQLITE_TRACE_CLOSE
    -**
    ^An SQLITE_TRACE_CLOSE callback is invoked when a database -** connection closes. -** ^The P argument is a pointer to the [database connection] object -** and the X argument is unused. -**
    -*/ -#define SQLITE_TRACE_STMT 0x01 -#define SQLITE_TRACE_PROFILE 0x02 -#define SQLITE_TRACE_ROW 0x04 -#define SQLITE_TRACE_CLOSE 0x08 - -/* -** CAPI3REF: SQL Trace Hook -** METHOD: sqlite3 -** -** ^The sqlite3_trace_v2(D,M,X,P) interface registers a trace callback -** function X against [database connection] D, using property mask M -** and context pointer P. ^If the X callback is -** NULL or if the M mask is zero, then tracing is disabled. The -** M argument should be the bitwise OR-ed combination of -** zero or more [SQLITE_TRACE] constants. -** -** ^Each call to either sqlite3_trace() or sqlite3_trace_v2() overrides -** (cancels) any prior calls to sqlite3_trace() or sqlite3_trace_v2(). -** -** ^The X callback is invoked whenever any of the events identified by -** mask M occur. ^The integer return value from the callback is currently -** ignored, though this may change in future releases. Callback -** implementations should return zero to ensure future compatibility. -** -** ^A trace callback is invoked with four arguments: callback(T,C,P,X). -** ^The T argument is one of the [SQLITE_TRACE] -** constants to indicate why the callback was invoked. -** ^The C argument is a copy of the context pointer. -** The P and X arguments are pointers whose meanings depend on T. -** -** The sqlite3_trace_v2() interface is intended to replace the legacy -** interfaces [sqlite3_trace()] and [sqlite3_profile()], both of which -** are deprecated. -*/ -SQLITE_API int SQLITE_STDCALL sqlite3_trace_v2( - sqlite3*, - unsigned uMask, - int(*xCallback)(unsigned,void*,void*,void*), - void *pCtx -); - /* ** CAPI3REF: Query Progress Callbacks ** METHOD: sqlite3 ** ** ^The sqlite3_progress_handler(D,N,X,P) interface causes the callback @@ -3516,39 +3399,15 @@ /* ** CAPI3REF: Retrieving Statement SQL ** METHOD: sqlite3_stmt ** -** ^The sqlite3_sql(P) interface returns a pointer to a copy of the UTF-8 -** SQL text used to create [prepared statement] P if P was -** created by either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()]. -** ^The sqlite3_expanded_sql(P) interface returns a pointer to a UTF-8 -** string containing the SQL text of prepared statement P with -** [bound parameters] expanded. -** -** ^(For example, if a prepared statement is created using the SQL -** text "SELECT $abc,:xyz" and if parameter $abc is bound to integer 2345 -** and parameter :xyz is unbound, then sqlite3_sql() will return -** the original string, "SELECT $abc,:xyz" but sqlite3_expanded_sql() -** will return "SELECT 2345,NULL".)^ -** -** ^The sqlite3_expanded_sql() interface returns NULL if insufficient memory -** is available to hold the result, or if the result would exceed the -** the maximum string length determined by the [SQLITE_LIMIT_LENGTH]. -** -** ^The [SQLITE_TRACE_SIZE_LIMIT] compile-time option limits the size of -** bound parameter expansions. ^The [SQLITE_OMIT_TRACE] compile-time -** option causes sqlite3_expanded_sql() to always return NULL. -** -** ^The string returned by sqlite3_sql(P) is managed by SQLite and is -** automatically freed when the prepared statement is finalized. -** ^The string returned by sqlite3_expanded_sql(P), on the other hand, -** is obtained from [sqlite3_malloc()] and must be free by the application -** by passing it to [sqlite3_free()]. +** ^This interface can be used to retrieve a saved copy of the original +** SQL text used to create a [prepared statement] if that statement was +** compiled using either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()]. */ SQLITE_API const char *SQLITE_STDCALL sqlite3_sql(sqlite3_stmt *pStmt); -SQLITE_API char *SQLITE_STDCALL sqlite3_expanded_sql(sqlite3_stmt *pStmt); /* ** CAPI3REF: Determine If An SQL Statement Writes The Database ** METHOD: sqlite3_stmt ** @@ -4702,17 +4561,16 @@ ** NULL if the metadata has been discarded. ** ^After each call to sqlite3_set_auxdata(C,N,P,X) where X is not NULL, ** SQLite will invoke the destructor function X with parameter P exactly ** once, when the metadata is discarded. ** SQLite is free to discard the metadata at any time, including:
      -**
    • ^(when the corresponding function parameter changes)^, or -**
    • ^(when [sqlite3_reset()] or [sqlite3_finalize()] is called for the -** SQL statement)^, or -**
    • ^(when sqlite3_set_auxdata() is invoked again on the same -** parameter)^, or -**
    • ^(during the original sqlite3_set_auxdata() call when a memory -** allocation error occurs.)^
    +**
  5. when the corresponding function parameter changes, or +**
  6. when [sqlite3_reset()] or [sqlite3_finalize()] is called for the +** SQL statement, or +**
  7. when sqlite3_set_auxdata() is invoked again on the same parameter, or +**
  8. during the original sqlite3_set_auxdata() call when a memory +** allocation error occurs. )^ ** ** Note the last bullet in particular. The destructor X in ** sqlite3_set_auxdata(C,N,P,X) might be called immediately, before the ** sqlite3_set_auxdata() interface even returns. Hence sqlite3_set_auxdata() ** should be called near the end of the function implementation and the @@ -5535,11 +5393,11 @@ ** interface returns SQLITE_OK and fills in the non-NULL pointers in ** the final five arguments with appropriate values if the specified ** column exists. ^The sqlite3_table_column_metadata() interface returns ** SQLITE_ERROR and if the specified column does not exist. ** ^If the column-name parameter to sqlite3_table_column_metadata() is a -** NULL pointer, then this routine simply checks for the existence of the +** NULL pointer, then this routine simply checks for the existance of the ** table and returns SQLITE_OK if the table exists and SQLITE_ERROR if it ** does not. ** ** ^The column is identified by the second, third and fourth parameters to ** this function. ^(The second parameter is either the name of the database @@ -5669,12 +5527,12 @@ ** to turn extension loading on and call it with onoff==0 to turn ** it back off again. ** ** ^This interface enables or disables both the C-API ** [sqlite3_load_extension()] and the SQL function [load_extension()]. -** ^(Use [sqlite3_db_config](db,[SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION],..) -** to enable or disable only the C-API.)^ +** Use [sqlite3_db_config](db,[SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION],..) +** to enable or disable only the C-API. ** ** Security warning: It is recommended that extension loading ** be disabled using the [SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION] method ** rather than this interface, so the [load_extension()] SQL function ** remains disabled. This will prevent SQL injections from giving attackers @@ -5690,11 +5548,11 @@ ** xEntryPoint() is the entry point for a statically linked [SQLite extension] ** that is to be automatically loaded into all new database connections. ** ** ^(Even though the function prototype shows that xEntryPoint() takes ** no arguments and returns void, SQLite invokes xEntryPoint() with three -** arguments and expects an integer result as if the signature of the +** arguments and expects and integer result as if the signature of the ** entry point where as follows: ** **
     **    int xEntryPoint(
     **      sqlite3 *db,
    @@ -5716,11 +5574,11 @@
     ** will be called more than once for each database connection that is opened.
     **
     ** See also: [sqlite3_reset_auto_extension()]
     ** and [sqlite3_cancel_auto_extension()]
     */
    -SQLITE_API int SQLITE_STDCALL sqlite3_auto_extension(void(*xEntryPoint)(void));
    +SQLITE_API int SQLITE_STDCALL sqlite3_auto_extension(void (*xEntryPoint)(void));
     
     /*
     ** CAPI3REF: Cancel Automatic Extension Loading
     **
     ** ^The [sqlite3_cancel_auto_extension(X)] interface unregisters the
    @@ -5728,11 +5586,11 @@
     ** [sqlite3_auto_extension(X)].  ^The [sqlite3_cancel_auto_extension(X)]
     ** routine returns 1 if initialization routine X was successfully 
     ** unregistered and it returns 0 if X was not on the list of initialization
     ** routines.
     */
    -SQLITE_API int SQLITE_STDCALL sqlite3_cancel_auto_extension(void(*xEntryPoint)(void));
    +SQLITE_API int SQLITE_STDCALL sqlite3_cancel_auto_extension(void (*xEntryPoint)(void));
     
     /*
     ** CAPI3REF: Reset Automatic Extension Loading
     **
     ** ^This interface disables all automatic extensions previously
    @@ -6904,22 +6762,10 @@
     ** [[SQLITE_DBSTATUS_CACHE_USED]] ^(
    SQLITE_DBSTATUS_CACHE_USED
    **
    This parameter returns the approximate number of bytes of heap ** memory used by all pager caches associated with the database connection.)^ ** ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_USED is always 0. ** -** [[SQLITE_DBSTATUS_CACHE_USED_SHARED]] -** ^(
    SQLITE_DBSTATUS_CACHE_USED_SHARED
    -**
    This parameter is similar to DBSTATUS_CACHE_USED, except that if a -** pager cache is shared between two or more connections the bytes of heap -** memory used by that pager cache is divided evenly between the attached -** connections.)^ In other words, if none of the pager caches associated -** with the database connection are shared, this request returns the same -** value as DBSTATUS_CACHE_USED. Or, if one or more or the pager caches are -** shared, the value returned by this call will be smaller than that returned -** by DBSTATUS_CACHE_USED. ^The highwater mark associated with -** SQLITE_DBSTATUS_CACHE_USED_SHARED is always 0. -** ** [[SQLITE_DBSTATUS_SCHEMA_USED]] ^(
    SQLITE_DBSTATUS_SCHEMA_USED
    **
    This parameter returns the approximate number of bytes of heap ** memory used to store the schema for all databases associated ** with the connection - main, temp, and any [ATTACH]-ed databases.)^ ** ^The full amount of memory used by the schemas is reported, even if the @@ -6973,12 +6819,11 @@ #define SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL 6 #define SQLITE_DBSTATUS_CACHE_HIT 7 #define SQLITE_DBSTATUS_CACHE_MISS 8 #define SQLITE_DBSTATUS_CACHE_WRITE 9 #define SQLITE_DBSTATUS_DEFERRED_FKS 10 -#define SQLITE_DBSTATUS_CACHE_USED_SHARED 11 -#define SQLITE_DBSTATUS_MAX 11 /* Largest defined DBSTATUS */ +#define SQLITE_DBSTATUS_MAX 10 /* Largest defined DBSTATUS */ /* ** CAPI3REF: Prepared Statement Status ** METHOD: sqlite3_stmt @@ -8130,11 +7975,11 @@ ** tables. ** ** ^The second parameter to the preupdate callback is a pointer to ** the [database connection] that registered the preupdate hook. ** ^The third parameter to the preupdate callback is one of the constants -** [SQLITE_INSERT], [SQLITE_DELETE], or [SQLITE_UPDATE] to identify the +** [SQLITE_INSERT], [SQLITE_DELETE], or [SQLITE_UPDATE] to indentify the ** kind of update operation that is about to occur. ** ^(The fourth parameter to the preupdate callback is the name of the ** database within the database connection that is being modified. This ** will be "main" for the main database or "temp" for TEMP tables or ** the name given after the AS keyword in the [ATTACH] statement for attached @@ -8357,11 +8202,11 @@ #endif #ifdef __cplusplus } /* End of the 'extern "C"' block */ #endif -#endif /* SQLITE3_H */ +#endif /* _SQLITE3_H_ */ /******** Begin file sqlite3rtree.h *********/ /* ** 2010 August 30 ** @@ -10077,11 +9922,11 @@ ** 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: ** ** xCreate: -** This function is used to allocate and initialize a tokenizer instance. +** This function is used to allocate and inititalize a tokenizer instance. ** A tokenizer instance is required to actually tokenize text. ** ** The first argument passed to this function is a copy of the (void*) ** pointer provided by the application when the fts5_tokenizer object ** was registered with FTS5 (the third argument to xCreateTokenizer()). @@ -10336,7 +10181,8 @@ #ifdef __cplusplus } /* end of the 'extern "C"' block */ #endif #endif /* _FTS5_H */ + /******** End of fts5.h *********/ Index: SQLite.Interop/src/core/sqlite3ext.h ================================================================== --- SQLite.Interop/src/core/sqlite3ext.h +++ SQLite.Interop/src/core/sqlite3ext.h @@ -13,13 +13,15 @@ ** shared libraries that want to be imported as extensions into ** an SQLite instance. Shared libraries that intend to be loaded ** as extensions by SQLite should #include this file instead of ** sqlite3.h. */ -#ifndef SQLITE3EXT_H -#define SQLITE3EXT_H +#ifndef _SQLITE3EXT_H_ +#define _SQLITE3EXT_H_ #include "sqlite3.h" + +typedef struct sqlite3_api_routines sqlite3_api_routines; /* ** The following structure holds pointers to all of the SQLite API ** routines. ** @@ -277,25 +279,12 @@ int (*status64)(int,sqlite3_int64*,sqlite3_int64*,int); int (*strlike)(const char*,const char*,unsigned int); int (*db_cacheflush)(sqlite3*); /* Version 3.12.0 and later */ int (*system_errno)(sqlite3*); - /* Version 3.14.0 and later */ - int (*trace_v2)(sqlite3*,unsigned,int(*)(unsigned,void*,void*,void*),void*); - char *(*expanded_sql)(sqlite3_stmt*); }; -/* -** This is the function signature used for all extension entry points. It -** is also defined in the file "loadext.c". -*/ -typedef int (*sqlite3_loadext_entry)( - sqlite3 *db, /* Handle to the database. */ - char **pzErrMsg, /* Used to set error string on failure. */ - const sqlite3_api_routines *pThunk /* Extension API function pointers. */ -); - /* ** The following macros redefine the API routines so that they are ** redirected through the global sqlite3_api structure. ** ** This header file is also used by the loadext.c source file @@ -535,13 +524,10 @@ #define sqlite3_status64 sqlite3_api->status64 #define sqlite3_strlike sqlite3_api->strlike #define sqlite3_db_cacheflush sqlite3_api->db_cacheflush /* Version 3.12.0 and later */ #define sqlite3_system_errno sqlite3_api->system_errno -/* Version 3.14.0 and later */ -#define sqlite3_trace_v2 sqlite3_api->trace_v2 -#define sqlite3_expanded_sql sqlite3_api->expanded_sql #endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */ #if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) /* This case when the file really is being compiled as a loadable ** extension */ @@ -555,6 +541,6 @@ # define SQLITE_EXTENSION_INIT1 /*no-op*/ # define SQLITE_EXTENSION_INIT2(v) (void)v; /* unused parameter */ # define SQLITE_EXTENSION_INIT3 /*no-op*/ #endif -#endif /* SQLITE3EXT_H */ +#endif /* _SQLITE3EXT_H_ */ Index: SQLite.Interop/src/ext/fts5.c ================================================================== --- SQLite.Interop/src/ext/fts5.c +++ SQLite.Interop/src/ext/fts5.c @@ -328,11 +328,11 @@ ** 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: ** ** xCreate: -** This function is used to allocate and initialize a tokenizer instance. +** This function is used to allocate and inititalize a tokenizer instance. ** A tokenizer instance is required to actually tokenize text. ** ** The first argument passed to this function is a copy of the (void*) ** pointer provided by the application when the fts5_tokenizer object ** was registered with FTS5 (the third argument to xCreateTokenizer()). @@ -587,10 +587,11 @@ #ifdef __cplusplus } /* end of the 'extern "C"' block */ #endif #endif /* _FTS5_H */ + #line 1 "fts5Int.h" /* ** 2014 May 31 ** @@ -1277,10 +1278,11 @@ static Fts5PoslistPopulator *sqlite3Fts5ExprClearPoslists(Fts5Expr*, int); static int sqlite3Fts5ExprPopulatePoslists( Fts5Config*, Fts5Expr*, Fts5PoslistPopulator*, int, const char*, int ); static void sqlite3Fts5ExprCheckPoslists(Fts5Expr*, i64); +static void sqlite3Fts5ExprClearEof(Fts5Expr*); static int sqlite3Fts5ExprClonePhrase(Fts5Expr*, int, Fts5Expr**); static int sqlite3Fts5ExprPhraseCollist(Fts5Expr *, int, const u8 **, int *); @@ -1696,22 +1698,21 @@ typedef struct fts5yyStackEntry fts5yyStackEntry; /* The state of the parser is completely contained in an instance of ** the following structure */ struct fts5yyParser { - fts5yyStackEntry *fts5yytos; /* Pointer to top element of the stack */ + int fts5yyidx; /* Index of top element in stack */ #ifdef fts5YYTRACKMAXSTACKDEPTH - int fts5yyhwm; /* High-water mark of the stack */ + int fts5yyidxMax; /* Maximum value of fts5yyidx */ #endif #ifndef fts5YYNOERRORRECOVERY int fts5yyerrcnt; /* Shifts left before out of the error */ #endif sqlite3Fts5ParserARG_SDECL /* A place to hold %extra_argument */ #if fts5YYSTACKDEPTH<=0 int fts5yystksz; /* Current side of the stack */ fts5yyStackEntry *fts5yystack; /* The parser's stack */ - fts5yyStackEntry fts5yystk0; /* First stack entry */ #else fts5yyStackEntry fts5yystack[fts5YYSTACKDEPTH]; /* The parser's stack */ #endif }; typedef struct fts5yyParser fts5yyParser; @@ -1794,38 +1795,28 @@ #endif /* NDEBUG */ #if fts5YYSTACKDEPTH<=0 /* -** Try to increase the size of the parser stack. Return the number -** of errors. Return 0 on success. +** Try to increase the size of the parser stack. */ -static int fts5yyGrowStack(fts5yyParser *p){ +static void fts5yyGrowStack(fts5yyParser *p){ int newSize; - int idx; fts5yyStackEntry *pNew; newSize = p->fts5yystksz*2 + 100; - idx = p->fts5yytos ? (int)(p->fts5yytos - p->fts5yystack) : 0; - if( p->fts5yystack==&p->fts5yystk0 ){ - pNew = malloc(newSize*sizeof(pNew[0])); - if( pNew ) pNew[0] = p->fts5yystk0; - }else{ - pNew = realloc(p->fts5yystack, newSize*sizeof(pNew[0])); - } + pNew = realloc(p->fts5yystack, newSize*sizeof(pNew[0])); if( pNew ){ p->fts5yystack = pNew; - p->fts5yytos = &p->fts5yystack[idx]; + p->fts5yystksz = newSize; #ifndef NDEBUG if( fts5yyTraceFILE ){ - fprintf(fts5yyTraceFILE,"%sStack grows from %d to %d entries.\n", - fts5yyTracePrompt, p->fts5yystksz, newSize); + fprintf(fts5yyTraceFILE,"%sStack grows to %d entries!\n", + fts5yyTracePrompt, p->fts5yystksz); } #endif - p->fts5yystksz = newSize; } - return pNew==0; } #endif /* Datatype of the argument to the memory allocated passed as the ** second argument to sqlite3Fts5ParserAlloc() below. This can be changed by @@ -1850,28 +1841,19 @@ */ static void *sqlite3Fts5ParserAlloc(void *(*mallocProc)(fts5YYMALLOCARGTYPE)){ fts5yyParser *pParser; pParser = (fts5yyParser*)(*mallocProc)( (fts5YYMALLOCARGTYPE)sizeof(fts5yyParser) ); if( pParser ){ + pParser->fts5yyidx = -1; #ifdef fts5YYTRACKMAXSTACKDEPTH - pParser->fts5yyhwm = 0; + pParser->fts5yyidxMax = 0; #endif #if fts5YYSTACKDEPTH<=0 - pParser->fts5yytos = NULL; pParser->fts5yystack = NULL; pParser->fts5yystksz = 0; - if( fts5yyGrowStack(pParser) ){ - pParser->fts5yystack = &pParser->fts5yystk0; - pParser->fts5yystksz = 1; - } -#endif -#ifndef fts5YYNOERRORRECOVERY - pParser->fts5yyerrcnt = -1; -#endif - pParser->fts5yytos = pParser->fts5yystack; - pParser->fts5yystack[0].stateno = 0; - pParser->fts5yystack[0].major = 0; + fts5yyGrowStack(pParser); +#endif } return pParser; } /* The following function deletes the "minor type" or semantic value @@ -1901,43 +1883,43 @@ /********* Begin destructor definitions ***************************************/ case 15: /* input */ { #line 83 "fts5parse.y" (void)pParse; -#line 509 "fts5parse.c" +#line 489 "fts5parse.c" } break; case 16: /* expr */ case 17: /* cnearset */ case 18: /* exprlist */ { #line 89 "fts5parse.y" sqlite3Fts5ParseNodeFree((fts5yypminor->fts5yy18)); -#line 518 "fts5parse.c" +#line 498 "fts5parse.c" } break; case 19: /* nearset */ case 22: /* nearphrases */ { #line 137 "fts5parse.y" sqlite3Fts5ParseNearsetFree((fts5yypminor->fts5yy26)); -#line 526 "fts5parse.c" +#line 506 "fts5parse.c" } break; case 20: /* colset */ case 21: /* colsetlist */ { #line 119 "fts5parse.y" sqlite3_free((fts5yypminor->fts5yy3)); -#line 534 "fts5parse.c" +#line 514 "fts5parse.c" } break; case 23: /* phrase */ { #line 168 "fts5parse.y" sqlite3Fts5ParsePhraseFree((fts5yypminor->fts5yy11)); -#line 541 "fts5parse.c" +#line 521 "fts5parse.c" } break; /********* End destructor definitions *****************************************/ default: break; /* If no destructor action specified: do nothing */ } @@ -1949,13 +1931,12 @@ ** If there is a destructor routine associated with the token which ** is popped from the stack, then call it. */ static void fts5yy_pop_parser_stack(fts5yyParser *pParser){ fts5yyStackEntry *fts5yytos; - assert( pParser->fts5yytos!=0 ); - assert( pParser->fts5yytos > pParser->fts5yystack ); - fts5yytos = pParser->fts5yytos--; + assert( pParser->fts5yyidx>=0 ); + fts5yytos = &pParser->fts5yystack[pParser->fts5yyidx--]; #ifndef NDEBUG if( fts5yyTraceFILE ){ fprintf(fts5yyTraceFILE,"%sPopping %s\n", fts5yyTracePrompt, fts5yyTokenName[fts5yytos->major]); @@ -1978,13 +1959,13 @@ ){ fts5yyParser *pParser = (fts5yyParser*)p; #ifndef fts5YYPARSEFREENEVERNULL if( pParser==0 ) return; #endif - while( pParser->fts5yytos>pParser->fts5yystack ) fts5yy_pop_parser_stack(pParser); + while( pParser->fts5yyidx>=0 ) fts5yy_pop_parser_stack(pParser); #if fts5YYSTACKDEPTH<=0 - if( pParser->fts5yystack!=&pParser->fts5yystk0 ) free(pParser->fts5yystack); + free(pParser->fts5yystack); #endif (*freeProc)((void*)pParser); } /* @@ -1991,11 +1972,11 @@ ** Return the peak depth of the stack for a parser. */ #ifdef fts5YYTRACKMAXSTACKDEPTH static int sqlite3Fts5ParserStackPeak(void *p){ fts5yyParser *pParser = (fts5yyParser*)p; - return pParser->fts5yyhwm; + return pParser->fts5yyidxMax; } #endif /* ** Find the appropriate action for a parser given the terminal @@ -2004,11 +1985,11 @@ static unsigned int fts5yy_find_shift_action( fts5yyParser *pParser, /* The parser */ fts5YYCODETYPE iLookAhead /* The look-ahead token */ ){ int i; - int stateno = pParser->fts5yytos->stateno; + int stateno = pParser->fts5yystack[pParser->fts5yyidx].stateno; if( stateno>=fts5YY_MIN_REDUCE ) return stateno; assert( stateno <= fts5YY_SHIFT_COUNT ); do{ i = fts5yy_shift_ofst[stateno]; @@ -2097,24 +2078,24 @@ /* ** The following routine is called if the stack overflows. */ static void fts5yyStackOverflow(fts5yyParser *fts5yypParser){ sqlite3Fts5ParserARG_FETCH; - fts5yypParser->fts5yytos--; + fts5yypParser->fts5yyidx--; #ifndef NDEBUG if( fts5yyTraceFILE ){ fprintf(fts5yyTraceFILE,"%sStack Overflow!\n",fts5yyTracePrompt); } #endif - while( fts5yypParser->fts5yytos>fts5yypParser->fts5yystack ) fts5yy_pop_parser_stack(fts5yypParser); + while( fts5yypParser->fts5yyidx>=0 ) fts5yy_pop_parser_stack(fts5yypParser); /* Here code is inserted which will execute if the parser ** stack every overflows */ /******** Begin %stack_overflow code ******************************************/ #line 36 "fts5parse.y" sqlite3Fts5ParseError(pParse, "fts5: parser stack overflow"); -#line 718 "fts5parse.c" +#line 697 "fts5parse.c" /******** End %stack_overflow code ********************************************/ sqlite3Fts5ParserARG_STORE; /* Suppress warning about unused %extra_argument var */ } /* @@ -2123,15 +2104,15 @@ #ifndef NDEBUG static void fts5yyTraceShift(fts5yyParser *fts5yypParser, int fts5yyNewState){ if( fts5yyTraceFILE ){ if( fts5yyNewStatefts5yytos->major], + fts5yyTracePrompt,fts5yyTokenName[fts5yypParser->fts5yystack[fts5yypParser->fts5yyidx].major], fts5yyNewState); }else{ fprintf(fts5yyTraceFILE,"%sShift '%s'\n", - fts5yyTracePrompt,fts5yyTokenName[fts5yypParser->fts5yytos->major]); + fts5yyTracePrompt,fts5yyTokenName[fts5yypParser->fts5yystack[fts5yypParser->fts5yyidx].major]); } } } #else # define fts5yyTraceShift(X,Y) @@ -2145,34 +2126,31 @@ int fts5yyNewState, /* The new state to shift in */ int fts5yyMajor, /* The major token to shift in */ sqlite3Fts5ParserFTS5TOKENTYPE fts5yyMinor /* The minor token to shift in */ ){ fts5yyStackEntry *fts5yytos; - fts5yypParser->fts5yytos++; + fts5yypParser->fts5yyidx++; #ifdef fts5YYTRACKMAXSTACKDEPTH - if( (int)(fts5yypParser->fts5yytos - fts5yypParser->fts5yystack)>fts5yypParser->fts5yyhwm ){ - fts5yypParser->fts5yyhwm++; - assert( fts5yypParser->fts5yyhwm == (int)(fts5yypParser->fts5yytos - fts5yypParser->fts5yystack) ); + if( fts5yypParser->fts5yyidx>fts5yypParser->fts5yyidxMax ){ + fts5yypParser->fts5yyidxMax = fts5yypParser->fts5yyidx; } #endif #if fts5YYSTACKDEPTH>0 - if( fts5yypParser->fts5yytos>=&fts5yypParser->fts5yystack[fts5YYSTACKDEPTH] ){ + if( fts5yypParser->fts5yyidx>=fts5YYSTACKDEPTH ){ fts5yyStackOverflow(fts5yypParser); return; } #else - if( fts5yypParser->fts5yytos>=&fts5yypParser->fts5yystack[fts5yypParser->fts5yystksz] ){ - if( fts5yyGrowStack(fts5yypParser) ){ + if( fts5yypParser->fts5yyidx>=fts5yypParser->fts5yystksz ){ + fts5yyGrowStack(fts5yypParser); + if( fts5yypParser->fts5yyidx>=fts5yypParser->fts5yystksz ){ fts5yyStackOverflow(fts5yypParser); return; } } #endif - if( fts5yyNewState > fts5YY_MAX_SHIFT ){ - fts5yyNewState += fts5YY_MIN_REDUCE - fts5YY_MIN_SHIFTREDUCE; - } - fts5yytos = fts5yypParser->fts5yytos; + fts5yytos = &fts5yypParser->fts5yystack[fts5yypParser->fts5yyidx]; fts5yytos->stateno = (fts5YYACTIONTYPE)fts5yyNewState; fts5yytos->major = (fts5YYCODETYPE)fts5yyMajor; fts5yytos->minor.fts5yy0 = fts5yyMinor; fts5yyTraceShift(fts5yypParser, fts5yyNewState); } @@ -2223,11 +2201,11 @@ int fts5yygoto; /* The next state */ int fts5yyact; /* The next action */ fts5yyStackEntry *fts5yymsp; /* The top of the parser's stack */ int fts5yysize; /* Amount to pop the stack */ sqlite3Fts5ParserARG_FETCH; - fts5yymsp = fts5yypParser->fts5yytos; + fts5yymsp = &fts5yypParser->fts5yystack[fts5yypParser->fts5yyidx]; #ifndef NDEBUG if( fts5yyTraceFILE && fts5yyruleno<(int)(sizeof(fts5yyRuleName)/sizeof(fts5yyRuleName[0])) ){ fts5yysize = fts5yyRuleInfo[fts5yyruleno].nrhs; fprintf(fts5yyTraceFILE, "%sReduce [%s], go to state %d.\n", fts5yyTracePrompt, fts5yyRuleName[fts5yyruleno], fts5yymsp[-fts5yysize].stateno); @@ -2237,27 +2215,26 @@ /* Check that the stack is large enough to grow by a single entry ** if the RHS of the rule is empty. This ensures that there is room ** enough on the stack to push the LHS value */ if( fts5yyRuleInfo[fts5yyruleno].nrhs==0 ){ #ifdef fts5YYTRACKMAXSTACKDEPTH - if( (int)(fts5yypParser->fts5yytos - fts5yypParser->fts5yystack)>fts5yypParser->fts5yyhwm ){ - fts5yypParser->fts5yyhwm++; - assert( fts5yypParser->fts5yyhwm == (int)(fts5yypParser->fts5yytos - fts5yypParser->fts5yystack)); + if( fts5yypParser->fts5yyidx>fts5yypParser->fts5yyidxMax ){ + fts5yypParser->fts5yyidxMax = fts5yypParser->fts5yyidx; } #endif #if fts5YYSTACKDEPTH>0 - if( fts5yypParser->fts5yytos>=&fts5yypParser->fts5yystack[fts5YYSTACKDEPTH-1] ){ + if( fts5yypParser->fts5yyidx>=fts5YYSTACKDEPTH-1 ){ fts5yyStackOverflow(fts5yypParser); return; } #else - if( fts5yypParser->fts5yytos>=&fts5yypParser->fts5yystack[fts5yypParser->fts5yystksz-1] ){ - if( fts5yyGrowStack(fts5yypParser) ){ + if( fts5yypParser->fts5yyidx>=fts5yypParser->fts5yystksz-1 ){ + fts5yyGrowStack(fts5yypParser); + if( fts5yypParser->fts5yyidx>=fts5yypParser->fts5yystksz-1 ){ fts5yyStackOverflow(fts5yypParser); return; } - fts5yymsp = fts5yypParser->fts5yytos; } #endif } switch( fts5yyruleno ){ @@ -2272,168 +2249,168 @@ /********** Begin reduce actions **********************************************/ fts5YYMINORTYPE fts5yylhsminor; case 0: /* input ::= expr */ #line 82 "fts5parse.y" { sqlite3Fts5ParseFinished(pParse, fts5yymsp[0].minor.fts5yy18); } -#line 880 "fts5parse.c" +#line 855 "fts5parse.c" break; case 1: /* expr ::= expr AND expr */ #line 92 "fts5parse.y" { fts5yylhsminor.fts5yy18 = sqlite3Fts5ParseNode(pParse, FTS5_AND, fts5yymsp[-2].minor.fts5yy18, fts5yymsp[0].minor.fts5yy18, 0); } -#line 887 "fts5parse.c" +#line 862 "fts5parse.c" fts5yymsp[-2].minor.fts5yy18 = fts5yylhsminor.fts5yy18; break; case 2: /* expr ::= expr OR expr */ #line 95 "fts5parse.y" { fts5yylhsminor.fts5yy18 = sqlite3Fts5ParseNode(pParse, FTS5_OR, fts5yymsp[-2].minor.fts5yy18, fts5yymsp[0].minor.fts5yy18, 0); } -#line 895 "fts5parse.c" +#line 870 "fts5parse.c" fts5yymsp[-2].minor.fts5yy18 = fts5yylhsminor.fts5yy18; break; case 3: /* expr ::= expr NOT expr */ #line 98 "fts5parse.y" { fts5yylhsminor.fts5yy18 = sqlite3Fts5ParseNode(pParse, FTS5_NOT, fts5yymsp[-2].minor.fts5yy18, fts5yymsp[0].minor.fts5yy18, 0); } -#line 903 "fts5parse.c" +#line 878 "fts5parse.c" fts5yymsp[-2].minor.fts5yy18 = fts5yylhsminor.fts5yy18; break; case 4: /* expr ::= LP expr RP */ #line 102 "fts5parse.y" {fts5yymsp[-2].minor.fts5yy18 = fts5yymsp[-1].minor.fts5yy18;} -#line 909 "fts5parse.c" +#line 884 "fts5parse.c" break; case 5: /* expr ::= exprlist */ case 6: /* exprlist ::= cnearset */ fts5yytestcase(fts5yyruleno==6); #line 103 "fts5parse.y" {fts5yylhsminor.fts5yy18 = fts5yymsp[0].minor.fts5yy18;} -#line 915 "fts5parse.c" +#line 890 "fts5parse.c" fts5yymsp[0].minor.fts5yy18 = fts5yylhsminor.fts5yy18; break; case 7: /* exprlist ::= exprlist cnearset */ #line 106 "fts5parse.y" { fts5yylhsminor.fts5yy18 = sqlite3Fts5ParseImplicitAnd(pParse, fts5yymsp[-1].minor.fts5yy18, fts5yymsp[0].minor.fts5yy18); } -#line 923 "fts5parse.c" +#line 898 "fts5parse.c" fts5yymsp[-1].minor.fts5yy18 = fts5yylhsminor.fts5yy18; break; case 8: /* cnearset ::= nearset */ #line 110 "fts5parse.y" { fts5yylhsminor.fts5yy18 = sqlite3Fts5ParseNode(pParse, FTS5_STRING, 0, 0, fts5yymsp[0].minor.fts5yy26); } -#line 931 "fts5parse.c" +#line 906 "fts5parse.c" fts5yymsp[0].minor.fts5yy18 = fts5yylhsminor.fts5yy18; break; case 9: /* cnearset ::= colset COLON nearset */ #line 113 "fts5parse.y" { sqlite3Fts5ParseSetColset(pParse, fts5yymsp[0].minor.fts5yy26, fts5yymsp[-2].minor.fts5yy3); fts5yylhsminor.fts5yy18 = sqlite3Fts5ParseNode(pParse, FTS5_STRING, 0, 0, fts5yymsp[0].minor.fts5yy26); } -#line 940 "fts5parse.c" +#line 915 "fts5parse.c" fts5yymsp[-2].minor.fts5yy18 = fts5yylhsminor.fts5yy18; break; case 10: /* colset ::= LCP colsetlist RCP */ #line 123 "fts5parse.y" { fts5yymsp[-2].minor.fts5yy3 = fts5yymsp[-1].minor.fts5yy3; } -#line 946 "fts5parse.c" +#line 921 "fts5parse.c" break; case 11: /* colset ::= STRING */ #line 124 "fts5parse.y" { fts5yylhsminor.fts5yy3 = sqlite3Fts5ParseColset(pParse, 0, &fts5yymsp[0].minor.fts5yy0); } -#line 953 "fts5parse.c" +#line 928 "fts5parse.c" fts5yymsp[0].minor.fts5yy3 = fts5yylhsminor.fts5yy3; break; case 12: /* colsetlist ::= colsetlist STRING */ #line 128 "fts5parse.y" { fts5yylhsminor.fts5yy3 = sqlite3Fts5ParseColset(pParse, fts5yymsp[-1].minor.fts5yy3, &fts5yymsp[0].minor.fts5yy0); } -#line 960 "fts5parse.c" +#line 935 "fts5parse.c" fts5yymsp[-1].minor.fts5yy3 = fts5yylhsminor.fts5yy3; break; case 13: /* colsetlist ::= STRING */ #line 130 "fts5parse.y" { fts5yylhsminor.fts5yy3 = sqlite3Fts5ParseColset(pParse, 0, &fts5yymsp[0].minor.fts5yy0); } -#line 968 "fts5parse.c" +#line 943 "fts5parse.c" fts5yymsp[0].minor.fts5yy3 = fts5yylhsminor.fts5yy3; break; case 14: /* nearset ::= phrase */ #line 140 "fts5parse.y" { fts5yylhsminor.fts5yy26 = sqlite3Fts5ParseNearset(pParse, 0, fts5yymsp[0].minor.fts5yy11); } -#line 974 "fts5parse.c" +#line 949 "fts5parse.c" fts5yymsp[0].minor.fts5yy26 = fts5yylhsminor.fts5yy26; break; case 15: /* nearset ::= STRING LP nearphrases neardist_opt RP */ #line 141 "fts5parse.y" { sqlite3Fts5ParseNear(pParse, &fts5yymsp[-4].minor.fts5yy0); sqlite3Fts5ParseSetDistance(pParse, fts5yymsp[-2].minor.fts5yy26, &fts5yymsp[-1].minor.fts5yy0); fts5yylhsminor.fts5yy26 = fts5yymsp[-2].minor.fts5yy26; } -#line 984 "fts5parse.c" +#line 959 "fts5parse.c" fts5yymsp[-4].minor.fts5yy26 = fts5yylhsminor.fts5yy26; break; case 16: /* nearphrases ::= phrase */ #line 147 "fts5parse.y" { fts5yylhsminor.fts5yy26 = sqlite3Fts5ParseNearset(pParse, 0, fts5yymsp[0].minor.fts5yy11); } -#line 992 "fts5parse.c" +#line 967 "fts5parse.c" fts5yymsp[0].minor.fts5yy26 = fts5yylhsminor.fts5yy26; break; case 17: /* nearphrases ::= nearphrases phrase */ #line 150 "fts5parse.y" { fts5yylhsminor.fts5yy26 = sqlite3Fts5ParseNearset(pParse, fts5yymsp[-1].minor.fts5yy26, fts5yymsp[0].minor.fts5yy11); } -#line 1000 "fts5parse.c" +#line 975 "fts5parse.c" fts5yymsp[-1].minor.fts5yy26 = fts5yylhsminor.fts5yy26; break; case 18: /* neardist_opt ::= */ #line 157 "fts5parse.y" { fts5yymsp[1].minor.fts5yy0.p = 0; fts5yymsp[1].minor.fts5yy0.n = 0; } -#line 1006 "fts5parse.c" +#line 981 "fts5parse.c" break; case 19: /* neardist_opt ::= COMMA STRING */ #line 158 "fts5parse.y" { fts5yymsp[-1].minor.fts5yy0 = fts5yymsp[0].minor.fts5yy0; } -#line 1011 "fts5parse.c" +#line 986 "fts5parse.c" break; case 20: /* phrase ::= phrase PLUS STRING star_opt */ #line 170 "fts5parse.y" { fts5yylhsminor.fts5yy11 = sqlite3Fts5ParseTerm(pParse, fts5yymsp[-3].minor.fts5yy11, &fts5yymsp[-1].minor.fts5yy0, fts5yymsp[0].minor.fts5yy20); } -#line 1018 "fts5parse.c" +#line 993 "fts5parse.c" fts5yymsp[-3].minor.fts5yy11 = fts5yylhsminor.fts5yy11; break; case 21: /* phrase ::= STRING star_opt */ #line 173 "fts5parse.y" { fts5yylhsminor.fts5yy11 = sqlite3Fts5ParseTerm(pParse, 0, &fts5yymsp[-1].minor.fts5yy0, fts5yymsp[0].minor.fts5yy20); } -#line 1026 "fts5parse.c" +#line 1001 "fts5parse.c" fts5yymsp[-1].minor.fts5yy11 = fts5yylhsminor.fts5yy11; break; case 22: /* star_opt ::= STAR */ #line 182 "fts5parse.y" { fts5yymsp[0].minor.fts5yy20 = 1; } -#line 1032 "fts5parse.c" +#line 1007 "fts5parse.c" break; case 23: /* star_opt ::= */ #line 183 "fts5parse.y" { fts5yymsp[1].minor.fts5yy20 = 0; } -#line 1037 "fts5parse.c" +#line 1012 "fts5parse.c" break; default: break; /********** End reduce actions ************************************************/ }; @@ -2440,21 +2417,19 @@ assert( fts5yyrulenofts5YY_MAX_SHIFT ){ - fts5yyact += fts5YY_MIN_REDUCE - fts5YY_MIN_SHIFTREDUCE; - } + if( fts5yyact>fts5YY_MAX_SHIFT ) fts5yyact += fts5YY_MIN_REDUCE - fts5YY_MIN_SHIFTREDUCE; + fts5yypParser->fts5yyidx -= fts5yysize - 1; fts5yymsp -= fts5yysize-1; - fts5yypParser->fts5yytos = fts5yymsp; fts5yymsp->stateno = (fts5YYACTIONTYPE)fts5yyact; fts5yymsp->major = (fts5YYCODETYPE)fts5yygoto; fts5yyTraceShift(fts5yypParser, fts5yyact); }else{ assert( fts5yyact == fts5YY_ACCEPT_ACTION ); - fts5yypParser->fts5yytos -= fts5yysize; + fts5yypParser->fts5yyidx -= fts5yysize; fts5yy_accept(fts5yypParser); } } /* @@ -2468,11 +2443,11 @@ #ifndef NDEBUG if( fts5yyTraceFILE ){ fprintf(fts5yyTraceFILE,"%sFail!\n",fts5yyTracePrompt); } #endif - while( fts5yypParser->fts5yytos>fts5yypParser->fts5yystack ) fts5yy_pop_parser_stack(fts5yypParser); + while( fts5yypParser->fts5yyidx>=0 ) fts5yy_pop_parser_stack(fts5yypParser); /* Here code is inserted which will be executed whenever the ** parser fails */ /************ Begin %parse_failure code ***************************************/ /************ End %parse_failure code *****************************************/ sqlite3Fts5ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */ @@ -2494,11 +2469,11 @@ UNUSED_PARAM(fts5yymajor); /* Silence a compiler warning */ sqlite3Fts5ParseError( pParse, "fts5: syntax error near \"%.*s\"",FTS5TOKEN.n,FTS5TOKEN.p ); -#line 1102 "fts5parse.c" +#line 1075 "fts5parse.c" /************ End %syntax_error code ******************************************/ sqlite3Fts5ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */ } /* @@ -2511,14 +2486,11 @@ #ifndef NDEBUG if( fts5yyTraceFILE ){ fprintf(fts5yyTraceFILE,"%sAccept!\n",fts5yyTracePrompt); } #endif -#ifndef fts5YYNOERRORRECOVERY - fts5yypParser->fts5yyerrcnt = -1; -#endif - assert( fts5yypParser->fts5yytos==fts5yypParser->fts5yystack ); + while( fts5yypParser->fts5yyidx>=0 ) fts5yy_pop_parser_stack(fts5yypParser); /* Here code is inserted which will be executed whenever the ** parser accepts */ /*********** Begin %parse_accept code *****************************************/ /*********** End %parse_accept code *******************************************/ sqlite3Fts5ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */ @@ -2557,12 +2529,32 @@ #ifdef fts5YYERRORSYMBOL int fts5yyerrorhit = 0; /* True if fts5yymajor has invoked an error */ #endif fts5yyParser *fts5yypParser; /* The parser */ + /* (re)initialize the parser, if necessary */ fts5yypParser = (fts5yyParser*)fts5yyp; - assert( fts5yypParser->fts5yytos!=0 ); + if( fts5yypParser->fts5yyidx<0 ){ +#if fts5YYSTACKDEPTH<=0 + if( fts5yypParser->fts5yystksz <=0 ){ + fts5yyStackOverflow(fts5yypParser); + return; + } +#endif + fts5yypParser->fts5yyidx = 0; +#ifndef fts5YYNOERRORRECOVERY + fts5yypParser->fts5yyerrcnt = -1; +#endif + fts5yypParser->fts5yystack[0].stateno = 0; + fts5yypParser->fts5yystack[0].major = 0; +#ifndef NDEBUG + if( fts5yyTraceFILE ){ + fprintf(fts5yyTraceFILE,"%sInitialize. Empty stack. State 0\n", + fts5yyTracePrompt); + } +#endif + } #if !defined(fts5YYERRORSYMBOL) && !defined(fts5YYNOERRORRECOVERY) fts5yyendofinput = (fts5yymajor==0); #endif sqlite3Fts5ParserARG_STORE; @@ -2573,10 +2565,11 @@ #endif do{ fts5yyact = fts5yy_find_shift_action(fts5yypParser,(fts5YYCODETYPE)fts5yymajor); if( fts5yyact <= fts5YY_MAX_SHIFTREDUCE ){ + if( fts5yyact > fts5YY_MAX_SHIFT ) fts5yyact += fts5YY_MIN_REDUCE - fts5YY_MIN_SHIFTREDUCE; fts5yy_shift(fts5yypParser,fts5yyact,fts5yymajor,fts5yyminor); #ifndef fts5YYNOERRORRECOVERY fts5yypParser->fts5yyerrcnt--; #endif fts5yymajor = fts5YYNOCODE; @@ -2614,11 +2607,11 @@ ** */ if( fts5yypParser->fts5yyerrcnt<0 ){ fts5yy_syntax_error(fts5yypParser,fts5yymajor,fts5yyminor); } - fts5yymx = fts5yypParser->fts5yytos->major; + fts5yymx = fts5yypParser->fts5yystack[fts5yypParser->fts5yyidx].major; if( fts5yymx==fts5YYERRORSYMBOL || fts5yyerrorhit ){ #ifndef NDEBUG if( fts5yyTraceFILE ){ fprintf(fts5yyTraceFILE,"%sDiscard input token %s\n", fts5yyTracePrompt,fts5yyTokenName[fts5yymajor]); @@ -2625,24 +2618,22 @@ } #endif fts5yy_destructor(fts5yypParser, (fts5YYCODETYPE)fts5yymajor, &fts5yyminorunion); fts5yymajor = fts5YYNOCODE; }else{ - while( fts5yypParser->fts5yytos >= &fts5yypParser->fts5yystack - && fts5yymx != fts5YYERRORSYMBOL - && (fts5yyact = fts5yy_find_reduce_action( - fts5yypParser->fts5yytos->stateno, + while( + fts5yypParser->fts5yyidx >= 0 && + fts5yymx != fts5YYERRORSYMBOL && + (fts5yyact = fts5yy_find_reduce_action( + fts5yypParser->fts5yystack[fts5yypParser->fts5yyidx].stateno, fts5YYERRORSYMBOL)) >= fts5YY_MIN_REDUCE ){ fts5yy_pop_parser_stack(fts5yypParser); } - if( fts5yypParser->fts5yytos < fts5yypParser->fts5yystack || fts5yymajor==0 ){ + if( fts5yypParser->fts5yyidx < 0 || fts5yymajor==0 ){ fts5yy_destructor(fts5yypParser,(fts5YYCODETYPE)fts5yymajor,&fts5yyminorunion); fts5yy_parse_failed(fts5yypParser); -#ifndef fts5YYNOERRORRECOVERY - fts5yypParser->fts5yyerrcnt = -1; -#endif fts5yymajor = fts5YYNOCODE; }else if( fts5yymx!=fts5YYERRORSYMBOL ){ fts5yy_shift(fts5yypParser,fts5yyact,fts5YYERRORSYMBOL,fts5yyminor); } } @@ -2675,27 +2666,22 @@ } fts5yypParser->fts5yyerrcnt = 3; fts5yy_destructor(fts5yypParser,(fts5YYCODETYPE)fts5yymajor,&fts5yyminorunion); if( fts5yyendofinput ){ fts5yy_parse_failed(fts5yypParser); -#ifndef fts5YYNOERRORRECOVERY - fts5yypParser->fts5yyerrcnt = -1; -#endif } fts5yymajor = fts5YYNOCODE; #endif } - }while( fts5yymajor!=fts5YYNOCODE && fts5yypParser->fts5yytos>fts5yypParser->fts5yystack ); + }while( fts5yymajor!=fts5YYNOCODE && fts5yypParser->fts5yyidx>=0 ); #ifndef NDEBUG if( fts5yyTraceFILE ){ - fts5yyStackEntry *i; - char cDiv = '['; + int i; fprintf(fts5yyTraceFILE,"%sReturn. Stack=",fts5yyTracePrompt); - for(i=&fts5yypParser->fts5yystack[1]; i<=fts5yypParser->fts5yytos; i++){ - fprintf(fts5yyTraceFILE,"%c%s", cDiv, fts5yyTokenName[i->major]); - cDiv = ' '; - } + for(i=1; i<=fts5yypParser->fts5yyidx; i++) + fprintf(fts5yyTraceFILE,"%c%s", i==1 ? '[' : ' ', + fts5yyTokenName[fts5yypParser->fts5yystack[i].major]); fprintf(fts5yyTraceFILE,"]\n"); } #endif return; } @@ -7238,10 +7224,21 @@ } static void sqlite3Fts5ExprCheckPoslists(Fts5Expr *pExpr, i64 iRowid){ fts5ExprCheckPoslists(pExpr->pRoot, iRowid); } + +static void fts5ExprClearEof(Fts5ExprNode *pNode){ + int i; + for(i=0; inChild; i++){ + fts5ExprClearEof(pNode->apChild[i]); + } + pNode->bEof = 0; +} +static void sqlite3Fts5ExprClearEof(Fts5Expr *pExpr){ + fts5ExprClearEof(pExpr->pRoot); +} /* ** This function is only called for detail=columns tables. */ static int sqlite3Fts5ExprPhraseCollist( @@ -15459,10 +15456,11 @@ assert( pCsr->iLastRowid==LARGEST_INT64 ); assert( pCsr->iFirstRowid==SMALLEST_INT64 ); pCsr->ePlan = FTS5_PLAN_SOURCE; pCsr->pExpr = pTab->pSortCsr->pExpr; rc = fts5CursorFirst(pTab, pCsr, bDesc); + sqlite3Fts5ExprClearEof(pCsr->pExpr); }else if( pMatch ){ const char *zExpr = (const char*)sqlite3_value_text(apVal[0]); if( zExpr==0 ) zExpr = ""; rc = fts5CursorParseRank(pConfig, pCsr, pRank); @@ -16887,11 +16885,11 @@ int nArg, /* Number of args */ sqlite3_value **apUnused /* Function arguments */ ){ assert( nArg==0 ); UNUSED_PARAM2(nArg, apUnused); - sqlite3_result_text(pCtx, "fts5: 2016-08-08 13:40:27 d5e98057028abcf7217d0d2b2e29bbbcdf09d6de", -1, SQLITE_TRANSIENT); + sqlite3_result_text(pCtx, "fts5: 2016-05-18 10:57:30 fc49f556e48970561d7ab6a2f24fdd7d9eb81ff2", -1, SQLITE_TRANSIENT); } static int fts5Init(sqlite3 *db){ static const sqlite3_module fts5Mod = { /* iVersion */ 2, @@ -17253,15 +17251,11 @@ ){ int rc; char *zErr = 0; rc = fts5ExecPrintf(pConfig->db, &zErr, "CREATE TABLE %Q.'%q_%q'(%s)%s", - pConfig->zDb, pConfig->zName, zPost, zDefn, -#ifndef SQLITE_FTS5_NO_WITHOUT_ROWID - bWithout?" WITHOUT ROWID": -#endif - "" + pConfig->zDb, pConfig->zName, zPost, zDefn, bWithout?" WITHOUT ROWID":"" ); if( zErr ){ *pzErr = sqlite3_mprintf( "fts5: error creating shadow table %q_%s: %s", pConfig->zName, zPost, zErr Index: SQLite.Interop/src/ext/json1.c ================================================================== --- SQLite.Interop/src/ext/json1.c +++ SQLite.Interop/src/ext/json1.c @@ -1209,30 +1209,10 @@ /**************************************************************************** ** Scalar SQL function implementations ****************************************************************************/ -/* -** Implementation of the json_QUOTE(VALUE) function. Return a JSON value -** corresponding to the SQL value input. Mostly this means putting -** double-quotes around strings and returning the unquoted string "null" -** when given a NULL input. -*/ -static void jsonQuoteFunc( - sqlite3_context *ctx, - int argc, - sqlite3_value **argv -){ - JsonString jx; - UNUSED_PARAM(argc); - - jsonInit(&jx, ctx); - jsonAppendValue(&jx, argv[0]); - jsonResult(&jx); - sqlite3_result_subtype(ctx, JSON_SUBTYPE); -} - /* ** Implementation of the json_array(VALUE,...) function. Return a JSON ** array that contains all values given in arguments. Or if any argument ** is a BLOB, throw an error. */ @@ -2142,11 +2122,10 @@ { "json_array_length", 1, 0, jsonArrayLengthFunc }, { "json_array_length", 2, 0, jsonArrayLengthFunc }, { "json_extract", -1, 0, jsonExtractFunc }, { "json_insert", -1, 0, jsonSetFunc }, { "json_object", -1, 0, jsonObjectFunc }, - { "json_quote", 1, 0, jsonQuoteFunc }, { "json_remove", -1, 0, jsonRemoveFunc }, { "json_replace", -1, 0, jsonReplaceFunc }, { "json_set", -1, 1, jsonSetFunc }, { "json_type", 1, 0, jsonTypeFunc }, { "json_type", 2, 0, jsonTypeFunc }, Index: SQLite.Interop/src/ext/percentile.c ================================================================== --- SQLite.Interop/src/ext/percentile.c +++ SQLite.Interop/src/ext/percentile.c @@ -165,11 +165,11 @@ } /* ** Compare to doubles for sorting using qsort() */ -static int SQLITE_CDECL doubleCmp(const void *pA, const void *pB){ +static int doubleCmp(const void *pA, const void *pB){ double a = *(double*)pA; double b = *(double*)pB; if( a==b ) return 0; if( a= 3007014 @@ -1069,13 +1051,11 @@ #endif { ret = SQLITE_ERROR; break; } -#if SQLITE_VERSION_NUMBER >= 3014000 - *prowid = sqlite3BtreeIntegerKey(pC->uc.pCursor); -#elif SQLITE_VERSION_NUMBER >= 3010000 +#if SQLITE_VERSION_NUMBER >= 3010000 sqlite3BtreeKeySize(pC->uc.pCursor, prowid); #else sqlite3BtreeKeySize(pC->pCursor, prowid); #endif if (prowid) *prowid = *prowid; Index: SQLite.Interop/src/generic/interop.h ================================================================== --- SQLite.Interop/src/generic/interop.h +++ SQLite.Interop/src/generic/interop.h @@ -4,11 +4,11 @@ * Written by Joe Mistachkin. * Released to the public domain, use at your own risk! */ #ifndef INTEROP_VERSION -#define INTEROP_VERSION "1.0.103.0" +#define INTEROP_VERSION "1.0.102.0" #endif #ifndef INTEROP_SOURCE_ID #define INTEROP_SOURCE_ID "0000000000000000000000000000000000000000" #endif Index: Setup/build.bat ================================================================== --- Setup/build.bat +++ Setup/build.bat @@ -184,18 +184,10 @@ ) IF DEFINED NETFX461ONLY ( %_AECHO% Forcing the use of the .NET Framework 4.6.1... SET YEAR=2015 - CALL :fn_CheckFrameworkDir v4.0.30319 - CALL :fn_CheckMsBuildDir 14.0 - GOTO setup_buildToolDir -) - -IF DEFINED NETFX462ONLY ( - %_AECHO% Forcing the use of the .NET Framework 4.6.2... - SET YEAR=2015 CALL :fn_CheckFrameworkDir v4.0.30319 CALL :fn_CheckMsBuildDir 14.0 GOTO setup_buildToolDir ) Index: Setup/build_mono.bat ================================================================== --- Setup/build_mono.bat +++ Setup/build_mono.bat @@ -28,16 +28,11 @@ SET TOOLS=%~dp0 SET TOOLS=%TOOLS:~0,-1% %_VECHO% Tools = '%TOOLS%' -IF DEFINED BUILD_DEBUG ( - SET BUILD_CONFIGURATIONS=DebugManagedOnly ReleaseManagedOnly -) ELSE ( - SET BUILD_CONFIGURATIONS=ReleaseManagedOnly -) - +SET BUILD_CONFIGURATIONS=DebugManagedOnly ReleaseManagedOnly SET PLATFORMS="Any CPU" SET YEARS=2013 SET NOUSER=1 SET MSBUILD_ARGS=/property:ConfigurationSuffix=MonoOnPosix SET MSBUILD_ARGS=%MSBUILD_ARGS% /property:InteropCodec=false Index: Setup/data/CheckForNetFx.pas ================================================================== --- Setup/data/CheckForNetFx.pas +++ Setup/data/CheckForNetFx.pas @@ -259,12 +259,11 @@ if Result then begin Result := ExtractAndInstallVcRuntime(ResultCode); - if not Result or ((ResultCode <> 0) and (ResultCode <> 1638) - and (ResultCode <> 3010) and (ResultCode <> 5100)) then + if not Result or ((ResultCode <> 0) and (ResultCode <> 5100)) then begin MsgBox('Failed to install Microsoft Visual C++ Runtime: ' + VcRuntimeRedistributable + ', ' + SysErrorMessage(ResultCode), mbError, MB_OK); Index: Setup/data/SQLite.iss ================================================================== --- Setup/data/SQLite.iss +++ Setup/data/SQLite.iss @@ -126,50 +126,50 @@ Components: Application\EF6; Tasks: ngen; Filename: {code:GetNetFx4InstallRoot|Ngen.exe}; Parameters: "install ""{app}\bin\System.Data.SQLite.EF6.dll"" /nologo"; Flags: skipifdoesntexist; Check: CheckIsNetFx4Setup() #endif #if Pos("NativeOnly", AppConfiguration) == 0 && AppProcessor == "x86" #if Year == "2005" -Components: {#InstallerCondition}; Tasks: gac\vs2005; Filename: {app}\bin\Installer.exe; Parameters: "-install true -wow64 true -installFlags AllExceptGlobalAssemblyCache -tracePriority Lowest -verbose true -noCompact true -noNetFx35 true -noNetFx40 true -noNetFx45 true -noNetFx451 true -noNetFx452 true -noNetFx46 true -noNetFx461 true -noNetFx462 true -noVs2008 true -noVs2010 true -noVs2012 true -noVs2013 true -noVs2015 true -whatIf false -confirm true"; Flags: skipifdoesntexist; Check: CheckIsNetFx2Setup() +Components: {#InstallerCondition}; Tasks: gac\vs2005; Filename: {app}\bin\Installer.exe; Parameters: "-install true -wow64 true -installFlags AllExceptGlobalAssemblyCache -tracePriority Lowest -verbose true -noCompact true -noNetFx35 true -noNetFx40 true -noNetFx45 true -noNetFx451 true -noNetFx452 true -noNetFx46 true -noNetFx461 true -noVs2008 true -noVs2010 true -noVs2012 true -noVs2013 true -noVs2015 true -whatIf false -confirm true"; Flags: skipifdoesntexist; Check: CheckIsNetFx2Setup() #endif #if Year == "2008" -Components: {#InstallerCondition}; Tasks: gac\vs2008; Filename: {app}\bin\Installer.exe; Parameters: "-install true -wow64 true -installFlags AllExceptGlobalAssemblyCache -tracePriority Lowest -verbose true -noCompact true -noNetFx40 true -noNetFx45 true -noNetFx451 true -noNetFx452 true -noNetFx46 true -noNetFx461 true -noNetFx462 true -noVs2005 true -noVs2010 true -noVs2012 true -noVs2013 true -noVs2015 true -whatIf false -confirm true"; Flags: skipifdoesntexist; Check: CheckIsNetFx2Setup() +Components: {#InstallerCondition}; Tasks: gac\vs2008; Filename: {app}\bin\Installer.exe; Parameters: "-install true -wow64 true -installFlags AllExceptGlobalAssemblyCache -tracePriority Lowest -verbose true -noCompact true -noNetFx40 true -noNetFx45 true -noNetFx451 true -noNetFx452 true -noNetFx46 true -noNetFx461 true -noVs2005 true -noVs2010 true -noVs2012 true -noVs2013 true -noVs2015 true -whatIf false -confirm true"; Flags: skipifdoesntexist; Check: CheckIsNetFx2Setup() #endif #if Year == "2010" -Components: {#InstallerCondition}; Tasks: gac\vs2010; Filename: {app}\bin\Installer.exe; Parameters: "-install true -wow64 true -installFlags AllExceptGlobalAssemblyCache -tracePriority Lowest -verbose true -noCompact true -noNetFx20 true -noNetFx35 true -noNetFx45 true -noNetFx451 true -noNetFx452 true -noNetFx46 true -noNetFx461 true -noNetFx462 true -noVs2005 true -noVs2008 true -noVs2012 true -noVs2013 true -noVs2015 true -whatIf false -confirm true"; Flags: skipifdoesntexist; Check: CheckIsNetFx4Setup() +Components: {#InstallerCondition}; Tasks: gac\vs2010; Filename: {app}\bin\Installer.exe; Parameters: "-install true -wow64 true -installFlags AllExceptGlobalAssemblyCache -tracePriority Lowest -verbose true -noCompact true -noNetFx20 true -noNetFx35 true -noNetFx45 true -noNetFx451 true -noNetFx452 true -noNetFx46 true -noNetFx461 true -noVs2005 true -noVs2008 true -noVs2012 true -noVs2013 true -noVs2015 true -whatIf false -confirm true"; Flags: skipifdoesntexist; Check: CheckIsNetFx4Setup() #endif #if Year == "2012" -Components: {#InstallerCondition}; Tasks: gac\vs2012; Filename: {app}\bin\Installer.exe; Parameters: "-install true -wow64 true -installFlags AllExceptGlobalAssemblyCache -tracePriority Lowest -verbose true -noCompact true -noNetFx20 true -noNetFx35 true -noNetFx40 true -noNetFx451 true -noNetFx452 true -noNetFx46 true -noNetFx461 true -noNetFx462 true -noVs2005 true -noVs2008 true -noVs2010 true -noVs2013 true -noVs2015 true -configVersion 4.0.30319 -whatIf false -confirm true"; Flags: skipifdoesntexist; Check: CheckIsNetFx4Setup() -Components: {#InstallerCondition}; Tasks: gac\vs2012; Filename: {app}\bin\Installer.exe; Parameters: "-perUser true -install true -wow64 true -installFlags AllExceptGlobalAssemblyCache -tracePriority Lowest -verbose true -noCompact true -noNetFx20 true -noNetFx35 true -noNetFx40 true -noNetFx451 true -noNetFx452 true -noNetFx46 true -noNetFx461 true -noNetFx462 true -noVs2005 true -noVs2008 true -noVs2010 true -noVs2013 true -noVs2015 true -configVersion 4.0.30319 -vsVersionSuffix _Config -whatIf false -confirm true"; Flags: skipifdoesntexist; Check: CheckIsNetFx4Setup() +Components: {#InstallerCondition}; Tasks: gac\vs2012; Filename: {app}\bin\Installer.exe; Parameters: "-install true -wow64 true -installFlags AllExceptGlobalAssemblyCache -tracePriority Lowest -verbose true -noCompact true -noNetFx20 true -noNetFx35 true -noNetFx40 true -noNetFx451 true -noNetFx452 true -noNetFx46 true -noNetFx461 true -noVs2005 true -noVs2008 true -noVs2010 true -noVs2013 true -noVs2015 true -configVersion 4.0.30319 -whatIf false -confirm true"; Flags: skipifdoesntexist; Check: CheckIsNetFx4Setup() +Components: {#InstallerCondition}; Tasks: gac\vs2012; Filename: {app}\bin\Installer.exe; Parameters: "-perUser true -install true -wow64 true -installFlags AllExceptGlobalAssemblyCache -tracePriority Lowest -verbose true -noCompact true -noNetFx20 true -noNetFx35 true -noNetFx40 true -noNetFx451 true -noNetFx452 true -noNetFx46 true -noNetFx461 true -noVs2005 true -noVs2008 true -noVs2010 true -noVs2013 true -noVs2015 true -configVersion 4.0.30319 -vsVersionSuffix _Config -whatIf false -confirm true"; Flags: skipifdoesntexist; Check: CheckIsNetFx4Setup() #endif #if Year == "2013" -Components: {#InstallerCondition}; Tasks: gac\vs2013; Filename: {app}\bin\Installer.exe; Parameters: "-install true -wow64 true -installFlags AllExceptGlobalAssemblyCache -tracePriority Lowest -verbose true -noCompact true -noNetFx20 true -noNetFx35 true -noNetFx40 true -noNetFx45 true -noNetFx452 true -noNetFx46 true -noNetFx461 true -noNetFx462 true -noVs2005 true -noVs2008 true -noVs2010 true -noVs2012 true -noVs2015 true -configVersion 4.0.30319 -whatIf false -confirm true"; Flags: skipifdoesntexist; Check: CheckIsNetFx4Setup() +Components: {#InstallerCondition}; Tasks: gac\vs2013; Filename: {app}\bin\Installer.exe; Parameters: "-install true -wow64 true -installFlags AllExceptGlobalAssemblyCache -tracePriority Lowest -verbose true -noCompact true -noNetFx20 true -noNetFx35 true -noNetFx40 true -noNetFx45 true -noNetFx452 true -noNetFx46 true -noNetFx461 true -noVs2005 true -noVs2008 true -noVs2010 true -noVs2012 true -noVs2015 true -configVersion 4.0.30319 -whatIf false -confirm true"; Flags: skipifdoesntexist; Check: CheckIsNetFx4Setup() #endif #if Year == "2015" -Components: {#InstallerCondition}; Tasks: gac\vs2015; Filename: {app}\bin\Installer.exe; Parameters: "-install true -wow64 true -installFlags AllExceptGlobalAssemblyCache -tracePriority Lowest -verbose true -noCompact true -noNetFx20 true -noNetFx35 true -noNetFx40 true -noNetFx45 true -noNetFx451 true -noNetFx452 true -noNetFx461 true -noNetFx462 true -noVs2005 true -noVs2008 true -noVs2010 true -noVs2012 true -noVs2013 true -configVersion 4.0.30319 -whatIf false -confirm true"; Flags: skipifdoesntexist; Check: CheckIsNetFx4Setup() +Components: {#InstallerCondition}; Tasks: gac\vs2015; Filename: {app}\bin\Installer.exe; Parameters: "-install true -wow64 true -installFlags AllExceptGlobalAssemblyCache -tracePriority Lowest -verbose true -noCompact true -noNetFx20 true -noNetFx35 true -noNetFx40 true -noNetFx45 true -noNetFx451 true -noNetFx452 true -noNetFx461 true -noVs2005 true -noVs2008 true -noVs2010 true -noVs2012 true -noVs2013 true -configVersion 4.0.30319 -whatIf false -confirm true"; Flags: skipifdoesntexist; Check: CheckIsNetFx4Setup() #endif #endif [UninstallRun] #if Pos("NativeOnly", AppConfiguration) == 0 && AppProcessor == "x86" #if Year == "2015" -Components: {#InstallerCondition}; Tasks: gac\vs2015; Filename: {app}\bin\Installer.exe; Parameters: "-install false -wow64 true -installFlags AllExceptGlobalAssemblyCache -tracePriority Lowest -verbose true -noCompact true -noNetFx20 true -noNetFx35 true -noNetFx40 true -noNetFx45 true -noNetFx451 true -noNetFx452 true -noNetFx461 true -noNetFx462 true -noVs2005 true -noVs2008 true -noVs2010 true -noVs2012 true -noVs2013 true -configVersion 4.0.30319 -whatIf false -confirm true"; Flags: skipifdoesntexist; Check: CheckIsNetFx4Setup() +Components: {#InstallerCondition}; Tasks: gac\vs2015; Filename: {app}\bin\Installer.exe; Parameters: "-install false -wow64 true -installFlags AllExceptGlobalAssemblyCache -tracePriority Lowest -verbose true -noCompact true -noNetFx20 true -noNetFx35 true -noNetFx40 true -noNetFx45 true -noNetFx451 true -noNetFx452 true -noNetFx461 true -noVs2005 true -noVs2008 true -noVs2010 true -noVs2012 true -noVs2013 true -configVersion 4.0.30319 -whatIf false -confirm true"; Flags: skipifdoesntexist; Check: CheckIsNetFx4Setup() #endif #if Year == "2013" -Components: {#InstallerCondition}; Tasks: gac\vs2013; Filename: {app}\bin\Installer.exe; Parameters: "-install false -wow64 true -installFlags AllExceptGlobalAssemblyCache -tracePriority Lowest -verbose true -noCompact true -noNetFx20 true -noNetFx35 true -noNetFx40 true -noNetFx45 true -noNetFx452 true -noNetFx46 true -noNetFx461 true -noNetFx462 true -noVs2005 true -noVs2008 true -noVs2010 true -noVs2012 true -noVs2015 true -configVersion 4.0.30319 -whatIf false -confirm true"; Flags: skipifdoesntexist; Check: CheckIsNetFx4Setup() +Components: {#InstallerCondition}; Tasks: gac\vs2013; Filename: {app}\bin\Installer.exe; Parameters: "-install false -wow64 true -installFlags AllExceptGlobalAssemblyCache -tracePriority Lowest -verbose true -noCompact true -noNetFx20 true -noNetFx35 true -noNetFx40 true -noNetFx45 true -noNetFx452 true -noNetFx46 true -noNetFx461 true -noVs2005 true -noVs2008 true -noVs2010 true -noVs2012 true -noVs2015 true -configVersion 4.0.30319 -whatIf false -confirm true"; Flags: skipifdoesntexist; Check: CheckIsNetFx4Setup() #endif #if Year == "2012" -Components: {#InstallerCondition}; Tasks: gac\vs2012; Filename: {app}\bin\Installer.exe; Parameters: "-perUser true -install false -wow64 true -installFlags AllExceptGlobalAssemblyCache -tracePriority Lowest -verbose true -noCompact true -noNetFx20 true -noNetFx35 true -noNetFx40 true -noNetFx451 true -noNetFx452 true -noNetFx46 true -noNetFx461 true -noNetFx462 true -noVs2005 true -noVs2008 true -noVs2010 true -noVs2013 true -noVs2015 true -configVersion 4.0.30319 -vsVersionSuffix _Config -whatIf false -confirm true"; Flags: skipifdoesntexist; Check: CheckIsNetFx4Setup() -Components: {#InstallerCondition}; Tasks: gac\vs2012; Filename: {app}\bin\Installer.exe; Parameters: "-install false -wow64 true -installFlags AllExceptGlobalAssemblyCache -tracePriority Lowest -verbose true -noCompact true -noNetFx20 true -noNetFx35 true -noNetFx40 true -noNetFx451 true -noNetFx452 true -noNetFx46 true -noNetFx461 true -noNetFx462 true -noVs2005 true -noVs2008 true -noVs2010 true -noVs2013 true -noVs2015 true -configVersion 4.0.30319 -whatIf false -confirm true"; Flags: skipifdoesntexist; Check: CheckIsNetFx4Setup() +Components: {#InstallerCondition}; Tasks: gac\vs2012; Filename: {app}\bin\Installer.exe; Parameters: "-perUser true -install false -wow64 true -installFlags AllExceptGlobalAssemblyCache -tracePriority Lowest -verbose true -noCompact true -noNetFx20 true -noNetFx35 true -noNetFx40 true -noNetFx451 true -noNetFx452 true -noNetFx46 true -noNetFx461 true -noVs2005 true -noVs2008 true -noVs2010 true -noVs2013 true -noVs2015 true -configVersion 4.0.30319 -vsVersionSuffix _Config -whatIf false -confirm true"; Flags: skipifdoesntexist; Check: CheckIsNetFx4Setup() +Components: {#InstallerCondition}; Tasks: gac\vs2012; Filename: {app}\bin\Installer.exe; Parameters: "-install false -wow64 true -installFlags AllExceptGlobalAssemblyCache -tracePriority Lowest -verbose true -noCompact true -noNetFx20 true -noNetFx35 true -noNetFx40 true -noNetFx451 true -noNetFx452 true -noNetFx46 true -noNetFx461 true -noVs2005 true -noVs2008 true -noVs2010 true -noVs2013 true -noVs2015 true -configVersion 4.0.30319 -whatIf false -confirm true"; Flags: skipifdoesntexist; Check: CheckIsNetFx4Setup() #endif #if Year == "2010" -Components: {#InstallerCondition}; Tasks: gac\vs2010; Filename: {app}\bin\Installer.exe; Parameters: "-install false -wow64 true -installFlags AllExceptGlobalAssemblyCache -tracePriority Lowest -verbose true -noCompact true -noNetFx20 true -noNetFx35 true -noNetFx45 true -noNetFx451 true -noNetFx452 true -noNetFx46 true -noNetFx461 true -noNetFx462 true -noVs2005 true -noVs2008 true -noVs2012 true -noVs2013 true -noVs2015 true -whatIf false -confirm true"; Flags: skipifdoesntexist; Check: CheckIsNetFx4Setup() +Components: {#InstallerCondition}; Tasks: gac\vs2010; Filename: {app}\bin\Installer.exe; Parameters: "-install false -wow64 true -installFlags AllExceptGlobalAssemblyCache -tracePriority Lowest -verbose true -noCompact true -noNetFx20 true -noNetFx35 true -noNetFx45 true -noNetFx451 true -noNetFx452 true -noNetFx46 true -noNetFx461 true -noVs2005 true -noVs2008 true -noVs2012 true -noVs2013 true -noVs2015 true -whatIf false -confirm true"; Flags: skipifdoesntexist; Check: CheckIsNetFx4Setup() #endif #if Year == "2008" -Components: {#InstallerCondition}; Tasks: gac\vs2008; Filename: {app}\bin\Installer.exe; Parameters: "-install false -wow64 true -installFlags AllExceptGlobalAssemblyCache -tracePriority Lowest -verbose true -noCompact true -noNetFx40 true -noNetFx45 true -noNetFx451 true -noNetFx452 true -noNetFx46 true -noNetFx461 true -noNetFx462 true -noVs2005 true -noVs2010 true -noVs2012 true -noVs2013 true -noVs2015 true -whatIf false -confirm true"; Flags: skipifdoesntexist; Check: CheckIsNetFx2Setup() +Components: {#InstallerCondition}; Tasks: gac\vs2008; Filename: {app}\bin\Installer.exe; Parameters: "-install false -wow64 true -installFlags AllExceptGlobalAssemblyCache -tracePriority Lowest -verbose true -noCompact true -noNetFx40 true -noNetFx45 true -noNetFx451 true -noNetFx452 true -noNetFx46 true -noNetFx461 true -noVs2005 true -noVs2010 true -noVs2012 true -noVs2013 true -noVs2015 true -whatIf false -confirm true"; Flags: skipifdoesntexist; Check: CheckIsNetFx2Setup() #endif #if Year == "2005" -Components: {#InstallerCondition}; Tasks: gac\vs2005; Filename: {app}\bin\Installer.exe; Parameters: "-install false -wow64 true -installFlags AllExceptGlobalAssemblyCache -tracePriority Lowest -verbose true -noCompact true -noNetFx35 true -noNetFx40 true -noNetFx45 true -noNetFx451 true -noNetFx452 true -noNetFx46 true -noNetFx461 true -noNetFx462 true -noVs2008 true -noVs2010 true -noVs2012 true -noVs2013 true -noVs2015 true -whatIf false -confirm true"; Flags: skipifdoesntexist; Check: CheckIsNetFx2Setup() +Components: {#InstallerCondition}; Tasks: gac\vs2005; Filename: {app}\bin\Installer.exe; Parameters: "-install false -wow64 true -installFlags AllExceptGlobalAssemblyCache -tracePriority Lowest -verbose true -noCompact true -noNetFx35 true -noNetFx40 true -noNetFx45 true -noNetFx451 true -noNetFx452 true -noNetFx46 true -noNetFx461 true -noVs2008 true -noVs2010 true -noVs2012 true -noVs2013 true -noVs2015 true -whatIf false -confirm true"; Flags: skipifdoesntexist; Check: CheckIsNetFx2Setup() #endif #endif #if Year != "2005" && Year != "2008" Components: Application\EF6; Tasks: ngen; Filename: {code:GetNetFx4InstallRoot|Ngen.exe}; Parameters: "uninstall ""{app}\bin\System.Data.SQLite.EF6.dll"" /nologo"; Flags: skipifdoesntexist; Check: CheckIsNetFx4Setup() Index: Setup/data/verify.lst ================================================================== --- Setup/data/verify.lst +++ Setup/data/verify.lst @@ -330,11 +330,10 @@ Setup/set_netFx45.bat Setup/set_netFx451.bat Setup/set_netFx452.bat Setup/set_netFx46.bat Setup/set_netFx461.bat - Setup/set_netFx462.bat Setup/set_Release.bat Setup/set_Release_ARMV7.bat "Setup/set_Release_CEPC DevPlatform.bat" "Setup/set_Release_Pocket PC 2003 (ARMV4).bat" Setup/set_Release_Win32.bat @@ -557,11 +556,10 @@ System.Data.SQLite/Resources/SR.resx System.Data.SQLite/SQLite3.cs System.Data.SQLite/SQLite3_UTF16.cs System.Data.SQLite/SQLiteBackup.cs System.Data.SQLite/SQLiteBase.cs - System.Data.SQLite/SQLiteBlob.cs System.Data.SQLite/SQLiteCommand.cs System.Data.SQLite/SQLiteCommandBuilder.cs System.Data.SQLite/SQLiteConnection.cs System.Data.SQLite/SQLiteConnectionPool.cs System.Data.SQLite/SQLiteConnectionStringBuilder.cs @@ -782,11 +780,10 @@ Tests/template/empty.eagle Tests/thread.eagle Tests/tkt-00f86f9739.eagle Tests/tkt-0a32885109.eagle Tests/tkt-0d5b1ef362.eagle - Tests/tkt-0ed01c447c.eagle Tests/tkt-17045010df.eagle Tests/tkt-1c456ae75f.eagle Tests/tkt-201128cc88.eagle Tests/tkt-2556655d1b.eagle Tests/tkt-2abbf2c244.eagle @@ -1196,20 +1193,20 @@ # # NOTE: This is the list of files that should be present in all setup archives # supporting the .NET Framework 4.6 for x86. # set sds_manifests(setupX86Vs2015) { - {{tmp}\vcredist_x86_2015_VSU3.exe} + {{tmp}\vcredist_x86_2015_VSU2.exe} } ############################################################################### # # NOTE: This is the list of files that should be present in all setup archives # supporting the .NET Framework 4.6 for x64. # set sds_manifests(setupX64Vs2015) { - {{tmp}\vcredist_x64_2015_VSU3.exe} + {{tmp}\vcredist_x64_2015_VSU2.exe} } ############################################################################### # # NOTE: These are the master archive manifest groups, based on file name. The Index: Setup/set_netFx46.bat ================================================================== --- Setup/set_netFx46.bat +++ Setup/set_netFx46.bat @@ -10,11 +10,11 @@ IF NOT DEFINED ISNETFX2 ( SET ISNETFX2=False ) IF NOT DEFINED VCRUNTIME ( - SET VCRUNTIME=2015_VSU3 + SET VCRUNTIME=2015_VSU2 ) IF NOT DEFINED CONFIGURATION ( SET CONFIGURATION=Release ) Index: Setup/set_netFx461.bat ================================================================== --- Setup/set_netFx461.bat +++ Setup/set_netFx461.bat @@ -10,11 +10,11 @@ IF NOT DEFINED ISNETFX2 ( SET ISNETFX2=False ) IF NOT DEFINED VCRUNTIME ( - SET VCRUNTIME=2015_VSU3 + SET VCRUNTIME=2015_VSU2 ) IF NOT DEFINED CONFIGURATION ( SET CONFIGURATION=Release ) DELETED Setup/set_netFx462.bat Index: Setup/set_netFx462.bat ================================================================== --- Setup/set_netFx462.bat +++ /dev/null @@ -1,38 +0,0 @@ -@ECHO OFF - -:: -:: set_netFx462.bat -- -:: -:: Written by Joe Mistachkin. -:: Released to the public domain, use at your own risk! -:: - -IF NOT DEFINED ISNETFX2 ( - SET ISNETFX2=False -) - -IF NOT DEFINED VCRUNTIME ( - SET VCRUNTIME=2015_VSU3 -) - -IF NOT DEFINED CONFIGURATION ( - SET CONFIGURATION=Release -) - -IF NOT DEFINED PLATFORM ( - SET PLATFORM=Win32 -) - -IF NOT DEFINED PROCESSOR ( - SET PROCESSOR=x86 -) - -IF NOT DEFINED YEAR ( - SET YEAR=2015 -) - -IF NOT DEFINED FRAMEWORK ( - SET FRAMEWORK=netFx462 -) - -:end_of_file Index: Setup/set_x64_2015.bat ================================================================== --- Setup/set_x64_2015.bat +++ Setup/set_x64_2015.bat @@ -6,9 +6,9 @@ :: Written by Joe Mistachkin. :: Released to the public domain, use at your own risk! :: SET ISNETFX2=False -SET VCRUNTIME=2015_VSU3 +SET VCRUNTIME=2015_VSU2 SET PLATFORM=x64 SET PROCESSOR=x64 SET YEAR=2015 Index: Setup/set_x86_2015.bat ================================================================== --- Setup/set_x86_2015.bat +++ Setup/set_x86_2015.bat @@ -6,9 +6,9 @@ :: Written by Joe Mistachkin. :: Released to the public domain, use at your own risk! :: SET ISNETFX2=False -SET VCRUNTIME=2015_VSU3 +SET VCRUNTIME=2015_VSU2 SET PLATFORM=Win32 SET PROCESSOR=x86 SET YEAR=2015 Index: System.Data.SQLite.Linq/AssemblyInfo.cs ================================================================== --- System.Data.SQLite.Linq/AssemblyInfo.cs +++ System.Data.SQLite.Linq/AssemblyInfo.cs @@ -51,7 +51,7 @@ // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.103.0")] -[assembly: AssemblyFileVersion("1.0.103.0")] +[assembly: AssemblyVersion("1.0.102.0")] +[assembly: AssemblyFileVersion("1.0.102.0")] Index: System.Data.SQLite/AssemblyInfo.cs ================================================================== --- System.Data.SQLite/AssemblyInfo.cs +++ System.Data.SQLite/AssemblyInfo.cs @@ -70,9 +70,9 @@ // Build Number // Revision // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.103.0")] +[assembly: AssemblyVersion("1.0.102.0")] #if !PLATFORM_COMPACTFRAMEWORK -[assembly: AssemblyFileVersion("1.0.103.0")] +[assembly: AssemblyFileVersion("1.0.102.0")] #endif Index: System.Data.SQLite/Configurations/System.Data.SQLite.dll.config ================================================================== --- System.Data.SQLite/Configurations/System.Data.SQLite.dll.config +++ System.Data.SQLite/Configurations/System.Data.SQLite.dll.config @@ -74,42 +74,10 @@ --> - - - - - - $(DefineConstants);NET_461 - - - $(DefineConstants);NET_462 - - @@ -202,19 +197,10 @@ Framework 4.6.1 (if necessary, it will typically be enabled from within the project file itself). --> false - - false - false - - - false