System.Data.SQLite
Check-in [060593ee6a]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Preparation for the 1.0.84.0 release.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 060593ee6a9a0808a8032d3e1e7a61c18984bad0
User & Date: mistachkin 2013-01-09 19:18:00
Context
2013-01-09
21:02
Update master release archive manifest and file exclusion list. check-in: c3512d6f32 user: mistachkin tags: trunk
19:18
Preparation for the 1.0.84.0 release. check-in: 060593ee6a user: mistachkin tags: trunk
18:50
Explicitly dispose of all the commands associated with a SQLiteDataAdapter object as the base class does not do it. Fix for ticket [6434e23a0f]. check-in: 42d873a6d8 user: mistachkin tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to Doc/Extra/version.html.

    39     39             </td>
    40     40           </tr>
    41     41         </table>
    42     42       </div>
    43     43       <div id="mainSection">
    44     44       <div id="mainBody">
    45     45       <h1 class="heading">Version History</h1>
    46         -    <p><b>1.0.84.0 - March XX, 2013 <font color="red">(release scheduled)</font></p>
           46  +    <p><b>1.0.84.0 - January 9, 2013</p>
    47     47       <ul>
    48         -      <li>Updated to <a href="http://www.sqlite.org/src/info/trunk">SQLite 3.7.16</a>.</li>
           48  +      <li>Updated to <a href="http://www.sqlite.org/releaselog/3_7_15_2.html">SQLite 3.7.15.2</a>.</li>
           49  +      <li>Explicitly dispose of all SQLiteCommand objects managed by the DbDataAdapter class. Fix for <a href="http://system.data.sqlite.org/index.html/info/6434e23a0f">[6434e23a0f]</a>.</li>
    49     50         <li>Add Cancel method to the SQLiteConnection class to interrupt a long running query.</li>
    50     51         <li>Improve thread safety of the SQLiteLog.LogMessage method.</li>
    51     52       </ul>
    52     53       <p><b>1.0.83.0 - December 29, 2012</p>
    53     54       <ul>
    54     55         <li>Updated to <a href="http://www.sqlite.org/releaselog/3_7_15_1.html">SQLite 3.7.15.1</a>.</li>
    55     56         <li>Add Visual Studio 2012 support to all the applicable solution/project files, their associated supporting files, and the test suite.</li>

Changes to Doc/SQLite.NET.chm.

cannot compute difference between binary files

Changes to Externals/Eagle/lib/Eagle1.0/init.eagle.

   139    139       set result ""; eval append result $args
   140    140     }
   141    141   
   142    142     proc lappendArgs { args } {
   143    143       #
   144    144       # NOTE: This should work properly in both Tcl and Eagle.
   145    145       #
   146         -    eval lappend result $args
          146  +    set result [list]; eval lappend result $args
   147    147     }
   148    148   
   149    149     proc getDictionaryValue { dictionary name {default ""} {wrap ""} } {
   150    150       #
   151    151       # NOTE: Locate the named value we are interested in.  The dictionary must
   152    152       #       be a list with an even number of elements in the following format:
   153    153       #
................................................................................
  1043   1043                 set components [list $baseUri releases $patchLevel]
  1044   1044   
  1045   1045                 #
  1046   1046                 # NOTE: Next, figure out what type of download is being
  1047   1047                 #       requested.
  1048   1048                 #
  1049   1049                 switch -exact -nocase -- $type {
  1050         -                source {
         1050  +                source -
         1051  +                setup -
         1052  +                binary {
  1051   1053                     #
  1052         -                  # NOTE: Source code download.  This may be a RAR or an EXE
  1053         -                  #       file.  Append the appropriate file name and then
  1054         -                  #       join all the URI components to form the final URI.
         1054  +                  # NOTE: Source code, setup, or binary download.  This may be
         1055  +                  #       a RAR or an EXE file.  Append the appropriate file
         1056  +                  #       name and then join all the URI components to form the
         1057  +                  #       final URI.
  1055   1058                     #
  1056         -                  set fileName [appendArgs EagleSource $patchLevel $extension]
  1057         -                  lappend components $fileName
         1059  +                  set fileName [appendArgs \
         1060  +                      [info engine] [string totitle $type] $patchLevel \
         1061  +                      [expr {[string tolower $type] eq "setup" ? ".exe" : \
         1062  +                      $extension}]]
  1058   1063   
  1059         -                  set result [list [eval uri join $components] \
  1060         -                      [file join $directory $fileName]]
  1061         -                }
  1062         -                setup {
  1063         -                  #
  1064         -                  # NOTE: Windows setup download.  Always append an ".exe"
  1065         -                  #       extension because we never distribute the setup as
  1066         -                  #       a RAR file.  Append the appropriate file name and
  1067         -                  #       then join all the URI components to form the final
  1068         -                  #       URI.
  1069         -                  #
  1070         -                  set fileName [appendArgs EagleSetup $patchLevel .exe]
  1071   1064                     lappend components $fileName
  1072   1065   
  1073         -                  set result [list [eval uri join $components] \
  1074         -                      [file join $directory $fileName]]
  1075         -                }
  1076         -                binary {
  1077         -                  #
  1078         -                  # NOTE: Binary file download.  This may be a RAR or an EXE
  1079         -                  #       file.  Append the appropriate file name and then
  1080         -                  #       join all the URI components to form the final URI.
  1081         -                  #
  1082         -                  set fileName [appendArgs EagleBinary $patchLevel $extension]
  1083         -                  lappend components $fileName
  1084         -
  1085         -                  set result [list [eval uri join $components] \
  1086         -                      [file join $directory $fileName]]
         1066  +                  set result [list [eval uri join $components] [file join \
         1067  +                      $directory $fileName]]
  1087   1068                   }
  1088   1069                 }
  1089   1070               }
  1090   1071             }
  1091   1072           }
  1092   1073         }
  1093   1074   
................................................................................
  1552   1533   
  1553   1534       proc tclLog { string } {
  1554   1535         #
  1555   1536         # NOTE: This should work properly in both Tcl and Eagle.
  1556   1537         #
  1557   1538         catch {puts stderr $string}
  1558   1539       }
         1540  +
         1541  +    proc makeVariableFast { name fast } {
         1542  +      #
         1543  +      # NOTE: This should work properly in Eagle only.
         1544  +      #
         1545  +      catch {
         1546  +        uplevel 1 [list object invoke -flags +NonPublic \
         1547  +            Interpreter.GetActive MakeVariableFast $name $fast]
         1548  +      }
         1549  +    }
  1559   1550   
  1560   1551       proc findDirectories { pattern } {
         1552  +      #
         1553  +      # NOTE: Block non-Windows platforms since this is Windows specific.
         1554  +      #
         1555  +      if {$::tcl_platform(platform) ne "windows"} then {
         1556  +        error "not supported on this operating system"
         1557  +      }
         1558  +
  1561   1559         #
  1562   1560         # NOTE: This should work properly in Eagle only.
  1563   1561         #
  1564         -      set result [list]
         1562  +      set dir ""; set result [list]
         1563  +
         1564  +      #
         1565  +      # HACK: Optimize the variable access in this procedure to be
         1566  +      #       as fast as possible.
         1567  +      #
         1568  +      makeVariableFast dir true; makeVariableFast result true
  1565   1569   
  1566   1570         foreach dir [split [exec -unicode $::env(ComSpec) /u /c dir \
  1567   1571             /ad /b [appendArgs \" [file nativename $pattern] \"]] \n] {
  1568   1572           set dir [string trim $dir]
  1569   1573   
  1570   1574           if {[string length $dir] > 0} then {
  1571   1575             set dir [getDirResultPath $pattern $dir]
  1572   1576   
  1573         -          if {[lsearch -exact -nocase $result $dir] == -1} then {
         1577  +          if {[lsearch -variable -exact -nocase result $dir] == -1} then {
  1574   1578               lappend result $dir
  1575   1579             }
  1576   1580           }
  1577   1581         }
  1578   1582   
  1579   1583         foreach dir [split [exec -unicode $::env(ComSpec) /u /c dir \
  1580   1584             /ahd /b [appendArgs \" [file nativename $pattern] \"]] \n] {
  1581   1585           set dir [string trim $dir]
  1582   1586   
  1583   1587           if {[string length $dir] > 0} then {
  1584   1588             set dir [getDirResultPath $pattern $dir]
  1585   1589   
  1586         -          if {[lsearch -exact -nocase $result $dir] == -1} then {
         1590  +          if {[lsearch -variable -exact -nocase result $dir] == -1} then {
  1587   1591               lappend result $dir
  1588   1592             }
  1589   1593           }
  1590   1594         }
  1591   1595   
  1592   1596         return $result
  1593   1597       }
  1594   1598   
  1595   1599       proc findFiles { pattern } {
         1600  +      #
         1601  +      # NOTE: Block non-Windows platforms since this is Windows specific.
         1602  +      #
         1603  +      if {$::tcl_platform(platform) ne "windows"} then {
         1604  +        error "not supported on this operating system"
         1605  +      }
         1606  +
  1596   1607         #
  1597   1608         # NOTE: This should work properly in Eagle only.
  1598   1609         #
  1599         -      set result [list]
         1610  +      set fileName ""; set result [list]
         1611  +
         1612  +      #
         1613  +      # HACK: Optimize the variable access in this procedure to be
         1614  +      #       as fast as possible.
         1615  +      #
         1616  +      makeVariableFast fileName true; makeVariableFast result true
  1600   1617   
  1601   1618         foreach fileName [split [exec -unicode $::env(ComSpec) /u /c dir \
  1602   1619             /a-d /b [appendArgs \" [file nativename $pattern] \"]] \n] {
  1603   1620           set fileName [string trim $fileName]
  1604   1621   
  1605   1622           if {[string length $fileName] > 0} then {
  1606   1623             set fileName [getDirResultPath $pattern $fileName]
  1607   1624   
  1608         -          if {[lsearch -exact -nocase $result $fileName] == -1} then {
         1625  +          if {[lsearch -variable -exact -nocase result $fileName] == -1} then {
  1609   1626               lappend result $fileName
  1610   1627             }
  1611   1628           }
  1612   1629         }
  1613   1630   
  1614   1631         foreach fileName [split [exec -unicode $::env(ComSpec) /u /c dir \
  1615   1632             /ah-d /b [appendArgs \" [file nativename $pattern] \"]] \n] {
  1616   1633           set fileName [string trim $fileName]
  1617   1634   
  1618   1635           if {[string length $fileName] > 0} then {
  1619   1636             set fileName [getDirResultPath $pattern $fileName]
  1620   1637   
  1621         -          if {[lsearch -exact -nocase $result $fileName] == -1} then {
         1638  +          if {[lsearch -variable -exact -nocase result $fileName] == -1} then {
  1622   1639               lappend result $fileName
  1623   1640             }
  1624   1641           }
  1625   1642         }
  1626   1643   
  1627   1644         return $result
  1628   1645       }
  1629   1646   
  1630   1647       proc findFilesRecursive { pattern } {
         1648  +      #
         1649  +      # NOTE: Block non-Windows platforms since this is Windows specific.
         1650  +      #
         1651  +      if {$::tcl_platform(platform) ne "windows"} then {
         1652  +        error "not supported on this operating system"
         1653  +      }
         1654  +
  1631   1655         #
  1632   1656         # NOTE: This should work properly in Eagle only.
  1633   1657         #
  1634         -      set result [list]
         1658  +      set fileName ""; set result [list]
         1659  +
         1660  +      #
         1661  +      # HACK: Optimize the variable access in this procedure to be
         1662  +      #       as fast as possible.
         1663  +      #
         1664  +      makeVariableFast fileName true; makeVariableFast result true
  1635   1665   
  1636   1666         foreach fileName [split [exec -unicode $::env(ComSpec) /u /c dir \
  1637   1667             /a-d /s /b [appendArgs \" [file nativename $pattern] \"]] \n] {
  1638   1668           set fileName [string trim $fileName]
  1639   1669   
  1640   1670           if {[string length $fileName] > 0} then {
  1641   1671             set fileName [getDirResultPath $pattern $fileName]
  1642   1672   
  1643         -          if {[lsearch -exact -nocase $result $fileName] == -1} then {
         1673  +          if {[lsearch -variable -exact -nocase result $fileName] == -1} then {
  1644   1674               lappend result $fileName
  1645   1675             }
  1646   1676           }
  1647   1677         }
  1648   1678   
  1649   1679         foreach fileName [split [exec -unicode $::env(ComSpec) /u /c dir \
  1650   1680             /ah-d /s /b [appendArgs \" [file nativename $pattern] \"]] \n] {
  1651   1681           set fileName [string trim $fileName]
  1652   1682   
  1653   1683           if {[string length $fileName] > 0} then {
  1654   1684             set fileName [getDirResultPath $pattern $fileName]
  1655   1685   
  1656         -          if {[lsearch -exact -nocase $result $fileName] == -1} then {
         1686  +          if {[lsearch -variable -exact -nocase result $fileName] == -1} then {
  1657   1687               lappend result $fileName
  1658   1688             }
  1659   1689           }
  1660   1690         }
  1661   1691   
  1662   1692         return $result
  1663   1693       }
................................................................................
  1707   1737         eval lappend result [glob -nocomplain -types {f hidden} \
  1708   1738             [file normalize $pattern]]
  1709   1739   
  1710   1740         return $result
  1711   1741       }
  1712   1742   
  1713   1743       proc findFilesRecursive { pattern } {
         1744  +      #
         1745  +      # NOTE: Block non-Windows platforms since this is Windows specific.
         1746  +      #
         1747  +      if {$::tcl_platform(platform) ne "windows"} then {
         1748  +        error "not supported on this operating system"
         1749  +      }
         1750  +
  1714   1751         #
  1715   1752         # NOTE: This should work properly in Tcl only.
  1716   1753         #
  1717   1754         set result [list]
  1718   1755   
  1719   1756         catch {
  1720   1757           foreach fileName [split [exec $::env(ComSpec) /c dir /a-d /s /b \
................................................................................
  1794   1831       }
  1795   1832   
  1796   1833       #
  1797   1834       # NOTE: Exports the necessary commands from this package and import them
  1798   1835       #       into the global namespace.
  1799   1836       #
  1800   1837       exportAndImportPackageCommands [namespace current] [list \
  1801         -        exportAndImportPackageCommands isEagle isMono getEnvironmentVariable \
  1802         -        getPluginPath getDictionaryValue getColumnValue getRowColumnValue \
  1803         -        appendArgs haveGaruda lappendArgs readFile writeFile filter map \
  1804         -        reduce getPlatformInfo execShell combineFlags tqputs tqlog] false false
         1838  +        isEagle haveGaruda isMono getEnvironmentVariable combineFlags \
         1839  +        getCompileInfo getPlatformInfo getPluginPath appendArgs lappendArgs \
         1840  +        getDictionaryValue getColumnValue getRowColumnValue tqputs tqlog \
         1841  +        readFile readSharedFile writeFile appendFile appendLogFile \
         1842  +        appendSharedFile appendSharedLogFile readAsciiFile writeAsciiFile \
         1843  +        readUnicodeFile writeUnicodeFile getDirResultPath addToPath \
         1844  +        removeFromPath execShell ldifference filter map reduce \
         1845  +        getLengthModifier debug findDirectories findFiles findFilesRecursive \
         1846  +        exportAndImportPackageCommands] false false
  1805   1847   
  1806   1848       ###########################################################################
  1807   1849       ############################## END Tcl ONLY ###############################
  1808   1850       ###########################################################################
  1809   1851     }
  1810   1852   
  1811   1853     #
  1812   1854     # NOTE: Provide the Eagle library package to the interpreter.
  1813   1855     #
  1814   1856     package provide Eagle.Library \
  1815   1857       [expr {[isEagle] ? [info engine PatchLevel] : "1.0"}]
  1816   1858   }
  1817   1859   

Changes to Externals/Eagle/lib/Eagle1.0/test.eagle.

  1316   1316               #
  1317   1317               # NOTE: Determine if any resource leaks have occurred and
  1318   1318               #       output diagnostics as necessary if they have.
  1319   1319               #
  1320   1320               reportTestStatistics $channel $fileName leaks leaked
  1321   1321             }
  1322   1322           } else {
         1323  +          #
         1324  +          # NOTE: This entire file has been skipped.  Record that fact in the
         1325  +          #       test suite log file.
         1326  +          #
         1327  +          tputs $channel [appendArgs "==== \"" $fileName "\" NON_TEST_FILE\n"]
         1328  +
  1323   1329             #
  1324   1330             # NOTE: This file does not actually count towards the total (i.e.
  1325   1331             #       it contains no actual tests).
  1326   1332             #
  1327   1333             incr total -1
  1328   1334           }
  1329   1335   
................................................................................
  1346   1352           #       break out of the test loop now.
  1347   1353           #
  1348   1354           if {$stop} then {
  1349   1355             break
  1350   1356           }
  1351   1357         } else {
  1352   1358           #
  1353         -        # NOTE: This entire test file has been skipped.  Record that fact in
  1354         -        #       the test suite log file.
         1359  +        # NOTE: This entire file has been skipped.  Record that fact in the
         1360  +        #       test suite log file.
  1355   1361           #
  1356   1362           tputs $channel [appendArgs "==== \"" $fileName "\" SKIPPED\n"]
  1357   1363   
  1358   1364           #
  1359   1365           # NOTE: This file does not actually count towards the total (i.e.
  1360   1366           #       it is part of the test suite infrastructure).
  1361   1367           #

Changes to SQLite.Interop/props/sqlite3.props.

     5      5    *
     6      6    * Written by Joe Mistachkin.
     7      7    * Released to the public domain, use at your own risk!
     8      8    *
     9      9   -->
    10     10   <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
    11     11     <PropertyGroup Label="UserMacros">
    12         -    <SQLITE_MANIFEST_VERSION>3.7.16</SQLITE_MANIFEST_VERSION>
    13         -    <SQLITE_RC_VERSION>3,7,16</SQLITE_RC_VERSION>
           12  +    <SQLITE_MANIFEST_VERSION>3.7.15.2</SQLITE_MANIFEST_VERSION>
           13  +    <SQLITE_RC_VERSION>3,7,15,2</SQLITE_RC_VERSION>
    14     14       <SQLITE_COMMON_DEFINES>_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_STAT3=1;SQLITE_ENABLE_FTS3=1;SQLITE_ENABLE_LOAD_EXTENSION=1;SQLITE_ENABLE_RTREE=1;SQLITE_SOUNDEX=1</SQLITE_COMMON_DEFINES>
    15     15       <SQLITE_EXTRA_DEFINES>SQLITE_HAS_CODEC=1</SQLITE_EXTRA_DEFINES>
    16     16       <SQLITE_WINCE_DEFINES>SQLITE_OMIT_WAL=1</SQLITE_WINCE_DEFINES>
    17     17       <SQLITE_DEBUG_DEFINES>SQLITE_DEBUG=1;SQLITE_MEMDEBUG=1;SQLITE_ENABLE_EXPENSIVE_ASSERT=1</SQLITE_DEBUG_DEFINES>
    18     18       <SQLITE_RELEASE_DEFINES>SQLITE_WIN32_MALLOC=1</SQLITE_RELEASE_DEFINES>
    19     19       <SQLITE_DISABLE_WARNINGS>4055;4100;4127;4146;4210;4232;4244;4245;4267;4306;4389;4701;4703;4706</SQLITE_DISABLE_WARNINGS>
    20     20       <SQLITE_DISABLE_X64_WARNINGS></SQLITE_DISABLE_X64_WARNINGS>

Changes to SQLite.Interop/props/sqlite3.vsprops.

    10     10   <VisualStudioPropertySheet
    11     11   	ProjectType="Visual C++"
    12     12   	Version="8.00"
    13     13   	Name="sqlite3"
    14     14   	>
    15     15   	<UserMacro
    16     16   		Name="SQLITE_MANIFEST_VERSION"
    17         -		Value="3.7.16"
           17  +		Value="3.7.15.2"
    18     18   		PerformEnvironmentSet="true"
    19     19   	/>
    20     20   	<UserMacro
    21     21   		Name="SQLITE_RC_VERSION"
    22         -		Value="3,7,16"
           22  +		Value="3,7,15,2"
    23     23   		PerformEnvironmentSet="true"
    24     24   	/>
    25     25   	<UserMacro
    26     26   		Name="SQLITE_COMMON_DEFINES"
    27     27   		Value="_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_STAT3=1;SQLITE_ENABLE_FTS3=1;SQLITE_ENABLE_LOAD_EXTENSION=1;SQLITE_ENABLE_RTREE=1;SQLITE_SOUNDEX=1"
    28     28   		PerformEnvironmentSet="true"
    29     29   	/>

Changes to SQLite.Interop/src/core/sqlite3.c.

     1      1   /******************************************************************************
     2      2   ** This file is an amalgamation of many separate C source files from SQLite
     3         -** version 3.7.16.  By combining all the individual C code files into this 
            3  +** version 3.7.15.2.  By combining all the individual C code files into this 
     4      4   ** single large file, the entire code can be compiled as a single translation
     5      5   ** unit.  This allows many compilers to do optimizations that would not be
     6      6   ** possible if the files were compiled separately.  Performance improvements
     7      7   ** of 5% or more are commonly seen when SQLite is compiled as a single
     8      8   ** translation unit.
     9      9   **
    10     10   ** This file is all you need to compile SQLite.  To use SQLite in other
................................................................................
   669    669   ** string contains the date and time of the check-in (UTC) and an SHA1
   670    670   ** hash of the entire source tree.
   671    671   **
   672    672   ** See also: [sqlite3_libversion()],
   673    673   ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
   674    674   ** [sqlite_version()] and [sqlite_source_id()].
   675    675   */
   676         -#define SQLITE_VERSION        "3.7.16"
   677         -#define SQLITE_VERSION_NUMBER 3007016
   678         -#define SQLITE_SOURCE_ID      "2013-01-04 19:22:33 8285b15a058811a9a8b452837f52e6a065868115"
          676  +#define SQLITE_VERSION        "3.7.15.2"
          677  +#define SQLITE_VERSION_NUMBER 3007015
          678  +#define SQLITE_SOURCE_ID      "2013-01-09 11:53:05 c0e09560d26f0a6456be9dd3447f5311eb4f238f"
   679    679   
   680    680   /*
   681    681   ** CAPI3REF: Run-Time Library Version Numbers
   682    682   ** KEYWORDS: sqlite3_version, sqlite3_sourceid
   683    683   **
   684    684   ** These interfaces provide the same information as the [SQLITE_VERSION],
   685    685   ** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros
................................................................................
 10551  10551   ** must be unique and what to do if they are not.  When Index.onError=OE_None,
 10552  10552   ** it means this is not a unique index.  Otherwise it is a unique index
 10553  10553   ** and the value of Index.onError indicate the which conflict resolution 
 10554  10554   ** algorithm to employ whenever an attempt is made to insert a non-unique
 10555  10555   ** element.
 10556  10556   */
 10557  10557   struct Index {
 10558         -  char *zName;             /* Name of this index */
 10559         -  int *aiColumn;           /* Which columns are used by this index.  1st is 0 */
 10560         -  tRowcnt *aiRowEst;       /* From ANALYZE: Est. rows selected by each column */
 10561         -  Table *pTable;           /* The SQL table being indexed */
 10562         -  char *zColAff;           /* String defining the affinity of each column */
 10563         -  Index *pNext;            /* The next index associated with the same table */
 10564         -  Schema *pSchema;         /* Schema containing this index */
 10565         -  u8 *aSortOrder;          /* for each column: True==DESC, False==ASC */
 10566         -  char **azColl;           /* Array of collation sequence names for index */
 10567         -  int tnum;                /* DB Page containing root of this index */
 10568         -  u16 nColumn;             /* Number of columns in table used by this index */
 10569         -  u8 onError;              /* OE_Abort, OE_Ignore, OE_Replace, or OE_None */
 10570         -  unsigned autoIndex:2;    /* 1==UNIQUE, 2==PRIMARY KEY, 0==CREATE INDEX */
 10571         -  unsigned bUnordered:1;   /* Use this index for == or IN queries only */
        10558  +  char *zName;     /* Name of this index */
        10559  +  int *aiColumn;   /* Which columns are used by this index.  1st is 0 */
        10560  +  tRowcnt *aiRowEst; /* Result of ANALYZE: Est. rows selected by each column */
        10561  +  Table *pTable;   /* The SQL table being indexed */
        10562  +  char *zColAff;   /* String defining the affinity of each column */
        10563  +  Index *pNext;    /* The next index associated with the same table */
        10564  +  Schema *pSchema; /* Schema containing this index */
        10565  +  u8 *aSortOrder;  /* Array of size Index.nColumn. True==DESC, False==ASC */
        10566  +  char **azColl;   /* Array of collation sequence names for index */
        10567  +  int nColumn;     /* Number of columns in the table used by this index */
        10568  +  int tnum;        /* Page containing root of this index in database file */
        10569  +  u8 onError;      /* OE_Abort, OE_Ignore, OE_Replace, or OE_None */
        10570  +  u8 autoIndex;    /* True if is automatically created (ex: by UNIQUE) */
        10571  +  u8 bUnordered;   /* Use this index for == or IN queries only */
 10572  10572   #ifdef SQLITE_ENABLE_STAT3
 10573  10573     int nSample;             /* Number of elements in aSample[] */
 10574  10574     tRowcnt avgEq;           /* Average nEq value for key values not in aSample */
 10575  10575     IndexSample *aSample;    /* Samples of the left-most key */
 10576  10576   #endif
 10577  10577   };
 10578  10578   
................................................................................
 10838  10838   /*
 10839  10839   ** A list of expressions.  Each expression may optionally have a
 10840  10840   ** name.  An expr/name combination can be used in several ways, such
 10841  10841   ** as the list of "expr AS ID" fields following a "SELECT" or in the
 10842  10842   ** list of "ID = expr" items in an UPDATE.  A list of expressions can
 10843  10843   ** also be used as the argument to a function, in which case the a.zName
 10844  10844   ** field is not used.
 10845         -**
 10846         -** By default the Expr.zSpan field holds a human-readable description of
 10847         -** the expression that is used in the generation of error messages and
 10848         -** column labels.  In this case, Expr.zSpan is typically the text of a
 10849         -** column expression as it exists in a SELECT statement.  However, if
 10850         -** the bSpanIsTab flag is set, then zSpan is overloaded to mean the name
 10851         -** of the result column in the form: DATABASE.TABLE.COLUMN.  This later
 10852         -** form is used for name resolution with nested FROM clauses.
 10853  10845   */
 10854  10846   struct ExprList {
 10855  10847     int nExpr;             /* Number of expressions on the list */
 10856  10848     int iECursor;          /* VDBE Cursor associated with this ExprList */
 10857  10849     struct ExprList_item { /* For each expression in the list */
 10858         -    Expr *pExpr;            /* The list of expressions */
 10859         -    char *zName;            /* Token associated with this expression */
 10860         -    char *zSpan;            /* Original text of the expression */
 10861         -    u8 sortOrder;           /* 1 for DESC or 0 for ASC */
 10862         -    unsigned done :1;       /* A flag to indicate when processing is finished */
 10863         -    unsigned bSpanIsTab :1; /* zSpan holds DB.TABLE.COLUMN */
 10864         -    u16 iOrderByCol;        /* For ORDER BY, column number in result set */
 10865         -    u16 iAlias;             /* Index into Parse.aAlias[] for zName */
        10850  +    Expr *pExpr;           /* The list of expressions */
        10851  +    char *zName;           /* Token associated with this expression */
        10852  +    char *zSpan;           /* Original text of the expression */
        10853  +    u8 sortOrder;          /* 1 for DESC or 0 for ASC */
        10854  +    u8 done;               /* A flag to indicate when processing is finished */
        10855  +    u16 iOrderByCol;       /* For ORDER BY, column number in result set */
        10856  +    u16 iAlias;            /* Index into Parse.aAlias[] for zName */
 10866  10857     } *a;                  /* Alloc a power of two greater or equal to nExpr */
 10867  10858   };
 10868  10859   
 10869  10860   /*
 10870  10861   ** An instance of this structure is used by the parser to record both
 10871  10862   ** the parse tree for an expression and the span of input text for an
 10872  10863   ** expression.
................................................................................
 11178  11169   #define SF_Aggregate       0x0004  /* Contains aggregate functions */
 11179  11170   #define SF_UsesEphemeral   0x0008  /* Uses the OpenEphemeral opcode */
 11180  11171   #define SF_Expanded        0x0010  /* sqlite3SelectExpand() called on this */
 11181  11172   #define SF_HasTypeInfo     0x0020  /* FROM subqueries have Table metadata */
 11182  11173   #define SF_UseSorter       0x0040  /* Sort using a sorter */
 11183  11174   #define SF_Values          0x0080  /* Synthesized from VALUES clause */
 11184  11175   #define SF_Materialize     0x0100  /* Force materialization of views */
 11185         -#define SF_NestedFrom      0x0200  /* Part of a parenthesized FROM clause */
 11186  11176   
 11187  11177   
 11188  11178   /*
 11189  11179   ** The results of a select can be distributed in several ways.  The
 11190  11180   ** "SRT" prefix means "SELECT Result Type".
 11191  11181   */
 11192  11182   #define SRT_Union        1  /* Store result as keys in an index */
................................................................................
 11891  11881   SQLITE_PRIVATE void sqlite3IdListDelete(sqlite3*, IdList*);
 11892  11882   SQLITE_PRIVATE void sqlite3SrcListDelete(sqlite3*, SrcList*);
 11893  11883   SQLITE_PRIVATE Index *sqlite3CreateIndex(Parse*,Token*,Token*,SrcList*,ExprList*,int,Token*,
 11894  11884                           Token*, int, int);
 11895  11885   SQLITE_PRIVATE void sqlite3DropIndex(Parse*, SrcList*, int);
 11896  11886   SQLITE_PRIVATE int sqlite3Select(Parse*, Select*, SelectDest*);
 11897  11887   SQLITE_PRIVATE Select *sqlite3SelectNew(Parse*,ExprList*,SrcList*,Expr*,ExprList*,
 11898         -                         Expr*,ExprList*,u16,Expr*,Expr*);
        11888  +                         Expr*,ExprList*,int,Expr*,Expr*);
 11899  11889   SQLITE_PRIVATE void sqlite3SelectDelete(sqlite3*, Select*);
 11900  11890   SQLITE_PRIVATE Table *sqlite3SrcListLookup(Parse*, SrcList*);
 11901  11891   SQLITE_PRIVATE int sqlite3IsReadOnly(Parse*, Table*, int);
 11902  11892   SQLITE_PRIVATE void sqlite3OpenTable(Parse*, int iCur, int iDb, Table*, int);
 11903  11893   #if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY)
 11904  11894   SQLITE_PRIVATE Expr *sqlite3LimitWhere(Parse *, SrcList *, Expr *, ExprList *, Expr *, Expr *, char *);
 11905  11895   #endif
................................................................................
 12148  12138   SQLITE_PRIVATE void sqlite3AlterFunctions(void);
 12149  12139   SQLITE_PRIVATE void sqlite3AlterRenameTable(Parse*, SrcList*, Token*);
 12150  12140   SQLITE_PRIVATE int sqlite3GetToken(const unsigned char *, int *);
 12151  12141   SQLITE_PRIVATE void sqlite3NestedParse(Parse*, const char*, ...);
 12152  12142   SQLITE_PRIVATE void sqlite3ExpirePreparedStatements(sqlite3*);
 12153  12143   SQLITE_PRIVATE int sqlite3CodeSubselect(Parse *, Expr *, int, int);
 12154  12144   SQLITE_PRIVATE void sqlite3SelectPrep(Parse*, Select*, NameContext*);
 12155         -SQLITE_PRIVATE int sqlite3MatchSpanName(const char*, const char*, const char*, const char*);
 12156  12145   SQLITE_PRIVATE int sqlite3ResolveExprNames(NameContext*, Expr*);
 12157  12146   SQLITE_PRIVATE void sqlite3ResolveSelectNames(Parse*, Select*, NameContext*);
 12158  12147   SQLITE_PRIVATE int sqlite3ResolveOrderGroupBy(Parse*, Select*, ExprList*, const char*);
 12159  12148   SQLITE_PRIVATE void sqlite3ColumnDefault(Vdbe *, Table *, int, int);
 12160  12149   SQLITE_PRIVATE void sqlite3AlterFinishAddColumn(Parse *, Token *);
 12161  12150   SQLITE_PRIVATE void sqlite3AlterBeginAddColumn(Parse *, SrcList *);
 12162  12151   SQLITE_PRIVATE CollSeq *sqlite3GetCollSeq(Parse*, u8, CollSeq *, const char*);
................................................................................
 12287  12276     #define sqlite3FkCheck(a,b,c,d)
 12288  12277     #define sqlite3FkDropTable(a,b,c)
 12289  12278     #define sqlite3FkOldmask(a,b)      0
 12290  12279     #define sqlite3FkRequired(a,b,c,d) 0
 12291  12280   #endif
 12292  12281   #ifndef SQLITE_OMIT_FOREIGN_KEY
 12293  12282   SQLITE_PRIVATE   void sqlite3FkDelete(sqlite3 *, Table*);
 12294         -SQLITE_PRIVATE   int sqlite3FkLocateIndex(Parse*,Table*,FKey*,Index**,int**);
 12295  12283   #else
 12296  12284     #define sqlite3FkDelete(a,b)
 12297         -  #define sqlite3FkLocateIndex(a,b,c,d,e)
 12298  12285   #endif
 12299  12286   
 12300  12287   
 12301  12288   /*
 12302  12289   ** Available fault injectors.  Should be numbered beginning with 0.
 12303  12290   */
 12304  12291   #define SQLITE_FAULTINJECTOR_MALLOC     0
................................................................................
 56345  56332     if( !sCheck.aPgRef ){
 56346  56333       *pnErr = 1;
 56347  56334       sqlite3BtreeLeave(p);
 56348  56335       return 0;
 56349  56336     }
 56350  56337     i = PENDING_BYTE_PAGE(pBt);
 56351  56338     if( i<=sCheck.nPage ) setPageReferenced(&sCheck, i);
 56352         -  sqlite3StrAccumInit(&sCheck.errMsg, zErr, sizeof(zErr), SQLITE_MAX_LENGTH);
        56339  +  sqlite3StrAccumInit(&sCheck.errMsg, zErr, sizeof(zErr), 20000);
 56353  56340     sCheck.errMsg.useMalloc = 2;
 56354  56341   
 56355  56342     /* Check the integrity of the freelist
 56356  56343     */
 56357  56344     checkList(&sCheck, 1, get4byte(&pBt->pPage1->aData[32]),
 56358  56345               get4byte(&pBt->pPage1->aData[36]), "Main freelist: ");
 56359  56346   
................................................................................
 56880  56867   }
 56881  56868   
 56882  56869   /*
 56883  56870   ** Parameter zSrcData points to a buffer containing the data for 
 56884  56871   ** page iSrcPg from the source database. Copy this data into the 
 56885  56872   ** destination database.
 56886  56873   */
 56887         -static int backupOnePage(
 56888         -  sqlite3_backup *p,              /* Backup handle */
 56889         -  Pgno iSrcPg,                    /* Source database page to backup */
 56890         -  const u8 *zSrcData,             /* Source database page data */
 56891         -  int bUpdate                     /* True for an update, false otherwise */
 56892         -){
        56874  +static int backupOnePage(sqlite3_backup *p, Pgno iSrcPg, const u8 *zSrcData){
 56893  56875     Pager * const pDestPager = sqlite3BtreePager(p->pDest);
 56894  56876     const int nSrcPgsz = sqlite3BtreeGetPageSize(p->pSrc);
 56895  56877     int nDestPgsz = sqlite3BtreeGetPageSize(p->pDest);
 56896  56878     const int nCopy = MIN(nSrcPgsz, nDestPgsz);
 56897  56879     const i64 iEnd = (i64)iSrcPg*(i64)nSrcPgsz;
 56898  56880   #ifdef SQLITE_HAS_CODEC
 56899  56881     /* Use BtreeGetReserveNoMutex() for the source b-tree, as although it is
................................................................................
 56958  56940         ** and the pager code use this trick (clearing the first byte
 56959  56941         ** of the page 'extra' space to invalidate the Btree layers
 56960  56942         ** cached parse of the page). MemPage.isInit is marked 
 56961  56943         ** "MUST BE FIRST" for this purpose.
 56962  56944         */
 56963  56945         memcpy(zOut, zIn, nCopy);
 56964  56946         ((u8 *)sqlite3PagerGetExtra(pDestPg))[0] = 0;
 56965         -      if( iOff==0 && bUpdate==0 ){
 56966         -        sqlite3Put4byte(&zOut[28], sqlite3BtreeLastPage(p->pSrc));
 56967         -      }
 56968  56947       }
 56969  56948       sqlite3PagerUnref(pDestPg);
 56970  56949     }
 56971  56950   
 56972  56951     return rc;
 56973  56952   }
 56974  56953   
................................................................................
 57067  57046       assert( nSrcPage>=0 );
 57068  57047       for(ii=0; (nPage<0 || ii<nPage) && p->iNext<=(Pgno)nSrcPage && !rc; ii++){
 57069  57048         const Pgno iSrcPg = p->iNext;                 /* Source page number */
 57070  57049         if( iSrcPg!=PENDING_BYTE_PAGE(p->pSrc->pBt) ){
 57071  57050           DbPage *pSrcPg;                             /* Source page object */
 57072  57051           rc = sqlite3PagerGet(pSrcPager, iSrcPg, &pSrcPg);
 57073  57052           if( rc==SQLITE_OK ){
 57074         -          rc = backupOnePage(p, iSrcPg, sqlite3PagerGetData(pSrcPg), 0);
        57053  +          rc = backupOnePage(p, iSrcPg, sqlite3PagerGetData(pSrcPg));
 57075  57054             sqlite3PagerUnref(pSrcPg);
 57076  57055           }
 57077  57056         }
 57078  57057         p->iNext++;
 57079  57058       }
 57080  57059       if( rc==SQLITE_OK ){
 57081  57060         p->nPagecount = nSrcPage;
................................................................................
 57315  57294         /* The backup process p has already copied page iPage. But now it
 57316  57295         ** has been modified by a transaction on the source pager. Copy
 57317  57296         ** the new data into the backup.
 57318  57297         */
 57319  57298         int rc;
 57320  57299         assert( p->pDestDb );
 57321  57300         sqlite3_mutex_enter(p->pDestDb->mutex);
 57322         -      rc = backupOnePage(p, iPage, aData, 1);
        57301  +      rc = backupOnePage(p, iPage, aData);
 57323  57302         sqlite3_mutex_leave(p->pDestDb->mutex);
 57324  57303         assert( rc!=SQLITE_BUSY && rc!=SQLITE_LOCKED );
 57325  57304         if( rc!=SQLITE_OK ){
 57326  57305           p->rc = rc;
 57327  57306         }
 57328  57307       }
 57329  57308     }
................................................................................
 71909  71888       rc = sqlite3OsOpen(p->pVfs, p->zJournal, pReal, p->flags, 0);
 71910  71889       if( rc==SQLITE_OK ){
 71911  71890         p->pReal = pReal;
 71912  71891         if( p->iSize>0 ){
 71913  71892           assert(p->iSize<=p->nBuf);
 71914  71893           rc = sqlite3OsWrite(p->pReal, p->zBuf, p->iSize, 0);
 71915  71894         }
 71916         -      if( rc!=SQLITE_OK ){
 71917         -        /* If an error occurred while writing to the file, close it before
 71918         -        ** returning. This way, SQLite uses the in-memory journal data to 
 71919         -        ** roll back changes made to the internal page-cache before this
 71920         -        ** function was called.  */
 71921         -        sqlite3OsClose(pReal);
 71922         -        p->pReal = 0;
 71923         -      }
 71924  71895       }
 71925  71896     }
 71926  71897     return rc;
 71927  71898   }
 71928  71899   
 71929  71900   /*
 71930  71901   ** Close the file.
................................................................................
 72663  72634       for(k=0; k<pUsing->nId; k++){
 72664  72635         if( sqlite3StrICmp(pUsing->a[k].zName, zCol)==0 ) return 1;
 72665  72636       }
 72666  72637     }
 72667  72638     return 0;
 72668  72639   }
 72669  72640   
 72670         -/*
 72671         -** Subqueries stores the original database, table and column names for their
 72672         -** result sets in ExprList.a[].zSpan, in the form "DATABASE.TABLE.COLUMN".
 72673         -** Check to see if the zSpan given to this routine matches the zDb, zTab,
 72674         -** and zCol.  If any of zDb, zTab, and zCol are NULL then those fields will
 72675         -** match anything.
 72676         -*/
 72677         -SQLITE_PRIVATE int sqlite3MatchSpanName(
 72678         -  const char *zSpan,
 72679         -  const char *zCol,
 72680         -  const char *zTab,
 72681         -  const char *zDb
 72682         -){
 72683         -  int n;
 72684         -  for(n=0; ALWAYS(zSpan[n]) && zSpan[n]!='.'; n++){}
 72685         -  if( zDb && sqlite3StrNICmp(zSpan, zDb, n)!=0 ){
 72686         -    return 0;
 72687         -  }
 72688         -  zSpan += n+1;
 72689         -  for(n=0; ALWAYS(zSpan[n]) && zSpan[n]!='.'; n++){}
 72690         -  if( zTab && sqlite3StrNICmp(zSpan, zTab, n)!=0 ){
 72691         -    return 0;
 72692         -  }
 72693         -  zSpan += n+1;
 72694         -  if( zCol && sqlite3StrICmp(zSpan, zCol)!=0 ){
 72695         -    return 0;
 72696         -  }
 72697         -  return 1;
 72698         -}
 72699  72641   
 72700  72642   /*
 72701  72643   ** Given the name of a column of the form X.Y.Z or Y.Z or just Z, look up
 72702  72644   ** that name in the set of source tables in pSrcList and make the pExpr 
 72703  72645   ** expression node refer back to that source column.  The following changes
 72704  72646   ** are made to pExpr:
 72705  72647   **
................................................................................
 72748  72690     assert( !ExprHasAnyProperty(pExpr, EP_TokenOnly|EP_Reduced) );
 72749  72691   
 72750  72692     /* Initialize the node to no-match */
 72751  72693     pExpr->iTable = -1;
 72752  72694     pExpr->pTab = 0;
 72753  72695     ExprSetIrreducible(pExpr);
 72754  72696   
 72755         -  /* Translate the schema name in zDb into a pointer to the corresponding
 72756         -  ** schema.  If not found, pSchema will remain NULL and nothing will match
 72757         -  ** resulting in an appropriate error message toward the end of this routine
 72758         -  */
 72759         -  if( zDb ){
 72760         -    for(i=0; i<db->nDb; i++){
 72761         -      assert( db->aDb[i].zName );
 72762         -      if( sqlite3StrICmp(db->aDb[i].zName,zDb)==0 ){
 72763         -        pSchema = db->aDb[i].pSchema;
 72764         -        break;
 72765         -      }
 72766         -    }
 72767         -  }
 72768         -
 72769  72697     /* Start at the inner-most context and move outward until a match is found */
 72770  72698     while( pNC && cnt==0 ){
 72771  72699       ExprList *pEList;
 72772  72700       SrcList *pSrcList = pNC->pSrcList;
 72773  72701   
 72774  72702       if( pSrcList ){
 72775  72703         for(i=0, pItem=pSrcList->a; i<pSrcList->nSrc; i++, pItem++){
 72776  72704           Table *pTab;
        72705  +        int iDb;
 72777  72706           Column *pCol;
 72778  72707     
 72779  72708           pTab = pItem->pTab;
 72780  72709           assert( pTab!=0 && pTab->zName!=0 );
        72710  +        iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
 72781  72711           assert( pTab->nCol>0 );
 72782         -        if( pItem->pSelect && (pItem->pSelect->selFlags & SF_NestedFrom)!=0 ){
 72783         -          ExprList *pEList = pItem->pSelect->pEList;
 72784         -          int hit = 0;
 72785         -          for(j=0; j<pEList->nExpr; j++){
 72786         -            if( sqlite3MatchSpanName(pEList->a[j].zSpan, zCol, zTab, zDb) ){
 72787         -              cnt++;
 72788         -              cntTab = 2;
 72789         -              pMatch = pItem;
 72790         -              pExpr->iColumn = j;
 72791         -              hit = 1;
 72792         -            }
 72793         -          }
 72794         -          if( hit || zTab==0 ) continue;
 72795         -        }
 72796         -        if( zDb && pTab->pSchema!=pSchema ){
 72797         -          continue;
 72798         -        }
 72799  72712           if( zTab ){
 72800         -          const char *zTabName = pItem->zAlias ? pItem->zAlias : pTab->zName;
 72801         -          assert( zTabName!=0 );
 72802         -          if( sqlite3StrICmp(zTabName, zTab)!=0 ){
 72803         -            continue;
        72713  +          if( pItem->zAlias ){
        72714  +            char *zTabName = pItem->zAlias;
        72715  +            if( sqlite3StrICmp(zTabName, zTab)!=0 ) continue;
        72716  +          }else{
        72717  +            char *zTabName = pTab->zName;
        72718  +            if( NEVER(zTabName==0) || sqlite3StrICmp(zTabName, zTab)!=0 ){
        72719  +              continue;
        72720  +            }
        72721  +            if( zDb!=0 && sqlite3StrICmp(db->aDb[iDb].zName, zDb)!=0 ){
        72722  +              continue;
        72723  +            }
 72804  72724             }
 72805  72725           }
 72806  72726           if( 0==(cntTab++) ){
        72727  +          pExpr->iTable = pItem->iCursor;
        72728  +          pExpr->pTab = pTab;
        72729  +          pSchema = pTab->pSchema;
 72807  72730             pMatch = pItem;
 72808  72731           }
 72809  72732           for(j=0, pCol=pTab->aCol; j<pTab->nCol; j++, pCol++){
 72810  72733             if( sqlite3StrICmp(pCol->zName, zCol)==0 ){
 72811  72734               /* If there has been exactly one prior match and this match
 72812  72735               ** is for the right-hand table of a NATURAL JOIN or is in a 
 72813  72736               ** USING clause, then skip this match.
 72814  72737               */
 72815  72738               if( cnt==1 ){
 72816  72739                 if( pItem->jointype & JT_NATURAL ) continue;
 72817  72740                 if( nameInUsingClause(pItem->pUsing, zCol) ) continue;
 72818  72741               }
 72819  72742               cnt++;
        72743  +            pExpr->iTable = pItem->iCursor;
        72744  +            pExpr->pTab = pTab;
 72820  72745               pMatch = pItem;
        72746  +            pSchema = pTab->pSchema;
 72821  72747               /* Substitute the rowid (column -1) for the INTEGER PRIMARY KEY */
 72822  72748               pExpr->iColumn = j==pTab->iPKey ? -1 : (i16)j;
 72823  72749               break;
 72824  72750             }
 72825  72751           }
 72826  72752         }
 72827         -      if( pMatch ){
 72828         -        pExpr->iTable = pMatch->iCursor;
 72829         -        pExpr->pTab = pMatch->pTab;
 72830         -        pSchema = pExpr->pTab->pSchema;
 72831         -      }
 72832         -    } /* if( pSrcList ) */
        72753  +    }
 72833  72754   
 72834  72755   #ifndef SQLITE_OMIT_TRIGGER
 72835  72756       /* If we have not already resolved the name, then maybe 
 72836  72757       ** it is a new.* or old.* trigger argument reference
 72837  72758       */
 72838  72759       if( zDb==0 && zTab!=0 && cnt==0 && pParse->pTriggerTab!=0 ){
 72839  72760         int op = pParse->eTriggerOp;
................................................................................
 73595  73516       */
 73596  73517       memset(&sNC, 0, sizeof(sNC));
 73597  73518       sNC.pParse = pParse;
 73598  73519       if( sqlite3ResolveExprNames(&sNC, p->pLimit) ||
 73599  73520           sqlite3ResolveExprNames(&sNC, p->pOffset) ){
 73600  73521         return WRC_Abort;
 73601  73522       }
        73523  +  
        73524  +    /* Set up the local name-context to pass to sqlite3ResolveExprNames() to
        73525  +    ** resolve the result-set expression list.
        73526  +    */
        73527  +    sNC.ncFlags = NC_AllowAgg;
        73528  +    sNC.pSrcList = p->pSrc;
        73529  +    sNC.pNext = pOuterNC;
        73530  +  
        73531  +    /* Resolve names in the result set. */
        73532  +    pEList = p->pEList;
        73533  +    assert( pEList!=0 );
        73534  +    for(i=0; i<pEList->nExpr; i++){
        73535  +      Expr *pX = pEList->a[i].pExpr;
        73536  +      if( sqlite3ResolveExprNames(&sNC, pX) ){
        73537  +        return WRC_Abort;
        73538  +      }
        73539  +    }
 73602  73540     
 73603  73541       /* Recursively resolve names in all subqueries
 73604  73542       */
 73605  73543       for(i=0; i<p->pSrc->nSrc; i++){
 73606  73544         struct SrcList_item *pItem = &p->pSrc->a[i];
 73607  73545         if( pItem->pSelect ){
 73608  73546           NameContext *pNC;         /* Used to iterate name contexts */
................................................................................
 73623  73561   
 73624  73562           for(pNC=pOuterNC; pNC; pNC=pNC->pNext) nRef -= pNC->nRef;
 73625  73563           assert( pItem->isCorrelated==0 && nRef<=0 );
 73626  73564           pItem->isCorrelated = (nRef!=0);
 73627  73565         }
 73628  73566       }
 73629  73567     
 73630         -    /* Set up the local name-context to pass to sqlite3ResolveExprNames() to
 73631         -    ** resolve the result-set expression list.
 73632         -    */
 73633         -    sNC.ncFlags = NC_AllowAgg;
 73634         -    sNC.pSrcList = p->pSrc;
 73635         -    sNC.pNext = pOuterNC;
 73636         -  
 73637         -    /* Resolve names in the result set. */
 73638         -    pEList = p->pEList;
 73639         -    assert( pEList!=0 );
 73640         -    for(i=0; i<pEList->nExpr; i++){
 73641         -      Expr *pX = pEList->a[i].pExpr;
 73642         -      if( sqlite3ResolveExprNames(&sNC, pX) ){
 73643         -        return WRC_Abort;
 73644         -      }
 73645         -    }
 73646         -  
 73647  73568       /* If there are no aggregate functions in the result-set, and no GROUP BY 
 73648  73569       ** expression, do not allow aggregates in any of the other expressions.
 73649  73570       */
 73650  73571       assert( (p->selFlags & SF_Aggregate)==0 );
 73651  73572       pGroupBy = p->pGroupBy;
 73652  73573       if( pGroupBy || (sNC.ncFlags & NC_HasAgg)!=0 ){
 73653  73574         p->selFlags |= SF_Aggregate;
................................................................................
 77123  77044     }else{
 77124  77045       sqlite3ExplainPush(pOut);
 77125  77046       for(i=0; i<pList->nExpr; i++){
 77126  77047         sqlite3ExplainPrintf(pOut, "item[%d] = ", i);
 77127  77048         sqlite3ExplainPush(pOut);
 77128  77049         sqlite3ExplainExpr(pOut, pList->a[i].pExpr);
 77129  77050         sqlite3ExplainPop(pOut);
 77130         -      if( pList->a[i].zName ){
 77131         -        sqlite3ExplainPrintf(pOut, " AS %s", pList->a[i].zName);
 77132         -      }
 77133         -      if( pList->a[i].bSpanIsTab ){
 77134         -        sqlite3ExplainPrintf(pOut, " (%s)", pList->a[i].zSpan);
 77135         -      }
 77136  77051         if( i<pList->nExpr-1 ){
 77137  77052           sqlite3ExplainNL(pOut);
 77138  77053         }
 77139  77054       }
 77140  77055       sqlite3ExplainPop(pOut);
 77141  77056     }
 77142  77057   }
................................................................................
 87606  87521   **   Register (x+3):      3.1  (type real)
 87607  87522   */
 87608  87523   
 87609  87524   /*
 87610  87525   ** A foreign key constraint requires that the key columns in the parent
 87611  87526   ** table are collectively subject to a UNIQUE or PRIMARY KEY constraint.
 87612  87527   ** Given that pParent is the parent table for foreign key constraint pFKey, 
 87613         -** search the schema for a unique index on the parent key columns. 
        87528  +** search the schema a unique index on the parent key columns. 
 87614  87529   **
 87615  87530   ** If successful, zero is returned. If the parent key is an INTEGER PRIMARY 
 87616  87531   ** KEY column, then output variable *ppIdx is set to NULL. Otherwise, *ppIdx 
 87617  87532   ** is set to point to the unique index. 
 87618  87533   ** 
 87619  87534   ** If the parent key consists of a single column (the foreign key constraint
 87620  87535   ** is not a composite foreign key), output variable *paiCol is set to NULL.
................................................................................
 87642  87557   **      consists of a a different number of columns to the child key in 
 87643  87558   **      the child table.
 87644  87559   **
 87645  87560   ** then non-zero is returned, and a "foreign key mismatch" error loaded
 87646  87561   ** into pParse. If an OOM error occurs, non-zero is returned and the
 87647  87562   ** pParse->db->mallocFailed flag is set.
 87648  87563   */
 87649         -SQLITE_PRIVATE int sqlite3FkLocateIndex(
        87564  +static int locateFkeyIndex(
 87650  87565     Parse *pParse,                  /* Parse context to store any error in */
 87651  87566     Table *pParent,                 /* Parent table of FK constraint pFKey */
 87652  87567     FKey *pFKey,                    /* Foreign key to find index for */
 87653  87568     Index **ppIdx,                  /* OUT: Unique index on parent table */
 87654  87569     int **paiCol                    /* OUT: Map of index columns in pFKey */
 87655  87570   ){
 87656  87571     Index *pIdx = 0;                    /* Value to return via *ppIdx */
................................................................................
 87739  87654           if( i==nCol ) break;      /* pIdx is usable */
 87740  87655         }
 87741  87656       }
 87742  87657     }
 87743  87658   
 87744  87659     if( !pIdx ){
 87745  87660       if( !pParse->disableTriggers ){
 87746         -      sqlite3ErrorMsg(pParse,
 87747         -           "foreign key mismatch - \"%w\" referencing \"%w\"",
 87748         -           pFKey->pFrom->zName, pFKey->zTo);
        87661  +      sqlite3ErrorMsg(pParse, "foreign key mismatch");
 87749  87662       }
 87750  87663       sqlite3DbFree(pParse->db, aiCol);
 87751  87664       return 1;
 87752  87665     }
 87753  87666   
 87754  87667     *ppIdx = pIdx;
 87755  87668     return 0;
................................................................................
 88202  88115       ** schema items cannot be located, set an error in pParse and return 
 88203  88116       ** early.  */
 88204  88117       if( pParse->disableTriggers ){
 88205  88118         pTo = sqlite3FindTable(db, pFKey->zTo, zDb);
 88206  88119       }else{
 88207  88120         pTo = sqlite3LocateTable(pParse, 0, pFKey->zTo, zDb);
 88208  88121       }
 88209         -    if( !pTo || sqlite3FkLocateIndex(pParse, pTo, pFKey, &pIdx, &aiFree) ){
        88122  +    if( !pTo || locateFkeyIndex(pParse, pTo, pFKey, &pIdx, &aiFree) ){
 88210  88123         assert( isIgnoreErrors==0 || (regOld!=0 && regNew==0) );
 88211  88124         if( !isIgnoreErrors || db->mallocFailed ) return;
 88212  88125         if( pTo==0 ){
 88213  88126           /* If isIgnoreErrors is true, then a table is being dropped. In this
 88214  88127           ** case SQLite runs a "DELETE FROM xxx" on the table being dropped
 88215  88128           ** before actually dropping it in order to check FK constraints.
 88216  88129           ** If the parent table of an FK constraint on the current table is
................................................................................
 88282  88195       if( !pFKey->isDeferred && !pParse->pToplevel && !pParse->isMultiWrite ){
 88283  88196         assert( regOld==0 && regNew!=0 );
 88284  88197         /* Inserting a single row into a parent table cannot cause an immediate
 88285  88198         ** foreign key violation. So do nothing in this case.  */
 88286  88199         continue;
 88287  88200       }
 88288  88201   
 88289         -    if( sqlite3FkLocateIndex(pParse, pTab, pFKey, &pIdx, &aiCol) ){
        88202  +    if( locateFkeyIndex(pParse, pTab, pFKey, &pIdx, &aiCol) ){
 88290  88203         if( !isIgnoreErrors || db->mallocFailed ) return;
 88291  88204         continue;
 88292  88205       }
 88293  88206       assert( aiCol || pFKey->nCol==1 );
 88294  88207   
 88295  88208       /* Create a SrcList structure containing a single table (the table 
 88296  88209       ** the foreign key that refers to this table is attached to). This
................................................................................
 88337  88250       FKey *p;
 88338  88251       int i;
 88339  88252       for(p=pTab->pFKey; p; p=p->pNextFrom){
 88340  88253         for(i=0; i<p->nCol; i++) mask |= COLUMN_MASK(p->aCol[i].iFrom);
 88341  88254       }
 88342  88255       for(p=sqlite3FkReferences(pTab); p; p=p->pNextTo){
 88343  88256         Index *pIdx = 0;
 88344         -      sqlite3FkLocateIndex(pParse, pTab, p, &pIdx, 0);
        88257  +      locateFkeyIndex(pParse, pTab, p, &pIdx, 0);
 88345  88258         if( pIdx ){
 88346  88259           for(i=0; i<pIdx->nColumn; i++) mask |= COLUMN_MASK(pIdx->aiColumn[i]);
 88347  88260         }
 88348  88261       }
 88349  88262     }
 88350  88263     return mask;
 88351  88264   }
................................................................................
 88463  88376       TriggerStep *pStep = 0;        /* First (only) step of trigger program */
 88464  88377       Expr *pWhere = 0;             /* WHERE clause of trigger step */
 88465  88378       ExprList *pList = 0;          /* Changes list if ON UPDATE CASCADE */
 88466  88379       Select *pSelect = 0;          /* If RESTRICT, "SELECT RAISE(...)" */
 88467  88380       int i;                        /* Iterator variable */
 88468  88381       Expr *pWhen = 0;              /* WHEN clause for the trigger */
 88469  88382   
 88470         -    if( sqlite3FkLocateIndex(pParse, pTab, pFKey, &pIdx, &aiCol) ) return 0;
        88383  +    if( locateFkeyIndex(pParse, pTab, pFKey, &pIdx, &aiCol) ) return 0;
 88471  88384       assert( aiCol || pFKey->nCol==1 );
 88472  88385   
 88473  88386       for(i=0; i<pFKey->nCol; i++){
 88474  88387         Token tOld = { "old", 3 };  /* Literal "old" token */
 88475  88388         Token tNew = { "new", 3 };  /* Literal "new" token */
 88476  88389         Token tFromCol;             /* Name of column in child table */
 88477  88390         Token tToCol;               /* Name of column in parent table */
................................................................................
 92803  92716     ** dflt_value: The default value for the column, if any.
 92804  92717     */
 92805  92718     if( sqlite3StrICmp(zLeft, "table_info")==0 && zRight ){
 92806  92719       Table *pTab;
 92807  92720       if( sqlite3ReadSchema(pParse) ) goto pragma_out;
 92808  92721       pTab = sqlite3FindTable(db, zRight, zDb);
 92809  92722       if( pTab ){
 92810         -      int i, k;
        92723  +      int i;
 92811  92724         int nHidden = 0;
 92812  92725         Column *pCol;
 92813         -      Index *pPk;
 92814         -      for(pPk=pTab->pIndex; pPk && pPk->autoIndex!=2; pPk=pPk->pNext){}
 92815  92726         sqlite3VdbeSetNumCols(v, 6);
 92816  92727         pParse->nMem = 6;
 92817  92728         sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "cid", SQLITE_STATIC);
 92818  92729         sqlite3VdbeSetColName(v, 1, COLNAME_NAME, "name", SQLITE_STATIC);
 92819  92730         sqlite3VdbeSetColName(v, 2, COLNAME_NAME, "type", SQLITE_STATIC);
 92820  92731         sqlite3VdbeSetColName(v, 3, COLNAME_NAME, "notnull", SQLITE_STATIC);
 92821  92732         sqlite3VdbeSetColName(v, 4, COLNAME_NAME, "dflt_value", SQLITE_STATIC);
................................................................................
 92832  92743              pCol->zType ? pCol->zType : "", 0);
 92833  92744           sqlite3VdbeAddOp2(v, OP_Integer, (pCol->notNull ? 1 : 0), 4);
 92834  92745           if( pCol->zDflt ){
 92835  92746             sqlite3VdbeAddOp4(v, OP_String8, 0, 5, 0, (char*)pCol->zDflt, 0);
 92836  92747           }else{
 92837  92748             sqlite3VdbeAddOp2(v, OP_Null, 0, 5);
 92838  92749           }
 92839         -        if( (pCol->colFlags & COLFLAG_PRIMKEY)==0 ){
 92840         -          k = 0;
 92841         -        }else if( pPk==0 ){
 92842         -          k = 1;
 92843         -        }else{
 92844         -          for(k=1; ALWAYS(k<=pTab->nCol) && pPk->aiColumn[k-1]!=i; k++){}
 92845         -        }
 92846         -        sqlite3VdbeAddOp2(v, OP_Integer, k, 6);
        92750  +        sqlite3VdbeAddOp2(v, OP_Integer,
        92751  +                            (pCol->colFlags&COLFLAG_PRIMKEY)!=0, 6);
 92847  92752           sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 6);
 92848  92753         }
 92849  92754       }
 92850  92755     }else
 92851  92756   
 92852  92757     if( sqlite3StrICmp(zLeft, "index_info")==0 && zRight ){
 92853  92758       Index *pIdx;
................................................................................
 92974  92879               sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 8);
 92975  92880             }
 92976  92881             ++i;
 92977  92882             pFK = pFK->pNextFrom;
 92978  92883           }
 92979  92884         }
 92980  92885       }
 92981         -  }else
 92982         -#endif /* !defined(SQLITE_OMIT_FOREIGN_KEY) */
 92983         -
 92984         -#ifndef SQLITE_OMIT_FOREIGN_KEY
 92985         -  if( sqlite3StrICmp(zLeft, "foreign_key_check")==0 ){
 92986         -    FKey *pFK;             /* A foreign key constraint */
 92987         -    Table *pTab;           /* Child table contain "REFERENCES" keyword */
 92988         -    Table *pParent;        /* Parent table that child points to */
 92989         -    Index *pIdx;           /* Index in the parent table */
 92990         -    int i;                 /* Loop counter:  Foreign key number for pTab */
 92991         -    int j;                 /* Loop counter:  Field of the foreign key */
 92992         -    HashElem *k;           /* Loop counter:  Next table in schema */
 92993         -    int x;                 /* result variable */
 92994         -    int regResult;         /* 3 registers to hold a result row */
 92995         -    int regKey;            /* Register to hold key for checking the FK */
 92996         -    int regRow;            /* Registers to hold a row from pTab */
 92997         -    int addrTop;           /* Top of a loop checking foreign keys */
 92998         -    int addrOk;            /* Jump here if the key is OK */
 92999         -    int *aiCols;           /* child to parent column mapping */
 93000         -
 93001         -    if( sqlite3ReadSchema(pParse) ) goto pragma_out;
 93002         -    regResult = pParse->nMem+1;
 93003         -    pParse->nMem += 4;
 93004         -    regKey = ++pParse->nMem;
 93005         -    regRow = ++pParse->nMem;
 93006         -    v = sqlite3GetVdbe(pParse);
 93007         -    sqlite3VdbeSetNumCols(v, 4);
 93008         -    sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "table", SQLITE_STATIC);
 93009         -    sqlite3VdbeSetColName(v, 1, COLNAME_NAME, "rowid", SQLITE_STATIC);
 93010         -    sqlite3VdbeSetColName(v, 2, COLNAME_NAME, "parent", SQLITE_STATIC);
 93011         -    sqlite3VdbeSetColName(v, 3, COLNAME_NAME, "fkid", SQLITE_STATIC);
 93012         -    sqlite3CodeVerifySchema(pParse, iDb);
 93013         -    k = sqliteHashFirst(&db->aDb[iDb].pSchema->tblHash);
 93014         -    while( k ){
 93015         -      if( zRight ){
 93016         -        pTab = sqlite3LocateTable(pParse, 0, zRight, zDb);
 93017         -        k = 0;
 93018         -      }else{
 93019         -        pTab = (Table*)sqliteHashData(k);
 93020         -        k = sqliteHashNext(k);
 93021         -      }
 93022         -      if( pTab==0 || pTab->pFKey==0 ) continue;
 93023         -      sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName);
 93024         -      if( pTab->nCol+regRow>pParse->nMem ) pParse->nMem = pTab->nCol + regRow;
 93025         -      sqlite3OpenTable(pParse, 0, iDb, pTab, OP_OpenRead);
 93026         -      sqlite3VdbeAddOp4(v, OP_String8, 0, regResult, 0, pTab->zName,
 93027         -                        P4_TRANSIENT);
 93028         -      for(i=1, pFK=pTab->pFKey; pFK; i++, pFK=pFK->pNextFrom){
 93029         -        pParent = sqlite3LocateTable(pParse, 0, pFK->zTo, zDb);
 93030         -        if( pParent==0 ) break;
 93031         -        pIdx = 0;
 93032         -        sqlite3TableLock(pParse, iDb, pParent->tnum, 0, pParent->zName);
 93033         -        x = sqlite3FkLocateIndex(pParse, pParent, pFK, &pIdx, 0);
 93034         -        if( x==0 ){
 93035         -          if( pIdx==0 ){
 93036         -            sqlite3OpenTable(pParse, i, iDb, pParent, OP_OpenRead);
 93037         -          }else{
 93038         -            KeyInfo *pKey = sqlite3IndexKeyinfo(pParse, pIdx);
 93039         -            sqlite3VdbeAddOp3(v, OP_OpenRead, i, pIdx->tnum, iDb);
 93040         -            sqlite3VdbeChangeP4(v, -1, (char*)pKey, P4_KEYINFO_HANDOFF);
 93041         -          }
 93042         -        }else{
 93043         -          k = 0;
 93044         -          break;
 93045         -        }
 93046         -      }
 93047         -      if( pFK ) break;
 93048         -      if( pParse->nTab<i ) pParse->nTab = i;
 93049         -      addrTop = sqlite3VdbeAddOp1(v, OP_Rewind, 0);
 93050         -      for(i=1, pFK=pTab->pFKey; pFK; i++, pFK=pFK->pNextFrom){
 93051         -        pParent = sqlite3LocateTable(pParse, 0, pFK->zTo, zDb);
 93052         -        assert( pParent!=0 );
 93053         -        pIdx = 0;
 93054         -        aiCols = 0;
 93055         -        x = sqlite3FkLocateIndex(pParse, pParent, pFK, &pIdx, &aiCols);
 93056         -        assert( x==0 );
 93057         -        addrOk = sqlite3VdbeMakeLabel(v);
 93058         -        if( pIdx==0 ){
 93059         -          int iKey = pFK->aCol[0].iFrom;
 93060         -          assert( iKey>=0 && iKey<pTab->nCol );
 93061         -          if( iKey!=pTab->iPKey ){
 93062         -            sqlite3VdbeAddOp3(v, OP_Column, 0, iKey, regRow);
 93063         -            sqlite3ColumnDefault(v, pTab, iKey, regRow);
 93064         -            sqlite3VdbeAddOp2(v, OP_IsNull, regRow, addrOk);
 93065         -            sqlite3VdbeAddOp2(v, OP_MustBeInt, regRow,
 93066         -               sqlite3VdbeCurrentAddr(v)+3);
 93067         -          }else{
 93068         -            sqlite3VdbeAddOp2(v, OP_Rowid, 0, regRow);
 93069         -          }
 93070         -          sqlite3VdbeAddOp3(v, OP_NotExists, i, 0, regRow);
 93071         -          sqlite3VdbeAddOp2(v, OP_Goto, 0, addrOk);
 93072         -          sqlite3VdbeJumpHere(v, sqlite3VdbeCurrentAddr(v)-2);
 93073         -        }else{
 93074         -          for(j=0; j<pFK->nCol; j++){
 93075         -            sqlite3ExprCodeGetColumnOfTable(v, pTab, 0,
 93076         -                            aiCols ? aiCols[j] : pFK->aCol[0].iFrom, regRow+j);
 93077         -            sqlite3VdbeAddOp2(v, OP_IsNull, regRow+j, addrOk);
 93078         -          }
 93079         -          sqlite3VdbeAddOp3(v, OP_MakeRecord, regRow, pFK->nCol, regKey);
 93080         -          sqlite3VdbeChangeP4(v, -1,
 93081         -                   sqlite3IndexAffinityStr(v,pIdx), P4_TRANSIENT);
 93082         -          sqlite3VdbeAddOp4Int(v, OP_Found, i, addrOk, regKey, 0);
 93083         -        }
 93084         -        sqlite3VdbeAddOp2(v, OP_Rowid, 0, regResult+1);
 93085         -        sqlite3VdbeAddOp4(v, OP_String8, 0, regResult+2, 0, 
 93086         -                          pFK->zTo, P4_TRANSIENT);
 93087         -        sqlite3VdbeAddOp2(v, OP_Integer, i-1, regResult+3);
 93088         -        sqlite3VdbeAddOp2(v, OP_ResultRow, regResult, 4);
 93089         -        sqlite3VdbeResolveLabel(v, addrOk);
 93090         -        sqlite3DbFree(db, aiCols);
 93091         -      }
 93092         -      sqlite3VdbeAddOp2(v, OP_Next, 0, addrTop+1);
 93093         -      sqlite3VdbeJumpHere(v, addrTop);
 93094         -    }
 93095  92886     }else
 93096  92887   #endif /* !defined(SQLITE_OMIT_FOREIGN_KEY) */
 93097  92888   
 93098  92889   #ifndef NDEBUG
 93099  92890     if( sqlite3StrICmp(zLeft, "parser_trace")==0 ){
 93100  92891       if( zRight ){
 93101  92892         if( sqlite3GetBoolean(zRight, 0) ){
................................................................................
 94547  94338     Parse *pParse,        /* Parsing context */
 94548  94339     ExprList *pEList,     /* which columns to include in the result */
 94549  94340     SrcList *pSrc,        /* the FROM clause -- which tables to scan */
 94550  94341     Expr *pWhere,         /* the WHERE clause */
 94551  94342     ExprList *pGroupBy,   /* the GROUP BY clause */
 94552  94343     Expr *pHaving,        /* the HAVING clause */
 94553  94344     ExprList *pOrderBy,   /* the ORDER BY clause */
 94554         -  u16 selFlags,         /* Flag parameters, such as SF_Distinct */
        94345  +  int isDistinct,       /* true if the DISTINCT keyword is present */
 94555  94346     Expr *pLimit,         /* LIMIT value.  NULL means not used */
 94556  94347     Expr *pOffset         /* OFFSET value.  NULL means no offset */
 94557  94348   ){
 94558  94349     Select *pNew;
 94559  94350     Select standin;
 94560  94351     sqlite3 *db = pParse->db;
 94561  94352     pNew = sqlite3DbMallocZero(db, sizeof(*pNew) );
................................................................................
 94571  94362     pNew->pEList = pEList;
 94572  94363     if( pSrc==0 ) pSrc = sqlite3DbMallocZero(db, sizeof(*pSrc));
 94573  94364     pNew->pSrc = pSrc;
 94574  94365     pNew->pWhere = pWhere;
 94575  94366     pNew->pGroupBy = pGroupBy;
 94576  94367     pNew->pHaving = pHaving;
 94577  94368     pNew->pOrderBy = pOrderBy;
 94578         -  pNew->selFlags = selFlags;
        94369  +  pNew->selFlags = isDistinct ? SF_Distinct : 0;
 94579  94370     pNew->op = TK_SELECT;
 94580  94371     pNew->pLimit = pLimit;
 94581  94372     pNew->pOffset = pOffset;
 94582  94373     assert( pOffset==0 || pLimit!=0 );
 94583  94374     pNew->addrOpenEphm[0] = -1;
 94584  94375     pNew->addrOpenEphm[1] = -1;
 94585  94376     pNew->addrOpenEphm[2] = -1;
................................................................................
 95828  95619     *pnCol = nCol;
 95829  95620     *paCol = aCol;
 95830  95621   
 95831  95622     for(i=0, pCol=aCol; i<nCol; i++, pCol++){
 95832  95623       /* Get an appropriate name for the column
 95833  95624       */
 95834  95625       p = sqlite3ExprSkipCollate(pEList->a[i].pExpr);
        95626  +    assert( p->pRight==0 || ExprHasProperty(p->pRight, EP_IntValue)
        95627  +               || p->pRight->u.zToken==0 || p->pRight->u.zToken[0]!=0 );
 95835  95628       if( (zName = pEList->a[i].zName)!=0 ){
 95836  95629         /* If the column contains an "AS <name>" phrase, use <name> as the name */
 95837  95630         zName = sqlite3DbStrDup(db, zName);
 95838  95631       }else{
 95839  95632         Expr *pColExpr = p;  /* The expression that is the result column name */
 95840  95633         Table *pTab;         /* Table associated with this expression */
 95841  95634         while( pColExpr->op==TK_DOT ){
................................................................................
 95865  95658       /* Make sure the column name is unique.  If the name is not unique,
 95866  95659       ** append a integer to the name so that it becomes unique.
 95867  95660       */
 95868  95661       nName = sqlite3Strlen30(zName);
 95869  95662       for(j=cnt=0; j<i; j++){
 95870  95663         if( sqlite3StrICmp(aCol[j].zName, zName)==0 ){
 95871  95664           char *zNewName;
 95872         -        int k;
 95873         -        for(k=nName-1; k>1 && sqlite3Isdigit(zName[k]); k--){}
 95874         -        if( zName[k]==':' ) nName = k;
 95875  95665           zName[nName] = 0;
 95876  95666           zNewName = sqlite3MPrintf(db, "%s:%d", zName, ++cnt);
 95877  95667           sqlite3DbFree(db, zName);
 95878  95668           zName = zNewName;
 95879  95669           j = -1;
 95880  95670           if( zName==0 ) break;
 95881  95671         }
................................................................................
 97653  97443     sqlite3SelectDelete(db, pSub1);
 97654  97444   
 97655  97445     return 1;
 97656  97446   }
 97657  97447   #endif /* !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW) */
 97658  97448   
 97659  97449   /*
 97660         -** Based on the contents of the AggInfo structure indicated by the first
 97661         -** argument, this function checks if the following are true:
 97662         -**
 97663         -**    * the query contains just a single aggregate function,
 97664         -**    * the aggregate function is either min() or max(), and
 97665         -**    * the argument to the aggregate function is a column value.
 97666         -**
 97667         -** If all of the above are true, then WHERE_ORDERBY_MIN or WHERE_ORDERBY_MAX
 97668         -** is returned as appropriate. Also, *ppMinMax is set to point to the 
 97669         -** list of arguments passed to the aggregate before returning.
 97670         -**
 97671         -** Or, if the conditions above are not met, *ppMinMax is set to 0 and
 97672         -** WHERE_ORDERBY_NORMAL is returned.
 97673         -*/
 97674         -static u8 minMaxQuery(AggInfo *pAggInfo, ExprList **ppMinMax){
 97675         -  int eRet = WHERE_ORDERBY_NORMAL;          /* Return value */
 97676         -
 97677         -  *ppMinMax = 0;
 97678         -  if( pAggInfo->nFunc==1 ){
 97679         -    Expr *pExpr = pAggInfo->aFunc[0].pExpr; /* Aggregate function */
 97680         -    ExprList *pEList = pExpr->x.pList;      /* Arguments to agg function */
 97681         -
 97682         -    assert( pExpr->op==TK_AGG_FUNCTION );
 97683         -    if( pEList && pEList->nExpr==1 && pEList->a[0].pExpr->op==TK_AGG_COLUMN ){
 97684         -      const char *zFunc = pExpr->u.zToken;
 97685         -      if( sqlite3StrICmp(zFunc, "min")==0 ){
 97686         -        eRet = WHERE_ORDERBY_MIN;
 97687         -        *ppMinMax = pEList;
 97688         -      }else if( sqlite3StrICmp(zFunc, "max")==0 ){
 97689         -        eRet = WHERE_ORDERBY_MAX;
 97690         -        *ppMinMax = pEList;
 97691         -      }
 97692         -    }
 97693         -  }
 97694         -
 97695         -  assert( *ppMinMax==0 || (*ppMinMax)->nExpr==1 );
 97696         -  return eRet;
        97450  +** Analyze the SELECT statement passed as an argument to see if it
        97451  +** is a min() or max() query. Return WHERE_ORDERBY_MIN or WHERE_ORDERBY_MAX if 
        97452  +** it is, or 0 otherwise. At present, a query is considered to be
        97453  +** a min()/max() query if:
        97454  +**
        97455  +**   1. There is a single object in the FROM clause.
        97456  +**
        97457  +**   2. There is a single expression in the result set, and it is
        97458  +**      either min(x) or max(x), where x is a column reference.
        97459  +*/
        97460  +static u8 minMaxQuery(Select *p){
        97461  +  Expr *pExpr;
        97462  +  ExprList *pEList = p->pEList;
        97463  +
        97464  +  if( pEList->nExpr!=1 ) return WHERE_ORDERBY_NORMAL;
        97465  +  pExpr = pEList->a[0].pExpr;
        97466  +  if( pExpr->op!=TK_AGG_FUNCTION ) return 0;
        97467  +  if( NEVER(ExprHasProperty(pExpr, EP_xIsSelect)) ) return 0;
        97468  +  pEList = pExpr->x.pList;
        97469  +  if( pEList==0 || pEList->nExpr!=1 ) return 0;
        97470  +  if( pEList->a[0].pExpr->op!=TK_AGG_COLUMN ) return WHERE_ORDERBY_NORMAL;
        97471  +  assert( !ExprHasProperty(pExpr, EP_IntValue) );
        97472  +  if( sqlite3StrICmp(pExpr->u.zToken,"min")==0 ){
        97473  +    return WHERE_ORDERBY_MIN;
        97474  +  }else if( sqlite3StrICmp(pExpr->u.zToken,"max")==0 ){
        97475  +    return WHERE_ORDERBY_MAX;
        97476  +  }
        97477  +  return WHERE_ORDERBY_NORMAL;
 97697  97478   }
 97698  97479   
 97699  97480   /*
 97700  97481   ** The select statement passed as the first argument is an aggregate query.
 97701  97482   ** The second argment is the associated aggregate-info object. This 
 97702  97483   ** function tests if the SELECT is of the form:
 97703  97484   **
................................................................................
 97784  97565   static int selectExpander(Walker *pWalker, Select *p){
 97785  97566     Parse *pParse = pWalker->pParse;
 97786  97567     int i, j, k;
 97787  97568     SrcList *pTabList;
 97788  97569     ExprList *pEList;
 97789  97570     struct SrcList_item *pFrom;
 97790  97571     sqlite3 *db = pParse->db;
 97791         -  Expr *pE, *pRight, *pExpr;
 97792  97572   
 97793  97573     if( db->mallocFailed  ){
 97794  97574       return WRC_Abort;
 97795  97575     }
 97796  97576     if( NEVER(p->pSrc==0) || (p->selFlags & SF_Expanded)!=0 ){
 97797  97577       return WRC_Prune;
 97798  97578     }
................................................................................
 97870  97650     ** The following code just has to locate the TK_ALL expressions and expand
 97871  97651     ** each one to the list of all columns in all tables.
 97872  97652     **
 97873  97653     ** The first loop just checks to see if there are any "*" operators
 97874  97654     ** that need expanding.
 97875  97655     */
 97876  97656     for(k=0; k<pEList->nExpr; k++){
 97877         -    pE = pEList->a[k].pExpr;
        97657  +    Expr *pE = pEList->a[k].pExpr;
 97878  97658       if( pE->op==TK_ALL ) break;
 97879  97659       assert( pE->op!=TK_DOT || pE->pRight!=0 );
 97880  97660       assert( pE->op!=TK_DOT || (pE->pLeft!=0 && pE->pLeft->op==TK_ID) );
 97881  97661       if( pE->op==TK_DOT && pE->pRight->op==TK_ALL ) break;
 97882  97662     }
 97883  97663     if( k<pEList->nExpr ){
 97884  97664       /*
................................................................................
 97888  97668       */
 97889  97669       struct ExprList_item *a = pEList->a;
 97890  97670       ExprList *pNew = 0;
 97891  97671       int flags = pParse->db->flags;
 97892  97672       int longNames = (flags & SQLITE_FullColNames)!=0
 97893  97673                         && (flags & SQLITE_ShortColNames)==0;
 97894  97674   
 97895         -    /* When processing FROM-clause subqueries, it is always the case
 97896         -    ** that full_column_names=OFF and short_column_names=ON.  The
 97897         -    ** sqlite3ResultSetOfSelect() routine makes it so. */
 97898         -    assert( (p->selFlags & SF_NestedFrom)==0
 97899         -          || ((flags & SQLITE_FullColNames)==0 &&
 97900         -              (flags & SQLITE_ShortColNames)!=0) );
 97901         -
 97902  97675       for(k=0; k<pEList->nExpr; k++){
 97903         -      pE = a[k].pExpr;
 97904         -      pRight = pE->pRight;
 97905         -      assert( pE->op!=TK_DOT || pRight!=0 );
 97906         -      if( pE->op!=TK_ALL && (pE->op!=TK_DOT || pRight->op!=TK_ALL) ){
        97676  +      Expr *pE = a[k].pExpr;
        97677  +      assert( pE->op!=TK_DOT || pE->pRight!=0 );
        97678  +      if( pE->op!=TK_ALL && (pE->op!=TK_DOT || pE->pRight->op!=TK_ALL) ){
 97907  97679           /* This particular expression does not need to be expanded.
 97908  97680           */
 97909  97681           pNew = sqlite3ExprListAppend(pParse, pNew, a[k].pExpr);
 97910  97682           if( pNew ){
 97911  97683             pNew->a[pNew->nExpr-1].zName = a[k].zName;
 97912  97684             pNew->a[pNew->nExpr-1].zSpan = a[k].zSpan;
 97913  97685             a[k].zName = 0;
................................................................................
 97914  97686             a[k].zSpan = 0;
 97915  97687           }
 97916  97688           a[k].pExpr = 0;
 97917  97689         }else{
 97918  97690           /* This expression is a "*" or a "TABLE.*" and needs to be
 97919  97691           ** expanded. */
 97920  97692           int tableSeen = 0;      /* Set to 1 when TABLE matches */
 97921         -        char *zTName = 0;       /* text of name of TABLE */
        97693  +        char *zTName;            /* text of name of TABLE */
 97922  97694           if( pE->op==TK_DOT ){
 97923  97695             assert( pE->pLeft!=0 );
 97924  97696             assert( !ExprHasProperty(pE->pLeft, EP_IntValue) );
 97925  97697             zTName = pE->pLeft->u.zToken;
        97698  +        }else{
        97699  +          zTName = 0;
 97926  97700           }
 97927  97701           for(i=0, pFrom=pTabList->a; i<pTabList->nSrc; i++, pFrom++){
 97928  97702             Table *pTab = pFrom->pTab;
 97929         -          Select *pSub = pFrom->pSelect;
 97930  97703             char *zTabName = pFrom->zAlias;
 97931         -          const char *zSchemaName = 0;
 97932         -          int iDb;
 97933  97704             if( zTabName==0 ){
 97934  97705               zTabName = pTab->zName;
 97935  97706             }
 97936  97707             if( db->mallocFailed ) break;
 97937         -          if( pSub==0 || (pSub->selFlags & SF_NestedFrom)==0 ){
 97938         -            pSub = 0;
 97939         -            if( zTName && sqlite3StrICmp(zTName, zTabName)!=0 ){
 97940         -              continue;
 97941         -            }
 97942         -            iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
 97943         -            zSchemaName = iDb>=0 ? db->aDb[iDb].zName : "*";
        97708  +          if( zTName && sqlite3StrICmp(zTName, zTabName)!=0 ){
        97709  +            continue;
 97944  97710             }
        97711  +          tableSeen = 1;
 97945  97712             for(j=0; j<pTab->nCol; j++){
        97713  +            Expr *pExpr, *pRight;
 97946  97714               char *zName = pTab->aCol[j].zName;
 97947  97715               char *zColname;  /* The computed column name */
 97948  97716               char *zToFree;   /* Malloced string that needs to be freed */
 97949  97717               Token sColname;  /* Computed column name as a token */
 97950  97718   
 97951         -            assert( zName );
 97952         -            if( zTName && pSub
 97953         -             && sqlite3MatchSpanName(pSub->pEList->a[j].zSpan, 0, zTName, 0)==0
 97954         -            ){
 97955         -              continue;
 97956         -            }
 97957         -
 97958  97719               /* If a column is marked as 'hidden' (currently only possible
 97959  97720               ** for virtual tables), do not include it in the expanded
 97960  97721               ** result-set list.
 97961  97722               */
 97962  97723               if( IsHiddenColumn(&pTab->aCol[j]) ){
 97963  97724                 assert(IsVirtual(pTab));
 97964  97725                 continue;
 97965  97726               }
 97966         -            tableSeen = 1;
 97967  97727   
 97968  97728               if( i>0 && zTName==0 ){
 97969  97729                 if( (pFrom->jointype & JT_NATURAL)!=0
 97970  97730                   && tableAndColumnIndex(pTabList, i, zName, 0, 0)
 97971  97731                 ){
 97972  97732                   /* In a NATURAL join, omit the join columns from the 
 97973  97733                   ** table to the right of the join */
................................................................................
 97982  97742               pRight = sqlite3Expr(db, TK_ID, zName);
 97983  97743               zColname = zName;
 97984  97744               zToFree = 0;
 97985  97745               if( longNames || pTabList->nSrc>1 ){
 97986  97746                 Expr *pLeft;
 97987  97747                 pLeft = sqlite3Expr(db, TK_ID, zTabName);
 97988  97748                 pExpr = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight, 0);
 97989         -              if( zSchemaName ){
 97990         -                pLeft = sqlite3Expr(db, TK_ID, zSchemaName);
 97991         -                pExpr = sqlite3PExpr(pParse, TK_DOT, pLeft, pExpr, 0);
 97992         -              }
 97993  97749                 if( longNames ){
 97994  97750                   zColname = sqlite3MPrintf(db, "%s.%s", zTabName, zName);
 97995  97751                   zToFree = zColname;
 97996  97752                 }
 97997  97753               }else{
 97998  97754                 pExpr = pRight;
 97999  97755               }
 98000  97756               pNew = sqlite3ExprListAppend(pParse, pNew, pExpr);
 98001  97757               sColname.z = zColname;
 98002  97758               sColname.n = sqlite3Strlen30(zColname);
 98003  97759               sqlite3ExprListSetName(pParse, pNew, &sColname, 0);
 98004         -            if( pNew && (p->selFlags & SF_NestedFrom)!=0 ){
 98005         -              struct ExprList_item *pX = &pNew->a[pNew->nExpr-1];
 98006         -              if( pSub ){
 98007         -                pX->zSpan = sqlite3DbStrDup(db, pSub->pEList->a[j].zSpan);
 98008         -                testcase( pX->zSpan==0 );
 98009         -              }else{
 98010         -                pX->zSpan = sqlite3MPrintf(db, "%s.%s.%s",
 98011         -                                           zSchemaName, zTabName, zColname);
 98012         -                testcase( pX->zSpan==0 );
 98013         -              }
 98014         -              pX->bSpanIsTab = 1;
 98015         -            }
 98016  97760               sqlite3DbFree(db, zToFree);
 98017  97761             }
 98018  97762           }
 98019  97763           if( !tableSeen ){
 98020  97764             if( zTName ){
 98021  97765               sqlite3ErrorMsg(pParse, "no such table: %s", zTName);
 98022  97766             }else{
................................................................................
 99066  98810           **
 99067  98811           **   + The optimizer code in where.c (the thing that decides which
 99068  98812           **     index or indices to use) should place a different priority on 
 99069  98813           **     satisfying the 'ORDER BY' clause than it does in other cases.
 99070  98814           **     Refer to code and comments in where.c for details.
 99071  98815           */
 99072  98816           ExprList *pMinMax = 0;
 99073         -        u8 flag = WHERE_ORDERBY_NORMAL;
 99074         -        
 99075         -        assert( p->pGroupBy==0 );
 99076         -        assert( flag==0 );
 99077         -        if( p->pHaving==0 ){
 99078         -          flag = minMaxQuery(&sAggInfo, &pMinMax);
 99079         -        }
 99080         -        assert( flag==0 || (pMinMax!=0 && pMinMax->nExpr==1) );
 99081         -
        98817  +        u8 flag = minMaxQuery(p);
 99082  98818           if( flag ){
 99083         -          pMinMax = sqlite3ExprListDup(db, pMinMax, 0);
        98819  +          assert( !ExprHasProperty(p->pEList->a[0].pExpr, EP_xIsSelect) );
        98820  +          assert( p->pEList->a[0].pExpr->x.pList->nExpr==1 );
        98821  +          pMinMax = sqlite3ExprListDup(db, p->pEList->a[0].pExpr->x.pList,0);
 99084  98822             pDel = pMinMax;
 99085  98823             if( pMinMax && !db->mallocFailed ){
 99086  98824               pMinMax->a[0].sortOrder = flag!=WHERE_ORDERBY_MIN ?1:0;
 99087  98825               pMinMax->a[0].pExpr->op = TK_COLUMN;
 99088  98826             }
 99089  98827           }
 99090  98828     
................................................................................
102964 102702   #define WHERE_ROWID_RANGE  0x00002000  /* rowid<EXPR and/or rowid>EXPR */
102965 102703   #define WHERE_COLUMN_EQ    0x00010000  /* x=EXPR or x IN (...) or x IS NULL */
102966 102704   #define WHERE_COLUMN_RANGE 0x00020000  /* x<EXPR and/or x>EXPR */
102967 102705   #define WHERE_COLUMN_IN    0x00040000  /* x IN (...) */
102968 102706   #define WHERE_COLUMN_NULL  0x00080000  /* x IS NULL */
102969 102707   #define WHERE_INDEXED      0x000f0000  /* Anything that uses an index */
102970 102708   #define WHERE_NOT_FULLSCAN 0x100f3000  /* Does not do a full table scan */
102971         -#define WHERE_IN_ABLE      0x080f1000  /* Able to support an IN operator */
       102709  +#define WHERE_IN_ABLE      0x000f1000  /* Able to support an IN operator */
102972 102710   #define WHERE_TOP_LIMIT    0x00100000  /* x<EXPR or x<=EXPR constraint */
102973 102711   #define WHERE_BTM_LIMIT    0x00200000  /* x>EXPR or x>=EXPR constraint */
102974 102712   #define WHERE_BOTH_LIMIT   0x00300000  /* Both x>EXPR and x<EXPR */
102975 102713   #define WHERE_IDX_ONLY     0x00400000  /* Use index only - omit table */
102976 102714   #define WHERE_ORDERED      0x00800000  /* Output will appear in correct order */
102977 102715   #define WHERE_REVERSE      0x01000000  /* Scan in reverse order */
102978 102716   #define WHERE_UNIQUE       0x02000000  /* Selects no more than one row */
................................................................................
104768 104506     /* Count the number of possible WHERE clause constraints referring
104769 104507     ** to this virtual table */
104770 104508     for(i=nTerm=0, pTerm=pWC->a; i<pWC->nTerm; i++, pTerm++){
104771 104509       if( pTerm->leftCursor != pSrc->iCursor ) continue;
104772 104510       assert( (pTerm->eOperator&(pTerm->eOperator-1))==0 );
104773 104511       testcase( pTerm->eOperator==WO_IN );
104774 104512       testcase( pTerm->eOperator==WO_ISNULL );
104775         -    if( pTerm->eOperator & (WO_ISNULL) ) continue;
       104513  +    if( pTerm->eOperator & (WO_IN|WO_ISNULL) ) continue;
104776 104514       if( pTerm->wtFlags & TERM_VNULL ) continue;
104777 104515       nTerm++;
104778 104516     }
104779 104517   
104780 104518     /* If the ORDER BY clause contains only columns in the current 
104781 104519     ** virtual table then allocate space for the aOrderBy part of
104782 104520     ** the sqlite3_index_info structure.
................................................................................
104816 104554     *(int*)&pIdxInfo->nOrderBy = nOrderBy;
104817 104555     *(struct sqlite3_index_constraint**)&pIdxInfo->aConstraint = pIdxCons;
104818 104556     *(struct sqlite3_index_orderby**)&pIdxInfo->aOrderBy = pIdxOrderBy;
104819 104557     *(struct sqlite3_index_constraint_usage**)&pIdxInfo->aConstraintUsage =
104820 104558                                                                      pUsage;
104821 104559   
104822 104560     for(i=j=0, pTerm=pWC->a; i<pWC->nTerm; i++, pTerm++){
104823         -    u8 op;
104824 104561       if( pTerm->leftCursor != pSrc->iCursor ) continue;
104825 104562       assert( (pTerm->eOperator&(pTerm->eOperator-1))==0 );
104826 104563       testcase( pTerm->eOperator==WO_IN );
104827 104564       testcase( pTerm->eOperator==WO_ISNULL );
104828         -    if( pTerm->eOperator & (WO_ISNULL) ) continue;
       104565  +    if( pTerm->eOperator & (WO_IN|WO_ISNULL) ) continue;
104829 104566       if( pTerm->wtFlags & TERM_VNULL ) continue;
104830 104567       pIdxCons[j].iColumn = pTerm->u.leftColumn;
104831 104568       pIdxCons[j].iTermOffset = i;
104832         -    op = (u8)pTerm->eOperator;
104833         -    if( op==WO_IN ) op = WO_EQ;
104834         -    pIdxCons[j].op = op;
       104569  +    pIdxCons[j].op = (u8)pTerm->eOperator;
104835 104570       /* The direct assignment in the previous line is possible only because
104836 104571       ** the WO_ and SQLITE_INDEX_CONSTRAINT_ codes are identical.  The
104837 104572       ** following asserts verify this fact. */
104838 104573       assert( WO_EQ==SQLITE_INDEX_CONSTRAINT_EQ );
104839 104574       assert( WO_LT==SQLITE_INDEX_CONSTRAINT_LT );
104840 104575       assert( WO_LE==SQLITE_INDEX_CONSTRAINT_LE );
104841 104576       assert( WO_GT==SQLITE_INDEX_CONSTRAINT_GT );
104842 104577       assert( WO_GE==SQLITE_INDEX_CONSTRAINT_GE );
104843 104578       assert( WO_MATCH==SQLITE_INDEX_CONSTRAINT_MATCH );
104844         -    assert( pTerm->eOperator & (WO_IN|WO_EQ|WO_LT|WO_LE|WO_GT|WO_GE|WO_MATCH) );
       104579  +    assert( pTerm->eOperator & (WO_EQ|WO_LT|WO_LE|WO_GT|WO_GE|WO_MATCH) );
104845 104580       j++;
104846 104581     }
104847 104582     for(i=0; i<nOrderBy; i++){
104848 104583       Expr *pExpr = pOrderBy->a[i].pExpr;
104849 104584       pIdxOrderBy[i].iColumn = pExpr->iColumn;
104850 104585       pIdxOrderBy[i].desc = pOrderBy->a[i].sortOrder;
104851 104586     }
................................................................................
104923 104658     Table *pTab = pSrc->pTab;
104924 104659     sqlite3_index_info *pIdxInfo;
104925 104660     struct sqlite3_index_constraint *pIdxCons;
104926 104661     struct sqlite3_index_constraint_usage *pUsage;
104927 104662     WhereTerm *pTerm;
104928 104663     int i, j;
104929 104664     int nOrderBy;
104930         -  int bAllowIN;                   /* Allow IN optimizations */
104931 104665     double rCost;
104932 104666   
104933 104667     /* Make sure wsFlags is initialized to some sane value. Otherwise, if the 
104934 104668     ** malloc in allocateIndexInfo() fails and this function returns leaving
104935 104669     ** wsFlags in an uninitialized state, the caller may behave unpredictably.
104936 104670     */
104937 104671     memset(&p->cost, 0, sizeof(p->cost));
................................................................................
104958 104692     /* The module name must be defined. Also, by this point there must
104959 104693     ** be a pointer to an sqlite3_vtab structure. Otherwise
104960 104694     ** sqlite3ViewGetColumnNames() would have picked up the error. 
104961 104695     */
104962 104696     assert( pTab->azModuleArg && pTab->azModuleArg[0] );
104963 104697     assert( sqlite3GetVTable(pParse->db, pTab) );
104964 104698   
104965         -  /* Try once or twice.  On the first attempt, allow IN optimizations.
104966         -  ** If an IN optimization is accepted by the virtual table xBestIndex
104967         -  ** method, but the  pInfo->aConstrainUsage.omit flag is not set, then
104968         -  ** the query will not work because it might allow duplicate rows in
104969         -  ** output.  In that case, run the xBestIndex method a second time
104970         -  ** without the IN constraints.  Usually this loop only runs once.
104971         -  ** The loop will exit using a "break" statement.
104972         -  */
104973         -  for(bAllowIN=1; 1; bAllowIN--){
104974         -    assert( bAllowIN==0 || bAllowIN==1 );
104975         -
104976         -    /* Set the aConstraint[].usable fields and initialize all 
104977         -    ** output variables to zero.
104978         -    **
104979         -    ** aConstraint[].usable is true for constraints where the right-hand
104980         -    ** side contains only references to tables to the left of the current
104981         -    ** table.  In other words, if the constraint is of the form:
104982         -    **
104983         -    **           column = expr
104984         -    **
104985         -    ** and we are evaluating a join, then the constraint on column is 
104986         -    ** only valid if all tables referenced in expr occur to the left
104987         -    ** of the table containing column.
104988         -    **
104989         -    ** The aConstraints[] array contains entries for all constraints
104990         -    ** on the current table.  That way we only have to compute it once
104991         -    ** even though we might try to pick the best index multiple times.
104992         -    ** For each attempt at picking an index, the order of tables in the
104993         -    ** join might be different so we have to recompute the usable flag
104994         -    ** each time.
104995         -    */
104996         -    pIdxCons = *(struct sqlite3_index_constraint**)&pIdxInfo->aConstraint;
104997         -    pUsage = pIdxInfo->aConstraintUsage;
104998         -    for(i=0; i<pIdxInfo->nConstraint; i++, pIdxCons++){
104999         -      j = pIdxCons->iTermOffset;
105000         -      pTerm = &pWC->a[j];
105001         -      if( (pTerm->prereqRight&p->notReady)==0
105002         -       && (bAllowIN || pTerm->eOperator!=WO_IN)
105003         -      ){
105004         -        pIdxCons->usable = 1;
105005         -      }else{
105006         -        pIdxCons->usable = 0;
105007         -      }
105008         -    }
105009         -    memset(pUsage, 0, sizeof(pUsage[0])*pIdxInfo->nConstraint);
105010         -    if( pIdxInfo->needToFreeIdxStr ){
105011         -      sqlite3_free(pIdxInfo->idxStr);
105012         -    }
105013         -    pIdxInfo->idxStr = 0;
105014         -    pIdxInfo->idxNum = 0;
105015         -    pIdxInfo->needToFreeIdxStr = 0;
105016         -    pIdxInfo->orderByConsumed = 0;
105017         -    /* ((double)2) In case of SQLITE_OMIT_FLOATING_POINT... */
105018         -    pIdxInfo->estimatedCost = SQLITE_BIG_DBL / ((double)2);
105019         -    nOrderBy = pIdxInfo->nOrderBy;
105020         -    if( !p->pOrderBy ){
105021         -      pIdxInfo->nOrderBy = 0;
105022         -    }
105023         -  
105024         -    if( vtabBestIndex(pParse, pTab, pIdxInfo) ){
105025         -      return;
105026         -    }
105027         -  
105028         -    pIdxCons = *(struct sqlite3_index_constraint**)&pIdxInfo->aConstraint;
105029         -    for(i=0; i<pIdxInfo->nConstraint; i++, pIdxCons++){
105030         -      if( pUsage[i].argvIndex>0 ){
105031         -        j = pIdxCons->iTermOffset;
105032         -        pTerm = &pWC->a[j];
105033         -        p->cost.used |= pTerm->prereqRight;
105034         -        if( pTerm->eOperator==WO_IN && pUsage[i].omit==0 ){
105035         -          /* Do not attempt to use an IN constraint if the virtual table
105036         -          ** says that the equivalent EQ constraint cannot be safely omitted.
105037         -          ** If we do attempt to use such a constraint, some rows might be
105038         -          ** repeated in the output. */
105039         -          break;
105040         -        }
105041         -      }
105042         -    }
105043         -    if( i>=pIdxInfo->nConstraint ) break;
105044         -  }
105045         -  
       104699  +  /* Set the aConstraint[].usable fields and initialize all 
       104700  +  ** output variables to zero.
       104701  +  **
       104702  +  ** aConstraint[].usable is true for constraints where the right-hand
       104703  +  ** side contains only references to tables to the left of the current
       104704  +  ** table.  In other words, if the constraint is of the form:
       104705  +  **
       104706  +  **           column = expr
       104707  +  **
       104708  +  ** and we are evaluating a join, then the constraint on column is 
       104709  +  ** only valid if all tables referenced in expr occur to the left
       104710  +  ** of the table containing column.
       104711  +  **
       104712  +  ** The aConstraints[] array contains entries for all constraints
       104713  +  ** on the current table.  That way we only have to compute it once
       104714  +  ** even though we might try to pick the best index multiple times.
       104715  +  ** For each attempt at picking an index, the order of tables in the
       104716  +  ** join might be different so we have to recompute the usable flag
       104717  +  ** each time.
       104718  +  */
       104719  +  pIdxCons = *(struct sqlite3_index_constraint**)&pIdxInfo->aConstraint;
       104720  +  pUsage = pIdxInfo->aConstraintUsage;
       104721  +  for(i=0; i<pIdxInfo->nConstraint; i++, pIdxCons++){
       104722  +    j = pIdxCons->iTermOffset;
       104723  +    pTerm = &pWC->a[j];
       104724  +    pIdxCons->usable = (pTerm->prereqRight&p->notReady) ? 0 : 1;
       104725  +  }
       104726  +  memset(pUsage, 0, sizeof(pUsage[0])*pIdxInfo->nConstraint);
       104727  +  if( pIdxInfo->needToFreeIdxStr ){
       104728  +    sqlite3_free(pIdxInfo->idxStr);
       104729  +  }
       104730  +  pIdxInfo->idxStr = 0;
       104731  +  pIdxInfo->idxNum = 0;
       104732  +  pIdxInfo->needToFreeIdxStr = 0;
       104733  +  pIdxInfo->orderByConsumed = 0;
       104734  +  /* ((double)2) In case of SQLITE_OMIT_FLOATING_POINT... */
       104735  +  pIdxInfo->estimatedCost = SQLITE_BIG_DBL / ((double)2);
       104736  +  nOrderBy = pIdxInfo->nOrderBy;
       104737  +  if( !p->pOrderBy ){
       104738  +    pIdxInfo->nOrderBy = 0;
       104739  +  }
       104740  +
       104741  +  if( vtabBestIndex(pParse, pTab, pIdxInfo) ){
       104742  +    return;
       104743  +  }
       104744  +
       104745  +  pIdxCons = *(struct sqlite3_index_constraint**)&pIdxInfo->aConstraint;
       104746  +  for(i=0; i<pIdxInfo->nConstraint; i++){
       104747  +    if( pUsage[i].argvIndex>0 ){
       104748  +      p->cost.used |= pWC->a[pIdxCons[i].iTermOffset].prereqRight;
       104749  +    }
       104750  +  }
       104751  +
105046 104752     /* If there is an ORDER BY clause, and the selected virtual table index
105047 104753     ** does not satisfy it, increase the cost of the scan accordingly. This
105048 104754     ** matches the processing for non-virtual tables in bestBtreeIndex().
105049 104755     */
105050 104756     rCost = pIdxInfo->estimatedCost;
105051 104757     if( p->pOrderBy && pIdxInfo->orderByConsumed==0 ){
105052 104758       rCost += estLog(rCost)*rCost;
................................................................................
106013 105719       ** variable.  */
106014 105720       if( bSort && (pSrc->jointype & JT_LEFT)==0 ){
106015 105721         int bRev = 2;
106016 105722         WHERETRACE(("      --> before isSortingIndex: nPriorSat=%d\n",nPriorSat));
106017 105723         pc.plan.nOBSat = isSortingIndex(p, pProbe, iCur, &bRev);
106018 105724         WHERETRACE(("      --> after  isSortingIndex: bRev=%d nOBSat=%d\n",
106019 105725                     bRev, pc.plan.nOBSat));
106020         -      if( nPriorSat<pc.plan.nOBSat || (pc.plan.wsFlags & WHERE_UNIQUE)!=0 ){
       105726  +      if( nPriorSat<pc.plan.nOBSat || (pc.plan.wsFlags & WHERE_ALL_UNIQUE)!=0 ){
106021 105727           pc.plan.wsFlags |= WHERE_ORDERED;
106022 105728         }
106023 105729         if( nOrderBy==pc.plan.nOBSat ){
106024 105730           bSort = 0;
106025 105731           pc.plan.wsFlags |= WHERE_ROWID_RANGE|WHERE_COLUMN_RANGE;
106026 105732         }
106027 105733         if( bRev & 1 ) pc.plan.wsFlags |= WHERE_REVERSE;
................................................................................
106807 106513   
106808 106514   #ifndef SQLITE_OMIT_VIRTUALTABLE
106809 106515     if(  (pLevel->plan.wsFlags & WHERE_VIRTUALTABLE)!=0 ){
106810 106516       /* Case 0:  The table is a virtual-table.  Use the VFilter and VNext
106811 106517       **          to access the data.
106812 106518       */
106813 106519       int iReg;   /* P3 Value for OP_VFilter */
106814         -    int addrNotFound;
106815 106520       sqlite3_index_info *pVtabIdx = pLevel->plan.u.pVtabIdx;
106816 106521       int nConstraint = pVtabIdx->nConstraint;
106817 106522       struct sqlite3_index_constraint_usage *aUsage =
106818 106523                                                   pVtabIdx->aConstraintUsage;
106819 106524       const struct sqlite3_index_constraint *aConstraint =
106820 106525                                                   pVtabIdx->aConstraint;
106821 106526   
106822 106527       sqlite3ExprCachePush(pParse);
106823 106528       iReg = sqlite3GetTempRange(pParse, nConstraint+2);
106824         -    addrNotFound = pLevel->addrBrk;
106825 106529       for(j=1; j<=nConstraint; j++){
106826 106530         for(k=0; k<nConstraint; k++){
106827 106531           if( aUsage[k].argvIndex==j ){
106828         -          WhereTerm *pTerm = &pWC->a[aConstraint[k].iTermOffset];
106829         -          int iTarget = iReg+j+1;
106830         -          if( pTerm->eOperator & WO_IN ){
106831         -            codeEqualityTerm(pParse, pTerm, pLevel, iTarget);
106832         -            addrNotFound = pLevel->addrNxt;
106833         -          }else{
106834         -            sqlite3ExprCode(pParse, pTerm->pExpr->pRight, iTarget);
106835         -          }
       106532  +          int iTerm = aConstraint[k].iTermOffset;
       106533  +          sqlite3ExprCode(pParse, pWC->a[iTerm].pExpr->pRight, iReg+j+1);
106836 106534             break;
106837 106535           }
106838 106536         }
106839 106537         if( k==nConstraint ) break;
106840 106538       }
106841 106539       sqlite3VdbeAddOp2(v, OP_Integer, pVtabIdx->idxNum, iReg);
106842 106540       sqlite3VdbeAddOp2(v, OP_Integer, j-1, iReg+1);
106843         -    sqlite3VdbeAddOp4(v, OP_VFilter, iCur, addrNotFound, iReg, pVtabIdx->idxStr,
       106541  +    sqlite3VdbeAddOp4(v, OP_VFilter, iCur, addrBrk, iReg, pVtabIdx->idxStr,
106844 106542                         pVtabIdx->needToFreeIdxStr ? P4_MPRINTF : P4_STATIC);
106845 106543       pVtabIdx->needToFreeIdxStr = 0;
106846 106544       for(j=0; j<nConstraint; j++){
106847 106545         if( aUsage[j].omit ){
106848 106546           int iTerm = aConstraint[j].iTermOffset;
106849 106547           disableTerm(pLevel, &pWC->a[iTerm]);
106850 106548         }
................................................................................
108483 108181     sqlite3ParserTOKENTYPE yy0;
108484 108182     struct LimitVal yy64;
108485 108183     Expr* yy122;
108486 108184     Select* yy159;
108487 108185     IdList* yy180;
108488 108186     struct {int value; int mask;} yy207;
108489 108187     u8 yy258;
108490         -  u16 yy305;
108491 108188     struct LikeOp yy318;
108492 108189     TriggerStep* yy327;
108493 108190     ExprSpan yy342;
108494 108191     SrcList* yy347;
108495 108192     int yy392;
108496 108193     struct TrigEvent yy410;
108497 108194     ExprList* yy442;
................................................................................
110434 110131         case 31: /* temp ::= */ yytestcase(yyruleno==31);
110435 110132         case 69: /* autoinc ::= */ yytestcase(yyruleno==69);
110436 110133         case 82: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ yytestcase(yyruleno==82);
110437 110134         case 84: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==84);
110438 110135         case 86: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ yytestcase(yyruleno==86);
110439 110136         case 98: /* defer_subclause_opt ::= */ yytestcase(yyruleno==98);
110440 110137         case 109: /* ifexists ::= */ yytestcase(yyruleno==109);
       110138  +      case 120: /* distinct ::= ALL */ yytestcase(yyruleno==120);
       110139  +      case 121: /* distinct ::= */ yytestcase(yyruleno==121);
110441 110140         case 221: /* between_op ::= BETWEEN */ yytestcase(yyruleno==221);
110442 110141         case 224: /* in_op ::= IN */ yytestcase(yyruleno==224);
110443 110142   {yygotominor.yy392 = 0;}
110444 110143           break;
110445 110144         case 29: /* ifnotexists ::= IF NOT EXISTS */
110446 110145         case 30: /* temp ::= TEMP */ yytestcase(yyruleno==30);
110447 110146         case 70: /* autoinc ::= AUTOINCR */ yytestcase(yyruleno==70);
110448 110147         case 85: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */ yytestcase(yyruleno==85);
110449 110148         case 108: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==108);
       110149  +      case 119: /* distinct ::= DISTINCT */ yytestcase(yyruleno==119);
110450 110150         case 222: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==222);
110451 110151         case 225: /* in_op ::= NOT IN */ yytestcase(yyruleno==225);
110452 110152   {yygotominor.yy392 = 1;}
110453 110153           break;
110454 110154         case 32: /* create_table_args ::= LP columnlist conslist_opt RP */
110455 110155   {
110456 110156     sqlite3EndTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0);
................................................................................
110682 110382   }
110683 110383           break;
110684 110384         case 116: /* multiselect_op ::= UNION ALL */
110685 110385   {yygotominor.yy392 = TK_ALL;}
110686 110386           break;
110687 110387         case 118: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
110688 110388   {
110689         -  yygotominor.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.yy305,yymsp[0].minor.yy64.pLimit,yymsp[0].minor.yy64.pOffset);
       110389  +  yygotominor.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);
110690 110390   }
110691 110391           break;
110692         -      case 119: /* distinct ::= DISTINCT */
110693         -{yygotominor.yy305 = SF_Distinct;}
110694         -        break;
110695         -      case 120: /* distinct ::= ALL */
110696         -      case 121: /* distinct ::= */ yytestcase(yyruleno==121);
110697         -{yygotominor.yy305 = 0;}
110698         -        break;
110699 110392         case 122: /* sclp ::= selcollist COMMA */
110700 110393         case 246: /* idxlist_opt ::= LP idxlist RP */ yytestcase(yyruleno==246);
110701 110394   {yygotominor.yy442 = yymsp[-1].minor.yy442;}
110702 110395           break;
110703 110396         case 123: /* sclp ::= */
110704 110397         case 151: /* orderby_opt ::= */ yytestcase(yyruleno==151);
110705 110398         case 158: /* groupby_opt ::= */ yytestcase(yyruleno==158);
................................................................................
110760 110453       yygotominor.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);
110761 110454     }
110762 110455           break;
110763 110456         case 136: /* seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
110764 110457   {
110765 110458       if( yymsp[-6].minor.yy347==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy122==0 && yymsp[0].minor.yy180==0 ){
110766 110459         yygotominor.yy347 = yymsp[-4].minor.yy347;
110767         -    }else if( yymsp[-4].minor.yy347->nSrc==1 ){
110768         -      yygotominor.yy347 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy347,0,0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy122,yymsp[0].minor.yy180);
110769         -      if( yygotominor.yy347 ){
110770         -        struct SrcList_item *pNew = &yygotominor.yy347->a[yygotominor.yy347->nSrc-1];
110771         -        struct SrcList_item *pOld = yymsp[-4].minor.yy347->a;
110772         -        pNew->zName = pOld->zName;
110773         -        pNew->zDatabase = pOld->zDatabase;
110774         -        pOld->zName = pOld->zDatabase = 0;
110775         -      }
110776         -      sqlite3SrcListDelete(pParse->db, yymsp[-4].minor.yy347);
110777 110460       }else{
110778 110461         Select *pSubquery;
110779 110462         sqlite3SrcListShiftJoinType(yymsp[-4].minor.yy347);
110780         -      pSubquery = sqlite3SelectNew(pParse,0,yymsp[-4].minor.yy347,0,0,0,0,SF_NestedFrom,0,0);
       110463  +      pSubquery = sqlite3SelectNew(pParse,0,yymsp[-4].minor.yy347,0,0,0,0,0,0,0);
110781 110464         yygotominor.yy347 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy347,0,0,&yymsp[-2].minor.yy0,pSubquery,yymsp[-1].minor.yy122,yymsp[0].minor.yy180);
110782 110465       }
110783 110466     }
110784 110467           break;
110785 110468         case 137: /* dbnm ::= */
110786 110469         case 146: /* indexed_opt ::= */ yytestcase(yyruleno==146);
110787 110470   {yygotominor.yy0.z=0; yygotominor.yy0.n=0;}
................................................................................
111006 110689         case 196: /* expr ::= ID LP distinct exprlist RP */
111007 110690   {
111008 110691     if( yymsp[-1].minor.yy442 && yymsp[-1].minor.yy442->nExpr>pParse->db->aLimit[SQLITE_LIMIT_FUNCTION_ARG] ){
111009 110692       sqlite3ErrorMsg(pParse, "too many arguments on function %T", &yymsp[-4].minor.yy0);
111010 110693     }
111011 110694     yygotominor.yy342.pExpr = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy442, &yymsp[-4].minor.yy0);
111012 110695     spanSet(&yygotominor.yy342,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0);
111013         -  if( yymsp[-2].minor.yy305 && yygotominor.yy342.pExpr ){
       110696  +  if( yymsp[-2].minor.yy392 && yygotominor.yy342.pExpr ){
111014 110697       yygotominor.yy342.pExpr->flags |= EP_Distinct;
111015 110698     }
111016 110699   }
111017 110700           break;
111018 110701         case 197: /* expr ::= ID LP STAR RP */
111019 110702   {
111020 110703     yygotominor.yy342.pExpr = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0);

Changes to SQLite.Interop/src/core/sqlite3.h.

   103    103   ** string contains the date and time of the check-in (UTC) and an SHA1
   104    104   ** hash of the entire source tree.
   105    105   **
   106    106   ** See also: [sqlite3_libversion()],
   107    107   ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
   108    108   ** [sqlite_version()] and [sqlite_source_id()].
   109    109   */
   110         -#define SQLITE_VERSION        "3.7.16"
   111         -#define SQLITE_VERSION_NUMBER 3007016
   112         -#define SQLITE_SOURCE_ID      "2013-01-04 19:22:33 8285b15a058811a9a8b452837f52e6a065868115"
          110  +#define SQLITE_VERSION        "3.7.15.2"
          111  +#define SQLITE_VERSION_NUMBER 3007015
          112  +#define SQLITE_SOURCE_ID      "2013-01-09 11:53:05 c0e09560d26f0a6456be9dd3447f5311eb4f238f"
   113    113   
   114    114   /*
   115    115   ** CAPI3REF: Run-Time Library Version Numbers
   116    116   ** KEYWORDS: sqlite3_version, sqlite3_sourceid
   117    117   **
   118    118   ** These interfaces provide the same information as the [SQLITE_VERSION],
   119    119   ** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros

Changes to readme.htm.

     1      1   <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
     2      2   <html>
     3      3   <head>
     4      4   <title></title>
     5      5   </head>
     6      6   <body>
     7      7   ADO.NET SQLite Data Provider<br />
     8         -Version 1.0.84.0 March XX, 2013 <font color="red">(release scheduled)</font><br />
     9         -Using <a href="http://www.sqlite.org/src/info/trunk">SQLite 3.7.16</a><br />
            8  +Version 1.0.84.0 January 9, 2013<br />
            9  +Using <a href="http://www.sqlite.org/releaselog/3_7_15_2.html">SQLite 3.7.15.2</a><br />
    10     10   Originally written by Robert Simpson<br />
    11     11   Released to the public domain, use at your own risk!<br />
    12     12   Official provider website:&nbsp;<a href="http://system.data.sqlite.org/">http://system.data.sqlite.org/</a><br />
    13     13   Legacy versions:&nbsp;<a href="http://sqlite.phxsoftware.com/">http://sqlite.phxsoftware.com/</a><br />
    14     14   <br />
    15     15   The current development version can be downloaded from <a href="http://system.data.sqlite.org/index.html/timeline?y=ci">
    16     16   http://system.data.sqlite.org/index.html/timeline?y=ci</a>
................................................................................
   183    183   it to extend its functionality, but the core engine's source is not changed.</p>
   184    184   <p>
   185    185   </p>
   186    186   
   187    187   <h2><b>Version History</b></h2>
   188    188   
   189    189   <p>
   190         -    <b>1.0.84.0 - March XX, 2013 <font color="red">(release scheduled)</font></b>
          190  +    <b>1.0.84.0 - January 9, 2013</b>
   191    191   </p>
   192    192   <ul>
   193         -    <li>Updated to <a href="http://www.sqlite.org/src/info/trunk">SQLite 3.7.16</a>.</li>
          193  +    <li>Updated to <a href="http://www.sqlite.org/releaselog/3_7_15_2.html">SQLite 3.7.15.2</a>.</li>
          194  +    <li>Explicitly dispose of all SQLiteCommand objects managed by the DbDataAdapter class. Fix for [6434e23a0f].</li>
   194    195       <li>Add Cancel method to the SQLiteConnection class to interrupt a long running query.</li>
   195    196       <li>Improve thread safety of the SQLiteLog.LogMessage method.</li>
   196    197   </ul>
   197    198   <p>
   198    199       <b>1.0.83.0 - December 29, 2012</b>
   199    200   </p>
   200    201   <ul>

Changes to www/news.wiki.

     1      1   <title>News</title>
     2      2   
     3      3   <b>Version History</b>
     4      4   
     5      5   <p>
     6         -    <b>1.0.84.0 - March XX, 2013 <font color="red">(release scheduled)</font></b>
            6  +    <b>1.0.84.0 - January 9, 2013</b>
     7      7   </p>
     8      8   <ul>
     9         -    <li>Updated to <a href="http://www.sqlite.org/src/info/trunk">SQLite 3.7.16</a>.</li>
            9  +    <li>Updated to <a href="http://www.sqlite.org/releaselog/3_7_15_2.html">SQLite 3.7.15.2</a>.</li>
           10  +    <li>Explicitly dispose of all SQLiteCommand objects managed by the DbDataAdapter class. Fix for [6434e23a0f].</li>
    10     11       <li>Add Cancel method to the SQLiteConnection class to interrupt a long running query.</li>
    11     12       <li>Improve thread safety of the SQLiteLog.LogMessage method.</li>
    12     13   </ul>
    13     14   <p>
    14     15       <b>1.0.83.0 - December 29, 2012</b>
    15     16   </p>
    16     17   <ul>