System.Data.SQLite
Check-in [f3f45cefd1]
Not logged in

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

Overview
Comment:1.0.49.0
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | sourceforge
Files: files | file ages | folders
SHA1:f3f45cefd146934b39793e02eb2d879fee627439
User & Date: rmsimpson 2008-05-28 08:18:26
Context
2008-05-28
08:19
VS2008 Conversion check-in: 464ebf8948 user: rmsimpson tags: sourceforge
08:18
1.0.49.0 check-in: f3f45cefd1 user: rmsimpson tags: sourceforge
2007-12-07
16:09
no message check-in: 4228ab0070 user: rmsimpson tags: sourceforge
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to Doc/Extra/dbfactorysupport.html.

    93     93   <configuration>
    94     94     <system.data>
    95     95       <DbProviderFactories>
    96     96         <remove invariant="System.Data.SQLite"/>
    97     97         <add name="SQLite Data Provider" invariant="System.Data.SQLite" 
    98     98              description=".Net Framework Data Provider for SQLite"
    99     99              type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite,
   100         -                 Version=1.0.47.0, Culture=neutral,
          100  +                 Version=1.0.49.0, Culture=neutral,
   101    101                    PublicKeyToken=db937bc2d44ff139"/>
   102    102       </DbProviderFactories>
   103    103     </system.data>
   104    104   </configuration>
   105    105   </pre>
   106    106         </div>
   107    107         <p>

Changes to Doc/Extra/version.html.

    51     51             </td>
    52     52           </tr>
    53     53         </table>
    54     54       </div>
    55     55       <div id="mainSection">
    56     56       <div id="mainBody">
    57     57       <h1 class="heading">Version History</h1>
           58  +    <p><b>1.0.49.0 - May 28, 2008</b></p>
           59  +    <ul>
           60  +      <li>Code merge with SQLite 3.5.9</li>
           61  +      <li>Fixed schema problems when querying the TEMP catalog.</li>
           62  +      <li>Changed BLOB datatype schema to return IsLong = False instead of True.&nbsp; This
           63  +        was preventing DbCommandBuilder from using GUID's and BLOB's as primary keys.</li>
           64  +      <li>Fix rollover issue with SQLite3.Reset() using TickCount.</li>
           65  +      <li>Fixed SQLiteDataReader to dispose of its command (if called for) before 
           66  +        closing the connection (when flagged to do so) instead of the other way around.</li>
           67  +      <li>Fixed a DbNull error when retrieving items not backed by a table schema.</li>
           68  +      <li>Fixed foreign key constraint parsing bug.</li>
           69  +      <li>Added FailIfMissing property to the SQLiteConnectionStringBuilder.</li>
           70  +      <li>Converted the source projects to Visual Studio 2008.</li>
           71  +    </ul>
           72  +    <p><b>1.0.48.0 - December 28, 2007</b></p>
           73  +    <ul>
           74  +      <li>Code merge with SQLite 3.5.4</li>
           75  +      <li>Calling SQLiteDataReader.GetFieldType() on a column with no schema information
           76  +        and whos first row is initially NULL now returns type Object instead of type DbNull.</li>
           77  +      <li>Added support for a new DateTime type, JulianDay.&nbsp; SQLite uses Julian dates
           78  +        internally.</li>
           79  +      <li>Added a new connection string parameter "Default Timeout" and a corresponding
           80  +        method on the SQLiteConnection object to change the default command timeout.&nbsp;
           81  +        This is especially useful for changing the timeout on transactions, which use SQLiteCommand
           82  +        objects internally and have no ADO.NET-friendly way to adjust the command timeout
           83  +        on those commands.</li>
           84  +      <li>FTS1 and FTS2 modules were removed from the codebase.&nbsp; Please upgrade all
           85  +        full-text indexes to use the FTS3 module.&nbsp;</li>
           86  +    </ul>
           87  +    <p><b>1.0.47.2 - December 10, 2007</b></p>
           88  +    <ul>
           89  +      <li>Fixed yet one more bug when closing a database with unfinalized command objects</li>
           90  +      <li>Fixed the DataReader's GetFieldType function when dealing with untyped SQLite affinities</li>
           91  +    </ul>
           92  +    <p><b>1.0.47.1 - December 5, 2007</b></p>
           93  +    <ul>
           94  +      <li>Fixed a leftover bug from the codemerge with SQLite 3.5.3 that failed to close a database.</li>
           95  +      <li>Fixed the broken Compact Framework distribution binary.</li>
           96  +      <li>SQLite 3.5.x changed some internal infrastructure pieces in the encryption interface
           97  +        which I didn't catch initially.&nbsp; Fixed.&nbsp;</li>
           98  +    </ul>
    58     99       <p><b>1.0.47.0 - December 4, 2007</b></p>
    59    100       <ul>
    60    101         <li>Code merge with SQLite 3.5.3</li>
    61    102         <li>Added installer support for Visual Studio 2008.&nbsp; Code is still using the
    62    103           VS2005 SDK so one or two bells and whistles are missing, but nothing significant.</li>
    63    104         <li>This is the last version that the FTS1 and FTS2 extensions will appear.&nbsp;
    64    105           Everyone should rebuild their fulltext indexes using the new FTS3 module.&nbsp;

Changes to Doc/SQLite.NET.chm.

cannot compute difference between binary files

Changes to Doc/SQLite.NET.ndoc.

     6      6       <documenters>
     7      7           <documenter name="MSDN-Help2">
     8      8               <property name="PlugInNamespace" value="ms.vscc" />
     9      9               <property name="OutputDirectory" value=".\doc\" />
    10     10               <property name="HtmlHelpName" value="Documentation" />
    11     11               <property name="Title" value="An NDoc documented library" />
    12     12           </documenter>
    13         -        <documenter name="XML">
    14         -            <property name="OutputFile" value=".\doc\doc.xml" />
    15         -        </documenter>
    16         -        <documenter name="Intellisense">
    17         -            <property name="OutputDirectory" value=".\intellisense\" />
    18         -        </documenter>
    19     13           <documenter name="MSDN-CHM">
    20     14               <property name="IncludeFavorites" value="True" />
    21     15               <property name="SdkLinksOnWeb" value="True" />
    22     16               <property name="OutputDirectory" value=".\" />
    23     17               <property name="HtmlHelpName" value="SQLite.NET" />
    24     18               <property name="Title" value="SQLite ADO.NET 2.0 Provider" />
           19  +            <property name="Version" value="" />
    25     20               <property name="AdditionalContentResourceDirectory" value=".\Extra\" />
    26     21               <property name="AssemblyVersionInfo" value="AssemblyVersion" />
    27     22               <property name="FeedbackEmailAddress" value="robert@blackcastlesoft.com" />
    28     23               <property name="DocumentAttributes" value="False" />
    29     24               <property name="IncludeDefaultThreadSafety" value="False" />
    30     25           </documenter>
           26  +        <documenter name="XML">
           27  +            <property name="OutputFile" value=".\doc\doc.xml" />
           28  +        </documenter>
           29  +        <documenter name="Intellisense">
           30  +            <property name="OutputDirectory" value=".\intellisense\" />
           31  +        </documenter>
    31     32       </documenters>
    32     33   </project>

Changes to SQLite.Designer/AssemblyInfo.cs.

    28     28   //      Major Version
    29     29   //      Minor Version 
    30     30   //      Build Number
    31     31   //      Revision
    32     32   //
    33     33   // You can specify all the values or you can default the Revision and Build Numbers 
    34     34   // by using the '*' as shown below:
    35         -[assembly: AssemblyVersion("1.0.32.0")]
    36         -[assembly: AssemblyFileVersion("1.0.32.0")]
           35  +[assembly: AssemblyVersion("1.0.33.0")]
           36  +[assembly: AssemblyFileVersion("1.0.33.0")]
    37     37   [assembly: AssemblyDelaySignAttribute(false)]
    38     38   [assembly: AssemblyKeyFileAttribute("..\\System.Data.SQLite\\System.Data.SQLite.snk")]
    39     39   [assembly: AssemblyKeyNameAttribute("")]

Changes to SQLite.Designer/ChangePasswordDialog.cs.

    14     14     using System.Data.Common;
    15     15   
    16     16     public partial class ChangePasswordDialog : Form
    17     17     {
    18     18       internal string Password = null;
    19     19   
    20     20       private SQLiteConnectionProperties _props;
           21  +
           22  +    private string GetCurrentPassword()
           23  +    {
           24  +      try
           25  +      {
           26  +        return _props["Password"] as string;
           27  +      }
           28  +      catch
           29  +      {
           30  +        return String.Empty;
           31  +      }
           32  +    }
    21     33   
    22     34       internal ChangePasswordDialog(SQLiteConnectionProperties props)
    23     35       {
    24     36         _props = props;
    25     37         InitializeComponent();
    26     38   
    27         -      password.Text = _props["Password"] as string;
           39  +      password.Text = GetCurrentPassword();
    28     40       }
    29     41   
    30     42       private void password_TextChanged(object sender, EventArgs e)
    31     43       {
    32         -      if (String.IsNullOrEmpty(password.Text) || password.Text == _props["Password"] as string)
           44  +      if (String.IsNullOrEmpty(password.Text) || password.Text == GetCurrentPassword())
    33     45         {
    34     46           confirmLabel.Enabled = false;
    35     47           passwordConfirm.Enabled = false;
    36     48           passwordConfirm.Text = "";
    37     49   
    38         -        if (String.IsNullOrEmpty(password.Text) && _props["Password"] != null)
           50  +        if (String.IsNullOrEmpty(password.Text) && String.IsNullOrEmpty(GetCurrentPassword()) == false)
    39     51             action.Text = VSPackage.Decrypt;
    40     52           else
    41     53             action.Text = "";
    42     54         }
    43     55         else
    44     56         {
    45     57           confirmLabel.Enabled = true;
    46     58           passwordConfirm.Enabled = true;
    47     59   
    48         -        if (_props["Password"] != null)
           60  +        if (String.IsNullOrEmpty(GetCurrentPassword()) == false)
    49     61             action.Text = VSPackage.ReEncrypt;
    50     62           else
    51     63             action.Text = VSPackage.Encrypt;
    52     64         }
    53     65   
    54     66         okButton.Enabled = (password.Text == passwordConfirm.Text);
    55     67       }

Added SQLite.Designer/PkgCmd.vsct.

            1  +<?xml version="1.0" encoding="utf-8"?>
            2  +<CommandTable language="en-US" xmlns="http://schemas.microsoft.com/VisualStudio/2005-10-18/CommandTable">
            3  +  <Commands package="guidVSPackageBasedProviderPkg">
            4  +    <Buttons>
            5  +      <Button guid="guidVSPackageBasedProviderCmdSet" id="cmdidVacuum" type="Button">
            6  +        <CommandFlag>DefaultInvisible</CommandFlag>
            7  +        <CommandFlag>DynamicVisibility</CommandFlag>
            8  +        <CommandFlag>DefaultDisabled</CommandFlag>
            9  +        <Strings>
           10  +          <ButtonText>&amp;Vacuum</ButtonText>
           11  +        </Strings>
           12  +      </Button>
           13  +      <Button guid="guidVSPackageBasedProviderCmdSet" id="cmdidRekey" type="Button">
           14  +        <CommandFlag>DefaultInvisible</CommandFlag>
           15  +        <CommandFlag>DynamicVisibility</CommandFlag>
           16  +        <CommandFlag>DefaultDisabled</CommandFlag>
           17  +        <Strings>
           18  +          <ButtonText>Change &amp;Password ...</ButtonText>
           19  +        </Strings>
           20  +      </Button>
           21  +    </Buttons>
           22  +  </Commands>
           23  +  <CommandPlacements>
           24  +    <CommandPlacement guid="guidVSPackageBasedProviderCmdSet" id="cmdidVacuum" priority="0x0100">
           25  +      <Parent guid="guidVSData" id="IDG_DV_CONNECTION" />
           26  +    </CommandPlacement>
           27  +    <CommandPlacement guid="guidVSPackageBasedProviderCmdSet" id="cmdidRekey" priority="0x0100">
           28  +      <Parent guid="guidVSData" id="IDG_DV_CONNECTION" />
           29  +    </CommandPlacement>
           30  +  </CommandPlacements>
           31  +  <Symbols>
           32  +    <GuidSymbol name="Group_Undefined" value="{83285929-227c-11d3-b870-00c04f79f802}" />
           33  +    <GuidSymbol name="Pkg_Undefined" value="{8328592a-227c-11d3-b870-00c04f79f802}" />
           34  +    <GuidSymbol name="guidVSPackageBasedProviderPkg" value="{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}" />
           35  +    <GuidSymbol name="guidVSData" value="{4614107f-217d-4bbf-9dfe-b9e165c65572}">
           36  +      <IDSymbol name="IDG_DV_CONNECTION" value="0x4101" />
           37  +    </GuidSymbol>
           38  +    <GuidSymbol name="guidVSPackageBasedProviderCmdSet" value="{814658ee-a28e-4b97-bc33-4b1bc81ebecb}">
           39  +      <IDSymbol name="cmdidRekey" value="0x0107" />
           40  +      <IDSymbol name="cmdidVacuum" value="0x0106" />
           41  +    </GuidSymbol>
           42  +    <GuidSymbol name="guidOfficeIcon" value="{d309f794-903f-11d0-9efc-00a0c911004f}">
           43  +      <IDSymbol name="msotcidNoIcon" value="0x02EA" />
           44  +    </GuidSymbol>
           45  +  </Symbols>
           46  +</CommandTable>

Changes to SQLite.Designer/SQLite.Designer.csproj.

     1         -<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
            1  +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
     2      2     <PropertyGroup>
     3      3       <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
     4      4       <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
     5      5       <ProductVersion>8.0.50727</ProductVersion>
     6      6       <SchemaVersion>2.0</SchemaVersion>
     7      7       <ProjectGuid>{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}</ProjectGuid>
     8      8       <OutputType>Library</OutputType>
     9      9       <AppDesignerFolder>Properties</AppDesignerFolder>
    10     10       <RootNamespace>SQLite.Designer</RootNamespace>
    11     11       <AssemblyName>SQLite.Designer</AssemblyName>
    12     12       <SignAssembly>false</SignAssembly>
    13         -    <AssemblyOriginatorKeyFile>
    14         -    </AssemblyOriginatorKeyFile>
           13  +    <RegisterOutputPackage>false</RegisterOutputPackage>
           14  +    <RegisterWithCodebase>false</RegisterWithCodebase>
           15  +    <GeneratePkgDefFile>false</GeneratePkgDefFile>
           16  +    <FileUpgradeFlags>
           17  +    </FileUpgradeFlags>
           18  +    <OldToolsVersion>2.0</OldToolsVersion>
           19  +    <UpgradeBackupLocation>
           20  +    </UpgradeBackupLocation>
    15     21     </PropertyGroup>
    16     22     <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    17     23       <DebugSymbols>true</DebugSymbols>
    18     24       <DebugType>full</DebugType>
    19     25       <Optimize>false</Optimize>
    20     26       <OutputPath>..\bin\designer\</OutputPath>
    21     27       <DefineConstants>DEBUG;TRACE</DefineConstants>
    22     28       <ErrorReport>prompt</ErrorReport>
    23     29       <WarningLevel>4</WarningLevel>
    24     30       <NoWarn>1701;1702;1699</NoWarn>
    25     31       <FileAlignment>512</FileAlignment>
    26     32       <PlatformTarget>x86</PlatformTarget>
    27     33       <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
           34  +    <RegisterOutputPackage>false</RegisterOutputPackage>
           35  +    <GeneratePkgDefFile>false</GeneratePkgDefFile>
           36  +    <RegisterWithCodebase>false</RegisterWithCodebase>
    28     37     </PropertyGroup>
    29     38     <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    30     39       <DebugType>none</DebugType>
    31     40       <Optimize>true</Optimize>
    32     41       <OutputPath>..\bin\Designer\</OutputPath>
    33     42       <DefineConstants>
    34     43       </DefineConstants>
    35     44       <ErrorReport>prompt</ErrorReport>
    36     45       <WarningLevel>4</WarningLevel>
    37     46       <NoWarn>1701;1702;1699</NoWarn>
    38     47       <FileAlignment>512</FileAlignment>
    39     48       <PlatformTarget>x86</PlatformTarget>
    40     49       <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
           50  +    <RegisterOutputPackage>false</RegisterOutputPackage>
           51  +    <RegisterWithCodebase>false</RegisterWithCodebase>
           52  +    <GeneratePkgDefFile>false</GeneratePkgDefFile>
    41     53     </PropertyGroup>
    42     54     <ItemGroup>
    43     55       <Reference Include="Microsoft.Data.ConnectionUI, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
    44     56         <SpecificVersion>False</SpecificVersion>
    45     57         <Private>False</Private>
    46     58       </Reference>
    47     59       <Reference Include="Microsoft.VisualStudio.Data, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
    48         -      <SpecificVersion>False</SpecificVersion>
    49     60         <HintPath>..\..\..\VSNET2005\Common7\IDE\Microsoft.VisualStudio.Data.dll</HintPath>
           61  +      <SpecificVersion>True</SpecificVersion>
    50     62         <Private>False</Private>
    51     63       </Reference>
    52     64       <Reference Include="Microsoft.VisualStudio.OLE.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    53     65         <SpecificVersion>False</SpecificVersion>
    54     66       </Reference>
    55     67       <Reference Include="Microsoft.VisualStudio.Shell, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
    56     68         <SpecificVersion>False</SpecificVersion>
................................................................................
   112    124       <Compile Include="SQLiteProviderObjectFactory.cs" />
   113    125       <Compile Include="VSPackage.Designer.cs">
   114    126         <AutoGen>True</AutoGen>
   115    127         <DesignTime>True</DesignTime>
   116    128         <DependentUpon>VSPackage.resx</DependentUpon>
   117    129       </Compile>
   118    130     </ItemGroup>
          131  +  <ItemGroup>
          132  +    <VSCTCompile Include="PkgCmd.vsct">
          133  +      <ResourceName>1000</ResourceName>
          134  +    </VSCTCompile>
          135  +  </ItemGroup>
   119    136     <ItemGroup>
   120    137       <EmbeddedResource Include="SQLiteDataViewSupport.xml" />
   121    138       <EmbeddedResource Include="VSPackage.resx">
   122    139         <Generator>ResXFileCodeGenerator</Generator>
   123    140         <LastGenOutput>VSPackage.Designer.cs</LastGenOutput>
   124    141         <MergeWithCTO>true</MergeWithCTO>
   125    142         <SubType>Designer</SubType>
................................................................................
   137    154       <EmbeddedResource Include="SQLiteConnectionUIControl.resx">
   138    155         <SubType>Designer</SubType>
   139    156         <DependentUpon>SQLiteConnectionUIControl.cs</DependentUpon>
   140    157       </EmbeddedResource>
   141    158       <EmbeddedResource Include="SQLiteDataObjectSupport.xml" />
   142    159     </ItemGroup>
   143    160     <ItemGroup>
   144         -    <CtcFile Include="CtcComponents\PkgCmd.ctc">
   145         -      <ResourceName>1000</ResourceName>
   146         -    </CtcFile>
   147         -    <None Include="CtcComponents\Guids.h" />
   148         -    <None Include="CtcComponents\PkgCmdID.h" />
   149         -  </ItemGroup>
   150         -  <ItemGroup>
   151    161       <Folder Include="Properties\" />
   152    162       <Folder Include="Resources\" />
   153    163     </ItemGroup>
   154    164     <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
   155         -  <Import Project="C:\Program Files (x86)\Visual Studio 2005 SDK\2007.02\VisualStudioIntegration\Tools\Build\Microsoft.VsSDK.targets" />
          165  +  <Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\VSSDK\Microsoft.VsSDK.targets" />
   156    166     <PropertyGroup>
   157    167       <PostBuildEvent>
   158    168       </PostBuildEvent>
   159    169     </PropertyGroup>
   160    170   </Project>

Changes to SQLite.Designer/SQLite.Designer.sln.

     1      1   
     2         -Microsoft Visual Studio Solution File, Format Version 9.00
     3         -# Visual Studio 2005
            2  +Microsoft Visual Studio Solution File, Format Version 10.00
            3  +# Visual Studio 2008
     4      4   Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SQLite.Designer", "SQLite.Designer.csproj", "{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}"
     5      5   EndProject
     6      6   Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "install", "..\tools\install\install.csproj", "{71EED886-B5BF-488E-A4AA-1403E393D224}"
     7      7   	ProjectSection(ProjectDependencies) = postProject
     8      8   		{AC139962-261A-4463-B6FA-AEBC25283A66} = {AC139962-261A-4463-B6FA-AEBC25283A66}
     9      9   		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198} = {9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}
    10     10   	EndProjectSection

Changes to SQLite.Designer/SQLiteDataViewSupport.xml.

   153    153           </Part>
   154    154         </Identifier>
   155    155         <CommandBindings>
   156    156           <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
   157    157           <CommandBinding name="DropTable" guid="5efc7975-14bc-11cf-9b2b-00aa00573819" cmdid="17" handler="SQLite.Designer.SQLiteCommandHandler">
   158    158             <Parameter value="Table"/>
   159    159           </CommandBinding>
   160         -        <CommandBinding name="Browse_Data" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="12384" handler="Microsoft.VisualStudio.DataTools.DBPackage.VDT_OLEDB_CommandHandler_TableTools">
          160  +        <CommandBinding name="Browse_Data" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="12384" handler="884DD964-5327-461f-9F06-6484DD540F8F">
   161    161             <Parameter value="Open"/>
   162    162           </CommandBinding>
          163  +        <!--<CommandBinding name="Browse_DataVS2005" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="12384" handler="Microsoft.VisualStudio.DataTools.DBPackage.VDT_OLEDB_CommandHandler_TableTools">
          164  +          <Parameter value="Open"/>
          165  +        </CommandBinding>-->
   163    166           <CommandBinding name="Design" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="12291" handler="SQLite.Designer.SQLiteCommandHandler">
   164    167             <Parameter value="Table"/>
   165    168           </CommandBinding>
   166    169         </CommandBindings>
   167    170       </TypeExtension>
   168    171       
   169    172       <TypeExtension name="View">

Changes to SQLite.Designer/VSPackage.Designer.cs.

     1      1   //------------------------------------------------------------------------------
     2      2   // <auto-generated>
     3      3   //     This code was generated by a tool.
     4         -//     Runtime Version:2.0.50727.42
            4  +//     Runtime Version:2.0.50727.1433
     5      5   //
     6      6   //     Changes to this file may cause incorrect behavior and will be lost if
     7      7   //     the code is regenerated.
     8      8   // </auto-generated>
     9      9   //------------------------------------------------------------------------------
    10     10   
    11     11   namespace SQLite.Designer {

Changes to SQLite.Interop/SQLite.Interop.rc.

    49     49   
    50     50   /////////////////////////////////////////////////////////////////////////////
    51     51   //
    52     52   // Version
    53     53   //
    54     54   
    55     55   VS_VERSION_INFO VERSIONINFO
    56         - FILEVERSION 1,0,47,0
           56  + FILEVERSION 1,0,49,0
    57     57    PRODUCTVERSION 1,0,0,0
    58     58    FILEFLAGSMASK 0x17L
    59     59   #ifdef _DEBUG
    60     60    FILEFLAGS 0x1L
    61     61   #else
    62     62    FILEFLAGS 0x0L
    63     63   #endif
................................................................................
    67     67   BEGIN
    68     68       BLOCK "StringFileInfo"
    69     69       BEGIN
    70     70           BLOCK "040904b0"
    71     71           BEGIN
    72     72               VALUE "Comments", "http://sqlite.phxsoftware.com"
    73     73               VALUE "FileDescription", "System.Data.SQLite Interop Library"
    74         -            VALUE "FileVersion", "1.0.47.0"
           74  +            VALUE "FileVersion", "1.0.49.0"
    75     75               VALUE "InternalName", "SQLite.Interop.DLL"
    76     76               VALUE "LegalCopyright", "Released to the public domain"
    77         -            VALUE "OriginalFilename", "SQLite3.DLL 3.4.2"
           77  +            VALUE "OriginalFilename", "SQLite3.DLL 3.5.9"
    78     78               VALUE "ProductName", "System.Data.SQLite"
    79     79               VALUE "ProductVersion", "1.0"
    80     80           END
    81     81       END
    82     82       BLOCK "VarFileInfo"
    83     83       BEGIN
    84     84           VALUE "Translation", 0x409, 1200

Changes to SQLite.Interop/SQLite.Interop.vcproj.

     1      1   <?xml version="1.0" encoding="Windows-1252"?>
     2      2   <VisualStudioProject
     3      3   	ProjectType="Visual C++"
     4         -	Version="8.00"
            4  +	Version="9.00"
     5      5   	Name="SQLite.Interop"
     6      6   	ProjectGUID="{10B51CE8-A838-44DE-BD82-B658F0296F80}"
     7      7   	RootNamespace="SQLite.Interop"
     8      8   	Keyword="Win32Proj"
            9  +	TargetFrameworkVersion="131072"
     9     10   	>
    10     11   	<Platforms>
    11     12   		<Platform
    12     13   			Name="Win32"
    13     14   		/>
    14     15   		<Platform
    15     16   			Name="Pocket PC 2003 (ARMV4)"
................................................................................
    50     51   				Name="VCMIDLTool"
    51     52   			/>
    52     53   			<Tool
    53     54   				Name="VCCLCompilerTool"
    54     55   				AdditionalOptions="/GS-"
    55     56   				Optimization="2"
    56     57   				FavorSizeOrSpeed="1"
    57         -				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;NO_TCL;THREADSAFE=1;SQLITE_HAS_CODEC;SQLITE_ENABLE_COLUMN_METADATA;SQLITE_ENABLE_FTS3;SQLITE_ENABLE_FTS2;SQLITE_ENABLE_FTS1;SQLITE_ENABLE_FTS2;SQLITE_ENABLE_FTS1;SQLITE_OMIT_TRACE"
           58  +				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;NO_TCL;THREADSAFE=1;SQLITE_HAS_CODEC;SQLITE_ENABLE_COLUMN_METADATA;SQLITE_ENABLE_FTS3;SQLITE_OMIT_TRACE"
    58     59   				StringPooling="true"
    59     60   				ExceptionHandling="0"
    60     61   			/>
    61     62   			<Tool
    62     63   				Name="VCManagedResourceCompilerTool"
    63     64   			/>
    64     65   			<Tool
................................................................................
    71     72   				Name="VCLinkerTool"
    72     73   				OutputFile="../bin/System.Data.SQLite.DLL"
    73     74   				GenerateManifest="false"
    74     75   				IgnoreDefaultLibraryNames=""
    75     76   				ModuleDefinitionFile="src\sqlite3.def"
    76     77   				EmbedManagedResourceFile=""
    77     78   				DelayLoadDLLs="advapi32.dll"
    78         -				OptimizeForWindows98="1"
           79  +				RandomizedBaseAddress="1"
           80  +				DataExecutionPrevention="0"
    79     81   				ImportLibrary=""
    80     82   				TargetMachine="1"
    81     83   				KeyFile=""
    82     84   			/>
    83     85   			<Tool
    84     86   				Name="VCALinkTool"
    85     87   			/>
................................................................................
    95     97   			/>
    96     98   			<Tool
    97     99   				Name="VCFxCopTool"
    98    100   			/>
    99    101   			<Tool
   100    102   				Name="VCAppVerifierTool"
   101    103   			/>
   102         -			<Tool
   103         -				Name="VCWebDeploymentTool"
   104         -			/>
   105    104   			<Tool
   106    105   				Name="VCPostBuildEventTool"
   107    106   				Description="Merging binaries ..."
   108    107   				CommandLine="..\bin\tools\mergebin.exe /S:.clr ..\System.Data.SQLite\bin\$(TargetFileName) &quot;$(TargetPath)&quot;&#x0D;&#x0A;sn -Ra &quot;$(TargetPath)&quot; ..\System.Data.SQLite\System.Data.SQLite.snk&#x0D;&#x0A;"
   109    108   			/>
   110    109   		</Configuration>
   111    110   		<Configuration
................................................................................
   131    130   			/>
   132    131   			<Tool
   133    132   				Name="VCMIDLTool"
   134    133   			/>
   135    134   			<Tool
   136    135   				Name="VCCLCompilerTool"
   137    136   				ExecutionBucket="7"
   138         -				PreprocessorDefinitions="_WIN32_WCE=$(CEVER);UNDER_CE=$(CEVER);WINCE;$(PLATFORMDEFINES);NDEBUG;_WINDOWS;_USRDLL;CPPSMART_EXPORTS;$(ARCHFAM);$(_ARCHFAM_);UNICODE;_UNICODE;SQLITE_HAS_CODEC;SQLITE_ENABLE_COLUMN_METADATA;SQLITE_ENABLE_FTS3;SQLITE_ENABLE_FTS2;SQLITE_ENABLE_FTS1;SQLITE_OMIT_TRACE"
          137  +				PreprocessorDefinitions="_WIN32_WCE=$(CEVER);UNDER_CE=$(CEVER);WINCE;$(PLATFORMDEFINES);NDEBUG;_WINDOWS;_USRDLL;CPPSMART_EXPORTS;$(ARCHFAM);$(_ARCHFAM_);UNICODE;_UNICODE;SQLITE_HAS_CODEC;SQLITE_ENABLE_COLUMN_METADATA;SQLITE_ENABLE_FTS3;SQLITE_OMIT_TRACE"
   139    138   				StringPooling="true"
   140    139   				ExceptionHandling="0"
   141    140   				BufferSecurityCheck="false"
   142    141   			/>
   143    142   			<Tool
   144    143   				Name="VCManagedResourceCompilerTool"
   145    144   			/>
................................................................................
   156    155   				Name="VCLinkerTool"
   157    156   				OutputFile="../bin/CompactFramework/System.Data.SQLite.DLL"
   158    157   				AdditionalLibraryDirectories=""
   159    158   				IgnoreDefaultLibraryNames=""
   160    159   				ModuleDefinitionFile="src\sqlite3.def"
   161    160   				AddModuleNamesToAssembly=""
   162    161   				EmbedManagedResourceFile=""
   163         -				SubSystem="9"
          162  +				SubSystem="8"
          163  +				RandomizedBaseAddress="1"
   164    164   				TargetMachine="3"
   165    165   			/>
   166    166   			<Tool
   167    167   				Name="VCALinkTool"
   168    168   			/>
   169    169   			<Tool
   170    170   				Name="VCXDCMakeTool"
   171    171   			/>
   172    172   			<Tool
   173    173   				Name="VCBscMakeTool"
   174    174   			/>
          175  +			<Tool
          176  +				Name="VCFxCopTool"
          177  +			/>
   175    178   			<Tool
   176    179   				Name="VCCodeSignTool"
   177    180   			/>
   178    181   			<Tool
   179    182   				Name="VCPostBuildEventTool"
   180    183   				Description="Merging binaries ..."
   181         -				CommandLine="..\bin\tools\mergebin.exe /A:1120 /S:.clr ..\System.Data.SQLite\bin\CompactFramework\$(TargetFileName) &quot;$(TargetPath)&quot;&#x0D;&#x0A;sn -Ra &quot;$(TargetPath)&quot; ..\System.Data.SQLite\System.Data.SQLite.CF.snk&#x0D;&#x0A;"
          184  +				CommandLine="..\bin\tools\mergebin.exe /A:1580 /S:.clr ..\System.Data.SQLite\bin\CompactFramework\$(TargetFileName) &quot;$(TargetPath)&quot;&#x0D;&#x0A;sn -Ra &quot;$(TargetPath)&quot; ..\System.Data.SQLite\System.Data.SQLite.CF.snk&#x0D;&#x0A;"
   182    185   			/>
   183    186   			<DeploymentTool
   184    187   				ForceDirty="-1"
   185    188   				RemoteDirectory="\Program Files\testce"
   186    189   				RegisterOutput="0"
   187    190   				AdditionalFiles=""
   188    191   			/>
................................................................................
   216    219   				TargetEnvironment="2"
   217    220   			/>
   218    221   			<Tool
   219    222   				Name="VCCLCompilerTool"
   220    223   				AdditionalOptions="/GS-"
   221    224   				Optimization="2"
   222    225   				FavorSizeOrSpeed="1"
   223         -				PreprocessorDefinitions="NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;NO_TCL;THREADSAFE=1;WIN64;SQLITE_HAS_CODEC;SQLITE_ENABLE_COLUMN_METADATA;SQLITE_ENABLE_FTS3;SQLITE_ENABLE_FTS2;SQLITE_ENABLE_FTS1;SQLITE_OMIT_TRACE"
          226  +				PreprocessorDefinitions="NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;NO_TCL;THREADSAFE=1;WIN64;SQLITE_HAS_CODEC;SQLITE_ENABLE_COLUMN_METADATA;SQLITE_ENABLE_FTS3;SQLITE_OMIT_TRACE"
   224    227   				StringPooling="true"
   225    228   				ExceptionHandling="0"
   226    229   				BufferSecurityCheck="false"
   227    230   				EnableFunctionLevelLinking="true"
   228    231   				RuntimeTypeInfo="false"
   229    232   			/>
   230    233   			<Tool
................................................................................
   238    241   			/>
   239    242   			<Tool
   240    243   				Name="VCLinkerTool"
   241    244   				OutputFile="../bin/Itanium/System.Data.SQLite.DLL"
   242    245   				ModuleDefinitionFile="src\sqlite3.def"
   243    246   				EmbedManagedResourceFile=""
   244    247   				DelayLoadDLLs="advapi32.dll"
   245         -				OptimizeForWindows98="1"
          248  +				RandomizedBaseAddress="1"
          249  +				DataExecutionPrevention="0"
   246    250   				ImportLibrary=""
   247    251   				TargetMachine="5"
   248    252   				KeyFile=""
   249    253   			/>
   250    254   			<Tool
   251    255   				Name="VCALinkTool"
   252    256   			/>
................................................................................
   262    266   			/>
   263    267   			<Tool
   264    268   				Name="VCFxCopTool"
   265    269   			/>
   266    270   			<Tool
   267    271   				Name="VCAppVerifierTool"
   268    272   			/>
   269         -			<Tool
   270         -				Name="VCWebDeploymentTool"
   271         -			/>
   272    273   			<Tool
   273    274   				Name="VCPostBuildEventTool"
   274    275   				Description="Merging binaries ..."
   275    276   				CommandLine="..\bin\tools\mergebin.exe /S:.clr ..\System.Data.SQLite\bin\$(TargetFileName) &quot;$(TargetPath)&quot;&#x0D;&#x0A;sn -Ra &quot;$(TargetPath)&quot; ..\System.Data.SQLite\System.Data.SQLite.snk&#x0D;&#x0A;"
   276    277   			/>
   277    278   		</Configuration>
   278    279   		<Configuration
................................................................................
   302    303   				TargetEnvironment="3"
   303    304   			/>
   304    305   			<Tool
   305    306   				Name="VCCLCompilerTool"
   306    307   				AdditionalOptions="/GS-"
   307    308   				Optimization="2"
   308    309   				FavorSizeOrSpeed="1"
   309         -				PreprocessorDefinitions="NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;NO_TCL;THREADSAFE=1;WIN64;SQLITE_HAS_CODEC;SQLITE_ENABLE_COLUMN_METADATA;SQLITE_ENABLE_FTS3;SQLITE_ENABLE_FTS2;SQLITE_ENABLE_FTS1;SQLITE_OMIT_TRACE"
          310  +				PreprocessorDefinitions="NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;NO_TCL;THREADSAFE=1;WIN64;SQLITE_HAS_CODEC;SQLITE_ENABLE_COLUMN_METADATA;SQLITE_ENABLE_FTS3;SQLITE_OMIT_TRACE"
   310    311   				StringPooling="true"
   311    312   				ExceptionHandling="0"
   312    313   				BufferSecurityCheck="false"
   313    314   				EnableFunctionLevelLinking="true"
   314    315   				RuntimeTypeInfo="false"
   315    316   			/>
   316    317   			<Tool
................................................................................
   324    325   			/>
   325    326   			<Tool
   326    327   				Name="VCLinkerTool"
   327    328   				OutputFile="../bin/x64/System.Data.SQLite.DLL"
   328    329   				ModuleDefinitionFile="src\sqlite3.def"
   329    330   				EmbedManagedResourceFile=""
   330    331   				DelayLoadDLLs="advapi32.dll"
   331         -				OptimizeForWindows98="1"
          332  +				RandomizedBaseAddress="1"
          333  +				DataExecutionPrevention="0"
   332    334   				ImportLibrary=""
   333    335   				TargetMachine="17"
   334    336   				KeyFile=""
   335    337   			/>
   336    338   			<Tool
   337    339   				Name="VCALinkTool"
   338    340   			/>
................................................................................
   348    350   			/>
   349    351   			<Tool
   350    352   				Name="VCFxCopTool"
   351    353   			/>
   352    354   			<Tool
   353    355   				Name="VCAppVerifierTool"
   354    356   			/>
   355         -			<Tool
   356         -				Name="VCWebDeploymentTool"
   357         -			/>
   358    357   			<Tool
   359    358   				Name="VCPostBuildEventTool"
   360    359   				Description="Merging binaries ..."
   361    360   				CommandLine="..\bin\tools\mergebin.exe /S:.clr ..\System.Data.SQLite\bin\$(TargetFileName) &quot;$(TargetPath)&quot;&#x0D;&#x0A;sn -Ra &quot;$(TargetPath)&quot; ..\System.Data.SQLite\System.Data.SQLite.snk&#x0D;&#x0A;"
   362    361   			/>
   363    362   		</Configuration>
   364    363   		<Configuration
................................................................................
   386    385   			<Tool
   387    386   				Name="VCMIDLTool"
   388    387   			/>
   389    388   			<Tool
   390    389   				Name="VCCLCompilerTool"
   391    390   				AdditionalOptions="/GS-"
   392    391   				Optimization="0"
   393         -				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;NO_TCL;THREADSAFE=1;SQLITE_HAS_CODEC;SQLITE_ENABLE_COLUMN_METADATA;SQLITE_ENABLE_FTS3;SQLITE_ENABLE_FTS2;SQLITE_ENABLE_FTS1;SQLITE_OMIT_TRACE"
          392  +				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;NO_TCL;THREADSAFE=1;SQLITE_HAS_CODEC;SQLITE_ENABLE_COLUMN_METADATA;SQLITE_ENABLE_FTS3;SQLITE_OMIT_TRACE"
   394    393   				RuntimeLibrary="3"
   395    394   				RuntimeTypeInfo="false"
   396    395   				DebugInformationFormat="3"
   397    396   			/>
   398    397   			<Tool
   399    398   				Name="VCManagedResourceCompilerTool"
   400    399   			/>
................................................................................
   408    407   				Name="VCLinkerTool"
   409    408   				OutputFile="../bin/$(InputName).DLL"
   410    409   				LinkIncremental="1"
   411    410   				ModuleDefinitionFile="src\sqlite3.def"
   412    411   				EmbedManagedResourceFile=""
   413    412   				DelayLoadDLLs="advapi32.dll"
   414    413   				GenerateDebugInformation="true"
          414  +				RandomizedBaseAddress="1"
          415  +				DataExecutionPrevention="0"
   415    416   				ImportLibrary=""
   416    417   				TargetMachine="1"
   417    418   				KeyFile="..\System.Data.SQLite\System.Data.SQLite.snk"
   418    419   			/>
   419    420   			<Tool
   420    421   				Name="VCALinkTool"
   421    422   			/>
................................................................................
   431    432   			/>
   432    433   			<Tool
   433    434   				Name="VCFxCopTool"
   434    435   			/>
   435    436   			<Tool
   436    437   				Name="VCAppVerifierTool"
   437    438   			/>
   438         -			<Tool
   439         -				Name="VCWebDeploymentTool"
   440         -			/>
   441    439   			<Tool
   442    440   				Name="VCPostBuildEventTool"
   443    441   				CommandLine=""
   444    442   			/>
   445    443   		</Configuration>
   446    444   		<Configuration
   447    445   			Name="Debug|Pocket PC 2003 (ARMV4)"
................................................................................
   469    467   				TargetEnvironment="1"
   470    468   			/>
   471    469   			<Tool
   472    470   				Name="VCCLCompilerTool"
   473    471   				ExecutionBucket="7"
   474    472   				AdditionalOptions="/GS-"
   475    473   				Optimization="0"
   476         -				PreprocessorDefinitions="_WIN32_WCE=$(CEVER);UNDER_CE=$(CEVER);WINCE;$(PLATFORMDEFINES);_DEBUG;_WINDOWS;_USRDLL;CPPSMART_EXPORTS;$(ARCHFAM);$(_ARCHFAM_);UNICODE;_UNICODE;SQLITE_HAS_CODEC;SQLITE_ENABLE_COLUMN_METADATA;SQLITE_ENABLE_FTS3;SQLITE_ENABLE_FTS2;SQLITE_ENABLE_FTS1;SQLITE_OMIT_TRACE"
          474  +				PreprocessorDefinitions="_WIN32_WCE=$(CEVER);UNDER_CE=$(CEVER);WINCE;$(PLATFORMDEFINES);_DEBUG;_WINDOWS;_USRDLL;CPPSMART_EXPORTS;$(ARCHFAM);$(_ARCHFAM_);UNICODE;_UNICODE;SQLITE_HAS_CODEC;SQLITE_ENABLE_COLUMN_METADATA;SQLITE_ENABLE_FTS3;SQLITE_OMIT_TRACE"
   477    475   				DebugInformationFormat="3"
   478    476   			/>
   479    477   			<Tool
   480    478   				Name="VCManagedResourceCompilerTool"
   481    479   			/>
   482    480   			<Tool
   483    481   				Name="VCResourceCompilerTool"
................................................................................
   495    493   				OutputFile="../bin/CompactFramework/$(InputName).DLL"
   496    494   				AdditionalLibraryDirectories=""
   497    495   				IgnoreDefaultLibraryNames=""
   498    496   				ModuleDefinitionFile="src\sqlite3.def"
   499    497   				AddModuleNamesToAssembly=""
   500    498   				EmbedManagedResourceFile=""
   501    499   				GenerateDebugInformation="true"
          500  +				RandomizedBaseAddress="1"
          501  +				DataExecutionPrevention="0"
   502    502   				TargetMachine="3"
   503    503   			/>
   504    504   			<Tool
   505    505   				Name="VCALinkTool"
   506    506   			/>
   507    507   			<Tool
   508    508   				Name="VCXDCMakeTool"
   509    509   			/>
   510    510   			<Tool
   511    511   				Name="VCBscMakeTool"
   512    512   			/>
          513  +			<Tool
          514  +				Name="VCFxCopTool"
          515  +			/>
   513    516   			<Tool
   514    517   				Name="VCCodeSignTool"
   515    518   			/>
   516    519   			<Tool
   517    520   				Name="VCPostBuildEventTool"
   518    521   				CommandLine=""
   519    522   			/>
................................................................................
   552    555   				Name="VCMIDLTool"
   553    556   				TargetEnvironment="2"
   554    557   			/>
   555    558   			<Tool
   556    559   				Name="VCCLCompilerTool"
   557    560   				AdditionalOptions="/GS-"
   558    561   				Optimization="0"
   559         -				PreprocessorDefinitions="_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;NO_TCL;THREADSAFE=1;WIN64;SQLITE_HAS_CODEC;SQLITE_ENABLE_COLUMN_METADATA;SQLITE_ENABLE_FTS3;SQLITE_ENABLE_FTS2;SQLITE_ENABLE_FTS1;SQLITE_OMIT_TRACE"
          562  +				PreprocessorDefinitions="_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;NO_TCL;THREADSAFE=1;WIN64;SQLITE_HAS_CODEC;SQLITE_ENABLE_COLUMN_METADATA;SQLITE_ENABLE_FTS3;SQLITE_OMIT_TRACE"
   560    563   				RuntimeLibrary="3"
   561    564   				RuntimeTypeInfo="false"
   562    565   				DebugInformationFormat="3"
   563    566   			/>
   564    567   			<Tool
   565    568   				Name="VCManagedResourceCompilerTool"
   566    569   			/>
................................................................................
   573    576   			<Tool
   574    577   				Name="VCLinkerTool"
   575    578   				OutputFile="../bin/Itanium/$(InputName).DLL"
   576    579   				ModuleDefinitionFile="src\sqlite3.def"
   577    580   				EmbedManagedResourceFile=""
   578    581   				DelayLoadDLLs="advapi32.dll"
   579    582   				GenerateDebugInformation="true"
          583  +				RandomizedBaseAddress="1"
          584  +				DataExecutionPrevention="0"
   580    585   				ImportLibrary=""
   581    586   				TargetMachine="5"
   582    587   				KeyFile="..\System.Data.SQLite\System.Data.SQLite.snk"
   583    588   			/>
   584    589   			<Tool
   585    590   				Name="VCALinkTool"
   586    591   			/>
................................................................................
   596    601   			/>
   597    602   			<Tool
   598    603   				Name="VCFxCopTool"
   599    604   			/>
   600    605   			<Tool
   601    606   				Name="VCAppVerifierTool"
   602    607   			/>
   603         -			<Tool
   604         -				Name="VCWebDeploymentTool"
   605         -			/>
   606    608   			<Tool
   607    609   				Name="VCPostBuildEventTool"
   608    610   			/>
   609    611   		</Configuration>
   610    612   		<Configuration
   611    613   			Name="Debug|x64"
   612    614   			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
................................................................................
   633    635   				Name="VCMIDLTool"
   634    636   				TargetEnvironment="3"
   635    637   			/>
   636    638   			<Tool
   637    639   				Name="VCCLCompilerTool"
   638    640   				AdditionalOptions="/GS-"
   639    641   				Optimization="0"
   640         -				PreprocessorDefinitions="_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;NO_TCL;THREADSAFE=1;WIN64;SQLITE_HAS_CODEC;SQLITE_ENABLE_COLUMN_METADATA;SQLITE_ENABLE_FTS3;SQLITE_ENABLE_FTS2;SQLITE_ENABLE_FTS1;SQLITE_OMIT_TRACE"
          642  +				PreprocessorDefinitions="_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;NO_TCL;THREADSAFE=1;WIN64;SQLITE_HAS_CODEC;SQLITE_ENABLE_COLUMN_METADATA;SQLITE_ENABLE_FTS3;SQLITE_OMIT_TRACE"
   641    643   				RuntimeLibrary="3"
   642    644   				RuntimeTypeInfo="false"
   643    645   				DebugInformationFormat="3"
   644    646   			/>
   645    647   			<Tool
   646    648   				Name="VCManagedResourceCompilerTool"
   647    649   			/>
................................................................................
   654    656   			<Tool
   655    657   				Name="VCLinkerTool"
   656    658   				OutputFile="../bin/x64/$(InputName).DLL"
   657    659   				ModuleDefinitionFile="src\sqlite3.def"
   658    660   				EmbedManagedResourceFile=""
   659    661   				DelayLoadDLLs="advapi32.dll"
   660    662   				GenerateDebugInformation="true"
          663  +				RandomizedBaseAddress="1"
          664  +				DataExecutionPrevention="0"
   661    665   				ImportLibrary=""
   662    666   				TargetMachine="17"
   663    667   				KeyFile="..\System.Data.SQLite\System.Data.SQLite.snk"
   664    668   			/>
   665    669   			<Tool
   666    670   				Name="VCALinkTool"
   667    671   			/>
................................................................................
   677    681   			/>
   678    682   			<Tool
   679    683   				Name="VCFxCopTool"
   680    684   			/>
   681    685   			<Tool
   682    686   				Name="VCAppVerifierTool"
   683    687   			/>
   684         -			<Tool
   685         -				Name="VCWebDeploymentTool"
   686         -			/>
   687    688   			<Tool
   688    689   				Name="VCPostBuildEventTool"
   689    690   			/>
   690    691   		</Configuration>
   691    692   	</Configurations>
   692    693   	<References>
   693    694   	</References>

Changes to SQLite.Interop/crypt.c.

     5      5   #include <wincrypt.h>
     6      6   
     7      7   // Extra padding before and after the cryptographic buffer
     8      8   #define CRYPT_OFFSET 8
     9      9   
    10     10   typedef struct _CRYPTBLOCK
    11     11   {
           12  +  Pager    *pPager;       // Pager this cryptblock belongs to
    12     13     HCRYPTKEY hReadKey;     // Key used to read from the database and write to the journal
    13     14     HCRYPTKEY hWriteKey;    // Key used to write to the database
    14     15     DWORD     dwPageSize;   // Size of pages
    15     16     LPVOID    pvCrypt;      // A buffer for encrypting/decrypting (if necessary)
    16     17     DWORD     dwCryptSize;  // Equal to or greater than dwPageSize.  If larger, pvCrypt is valid and this is its size
    17     18   } CRYPTBLOCK, *LPCRYPTBLOCK;
    18     19   
................................................................................
    59     60       pBlock->hWriteKey = hKey;
    60     61     }
    61     62     else // Updating an existing cryptblock
    62     63     {
    63     64       pBlock = pExisting;
    64     65     }
    65     66   
           67  +  pBlock->pPager = pager;
    66     68     pBlock->dwPageSize = (DWORD)pager->pageSize;
    67     69     pBlock->dwCryptSize = pBlock->dwPageSize;
    68     70   
    69     71     // Existing cryptblocks may have a buffer, if so, delete it
    70     72     if (pBlock->pvCrypt)
    71     73     {
    72     74       sqlite3_free(pBlock->pvCrypt);
................................................................................
   112    114     DWORD dwPageSize;
   113    115     LPVOID pvTemp;
   114    116   
   115    117     if (!pBlock) return data;
   116    118   
   117    119     // Make sure the page size for the pager is still the same as the page size
   118    120     // for the cryptblock.  If the user changed it, we need to adjust!
   119         -  //if (nMode != 2)
   120         -  //{
   121         -  //  PgHdr *pageHeader;
   122         -  //  pageHeader = DATA_TO_PGHDR(data);
   123         -  //  if (pageHeader->pPager->pageSize != pBlock->dwPageSize)
   124         -  //  {
   125         -  //    // Update the cryptblock to reflect the new page size
   126         -  //    CreateCryptBlock(0, pageHeader->pPager, pBlock);
   127         -  //  }
   128         -  //}
          121  +  if (nMode != 2)
          122  +  {
          123  +    if (pBlock->pPager->pageSize != pBlock->dwPageSize)
          124  +    {
          125  +      // Update the cryptblock to reflect the new page size
          126  +      CreateCryptBlock(pBlock->hReadKey, pBlock->pPager, pBlock);
          127  +    }
          128  +  }
   129    129   
   130    130     switch(nMode)
   131    131     {
   132    132     case 0: // Undo a "case 7" journal file encryption
   133    133     case 2: // Reload a page
   134    134     case 3: // Load a page
   135    135       if (!pBlock->hReadKey) break;

Changes to SQLite.Interop/interop.c.

    84     84     //  LeaveCriticalSection(pdb->pTraceArg);
    85     85     //}
    86     86   }
    87     87   
    88     88   int sqlite3_closeAndFreeMutex(sqlite3 *db)
    89     89   {
    90     90     //CRITICAL_SECTION *pcrit = db->pTraceArg;
    91         -  //int ret;
           91  +  int ret;
    92     92     //EnterDbMutex(db);
    93     93   
    94         -  //ret = sqlite3_close(db);
           94  +  ret = sqlite3_close(db);
    95     95     //if (ret == SQLITE_OK)
    96     96     //{
    97     97     //  if (pcrit)
    98     98     //  {
    99     99     //    LeaveCriticalSection(pcrit);
   100    100     //    DeleteCriticalSection(pcrit);
   101    101     //    sqlite3_free(pcrit);
   102    102     //  }
   103    103     //}
   104    104     //else
   105    105     //  LeaveDbMutex(db);
   106    106   
   107         -  return 0;
          107  +  return ret;
   108    108   }
   109    109   
   110    110   int SetCompression(const wchar_t *pwszFilename, unsigned short ufLevel)
   111    111   {
   112    112   #ifdef FSCTL_SET_COMPRESSION
   113    113     HMODULE hMod = GetModuleHandle(_T("KERNEL32"));
   114    114     CREATEFILEW pfunc;
................................................................................
   442    442   }
   443    443   
   444    444   __declspec(dllexport) int WINAPI sqlite3_step_interop(sqlite3_stmt *stmt)
   445    445   {
   446    446     int ret;
   447    447   
   448    448     EnterDbMutex(((Vdbe *)stmt)->db);
          449  +
          450  +  if (((Vdbe *)stmt)->magic == VDBE_MAGIC_DEAD) return SQLITE_ERROR;
   449    451     ret = sqlite3_step(stmt);
   450    452     LeaveDbMutex(((Vdbe *)stmt)->db);
   451    453   
   452    454     return ret;
   453    455   }
   454    456   
   455    457   __declspec(dllexport) int WINAPI sqlite3_data_count_interop(sqlite3_stmt *stmt)
................................................................................
   537    539   }
   538    540   
   539    541   __declspec(dllexport) int WINAPI sqlite3_reset_interop(sqlite3_stmt *stmt)
   540    542   {
   541    543     int ret;
   542    544   
   543    545     EnterDbMutex(((Vdbe *)stmt)->db);
          546  +  if (((Vdbe *)stmt)->magic == VDBE_MAGIC_DEAD) return SQLITE_SCHEMA;
   544    547     ret = sqlite3_reset(stmt);
   545    548     LeaveDbMutex(((Vdbe *)stmt)->db);
   546    549     return ret;
   547    550   }
   548    551   
   549    552   __declspec(dllexport) int WINAPI sqlite3_create_function_interop(sqlite3 *psql, const char *zFunctionName, int nArg, int eTextRep, SQLITEUSERFUNC func, SQLITEUSERFUNC funcstep, SQLITEUSERFUNC funcfinal, void **ppCookie)
   550    553   {
................................................................................
   894    897   }
   895    898   
   896    899   
   897    900   // IMPORTANT: This placeholder is here for a reason!!!
   898    901   // On the Compact Framework the .data section of the DLL must have its RawDataSize larger than the VirtualSize!
   899    902   // If its not, strong name validation will fail and other bad things will happen.
   900    903   #if _WIN32_WCE
   901         -__int64 _ph[84] = {1};
          904  +__int64 _ph[128] = {1};
   902    905   #endif // _WIN32_WCE
   903    906   
   904    907   #endif // OS_WIN

Changes to SQLite.Interop/merge.h.

     1      1   // This code was automatically generated from assembly
     2      2   // C:\Src\SQLite.NET\System.Data.SQLite\bin\CompactFramework\System.Data.SQLite.dll
     3      3   
     4      4   #include <windef.h>
     5      5   
     6      6   #pragma data_seg(push,clrseg,".clr")
     7      7   #pragma comment(linker, "/SECTION:.clr,ER")
     8         -  char __ph[131636] = {0}; // The number of bytes to reserve
            8  +  char __ph[132592] = {0}; // The number of bytes to reserve
     9      9   #pragma data_seg(pop,clrseg)
    10     10   
    11     11   typedef BOOL (WINAPI *DLLMAIN)(HANDLE, DWORD, LPVOID);
    12     12   typedef struct EXTRA_STUFF
    13     13   {
    14     14     DWORD dwNativeEntryPoint;
    15     15   } EXTRA_STUFF, *LPEXTRA_STUFF;

Changes to SQLite.Interop/merge_full.h.

     1      1   // This code was automatically generated from assembly
     2      2   // C:\Src\SQLite.NET\System.Data.SQLite\bin\System.Data.SQLite.dll
     3      3   
     4      4   #include <windef.h>
     5      5   
     6      6   #pragma data_seg(push,clrseg,".clr")
     7      7   #pragma comment(linker, "/SECTION:.clr,ER")
     8         -  char __ph[142252] = {0}; // The number of bytes to reserve
            8  +  char __ph[144600] = {0}; // The number of bytes to reserve
     9      9   #pragma data_seg(pop,clrseg)
    10     10   
    11     11   typedef BOOL (WINAPI *DLLMAIN)(HANDLE, DWORD, LPVOID);
    12     12   typedef struct EXTRA_STUFF
    13     13   {
    14     14     DWORD dwNativeEntryPoint;
    15     15   } EXTRA_STUFF, *LPEXTRA_STUFF;

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

more than 10,000 changes

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

    26     26   ** on how SQLite interfaces are suppose to operate.
    27     27   **
    28     28   ** The name of this file under configuration management is "sqlite.h.in".
    29     29   ** The makefile makes some minor changes to this file (such as inserting
    30     30   ** the version number) and changes its name to "sqlite3.h" as
    31     31   ** part of the build process.
    32     32   **
    33         -** @(#) $Id: sqlite3.h,v 1.33 2007/12/04 16:11:13 rmsimpson Exp $
           33  +** @(#) $Id: sqlite3.h,v 1.34 2008/05/28 08:25:00 rmsimpson Exp $
    34     34   */
    35     35   #ifndef _SQLITE3_H_
    36     36   #define _SQLITE3_H_
    37     37   #include <stdarg.h>     /* Needed for the definition of va_list */
    38     38   
    39     39   /*
    40     40   ** Make sure we can call this stuff from C++.
................................................................................
    59     59   # undef SQLITE_VERSION
    60     60   #endif
    61     61   #ifdef SQLITE_VERSION_NUMBER
    62     62   # undef SQLITE_VERSION_NUMBER
    63     63   #endif
    64     64   
    65     65   /*
    66         -** CAPI3REF: Compile-Time Library Version Numbers
           66  +** CAPI3REF: Compile-Time Library Version Numbers {F10010}
    67     67   **
    68         -** The version of the SQLite library is contained in the sqlite3.h
    69         -** header file in a #define named SQLITE_VERSION.  The SQLITE_VERSION
    70         -** macro resolves to a string constant.
           68  +** The SQLITE_VERSION and SQLITE_VERSION_NUMBER #defines in
           69  +** the sqlite3.h file specify the version of SQLite with which
           70  +** that header file is associated.
    71     71   **
    72         -** The format of the version string is "X.Y.Z", where
    73         -** X is the major version number, Y is the minor version number and Z
    74         -** is the release number.  The X.Y.Z might be followed by "alpha" or "beta".
    75         -** For example "3.1.1beta".
    76         -**
    77         -** The X value is always 3 in SQLite.  The X value only changes when
    78         -** backwards compatibility is broken and we intend to never break
    79         -** backwards compatibility.  The Y value only changes when
           72  +** The "version" of SQLite is a string of the form "X.Y.Z".
           73  +** The phrase "alpha" or "beta" might be appended after the Z.
           74  +** The X value is major version number always 3 in SQLite3.
           75  +** The X value only changes when  backwards compatibility is
           76  +** broken and we intend to never break
           77  +** backwards compatibility.  The Y value is the minor version
           78  +** number and only changes when
    80     79   ** there are major feature enhancements that are forwards compatible
    81         -** but not backwards compatible.  The Z value is incremented with
           80  +** but not backwards compatible.  The Z value is release number
           81  +** and is incremented with
    82     82   ** each release but resets back to 0 when Y is incremented.
    83     83   **
    84         -** The SQLITE_VERSION_NUMBER is an integer with the value 
    85         -** (X*1000000 + Y*1000 + Z). For example, for version "3.1.1beta", 
    86         -** SQLITE_VERSION_NUMBER is set to 3001001. To detect if they are using 
    87         -** version 3.1.1 or greater at compile time, programs may use the test 
    88         -** (SQLITE_VERSION_NUMBER>=3001001).
    89         -**
    90     84   ** See also: [sqlite3_libversion()] and [sqlite3_libversion_number()].
    91         -*/
    92         -#define SQLITE_VERSION         "3.5.3"
    93         -#define SQLITE_VERSION_NUMBER 3005003
    94         -
    95         -/*
    96         -** CAPI3REF: Run-Time Library Version Numbers
    97         -**
    98         -** These routines return values equivalent to the header constants
    99         -** [SQLITE_VERSION] and [SQLITE_VERSION_NUMBER].  The values returned
   100         -** by this routines should only be different from the header values
   101         -** if you compile your program using an sqlite3.h header from a
   102         -** different version of SQLite that the version of the library you
   103         -** link against.
   104         -**
   105         -** The sqlite3_version[] string constant contains the text of the
   106         -** [SQLITE_VERSION] string.  The sqlite3_libversion() function returns
   107         -** a poiner to the sqlite3_version[] string constant.  The function
   108         -** is provided for DLL users who can only access functions and not
           85  +**
           86  +** INVARIANTS:
           87  +**
           88  +** {F10011} The SQLITE_VERSION #define in the sqlite3.h header file
           89  +**          evaluates to a string literal that is the SQLite version
           90  +**          with which the header file is associated.
           91  +**
           92  +** {F10014} The SQLITE_VERSION_NUMBER #define resolves to an integer
           93  +**          with the value  (X*1000000 + Y*1000 + Z) where X, Y, and
           94  +**          Z are the major version, minor version, and release number.
           95  +*/
           96  +#define SQLITE_VERSION         "3.5.9"
           97  +#define SQLITE_VERSION_NUMBER  3005009
           98  +
           99  +/*
          100  +** CAPI3REF: Run-Time Library Version Numbers {F10020}
          101  +** KEYWORDS: sqlite3_version
          102  +**
          103  +** These features provide the same information as the [SQLITE_VERSION]
          104  +** and [SQLITE_VERSION_NUMBER] #defines in the header, but are associated
          105  +** with the library instead of the header file.  Cautious programmers might
          106  +** include a check in their application to verify that 
          107  +** sqlite3_libversion_number() always returns the value 
          108  +** [SQLITE_VERSION_NUMBER].
          109  +**
          110  +** The sqlite3_libversion() function returns the same information as is
          111  +** in the sqlite3_version[] string constant.  The function is provided
          112  +** for use in DLLs since DLL users usually do not have direct access to string
   109    113   ** constants within the DLL.
          114  +**
          115  +** INVARIANTS:
          116  +**
          117  +** {F10021} The [sqlite3_libversion_number()] interface returns an integer
          118  +**          equal to [SQLITE_VERSION_NUMBER]. 
          119  +**
          120  +** {F10022} The [sqlite3_version] string constant contains the text of the
          121  +**          [SQLITE_VERSION] string. 
          122  +**
          123  +** {F10023} The [sqlite3_libversion()] function returns
          124  +**          a pointer to the [sqlite3_version] string constant.
   110    125   */
   111    126   SQLITE_EXTERN const char sqlite3_version[];
   112    127   const char *sqlite3_libversion(void);
   113    128   int sqlite3_libversion_number(void);
   114    129   
   115    130   /*
   116         -** CAPI3REF: Test To See If The Library Is Threadsafe
   117         -**
   118         -** This routine returns TRUE (nonzero) if SQLite was compiled with
   119         -** all of its mutexes enabled and is thus threadsafe.  It returns
   120         -** zero if the particular build is for single-threaded operation
   121         -** only.
   122         -**
   123         -** Really all this routine does is return true if SQLite was compiled
   124         -** with the -DSQLITE_THREADSAFE=1 option and false if
   125         -** compiled with -DSQLITE_THREADSAFE=0.  If SQLite uses an
   126         -** application-defined mutex subsystem, malloc subsystem, collating
   127         -** sequence, VFS, SQL function, progress callback, commit hook,
   128         -** extension, or other accessories and these add-ons are not
   129         -** threadsafe, then clearly the combination will not be threadsafe
   130         -** either.  Hence, this routine never reports that the library
   131         -** is guaranteed to be threadsafe, only when it is guaranteed not
   132         -** to be.
   133         -**
   134         -** This is an experimental API and may go away or change in future
   135         -** releases.
          131  +** CAPI3REF: Test To See If The Library Is Threadsafe {F10100}
          132  +**
          133  +** SQLite can be compiled with or without mutexes.  When
          134  +** the SQLITE_THREADSAFE C preprocessor macro is true, mutexes
          135  +** are enabled and SQLite is threadsafe.  When that macro is false,
          136  +** the mutexes are omitted.  Without the mutexes, it is not safe
          137  +** to use SQLite from more than one thread.
          138  +**
          139  +** There is a measurable performance penalty for enabling mutexes.
          140  +** So if speed is of utmost importance, it makes sense to disable
          141  +** the mutexes.  But for maximum safety, mutexes should be enabled.
          142  +** The default behavior is for mutexes to be enabled.
          143  +**
          144  +** This interface can be used by a program to make sure that the
          145  +** version of SQLite that it is linking against was compiled with
          146  +** the desired setting of the SQLITE_THREADSAFE macro.
          147  +**
          148  +** INVARIANTS:
          149  +**
          150  +** {F10101} The [sqlite3_threadsafe()] function returns nonzero if
          151  +**          SQLite was compiled with its mutexes enabled or zero
          152  +**          if SQLite was compiled with mutexes disabled.
   136    153   */
   137    154   int sqlite3_threadsafe(void);
   138    155   
   139    156   /*
   140         -** CAPI3REF: Database Connection Handle
          157  +** CAPI3REF: Database Connection Handle {F12000}
          158  +** KEYWORDS: {database connection} {database connections}
   141    159   **
   142    160   ** Each open SQLite database is represented by pointer to an instance of the
   143    161   ** opaque structure named "sqlite3".  It is useful to think of an sqlite3
   144    162   ** pointer as an object.  The [sqlite3_open()], [sqlite3_open16()], and
   145    163   ** [sqlite3_open_v2()] interfaces are its constructors
   146    164   ** and [sqlite3_close()] is its destructor.  There are many other interfaces
   147    165   ** (such as [sqlite3_prepare_v2()], [sqlite3_create_function()], and
................................................................................
   148    166   ** [sqlite3_busy_timeout()] to name but three) that are methods on this
   149    167   ** object.
   150    168   */
   151    169   typedef struct sqlite3 sqlite3;
   152    170   
   153    171   
   154    172   /*
   155         -** CAPI3REF: 64-Bit Integer Types
          173  +** CAPI3REF: 64-Bit Integer Types {F10200}
          174  +** KEYWORDS: sqlite_int64 sqlite_uint64
   156    175   **
   157         -** Some compilers do not support the "long long" datatype.  So we have
   158         -** to do compiler-specific typedefs for 64-bit signed and unsigned integers.
          176  +** Because there is no cross-platform way to specify 64-bit integer types
          177  +** SQLite includes typedefs for 64-bit signed and unsigned integers.
   159    178   **
   160         -** Many SQLite interface functions require a 64-bit integer arguments.
   161         -** Those interfaces are declared using this typedef.
          179  +** The sqlite3_int64 and sqlite3_uint64 are the preferred type
          180  +** definitions.  The sqlite_int64 and sqlite_uint64 types are
          181  +** supported for backwards compatibility only.
          182  +**
          183  +** INVARIANTS:
          184  +**
          185  +** {F10201} The [sqlite_int64] and [sqlite3_int64] types specify a
          186  +**          64-bit signed integer.
          187  +**
          188  +** {F10202} The [sqlite_uint64] and [sqlite3_uint64] types specify
          189  +**          a 64-bit unsigned integer.
   162    190   */
   163    191   #ifdef SQLITE_INT64_TYPE
   164    192     typedef SQLITE_INT64_TYPE sqlite_int64;
   165    193     typedef unsigned SQLITE_INT64_TYPE sqlite_uint64;
   166    194   #elif defined(_MSC_VER) || defined(__BORLANDC__)
   167    195     typedef __int64 sqlite_int64;
   168    196     typedef unsigned __int64 sqlite_uint64;
................................................................................
   178    206   ** substitute integer for floating-point
   179    207   */
   180    208   #ifdef SQLITE_OMIT_FLOATING_POINT
   181    209   # define double sqlite3_int64
   182    210   #endif
   183    211   
   184    212   /*
   185         -** CAPI3REF: Closing A Database Connection
   186         -**
   187         -** Call this function with a pointer to a structure that was previously
   188         -** returned from [sqlite3_open()], [sqlite3_open16()], or
   189         -** [sqlite3_open_v2()] and the corresponding database will by
   190         -** closed.
   191         -**
   192         -** All SQL statements prepared using [sqlite3_prepare_v2()] or
   193         -** [sqlite3_prepare16_v2()] must be destroyed using [sqlite3_finalize()]
   194         -** before this routine is called. Otherwise, SQLITE_BUSY is returned and the
   195         -** database connection remains open.
   196         -**
   197         -** Passing this routine a database connection that has already been
   198         -** closed results in undefined behavior.  If other interfaces that
   199         -** reference the same database connection are pending (either in the
   200         -** same thread or in different threads) when this routine is called,
   201         -** then the behavior is undefined and is almost certainly undesirable.
          213  +** CAPI3REF: Closing A Database Connection {F12010}
          214  +**
          215  +** This routine is the destructor for the [sqlite3] object.  
          216  +**
          217  +** Applications should [sqlite3_finalize | finalize] all
          218  +** [prepared statements] and
          219  +** [sqlite3_blob_close | close] all [sqlite3_blob | BLOBs] 
          220  +** associated with the [sqlite3] object prior
          221  +** to attempting to close the [sqlite3] object.
          222  +**
          223  +** <todo>What happens to pending transactions?  Are they
          224  +** rolled back, or abandoned?</todo>
          225  +**
          226  +** INVARIANTS:
          227  +**
          228  +** {F12011} The [sqlite3_close()] interface destroys an [sqlite3] object
          229  +**          allocated by a prior call to [sqlite3_open()],
          230  +**          [sqlite3_open16()], or [sqlite3_open_v2()].
          231  +**
          232  +** {F12012} The [sqlite3_close()] function releases all memory used by the
          233  +**          connection and closes all open files.
          234  +**
          235  +** {F12013} If the database connection contains
          236  +**          [prepared statements] that have not been
          237  +**          finalized by [sqlite3_finalize()], then [sqlite3_close()]
          238  +**          returns [SQLITE_BUSY] and leaves the connection open.
          239  +**
          240  +** {F12014} Giving sqlite3_close() a NULL pointer is a harmless no-op.
          241  +**
          242  +** LIMITATIONS:
          243  +**
          244  +** {U12015} The parameter to [sqlite3_close()] must be an [sqlite3] object
          245  +**          pointer previously obtained from [sqlite3_open()] or the 
          246  +**          equivalent, or NULL.
          247  +**
          248  +** {U12016} The parameter to [sqlite3_close()] must not have been previously
          249  +**          closed.
   202    250   */
   203    251   int sqlite3_close(sqlite3 *);
   204    252   
   205    253   /*
   206    254   ** The type for a callback function.
   207    255   ** This is legacy and deprecated.  It is included for historical
   208    256   ** compatibility and is not documented.
   209    257   */
   210    258   typedef int (*sqlite3_callback)(void*,int,char**, char**);
   211    259   
   212    260   /*
   213         -** CAPI3REF: One-Step Query Execution Interface
   214         -**
   215         -** This interface is used to do a one-time evaluatation of zero
   216         -** or more SQL statements.  UTF-8 text of the SQL statements to
   217         -** be evaluted is passed in as the second parameter.  The statements
   218         -** are prepared one by one using [sqlite3_prepare()], evaluated
   219         -** using [sqlite3_step()], then destroyed using [sqlite3_finalize()].
   220         -**
   221         -** If one or more of the SQL statements are queries, then
   222         -** the callback function specified by the 3rd parameter is
   223         -** invoked once for each row of the query result.  This callback
   224         -** should normally return 0.  If the callback returns a non-zero
   225         -** value then the query is aborted, all subsequent SQL statements
   226         -** are skipped and the sqlite3_exec() function returns the [SQLITE_ABORT].
   227         -**
   228         -** The 4th parameter to this interface is an arbitrary pointer that is
   229         -** passed through to the callback function as its first parameter.
   230         -**
   231         -** The 2nd parameter to the callback function is the number of
   232         -** columns in the query result.  The 3rd parameter to the callback
   233         -** is an array of strings holding the values for each column
   234         -** as extracted using [sqlite3_column_text()].
   235         -** The 4th parameter to the callback is an array of strings
   236         -** obtained using [sqlite3_column_name()] and holding
   237         -** the names of each column.
   238         -**
   239         -** The callback function may be NULL, even for queries.  A NULL
   240         -** callback is not an error.  It just means that no callback
   241         -** will be invoked.
   242         -**
   243         -** If an error occurs while parsing or evaluating the SQL (but
   244         -** not while executing the callback) then an appropriate error
   245         -** message is written into memory obtained from [sqlite3_malloc()] and
   246         -** *errmsg is made to point to that message.  The calling function
   247         -** is responsible for freeing the memory using [sqlite3_free()].
   248         -** If errmsg==NULL, then no error message is ever written.
   249         -**
   250         -** The return value is is SQLITE_OK if there are no errors and
   251         -** some other [SQLITE_OK | return code] if there is an error.  
   252         -** The particular return value depends on the type of error. 
   253         -**
          261  +** CAPI3REF: One-Step Query Execution Interface {F12100}
          262  +**
          263  +** The sqlite3_exec() interface is a convenient way of running
          264  +** one or more SQL statements without a lot of C code.  The
          265  +** SQL statements are passed in as the second parameter to
          266  +** sqlite3_exec().  The statements are evaluated one by one
          267  +** until either an error or an interrupt is encountered or
          268  +** until they are all done.  The 3rd parameter is an optional
          269  +** callback that is invoked once for each row of any query results
          270  +** produced by the SQL statements.  The 5th parameter tells where
          271  +** to write any error messages.
          272  +**
          273  +** The sqlite3_exec() interface is implemented in terms of
          274  +** [sqlite3_prepare_v2()], [sqlite3_step()], and [sqlite3_finalize()].
          275  +** The sqlite3_exec() routine does nothing that cannot be done
          276  +** by [sqlite3_prepare_v2()], [sqlite3_step()], and [sqlite3_finalize()].
          277  +** The sqlite3_exec() is just a convenient wrapper.
          278  +**
          279  +** INVARIANTS:
          280  +** 
          281  +** {F12101} The [sqlite3_exec()] interface evaluates zero or more UTF-8
          282  +**          encoded, semicolon-separated, SQL statements in the
          283  +**          zero-terminated string of its 2nd parameter within the
          284  +**          context of the [sqlite3] object given in the 1st parameter.
          285  +**
          286  +** {F12104} The return value of [sqlite3_exec()] is SQLITE_OK if all
          287  +**          SQL statements run successfully.
          288  +**
          289  +** {F12105} The return value of [sqlite3_exec()] is an appropriate 
          290  +**          non-zero error code if any SQL statement fails.
          291  +**
          292  +** {F12107} If one or more of the SQL statements handed to [sqlite3_exec()]
          293  +**          return results and the 3rd parameter is not NULL, then
          294  +**          the callback function specified by the 3rd parameter is
          295  +**          invoked once for each row of result.
          296  +**
          297  +** {F12110} If the callback returns a non-zero value then [sqlite3_exec()]
          298  +**          will aborted the SQL statement it is currently evaluating,
          299  +**          skip all subsequent SQL statements, and return [SQLITE_ABORT].
          300  +**          <todo>What happens to *errmsg here?  Does the result code for
          301  +**          sqlite3_errcode() get set?</todo>
          302  +**
          303  +** {F12113} The [sqlite3_exec()] routine will pass its 4th parameter through
          304  +**          as the 1st parameter of the callback.
          305  +**
          306  +** {F12116} The [sqlite3_exec()] routine sets the 2nd parameter of its
          307  +**          callback to be the number of columns in the current row of
          308  +**          result.
          309  +**
          310  +** {F12119} The [sqlite3_exec()] routine sets the 3rd parameter of its 
          311  +**          callback to be an array of pointers to strings holding the
          312  +**          values for each column in the current result set row as
          313  +**          obtained from [sqlite3_column_text()].
          314  +**
          315  +** {F12122} The [sqlite3_exec()] routine sets the 4th parameter of its
          316  +**          callback to be an array of pointers to strings holding the
          317  +**          names of result columns as obtained from [sqlite3_column_name()].
          318  +**
          319  +** {F12125} If the 3rd parameter to [sqlite3_exec()] is NULL then
          320  +**          [sqlite3_exec()] never invokes a callback.  All query
          321  +**          results are silently discarded.
          322  +**
          323  +** {F12128} If an error occurs while parsing or evaluating any of the SQL
          324  +**          statements handed to [sqlite3_exec()] then [sqlite3_exec()] will
          325  +**          return an [error code] other than [SQLITE_OK].
          326  +**
          327  +** {F12131} If an error occurs while parsing or evaluating any of the SQL
          328  +**          handed to [sqlite3_exec()] and if the 5th parameter (errmsg)
          329  +**          to [sqlite3_exec()] is not NULL, then an error message is
          330  +**          allocated using the equivalent of [sqlite3_mprintf()] and
          331  +**          *errmsg is made to point to that message.
          332  +**
          333  +** {F12134} The [sqlite3_exec()] routine does not change the value of
          334  +**          *errmsg if errmsg is NULL or if there are no errors.
          335  +**
          336  +** {F12137} The [sqlite3_exec()] function sets the error code and message
          337  +**          accessible via [sqlite3_errcode()], [sqlite3_errmsg()], and
          338  +**          [sqlite3_errmsg16()].
          339  +**
          340  +** LIMITATIONS:
          341  +**
          342  +** {U12141} The first parameter to [sqlite3_exec()] must be an valid and open
          343  +**          [database connection].
          344  +**
          345  +** {U12142} The database connection must not be closed while
          346  +**          [sqlite3_exec()] is running.
          347  +** 
          348  +** {U12143} The calling function is should use [sqlite3_free()] to free
          349  +**          the memory that *errmsg is left pointing at once the error
          350  +**          message is no longer needed.
          351  +**
          352  +** {U12145} The SQL statement text in the 2nd parameter to [sqlite3_exec()]
          353  +**          must remain unchanged while [sqlite3_exec()] is running.
   254    354   */
   255    355   int sqlite3_exec(
   256    356     sqlite3*,                                  /* An open database */
   257    357     const char *sql,                           /* SQL to be evaluted */
   258    358     int (*callback)(void*,int,char**,char**),  /* Callback function */
   259    359     void *,                                    /* 1st argument to callback */
   260    360     char **errmsg                              /* Error msg written here */
   261    361   );
   262    362   
   263    363   /*
   264         -** CAPI3REF: Result Codes
   265         -** KEYWORDS: SQLITE_OK
          364  +** CAPI3REF: Result Codes {F10210}
          365  +** KEYWORDS: SQLITE_OK {error code} {error codes}
   266    366   **
   267    367   ** Many SQLite functions return an integer result code from the set shown
   268         -** above in order to indicates success or failure.
   269         -**
   270         -** The result codes above are the only ones returned by SQLite in its
   271         -** default configuration.  However, the [sqlite3_extended_result_codes()]
   272         -** API can be used to set a database connectoin to return more detailed
   273         -** result codes.
          368  +** here in order to indicates success or failure.
   274    369   **
   275    370   ** See also: [SQLITE_IOERR_READ | extended result codes]
   276         -**
   277    371   */
   278    372   #define SQLITE_OK           0   /* Successful result */
   279    373   /* beginning-of-error-codes */
   280    374   #define SQLITE_ERROR        1   /* SQL error or missing database */
   281         -#define SQLITE_INTERNAL     2   /* NOT USED. Internal logic error in SQLite */
          375  +#define SQLITE_INTERNAL     2   /* Internal logic error in SQLite */
   282    376   #define SQLITE_PERM         3   /* Access permission denied */
   283    377   #define SQLITE_ABORT        4   /* Callback routine requested an abort */
   284    378   #define SQLITE_BUSY         5   /* The database file is locked */
   285    379   #define SQLITE_LOCKED       6   /* A table in the database is locked */
   286    380   #define SQLITE_NOMEM        7   /* A malloc() failed */
   287    381   #define SQLITE_READONLY     8   /* Attempt to write a readonly database */
   288    382   #define SQLITE_INTERRUPT    9   /* Operation terminated by sqlite3_interrupt()*/
................................................................................
   304    398   #define SQLITE_RANGE       25   /* 2nd parameter to sqlite3_bind out of range */
   305    399   #define SQLITE_NOTADB      26   /* File opened that is not a database file */
   306    400   #define SQLITE_ROW         100  /* sqlite3_step() has another row ready */
   307    401   #define SQLITE_DONE        101  /* sqlite3_step() has finished executing */
   308    402   /* end-of-error-codes */
   309    403   
   310    404   /*
   311         -** CAPI3REF: Extended Result Codes
          405  +** CAPI3REF: Extended Result Codes {F10220}
          406  +** KEYWORDS: {extended error code} {extended error codes}
          407  +** KEYWORDS: {extended result codes}
   312    408   **
   313    409   ** In its default configuration, SQLite API routines return one of 26 integer
   314         -** result codes described at result-codes.  However, experience has shown that
          410  +** [SQLITE_OK | result codes].  However, experience has shown that
   315    411   ** many of these result codes are too course-grained.  They do not provide as
   316         -** much information about problems as users might like.  In an effort to
          412  +** much information about problems as programmers might like.  In an effort to
   317    413   ** address this, newer versions of SQLite (version 3.3.8 and later) include
   318    414   ** support for additional result codes that provide more detailed information
   319         -** about errors.  The extended result codes are enabled (or disabled) for 
   320         -** each database
   321         -** connection using the [sqlite3_extended_result_codes()] API.
          415  +** about errors. The extended result codes are enabled or disabled
          416  +** for each database connection using the [sqlite3_extended_result_codes()]
          417  +** API.
   322    418   ** 
   323         -** Some of the available extended result codes are listed above.
   324         -** We expect the number of extended result codes will be expand
          419  +** Some of the available extended result codes are listed here.
          420  +** One may expect the number of extended result codes will be expand
   325    421   ** over time.  Software that uses extended result codes should expect
   326    422   ** to see new result codes in future releases of SQLite.
   327         -** 
   328         -** The symbolic name for an extended result code always contains a related
   329         -** primary result code as a prefix.  Primary result codes contain a single
   330         -** "_" character.  Extended result codes contain two or more "_" characters.
   331         -** The numeric value of an extended result code can be converted to its
   332         -** corresponding primary result code by masking off the lower 8 bytes.
   333    423   **
   334    424   ** The SQLITE_OK result code will never be extended.  It will always
   335    425   ** be exactly zero.
          426  +** 
          427  +** INVARIANTS:
          428  +**
          429  +** {F10223} The symbolic name for an extended result code always contains
          430  +**          a related primary result code as a prefix.
          431  +**
          432  +** {F10224} Primary result code names contain a single "_" character.
          433  +**
          434  +** {F10225} Extended result code names contain two or more "_" characters.
          435  +**
          436  +** {F10226} The numeric value of an extended result code contains the
          437  +**          numeric value of its corresponding primary result code in
          438  +**          its least significant 8 bits.
   336    439   */
   337    440   #define SQLITE_IOERR_READ          (SQLITE_IOERR | (1<<8))
   338    441   #define SQLITE_IOERR_SHORT_READ    (SQLITE_IOERR | (2<<8))
   339    442   #define SQLITE_IOERR_WRITE         (SQLITE_IOERR | (3<<8))
   340    443   #define SQLITE_IOERR_FSYNC         (SQLITE_IOERR | (4<<8))
   341    444   #define SQLITE_IOERR_DIR_FSYNC     (SQLITE_IOERR | (5<<8))
   342    445   #define SQLITE_IOERR_TRUNCATE      (SQLITE_IOERR | (6<<8))
................................................................................
   344    447   #define SQLITE_IOERR_UNLOCK        (SQLITE_IOERR | (8<<8))
   345    448   #define SQLITE_IOERR_RDLOCK        (SQLITE_IOERR | (9<<8))
   346    449   #define SQLITE_IOERR_DELETE        (SQLITE_IOERR | (10<<8))
   347    450   #define SQLITE_IOERR_BLOCKED       (SQLITE_IOERR | (11<<8))
   348    451   #define SQLITE_IOERR_NOMEM         (SQLITE_IOERR | (12<<8))
   349    452   
   350    453   /*
   351         -** CAPI3REF: Flags For File Open Operations
          454  +** CAPI3REF: Flags For File Open Operations {F10230}
   352    455   **
   353         -** Combination of the following bit values are used as the
   354         -** third argument to the [sqlite3_open_v2()] interface and
   355         -** as fourth argument to the xOpen method of the
          456  +** These bit values are intended for use in the
          457  +** 3rd parameter to the [sqlite3_open_v2()] interface and
          458  +** in the 4th parameter to the xOpen method of the
   356    459   ** [sqlite3_vfs] object.
   357         -**
   358    460   */
   359    461   #define SQLITE_OPEN_READONLY         0x00000001
   360    462   #define SQLITE_OPEN_READWRITE        0x00000002
   361    463   #define SQLITE_OPEN_CREATE           0x00000004
   362    464   #define SQLITE_OPEN_DELETEONCLOSE    0x00000008
   363    465   #define SQLITE_OPEN_EXCLUSIVE        0x00000010
   364    466   #define SQLITE_OPEN_MAIN_DB          0x00000100
................................................................................
   366    468   #define SQLITE_OPEN_TRANSIENT_DB     0x00000400
   367    469   #define SQLITE_OPEN_MAIN_JOURNAL     0x00000800
   368    470   #define SQLITE_OPEN_TEMP_JOURNAL     0x00001000
   369    471   #define SQLITE_OPEN_SUBJOURNAL       0x00002000
   370    472   #define SQLITE_OPEN_MASTER_JOURNAL   0x00004000
   371    473   
   372    474   /*
   373         -** CAPI3REF: Device Characteristics
          475  +** CAPI3REF: Device Characteristics {F10240}
   374    476   **
   375    477   ** The xDeviceCapabilities method of the [sqlite3_io_methods]
   376         -** object returns an integer which is a vector of the following
          478  +** object returns an integer which is a vector of the these
   377    479   ** bit values expressing I/O characteristics of the mass storage
   378    480   ** device that holds the file that the [sqlite3_io_methods]
   379    481   ** refers to.
   380    482   **
   381    483   ** The SQLITE_IOCAP_ATOMIC property means that all writes of
   382    484   ** any size are atomic.  The SQLITE_IOCAP_ATOMICnnn values
   383    485   ** mean that writes of blocks that are nnn bytes in size and
................................................................................
   398    500   #define SQLITE_IOCAP_ATOMIC16K       0x00000040
   399    501   #define SQLITE_IOCAP_ATOMIC32K       0x00000080
   400    502   #define SQLITE_IOCAP_ATOMIC64K       0x00000100
   401    503   #define SQLITE_IOCAP_SAFE_APPEND     0x00000200
   402    504   #define SQLITE_IOCAP_SEQUENTIAL      0x00000400
   403    505   
   404    506   /*
   405         -** CAPI3REF: File Locking Levels
          507  +** CAPI3REF: File Locking Levels {F10250}
   406    508   **
   407         -** SQLite uses one of the following integer values as the second
          509  +** SQLite uses one of these integer values as the second
   408    510   ** argument to calls it makes to the xLock() and xUnlock() methods
   409    511   ** of an [sqlite3_io_methods] object.
   410    512   */
   411    513   #define SQLITE_LOCK_NONE          0
   412    514   #define SQLITE_LOCK_SHARED        1
   413    515   #define SQLITE_LOCK_RESERVED      2
   414    516   #define SQLITE_LOCK_PENDING       3
   415    517   #define SQLITE_LOCK_EXCLUSIVE     4
   416    518   
   417    519   /*
   418         -** CAPI3REF: Synchronization Type Flags
          520  +** CAPI3REF: Synchronization Type Flags {F10260}
   419    521   **
   420         -** When SQLite invokes the xSync() method of an [sqlite3_io_methods]
   421         -** object it uses a combination of the following integer values as
   422         -** the second argument.
          522  +** When SQLite invokes the xSync() method of an
          523  +** [sqlite3_io_methods] object it uses a combination of
          524  +** these integer values as the second argument.
   423    525   **
   424    526   ** When the SQLITE_SYNC_DATAONLY flag is used, it means that the
   425    527   ** sync operation only needs to flush data to mass storage.  Inode
   426         -** information need not be flushed.  The SQLITE_SYNC_NORMAL means 
   427         -** to use normal fsync() semantics.  The SQLITE_SYNC_FULL flag means 
          528  +** information need not be flushed. The SQLITE_SYNC_NORMAL flag means 
          529  +** to use normal fsync() semantics. The SQLITE_SYNC_FULL flag means 
   428    530   ** to use Mac OS-X style fullsync instead of fsync().
   429    531   */
   430    532   #define SQLITE_SYNC_NORMAL        0x00002
   431    533   #define SQLITE_SYNC_FULL          0x00003
   432    534   #define SQLITE_SYNC_DATAONLY      0x00010
   433    535   
   434    536   
   435    537   /*
   436         -** CAPI3REF: OS Interface Open File Handle
          538  +** CAPI3REF: OS Interface Open File Handle {F11110}
   437    539   **
   438    540   ** An [sqlite3_file] object represents an open file in the OS
   439    541   ** interface layer.  Individual OS interface implementations will
   440    542   ** want to subclass this object by appending additional fields
   441    543   ** for their own use.  The pMethods entry is a pointer to an
   442    544   ** [sqlite3_io_methods] object that defines methods for performing
   443    545   ** I/O operations on the open file.
................................................................................
   444    546   */
   445    547   typedef struct sqlite3_file sqlite3_file;
   446    548   struct sqlite3_file {
   447    549     const struct sqlite3_io_methods *pMethods;  /* Methods for an open file */
   448    550   };
   449    551   
   450    552   /*
   451         -** CAPI3REF: OS Interface File Virtual Methods Object
          553  +** CAPI3REF: OS Interface File Virtual Methods Object {F11120}
   452    554   **
   453    555   ** Every file opened by the [sqlite3_vfs] xOpen method contains a pointer to
   454         -** an instance of the this object.  This object defines the
          556  +** an instance of this object.  This object defines the
   455    557   ** methods used to perform various operations against the open file.
   456    558   **
   457    559   ** The flags argument to xSync may be one of [SQLITE_SYNC_NORMAL] or
   458    560   ** [SQLITE_SYNC_FULL].  The first choice is the normal fsync().
   459    561   *  The second choice is an
   460    562   ** OS-X style fullsync.  The SQLITE_SYNC_DATA flag may be ORed in to
   461    563   ** indicate that only the data of the file and not its inode needs to be
................................................................................
   538    640     int (*xFileControl)(sqlite3_file*, int op, void *pArg);
   539    641     int (*xSectorSize)(sqlite3_file*);
   540    642     int (*xDeviceCharacteristics)(sqlite3_file*);
   541    643     /* Additional methods may be added in future releases */
   542    644   };
   543    645   
   544    646   /*
   545         -** CAPI3REF: Standard File Control Opcodes
          647  +** CAPI3REF: Standard File Control Opcodes {F11310}
   546    648   **
   547    649   ** These integer constants are opcodes for the xFileControl method
   548    650   ** of the [sqlite3_io_methods] object and to the [sqlite3_file_control()]
   549    651   ** interface.
   550    652   **
   551    653   ** The [SQLITE_FCNTL_LOCKSTATE] opcode is used for debugging.  This
   552         -** opcode cases the xFileControl method to write the current state of
          654  +** opcode causes the xFileControl method to write the current state of
   553    655   ** the lock (one of [SQLITE_LOCK_NONE], [SQLITE_LOCK_SHARED],
   554    656   ** [SQLITE_LOCK_RESERVED], [SQLITE_LOCK_PENDING], or [SQLITE_LOCK_EXCLUSIVE])
   555         -** into an integer that the pArg argument points to.  This capability
          657  +** into an integer that the pArg argument points to. This capability
   556    658   ** is used during testing and only needs to be supported when SQLITE_TEST
   557    659   ** is defined.
   558    660   */
   559    661   #define SQLITE_FCNTL_LOCKSTATE        1
   560    662   
   561    663   /*
   562         -** CAPI3REF: Mutex Handle
          664  +** CAPI3REF: Mutex Handle {F17110}
   563    665   **
   564    666   ** The mutex module within SQLite defines [sqlite3_mutex] to be an
   565    667   ** abstract type for a mutex object.  The SQLite core never looks
   566    668   ** at the internal representation of an [sqlite3_mutex].  It only
   567    669   ** deals with pointers to the [sqlite3_mutex] object.
   568    670   **
   569    671   ** Mutexes are created using [sqlite3_mutex_alloc()].
   570    672   */
   571    673   typedef struct sqlite3_mutex sqlite3_mutex;
   572    674   
   573    675   /*
   574         -** CAPI3REF: OS Interface Object
          676  +** CAPI3REF: OS Interface Object {F11140}
   575    677   **
   576    678   ** An instance of this object defines the interface between the
   577    679   ** SQLite core and the underlying operating system.  The "vfs"
   578    680   ** in the name of the object stands for "virtual file system".
   579    681   **
   580    682   ** The iVersion field is initially 1 but may be larger for future
   581    683   ** versions of SQLite.  Additional fields may be appended to this
   582    684   ** object when the iVersion value is increased.
   583    685   **
   584    686   ** The szOsFile field is the size of the subclassed [sqlite3_file]
   585    687   ** structure used by this VFS.  mxPathname is the maximum length of
   586    688   ** a pathname in this VFS.
   587    689   **
   588         -** Registered vfs modules are kept on a linked list formed by
          690  +** Registered sqlite3_vfs objects are kept on a linked list formed by
   589    691   ** the pNext pointer.  The [sqlite3_vfs_register()]
   590    692   ** and [sqlite3_vfs_unregister()] interfaces manage this list
   591    693   ** in a thread-safe way.  The [sqlite3_vfs_find()] interface
   592    694   ** searches the list.
   593    695   **
   594         -** The pNext field is the only fields in the sqlite3_vfs 
          696  +** The pNext field is the only field in the sqlite3_vfs 
   595    697   ** structure that SQLite will ever modify.  SQLite will only access
   596    698   ** or modify this field while holding a particular static mutex.
   597    699   ** The application should never modify anything within the sqlite3_vfs
   598    700   ** object once the object has been registered.
   599    701   **
   600    702   ** The zName field holds the name of the VFS module.  The name must
   601    703   ** be unique across all VFS modules.
   602    704   **
   603         -** SQLite will guarantee that the zFilename string passed to
          705  +** {F11141} SQLite will guarantee that the zFilename string passed to
   604    706   ** xOpen() is a full pathname as generated by xFullPathname() and
   605    707   ** that the string will be valid and unchanged until xClose() is
   606         -** called.  So the [sqlite3_file] can store a pointer to the
          708  +** called.  {END} So the [sqlite3_file] can store a pointer to the
   607    709   ** filename if it needs to remember the filename for some reason.
   608    710   **
   609         -** The flags argument to xOpen() is a copy of the flags argument
   610         -** to [sqlite3_open_v2()].  If [sqlite3_open()] or [sqlite3_open16()]
   611         -** is used, then flags is [SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE].
          711  +** {F11142} The flags argument to xOpen() includes all bits set in
          712  +** the flags argument to [sqlite3_open_v2()].  Or if [sqlite3_open()]
          713  +** or [sqlite3_open16()] is used, then flags includes at least
          714  +** [SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE]. {END}
   612    715   ** If xOpen() opens a file read-only then it sets *pOutFlags to
   613    716   ** include [SQLITE_OPEN_READONLY].  Other bits in *pOutFlags may be
   614    717   ** set.
   615    718   ** 
   616         -** SQLite will also add one of the following flags to the xOpen()
          719  +** {F11143} SQLite will also add one of the following flags to the xOpen()
   617    720   ** call, depending on the object being opened:
   618    721   ** 
   619    722   ** <ul>
   620    723   ** <li>  [SQLITE_OPEN_MAIN_DB]
   621    724   ** <li>  [SQLITE_OPEN_MAIN_JOURNAL]
   622    725   ** <li>  [SQLITE_OPEN_TEMP_DB]
   623    726   ** <li>  [SQLITE_OPEN_TEMP_JOURNAL]
   624    727   ** <li>  [SQLITE_OPEN_TRANSIENT_DB]
   625    728   ** <li>  [SQLITE_OPEN_SUBJOURNAL]
   626    729   ** <li>  [SQLITE_OPEN_MASTER_JOURNAL]
   627         -** </ul>
          730  +** </ul> {END}
   628    731   **
   629    732   ** The file I/O implementation can use the object type flags to
   630    733   ** changes the way it deals with files.  For example, an application
   631         -** that does not care about crash recovery or rollback, might make
   632         -** the open of a journal file a no-op.  Writes to this journal are
   633         -** also a no-op.  Any attempt to read the journal return SQLITE_IOERR.
   634         -** Or the implementation might recognize the a database file will
   635         -** be doing page-aligned sector reads and writes in a random order
   636         -** and set up its I/O subsystem accordingly.
          734  +** that does not care about crash recovery or rollback might make
          735  +** the open of a journal file a no-op.  Writes to this journal would
          736  +** also be no-ops, and any attempt to read the journal would return 
          737  +** SQLITE_IOERR.  Or the implementation might recognize that a database 
          738  +** file will be doing page-aligned sector reads and writes in a random 
          739  +** order and set up its I/O subsystem accordingly.
   637    740   ** 
   638    741   ** SQLite might also add one of the following flags to the xOpen
   639    742   ** method:
   640    743   ** 
   641    744   ** <ul>
   642    745   ** <li> [SQLITE_OPEN_DELETEONCLOSE]
   643    746   ** <li> [SQLITE_OPEN_EXCLUSIVE]
   644    747   ** </ul>
   645    748   ** 
   646         -** The [SQLITE_OPEN_DELETEONCLOSE] flag means the file should be
   647         -** deleted when it is closed.  This will always be set for TEMP 
   648         -** databases and journals and for subjournals.  The 
   649         -** [SQLITE_OPEN_EXCLUSIVE] flag means the file should be opened
          749  +** {F11145} The [SQLITE_OPEN_DELETEONCLOSE] flag means the file should be
          750  +** deleted when it is closed.  {F11146} The [SQLITE_OPEN_DELETEONCLOSE]
          751  +** will be set for TEMP  databases, journals and for subjournals. 
          752  +** {F11147} The [SQLITE_OPEN_EXCLUSIVE] flag means the file should be opened
   650    753   ** for exclusive access.  This flag is set for all files except
   651         -** for the main database file.
          754  +** for the main database file. {END}
   652    755   ** 
   653         -** Space to hold the  [sqlite3_file] structure passed as the third 
   654         -** argument to xOpen is allocated by caller (the SQLite core). 
   655         -** szOsFile bytes are allocated for this object.  The xOpen method
   656         -** fills in the allocated space.
          756  +** {F11148} At least szOsFile bytes of memory are allocated by SQLite 
          757  +** to hold the  [sqlite3_file] structure passed as the third 
          758  +** argument to xOpen.  {END}  The xOpen method does not have to
          759  +** allocate the structure; it should just fill it in.
   657    760   ** 
   658         -** The flags argument to xAccess() may be [SQLITE_ACCESS_EXISTS] 
          761  +** {F11149} The flags argument to xAccess() may be [SQLITE_ACCESS_EXISTS] 
   659    762   ** to test for the existance of a file,
   660    763   ** or [SQLITE_ACCESS_READWRITE] to test to see
   661    764   ** if a file is readable and writable, or [SQLITE_ACCESS_READ]
   662         -** to test to see if a file is at least readable.  The file can be a 
          765  +** to test to see if a file is at least readable.  {END} The file can be a 
   663    766   ** directory.
   664    767   ** 
   665         -** SQLite will always allocate at least mxPathname+1 byte for
   666         -** the output buffers for xGetTempname and xFullPathname. The exact
          768  +** {F11150} SQLite will always allocate at least mxPathname+1 bytes for
          769  +** the output buffers for xGetTempname and xFullPathname. {F11151} The exact
   667    770   ** size of the output buffer is also passed as a parameter to both 
   668         -** methods. If the output buffer is not large enough, SQLITE_CANTOPEN
          771  +** methods. {END} If the output buffer is not large enough, SQLITE_CANTOPEN
   669    772   ** should be returned. As this is handled as a fatal error by SQLite,
   670         -** vfs implementations should endevour to prevent this by setting 
          773  +** vfs implementations should endeavor to prevent this by setting 
   671    774   ** mxPathname to a sufficiently large value.
   672    775   ** 
   673    776   ** The xRandomness(), xSleep(), and xCurrentTime() interfaces
   674    777   ** are not strictly a part of the filesystem, but they are
   675    778   ** included in the VFS structure for completeness.
   676    779   ** The xRandomness() function attempts to return nBytes bytes
   677    780   ** of good-quality randomness into zOut.  The return value is
   678    781   ** the actual number of bytes of randomness obtained.  The
   679         -** xSleep() method cause the calling thread to sleep for at
          782  +** xSleep() method causes the calling thread to sleep for at
   680    783   ** least the number of microseconds given.  The xCurrentTime()
   681    784   ** method returns a Julian Day Number for the current date and
   682    785   ** time.
   683    786   */
   684    787   typedef struct sqlite3_vfs sqlite3_vfs;
   685    788   struct sqlite3_vfs {
   686    789     int iVersion;            /* Structure version number */
................................................................................
   703    806     int (*xSleep)(sqlite3_vfs*, int microseconds);
   704    807     int (*xCurrentTime)(sqlite3_vfs*, double*);
   705    808     /* New fields may be appended in figure versions.  The iVersion
   706    809     ** value will increment whenever this happens. */
   707    810   };
   708    811   
   709    812   /*
   710         -** CAPI3REF: Flags for the xAccess VFS method
          813  +** CAPI3REF: Flags for the xAccess VFS method {F11190}
   711    814   **
   712         -** These integer constants can be used as the third parameter to
   713         -** the xAccess method of an [sqlite3_vfs] object.  They determine
   714         -** the kind of what kind of permissions the xAccess method is
   715         -** looking for.  With SQLITE_ACCESS_EXISTS, the xAccess method
   716         -** simply checks to see if the file exists.  With SQLITE_ACCESS_READWRITE,
   717         -** the xAccess method checks to see if the file is both readable
   718         -** and writable.  With SQLITE_ACCESS_READ the xAccess method
          815  +** {F11191} These integer constants can be used as the third parameter to
          816  +** the xAccess method of an [sqlite3_vfs] object. {END}  They determine
          817  +** what kind of permissions the xAccess method is
          818  +** looking for.  {F11192} With SQLITE_ACCESS_EXISTS, the xAccess method
          819  +** simply checks to see if the file exists. {F11193} With
          820  +** SQLITE_ACCESS_READWRITE, the xAccess method checks to see
          821  +** if the file is both readable and writable.  {F11194} With
          822  +** SQLITE_ACCESS_READ the xAccess method
   719    823   ** checks to see if the file is readable.
   720    824   */
   721    825   #define SQLITE_ACCESS_EXISTS    0
   722    826   #define SQLITE_ACCESS_READWRITE 1
   723    827   #define SQLITE_ACCESS_READ      2
   724    828   
   725    829   /*
   726         -** CAPI3REF: Enable Or Disable Extended Result Codes
          830  +** CAPI3REF: Enable Or Disable Extended Result Codes {F12200}
   727    831   **
   728         -** This routine enables or disables the
   729         -** [SQLITE_IOERR_READ | extended result codes] feature.
   730         -** By default, SQLite API routines return one of only 26 integer
   731         -** [SQLITE_OK | result codes].  When extended result codes
   732         -** are enabled by this routine, the repetoire of result codes can be
   733         -** much larger and can (hopefully) provide more detailed information
   734         -** about the cause of an error.
          832  +** The sqlite3_extended_result_codes() routine enables or disables the
          833  +** [SQLITE_IOERR_READ | extended result codes] feature of SQLite.
          834  +** The extended result codes are disabled by default for historical
          835  +** compatibility.
   735    836   **
   736         -** The second argument is a boolean value that turns extended result
   737         -** codes on and off.  Extended result codes are off by default for
   738         -** backwards compatibility with older versions of SQLite.
          837  +** INVARIANTS:
          838  +**
          839  +** {F12201} Each new [database connection] has the 
          840  +**          [extended result codes] feature
          841  +**          disabled by default.
          842  +**
          843  +** {F12202} The [sqlite3_extended_result_codes(D,F)] interface will enable
          844  +**          [extended result codes] for the 
          845  +**          [database connection] D if the F parameter
          846  +**          is true, or disable them if F is false.
   739    847   */
   740    848   int sqlite3_extended_result_codes(sqlite3*, int onoff);
   741    849   
   742    850   /*
   743         -** CAPI3REF: Last Insert Rowid
          851  +** CAPI3REF: Last Insert Rowid {F12220}
   744    852   **
   745         -** Each entry in an SQLite table has a unique 64-bit signed integer key
   746         -** called the "rowid". The rowid is always available as an undeclared
   747         -** column named ROWID, OID, or _ROWID_.  If the table has a column of
   748         -** type INTEGER PRIMARY KEY then that column is another an alias for the
   749         -** rowid.
          853  +** Each entry in an SQLite table has a unique 64-bit signed
          854  +** integer key called the "rowid". The rowid is always available
          855  +** as an undeclared column named ROWID, OID, or _ROWID_ as long as those
          856  +** names are not also used by explicitly declared columns. If
          857  +** the table has a column of type INTEGER PRIMARY KEY then that column
          858  +** is another alias for the rowid.
   750    859   **
   751         -** This routine returns the rowid of the most recent successful INSERT into
   752         -** the database from the database connection given in the first 
   753         -** argument.  If no successful inserts have ever occurred on this database
   754         -** connection, zero is returned.
          860  +** This routine returns the rowid of the most recent
          861  +** successful INSERT into the database from the database connection
          862  +** shown in the first argument.  If no successful inserts
          863  +** have ever occurred on this database connection, zero is returned.
   755    864   **
   756    865   ** If an INSERT occurs within a trigger, then the rowid of the
   757    866   ** inserted row is returned by this routine as long as the trigger
   758    867   ** is running.  But once the trigger terminates, the value returned
   759    868   ** by this routine reverts to the last value inserted before the
   760    869   ** trigger fired.
   761    870   **
................................................................................
   763    872   ** successful insert and does not change the value returned by this
   764    873   ** routine.  Thus INSERT OR FAIL, INSERT OR IGNORE, INSERT OR ROLLBACK,
   765    874   ** and INSERT OR ABORT make no changes to the return value of this
   766    875   ** routine when their insertion fails.  When INSERT OR REPLACE 
   767    876   ** encounters a constraint violation, it does not fail.  The
   768    877   ** INSERT continues to completion after deleting rows that caused
   769    878   ** the constraint problem so INSERT OR REPLACE will always change
   770         -** the return value of this interface.
          879  +** the return value of this interface. 
   771    880   **
   772         -** If another thread does a new insert on the same database connection
   773         -** while this routine is running and thus changes the last insert rowid,
   774         -** then the return value of this routine is undefined.
          881  +** For the purposes of this routine, an insert is considered to
          882  +** be successful even if it is subsequently rolled back.
          883  +**
          884  +** INVARIANTS:
          885  +**
          886  +** {F12221} The [sqlite3_last_insert_rowid()] function returns the
          887  +**          rowid of the most recent successful insert done
          888  +**          on the same database connection and within the same
          889  +**          trigger context, or zero if there have
          890  +**          been no qualifying inserts on that connection.
          891  +**
          892  +** {F12223} The [sqlite3_last_insert_rowid()] function returns
          893  +**          same value when called from the same trigger context
          894  +**          immediately before and after a ROLLBACK.
          895  +**
          896  +** LIMITATIONS:
          897  +**
          898  +** {U12232} If a separate thread does a new insert on the same
          899  +**          database connection while the [sqlite3_last_insert_rowid()]
          900  +**          function is running and thus changes the last insert rowid,
          901  +**          then the value returned by [sqlite3_last_insert_rowid()] is
          902  +**          unpredictable and might not equal either the old or the new
          903  +**          last insert rowid.
   775    904   */
   776    905   sqlite3_int64 sqlite3_last_insert_rowid(sqlite3*);
   777    906   
   778    907   /*
   779         -** CAPI3REF: Count The Number Of Rows Modified
          908  +** CAPI3REF: Count The Number Of Rows Modified {F12240}
   780    909   **
   781    910   ** This function returns the number of database rows that were changed
   782         -** (or inserted or deleted) by the most recent SQL statement.  Only
          911  +** or inserted or deleted by the most recently completed SQL statement
          912  +** on the connection specified by the first parameter.  Only
   783    913   ** changes that are directly specified by the INSERT, UPDATE, or
   784    914   ** DELETE statement are counted.  Auxiliary changes caused by
   785         -** triggers are not counted.  Use the [sqlite3_total_changes()] function
          915  +** triggers are not counted. Use the [sqlite3_total_changes()] function
   786    916   ** to find the total number of changes including changes caused by triggers.
   787    917   **
   788         -** Within the body of a trigger, the sqlite3_changes() interface can be
   789         -** called to find the number of
          918  +** A "row change" is a change to a single row of a single table
          919  +** caused by an INSERT, DELETE, or UPDATE statement.  Rows that
          920  +** are changed as side effects of REPLACE constraint resolution,
          921  +** rollback, ABORT processing, DROP TABLE, or by any other
          922  +** mechanisms do not count as direct row changes.
          923  +**
          924  +** A "trigger context" is a scope of execution that begins and
          925  +** ends with the script of a trigger.  Most SQL statements are
          926  +** evaluated outside of any trigger.  This is the "top level"
          927  +** trigger context.  If a trigger fires from the top level, a
          928  +** new trigger context is entered for the duration of that one
          929  +** trigger.  Subtriggers create subcontexts for their duration.
          930  +**
          931  +** Calling [sqlite3_exec()] or [sqlite3_step()] recursively does
          932  +** not create a new trigger context.
          933  +**
          934  +** This function returns the number of direct row changes in the
          935  +** most recent INSERT, UPDATE, or DELETE statement within the same
          936  +** trigger context.
          937  +**
          938  +** So when called from the top level, this function returns the
          939  +** number of changes in the most recent INSERT, UPDATE, or DELETE
          940  +** that also occurred at the top level.
          941  +** Within the body of a trigger, the sqlite3_changes() interface
          942  +** can be called to find the number of
   790    943   ** changes in the most recently completed INSERT, UPDATE, or DELETE
   791         -** statement within the body of the trigger.
   792         -**
   793         -** All changes are counted, even if they were later undone by a
   794         -** ROLLBACK or ABORT.  Except, changes associated with creating and
   795         -** dropping tables are not counted.
   796         -**
   797         -** If a callback invokes [sqlite3_exec()] or [sqlite3_step()] recursively,
   798         -** then the changes in the inner, recursive call are counted together
   799         -** with the changes in the outer call.
   800         -**
   801         -** SQLite implements the command "DELETE FROM table" without a WHERE clause
   802         -** by dropping and recreating the table.  (This is much faster than going
          944  +** statement within the body of the same trigger.
          945  +** However, the number returned does not include in changes
          946  +** caused by subtriggers since they have their own context.
          947  +**
          948  +** SQLite implements the command "DELETE FROM table" without
          949  +** a WHERE clause by dropping and recreating the table.  (This is much
          950  +** faster than going through and deleting individual elements from the
          951  +** table.)  Because of this optimization, the deletions in
          952  +** "DELETE FROM table" are not row changes and will not be counted
          953  +** by the sqlite3_changes() or [sqlite3_total_changes()] functions.
          954  +** To get an accurate count of the number of rows deleted, use
          955  +** "DELETE FROM table WHERE 1" instead.
          956  +**
          957  +** INVARIANTS:
          958  +**
          959  +** {F12241} The [sqlite3_changes()] function returns the number of
          960  +**          row changes caused by the most recent INSERT, UPDATE,
          961  +**          or DELETE statement on the same database connection and
          962  +**          within the same trigger context, or zero if there have
          963  +**          not been any qualifying row changes.
          964  +**
          965  +** LIMITATIONS:
          966  +**
          967  +** {U12252} If a separate thread makes changes on the same database connection
          968  +**          while [sqlite3_changes()] is running then the value returned
          969  +**          is unpredictable and unmeaningful.
          970  +*/
          971  +int sqlite3_changes(sqlite3*);
          972  +
          973  +/*
          974  +** CAPI3REF: Total Number Of Rows Modified {F12260}
          975  +***
          976  +** This function returns the number of row changes caused
          977  +** by INSERT, UPDATE or DELETE statements since the database handle
          978  +** was opened.  The count includes all changes from all trigger
          979  +** contexts.  But the count does not include changes used to
          980  +** implement REPLACE constraints, do rollbacks or ABORT processing,
          981  +** or DROP table processing.
          982  +** The changes
          983  +** are counted as soon as the statement that makes them is completed 
          984  +** (when the statement handle is passed to [sqlite3_reset()] or 
          985  +** [sqlite3_finalize()]).
          986  +**
          987  +** SQLite implements the command "DELETE FROM table" without
          988  +** a WHERE clause by dropping and recreating the table.  (This is much
          989  +** faster than going
   803    990   ** through and deleting individual elements from the table.)  Because of
   804    991   ** this optimization, the change count for "DELETE FROM table" will be
   805    992   ** zero regardless of the number of elements that were originally in the
   806    993   ** table. To get an accurate count of the number of rows deleted, use
   807    994   ** "DELETE FROM table WHERE 1" instead.
   808    995   **
   809         -** If another thread makes changes on the same database connection
   810         -** while this routine is running then the return value of this routine
   811         -** is undefined.
   812         -*/
   813         -int sqlite3_changes(sqlite3*);
   814         -
   815         -/*
   816         -** CAPI3REF: Total Number Of Rows Modified
   817         -***
   818         -** This function returns the number of database rows that have been
   819         -** modified by INSERT, UPDATE or DELETE statements since the database handle
   820         -** was opened. This includes UPDATE, INSERT and DELETE statements executed
   821         -** as part of trigger programs. All changes are counted as soon as the
   822         -** statement that makes them is completed (when the statement handle is
   823         -** passed to [sqlite3_reset()] or [sqlite3_finalize()]).
   824         -**
   825         -** See also the [sqlite3_change()] interface.
   826         -**
   827         -** SQLite implements the command "DELETE FROM table" without a WHERE clause
   828         -** by dropping and recreating the table.  (This is much faster than going
   829         -** through and deleting individual elements form the table.)  Because of
   830         -** this optimization, the change count for "DELETE FROM table" will be
   831         -** zero regardless of the number of elements that were originally in the
   832         -** table. To get an accurate count of the number of rows deleted, use
   833         -** "DELETE FROM table WHERE 1" instead.
   834         -**
   835         -** If another thread makes changes on the same database connection
   836         -** while this routine is running then the return value of this routine
   837         -** is undefined.
          996  +** See also the [sqlite3_changes()] interface.
          997  +**
          998  +** INVARIANTS:
          999  +** 
         1000  +** {F12261} The [sqlite3_total_changes()] returns the total number
         1001  +**          of row changes caused by INSERT, UPDATE, and/or DELETE
         1002  +**          statements on the same [database connection], in any
         1003  +**          trigger context, since the database connection was
         1004  +**          created.
         1005  +**
         1006  +** LIMITATIONS:
         1007  +**
         1008  +** {U12264} If a separate thread makes changes on the same database connection
         1009  +**          while [sqlite3_total_changes()] is running then the value 
         1010  +**          returned is unpredictable and unmeaningful.
   838   1011   */
   839   1012   int sqlite3_total_changes(sqlite3*);
   840   1013   
   841   1014   /*
   842         -** CAPI3REF: Interrupt A Long-Running Query
         1015  +** CAPI3REF: Interrupt A Long-Running Query {F12270}
   843   1016   **
   844   1017   ** This function causes any pending database operation to abort and
   845         -** return at its earliest opportunity.  This routine is typically
         1018  +** return at its earliest opportunity. This routine is typically
   846   1019   ** called in response to a user action such as pressing "Cancel"
   847   1020   ** or Ctrl-C where the user wants a long query operation to halt
   848   1021   ** immediately.
   849   1022   **
   850   1023   ** It is safe to call this routine from a thread different from the
   851   1024   ** thread that is currently running the database operation.  But it
   852   1025   ** is not safe to call this routine with a database connection that
   853   1026   ** is closed or might close before sqlite3_interrupt() returns.
   854   1027   **
   855         -** The SQL operation that is interrupted will return [SQLITE_INTERRUPT].
   856         -** If an interrupted operation was an update that is inside an
   857         -** explicit transaction, then the entire transaction will be rolled
   858         -** back automatically.
         1028  +** If an SQL is very nearly finished at the time when sqlite3_interrupt()
         1029  +** is called, then it might not have an opportunity to be interrupted.
         1030  +** It might continue to completion.
         1031  +** An SQL operation that is interrupted will return
         1032  +** [SQLITE_INTERRUPT].  If the interrupted SQL operation is an
         1033  +** INSERT, UPDATE, or DELETE that is inside an explicit transaction, 
         1034  +** then the entire transaction will be rolled back automatically.
         1035  +** A call to sqlite3_interrupt() has no effect on SQL statements
         1036  +** that are started after sqlite3_interrupt() returns.
         1037  +**
         1038  +** INVARIANTS:
         1039  +**
         1040  +** {F12271} The [sqlite3_interrupt()] interface will force all running
         1041  +**          SQL statements associated with the same database connection
         1042  +**          to halt after processing at most one additional row of
         1043  +**          data.
         1044  +**
         1045  +** {F12272} Any SQL statement that is interrupted by [sqlite3_interrupt()]
         1046  +**          will return [SQLITE_INTERRUPT].
         1047  +**
         1048  +** LIMITATIONS:
         1049  +**
         1050  +** {U12279} If the database connection closes while [sqlite3_interrupt()]
         1051  +**          is running then bad things will likely happen.
   859   1052   */
   860   1053   void sqlite3_interrupt(sqlite3*);
   861   1054   
   862   1055   /*
   863         -** CAPI3REF: Determine If An SQL Statement Is Complete
   864         -**
   865         -** These functions return true if the given input string comprises
   866         -** one or more complete SQL statements. For the sqlite3_complete() call,
   867         -** the parameter must be a nul-terminated UTF-8 string. For
   868         -** sqlite3_complete16(), a nul-terminated machine byte order UTF-16 string
   869         -** is required.
         1056  +** CAPI3REF: Determine If An SQL Statement Is Complete {F10510}
   870   1057   **
   871   1058   ** These routines are useful for command-line input to determine if the
   872         -** currently entered text forms one or more complete SQL statements or
   873         -** if additional input is needed before sending the statements into
   874         -** SQLite for parsing. The algorithm is simple.  If the 
   875         -** last token other than spaces and comments is a semicolon, then return 
   876         -** true.  Actually, the algorithm is a little more complicated than that
   877         -** in order to deal with triggers, but the basic idea is the same:  the
   878         -** statement is not complete unless it ends in a semicolon.
         1059  +** currently entered text seems to form complete a SQL statement or
         1060  +** if additional input is needed before sending the text into
         1061  +** SQLite for parsing.  These routines return true if the input string
         1062  +** appears to be a complete SQL statement.  A statement is judged to be
         1063  +** complete if it ends with a semicolon token and is not a fragment of a
         1064  +** CREATE TRIGGER statement.  Semicolons that are embedded within
         1065  +** string literals or quoted identifier names or comments are not
         1066  +** independent tokens (they are part of the token in which they are
         1067  +** embedded) and thus do not count as a statement terminator.
         1068  +**
         1069  +** These routines do not parse the SQL and
         1070  +** so will not detect syntactically incorrect SQL.
         1071  +**
         1072  +** INVARIANTS:
         1073  +**
         1074  +** {F10511} The sqlite3_complete() and sqlite3_complete16() functions
         1075  +**          return true (non-zero) if and only if the last
         1076  +**          non-whitespace token in their input is a semicolon that
         1077  +**          is not in between the BEGIN and END of a CREATE TRIGGER
         1078  +**          statement.
         1079  +**
         1080  +** LIMITATIONS:
         1081  +**
         1082  +** {U10512} The input to sqlite3_complete() must be a zero-terminated
         1083  +**          UTF-8 string.
         1084  +**
         1085  +** {U10513} The input to sqlite3_complete16() must be a zero-terminated
         1086  +**          UTF-16 string in native byte order.
   879   1087   */
   880   1088   int sqlite3_complete(const char *sql);
   881   1089   int sqlite3_complete16(const void *sql);
   882   1090   
   883   1091   /*
   884         -** CAPI3REF: Register A Callback To Handle SQLITE_BUSY Errors
         1092  +** CAPI3REF: Register A Callback To Handle SQLITE_BUSY Errors {F12310}
   885   1093   **
   886         -** This routine identifies a callback function that might be invoked
   887         -** whenever an attempt is made to open a database table 
         1094  +** This routine identifies a callback function that might be
         1095  +** invoked whenever an attempt is made to open a database table 
   888   1096   ** that another thread or process has locked.
   889   1097   ** If the busy callback is NULL, then [SQLITE_BUSY]
   890         -** (or sometimes [SQLITE_IOERR_BLOCKED])
         1098  +** or [SQLITE_IOERR_BLOCKED]
   891   1099   ** is returned immediately upon encountering the lock.
   892   1100   ** If the busy callback is not NULL, then the
   893   1101   ** callback will be invoked with two arguments.  The
   894   1102   ** first argument to the handler is a copy of the void* pointer which
   895   1103   ** is the third argument to this routine.  The second argument to
   896   1104   ** the handler is the number of times that the busy handler has
   897         -** been invoked for this locking event. If the
         1105  +** been invoked for this locking event.   If the
   898   1106   ** busy callback returns 0, then no additional attempts are made to
   899   1107   ** access the database and [SQLITE_BUSY] or [SQLITE_IOERR_BLOCKED] is returned.
   900         -** If the callback returns non-zero, then another attempt is made to open the
   901         -** database for reading and the cycle repeats.
         1108  +** If the callback returns non-zero, then another attempt
         1109  +** is made to open the database for reading and the cycle repeats.
   902   1110   **
   903   1111   ** The presence of a busy handler does not guarantee that
   904   1112   ** it will be invoked when there is lock contention.
   905   1113   ** If SQLite determines that invoking the busy handler could result in
   906         -** a deadlock, it will return [SQLITE_BUSY] instead.
         1114  +** a deadlock, it will go ahead and return [SQLITE_BUSY] or
         1115  +** [SQLITE_IOERR_BLOCKED] instead of invoking the
         1116  +** busy handler.
   907   1117   ** Consider a scenario where one process is holding a read lock that
   908   1118   ** it is trying to promote to a reserved lock and
   909   1119   ** a second process is holding a reserved lock that it is trying
   910   1120   ** to promote to an exclusive lock.  The first process cannot proceed
   911   1121   ** because it is blocked by the second and the second process cannot
   912   1122   ** proceed because it is blocked by the first.  If both processes
   913   1123   ** invoke the busy handlers, neither will make any progress.  Therefore,
   914   1124   ** SQLite returns [SQLITE_BUSY] for the first process, hoping that this
   915   1125   ** will induce the first process to release its read lock and allow
   916   1126   ** the second process to proceed.
   917   1127   **
   918   1128   ** The default busy callback is NULL.
   919   1129   **
   920         -** The [SQLITE_BUSY] error is converted to [SQLITE_IOERR_BLOCKED] when
   921         -** SQLite is in the middle of a large transaction where all the
         1130  +** The [SQLITE_BUSY] error is converted to [SQLITE_IOERR_BLOCKED]
         1131  +** when SQLite is in the middle of a large transaction where all the
   922   1132   ** changes will not fit into the in-memory cache.  SQLite will
   923   1133   ** already hold a RESERVED lock on the database file, but it needs
   924   1134   ** to promote this lock to EXCLUSIVE so that it can spill cache
   925   1135   ** pages into the database file without harm to concurrent
   926   1136   ** readers.  If it is unable to promote the lock, then the in-memory
   927   1137   ** cache will be left in an inconsistent state and so the error
   928   1138   ** code is promoted from the relatively benign [SQLITE_BUSY] to
   929   1139   ** the more severe [SQLITE_IOERR_BLOCKED].  This error code promotion
   930         -** forces an automatic rollback of the changes. See the
         1140  +** forces an automatic rollback of the changes.  See the
   931   1141   ** <a href="http://www.sqlite.org/cvstrac/wiki?p=CorruptionFollowingBusyError">
   932   1142   ** CorruptionFollowingBusyError</a> wiki page for a discussion of why
   933   1143   ** this is important.
   934   1144   **	
   935         -** Sqlite is re-entrant, so the busy handler may start a new query. 
   936         -** (It is not clear why anyone would every want to do this, but it
   937         -** is allowed, in theory.)  But the busy handler may not close the
   938         -** database.  Closing the database from a busy handler will delete 
   939         -** data structures out from under the executing query and will 
   940         -** probably result in a segmentation fault or other runtime error.
   941         -**
   942   1145   ** There can only be a single busy handler defined for each database
   943         -** connection.  Setting a new busy handler clears any previous one.
         1146  +** connection.  Setting a new busy handler clears any previous one. 
   944   1147   ** Note that calling [sqlite3_busy_timeout()] will also set or clear
   945   1148   ** the busy handler.
   946   1149   **
   947         -** When operating in [sqlite3_enable_shared_cache | shared cache mode],
   948         -** only a single busy handler can be defined for each database file.
   949         -** So if two database connections share a single cache, then changing
   950         -** the busy handler on one connection will also change the busy
   951         -** handler in the other connection.  The busy handler is invoked
   952         -** in the thread that was running when the SQLITE_BUSY was hit.
         1150  +** INVARIANTS:
         1151  +**
         1152  +** {F12311} The [sqlite3_busy_handler()] function replaces the busy handler
         1153  +**          callback in the database connection identified by the 1st
         1154  +**          parameter with a new busy handler identified by the 2nd and 3rd
         1155  +**          parameters.
         1156  +**
         1157  +** {F12312} The default busy handler for new database connections is NULL.
         1158  +**
         1159  +** {F12314} When two or more database connection share a common cache,
         1160  +**          the busy handler for the database connection currently using
         1161  +**          the cache is invoked when the cache encounters a lock.
         1162  +**
         1163  +** {F12316} If a busy handler callback returns zero, then the SQLite
         1164  +**          interface that provoked the locking event will return
         1165  +**          [SQLITE_BUSY].
         1166  +**
         1167  +** {F12318} SQLite will invokes the busy handler with two argument which
         1168  +**          are a copy of the pointer supplied by the 3rd parameter to
         1169  +**          [sqlite3_busy_handler()] and a count of the number of prior
         1170  +**          invocations of the busy handler for the same locking event.
         1171  +**
         1172  +** LIMITATIONS:
         1173  +**
         1174  +** {U12319} A busy handler should not call close the database connection
         1175  +**          or prepared statement that invoked the busy handler.
   953   1176   */
   954   1177   int sqlite3_busy_handler(sqlite3*, int(*)(void*,int), void*);
   955   1178   
   956   1179   /*
   957         -** CAPI3REF: Set A Busy Timeout
         1180  +** CAPI3REF: Set A Busy Timeout {F12340}
   958   1181   **
   959         -** This routine sets a busy handler that sleeps for a while when a
         1182  +** This routine sets a [sqlite3_busy_handler | busy handler]
         1183  +** that sleeps for a while when a
   960   1184   ** table is locked.  The handler will sleep multiple times until 
   961         -** at least "ms" milliseconds of sleeping have been done.  After
         1185  +** at least "ms" milliseconds of sleeping have been done. {F12343} After
   962   1186   ** "ms" milliseconds of sleeping, the handler returns 0 which
   963   1187   ** causes [sqlite3_step()] to return [SQLITE_BUSY] or [SQLITE_IOERR_BLOCKED].
   964   1188   **
   965   1189   ** Calling this routine with an argument less than or equal to zero
   966   1190   ** turns off all busy handlers.
   967   1191   **
   968   1192   ** There can only be a single busy handler for a particular database
   969   1193   ** connection.  If another busy handler was defined  
   970   1194   ** (using [sqlite3_busy_handler()]) prior to calling
   971   1195   ** this routine, that other busy handler is cleared.
         1196  +**
         1197  +** INVARIANTS:
         1198  +**
         1199  +** {F12341} The [sqlite3_busy_timeout()] function overrides any prior
         1200  +**          [sqlite3_busy_timeout()] or [sqlite3_busy_handler()] setting
         1201  +**          on the same database connection.
         1202  +**
         1203  +** {F12343} If the 2nd parameter to [sqlite3_busy_timeout()] is less than
         1204  +**          or equal to zero, then the busy handler is cleared so that
         1205  +**          all subsequent locking events immediately return [SQLITE_BUSY].
         1206  +**
         1207  +** {F12344} If the 2nd parameter to [sqlite3_busy_timeout()] is a positive
         1208  +**          number N, then a busy handler is set that repeatedly calls
         1209  +**          the xSleep() method in the VFS interface until either the
         1210  +**          lock clears or until the cumulative sleep time reported back
         1211  +**          by xSleep() exceeds N milliseconds.
   972   1212   */
   973   1213   int sqlite3_busy_timeout(sqlite3*, int ms);
   974   1214   
   975   1215   /*
   976         -** CAPI3REF: Convenience Routines For Running Queries
         1216  +** CAPI3REF: Convenience Routines For Running Queries {F12370}
   977   1217   **
   978         -** This next routine is a convenience wrapper around [sqlite3_exec()].
   979         -** Instead of invoking a user-supplied callback for each row of the
   980         -** result, this routine remembers each row of the result in memory
   981         -** obtained from [sqlite3_malloc()], then returns all of the result after the
   982         -** query has finished. 
         1218  +** Definition: A <b>result table</b> is memory data structure created by the
         1219  +** [sqlite3_get_table()] interface.  A result table records the
         1220  +** complete query results from one or more queries.
   983   1221   **
   984         -** As an example, suppose the query result where this table:
         1222  +** The table conceptually has a number of rows and columns.  But
         1223  +** these numbers are not part of the result table itself.  These
         1224  +** numbers are obtained separately.  Let N be the number of rows
         1225  +** and M be the number of columns.
         1226  +**
         1227  +** A result table is an array of pointers to zero-terminated
         1228  +** UTF-8 strings.  There are (N+1)*M elements in the array.  
         1229  +** The first M pointers point to zero-terminated strings that 
         1230  +** contain the names of the columns.
         1231  +** The remaining entries all point to query results.  NULL
         1232  +** values are give a NULL pointer.  All other values are in
         1233  +** their UTF-8 zero-terminated string representation as returned by
         1234  +** [sqlite3_column_text()].
         1235  +**
         1236  +** A result table might consists of one or more memory allocations.
         1237  +** It is not safe to pass a result table directly to [sqlite3_free()].
         1238  +** A result table should be deallocated using [sqlite3_free_table()].
         1239  +**
         1240  +** As an example of the result table format, suppose a query result
         1241  +** is as follows:
   985   1242   **
   986   1243   ** <blockquote><pre>
   987   1244   **        Name        | Age
   988   1245   **        -----------------------
   989   1246   **        Alice       | 43
   990   1247   **        Bob         | 28
   991   1248   **        Cindy       | 21
   992   1249   ** </pre></blockquote>
   993   1250   **
   994         -** If the 3rd argument were &azResult then after the function returns
   995         -** azResult will contain the following data:
         1251  +** There are two column (M==2) and three rows (N==3).  Thus the
         1252  +** result table has 8 entries.  Suppose the result table is stored
         1253  +** in an array names azResult.  Then azResult holds this content:
   996   1254   **
   997   1255   ** <blockquote><pre>
   998   1256   **        azResult&#91;0] = "Name";
   999   1257   **        azResult&#91;1] = "Age";
  1000   1258   **        azResult&#91;2] = "Alice";
  1001   1259   **        azResult&#91;3] = "43";
  1002   1260   **        azResult&#91;4] = "Bob";
  1003   1261   **        azResult&#91;5] = "28";
  1004   1262   **        azResult&#91;6] = "Cindy";
  1005   1263   **        azResult&#91;7] = "21";
  1006   1264   ** </pre></blockquote>
  1007   1265   **
  1008         -** Notice that there is an extra row of data containing the column
  1009         -** headers.  But the *nrow return value is still 3.  *ncolumn is
  1010         -** set to 2.  In general, the number of values inserted into azResult
  1011         -** will be ((*nrow) + 1)*(*ncolumn).
         1266  +** The sqlite3_get_table() function evaluates one or more
         1267  +** semicolon-separated SQL statements in the zero-terminated UTF-8
         1268  +** string of its 2nd parameter.  It returns a result table to the
         1269  +** pointer given in its 3rd parameter.
  1012   1270   **
  1013   1271   ** After the calling function has finished using the result, it should 
  1014         -** pass the result data pointer to sqlite3_free_table() in order to 
         1272  +** pass the pointer to the result table to sqlite3_free_table() in order to 
  1015   1273   ** release the memory that was malloc-ed.  Because of the way the 
  1016         -** [sqlite3_malloc()] happens, the calling function must not try to call 
  1017         -** [sqlite3_free()] directly.  Only [sqlite3_free_table()] is able to release 
  1018         -** the memory properly and safely.
         1274  +** [sqlite3_malloc()] happens within sqlite3_get_table(), the calling
         1275  +** function must not try to call [sqlite3_free()] directly.  Only 
         1276  +** [sqlite3_free_table()] is able to release the memory properly and safely.
  1019   1277   **
  1020         -** The return value of this routine is the same as from [sqlite3_exec()].
         1278  +** The sqlite3_get_table() interface is implemented as a wrapper around
         1279  +** [sqlite3_exec()].  The sqlite3_get_table() routine does not have access
         1280  +** to any internal data structures of SQLite.  It uses only the public
         1281  +** interface defined here.  As a consequence, errors that occur in the
         1282  +** wrapper layer outside of the internal [sqlite3_exec()] call are not
         1283  +** reflected in subsequent calls to [sqlite3_errcode()] or
         1284  +** [sqlite3_errmsg()].
         1285  +**
         1286  +** INVARIANTS:
         1287  +**
         1288  +** {F12371} If a [sqlite3_get_table()] fails a memory allocation, then
         1289  +**          it frees the result table under construction, aborts the
         1290  +**          query in process, skips any subsequent queries, sets the
         1291  +**          *resultp output pointer to NULL and returns [SQLITE_NOMEM].
         1292  +**
         1293  +** {F12373} If the ncolumn parameter to [sqlite3_get_table()] is not NULL
         1294  +**          then [sqlite3_get_table()] write the number of columns in the
         1295  +**          result set of the query into *ncolumn if the query is
         1296  +**          successful (if the function returns SQLITE_OK).
         1297  +**
         1298  +** {F12374} If the nrow parameter to [sqlite3_get_table()] is not NULL
         1299  +**          then [sqlite3_get_table()] write the number of rows in the
         1300  +**          result set of the query into *nrow if the query is
         1301  +**          successful (if the function returns SQLITE_OK).
         1302  +**
         1303  +** {F12376} The [sqlite3_get_table()] function sets its *ncolumn value
         1304  +**          to the number of columns in the result set of the query in the
         1305  +**          sql parameter, or to zero if the query in sql has an empty
         1306  +**          result set.
  1021   1307   */
  1022   1308   int sqlite3_get_table(
  1023         -  sqlite3*,              /* An open database */
  1024         -  const char *sql,       /* SQL to be executed */
  1025         -  char ***resultp,       /* Result written to a char *[]  that this points to */
  1026         -  int *nrow,             /* Number of result rows written here */
  1027         -  int *ncolumn,          /* Number of result columns written here */
  1028         -  char **errmsg          /* Error msg written here */
         1309  +  sqlite3*,             /* An open database */
         1310  +  const char *sql,      /* SQL to be evaluated */
         1311  +  char ***pResult,      /* Results of the query */
         1312  +  int *nrow,            /* Number of result rows written here */
         1313  +  int *ncolumn,         /* Number of result columns written here */
         1314  +  char **errmsg         /* Error msg written here */
  1029   1315   );
  1030   1316   void sqlite3_free_table(char **result);
  1031   1317   
  1032   1318   /*
  1033         -** CAPI3REF: Formatted String Printing Functions
         1319  +** CAPI3REF: Formatted String Printing Functions {F17400}
  1034   1320   **
  1035   1321   ** These routines are workalikes of the "printf()" family of functions
  1036   1322   ** from the standard C library.
  1037   1323   **
  1038   1324   ** The sqlite3_mprintf() and sqlite3_vmprintf() routines write their
  1039   1325   ** results into memory obtained from [sqlite3_malloc()].
  1040   1326   ** The strings returned by these two routines should be
  1041         -** released by [sqlite3_free()].  Both routines return a
         1327  +** released by [sqlite3_free()].   Both routines return a
  1042   1328   ** NULL pointer if [sqlite3_malloc()] is unable to allocate enough
  1043   1329   ** memory to hold the resulting string.
  1044   1330   **
  1045   1331   ** In sqlite3_snprintf() routine is similar to "snprintf()" from
  1046   1332   ** the standard C library.  The result is written into the
  1047   1333   ** buffer supplied as the second parameter whose size is given by
  1048         -** the first parameter.  Note that the order of the
         1334  +** the first parameter. Note that the order of the
  1049   1335   ** first two parameters is reversed from snprintf().  This is an
  1050   1336   ** historical accident that cannot be fixed without breaking
  1051   1337   ** backwards compatibility.  Note also that sqlite3_snprintf()
  1052   1338   ** returns a pointer to its buffer instead of the number of
  1053   1339   ** characters actually written into the buffer.  We admit that
  1054   1340   ** the number of characters written would be a more useful return
  1055   1341   ** value but we cannot change the implementation of sqlite3_snprintf()
................................................................................
  1103   1389   ** This second example is an SQL syntax error.  As a general rule you
  1104   1390   ** should always use %q instead of %s when inserting text into a string 
  1105   1391   ** literal.
  1106   1392   **
  1107   1393   ** The %Q option works like %q except it also adds single quotes around
  1108   1394   ** the outside of the total string.  Or if the parameter in the argument
  1109   1395   ** list is a NULL pointer, %Q substitutes the text "NULL" (without single
  1110         -** quotes) in place of the %Q option.  So, for example, one could say:
         1396  +** quotes) in place of the %Q option. {END}  So, for example, one could say:
  1111   1397   **
  1112   1398   ** <blockquote><pre>
  1113   1399   **  char *zSQL = sqlite3_mprintf("INSERT INTO table VALUES(%Q)", zText);
  1114   1400   **  sqlite3_exec(db, zSQL, 0, 0, 0);
  1115   1401   **  sqlite3_free(zSQL);
  1116   1402   ** </pre></blockquote>
  1117   1403   **
  1118   1404   ** The code above will render a correct SQL statement in the zSQL
  1119   1405   ** variable even if the zText variable is a NULL pointer.
  1120   1406   **
  1121   1407   ** The "%z" formatting option works exactly like "%s" with the
  1122   1408   ** addition that after the string has been read and copied into
  1123         -** the result, [sqlite3_free()] is called on the input string.
         1409  +** the result, [sqlite3_free()] is called on the input string. {END}
         1410  +**
         1411  +** INVARIANTS:
         1412  +**
         1413  +** {F17403}  The [sqlite3_mprintf()] and [sqlite3_vmprintf()] interfaces
         1414  +**           return either pointers to zero-terminated UTF-8 strings held in
         1415  +**           memory obtained from [sqlite3_malloc()] or NULL pointers if
         1416  +**           a call to [sqlite3_malloc()] fails.
         1417  +**
         1418  +** {F17406}  The [sqlite3_snprintf()] interface writes a zero-terminated
         1419  +**           UTF-8 string into the buffer pointed to by the second parameter
         1420  +**           provided that the first parameter is greater than zero.
         1421  +**
         1422  +** {F17407}  The [sqlite3_snprintf()] interface does not writes slots of
         1423  +**           its output buffer (the second parameter) outside the range
         1424  +**           of 0 through N-1 (where N is the first parameter)
         1425  +**           regardless of the length of the string
         1426  +**           requested by the format specification.
         1427  +**   
  1124   1428   */
  1125   1429   char *sqlite3_mprintf(const char*,...);
  1126   1430   char *sqlite3_vmprintf(const char*, va_list);
  1127   1431   char *sqlite3_snprintf(int,char*,const char*, ...);
  1128   1432   
  1129   1433   /*
  1130         -** CAPI3REF: Memory Allocation Subsystem
         1434  +** CAPI3REF: Memory Allocation Subsystem {F17300}
  1131   1435   **
  1132         -** The SQLite core uses these three routines for all of its own
  1133         -** internal memory allocation needs. (See the exception below.)
         1436  +** The SQLite core  uses these three routines for all of its own
         1437  +** internal memory allocation needs. "Core" in the previous sentence
         1438  +** does not include operating-system specific VFS implementation.  The
         1439  +** windows VFS uses native malloc and free for some operations.
         1440  +**
         1441  +** The sqlite3_malloc() routine returns a pointer to a block
         1442  +** of memory at least N bytes in length, where N is the parameter.
         1443  +** If sqlite3_malloc() is unable to obtain sufficient free
         1444  +** memory, it returns a NULL pointer.  If the parameter N to
         1445  +** sqlite3_malloc() is zero or negative then sqlite3_malloc() returns
         1446  +** a NULL pointer.
         1447  +**
         1448  +** Calling sqlite3_free() with a pointer previously returned
         1449  +** by sqlite3_malloc() or sqlite3_realloc() releases that memory so
         1450  +** that it might be reused.  The sqlite3_free() routine is
         1451  +** a no-op if is called with a NULL pointer.  Passing a NULL pointer
         1452  +** to sqlite3_free() is harmless.  After being freed, memory
         1453  +** should neither be read nor written.  Even reading previously freed
         1454  +** memory might result in a segmentation fault or other severe error.
         1455  +** Memory corruption, a segmentation fault, or other severe error
         1456  +** might result if sqlite3_free() is called with a non-NULL pointer that
         1457  +** was not obtained from sqlite3_malloc() or sqlite3_free().
         1458  +**
         1459  +** The sqlite3_realloc() interface attempts to resize a
         1460  +** prior memory allocation to be at least N bytes, where N is the
         1461  +** second parameter.  The memory allocation to be resized is the first
         1462  +** parameter.  If the first parameter to sqlite3_realloc()
         1463  +** is a NULL pointer then its behavior is identical to calling
         1464  +** sqlite3_malloc(N) where N is the second parameter to sqlite3_realloc().
         1465  +** If the second parameter to sqlite3_realloc() is zero or
         1466  +** negative then the behavior is exactly the same as calling
         1467  +** sqlite3_free(P) where P is the first parameter to sqlite3_realloc().
         1468  +** Sqlite3_realloc() returns a pointer to a memory allocation
         1469  +** of at least N bytes in size or NULL if sufficient memory is unavailable.
         1470  +** If M is the size of the prior allocation, then min(N,M) bytes
         1471  +** of the prior allocation are copied into the beginning of buffer returned
         1472  +** by sqlite3_realloc() and the prior allocation is freed.
         1473  +** If sqlite3_realloc() returns NULL, then the prior allocation
         1474  +** is not freed.
         1475  +**
         1476  +** The memory returned by sqlite3_malloc() and sqlite3_realloc()
         1477  +** is always aligned to at least an 8 byte boundary. {END}
  1134   1478   **
  1135   1479   ** The default implementation
  1136   1480   ** of the memory allocation subsystem uses the malloc(), realloc()
  1137         -** and free() provided by the standard C library.  However, if 
         1481  +** and free() provided by the standard C library. {F17382} However, if 
  1138   1482   ** SQLite is compiled with the following C preprocessor macro
  1139   1483   **
  1140   1484   ** <blockquote> SQLITE_MEMORY_SIZE=<i>NNN</i> </blockquote>
  1141   1485   **
  1142   1486   ** where <i>NNN</i> is an integer, then SQLite create a static
  1143   1487   ** array of at least <i>NNN</i> bytes in size and use that array
  1144         -** for all of its dynamic memory allocation needs.
         1488  +** for all of its dynamic memory allocation needs. {END}  Additional
         1489  +** memory allocator options may be added in future releases.
  1145   1490   **
  1146   1491   ** In SQLite version 3.5.0 and 3.5.1, it was possible to define
  1147   1492   ** the SQLITE_OMIT_MEMORY_ALLOCATION which would cause the built-in
  1148   1493   ** implementation of these routines to be omitted.  That capability
  1149   1494   ** is no longer provided.  Only built-in memory allocators can be
  1150   1495   ** used.
  1151   1496   **
  1152         -** <b>Exception:</b> The windows OS interface layer calls
         1497  +** The windows OS interface layer calls
  1153   1498   ** the system malloc() and free() directly when converting
  1154   1499   ** filenames between the UTF-8 encoding used by SQLite
  1155   1500   ** and whatever filename encoding is used by the particular windows
  1156   1501   ** installation.  Memory allocation errors are detected, but
  1157   1502   ** they are reported back as [SQLITE_CANTOPEN] or
  1158   1503   ** [SQLITE_IOERR] rather than [SQLITE_NOMEM].
         1504  +**
         1505  +** INVARIANTS:
         1506  +**
         1507  +** {F17303}  The [sqlite3_malloc(N)] interface returns either a pointer to 
         1508  +**           newly checked-out block of at least N bytes of memory
         1509  +**           that is 8-byte aligned, 
         1510  +**           or it returns NULL if it is unable to fulfill the request.
         1511  +**
         1512  +** {F17304}  The [sqlite3_malloc(N)] interface returns a NULL pointer if
         1513  +**           N is less than or equal to zero.
         1514  +**
         1515  +** {F17305}  The [sqlite3_free(P)] interface releases memory previously
         1516  +**           returned from [sqlite3_malloc()] or [sqlite3_realloc()],
         1517  +**           making it available for reuse.
         1518  +**
         1519  +** {F17306}  A call to [sqlite3_free(NULL)] is a harmless no-op.
         1520  +**
         1521  +** {F17310}  A call to [sqlite3_realloc(0,N)] is equivalent to a call
         1522  +**           to [sqlite3_malloc(N)].
         1523  +**
         1524  +** {F17312}  A call to [sqlite3_realloc(P,0)] is equivalent to a call
         1525  +**           to [sqlite3_free(P)].
         1526  +**
         1527  +** {F17315}  The SQLite core uses [sqlite3_malloc()], [sqlite3_realloc()],
         1528  +**           and [sqlite3_free()] for all of its memory allocation and
         1529  +**           deallocation needs.
         1530  +**
         1531  +** {F17318}  The [sqlite3_realloc(P,N)] interface returns either a pointer
         1532  +**           to a block of checked-out memory of at least N bytes in size
         1533  +**           that is 8-byte aligned, or a NULL pointer.
         1534  +**
         1535  +** {F17321}  When [sqlite3_realloc(P,N)] returns a non-NULL pointer, it first
         1536  +**           copies the first K bytes of content from P into the newly allocated
         1537  +**           where K is the lessor of N and the size of the buffer P.
         1538  +**
         1539  +** {F17322}  When [sqlite3_realloc(P,N)] returns a non-NULL pointer, it first
         1540  +**           releases the buffer P.
         1541  +**
         1542  +** {F17323}  When [sqlite3_realloc(P,N)] returns NULL, the buffer P is
         1543  +**           not modified or released.
         1544  +**
         1545  +** LIMITATIONS:
         1546  +**
         1547  +** {U17350}  The pointer arguments to [sqlite3_free()] and [sqlite3_realloc()]
         1548  +**           must be either NULL or else a pointer obtained from a prior
         1549  +**           invocation of [sqlite3_malloc()] or [sqlite3_realloc()] that has
         1550  +**           not been released.
         1551  +**
         1552  +** {U17351}  The application must not read or write any part of 
         1553  +**           a block of memory after it has been released using
         1554  +**           [sqlite3_free()] or [sqlite3_realloc()].
         1555  +**
  1159   1556   */
  1160   1557   void *sqlite3_malloc(int);
  1161   1558   void *sqlite3_realloc(void*, int);
  1162   1559   void sqlite3_free(void*);
  1163   1560   
  1164   1561   /*
  1165         -** CAPI3REF: Memory Allocator Statistics
  1166         -**
  1167         -** In addition to the basic three allocation routines 
  1168         -** [sqlite3_malloc()], [sqlite3_free()], and [sqlite3_realloc()],
  1169         -** the memory allocation subsystem included with the SQLite
  1170         -** sources provides the interfaces shown below.
  1171         -**
  1172         -** The first of these two routines returns the amount of memory 
  1173         -** currently outstanding (malloced but not freed).  The second
  1174         -** returns the largest instantaneous amount of outstanding
  1175         -** memory.  The highwater mark is reset if the argument is
  1176         -** true.
  1177         -**
  1178         -** The value returned may or may not include allocation
  1179         -** overhead, depending on which built-in memory allocator
  1180         -** implementation is used.
         1562  +** CAPI3REF: Memory Allocator Statistics {F17370}
         1563  +**
         1564  +** SQLite provides these two interfaces for reporting on the status
         1565  +** of the [sqlite3_malloc()], [sqlite3_free()], and [sqlite3_realloc()]
         1566  +** the memory allocation subsystem included within the SQLite.
         1567  +**
         1568  +** INVARIANTS:
         1569  +**
         1570  +** {F17371} The [sqlite3_memory_used()] routine returns the
         1571  +**          number of bytes of memory currently outstanding 
         1572  +**          (malloced but not freed).
         1573  +**
         1574  +** {F17373} The [sqlite3_memory_highwater()] routine returns the maximum
         1575  +**          value of [sqlite3_memory_used()] 
         1576  +**          since the highwater mark was last reset.
         1577  +**
         1578  +** {F17374} The values returned by [sqlite3_memory_used()] and
         1579  +**          [sqlite3_memory_highwater()] include any overhead
         1580  +**          added by SQLite in its implementation of [sqlite3_malloc()],
         1581  +**          but not overhead added by the any underlying system library
         1582  +**          routines that [sqlite3_malloc()] may call.
         1583  +** 
         1584  +** {F17375} The memory highwater mark is reset to the current value of
         1585  +**          [sqlite3_memory_used()] if and only if the parameter to
         1586  +**          [sqlite3_memory_highwater()] is true.  The value returned
         1587  +**          by [sqlite3_memory_highwater(1)] is the highwater mark
         1588  +**          prior to the reset.
  1181   1589   */
  1182   1590   sqlite3_int64 sqlite3_memory_used(void);
  1183   1591   sqlite3_int64 sqlite3_memory_highwater(int resetFlag);
  1184   1592   
  1185   1593   /*
  1186         -** CAPI3REF: Compile-Time Authorization Callbacks
  1187         -***
  1188         -** This routine registers a authorizer callback with the SQLite library.  
         1594  +** CAPI3REF: Pseudo-Random Number Generator {F17390}
         1595  +**
         1596  +** SQLite contains a high-quality pseudo-random number generator (PRNG) used to
         1597  +** select random ROWIDs when inserting new records into a table that
         1598  +** already uses the largest possible ROWID.  The PRNG is also used for
         1599  +** the build-in random() and randomblob() SQL functions.  This interface allows
         1600  +** appliations to access the same PRNG for other purposes.
         1601  +**
         1602  +** A call to this routine stores N bytes of randomness into buffer P.
         1603  +**
         1604  +** The first time this routine is invoked (either internally or by
         1605  +** the application) the PRNG is seeded using randomness obtained
         1606  +** from the xRandomness method of the default [sqlite3_vfs] object.
         1607  +** On all subsequent invocations, the pseudo-randomness is generated
         1608  +** internally and without recourse to the [sqlite3_vfs] xRandomness
         1609  +** method.
         1610  +**
         1611  +** INVARIANTS:
         1612  +**
         1613  +** {F17392} The [sqlite3_randomness(N,P)] interface writes N bytes of
         1614  +**          high-quality pseudo-randomness into buffer P.
         1615  +*/
         1616  +void sqlite3_randomness(int N, void *P);
         1617  +
         1618  +/*
         1619  +** CAPI3REF: Compile-Time Authorization Callbacks {F12500}
         1620  +**
         1621  +** This routine registers a authorizer callback with a particular
         1622  +** [database connection], supplied in the first argument.
  1189   1623   ** The authorizer callback is invoked as SQL statements are being compiled
  1190   1624   ** by [sqlite3_prepare()] or its variants [sqlite3_prepare_v2()],
  1191   1625   ** [sqlite3_prepare16()] and [sqlite3_prepare16_v2()].  At various
  1192   1626   ** points during the compilation process, as logic is being created
  1193   1627   ** to perform various actions, the authorizer callback is invoked to
  1194   1628   ** see if those actions are allowed.  The authorizer callback should
  1195         -** return SQLITE_OK to allow the action, [SQLITE_IGNORE] to disallow the
         1629  +** return [SQLITE_OK] to allow the action, [SQLITE_IGNORE] to disallow the
  1196   1630   ** specific action but allow the SQL statement to continue to be
  1197   1631   ** compiled, or [SQLITE_DENY] to cause the entire SQL statement to be
  1198         -** rejected with an error.  
         1632  +** rejected with an error.   If the authorizer callback returns
         1633  +** any value other than [SQLITE_IGNORE], [SQLITE_OK], or [SQLITE_DENY]
         1634  +** then [sqlite3_prepare_v2()] or equivalent call that triggered
         1635  +** the authorizer will fail with an error message.
  1199   1636   **
  1200         -** Depending on the action, the [SQLITE_IGNORE] and [SQLITE_DENY] return
  1201         -** codes might mean something different or they might mean the same
  1202         -** thing.  If the action is, for example, to perform a delete opertion,
  1203         -** then [SQLITE_IGNORE] and [SQLITE_DENY] both cause the statement compilation
  1204         -** to fail with an error.  But if the action is to read a specific column
  1205         -** from a specific table, then [SQLITE_DENY] will cause the entire
  1206         -** statement to fail but [SQLITE_IGNORE] will cause a NULL value to be
  1207         -** read instead of the actual column value.
         1637  +** When the callback returns [SQLITE_OK], that means the operation
         1638  +** requested is ok.  When the callback returns [SQLITE_DENY], the
         1639  +** [sqlite3_prepare_v2()] or equivalent call that triggered the
         1640  +** authorizer will fail with an error message explaining that
         1641  +** access is denied.  If the authorizer code is [SQLITE_READ]
         1642  +** and the callback returns [SQLITE_IGNORE] then the
         1643  +** [prepared statement] statement is constructed to substitute
         1644  +** a NULL value in place of the table column that would have
         1645  +** been read if [SQLITE_OK] had been returned.  The [SQLITE_IGNORE]
         1646  +** return can be used to deny an untrusted user access to individual
         1647  +** columns of a table.
  1208   1648   **
  1209   1649   ** The first parameter to the authorizer callback is a copy of
  1210   1650   ** the third parameter to the sqlite3_set_authorizer() interface.
  1211   1651   ** The second parameter to the callback is an integer 
  1212   1652   ** [SQLITE_COPY | action code] that specifies the particular action
  1213         -** to be authorized.  The available action codes are
  1214         -** [SQLITE_COPY | documented separately].  The third through sixth
  1215         -** parameters to the callback are strings that contain additional
  1216         -** details about the action to be authorized.
         1653  +** to be authorized. The third through sixth
         1654  +** parameters to the callback are zero-terminated strings that contain 
         1655  +** additional details about the action to be authorized.
  1217   1656   **
  1218         -** An authorizer is used when preparing SQL statements from an untrusted
         1657  +** An authorizer is used when [sqlite3_prepare | preparing]
         1658  +** SQL statements from an untrusted
  1219   1659   ** source, to ensure that the SQL statements do not try to access data
  1220   1660   ** that they are not allowed to see, or that they do not try to
  1221   1661   ** execute malicious statements that damage the database.  For
  1222   1662   ** example, an application may allow a user to enter arbitrary
  1223   1663   ** SQL queries for evaluation by a database.  But the application does
  1224   1664   ** not want the user to be able to make arbitrary changes to the
  1225   1665   ** database.  An authorizer could then be put in place while the
  1226         -** user-entered SQL is being prepared that disallows everything
  1227         -** except SELECT statements.  
         1666  +** user-entered SQL is being [sqlite3_prepare | prepared] that
         1667  +** disallows everything except [SELECT] statements.
         1668  +**
         1669  +** Applications that need to process SQL from untrusted sources
         1670  +** might also consider lowering resource limits using [sqlite3_limit()]
         1671  +** and limiting database size using the [max_page_count] [PRAGMA]
         1672  +** in addition to using an authorizer.
  1228   1673   **
  1229   1674   ** Only a single authorizer can be in place on a database connection
  1230   1675   ** at a time.  Each call to sqlite3_set_authorizer overrides the
  1231         -** previous call.  A NULL authorizer means that no authorization
  1232         -** callback is invoked.  The default authorizer is NULL.
         1676  +** previous call.  Disable the authorizer by installing a NULL callback.
         1677  +** The authorizer is disabled by default.
  1233   1678   **
  1234   1679   ** Note that the authorizer callback is invoked only during 
  1235   1680   ** [sqlite3_prepare()] or its variants.  Authorization is not
  1236   1681   ** performed during statement evaluation in [sqlite3_step()].
         1682  +**
         1683  +** INVARIANTS:
         1684  +**
         1685  +** {F12501} The [sqlite3_set_authorizer(D,...)] interface registers a
         1686  +**          authorizer callback with database connection D.
         1687  +**
         1688  +** {F12502} The authorizer callback is invoked as SQL statements are
         1689  +**          being compiled
         1690  +**
         1691  +** {F12503} If the authorizer callback returns any value other than
         1692  +**          [SQLITE_IGNORE], [SQLITE_OK], or [SQLITE_DENY] then
         1693  +**          the [sqlite3_prepare_v2()] or equivalent call that caused
         1694  +**          the authorizer callback to run shall fail with an
         1695  +**          [SQLITE_ERROR] error code and an appropriate error message.
         1696  +**
         1697  +** {F12504} When the authorizer callback returns [SQLITE_OK], the operation
         1698  +**          described is coded normally.
         1699  +**
         1700  +** {F12505} When the authorizer callback returns [SQLITE_DENY], the
         1701  +**          [sqlite3_prepare_v2()] or equivalent call that caused the
         1702  +**          authorizer callback to run shall fail
         1703  +**          with an [SQLITE_ERROR] error code and an error message
         1704  +**          explaining that access is denied.
         1705  +**
         1706  +** {F12506} If the authorizer code (the 2nd parameter to the authorizer
         1707  +**          callback) is [SQLITE_READ] and the authorizer callback returns
         1708  +**          [SQLITE_IGNORE] then the prepared statement is constructed to
         1709  +**          insert a NULL value in place of the table column that would have
         1710  +**          been read if [SQLITE_OK] had been returned.
         1711  +**
         1712  +** {F12507} If the authorizer code (the 2nd parameter to the authorizer
         1713  +**          callback) is anything other than [SQLITE_READ], then
         1714  +**          a return of [SQLITE_IGNORE] has the same effect as [SQLITE_DENY]. 
         1715  +**
         1716  +** {F12510} The first parameter to the authorizer callback is a copy of
         1717  +**          the third parameter to the [sqlite3_set_authorizer()] interface.
         1718  +**
         1719  +** {F12511} The second parameter to the callback is an integer 
         1720  +**          [SQLITE_COPY | action code] that specifies the particular action
         1721  +**          to be authorized.
         1722  +**
         1723  +** {F12512} The third through sixth parameters to the callback are
         1724  +**          zero-terminated strings that contain 
         1725  +**          additional details about the action to be authorized.
         1726  +**
         1727  +** {F12520} Each call to [sqlite3_set_authorizer()] overrides the
         1728  +**          any previously installed authorizer.
         1729  +**
         1730  +** {F12521} A NULL authorizer means that no authorization
         1731  +**          callback is invoked.
         1732  +**
         1733  +** {F12522} The default authorizer is NULL.
  1237   1734   */
  1238   1735   int sqlite3_set_authorizer(
  1239   1736     sqlite3*,
  1240   1737     int (*xAuth)(void*,int,const char*,const char*,const char*,const char*),
  1241   1738     void *pUserData
  1242   1739   );
  1243   1740   
  1244   1741   /*
  1245         -** CAPI3REF: Authorizer Return Codes
         1742  +** CAPI3REF: Authorizer Return Codes {F12590}
  1246   1743   **
  1247   1744   ** The [sqlite3_set_authorizer | authorizer callback function] must
  1248   1745   ** return either [SQLITE_OK] or one of these two constants in order
  1249   1746   ** to signal SQLite whether or not the action is permitted.  See the
  1250   1747   ** [sqlite3_set_authorizer | authorizer documentation] for additional
  1251   1748   ** information.
  1252   1749   */
  1253   1750   #define SQLITE_DENY   1   /* Abort the SQL statement with an error */
  1254   1751   #define SQLITE_IGNORE 2   /* Don't allow access, but don't generate an error */
  1255   1752   
  1256   1753   /*
  1257         -** CAPI3REF: Authorizer Action Codes
         1754  +** CAPI3REF: Authorizer Action Codes {F12550}
  1258   1755   **
  1259   1756   ** The [sqlite3_set_authorizer()] interface registers a callback function
  1260   1757   ** that is invoked to authorizer certain SQL statement actions.  The
  1261   1758   ** second parameter to the callback is an integer code that specifies
  1262   1759   ** what action is being authorized.  These are the integer action codes that
  1263   1760   ** the authorizer callback may be passed.
  1264   1761   **
  1265   1762   ** These action code values signify what kind of operation is to be 
  1266         -** authorized.  The 3rd and 4th parameters to the authorization callback
  1267         -** function will be parameters or NULL depending on which of these
         1763  +** authorized.  The 3rd and 4th parameters to the authorization
         1764  +** callback function will be parameters or NULL depending on which of these
  1268   1765   ** codes is used as the second parameter.  The 5th parameter to the
  1269   1766   ** authorizer callback is the name of the database ("main", "temp", 
  1270   1767   ** etc.) if applicable.  The 6th parameter to the authorizer callback
  1271   1768   ** is the name of the inner-most trigger or view that is responsible for
  1272   1769   ** the access attempt or NULL if this access attempt is directly from 
  1273   1770   ** top-level SQL code.
         1771  +**
         1772  +** INVARIANTS:
         1773  +**
         1774  +** {F12551} The second parameter to an 
         1775  +**          [sqlite3_set_authorizer | authorizer callback is always an integer
         1776  +**          [SQLITE_COPY | authorizer code] that specifies what action
         1777  +**          is being authorized.
         1778  +**
         1779  +** {F12552} The 3rd and 4th parameters to the 
         1780  +**          [sqlite3_set_authorizer | authorization callback function]
         1781  +**          will be parameters or NULL depending on which 
         1782  +**          [SQLITE_COPY | authorizer code] is used as the second parameter.
         1783  +**
         1784  +** {F12553} The 5th parameter to the
         1785  +**          [sqlite3_set_authorizer | authorizer callback] is the name
         1786  +**          of the database (example: "main", "temp", etc.) if applicable.
         1787  +**
         1788  +** {F12554} The 6th parameter to the
         1789  +**          [sqlite3_set_authorizer | authorizer callback] is the name
         1790  +**          of the inner-most trigger or view that is responsible for
         1791  +**          the access attempt or NULL if this access attempt is directly from 
         1792  +**          top-level SQL code.
  1274   1793   */
  1275   1794   /******************************************* 3rd ************ 4th ***********/
  1276   1795   #define SQLITE_CREATE_INDEX          1   /* Index Name      Table Name      */
  1277   1796   #define SQLITE_CREATE_TABLE          2   /* Table Name      NULL            */
  1278   1797   #define SQLITE_CREATE_TEMP_INDEX     3   /* Index Name      Table Name      */
  1279   1798   #define SQLITE_CREATE_TEMP_TABLE     4   /* Table Name      NULL            */
  1280   1799   #define SQLITE_CREATE_TEMP_TRIGGER   5   /* Trigger Name    Table Name      */
................................................................................
  1303   1822   #define SQLITE_ANALYZE              28   /* Table Name      NULL            */
  1304   1823   #define SQLITE_CREATE_VTABLE        29   /* Table Name      Module Name     */
  1305   1824   #define SQLITE_DROP_VTABLE          30   /* Table Name      Module Name     */
  1306   1825   #define SQLITE_FUNCTION             31   /* Function Name   NULL            */
  1307   1826   #define SQLITE_COPY                  0   /* No longer used */
  1308   1827   
  1309   1828   /*
  1310         -** CAPI3REF: Tracing And Profiling Functions
         1829  +** CAPI3REF: Tracing And Profiling Functions {F12280}
  1311   1830   **
  1312   1831   ** These routines register callback functions that can be used for
  1313   1832   ** tracing and profiling the execution of SQL statements.
  1314         -** The callback function registered by sqlite3_trace() is invoked
  1315         -** at the first [sqlite3_step()] for the evaluation of an SQL statement.
         1833  +**
         1834  +** The callback function registered by sqlite3_trace() is invoked at
         1835  +** various times when an SQL statement is being run by [sqlite3_step()].
         1836  +** The callback returns a UTF-8 rendering of the SQL statement text
         1837  +** as the statement first begins executing.  Additional callbacks occur
         1838  +** as each triggersubprogram is entered.  The callbacks for triggers
         1839  +** contain a UTF-8 SQL comment that identifies the trigger.
         1840  +** 
  1316   1841   ** The callback function registered by sqlite3_profile() is invoked
  1317         -** as each SQL statement finishes and includes
  1318         -** information on how long that statement ran.
         1842  +** as each SQL statement finishes.  The profile callback contains
         1843  +** the original statement text and an estimate of wall-clock time
         1844  +** of how long that statement took to run.
  1319   1845   **
  1320   1846   ** The sqlite3_profile() API is currently considered experimental and
  1321         -** is subject to change.
         1847  +** is subject to change or removal in a future release.
         1848  +**
         1849  +** The trigger reporting feature of the trace callback is considered
         1850  +** experimental and is subject to change or removal in future releases.
         1851  +** Future versions of SQLite might also add new trace callback 
         1852  +** invocations.
         1853  +**
         1854  +** INVARIANTS:
         1855  +**
         1856  +** {F12281} The callback function registered by [sqlite3_trace()] is
         1857  +**          whenever an SQL statement first begins to execute and
         1858  +**          whenever a trigger subprogram first begins to run.
         1859  +**
         1860  +** {F12282} Each call to [sqlite3_trace()] overrides the previously
         1861  +**          registered trace callback.
         1862  +**
         1863  +** {F12283} A NULL trace callback disables tracing.
         1864  +**
         1865  +** {F12284} The first argument to the trace callback is a copy of
         1866  +**          the pointer which was the 3rd argument to [sqlite3_trace()].
         1867  +**
         1868  +** {F12285} The second argument to the trace callback is a
         1869  +**          zero-terminated UTF8 string containing the original text
         1870  +**          of the SQL statement as it was passed into [sqlite3_prepare_v2()]
         1871  +**          or the equivalent, or an SQL comment indicating the beginning
         1872  +**          of a trigger subprogram.
         1873  +**
         1874  +** {F12287} The callback function registered by [sqlite3_profile()] is invoked
         1875  +**          as each SQL statement finishes.
         1876  +**
         1877  +** {F12288} The first parameter to the profile callback is a copy of
         1878  +**          the 3rd parameter to [sqlite3_profile()].
         1879  +**
         1880  +** {F12289} The second parameter to the profile callback is a
         1881  +**          zero-terminated UTF-8 string that contains the complete text of
         1882  +**          the SQL statement as it was processed by [sqlite3_prepare_v2()]
         1883  +**          or the equivalent.
         1884  +**
         1885  +** {F12290} The third parameter to the profile  callback is an estimate
         1886  +**          of the number of nanoseconds of wall-clock time required to
         1887  +**          run the SQL statement from start to finish.
  1322   1888   */
  1323   1889   void *sqlite3_trace(sqlite3*, void(*xTrace)(void*,const char*), void*);
  1324   1890   void *sqlite3_profile(sqlite3*,
  1325   1891      void(*xProfile)(void*,const char*,sqlite3_uint64), void*);
  1326   1892   
  1327   1893   /*
  1328         -** CAPI3REF: Query Progress Callbacks
         1894  +** CAPI3REF: Query Progress Callbacks {F12910}
  1329   1895   **
  1330         -** This routine configures a callback function - the progress callback - that
  1331         -** is invoked periodically during long running calls to [sqlite3_exec()],
  1332         -** [sqlite3_step()] and [sqlite3_get_table()].  An example use for this 
         1896  +** This routine configures a callback function - the
         1897  +** progress callback - that is invoked periodically during long
         1898  +** running calls to [sqlite3_exec()], [sqlite3_step()] and
         1899  +** [sqlite3_get_table()].   An example use for this 
  1333   1900   ** interface is to keep a GUI updated during a large query.
  1334   1901   **
  1335         -** The progress callback is invoked once for every N virtual machine opcodes,
  1336         -** where N is the second argument to this function. The progress callback
  1337         -** itself is identified by the third argument to this function. The fourth
  1338         -** argument to this function is a void pointer passed to the progress callback
  1339         -** function each time it is invoked.
         1902  +** If the progress callback returns non-zero, the opertion is
         1903  +** interrupted.  This feature can be used to implement a
         1904  +** "Cancel" button on a GUI dialog box.
  1340   1905   **
  1341         -** If a call to [sqlite3_exec()], [sqlite3_step()], or [sqlite3_get_table()]
  1342         -** results in fewer than N opcodes being executed, then the progress 
  1343         -** callback is never invoked.
         1906  +** INVARIANTS:
         1907  +**
         1908  +** {F12911} The callback function registered by [sqlite3_progress_handler()]
         1909  +**          is invoked periodically during long running calls to
         1910  +**          [sqlite3_step()].
         1911  +**
         1912  +** {F12912} The progress callback is invoked once for every N virtual
         1913  +**          machine opcodes, where N is the second argument to 
         1914  +**          the [sqlite3_progress_handler()] call that registered
         1915  +**          the callback.  <todo>What if N is less than 1?</todo>
         1916  +**
         1917  +** {F12913} The progress callback itself is identified by the third
         1918  +**          argument to [sqlite3_progress_handler()].
         1919  +**
         1920  +** {F12914} The fourth argument [sqlite3_progress_handler()] is a
         1921  +***         void pointer passed to the progress callback
         1922  +**          function each time it is invoked.
         1923  +**
         1924  +** {F12915} If a call to [sqlite3_step()] results in fewer than
         1925  +**          N opcodes being executed,
         1926  +**          then the progress callback is never invoked. {END}
  1344   1927   ** 
  1345         -** Only a single progress callback function may be registered for each
  1346         -** open database connection.  Every call to sqlite3_progress_handler()
  1347         -** overwrites the results of the previous call.
  1348         -** To remove the progress callback altogether, pass NULL as the third
  1349         -** argument to this function.
         1928  +** {F12916} Every call to [sqlite3_progress_handler()]
         1929  +**          overwrites any previously registere progress handler.
  1350   1930   **
  1351         -** If the progress callback returns a result other than 0, then the current 
  1352         -** query is immediately terminated and any database changes rolled back.
  1353         -** The containing [sqlite3_exec()], [sqlite3_step()], or
  1354         -** [sqlite3_get_table()] call returns SQLITE_INTERRUPT.   This feature
  1355         -** can be used, for example, to implement the "Cancel" button on a
  1356         -** progress dialog box in a GUI.
         1931  +** {F12917} If the progress handler callback is NULL then no progress
         1932  +**          handler is invoked.
         1933  +**
         1934  +** {F12918} If the progress callback returns a result other than 0, then
         1935  +**          the behavior is a if [sqlite3_interrupt()] had been called.
  1357   1936   */
  1358   1937   void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
  1359   1938   
  1360   1939   /*
  1361         -** CAPI3REF: Opening A New Database Connection
         1940  +** CAPI3REF: Opening A New Database Connection {F12700}
  1362   1941   **
  1363         -** Open the sqlite database file "filename".  The "filename" is UTF-8
  1364         -** encoded for [sqlite3_open()] and [sqlite3_open_v2()] and UTF-16 encoded
         1942  +** These routines open an SQLite database file whose name
         1943  +** is given by the filename argument.
         1944  +** The filename argument is interpreted as UTF-8
         1945  +** for [sqlite3_open()] and [sqlite3_open_v2()] and as UTF-16
  1365   1946   ** in the native byte order for [sqlite3_open16()].
  1366         -** An [sqlite3*] handle is returned in *ppDb, even
  1367         -** if an error occurs. If the database is opened (or created) successfully,
  1368         -** then [SQLITE_OK] is returned. Otherwise an error code is returned. The
         1947  +** An [sqlite3*] handle is usually returned in *ppDb, even
         1948  +** if an error occurs.  The only exception is if SQLite is unable
         1949  +** to allocate memory to hold the [sqlite3] object, a NULL will
         1950  +** be written into *ppDb instead of a pointer to the [sqlite3] object.
         1951  +** If the database is opened (and/or created)
         1952  +** successfully, then [SQLITE_OK] is returned.  Otherwise an
         1953  +** error code is returned.  The
  1369   1954   ** [sqlite3_errmsg()] or [sqlite3_errmsg16()]  routines can be used to obtain
  1370   1955   ** an English language description of the error.
  1371   1956   **
  1372   1957   ** The default encoding for the database will be UTF-8 if
  1373   1958   ** [sqlite3_open()] or [sqlite3_open_v2()] is called and
  1374         -** UTF-16 if [sqlite3_open16()] is used.
         1959  +** UTF-16 in the native byte order if [sqlite3_open16()] is used.
  1375   1960   **
  1376         -** Whether or not an error occurs when it is opened, resources associated
  1377         -** with the [sqlite3*] handle should be released by passing it to
  1378         -** [sqlite3_close()] when it is no longer required.
         1961  +** Whether or not an error occurs when it is opened, resources
         1962  +** associated with the [sqlite3*] handle should be released by passing it
         1963  +** to [sqlite3_close()] when it is no longer required.
  1379   1964   **
  1380         -** The [sqlite3_open_v2()] interface works like [sqlite3_open()] except that
  1381         -** provides two additional parameters for additional control over the
  1382         -** new database connection.  The flags parameter can be one of:
         1965  +** The [sqlite3_open_v2()] interface works like [sqlite3_open()] 
         1966  +** except that it acccepts two additional parameters for additional control
         1967  +** over the new database connection.  The flags parameter can be
         1968  +** one of:
  1383   1969   **
  1384   1970   ** <ol>
  1385   1971   ** <li>  [SQLITE_OPEN_READONLY]
  1386   1972   ** <li>  [SQLITE_OPEN_READWRITE]
  1387   1973   ** <li>  [SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE]
  1388   1974   ** </ol>
  1389   1975   **
  1390         -** The first value opens the database read-only.  If the database does
  1391         -** not previously exist, an error is returned.  The second option opens
         1976  +** The first value opens the database read-only. 
         1977  +** If the database does not previously exist, an error is returned.
         1978  +** The second option opens
  1392   1979   ** the database for reading and writing if possible, or reading only if
  1393         -** if the file is write protected.  In either case the database must already
  1394         -** exist or an error is returned.  The third option opens the database
  1395         -** for reading and writing and creates it if it does not already exist.
         1980  +** if the file is write protected.  In either case the database
         1981  +** must already exist or an error is returned.  The third option
         1982  +** opens the database for reading and writing and creates it if it does
         1983  +** not already exist.
  1396   1984   ** The third options is behavior that is always used for [sqlite3_open()]
  1397   1985   ** and [sqlite3_open16()].
         1986  +**
         1987  +** If the 3rd parameter to [sqlite3_open_v2()] is not one of the
         1988  +** combinations shown above then the behavior is undefined.
  1398   1989   **
  1399   1990   ** If the filename is ":memory:", then an private
  1400   1991   ** in-memory database is created for the connection.  This in-memory
  1401   1992   ** database will vanish when the database connection is closed.  Future
  1402   1993   ** version of SQLite might make use of additional special filenames
  1403   1994   ** that begin with the ":" character.  It is recommended that 
  1404   1995   ** when a database filename really does begin with
................................................................................
  1416   2007   ** object is used.
  1417   2008   **
  1418   2009   ** <b>Note to windows users:</b>  The encoding used for the filename argument
  1419   2010   ** of [sqlite3_open()] and [sqlite3_open_v2()] must be UTF-8, not whatever
  1420   2011   ** codepage is currently defined.  Filenames containing international
  1421   2012   ** characters must be converted to UTF-8 prior to passing them into
  1422   2013   ** [sqlite3_open()] or [sqlite3_open_v2()].
         2014  +**
         2015  +** INVARIANTS:
         2016  +**
         2017  +** {F12701} The [sqlite3_open()], [sqlite3_open16()], and
         2018  +**          [sqlite3_open_v2()] interfaces create a new
         2019  +**          [database connection] associated with
         2020  +**          the database file given in their first parameter.
         2021  +**
         2022  +** {F12702} The filename argument is interpreted as UTF-8
         2023  +**          for [sqlite3_open()] and [sqlite3_open_v2()] and as UTF-16
         2024  +**          in the native byte order for [sqlite3_open16()].
         2025  +**
         2026  +** {F12703} A successful invocation of [sqlite3_open()], [sqlite3_open16()], 
         2027  +**          or [sqlite3_open_v2()] writes a pointer to a new
         2028  +**          [database connection] into *ppDb.
         2029  +**
         2030  +** {F12704} The [sqlite3_open()], [sqlite3_open16()], and
         2031  +**          [sqlite3_open_v2()] interfaces return [SQLITE_OK] upon success,
         2032  +**          or an appropriate [error code] on failure.
         2033  +**
         2034  +** {F12706} The default text encoding for a new database created using
         2035  +**          [sqlite3_open()] or [sqlite3_open_v2()] will be UTF-8.
         2036  +**
         2037  +** {F12707} The default text encoding for a new database created using
         2038  +**          [sqlite3_open16()] will be UTF-16.
         2039  +**
         2040  +** {F12709} The [sqlite3_open(F,D)] interface is equivalent to
         2041  +**          [sqlite3_open_v2(F,D,G,0)] where the G parameter is
         2042  +**          [SQLITE_OPEN_READWRITE]|[SQLITE_OPEN_CREATE].
         2043  +**
         2044  +** {F12711} If the G parameter to [sqlite3_open_v2(F,D,G,V)] contains the
         2045  +**          bit value [SQLITE_OPEN_READONLY] then the database is opened
         2046  +**          for reading only.
         2047  +**
         2048  +** {F12712} If the G parameter to [sqlite3_open_v2(F,D,G,V)] contains the
         2049  +**          bit value [SQLITE_OPEN_READWRITE] then the database is opened
         2050  +**          reading and writing if possible, or for reading only if the
         2051  +**          file is write protected by the operating system.
         2052  +**
         2053  +** {F12713} If the G parameter to [sqlite3_open(v2(F,D,G,V)] omits the
         2054  +**          bit value [SQLITE_OPEN_CREATE] and the database does not
         2055  +**          previously exist, an error is returned.
         2056  +**
         2057  +** {F12714} If the G parameter to [sqlite3_open(v2(F,D,G,V)] contains the
         2058  +**          bit value [SQLITE_OPEN_CREATE] and the database does not
         2059  +**          previously exist, then an attempt is made to create and
         2060  +**          initialize the database.
         2061  +**
         2062  +** {F12717} If the filename argument to [sqlite3_open()], [sqlite3_open16()],
         2063  +**          or [sqlite3_open_v2()] is ":memory:", then an private,
         2064  +**          ephemeral, in-memory database is created for the connection.
         2065  +**          <todo>Is SQLITE_OPEN_CREATE|SQLITE_OPEN_READWRITE required
         2066  +**          in sqlite3_open_v2()?</todo>
         2067  +**
         2068  +** {F12719} If the filename is NULL or an empty string, then a private,
         2069  +**          ephermeral on-disk database will be created.
         2070  +**          <todo>Is SQLITE_OPEN_CREATE|SQLITE_OPEN_READWRITE required
         2071  +**          in sqlite3_open_v2()?</todo>
         2072  +**
         2073  +** {F12721} The [database connection] created by 
         2074  +**          [sqlite3_open_v2(F,D,G,V)] will use the
         2075  +**          [sqlite3_vfs] object identified by the V parameter, or
         2076  +**          the default [sqlite3_vfs] object is V is a NULL pointer.
  1423   2077   */
  1424   2078   int sqlite3_open(
  1425   2079     const char *filename,   /* Database filename (UTF-8) */
  1426   2080     sqlite3 **ppDb          /* OUT: SQLite db handle */
  1427   2081   );
  1428   2082   int sqlite3_open16(
  1429   2083     const void *filename,   /* Database filename (UTF-16) */
................................................................................
  1433   2087     const char *filename,   /* Database filename (UTF-8) */
  1434   2088     sqlite3 **ppDb,         /* OUT: SQLite db handle */
  1435   2089     int flags,              /* Flags */
  1436   2090     const char *zVfs        /* Name of VFS module to use */
  1437   2091   );
  1438   2092   
  1439   2093   /*
  1440         -** CAPI3REF: Error Codes And Messages
         2094  +** CAPI3REF: Error Codes And Messages {F12800}
  1441   2095   **
  1442   2096   ** The sqlite3_errcode() interface returns the numeric
  1443   2097   ** [SQLITE_OK | result code] or [SQLITE_IOERR_READ | extended result code]
  1444   2098   ** for the most recent failed sqlite3_* API call associated
  1445         -** with [sqlite3] handle 'db'.  If a prior API call failed but the
         2099  +** with [sqlite3] handle 'db'. If a prior API call failed but the
  1446   2100   ** most recent API call succeeded, the return value from sqlite3_errcode()
  1447         -** is undefined. 
         2101  +** is undefined.
  1448   2102   **
  1449   2103   ** The sqlite3_errmsg() and sqlite3_errmsg16() return English-language
  1450   2104   ** text that describes the error, as either UTF8 or UTF16 respectively.
  1451         -** Memory to hold the error message string is managed internally.  The 
  1452         -** string may be overwritten or deallocated by subsequent calls to SQLite
  1453         -** interface functions.
  1454         -**
  1455         -** Calls to many sqlite3_* functions set the error code and string returned
  1456         -** by [sqlite3_errcode()], [sqlite3_errmsg()], and [sqlite3_errmsg16()]
  1457         -** (overwriting the previous values). Note that calls to [sqlite3_errcode()],
  1458         -** [sqlite3_errmsg()], and [sqlite3_errmsg16()] themselves do not affect the
  1459         -** results of future invocations.  Calls to API routines that do not return
  1460         -** an error code (example: [sqlite3_data_count()]) do not
  1461         -** change the error code returned by this routine.  Interfaces that are
  1462         -** not associated with a specific database connection (examples:
  1463         -** [sqlite3_mprintf()] or [sqlite3_enable_shared_cache()] do not change
  1464         -** the return code.  
  1465         -**
  1466         -** Assuming no other intervening sqlite3_* API calls are made, the error
  1467         -** code returned by this function is associated with the same error as
  1468         -** the strings returned by [sqlite3_errmsg()] and [sqlite3_errmsg16()].
         2105  +** Memory to hold the error message string is managed internally.
         2106  +** The application does not need to worry with freeing the result.
         2107  +** However, the error string might be overwritten or deallocated by
         2108  +** subsequent calls to other SQLite interface functions.
         2109  +**
         2110  +** INVARIANTS:
         2111  +**
         2112  +** {F12801} The [sqlite3_errcode(D)] interface returns the numeric
         2113  +**          [SQLITE_OK | result code] or
         2114  +**          [SQLITE_IOERR_READ | extended result code]
         2115  +**          for the most recently failed interface call associated
         2116  +**          with [database connection] D.
         2117  +**
         2118  +** {F12803} The [sqlite3_errmsg(D)] and [sqlite3_errmsg16(D)]
         2119  +**          interfaces return English-language text that describes
         2120  +**          the error in the mostly recently failed interface call,
         2121  +**          encoded as either UTF8 or UTF16 respectively.
         2122  +**
         2123  +** {F12807} The strings returned by [sqlite3_errmsg()] and [sqlite3_errmsg16()]
         2124  +**          are valid until the next SQLite interface call.
         2125  +**
         2126  +** {F12808} Calls to API routines that do not return an error code
         2127  +**          (example: [sqlite3_data_count()]) do not
         2128  +**          change the error code or message returned by
         2129  +**          [sqlite3_errcode()], [sqlite3_errmsg()], or [sqlite3_errmsg16()].
         2130  +**
         2131  +** {F12809} Interfaces that are not associated with a specific
         2132  +**          [database connection] (examples:
         2133  +**          [sqlite3_mprintf()] or [sqlite3_enable_shared_cache()]
         2134  +**          do not change the values returned by
         2135  +**          [sqlite3_errcode()], [sqlite3_errmsg()], or [sqlite3_errmsg16()].
  1469   2136   */
  1470   2137   int sqlite3_errcode(sqlite3 *db);
  1471   2138   const char *sqlite3_errmsg(sqlite3*);
  1472   2139   const void *sqlite3_errmsg16(sqlite3*);
  1473   2140   
  1474   2141   /*
  1475         -** CAPI3REF: SQL Statement Object
         2142  +** CAPI3REF: SQL Statement Object {F13000}
         2143  +** KEYWORDS: {prepared statement} {prepared statements}
  1476   2144   **
  1477         -** Instance of this object represent single SQL statements.  This
  1478         -** is variously known as a "prepared statement" or a 
         2145  +** An instance of this object represent single SQL statements.  This
         2146  +** object is variously known as a "prepared statement" or a 
  1479   2147   ** "compiled SQL statement" or simply as a "statement".
  1480   2148   ** 
  1481   2149   ** The life of a statement object goes something like this:
  1482   2150   **
  1483   2151   ** <ol>
  1484   2152   ** <li> Create the object using [sqlite3_prepare_v2()] or a related
  1485   2153   **      function.
................................................................................
  1493   2161   **
  1494   2162   ** Refer to documentation on individual methods above for additional
  1495   2163   ** information.
  1496   2164   */
  1497   2165   typedef struct sqlite3_stmt sqlite3_stmt;
  1498   2166   
  1499   2167   /*
  1500         -** CAPI3REF: Compiling An SQL Statement
         2168  +** CAPI3REF: Run-time Limits {F12760}
         2169  +**
         2170  +** This interface allows the size of various constructs to be limited
         2171  +** on a connection by connection basis.  The first parameter is the
         2172  +** [database connection] whose limit is to be set or queried.  The
         2173  +** second parameter is one of the [limit categories] that define a
         2174  +** class of constructs to be size limited.  The third parameter is the
         2175  +** new limit for that construct.  The function returns the old limit.
         2176  +**
         2177  +** If the new limit is a negative number, the limit is unchanged.
         2178  +** For the limit category of SQLITE_LIMIT_XYZ there is a hard upper
         2179  +** bound set by a compile-time C-preprocess macro named SQLITE_MAX_XYZ.
         2180  +** (The "_LIMIT_" in the name is changed to "_MAX_".)
         2181  +** Attempts to increase a limit above its hard upper bound are
         2182  +** silently truncated to the hard upper limit.
         2183  +**
         2184  +** Run time limits are intended for use in applications that manage
         2185  +** both their own internal database and also databases that are controlled
         2186  +** by untrusted external sources.  An example application might be a
         2187  +** webbrowser that has its own databases for storing history and
         2188  +** separate databases controlled by javascript applications downloaded
         2189  +** off the internet.  The internal databases can be given the
         2190  +** large, default limits.  Databases managed by external sources can
         2191  +** be given much smaller limits designed to prevent a denial of service
         2192  +** attach.  Developers might also want to use the [sqlite3_set_authorizer()]
         2193  +** interface to further control untrusted SQL.  The size of the database
         2194  +** created by an untrusted script can be contained using the
         2195  +** [max_page_count] [PRAGMA].
         2196  +**
         2197  +** This interface is currently considered experimental and is subject
         2198  +** to change or removal without prior notice.
         2199  +**
         2200  +** INVARIANTS:
         2201  +**
         2202  +** {F12762} A successful call to [sqlite3_limit(D,C,V)] where V is
         2203  +**          positive changes the
         2204  +**          limit on the size of construct C in [database connection] D
         2205  +**          to the lessor of V and the hard upper bound on the size
         2206  +**          of C that is set at compile-time.
         2207  +**
         2208  +** {F12766} A successful call to [sqlite3_limit(D,C,V)] where V is negative
         2209  +**          leaves the state of [database connection] D unchanged.
         2210  +**
         2211  +** {F12769} A successful call to [sqlite3_limit(D,C,V)] returns the
         2212  +**          value of the limit on the size of construct C in
         2213  +**          in [database connection] D as it was prior to the call.
         2214  +*/
         2215  +int sqlite3_limit(sqlite3*, int id, int newVal);
         2216  +
         2217  +/*
         2218  +** CAPI3REF: Run-Time Limit Categories {F12790}
         2219  +** KEYWORDS: {limit category} {limit categories}
         2220  +** 
         2221  +** These constants define various aspects of a [database connection]
         2222  +** that can be limited in size by calls to [sqlite3_limit()].
         2223  +** The meanings of the various limits are as follows:
         2224  +**
         2225  +** <dl>
         2226  +** <dt>SQLITE_LIMIT_LENGTH</dt>
         2227  +** <dd>The maximum size of any
         2228  +** string or blob or table row.<dd>
         2229  +**
         2230  +** <dt>SQLITE_LIMIT_SQL_LENGTH</dt>
         2231  +** <dd>The maximum length of an SQL statement.</dd>
         2232  +**
         2233  +** <dt>SQLITE_LIMIT_COLUMN</dt>
         2234  +** <dd>The maximum number of columns in a table definition or in the
         2235  +** result set of a SELECT or the maximum number of columns in an index
         2236  +** or in an ORDER BY or GROUP BY clause.</dd>
         2237  +**
         2238  +** <dt>SQLITE_LIMIT_EXPR_DEPTH</dt>
         2239  +** <dd>The maximum depth of the parse tree on any expression.</dd>
         2240  +**
         2241  +** <dt>SQLITE_LIMIT_COMPOUND_SELECT</dt>
         2242  +** <dd>The maximum number of terms in a compound SELECT statement.</dd>
         2243  +**
         2244  +** <dt>SQLITE_LIMIT_VDBE_OP</dt>
         2245  +** <dd>The maximum number of instructions in a virtual machine program
         2246  +** used to implement an SQL statement.</dd>
         2247  +**
         2248  +** <dt>SQLITE_LIMIT_FUNCTION_ARG</dt>
         2249  +** <dd>The maximum number of arguments on a function.</dd>
         2250  +**
         2251  +** <dt>SQLITE_LIMIT_ATTACHED</dt>
         2252  +** <dd>The maximum number of attached databases.</dd>
         2253  +**
         2254  +** <dt>SQLITE_LIMIT_LIKE_PATTERN_LENGTH</dt>
         2255  +** <dd>The maximum length of the pattern argument to the LIKE or
         2256  +** GLOB operators.</dd>
         2257  +**
         2258  +** <dt>SQLITE_LIMIT_VARIABLE_NUMBER</dt>
         2259  +** <dd>The maximum number of variables in an SQL statement that can
         2260  +** be bound.</dd>
         2261  +** </dl>
         2262  +*/
         2263  +#define SQLITE_LIMIT_LENGTH                    0
         2264  +#define SQLITE_LIMIT_SQL_LENGTH                1
         2265  +#define SQLITE_LIMIT_COLUMN                    2
         2266  +#define SQLITE_LIMIT_EXPR_DEPTH                3
         2267  +#define SQLITE_LIMIT_COMPOUND_SELECT           4
         2268  +#define SQLITE_LIMIT_VDBE_OP                   5
         2269  +#define SQLITE_LIMIT_FUNCTION_ARG              6
         2270  +#define SQLITE_LIMIT_ATTACHED                  7
         2271  +#define SQLITE_LIMIT_LIKE_PATTERN_LENGTH       8
         2272  +#define SQLITE_LIMIT_VARIABLE_NUMBER           9
         2273  +
         2274  +/*
         2275  +** CAPI3REF: Compiling An SQL Statement {F13010}
  1501   2276   **
  1502   2277   ** To execute an SQL query, it must first be compiled into a byte-code
  1503   2278   ** program using one of these routines. 
  1504   2279   **
  1505         -** The first argument "db" is an [sqlite3 | SQLite database handle] 
         2280  +** The first argument "db" is an [database connection] 
  1506   2281   ** obtained from a prior call to [sqlite3_open()], [sqlite3_open_v2()]
  1507         -** or [sqlite3_open16()].
         2282  +** or [sqlite3_open16()]. 
  1508   2283   ** The second argument "zSql" is the statement to be compiled, encoded
  1509   2284   ** as either UTF-8 or UTF-16.  The sqlite3_prepare() and sqlite3_prepare_v2()
  1510   2285   ** interfaces uses UTF-8 and sqlite3_prepare16() and sqlite3_prepare16_v2()
  1511         -** use UTF-16.
         2286  +** use UTF-16. {END}
  1512   2287   **
  1513   2288   ** If the nByte argument is less
  1514         -** than zero, then zSql is read up to the first zero terminator.  If
  1515         -** nByte is non-negative, then it is the maximum number of 
         2289  +** than zero, then zSql is read up to the first zero terminator.
         2290  +** If nByte is non-negative, then it is the maximum number of 
  1516   2291   ** bytes read from zSql.  When nByte is non-negative, the
  1517         -** zSql string ends at either the first '\000' character or 
  1518         -** until the nByte-th byte, whichever comes first.
         2292  +** zSql string ends at either the first '\000' or '\u0000' character or 
         2293  +** the nByte-th byte, whichever comes first. If the caller knows
         2294  +** that the supplied string is nul-terminated, then there is a small
         2295  +** performance advantage to be had by passing an nByte parameter that 
         2296  +** is equal to the number of bytes in the input string <i>including</i> 
         2297  +** the nul-terminator bytes.{END}
  1519   2298   **
  1520         -** *pzTail is made to point to the first byte past the end of the first
  1521         -** SQL statement in zSql.  This routine only compiles the first statement
  1522         -** in zSql, so *pzTail is left pointing to what remains uncompiled.
         2299  +** *pzTail is made to point to the first byte past the end of the
         2300  +** first SQL statement in zSql.  These routines only compiles the first
         2301  +** statement in zSql, so *pzTail is left pointing to what remains
         2302  +** uncompiled.
  1523   2303   **
  1524         -** *ppStmt is left pointing to a compiled 
  1525         -** [sqlite3_stmt | SQL statement structure] that can be
  1526         -** executed using [sqlite3_step()].  Or if there is an error, *ppStmt may be
  1527         -** set to NULL.  If the input text contained no SQL (if the input is and
  1528         -** empty string or a comment) then *ppStmt is set to NULL.  The calling
  1529         -** procedure is responsible for deleting the compiled SQL statement
         2304  +** *ppStmt is left pointing to a compiled [prepared statement] that can be
         2305  +** executed using [sqlite3_step()].  Or if there is an error, *ppStmt is
         2306  +** set to NULL.  If the input text contains no SQL (if the input
         2307  +** is and empty string or a comment) then *ppStmt is set to NULL.
         2308  +** {U13018} The calling procedure is responsible for deleting the
         2309  +** compiled SQL statement
  1530   2310   ** using [sqlite3_finalize()] after it has finished with it.
  1531   2311   **
  1532   2312   ** On success, [SQLITE_OK] is returned.  Otherwise an 
  1533         -** [SQLITE_ERROR | error code] is returned.
         2313  +** [error code] is returned.
  1534   2314   **
  1535   2315   ** The sqlite3_prepare_v2() and sqlite3_prepare16_v2() interfaces are
  1536   2316   ** recommended for all new programs. The two older interfaces are retained
  1537   2317   ** for backwards compatibility, but their use is discouraged.
  1538   2318   ** In the "v2" interfaces, the prepared statement
  1539   2319   ** that is returned (the [sqlite3_stmt] object) contains a copy of the 
  1540         -** original SQL text. This causes the [sqlite3_step()] interface to
         2320  +** original SQL text. {END} This causes the [sqlite3_step()] interface to
  1541   2321   ** behave a differently in two ways:
  1542   2322   **
  1543   2323   ** <ol>
  1544   2324   ** <li>
  1545   2325   ** If the database schema changes, instead of returning [SQLITE_SCHEMA] as it
  1546   2326   ** always used to do, [sqlite3_step()] will automatically recompile the SQL
  1547         -** statement and try to run it again.  If the schema has changed in a way
  1548         -** that makes the statement no longer valid, [sqlite3_step()] will still
  1549         -** return [SQLITE_SCHEMA].  But unlike the legacy behavior, [SQLITE_SCHEMA] is
  1550         -** now a fatal error.  Calling [sqlite3_prepare_v2()] again will not make the
  1551         -** error go away.  Note: use [sqlite3_errmsg()] to find the text of the parsing
  1552         -** error that results in an [SQLITE_SCHEMA] return.
         2327  +** statement and try to run it again.  If the schema has changed in
         2328  +** a way that makes the statement no longer valid, [sqlite3_step()] will still
         2329  +** return [SQLITE_SCHEMA].  But unlike the legacy behavior, 
         2330  +** [SQLITE_SCHEMA] is now a fatal error.  Calling
         2331  +** [sqlite3_prepare_v2()] again will not make the
         2332  +** error go away.  Note: use [sqlite3_errmsg()] to find the text
         2333  +** of the parsing error that results in an [SQLITE_SCHEMA] return. {END}
  1553   2334   ** </li>
  1554   2335   **
  1555   2336   ** <li>
  1556   2337   ** When an error occurs, 
  1557   2338   ** [sqlite3_step()] will return one of the detailed 
  1558         -** [SQLITE_ERROR | result codes] or
  1559         -** [SQLITE_IOERR_READ | extended result codes] such as directly.
         2339  +** [error codes] or [extended error codes]. 
  1560   2340   ** The legacy behavior was that [sqlite3_step()] would only return a generic
  1561   2341   ** [SQLITE_ERROR] result code and you would have to make a second call to
  1562   2342   ** [sqlite3_reset()] in order to find the underlying cause of the problem.
  1563   2343   ** With the "v2" prepare interfaces, the underlying reason for the error is
  1564   2344   ** returned immediately.
  1565   2345   ** </li>
  1566   2346   ** </ol>
         2347  +**
         2348  +** INVARIANTS:
         2349  +**
         2350  +** {F13011} The [sqlite3_prepare(db,zSql,...)] and
         2351  +**          [sqlite3_prepare_v2(db,zSql,...)] interfaces interpret the
         2352  +**          text in their zSql parameter as UTF-8.
         2353  +**
         2354  +** {F13012} The [sqlite3_prepare16(db,zSql,...)] and
         2355  +**          [sqlite3_prepare16_v2(db,zSql,...)] interfaces interpret the
         2356  +**          text in their zSql parameter as UTF-16 in the native byte order.
         2357  +**
         2358  +** {F13013} If the nByte argument to [sqlite3_prepare_v2(db,zSql,nByte,...)]
         2359  +**          and its variants is less than zero, then SQL text is
         2360  +**          read from zSql is read up to the first zero terminator.
         2361  +**
         2362  +** {F13014} If the nByte argument to [sqlite3_prepare_v2(db,zSql,nByte,...)]
         2363  +**          and its variants is non-negative, then at most nBytes bytes
         2364  +**          SQL text is read from zSql.
         2365  +**
         2366  +** {F13015} In [sqlite3_prepare_v2(db,zSql,N,P,pzTail)] and its variants
         2367  +**          if the zSql input text contains more than one SQL statement
         2368  +**          and pzTail is not NULL, then *pzTail is made to point to the
         2369  +**          first byte past the end of the first SQL statement in zSql.
         2370  +**          <todo>What does *pzTail point to if there is one statement?</todo>
         2371  +**
         2372  +** {F13016} A successful call to [sqlite3_prepare_v2(db,zSql,N,ppStmt,...)]
         2373  +**          or one of its variants writes into *ppStmt a pointer to a new
         2374  +**          [prepared statement] or a pointer to NULL
         2375  +**          if zSql contains nothing other than whitespace or comments. 
         2376  +**
         2377  +** {F13019} The [sqlite3_prepare_v2()] interface and its variants return
         2378  +**          [SQLITE_OK] or an appropriate [error code] upon failure.
         2379  +**
         2380  +** {F13021} Before [sqlite3_prepare(db,zSql,nByte,ppStmt,pzTail)] or its
         2381  +**          variants returns an error (any value other than [SQLITE_OK])
         2382  +**          it first sets *ppStmt to NULL.
  1567   2383   */
  1568   2384   int sqlite3_prepare(
  1569   2385     sqlite3 *db,            /* Database handle */
  1570   2386     const char *zSql,       /* SQL statement, UTF-8 encoded */
  1571   2387     int nByte,              /* Maximum length of zSql in bytes. */
  1572   2388     sqlite3_stmt **ppStmt,  /* OUT: Statement handle */
  1573   2389     const char **pzTail     /* OUT: Pointer to unused portion of zSql */
................................................................................
  1591   2407     const void *zSql,       /* SQL statement, UTF-16 encoded */
  1592   2408     int nByte,              /* Maximum length of zSql in bytes. */
  1593   2409     sqlite3_stmt **ppStmt,  /* OUT: Statement handle */
  1594   2410     const void **pzTail     /* OUT: Pointer to unused portion of zSql */
  1595   2411   );
  1596   2412   
  1597   2413   /*
  1598         -** Retrieve the original SQL statement associated with a compiled statement
  1599         -** in UTF-8 encoding.
         2414  +** CAPIREF: Retrieving Statement SQL {F13100}
  1600   2415   **
  1601         -** If the compiled SQL statement passed as an argument was compiled using
  1602         -** either sqlite3_prepare_v2 or sqlite3_prepare16_v2, then this function
  1603         -** returns a pointer to a nul-terminated string containing a copy of
  1604         -** the original SQL statement. The pointer is valid until the statement
  1605         -** is deleted using sqlite3_finalize().
         2416  +** This intereface can be used to retrieve a saved copy of the original
         2417  +** SQL text used to create a [prepared statement].
  1606   2418   **
  1607         -** If the statement was compiled using either of the legacy interfaces 
  1608         -** sqlite3_prepare() or sqlite3_prepare16(), this function returns NULL.
  1609         -** 
  1610         -****** EXPERIMENTAL - subject to change without notice **************
         2419  +** INVARIANTS:
         2420  +**
         2421  +** {F13101} If the [prepared statement] passed as 
         2422  +**          the an argument to [sqlite3_sql()] was compiled
         2423  +**          compiled using either [sqlite3_prepare_v2()] or
         2424  +**          [sqlite3_prepare16_v2()],
         2425  +**          then [sqlite3_sql()] function returns a pointer to a
         2426  +**          zero-terminated string containing a UTF-8 rendering
         2427  +**          of the original SQL statement.
         2428  +**
         2429  +** {F13102} If the [prepared statement] passed as 
         2430  +**          the an argument to [sqlite3_sql()] was compiled
         2431  +**          compiled using either [sqlite3_prepare()] or
         2432  +**          [sqlite3_prepare16()],
         2433  +**          then [sqlite3_sql()] function returns a NULL pointer.
         2434  +**
         2435  +** {F13103} The string returned by [sqlite3_sql(S)] is valid until the
         2436  +**          [prepared statement] S is deleted using [sqlite3_finalize(S)].
  1611   2437   */
  1612   2438   const char *sqlite3_sql(sqlite3_stmt *pStmt);
  1613   2439   
  1614   2440   /*
  1615         -** CAPI3REF:  Dynamically Typed Value Object
         2441  +** CAPI3REF:  Dynamically Typed Value Object  {F15000}
         2442  +** KEYWORDS: {protected sqlite3_value} {unprotected sqlite3_value}
  1616   2443   **
  1617         -** SQLite uses dynamic typing for the values it stores.  Values can 
  1618         -** be integers, floating point values, strings, BLOBs, or NULL.  When
  1619         -** passing around values internally, each value is represented as
  1620         -** an instance of the sqlite3_value object.
         2444  +** SQLite uses the sqlite3_value object to represent all values
         2445  +** that can be stored in a database table.
         2446  +** SQLite uses dynamic typing for the values it stores.  
         2447  +** Values stored in sqlite3_value objects can be
         2448  +** be integers, floating point values, strings, BLOBs, or NULL.
         2449  +**
         2450  +** An sqlite3_value object may be either "protected" or "unprotected".
         2451  +** Some interfaces require a protected sqlite3_value.  Other interfaces
         2452  +** will accept either a protected or an unprotected sqlite3_value.
         2453  +** Every interface that accepts sqlite3_value arguments specifies 
         2454  +** whether or not it requires a protected sqlite3_value.
         2455  +**
         2456  +** The terms "protected" and "unprotected" refer to whether or not
         2457  +** a mutex is held.  A internal mutex is held for a protected
         2458  +** sqlite3_value object but no mutex is held for an unprotected
         2459  +** sqlite3_value object.  If SQLite is compiled to be single-threaded
         2460  +** (with SQLITE_THREADSAFE=0 and with [sqlite3_threadsafe()] returning 0)
         2461  +** then there is no distinction between
         2462  +** protected and unprotected sqlite3_value objects and they can be
         2463  +** used interchangable.  However, for maximum code portability it
         2464  +** is recommended that applications make the distinction between
         2465  +** between protected and unprotected sqlite3_value objects even if
         2466  +** they are single threaded.
         2467  +**
         2468  +** The sqlite3_value objects that are passed as parameters into the
         2469  +** implementation of application-defined SQL functions are protected.
         2470  +** The sqlite3_value object returned by
         2471  +** [sqlite3_column_value()] is unprotected.
         2472  +** Unprotected sqlite3_value objects may only be used with
         2473  +** [sqlite3_result_value()] and [sqlite3_bind_value()].  All other
         2474  +** interfaces that use sqlite3_value require protected sqlite3_value objects.
  1621   2475   */
  1622   2476   typedef struct Mem sqlite3_value;
  1623   2477   
  1624   2478   /*
  1625         -** CAPI3REF:  SQL Function Context Object
         2479  +** CAPI3REF:  SQL Function Context Object {F16001}
  1626   2480   **
  1627   2481   ** The context in which an SQL function executes is stored in an
  1628         -** sqlite3_context object.  A pointer to such an object is the
  1629         -** first parameter to user-defined SQL functions.
         2482  +** sqlite3_context object.  A pointer to an sqlite3_context
         2483  +** object is always first parameter to application-defined SQL functions.
  1630   2484   */
  1631   2485   typedef struct sqlite3_context sqlite3_context;
  1632   2486   
  1633   2487   /*
  1634         -** CAPI3REF:  Binding Values To Prepared Statements
         2488  +** CAPI3REF:  Binding Values To Prepared Statements {F13500}
  1635   2489   **
  1636         -** In the SQL strings input to [sqlite3_prepare_v2()] and its variants,
  1637         -** one or more literals can be replace by a parameter in one of these
  1638         -** forms:
         2490  +** In the SQL strings input to [sqlite3_prepare_v2()] and its
         2491  +** variants, literals may be replace by a parameter in one
         2492  +** of these forms:
  1639   2493   **
  1640   2494   ** <ul>
  1641   2495   ** <li>  ?
  1642   2496   ** <li>  ?NNN
  1643         -** <li>  :AAA
  1644         -** <li>  @AAA
         2497  +** <li>  :VVV
         2498  +** <li>  @VVV
  1645   2499   ** <li>  $VVV
  1646   2500   ** </ul>
  1647   2501   **
  1648   2502   ** In the parameter forms shown above NNN is an integer literal,
  1649         -** AAA is an alphanumeric identifier and VVV is a variable name according
  1650         -** to the syntax rules of the TCL programming language.
  1651         -** The values of these parameters (also called "host parameter names")
         2503  +** VVV alpha-numeric parameter name.
         2504  +** The values of these parameters (also called "host parameter names"
         2505  +** or "SQL parameters")
  1652   2506   ** can be set using the sqlite3_bind_*() routines defined here.
  1653   2507   **
  1654         -** The first argument to the sqlite3_bind_*() routines always is a pointer
  1655         -** to the [sqlite3_stmt] object returned from [sqlite3_prepare_v2()] or
  1656         -** its variants.  The second
  1657         -** argument is the index of the parameter to be set.  The first parameter has
  1658         -** an index of 1. When the same named parameter is used more than once, second
  1659         -** and subsequent
  1660         -** occurrences have the same index as the first occurrence.  The index for
  1661         -** named parameters can be looked up using the
  1662         -** [sqlite3_bind_parameter_name()] API if desired.  The index for "?NNN"
  1663         -** parametes is the value of NNN.
         2508  +** The first argument to the sqlite3_bind_*() routines always
         2509  +** is a pointer to the [sqlite3_stmt] object returned from
         2510  +** [sqlite3_prepare_v2()] or its variants. The second
         2511  +** argument is the index of the parameter to be set. The
         2512  +** first parameter has an index of 1.  When the same named
         2513  +** parameter is used more than once, second and subsequent
         2514  +** occurrences have the same index as the first occurrence. 
         2515  +** The index for named parameters can be looked up using the
         2516  +** [sqlite3_bind_parameter_name()] API if desired.  The index
         2517  +** for "?NNN" parameters is the value of NNN.
  1664   2518   ** The NNN value must be between 1 and the compile-time
  1665   2519   ** parameter SQLITE_MAX_VARIABLE_NUMBER (default value: 999).
  1666         -** See <a href="limits.html">limits.html</a> for additional information.
  1667   2520   **
  1668   2521   ** The third argument is the value to bind to the parameter.
  1669   2522   **
  1670   2523   ** In those
  1671   2524   ** routines that have a fourth argument, its value is the number of bytes
  1672         -** in the parameter.  To be clear: the value is the number of bytes in the
  1673         -** string, not the number of characters.  The number
  1674         -** of bytes does not include the zero-terminator at the end of strings.
         2525  +** in the parameter.  To be clear: the value is the number of <u>bytes</u>
         2526  +** in the value, not the number of characters. 
  1675   2527   ** If the fourth parameter is negative, the length of the string is
  1676   2528   ** number of bytes up to the first zero terminator.
  1677   2529   **
  1678   2530   ** The fifth argument to sqlite3_bind_blob(), sqlite3_bind_text(), and
  1679   2531   ** sqlite3_bind_text16() is a destructor used to dispose of the BLOB or
  1680         -** text after SQLite has finished with it.  If the fifth argument is the
  1681         -** special value [SQLITE_STATIC], then the library assumes that the information
  1682         -** is in static, unmanaged space and does not need to be freed.  If the
  1683         -** fifth argument has the value [SQLITE_TRANSIENT], then SQLite makes its
  1684         -** own private copy of the data immediately, before the sqlite3_bind_*()
  1685         -** routine returns.
         2532  +** string after SQLite has finished with it. If the fifth argument is
         2533  +** the special value [SQLITE_STATIC], then SQLite assumes that the
         2534  +** information is in static, unmanaged space and does not need to be freed.
         2535  +** If the fifth argument has the value [SQLITE_TRANSIENT], then
         2536  +** SQLite makes its own private copy of the data immediately, before
         2537  +** the sqlite3_bind_*() routine returns.
  1686   2538   **
  1687         -** The sqlite3_bind_zeroblob() routine binds a BLOB of length n that
         2539  +** The sqlite3_bind_zeroblob() routine binds a BLOB of length N that
  1688   2540   ** is filled with zeros.  A zeroblob uses a fixed amount of memory
  1689   2541   ** (just an integer to hold it size) while it is being processed.
  1690   2542   ** Zeroblobs are intended to serve as place-holders for BLOBs whose
  1691   2543   ** content is later written using 
  1692         -** [sqlite3_blob_open | increment BLOB I/O] routines.  A negative
         2544  +** [sqlite3_blob_open | increment BLOB I/O] routines. A negative
  1693   2545   ** value for the zeroblob results in a zero-length BLOB.
  1694   2546   **
  1695   2547   ** The sqlite3_bind_*() routines must be called after
  1696   2548   ** [sqlite3_prepare_v2()] (and its variants) or [sqlite3_reset()] and
  1697   2549   ** before [sqlite3_step()].
  1698   2550   ** Bindings are not cleared by the [sqlite3_reset()] routine.
  1699   2551   ** Unbound parameters are interpreted as NULL.
  1700   2552   **
  1701   2553   ** These routines return [SQLITE_OK] on success or an error code if
  1702   2554   ** anything goes wrong.  [SQLITE_RANGE] is returned if the parameter
  1703   2555   ** index is out of range.  [SQLITE_NOMEM] is returned if malloc fails.
  1704         -** [SQLITE_MISUSE] is returned if these routines are called on a virtual
  1705         -** machine that is the wrong state or which has already been finalized.
         2556  +** [SQLITE_MISUSE] might be returned if these routines are called on a
         2557  +** virtual machine that is the wrong state or which has already been finalized.
         2558  +** Detection of misuse is unreliable.  Applications should not depend
         2559  +** on SQLITE_MISUSE returns.  SQLITE_MISUSE is intended to indicate a
         2560  +** a logic error in the application.  Future versions of SQLite might
         2561  +** panic rather than return SQLITE_MISUSE.
         2562  +**
         2563  +** See also: [sqlite3_bind_parameter_count()],
         2564  +** [sqlite3_bind_parameter_name()], and
         2565  +** [sqlite3_bind_parameter_index()].
         2566  +**
         2567  +** INVARIANTS:
         2568  +**
         2569  +** {F13506} The [sqlite3_prepare | SQL statement compiler] recognizes
         2570  +**          tokens of the forms "?", "?NNN", "$VVV", ":VVV", and "@VVV"
         2571  +**          as SQL parameters, where NNN is any sequence of one or more
         2572  +**          digits and where VVV is any sequence of one or more 
         2573  +**          alphanumeric characters or "::" optionally followed by
         2574  +**          a string containing no spaces and contained within parentheses.
         2575  +**
         2576  +** {F13509} The initial value of an SQL parameter is NULL.
         2577  +**
         2578  +** {F13512} The index of an "?" SQL parameter is one larger than the
         2579  +**          largest index of SQL parameter to the left, or 1 if
         2580  +**          the "?" is the leftmost SQL parameter.
         2581  +**
         2582  +** {F13515} The index of an "?NNN" SQL parameter is the integer NNN.
         2583  +**
         2584  +** {F13518} The index of an ":VVV", "$VVV", or "@VVV" SQL parameter is
         2585  +**          the same as the index of leftmost occurances of the same
         2586  +**          parameter, or one more than the largest index over all
         2587  +**          parameters to the left if this is the first occurrance
         2588  +**          of this parameter, or 1 if this is the leftmost parameter.
         2589  +**
         2590  +** {F13521} The [sqlite3_prepare | SQL statement compiler] fail with
         2591  +**          an [SQLITE_RANGE] error if the index of an SQL parameter
         2592  +**          is less than 1 or greater than SQLITE_MAX_VARIABLE_NUMBER.
         2593  +**
         2594  +** {F13524} Calls to [sqlite3_bind_text | sqlite3_bind(S,N,V,...)]
         2595  +**          associate the value V with all SQL parameters having an
         2596  +**          index of N in the [prepared statement] S.
         2597  +**
         2598  +** {F13527} Calls to [sqlite3_bind_text | sqlite3_bind(S,N,...)]
         2599  +**          override prior calls with the same values of S and N.
         2600  +**
         2601  +** {F13530} Bindings established by [sqlite3_bind_text | sqlite3_bind(S,...)]
         2602  +**          persist across calls to [sqlite3_reset(S)].
         2603  +**
         2604  +** {F13533} In calls to [sqlite3_bind_blob(S,N,V,L,D)],
         2605  +**          [sqlite3_bind_text(S,N,V,L,D)], or
         2606  +**          [sqlite3_bind_text16(S,N,V,L,D)] SQLite binds the first L
         2607  +**          bytes of the blob or string pointed to by V, when L
         2608  +**          is non-negative.
         2609  +**
         2610  +** {F13536} In calls to [sqlite3_bind_text(S,N,V,L,D)] or
         2611  +**          [sqlite3_bind_text16(S,N,V,L,D)] SQLite binds characters
         2612  +**          from V through the first zero character when L is negative.
         2613  +**
         2614  +** {F13539} In calls to [sqlite3_bind_blob(S,N,V,L,D)],
         2615  +**          [sqlite3_bind_text(S,N,V,L,D)], or
         2616  +**          [sqlite3_bind_text16(S,N,V,L,D)] when D is the special
         2617  +**          constant [SQLITE_STATIC], SQLite assumes that the value V
         2618  +**          is held in static unmanaged space that will not change
         2619  +**          during the lifetime of the binding.
         2620  +**
         2621  +** {F13542} In calls to [sqlite3_bind_blob(S,N,V,L,D)],
         2622  +**          [sqlite3_bind_text(S,N,V,L,D)], or
         2623  +**          [sqlite3_bind_text16(S,N,V,L,D)] when D is the special
         2624  +**          constant [SQLITE_TRANSIENT], the routine makes a 
         2625  +**          private copy of V value before it returns.
         2626  +**
         2627  +** {F13545} In calls to [sqlite3_bind_blob(S,N,V,L,D)],
         2628  +**          [sqlite3_bind_text(S,N,V,L,D)], or
         2629  +**          [sqlite3_bind_text16(S,N,V,L,D)] when D is a pointer to
         2630  +**          a function, SQLite invokes that function to destroy the
         2631  +**          V value after it has finished using the V value.
         2632  +**
         2633  +** {F13548} In calls to [sqlite3_bind_zeroblob(S,N,V,L)] the value bound
         2634  +**          is a blob of L bytes, or a zero-length blob if L is negative.
         2635  +**
         2636  +** {F13551} In calls to [sqlite3_bind_value(S,N,V)] the V argument may
         2637  +**          be either a [protected sqlite3_value] object or an
         2638  +**          [unprotected sqlite3_value] object.
  1706   2639   */
  1707   2640   int sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n, void(*)(void*));
  1708   2641   int sqlite3_bind_double(sqlite3_stmt*, int, double);
  1709   2642   int sqlite3_bind_int(sqlite3_stmt*, int, int);
  1710   2643   int sqlite3_bind_int64(sqlite3_stmt*, int, sqlite3_int64);
  1711   2644   int sqlite3_bind_null(sqlite3_stmt*, int);
  1712   2645   int sqlite3_bind_text(sqlite3_stmt*, int, const char*, int n, void(*)(void*));
  1713   2646   int sqlite3_bind_text16(sqlite3_stmt*, int, const void*, int, void(*)(void*));
  1714   2647   int sqlite3_bind_value(sqlite3_stmt*, int, const sqlite3_value*);
  1715   2648   int sqlite3_bind_zeroblob(sqlite3_stmt*, int, int n);
  1716   2649   
  1717   2650   /*
  1718         -** CAPI3REF: Number Of Host Parameters
         2651  +** CAPI3REF: Number Of SQL Parameters {F13600}
  1719   2652   **
  1720         -** Return the largest host parameter index in the precompiled statement given
  1721         -** as the argument.  When the host parameters are of the forms like ":AAA"
  1722         -** or "?", then they are assigned sequential increasing numbers beginning
  1723         -** with one, so the value returned is the number of parameters.  However
  1724         -** if the same host parameter name is used multiple times, each occurrance
  1725         -** is given the same number, so the value returned in that case is the number
  1726         -** of unique host parameter names.  If host parameters of the form "?NNN"
  1727         -** are used (where NNN is an integer) then there might be gaps in the
  1728         -** numbering and the value returned by this interface is the index of the
  1729         -** host parameter with the largest index value.
         2653  +** This routine can be used to find the number of SQL parameters
         2654  +** in a prepared statement.  SQL parameters are tokens of the
         2655  +** form "?", "?NNN", ":AAA", "$AAA", or "@AAA" that serve as
         2656  +** place-holders for values that are [sqlite3_bind_blob | bound]
         2657  +** to the parameters at a later time.
  1730   2658   **
  1731         -** The prepared statement must not be [sqlite3_finalize | finalized]
  1732         -** prior to this routine returnning.  Otherwise the results are undefined
  1733         -** and probably undesirable.
         2659  +** This routine actually returns the index of the largest parameter.
         2660  +** For all forms except ?NNN, this will correspond to the number of
         2661  +** unique parameters.  If parameters of the ?NNN are used, there may
         2662  +** be gaps in the list.
         2663  +**
         2664  +** See also: [sqlite3_bind_blob|sqlite3_bind()],
         2665  +** [sqlite3_bind_parameter_name()], and
         2666  +** [sqlite3_bind_parameter_index()].
         2667  +**
         2668  +** INVARIANTS:
         2669  +**
         2670  +** {F13601} The [sqlite3_bind_parameter_count(S)] interface returns
         2671  +**          the largest index of all SQL parameters in the
         2672  +**          [prepared statement] S, or 0 if S
         2673  +**          contains no SQL parameters.
  1734   2674   */
  1735   2675   int sqlite3_bind_parameter_count(sqlite3_stmt*);
  1736   2676   
  1737   2677   /*
  1738         -** CAPI3REF: Name Of A Host Parameter
         2678  +** CAPI3REF: Name Of A Host Parameter {F13620}
  1739   2679   **
  1740         -** This routine returns a pointer to the name of the n-th parameter in a 
  1741         -** [sqlite3_stmt | prepared statement].
  1742         -** Host parameters of the form ":AAA" or "@AAA" or "$VVV" have a name
  1743         -** which is the string ":AAA" or "@AAA" or "$VVV".  
  1744         -** In other words, the initial ":" or "$" or "@"
         2680  +** This routine returns a pointer to the name of the n-th
         2681  +** SQL parameter in a [prepared statement].
         2682  +** SQL parameters of the form "?NNN" or ":AAA" or "@AAA" or "$AAA"
         2683  +** have a name which is the string "?NNN" or ":AAA" or "@AAA" or "$AAA"
         2684  +** respectively.
         2685  +** In other words, the initial ":" or "$" or "@" or "?"
  1745   2686   ** is included as part of the name.
  1746         -** Parameters of the form "?" or "?NNN" have no name.
         2687  +** Parameters of the form "?" without a following integer have no name.
  1747   2688   **
  1748         -** The first bound parameter has an index of 1, not 0.
         2689  +** The first host parameter has an index of 1, not 0.
  1749   2690   **
  1750         -** If the value n is out of range or if the n-th parameter is nameless,
  1751         -** then NULL is returned.  The returned string is always in the
  1752         -** UTF-8 encoding even if the named parameter was originally specified
  1753         -** as UTF-16 in [sqlite3_prepare16()] or [sqlite3_prepare16_v2()].
         2691  +** If the value n is out of range or if the n-th parameter is
         2692  +** nameless, then NULL is returned.  The returned string is
         2693  +** always in the UTF-8 encoding even if the named parameter was
         2694  +** originally specified as UTF-16 in [sqlite3_prepare16()] or
         2695  +** [sqlite3_prepare16_v2()].
         2696  +**
         2697  +** See also: [sqlite3_bind_blob|sqlite3_bind()],
         2698  +** [sqlite3_bind_parameter_count()], and
         2699  +** [sqlite3_bind_parameter_index()].
         2700  +**
         2701  +** INVARIANTS:
         2702  +**
         2703  +** {F13621} The [sqlite3_bind_parameter_name(S,N)] interface returns
         2704  +**          a UTF-8 rendering of the name of the SQL parameter in
         2705  +**          [prepared statement] S having index N, or
         2706  +**          NULL if there is no SQL parameter with index N or if the
         2707  +**          parameter with index N is an anonymous parameter "?".
  1754   2708   */
  1755   2709   const char *sqlite3_bind_parameter_name(sqlite3_stmt*, int);
  1756   2710   
  1757   2711   /*
  1758         -** CAPI3REF: Index Of A Parameter With A Given Name
         2712  +** CAPI3REF: Index Of A Parameter With A Given Name {F13640}
  1759   2713   **
  1760         -** This routine returns the index of a host parameter with the given name.
  1761         -** The name must match exactly.  If no parameter with the given name is 
  1762         -** found, return 0.  Parameter names must be UTF8.
         2714  +** Return the index of an SQL parameter given its name.  The
         2715  +** index value returned is suitable for use as the second
         2716  +** parameter to [sqlite3_bind_blob|sqlite3_bind()].  A zero
         2717  +** is returned if no matching parameter is found.  The parameter
         2718  +** name must be given in UTF-8 even if the original statement
         2719  +** was prepared from UTF-16 text using [sqlite3_prepare16_v2()].
         2720  +**
         2721  +** See also: [sqlite3_bind_blob|sqlite3_bind()],
         2722  +** [sqlite3_bind_parameter_count()], and
         2723  +** [sqlite3_bind_parameter_index()].
         2724  +**
         2725  +** INVARIANTS:
         2726  +**
         2727  +** {F13641} The [sqlite3_bind_parameter_index(S,N)] interface returns
         2728  +**          the index of SQL parameter in [prepared statement]
         2729  +**          S whose name matches the UTF-8 string N, or 0 if there is
         2730  +**          no match.
  1763   2731   */
  1764   2732   int sqlite3_bind_parameter_index(sqlite3_stmt*, const char *zName);
  1765   2733   
  1766   2734   /*
  1767         -** CAPI3REF: Reset All Bindings On A Prepared Statement
         2735  +** CAPI3REF: Reset All Bindings On A Prepared Statement {F13660}
  1768   2736   **
  1769   2737   ** Contrary to the intuition of many, [sqlite3_reset()] does not
  1770   2738   ** reset the [sqlite3_bind_blob | bindings] on a 
  1771         -** [sqlite3_stmt | prepared statement].  Use this routine to
         2739  +** [prepared statement].  Use this routine to
  1772   2740   ** reset all host parameters to NULL.
         2741  +**
         2742  +** INVARIANTS:
         2743  +**
         2744  +** {F13661} The [sqlite3_clear_bindings(S)] interface resets all
         2745  +**          SQL parameter bindings in [prepared statement] S
         2746  +**          back to NULL.
  1773   2747   */
  1774   2748   int sqlite3_clear_bindings(sqlite3_stmt*);
  1775   2749   
  1776   2750   /*
  1777         -** CAPI3REF: Number Of Columns In A Result Set
         2751  +** CAPI3REF: Number Of Columns In A Result Set {F13710}
  1778   2752   **
  1779   2753   ** Return the number of columns in the result set returned by the 
  1780         -** [sqlite3_stmt | compiled SQL statement]. This routine returns 0
         2754  +** [prepared statement]. This routine returns 0
  1781   2755   ** if pStmt is an SQL statement that does not return data (for 
  1782   2756   ** example an UPDATE).
         2757  +**
         2758  +** INVARIANTS:
         2759  +**
         2760  +** {F13711} The [sqlite3_column_count(S)] interface returns the number of
         2761  +**          columns in the result set generated by the
         2762  +**          [prepared statement] S, or 0 if S does not generate
         2763  +**          a result set.
  1783   2764   */
  1784   2765   int sqlite3_column_count(sqlite3_stmt *pStmt);
  1785   2766   
  1786   2767   /*
  1787         -** CAPI3REF: Column Names In A Result Set
         2768  +** CAPI3REF: Column Names In A Result Set {F13720}
  1788   2769   **
  1789   2770   ** These routines return the name assigned to a particular column
  1790   2771   ** in the result set of a SELECT statement.  The sqlite3_column_name()
  1791         -** interface returns a pointer to a UTF8 string and sqlite3_column_name16()
  1792         -** returns a pointer to a UTF16 string.  The first parameter is the
  1793         -** [sqlite3_stmt | prepared statement] that implements the SELECT statement.
         2772  +** interface returns a pointer to a zero-terminated UTF8 string
         2773  +** and sqlite3_column_name16() returns a pointer to a zero-terminated
         2774  +** UTF16 string.  The first parameter is the
         2775  +** [prepared statement] that implements the SELECT statement.
  1794   2776   ** The second parameter is the column number.  The left-most column is
  1795   2777   ** number 0.
  1796   2778   **
  1797   2779   ** The returned string pointer is valid until either the 
  1798         -** [sqlite3_stmt | prepared statement] is destroyed by [sqlite3_finalize()]
         2780  +** [prepared statement] is destroyed by [sqlite3_finalize()]
  1799   2781   ** or until the next call sqlite3_column_name() or sqlite3_column_name16()
  1800   2782   ** on the same column.
  1801   2783   **
  1802   2784   ** If sqlite3_malloc() fails during the processing of either routine
  1803   2785   ** (for example during a conversion from UTF-8 to UTF-16) then a
  1804   2786   ** NULL pointer is returned.
         2787  +**
         2788  +** The name of a result column is the value of the "AS" clause for
         2789  +** that column, if there is an AS clause.  If there is no AS clause
         2790  +** then the name of the column is unspecified and may change from
         2791  +** one release of SQLite to the next.
         2792  +**
         2793  +** INVARIANTS:
         2794  +**
         2795  +** {F13721} A successful invocation of the [sqlite3_column_name(S,N)]
         2796  +**          interface returns the name
         2797  +**          of the Nth column (where 0 is the left-most column) for the
         2798  +**          result set of [prepared statement] S as a
         2799  +**          zero-terminated UTF-8 string.
         2800  +**
         2801  +** {F13723} A successful invocation of the [sqlite3_column_name16(S,N)]
         2802  +**          interface returns the name
         2803  +**          of the Nth column (where 0 is the left-most column) for the
         2804  +**          result set of [prepared statement] S as a
         2805  +**          zero-terminated UTF-16 string in the native byte order.
         2806  +**
         2807  +** {F13724} The [sqlite3_column_name()] and [sqlite3_column_name16()]
         2808  +**          interfaces return a NULL pointer if they are unable to
         2809  +**          allocate memory memory to hold there normal return strings.
         2810  +**
         2811  +** {F13725} If the N parameter to [sqlite3_column_name(S,N)] or
         2812  +**          [sqlite3_column_name16(S,N)] is out of range, then the
         2813  +**          interfaces returns a NULL pointer.
         2814  +** 
         2815  +** {F13726} The strings returned by [sqlite3_column_name(S,N)] and
         2816  +**          [sqlite3_column_name16(S,N)] are valid until the next
         2817  +**          call to either routine with the same S and N parameters
         2818  +**          or until [sqlite3_finalize(S)] is called.
         2819  +**
         2820  +** {F13727} When a result column of a [SELECT] statement contains
         2821  +**          an AS clause, the name of that column is the indentifier
         2822  +**          to the right of the AS keyword.
  1805   2823   */
  1806   2824   const char *sqlite3_column_name(sqlite3_stmt*, int N);
  1807   2825   const void *sqlite3_column_name16(sqlite3_stmt*, int N);
  1808   2826   
  1809   2827   /*
  1810         -** CAPI3REF: Source Of Data In A Query Result
         2828  +** CAPI3REF: Source Of Data In A Query Result {F13740}
  1811   2829   **
  1812   2830   ** These routines provide a means to determine what column of what
  1813   2831   ** table in which database a result of a SELECT statement comes from.
  1814   2832   ** The name of the database or table or column can be returned as
  1815   2833   ** either a UTF8 or UTF16 string.  The _database_ routines return
  1816   2834   ** the database name, the _table_ routines return the table name, and
  1817   2835   ** the origin_ routines return the column name.
  1818   2836   ** The returned string is valid until
  1819         -** the [sqlite3_stmt | prepared statement] is destroyed using
         2837  +** the [prepared statement] is destroyed using
  1820   2838   ** [sqlite3_finalize()] or until the same information is requested
  1821   2839   ** again in a different encoding.
  1822   2840   **
  1823   2841   ** The names returned are the original un-aliased names of the
  1824   2842   ** database, table, and column.
  1825   2843   **
  1826         -** The first argument to the following calls is a 
  1827         -** [sqlite3_stmt | compiled SQL statement].
         2844  +** The first argument to the following calls is a [prepared statement].
  1828   2845   ** These functions return information about the Nth column returned by 
  1829   2846   ** the statement, where N is the second function argument.
  1830   2847   **
  1831   2848   ** If the Nth column returned by the statement is an expression
  1832   2849   ** or subquery and is not a column value, then all of these functions
  1833         -** return NULL. Otherwise, they return the 
         2850  +** return NULL.  These routine might also return NULL if a memory
         2851  +** allocation error occurs.  Otherwise, they return the 
  1834   2852   ** name of the attached database, table and column that query result
  1835   2853   ** column was extracted from.
  1836   2854   **
  1837         -** As with all other SQLite APIs, those postfixed with "16" return UTF-16
  1838         -** encoded strings, the other functions return UTF-8.
         2855  +** As with all other SQLite APIs, those postfixed with "16" return
         2856  +** UTF-16 encoded strings, the other functions return UTF-8. {END}
  1839   2857   **
  1840   2858   ** These APIs are only available if the library was compiled with the 
  1841   2859   ** SQLITE_ENABLE_COLUMN_METADATA preprocessor symbol defined.
  1842   2860   **
         2861  +** {U13751}
  1843   2862   ** If two or more threads call one or more of these routines against the same
  1844   2863   ** prepared statement and column at the same time then the results are
  1845   2864   ** undefined.
         2865  +**
         2866  +** INVARIANTS:
         2867  +**
         2868  +** {F13741} The [sqlite3_column_database_name(S,N)] interface returns either
         2869  +**          the UTF-8 zero-terminated name of the database from which the 
         2870  +**          Nth result column of [prepared statement] S 
         2871  +**          is extracted, or NULL if the the Nth column of S is a
         2872  +**          general expression or if unable to allocate memory
         2873  +**          to store the name.
         2874  +**          
         2875  +** {F13742} The [sqlite3_column_database_name16(S,N)] interface returns either
         2876  +**          the UTF-16 native byte order
         2877  +**          zero-terminated name of the database from which the 
         2878  +**          Nth result column of [prepared statement] S 
         2879  +**          is extracted, or NULL if the the Nth column of S is a
         2880  +**          general expression or if unable to allocate memory
         2881  +**          to store the name.
         2882  +**          
         2883  +** {F13743} The [sqlite3_column_table_name(S,N)] interface returns either
         2884  +**          the UTF-8 zero-terminated name of the table from which the 
         2885  +**          Nth result column of [prepared statement] S 
         2886  +**          is extracted, or NULL if the the Nth column of S is a
         2887  +**          general expression or if unable to allocate memory
         2888  +**          to store the name.
         2889  +**          
         2890  +** {F13744} The [sqlite3_column_table_name16(S,N)] interface returns either
         2891  +**          the UTF-16 native byte order
         2892  +**          zero-terminated name of the table from which the 
         2893  +**          Nth result column of [prepared statement] S 
         2894  +**          is extracted, or NULL if the the Nth column of S is a
         2895  +**          general expression or if unable to allocate memory
         2896  +**          to store the name.
         2897  +**          
         2898  +** {F13745} The [sqlite3_column_origin_name(S,N)] interface returns either
         2899  +**          the UTF-8 zero-terminated name of the table column from which the 
         2900  +**          Nth result column of [prepared statement] S 
         2901  +**          is extracted, or NULL if the the Nth column of S is a
         2902  +**          general expression or if unable to allocate memory
         2903  +**          to store the name.
         2904  +**          
         2905  +** {F13746} The [sqlite3_column_origin_name16(S,N)] interface returns either
         2906  +**          the UTF-16 native byte order
         2907  +**          zero-terminated name of the table column from which the 
         2908  +**          Nth result column of [prepared statement] S 
         2909  +**          is extracted, or NULL if the the Nth column of S is a
         2910  +**          general expression or if unable to allocate memory
         2911  +**          to store the name.
         2912  +**          
         2913  +** {F13748} The return values from
         2914  +**          [sqlite3_column_database_name|column metadata interfaces]
         2915  +**          are valid
         2916  +**          for the lifetime of the [prepared statement]
         2917  +**          or until the encoding is changed by another metadata
         2918  +**          interface call for the same prepared statement and column.
         2919  +**
         2920  +** LIMITATIONS:
         2921  +**
         2922  +** {U13751} If two or more threads call one or more
         2923  +**          [sqlite3_column_database_name|column metadata interfaces]
         2924  +**          the same [prepared statement] and result column
         2925  +**          at the same time then the results are undefined.
  1846   2926   */
  1847   2927   const char *sqlite3_column_database_name(sqlite3_stmt*,int);
  1848   2928   const void *sqlite3_column_database_name16(sqlite3_stmt*,int);
  1849   2929   const char *sqlite3_column_table_name(sqlite3_stmt*,int);
  1850   2930   const void *sqlite3_column_table_name16(sqlite3_stmt*,int);
  1851   2931   const char *sqlite3_column_origin_name(sqlite3_stmt*,int);
  1852   2932   const void *sqlite3_column_origin_name16(sqlite3_stmt*,int);
  1853   2933   
  1854   2934   /*
  1855         -** CAPI3REF: Declared Datatype Of A Query Result
         2935  +** CAPI3REF: Declared Datatype Of A Query Result {F13760}
  1856   2936   **
  1857         -** The first parameter is a [sqlite3_stmt | compiled SQL statement]. 
         2937  +** The first parameter is a [prepared statement]. 
  1858   2938   ** If this statement is a SELECT statement and the Nth column of the 
  1859         -** returned result set  of that SELECT is a table column (not an
         2939  +** returned result set of that SELECT is a table column (not an
  1860   2940   ** expression or subquery) then the declared type of the table
  1861         -** column is returned. If the Nth column of the result set is an
         2941  +** column is returned.  If the Nth column of the result set is an
  1862   2942   ** expression or subquery, then a NULL pointer is returned.
  1863         -** The returned string is always UTF-8 encoded. For example, in
  1864         -** the database schema:
         2943  +** The returned string is always UTF-8 encoded.  {END} 
         2944  +** For example, in the database schema:
  1865   2945   **
  1866   2946   ** CREATE TABLE t1(c1 VARIANT);
  1867   2947   **
  1868   2948   ** And the following statement compiled:
  1869   2949   **
  1870   2950   ** SELECT c1 + 1, c1 FROM t1;
  1871   2951   **
................................................................................
  1875   2955   **
  1876   2956   ** SQLite uses dynamic run-time typing.  So just because a column
  1877   2957   ** is declared to contain a particular type does not mean that the
  1878   2958   ** data stored in that column is of the declared type.  SQLite is
  1879   2959   ** strongly typed, but the typing is dynamic not static.  Type
  1880   2960   ** is associated with individual values, not with the containers
  1881   2961   ** used to hold those values.
         2962  +**
         2963  +** INVARIANTS:
         2964  +**
         2965  +** {F13761}  A successful call to [sqlite3_column_decltype(S,N)]
         2966  +**           returns a zero-terminated UTF-8 string containing the
         2967  +**           the declared datatype of the table column that appears
         2968  +**           as the Nth column (numbered from 0) of the result set to the
         2969  +**           [prepared statement] S.
         2970  +**
         2971  +** {F13762}  A successful call to [sqlite3_column_decltype16(S,N)]
         2972  +**           returns a zero-terminated UTF-16 native byte order string
         2973  +**           containing the declared datatype of the table column that appears
         2974  +**           as the Nth column (numbered from 0) of the result set to the
         2975  +**           [prepared statement] S.
         2976  +**
         2977  +** {F13763}  If N is less than 0 or N is greater than or equal to
         2978  +**           the number of columns in [prepared statement] S
         2979  +**           or if the Nth column of S is an expression or subquery rather
         2980  +**           than a table column or if a memory allocation failure
         2981  +**           occurs during encoding conversions, then
         2982  +**           calls to [sqlite3_column_decltype(S,N)] or
         2983  +**           [sqlite3_column_decltype16(S,N)] return NULL.
  1882   2984   */
  1883         -const char *sqlite3_column_decltype(sqlite3_stmt *, int i);
         2985  +const char *sqlite3_column_decltype(sqlite3_stmt*,int);
  1884   2986   const void *sqlite3_column_decltype16(sqlite3_stmt*,int);
  1885   2987   
  1886   2988   /* 
  1887         -** CAPI3REF:  Evaluate An SQL Statement
         2989  +** CAPI3REF:  Evaluate An SQL Statement {F13200}
  1888   2990   **
  1889         -** After an [sqlite3_stmt | SQL statement] has been prepared with a call
         2991  +** After an [prepared statement] has been prepared with a call
  1890   2992   ** to either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] or to one of
  1891   2993   ** the legacy interfaces [sqlite3_prepare()] or [sqlite3_prepare16()],
  1892   2994   ** then this function must be called one or more times to evaluate the 
  1893   2995   ** statement.
  1894   2996   **
  1895   2997   ** The details of the behavior of this sqlite3_step() interface depend
  1896   2998   ** on whether the statement was prepared using the newer "v2" interface
  1897   2999   ** [sqlite3_prepare_v2()] and [sqlite3_prepare16_v2()] or the older legacy
  1898   3000   ** interface [sqlite3_prepare()] and [sqlite3_prepare16()].  The use of the
  1899   3001   ** new "v2" interface is recommended for new applications but the legacy
  1900   3002   ** interface will continue to be supported.
  1901   3003   **
  1902         -** In the lagacy interface, the return value will be either [SQLITE_BUSY], 
         3004  +** In the legacy interface, the return value will be either [SQLITE_BUSY], 
  1903   3005   ** [SQLITE_DONE], [SQLITE_ROW], [SQLITE_ERROR], or [SQLITE_MISUSE].
  1904   3006   ** With the "v2" interface, any of the other [SQLITE_OK | result code]
  1905   3007   ** or [SQLITE_IOERR_READ | extended result code] might be returned as
  1906   3008   ** well.
  1907   3009   **
  1908   3010   ** [SQLITE_BUSY] means that the database engine was unable to acquire the
  1909   3011   ** database locks it needs to do its job.  If the statement is a COMMIT
................................................................................
  1925   3027   ** 
  1926   3028   ** [SQLITE_ERROR] means that a run-time error (such as a constraint
  1927   3029   ** violation) has occurred.  sqlite3_step() should not be called again on
  1928   3030   ** the VM. More information may be found by calling [sqlite3_errmsg()].
  1929   3031   ** With the legacy interface, a more specific error code (example:
  1930   3032   ** [SQLITE_INTERRUPT], [SQLITE_SCHEMA], [SQLITE_CORRUPT], and so forth)
  1931   3033   ** can be obtained by calling [sqlite3_reset()] on the
  1932         -** [sqlite3_stmt | prepared statement].  In the "v2" interface,
         3034  +** [prepared statement].  In the "v2" interface,
  1933   3035   ** the more specific error code is returned directly by sqlite3_step().
  1934   3036   **
  1935   3037   ** [SQLITE_MISUSE] means that the this routine was called inappropriately.
  1936         -** Perhaps it was called on a [sqlite3_stmt | prepared statement] that has
         3038  +** Perhaps it was called on a [prepared statement] that has
  1937   3039   ** already been [sqlite3_finalize | finalized] or on one that had 
  1938   3040   ** previously returned [SQLITE_ERROR] or [SQLITE_DONE].  Or it could
  1939   3041   ** be the case that the same database connection is being used by two or
  1940   3042   ** more threads at the same moment in time.
  1941   3043   **
  1942   3044   ** <b>Goofy Interface Alert:</b>
  1943   3045   ** In the legacy interface, 
  1944   3046   ** the sqlite3_step() API always returns a generic error code,
  1945   3047   ** [SQLITE_ERROR], following any error other than [SQLITE_BUSY]
  1946   3048   ** and [SQLITE_MISUSE].  You must call [sqlite3_reset()] or
  1947   3049   ** [sqlite3_finalize()] in order to find one of the specific
  1948         -** [SQLITE_ERROR | result codes] that better describes the error.
         3050  +** [error codes] that better describes the error.
  1949   3051   ** We admit that this is a goofy design.  The problem has been fixed
  1950   3052   ** with the "v2" interface.  If you prepare all of your SQL statements
  1951   3053   ** using either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] instead
  1952   3054   ** of the legacy [sqlite3_prepare()] and [sqlite3_prepare16()], then the 
  1953         -** more specific [SQLITE_ERROR | result codes] are returned directly
         3055  +** more specific [error codes] are returned directly
  1954   3056   ** by sqlite3_step().  The use of the "v2" interface is recommended.
         3057  +**
         3058  +** INVARIANTS:
         3059  +**
         3060  +** {F13202}  If [prepared statement] S is ready to be
         3061  +**           run, then [sqlite3_step(S)] advances that prepared statement
         3062  +**           until to completion or until it is ready to return another
         3063  +**           row of the result set or an interrupt or run-time error occurs.
         3064  +**
         3065  +** {F15304}  When a call to [sqlite3_step(S)] causes the 
         3066  +**           [prepared statement] S to run to completion,
         3067  +**           the function returns [SQLITE_DONE].
         3068  +**
         3069  +** {F15306}  When a call to [sqlite3_step(S)] stops because it is ready
         3070  +**           to return another row of the result set, it returns
         3071  +**           [SQLITE_ROW].
         3072  +**
         3073  +** {F15308}  If a call to [sqlite3_step(S)] encounters an
         3074  +**           [sqlite3_interrupt|interrupt] or a run-time error,
         3075  +**           it returns an appropraite error code that is not one of
         3076  +**           [SQLITE_OK], [SQLITE_ROW], or [SQLITE_DONE].
         3077  +**
         3078  +** {F15310}  If an [sqlite3_interrupt|interrupt] or run-time error
         3079  +**           occurs during a call to [sqlite3_step(S)]
         3080  +**           for a [prepared statement] S created using
         3081  +**           legacy interfaces [sqlite3_prepare()] or
         3082  +**           [sqlite3_prepare16()] then the function returns either
         3083  +**           [SQLITE_ERROR], [SQLITE_BUSY], or [SQLITE_MISUSE].
  1955   3084   */
  1956   3085   int sqlite3_step(sqlite3_stmt*);
  1957   3086   
  1958   3087   /*
  1959         -** CAPI3REF:
         3088  +** CAPI3REF: Number of columns in a result set {F13770}
  1960   3089   **
  1961   3090   ** Return the number of values in the current row of the result set.
  1962   3091   **
  1963         -** After a call to [sqlite3_step()] that returns [SQLITE_ROW], this routine
  1964         -** will return the same value as the [sqlite3_column_count()] function.
  1965         -** After [sqlite3_step()] has returned an [SQLITE_DONE], [SQLITE_BUSY], or
  1966         -** a [SQLITE_ERROR | error code], or before [sqlite3_step()] has been 
  1967         -** called on the [sqlite3_stmt | prepared statement] for the first time,
  1968         -** this routine returns zero.
         3092  +** INVARIANTS:
         3093  +**
         3094  +** {F13771}  After a call to [sqlite3_step(S)] that returns
         3095  +**           [SQLITE_ROW], the [sqlite3_data_count(S)] routine
         3096  +**           will return the same value as the
         3097  +**           [sqlite3_column_count(S)] function.
         3098  +**
         3099  +** {F13772}  After [sqlite3_step(S)] has returned any value other than
         3100  +**           [SQLITE_ROW] or before [sqlite3_step(S)] has been 
         3101  +**           called on the [prepared statement] for
         3102  +**           the first time since it was [sqlite3_prepare|prepared]
         3103  +**           or [sqlite3_reset|reset], the [sqlite3_data_count(S)]
         3104  +**           routine returns zero.
  1969   3105   */
  1970   3106   int sqlite3_data_count(sqlite3_stmt *pStmt);
  1971   3107   
  1972   3108   /*
  1973         -** CAPI3REF: Fundamental Datatypes
         3109  +** CAPI3REF: Fundamental Datatypes {F10265}
         3110  +** KEYWORDS: SQLITE_TEXT
  1974   3111   **
  1975         -** Every value in SQLite has one of five fundamental datatypes:
         3112  +** {F10266}Every value in SQLite has one of five fundamental datatypes:
  1976   3113   **
  1977   3114   ** <ul>
  1978   3115   ** <li> 64-bit signed integer
  1979   3116   ** <li> 64-bit IEEE floating point number
  1980   3117   ** <li> string
  1981   3118   ** <li> BLOB
  1982   3119   ** <li> NULL
  1983         -** </ul>
         3120  +** </ul> {END}
  1984   3121   **
  1985   3122   ** These constants are codes for each of those types.
  1986   3123   **
  1987   3124   ** Note that the SQLITE_TEXT constant was also used in SQLite version 2
  1988   3125   ** for a completely different meaning.  Software that links against both
  1989   3126   ** SQLite version 2 and SQLite version 3 should use SQLITE3_TEXT not
  1990   3127   ** SQLITE_TEXT.
................................................................................
  1997   3134   # undef SQLITE_TEXT
  1998   3135   #else
  1999   3136   # define SQLITE_TEXT     3
  2000   3137   #endif
  2001   3138   #define SQLITE3_TEXT     3
  2002   3139   
  2003   3140   /*
  2004         -** CAPI3REF: Results Values From A Query
         3141  +** CAPI3REF: Results Values From A Query {F13800}
         3142  +**
         3143  +** These routines form the "result set query" interface.
  2005   3144   **
  2006   3145   ** These routines return information about
  2007   3146   ** a single column of the current result row of a query.  In every
  2008   3147   ** case the first argument is a pointer to the 
  2009         -** [sqlite3_stmt | SQL statement] that is being
         3148  +** [prepared statement] that is being
  2010   3149   ** evaluated (the [sqlite3_stmt*] that was returned from 
  2011   3150   ** [sqlite3_prepare_v2()] or one of its variants) and
  2012   3151   ** the second argument is the index of the column for which information 
  2013   3152   ** should be returned.  The left-most column of the result set
  2014   3153   ** has an index of 0.
  2015   3154   **
  2016   3155   ** If the SQL statement is not currently point to a valid row, or if the
................................................................................
  2043   3182   ** [sqlite3_snprintf()] to convert that value to a UTF-8 string and returns
  2044   3183   ** the number of bytes in that string.
  2045   3184   ** The value returned does not include the zero terminator at the end
  2046   3185   ** of the string.  For clarity: the value returned is the number of
  2047   3186   ** bytes in the string, not the number of characters.
  2048   3187   **
  2049   3188   ** Strings returned by sqlite3_column_text() and sqlite3_column_text16(),
  2050         -** even zero-length strings, are always zero terminated.  The return
         3189  +** even empty strings, are always zero terminated.  The return
  2051   3190   ** value from sqlite3_column_blob() for a zero-length blob is an arbitrary
  2052   3191   ** pointer, possibly even a NULL pointer.
  2053   3192   **
  2054   3193   ** The sqlite3_column_bytes16() routine is similar to sqlite3_column_bytes()
  2055         -** but leaves the result in UTF-16 instead of UTF-8.  
         3194  +** but leaves the result in UTF-16 in native byte order instead of UTF-8.  
  2056   3195   ** The zero terminator is not included in this count.
         3196  +**
         3197  +** The object returned by [sqlite3_column_value()] is an
         3198  +** [unprotected sqlite3_value] object.  An unprotected sqlite3_value object
         3199  +** may only be used with [sqlite3_bind_value()] and [sqlite3_result_value()].
         3200  +** If the [unprotected sqlite3_value] object returned by
         3201  +** [sqlite3_column_value()] is used in any other way, including calls
         3202  +** to routines like 
         3203  +** [sqlite3_value_int()], [sqlite3_value_text()], or [sqlite3_value_bytes()],
         3204  +** then the behavior is undefined.
  2057   3205   **
  2058   3206   ** These routines attempt to convert the value where appropriate.  For
  2059   3207   ** example, if the internal representation is FLOAT and a text result
  2060   3208   ** is requested, [sqlite3_snprintf()] is used internally to do the conversion
  2061   3209   ** automatically.  The following table details the conversions that
  2062   3210   ** are applied:
  2063   3211   **
................................................................................
  2140   3288   ** [sqlite3_free()].
  2141   3289   **
  2142   3290   ** If a memory allocation error occurs during the evaluation of any
  2143   3291   ** of these routines, a default value is returned.  The default value
  2144   3292   ** is either the integer 0, the floating point number 0.0, or a NULL
  2145   3293   ** pointer.  Subsequent calls to [sqlite3_errcode()] will return
  2146   3294   ** [SQLITE_NOMEM].
         3295  +**
         3296  +** INVARIANTS:
         3297  +**
         3298  +** {F13803} The [sqlite3_column_blob(S,N)] interface converts the
         3299  +**          Nth column in the current row of the result set for
         3300  +**          [prepared statement] S into a blob and then returns a
         3301  +**          pointer to the converted value.
         3302  +**
         3303  +** {F13806} The [sqlite3_column_bytes(S,N)] interface returns the
         3304  +**          number of bytes in the blob or string (exclusive of the
         3305  +**          zero terminator on the string) that was returned by the
         3306  +**          most recent call to [sqlite3_column_blob(S,N)] or
         3307  +**          [sqlite3_column_text(S,N)].
         3308  +**
         3309  +** {F13809} The [sqlite3_column_bytes16(S,N)] interface returns the
         3310  +**          number of bytes in the string (exclusive of the
         3311  +**          zero terminator on the string) that was returned by the
         3312  +**          most recent call to [sqlite3_column_text16(S,N)].
         3313  +**
         3314  +** {F13812} The [sqlite3_column_double(S,N)] interface converts the
         3315  +**          Nth column in the current row of the result set for
         3316  +**          [prepared statement] S into a floating point value and
         3317  +**          returns a copy of that value.
         3318  +**
         3319  +** {F13815} The [sqlite3_column_int(S,N)] interface converts the
         3320  +**          Nth column in the current row of the result set for
         3321  +**          [prepared statement] S into a 64-bit signed integer and
         3322  +**          returns the lower 32 bits of that integer.
         3323  +**
         3324  +** {F13818} The [sqlite3_column_int64(S,N)] interface converts the
         3325  +**          Nth column in the current row of the result set for
         3326  +**          [prepared statement] S into a 64-bit signed integer and
         3327  +**          returns a copy of that integer.
         3328  +**
         3329  +** {F13821} The [sqlite3_column_text(S,N)] interface converts the
         3330  +**          Nth column in the current row of the result set for
         3331  +**          [prepared statement] S into a zero-terminated UTF-8 
         3332  +**          string and returns a pointer to that string.
         3333  +**
         3334  +** {F13824} The [sqlite3_column_text16(S,N)] interface converts the
         3335  +**          Nth column in the current row of the result set for
         3336  +**          [prepared statement] S into a zero-terminated 2-byte
         3337  +**          aligned UTF-16 native byte order
         3338  +**          string and returns a pointer to that string.
         3339  +**
         3340  +** {F13827} The [sqlite3_column_type(S,N)] interface returns
         3341  +**          one of [SQLITE_NULL], [SQLITE_INTEGER], [SQLITE_FLOAT],
         3342  +**          [SQLITE_TEXT], or [SQLITE_BLOB] as appropriate for
         3343  +**          the Nth column in the current row of the result set for
         3344  +**          [prepared statement] S.
         3345  +**
         3346  +** {F13830} The [sqlite3_column_value(S,N)] interface returns a
         3347  +**          pointer to an [unprotected sqlite3_value] object for the
         3348  +**          Nth column in the current row of the result set for
         3349  +**          [prepared statement] S.
  2147   3350   */
  2148   3351   const void *sqlite3_column_blob(sqlite3_stmt*, int iCol);
  2149   3352   int sqlite3_column_bytes(sqlite3_stmt*, int iCol);
  2150   3353   int sqlite3_column_bytes16(sqlite3_stmt*, int iCol);
  2151   3354   double sqlite3_column_double(sqlite3_stmt*, int iCol);
  2152   3355   int sqlite3_column_int(sqlite3_stmt*, int iCol);
  2153   3356   sqlite3_int64 sqlite3_column_int64(sqlite3_stmt*, int iCol);
  2154   3357   const unsigned char *sqlite3_column_text(sqlite3_stmt*, int iCol);
  2155   3358   const void *sqlite3_column_text16(sqlite3_stmt*, int iCol);
  2156   3359   int sqlite3_column_type(sqlite3_stmt*, int iCol);
  2157   3360   sqlite3_value *sqlite3_column_value(sqlite3_stmt*, int iCol);
  2158   3361   
  2159   3362   /*
  2160         -** CAPI3REF: Destroy A Prepared Statement Object
         3363  +** CAPI3REF: Destroy A Prepared Statement Object {F13300}
  2161   3364   **
  2162   3365   ** The sqlite3_finalize() function is called to delete a 
  2163         -** [sqlite3_stmt | compiled SQL statement]. If the statement was
         3366  +** [prepared statement]. If the statement was
  2164   3367   ** executed successfully, or not executed at all, then SQLITE_OK is returned.
  2165   3368   ** If execution of the statement failed then an 
  2166         -** [SQLITE_ERROR | error code] or [SQLITE_IOERR_READ | extended error code]
         3369  +** [error code] or [extended error code]
  2167   3370   ** is returned. 
  2168   3371   **
  2169   3372   ** This routine can be called at any point during the execution of the
  2170         -** [sqlite3_stmt | virtual machine].  If the virtual machine has not 
         3373  +** [prepared statement].  If the virtual machine has not 
  2171   3374   ** completed execution when this routine is called, that is like
  2172   3375   ** encountering an error or an interrupt.  (See [sqlite3_interrupt()].) 
  2173   3376   ** Incomplete updates may be rolled back and transactions cancelled,  
  2174   3377   ** depending on the circumstances, and the 
  2175         -** [SQLITE_ERROR | result code] returned will be [SQLITE_ABORT].
         3378  +** [error code] returned will be [SQLITE_ABORT].
         3379  +**
         3380  +** INVARIANTS:
         3381  +**
         3382  +** {F11302} The [sqlite3_finalize(S)] interface destroys the
         3383  +**          [prepared statement] S and releases all
         3384  +**          memory and file resources held by that object.
         3385  +**
         3386  +** {F11304} If the most recent call to [sqlite3_step(S)] for the
         3387  +**          [prepared statement] S returned an error,
         3388  +**          then [sqlite3_finalize(S)] returns that same error.
  2176   3389   */
  2177   3390   int sqlite3_finalize(sqlite3_stmt *pStmt);
  2178   3391   
  2179   3392   /*
  2180         -** CAPI3REF: Reset A Prepared Statement Object
         3393  +** CAPI3REF: Reset A Prepared Statement Object {F13330}
  2181   3394   **
  2182   3395   ** The sqlite3_reset() function is called to reset a 
  2183         -** [sqlite3_stmt | compiled SQL statement] object.
  2184         -** back to it's initial state, ready to be re-executed.
         3396  +** [prepared statement] object.
         3397  +** back to its initial state, ready to be re-executed.
  2185   3398   ** Any SQL statement variables that had values bound to them using
  2186   3399   ** the [sqlite3_bind_blob | sqlite3_bind_*() API] retain their values.
  2187   3400   ** Use [sqlite3_clear_bindings()] to reset the bindings.
         3401  +**
         3402  +** {F11332} The [sqlite3_reset(S)] interface resets the [prepared statement] S
         3403  +**          back to the beginning of its program.
         3404  +**
         3405  +** {F11334} If the most recent call to [sqlite3_step(S)] for 
         3406  +**          [prepared statement] S returned [SQLITE_ROW] or [SQLITE_DONE],
         3407  +**          or if [sqlite3_step(S)] has never before been called on S,
         3408  +**          then [sqlite3_reset(S)] returns [SQLITE_OK].
         3409  +**
         3410  +** {F11336} If the most recent call to [sqlite3_step(S)] for
         3411  +**          [prepared statement] S indicated an error, then
         3412  +**          [sqlite3_reset(S)] returns an appropriate [error code].
         3413  +**
         3414  +** {F11338} The [sqlite3_reset(S)] interface does not change the values
         3415  +**          of any [sqlite3_bind_blob|bindings] on [prepared statement] S.
  2188   3416   */
  2189   3417   int sqlite3_reset(sqlite3_stmt *pStmt);
  2190   3418   
  2191   3419   /*
  2192         -** CAPI3REF: Create Or Redefine SQL Functions
         3420  +** CAPI3REF: Create Or Redefine SQL Functions {F16100}
         3421  +** KEYWORDS: {function creation routines} 
  2193   3422   **
  2194         -** The following two functions are used to add SQL functions or aggregates
         3423  +** These two functions (collectively known as
         3424  +** "function creation routines") are used to add SQL functions or aggregates
  2195   3425   ** or to redefine the behavior of existing SQL functions or aggregates.  The
  2196   3426   ** difference only between the two is that the second parameter, the
  2197   3427   ** name of the (scalar) function or aggregate, is encoded in UTF-8 for
  2198   3428   ** sqlite3_create_function() and UTF-16 for sqlite3_create_function16().
  2199   3429   **
  2200         -** The first argument is the [sqlite3 | database handle] that holds the
  2201         -** SQL function or aggregate is to be added or redefined. If a single
  2202         -** program uses more than one database handle internally, then SQL
  2203         -** functions or aggregates must be added individually to each database
  2204         -** handle with which they will be used.
         3430  +** The first parameter is the [database connection] to which the SQL
         3431  +** function is to be added.  If a single
         3432  +** program uses more than one [database connection] internally, then SQL
         3433  +** functions must be added individually to each [database connection].
  2205   3434   **
  2206   3435   ** The second parameter is the name of the SQL function to be created
  2207   3436   ** or redefined.
  2208   3437   ** The length of the name is limited to 255 bytes, exclusive of the 
  2209   3438   ** zero-terminator.  Note that the name length limit is in bytes, not
  2210   3439   ** characters.  Any attempt to create a function with a longer name
  2211   3440   ** will result in an SQLITE_ERROR error.
................................................................................
  2241   3470   ** callback.
  2242   3471   **
  2243   3472   ** It is permitted to register multiple implementations of the same
  2244   3473   ** functions with the same name but with either differing numbers of
  2245   3474   ** arguments or differing perferred text encodings.  SQLite will use
  2246   3475   ** the implementation most closely matches the way in which the
  2247   3476   ** SQL function is used.
         3477  +**
         3478  +** INVARIANTS:
         3479  +**
         3480  +** {F16103} The [sqlite3_create_function16()] interface behaves exactly
         3481  +**          like [sqlite3_create_function()] in every way except that it
         3482  +**          interprets the zFunctionName argument as
         3483  +**          zero-terminated UTF-16 native byte order instead of as a
         3484  +**          zero-terminated UTF-8.
         3485  +**
         3486  +** {F16106} A successful invocation of
         3487  +**          the [sqlite3_create_function(D,X,N,E,...)] interface registers
         3488  +**          or replaces callback functions in [database connection] D
         3489  +**          used to implement the SQL function named X with N parameters
         3490  +**          and having a perferred text encoding of E.
         3491  +**
         3492  +** {F16109} A successful call to [sqlite3_create_function(D,X,N,E,P,F,S,L)]
         3493  +**          replaces the P, F, S, and L values from any prior calls with
         3494  +**          the same D, X, N, and E values.
         3495  +**
         3496  +** {F16112} The [sqlite3_create_function(D,X,...)] interface fails with
         3497  +**          a return code of [SQLITE_ERROR] if the SQL function name X is
         3498  +**          longer than 255 bytes exclusive of the zero terminator.
         3499  +**
         3500  +** {F16118} Either F must be NULL and S and L are non-NULL or else F
         3501  +**          is non-NULL and S and L are NULL, otherwise
         3502  +**          [sqlite3_create_function(D,X,N,E,P,F,S,L)] returns [SQLITE_ERROR].
         3503  +**
         3504  +** {F16121} The [sqlite3_create_function(D,...)] interface fails with an
         3505  +**          error code of [SQLITE_BUSY] if there exist [prepared statements]
         3506  +**          associated with the [database connection] D.
         3507  +**
         3508  +** {F16124} The [sqlite3_create_function(D,X,N,...)] interface fails with an
         3509  +**          error code of [SQLITE_ERROR] if parameter N (specifying the number
         3510  +**          of arguments to the SQL function being registered) is less
         3511  +**          than -1 or greater than 127.
         3512  +**
         3513  +** {F16127} When N is non-negative, the [sqlite3_create_function(D,X,N,...)]
         3514  +**          interface causes callbacks to be invoked for the SQL function
         3515  +**          named X when the number of arguments to the SQL function is
         3516  +**          exactly N.
         3517  +**
         3518  +** {F16130} When N is -1, the [sqlite3_create_function(D,X,N,...)]
         3519  +**          interface causes callbacks to be invoked for the SQL function
         3520  +**          named X with any number of arguments.
         3521  +**
         3522  +** {F16133} When calls to [sqlite3_create_function(D,X,N,...)]
         3523  +**          specify multiple implementations of the same function X
         3524  +**          and when one implementation has N>=0 and the other has N=(-1)
         3525  +**          the implementation with a non-zero N is preferred.
         3526  +**
         3527  +** {F16136} When calls to [sqlite3_create_function(D,X,N,E,...)]
         3528  +**          specify multiple implementations of the same function X with
         3529  +**          the same number of arguments N but with different
         3530  +**          encodings E, then the implementation where E matches the
         3531  +**          database encoding is preferred.
         3532  +**
         3533  +** {F16139} For an aggregate SQL function created using
         3534  +**          [sqlite3_create_function(D,X,N,E,P,0,S,L)] the finializer
         3535  +**          function L will always be invoked exactly once if the
         3536  +**          step function S is called one or more times.
         3537  +**
         3538  +** {F16142} When SQLite invokes either the xFunc or xStep function of
         3539  +**          an application-defined SQL function or aggregate created
         3540  +**          by [sqlite3_create_function()] or [sqlite3_create_function16()],
         3541  +**          then the array of [sqlite3_value] objects passed as the
         3542  +**          third parameter are always [protected sqlite3_value] objects.
  2248   3543   */
  2249   3544   int sqlite3_create_function(
  2250         -  sqlite3 *,
         3545  +  sqlite3 *db,
  2251   3546     const char *zFunctionName,
  2252   3547     int nArg,
  2253   3548     int eTextRep,
  2254         -  void*,
         3549  +  void *pApp,
  2255   3550     void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
  2256   3551     void (*xStep)(sqlite3_context*,int,sqlite3_value**),
  2257   3552     void (*xFinal)(sqlite3_context*)
  2258   3553   );
  2259   3554   int sqlite3_create_function16(
  2260         -  sqlite3*,
         3555  +  sqlite3 *db,
  2261   3556     const void *zFunctionName,
  2262   3557     int nArg,
  2263   3558     int eTextRep,
  2264         -  void*,
         3559  +  void *pApp,
  2265   3560     void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
  2266   3561     void (*xStep)(sqlite3_context*,int,sqlite3_value**),
  2267   3562     void (*xFinal)(sqlite3_context*)
  2268   3563   );
  2269   3564   
  2270   3565   /*
  2271         -** CAPI3REF: Text Encodings
         3566  +** CAPI3REF: Text Encodings {F10267}
  2272   3567   **
  2273   3568   ** These constant define integer codes that represent the various
  2274   3569   ** text encodings supported by SQLite.
  2275   3570   */
  2276   3571   #define SQLITE_UTF8           1
  2277   3572   #define SQLITE_UTF16LE        2
  2278   3573   #define SQLITE_UTF16BE        3
................................................................................
  2293   3588   int sqlite3_expired(sqlite3_stmt*);
  2294   3589   int sqlite3_transfer_bindings(sqlite3_stmt*, sqlite3_stmt*);
  2295   3590   int sqlite3_global_recover(void);
  2296   3591   void sqlite3_thread_cleanup(void);
  2297   3592   int sqlite3_memory_alarm(void(*)(void*,sqlite3_int64,int),void*,sqlite3_int64);
  2298   3593   
  2299   3594   /*
  2300         -** CAPI3REF: Obtaining SQL Function Parameter Values
         3595  +** CAPI3REF: Obtaining SQL Function Parameter Values {F15100}
  2301   3596   **
  2302   3597   ** The C-language implementation of SQL functions and aggregates uses
  2303   3598   ** this set of interface routines to access the parameter values on
  2304   3599   ** the function or aggregate.
  2305   3600   **
  2306   3601   ** The xFunc (for scalar functions) or xStep (for aggregates) parameters
  2307   3602   ** to [sqlite3_create_function()] and [sqlite3_create_function16()]
  2308   3603   ** define callbacks that implement the SQL functions and aggregates.
  2309   3604   ** The 4th parameter to these callbacks is an array of pointers to
  2310         -** [sqlite3_value] objects.  There is one [sqlite3_value] object for
         3605  +** [protected sqlite3_value] objects.  There is one [sqlite3_value] object for
  2311   3606   ** each parameter to the SQL function.  These routines are used to
  2312   3607   ** extract values from the [sqlite3_value] objects.
         3608  +**
         3609  +** These routines work only with [protected sqlite3_value] objects.
         3610  +** Any attempt to use these routines on an [unprotected sqlite3_value]
         3611  +** object results in undefined behavior.
  2313   3612   **
  2314   3613   ** These routines work just like the corresponding 
  2315   3614   ** [sqlite3_column_blob | sqlite3_column_* routines] except that 
  2316         -** these routines take a single [sqlite3_value*] pointer instead
  2317         -** of an [sqlite3_stmt*] pointer and an integer column number.
         3615  +** these routines take a single [protected sqlite3_value] object pointer
         3616  +** instead of an [sqlite3_stmt*] pointer and an integer column number.
  2318   3617   **
  2319   3618   ** The sqlite3_value_text16() interface extracts a UTF16 string
  2320   3619   ** in the native byte-order of the host machine.  The
  2321   3620   ** sqlite3_value_text16be() and sqlite3_value_text16le() interfaces
  2322   3621   ** extract UTF16 strings as big-endian and little-endian respectively.
  2323   3622   **
  2324   3623   ** The sqlite3_value_numeric_type() interface attempts to apply
  2325   3624   ** numeric affinity to the value.  This means that an attempt is
  2326   3625   ** made to convert the value to an integer or floating point.  If
  2327         -** such a conversion is possible without loss of information (in order
  2328         -** words if the value is original a string that looks like a number)
  2329         -** then it is done.  Otherwise no conversion occurs.  The 
         3626  +** such a conversion is possible without loss of information (in other
         3627  +** words if the value is a string that looks like a number)
         3628  +** then the conversion is done.  Otherwise no conversion occurs.  The 
  2330   3629   ** [SQLITE_INTEGER | datatype] after conversion is returned.
  2331   3630   **
  2332   3631   ** Please pay particular attention to the fact that the pointer that
  2333   3632   ** is returned from [sqlite3_value_blob()], [sqlite3_value_text()], or
  2334   3633   ** [sqlite3_value_text16()] can be invalidated by a subsequent call to
  2335   3634   ** [sqlite3_value_bytes()], [sqlite3_value_bytes16()], [sqlite3_value_text()],
  2336   3635   ** or [sqlite3_value_text16()].  
  2337   3636   **
  2338   3637   ** These routines must be called from the same thread as
  2339         -** the SQL function that supplied the sqlite3_value* parameters.
  2340         -** Or, if the sqlite3_value* argument comes from the [sqlite3_column_value()]
  2341         -** interface, then these routines should be called from the same thread
  2342         -** that ran [sqlite3_column_value()].
         3638  +** the SQL function that supplied the [sqlite3_value*] parameters.
         3639  +**
         3640  +**
         3641  +** INVARIANTS:
         3642  +**
         3643  +** {F15103} The [sqlite3_value_blob(V)] interface converts the
         3644  +**          [protected sqlite3_value] object V into a blob and then returns a
         3645  +**          pointer to the converted value.
         3646  +**
         3647  +** {F15106} The [sqlite3_value_bytes(V)] interface returns the
         3648  +**          number of bytes in the blob or string (exclusive of the
         3649  +**          zero terminator on the string) that was returned by the
         3650  +**          most recent call to [sqlite3_value_blob(V)] or
         3651  +**          [sqlite3_value_text(V)].
         3652  +**
         3653  +** {F15109} The [sqlite3_value_bytes16(V)] interface returns the
         3654  +**          number of bytes in the string (exclusive of the
         3655  +**          zero terminator on the string) that was returned by the
         3656  +**          most recent call to [sqlite3_value_text16(V)],
         3657  +**          [sqlite3_value_text16be(V)], or [sqlite3_value_text16le(V)].
         3658  +**
         3659  +** {F15112} The [sqlite3_value_double(V)] interface converts the
         3660  +**          [protected sqlite3_value] object V into a floating point value and
         3661  +**          returns a copy of that value.
         3662  +**
         3663  +** {F15115} The [sqlite3_value_int(V)] interface converts the
         3664  +**          [protected sqlite3_value] object V into a 64-bit signed integer and
         3665  +**          returns the lower 32 bits of that integer.
         3666  +**
         3667  +** {F15118} The [sqlite3_value_int64(V)] interface converts the
         3668  +**          [protected sqlite3_value] object V into a 64-bit signed integer and
         3669  +**          returns a copy of that integer.
         3670  +**
         3671  +** {F15121} The [sqlite3_value_text(V)] interface converts the
         3672  +**          [protected sqlite3_value] object V into a zero-terminated UTF-8 
         3673  +**          string and returns a pointer to that string.
         3674  +**
         3675  +** {F15124} The [sqlite3_value_text16(V)] interface converts the
         3676  +**          [protected sqlite3_value] object V into a zero-terminated 2-byte
         3677  +**          aligned UTF-16 native byte order
         3678  +**          string and returns a pointer to that string.
         3679  +**
         3680  +** {F15127} The [sqlite3_value_text16be(V)] interface converts the
         3681  +**          [protected sqlite3_value] object V into a zero-terminated 2-byte
         3682  +**          aligned UTF-16 big-endian
         3683  +**          string and returns a pointer to that string.
         3684  +**
         3685  +** {F15130} The [sqlite3_value_text16le(V)] interface converts the
         3686  +**          [protected sqlite3_value] object V into a zero-terminated 2-byte
         3687  +**          aligned UTF-16 little-endian
         3688  +**          string and returns a pointer to that string.
         3689  +**
         3690  +** {F15133} The [sqlite3_value_type(V)] interface returns
         3691  +**          one of [SQLITE_NULL], [SQLITE_INTEGER], [SQLITE_FLOAT],
         3692  +**          [SQLITE_TEXT], or [SQLITE_BLOB] as appropriate for
         3693  +**          the [sqlite3_value] object V.
         3694  +**
         3695  +** {F15136} The [sqlite3_value_numeric_type(V)] interface converts
         3696  +**          the [protected sqlite3_value] object V into either an integer or
         3697  +**          a floating point value if it can do so without loss of
         3698  +**          information, and returns one of [SQLITE_NULL],
         3699  +**          [SQLITE_INTEGER], [SQLITE_FLOAT], [SQLITE_TEXT], or
         3700  +**          [SQLITE_BLOB] as appropriate for
         3701  +**          the [protected sqlite3_value] object V after the conversion attempt.
  2343   3702   */
  2344   3703   const void *sqlite3_value_blob(sqlite3_value*);
  2345   3704   int sqlite3_value_bytes(sqlite3_value*);
  2346   3705   int sqlite3_value_bytes16(sqlite3_value*);
  2347   3706   double sqlite3_value_double(sqlite3_value*);
  2348   3707   int sqlite3_value_int(sqlite3_value*);
  2349   3708   sqlite3_int64 sqlite3_value_int64(sqlite3_value*);
................................................................................
  2351   3710   const void *sqlite3_value_text16(sqlite3_value*);
  2352   3711   const void *sqlite3_value_text16le(sqlite3_value*);
  2353   3712   const void *sqlite3_value_text16be(sqlite3_value*);
  2354   3713   int sqlite3_value_type(sqlite3_value*);
  2355   3714   int sqlite3_value_numeric_type(sqlite3_value*);
  2356   3715   
  2357   3716   /*
  2358         -** CAPI3REF: Obtain Aggregate Function Context
         3717  +** CAPI3REF: Obtain Aggregate Function Context {F16210}
  2359   3718   **
  2360   3719   ** The implementation of aggregate SQL functions use this routine to allocate
  2361         -** a structure for storing their state.  The first time this routine
  2362         -** is called for a particular aggregate, a new structure of size nBytes
  2363         -** is allocated, zeroed, and returned.  On subsequent calls (for the
  2364         -** same aggregate instance) the same buffer is returned.  The implementation
         3720  +** a structure for storing their state.  
         3721  +** The first time the sqlite3_aggregate_context() routine is
         3722  +** is called for a particular aggregate, SQLite allocates nBytes of memory
         3723  +** zeros that memory, and returns a pointer to it.
         3724  +** On second and subsequent calls to sqlite3_aggregate_context()
         3725  +** for the same aggregate function index, the same buffer is returned.
         3726  +** The implementation
  2365   3727   ** of the aggregate can use the returned buffer to accumulate data.
  2366   3728   **
  2367         -** The buffer allocated is freed automatically by SQLite whan the aggregate
         3729  +** SQLite automatically frees the allocated buffer when the aggregate
  2368   3730   ** query concludes.
  2369   3731   **
  2370   3732   ** The first parameter should be a copy of the 
  2371   3733   ** [sqlite3_context | SQL function context] that is the first
  2372   3734   ** parameter to the callback routine that implements the aggregate
  2373   3735   ** function.
  2374   3736   **
  2375   3737   ** This routine must be called from the same thread in which
  2376   3738   ** the aggregate SQL function is running.
         3739  +**
         3740  +** INVARIANTS:
         3741  +**
         3742  +** {F16211} The first invocation of [sqlite3_aggregate_context(C,N)] for
         3743  +**          a particular instance of an aggregate function (for a particular
         3744  +**          context C) causes SQLite to allocation N bytes of memory,
         3745  +**          zero that memory, and return a pointer to the allocationed
         3746  +**          memory.
         3747  +**
         3748  +** {F16213} If a memory allocation error occurs during
         3749  +**          [sqlite3_aggregate_context(C,N)] then the function returns 0.
         3750  +**
         3751  +** {F16215} Second and subsequent invocations of
         3752  +**          [sqlite3_aggregate_context(C,N)] for the same context pointer C
         3753  +**          ignore the N parameter and return a pointer to the same
         3754  +**          block of memory returned by the first invocation.
         3755  +**
         3756  +** {F16217} The memory allocated by [sqlite3_aggregate_context(C,N)] is
         3757  +**          automatically freed on the next call to [sqlite3_reset()]
         3758  +**          or [sqlite3_finalize()] for the [prepared statement] containing
         3759  +**          the aggregate function associated with context C.
  2377   3760   */
  2378   3761   void *sqlite3_aggregate_context(sqlite3_context*, int nBytes);
  2379   3762   
  2380   3763   /*
  2381         -** CAPI3REF: User Data For Functions
         3764  +** CAPI3REF: User Data For Functions {F16240}
  2382   3765   **
  2383         -** The pUserData parameter to the [sqlite3_create_function()]
  2384         -** and [sqlite3_create_function16()] routines
  2385         -** used to register user functions is available to
  2386         -** the implementation of the function using this call.
         3766  +** The sqlite3_user_data() interface returns a copy of
         3767  +** the pointer that was the pUserData parameter (the 5th parameter)
         3768  +** of the the [sqlite3_create_function()]
         3769  +** and [sqlite3_create_function16()] routines that originally
         3770  +** registered the application defined function. {END}
  2387   3771   **
  2388   3772   ** This routine must be called from the same thread in which
  2389         -** the SQL function is running.
         3773  +** the application-defined function is running.
         3774  +**
         3775  +** INVARIANTS:
         3776  +**
         3777  +** {F16243} The [sqlite3_user_data(C)] interface returns a copy of the
         3778  +**          P pointer from the [sqlite3_create_function(D,X,N,E,P,F,S,L)]
         3779  +**          or [sqlite3_create_function16(D,X,N,E,P,F,S,L)] call that
         3780  +**          registered the SQL function associated with 
         3781  +**          [sqlite3_context] C.
  2390   3782   */
  2391   3783   void *sqlite3_user_data(sqlite3_context*);
  2392   3784   
  2393   3785   /*
  2394         -** CAPI3REF: Function Auxiliary Data
         3786  +** CAPI3REF: Database Connection For Functions {F16250}
         3787  +**
         3788  +** The sqlite3_context_db_handle() interface returns a copy of
         3789  +** the pointer to the [database connection] (the 1st parameter)
         3790  +** of the the [sqlite3_create_function()]
         3791  +** and [sqlite3_create_function16()] routines that originally
         3792  +** registered the application defined function.
         3793  +**
         3794  +** INVARIANTS:
         3795  +**
         3796  +** {F16253} The [sqlite3_context_db_handle(C)] interface returns a copy of the
         3797  +**          D pointer from the [sqlite3_create_function(D,X,N,E,P,F,S,L)]
         3798  +**          or [sqlite3_create_function16(D,X,N,E,P,F,S,L)] call that
         3799  +**          registered the SQL function associated with 
         3800  +**          [sqlite3_context] C.
         3801  +*/
         3802  +sqlite3 *sqlite3_context_db_handle(sqlite3_context*);
         3803  +
         3804  +/*
         3805  +** CAPI3REF: Function Auxiliary Data {F16270}
  2395   3806   **
  2396   3807   ** The following two functions may be used by scalar SQL functions to
  2397   3808   ** associate meta-data with argument values. If the same value is passed to
  2398   3809   ** multiple invocations of the same SQL function during query execution, under
  2399   3810   ** some circumstances the associated meta-data may be preserved. This may
  2400   3811   ** be used, for example, to add a regular-expression matching scalar
  2401   3812   ** function. The compiled version of the regular expression is stored as
  2402   3813   ** meta-data associated with the SQL value passed as the regular expression
  2403   3814   ** pattern.  The compiled regular expression can be reused on multiple
  2404   3815   ** invocations of the same function so that the original pattern string
  2405   3816   ** does not need to be recompiled on each invocation.
  2406   3817   **
  2407   3818   ** The sqlite3_get_auxdata() interface returns a pointer to the meta-data
  2408         -** associated with the Nth argument value to the current SQL function
  2409         -** call, where N is the second parameter. If no meta-data has been set for
  2410         -** that value, then a NULL pointer is returned.
         3819  +** associated by the sqlite3_set_auxdata() function with the Nth argument
         3820  +** value to the application-defined function.
         3821  +** If no meta-data has been ever been set for the Nth
         3822  +** argument of the function, or if the cooresponding function parameter
         3823  +** has changed since the meta-data was set, then sqlite3_get_auxdata()
         3824  +** returns a NULL pointer.
  2411   3825   **
  2412         -** The sqlite3_set_auxdata() is used to associate meta-data with an SQL
  2413         -** function argument. The third parameter is a pointer to the meta-data
  2414         -** to be associated with the Nth user function argument value. The fourth
  2415         -** parameter specifies a destructor that will be called on the meta-
  2416         -** data pointer to release it when it is no longer required. If the 
  2417         -** destructor is NULL, it is not invoked.
         3826  +** The sqlite3_set_auxdata() interface saves the meta-data
         3827  +** pointed to by its 3rd parameter as the meta-data for the N-th
         3828  +** argument of the application-defined function.  Subsequent
         3829  +** calls to sqlite3_get_auxdata() might return this data, if it has
         3830  +** not been destroyed. 
         3831  +** If it is not NULL, SQLite will invoke the destructor 
         3832  +** function given by the 4th parameter to sqlite3_set_auxdata() on
         3833  +** the meta-data when the corresponding function parameter changes
         3834  +** or when the SQL statement completes, whichever comes first.
         3835  +**
         3836  +** SQLite is free to call the destructor and drop meta-data on
         3837  +** any parameter of any function at any time.  The only guarantee
         3838  +** is that the destructor will be called before the metadata is
         3839  +** dropped.
  2418   3840   **
  2419   3841   ** In practice, meta-data is preserved between function calls for
  2420   3842   ** expressions that are constant at compile time. This includes literal
  2421   3843   ** values and SQL variables.
  2422   3844   **
  2423   3845   ** These routines must be called from the same thread in which
  2424   3846   ** the SQL function is running.
         3847  +**
         3848  +** INVARIANTS:
         3849  +**
         3850  +** {F16272} The [sqlite3_get_auxdata(C,N)] interface returns a pointer
         3851  +**          to metadata associated with the Nth parameter of the SQL function
         3852  +**          whose context is C, or NULL if there is no metadata associated
         3853  +**          with that parameter.
         3854  +**
         3855  +** {F16274} The [sqlite3_set_auxdata(C,N,P,D)] interface assigns a metadata
         3856  +**          pointer P to the Nth parameter of the SQL function with context
         3857  +**          C.
         3858  +**
         3859  +** {F16276} SQLite will invoke the destructor D with a single argument
         3860  +**          which is the metadata pointer P following a call to
         3861  +**          [sqlite3_set_auxdata(C,N,P,D)] when SQLite ceases to hold
         3862  +**          the metadata.
         3863  +**
         3864  +** {F16277} SQLite ceases to hold metadata for an SQL function parameter
         3865  +**          when the value of that parameter changes.
         3866  +**
         3867  +** {F16278} When [sqlite3_set_auxdata(C,N,P,D)] is invoked, the destructor
         3868  +**          is called for any prior metadata associated with the same function
         3869  +**          context C and parameter N.
         3870  +**
         3871  +** {F16279} SQLite will call destructors for any metadata it is holding
         3872  +**          in a particular [prepared statement] S when either
         3873  +**          [sqlite3_reset(S)] or [sqlite3_finalize(S)] is called.
  2425   3874   */
  2426         -void *sqlite3_get_auxdata(sqlite3_context*, int);
  2427         -void sqlite3_set_auxdata(sqlite3_context*, int, void*, void (*)(void*));
         3875  +void *sqlite3_get_auxdata(sqlite3_context*, int N);
         3876  +void sqlite3_set_auxdata(sqlite3_context*, int N, void*, void (*)(void*));
  2428   3877   
  2429   3878   
  2430   3879   /*
  2431         -** CAPI3REF: Constants Defining Special Destructor Behavior
         3880  +** CAPI3REF: Constants Defining Special Destructor Behavior {F10280}
  2432   3881   **
  2433   3882   ** These are special value for the destructor that is passed in as the
  2434   3883   ** final argument to routines like [sqlite3_result_blob()].  If the destructor
  2435   3884   ** argument is SQLITE_STATIC, it means that the content pointer is constant
  2436   3885   ** and will never change.  It does not need to be destroyed.  The 
  2437   3886   ** SQLITE_TRANSIENT value means that the content will likely change in
  2438   3887   ** the near future and that SQLite should make its own private copy of
................................................................................
  2442   3891   ** C++ compilers.  See ticket #2191.
  2443   3892   */
  2444   3893   typedef void (*sqlite3_destructor_type)(void*);
  2445   3894   #define SQLITE_STATIC      ((sqlite3_destructor_type)0)
  2446   3895   #define SQLITE_TRANSIENT   ((sqlite3_destructor_type)-1)
  2447   3896   
  2448   3897   /*
  2449         -** CAPI3REF: Setting The Result Of An SQL Function
         3898  +** CAPI3REF: Setting The Result Of An SQL Function {F16400}
  2450   3899   **
  2451   3900   ** These routines are used by the xFunc or xFinal callbacks that
  2452   3901   ** implement SQL functions and aggregates.  See
  2453   3902   ** [sqlite3_create_function()] and [sqlite3_create_function16()]
  2454   3903   ** for additional information.
  2455   3904   **
  2456   3905   ** These functions work very much like the 
  2457   3906   ** [sqlite3_bind_blob | sqlite3_bind_*] family of functions used
  2458   3907   ** to bind values to host parameters in prepared statements.
  2459   3908   ** Refer to the
  2460   3909   ** [sqlite3_bind_blob | sqlite3_bind_* documentation] for
  2461   3910   ** additional information.
         3911  +**
         3912  +** The sqlite3_result_blob() interface sets the result from
         3913  +** an application defined function to be the BLOB whose content is pointed
         3914  +** to by the second parameter and which is N bytes long where N is the
         3915  +** third parameter. 
         3916  +** The sqlite3_result_zeroblob() inerfaces set the result of
         3917  +** the application defined function to be a BLOB containing all zero
         3918  +** bytes and N bytes in size, where N is the value of the 2nd parameter.
         3919  +**
         3920  +** The sqlite3_result_double() interface sets the result from
         3921  +** an application defined function to be a floating point value specified
         3922  +** by its 2nd argument.
  2462   3923   **
  2463   3924   ** The sqlite3_result_error() and sqlite3_result_error16() functions
  2464         -** cause the implemented SQL function to throw an exception.  The
  2465         -** parameter to sqlite3_result_error() or sqlite3_result_error16()
  2466         -** is the text of an error message.
  2467         -**
  2468         -** The sqlite3_result_toobig() cause the function implementation
  2469         -** to throw and error indicating that a string or BLOB is to long
  2470         -** to represent.
  2471         -**
  2472         -** These routines must be called from within the same thread as
  2473         -** the SQL function associated with the [sqlite3_context] pointer.
         3925  +** cause the implemented SQL function to throw an exception.
         3926  +** SQLite uses the string pointed to by the
         3927  +** 2nd parameter of sqlite3_result_error() or sqlite3_result_error16()
         3928  +** as the text of an error message.  SQLite interprets the error
         3929  +** message string from sqlite3_result_error() as UTF8. SQLite
         3930  +** interprets the string from sqlite3_result_error16() as UTF16 in native
         3931  +** byte order.  If the third parameter to sqlite3_result_error()
         3932  +** or sqlite3_result_error16() is negative then SQLite takes as the error
         3933  +** message all text up through the first zero character.
         3934  +** If the third parameter to sqlite3_result_error() or
         3935  +** sqlite3_result_error16() is non-negative then SQLite takes that many
         3936  +** bytes (not characters) from the 2nd parameter as the error message.
         3937  +** The sqlite3_result_error() and sqlite3_result_error16()
         3938  +** routines make a copy private copy of the error message text before
         3939  +** they return.  Hence, the calling function can deallocate or
         3940  +** modify the text after they return without harm.
         3941  +** The sqlite3_result_error_code() function changes the error code
         3942  +** returned by SQLite as a result of an error in a function.  By default,
         3943  +** the error code is SQLITE_ERROR.  A subsequent call to sqlite3_result_error()
         3944  +** or sqlite3_result_error16() resets the error code to SQLITE_ERROR.
         3945  +**
         3946  +** The sqlite3_result_toobig() interface causes SQLite
         3947  +** to throw an error indicating that a string or BLOB is to long
         3948  +** to represent.  The sqlite3_result_nomem() interface
         3949  +** causes SQLite to throw an exception indicating that the a
         3950  +** memory allocation failed.
         3951  +**
         3952  +** The sqlite3_result_int() interface sets the return value
         3953  +** of the application-defined function to be the 32-bit signed integer
         3954  +** value given in the 2nd argument.
         3955  +** The sqlite3_result_int64() interface sets the return value
         3956  +** of the application-defined function to be the 64-bit signed integer
         3957  +** value given in the 2nd argument.
         3958  +**
         3959  +** The sqlite3_result_null() interface sets the return value
         3960  +** of the application-defined function to be NULL.
         3961  +**
         3962  +** The sqlite3_result_text(), sqlite3_result_text16(), 
         3963  +** sqlite3_result_text16le(), and sqlite3_result_text16be() interfaces
         3964  +** set the return value of the application-defined function to be
         3965  +** a text string which is represented as UTF-8, UTF-16 native byte order,
         3966  +** UTF-16 little endian, or UTF-16 big endian, respectively.
         3967  +** SQLite takes the text result from the application from
         3968  +** the 2nd parameter of the sqlite3_result_text* interfaces.
         3969  +** If the 3rd parameter to the sqlite3_result_text* interfaces
         3970  +** is negative, then SQLite takes result text from the 2nd parameter 
         3971  +** through the first zero character.
         3972  +** If the 3rd parameter to the sqlite3_result_text* interfaces
         3973  +** is non-negative, then as many bytes (not characters) of the text
         3974  +** pointed to by the 2nd parameter are taken as the application-defined
         3975  +** function result.
         3976  +** If the 4th parameter to the sqlite3_result_text* interfaces
         3977  +** or sqlite3_result_blob is a non-NULL pointer, then SQLite calls that
         3978  +** function as the destructor on the text or blob result when it has
         3979  +** finished using that result.
         3980  +** If the 4th parameter to the sqlite3_result_text* interfaces
         3981  +** or sqlite3_result_blob is the special constant SQLITE_STATIC, then
         3982  +** SQLite assumes that the text or blob result is constant space and
         3983  +** does not copy the space or call a destructor when it has
         3984  +** finished using that result.
         3985  +** If the 4th parameter to the sqlite3_result_text* interfaces
         3986  +** or sqlite3_result_blob is the special constant SQLITE_TRANSIENT
         3987  +** then SQLite makes a copy of the result into space obtained from
         3988  +** from [sqlite3_malloc()] before it returns.
         3989  +**
         3990  +** The sqlite3_result_value() interface sets the result of
         3991  +** the application-defined function to be a copy the
         3992  +** [unprotected sqlite3_value] object specified by the 2nd parameter.  The
         3993  +** sqlite3_result_value() interface makes a copy of the [sqlite3_value]
         3994  +** so that [sqlite3_value] specified in the parameter may change or
         3995  +** be deallocated after sqlite3_result_value() returns without harm.
         3996  +** A [protected sqlite3_value] object may always be used where an
         3997  +** [unprotected sqlite3_value] object is required, so either
         3998  +** kind of [sqlite3_value] object can be used with this interface.
         3999  +**
         4000  +** If these routines are called from within the different thread 
         4001  +** than the one containing the application-defined function that recieved
         4002  +** the [sqlite3_context] pointer, the results are undefined.
         4003  +**
         4004  +** INVARIANTS:
         4005  +**
         4006  +** {F16403} The default return value from any SQL function is NULL.
         4007  +**
         4008  +** {F16406} The [sqlite3_result_blob(C,V,N,D)] interface changes the
         4009  +**          return value of function C to be a blob that is N bytes
         4010  +**          in length and with content pointed to by V.
         4011  +**
         4012  +** {F16409} The [sqlite3_result_double(C,V)] interface changes the
         4013  +**          return value of function C to be the floating point value V.
         4014  +**
         4015  +** {F16412} The [sqlite3_result_error(C,V,N)] interface changes the return
         4016  +**          value of function C to be an exception with error code
         4017  +**          [SQLITE_ERROR] and a UTF8 error message copied from V up to the
         4018  +**          first zero byte or until N bytes are read if N is positive.
         4019  +**
         4020  +** {F16415} The [sqlite3_result_error16(C,V,N)] interface changes the return
         4021  +**          value of function C to be an exception with error code
         4022  +**          [SQLITE_ERROR] and a UTF16 native byte order error message
         4023  +**          copied from V up to the first zero terminator or until N bytes
         4024  +**          are read if N is positive.
         4025  +**
         4026  +** {F16418} The [sqlite3_result_error_toobig(C)] interface changes the return
         4027  +**          value of the function C to be an exception with error code
         4028  +**          [SQLITE_TOOBIG] and an appropriate error message.
         4029  +**
         4030  +** {F16421} The [sqlite3_result_error_nomem(C)] interface changes the return
         4031  +**          value of the function C to be an exception with error code
         4032  +**          [SQLITE_NOMEM] and an appropriate error message.
         4033  +**
         4034  +** {F16424} The [sqlite3_result_error_code(C,E)] interface changes the return
         4035  +**          value of the function C to be an exception with error code E.
         4036  +**          The error message text is unchanged.
         4037  +**
         4038  +** {F16427} The [sqlite3_result_int(C,V)] interface changes the
         4039  +**          return value of function C to be the 32-bit integer value V.
         4040  +**
         4041  +** {F16430} The [sqlite3_result_int64(C,V)] interface changes the
         4042  +**          return value of function C to be the 64-bit integer value V.
         4043  +**
         4044  +** {F16433} The [sqlite3_result_null(C)] interface changes the
         4045  +**          return value of function C to be NULL.
         4046  +**
         4047  +** {F16436} The [sqlite3_result_text(C,V,N,D)] interface changes the
         4048  +**          return value of function C to be the UTF8 string
         4049  +**          V up to the first zero if N is negative
         4050  +**          or the first N bytes of V if N is non-negative.
         4051  +**
         4052  +** {F16439} The [sqlite3_result_text16(C,V,N,D)] interface changes the
         4053  +**          return value of function C to be the UTF16 native byte order
         4054  +**          string V up to the first zero if N is
         4055  +**          negative or the first N bytes of V if N is non-negative.
         4056  +**
         4057  +** {F16442} The [sqlite3_result_text16be(C,V,N,D)] interface changes the
         4058  +**          return value of function C to be the UTF16 big-endian
         4059  +**          string V up to the first zero if N is
         4060  +**          is negative or the first N bytes or V if N is non-negative.
         4061  +**
         4062  +** {F16445} The [sqlite3_result_text16le(C,V,N,D)] interface changes the
         4063  +**          return value of function C to be the UTF16 little-endian
         4064  +**          string V up to the first zero if N is
         4065  +**          negative or the first N bytes of V if N is non-negative.
         4066  +**
         4067  +** {F16448} The [sqlite3_result_value(C,V)] interface changes the
         4068  +**          return value of function C to be [unprotected sqlite3_value]
         4069  +**          object V.
         4070  +**
         4071  +** {F16451} The [sqlite3_result_zeroblob(C,N)] interface changes the
         4072  +**          return value of function C to be an N-byte blob of all zeros.
         4073  +**
         4074  +** {F16454} The [sqlite3_result_error()] and [sqlite3_result_error16()]
         4075  +**          interfaces make a copy of their error message strings before
         4076  +**          returning.
         4077  +**
         4078  +** {F16457} If the D destructor parameter to [sqlite3_result_blob(C,V,N,D)],
         4079  +**          [sqlite3_result_text(C,V,N,D)], [sqlite3_result_text16(C,V,N,D)],
         4080  +**          [sqlite3_result_text16be(C,V,N,D)], or
         4081  +**          [sqlite3_result_text16le(C,V,N,D)] is the constant [SQLITE_STATIC]
         4082  +**          then no destructor is ever called on the pointer V and SQLite
         4083  +**          assumes that V is immutable.
         4084  +**
         4085  +** {F16460} If the D destructor parameter to [sqlite3_result_blob(C,V,N,D)],
         4086  +**          [sqlite3_result_text(C,V,N,D)], [sqlite3_result_text16(C,V,N,D)],
         4087  +**          [sqlite3_result_text16be(C,V,N,D)], or
         4088  +**          [sqlite3_result_text16le(C,V,N,D)] is the constant
         4089  +**          [SQLITE_TRANSIENT] then the interfaces makes a copy of the
         4090  +**          content of V and retains the copy.
         4091  +**
         4092  +** {F16463} If the D destructor parameter to [sqlite3_result_blob(C,V,N,D)],
         4093  +**          [sqlite3_result_text(C,V,N,D)], [sqlite3_result_text16(C,V,N,D)],
         4094  +**          [sqlite3_result_text16be(C,V,N,D)], or
         4095  +**          [sqlite3_result_text16le(C,V,N,D)] is some value other than
         4096  +**          the constants [SQLITE_STATIC] and [SQLITE_TRANSIENT] then 
         4097  +**          SQLite will invoke the destructor D with V as its only argument
         4098  +**          when it has finished with the V value.
  2474   4099   */
  2475   4100   void sqlite3_result_blob(sqlite3_context*, const void*, int, void(*)(void*));
  2476   4101   void sqlite3_result_double(sqlite3_context*, double);
  2477   4102   void sqlite3_result_error(sqlite3_context*, const char*, int);
  2478   4103   void sqlite3_result_error16(sqlite3_context*, const void*, int);
  2479   4104   void sqlite3_result_error_toobig(sqlite3_context*);
  2480   4105   void sqlite3_result_error_nomem(sqlite3_context*);
         4106  +void sqlite3_result_error_code(sqlite3_context*, int);
  2481   4107   void sqlite3_result_int(sqlite3_context*, int);
  2482   4108   void sqlite3_result_int64(sqlite3_context*, sqlite3_int64);
  2483   4109   void sqlite3_result_null(sqlite3_context*);
  2484   4110   void sqlite3_result_text(sqlite3_context*, const char*, int, void(*)(void*));
  2485   4111   void sqlite3_result_text16(sqlite3_context*, const void*, int, void(*)(void*));
  2486   4112   void sqlite3_result_text16le(sqlite3_context*, const void*, int,void(*)(void*));
  2487   4113   void sqlite3_result_text16be(sqlite3_context*, const void*, int,void(*)(void*));
  2488   4114   void sqlite3_result_value(sqlite3_context*, sqlite3_value*);
  2489   4115   void sqlite3_result_zeroblob(sqlite3_context*, int n);
  2490   4116   
  2491   4117   /*
  2492         -** CAPI3REF: Define New Collating Sequences
         4118  +** CAPI3REF: Define New Collating Sequences {F16600}
  2493   4119   **
  2494   4120   ** These functions are used to add new collation sequences to the
  2495   4121   ** [sqlite3*] handle specified as the first argument. 
  2496   4122   **
  2497   4123   ** The name of the new collation sequence is specified as a UTF-8 string
  2498   4124   ** for sqlite3_create_collation() and sqlite3_create_collation_v2()
  2499         -** and a UTF-16 string for sqlite3_create_collation16().  In all cases
         4125  +** and a UTF-16 string for sqlite3_create_collation16(). In all cases
  2500   4126   ** the name is passed as the second function argument.
  2501   4127   **
  2502   4128   ** The third argument may be one of the constants [SQLITE_UTF8],
  2503   4129   ** [SQLITE_UTF16LE] or [SQLITE_UTF16BE], indicating that the user-supplied
  2504   4130   ** routine expects to be passed pointers to strings encoded using UTF-8,
  2505         -** UTF-16 little-endian or UTF-16 big-endian respectively.  The
         4131  +** UTF-16 little-endian or UTF-16 big-endian respectively. The
  2506   4132   ** third argument might also be [SQLITE_UTF16_ALIGNED] to indicate that
  2507   4133   ** the routine expects pointers to 16-bit word aligned strings
  2508   4134   ** of UTF16 in the native byte order of the host computer.
  2509   4135   **
  2510   4136   ** A pointer to the user supplied routine must be passed as the fifth
  2511         -** argument. If it is NULL, this is the same as deleting the collation
  2512         -** sequence (so that SQLite cannot call it anymore). Each time the user
         4137  +** argument.  If it is NULL, this is the same as deleting the collation
         4138  +** sequence (so that SQLite cannot call it anymore).
         4139  +** Each time the application
  2513   4140   ** supplied function is invoked, it is passed a copy of the void* passed as
  2514   4141   ** the fourth argument to sqlite3_create_collation() or
  2515   4142   ** sqlite3_create_collation16() as its first parameter.
  2516   4143   **
  2517         -** The remaining arguments to the user-supplied routine are two strings,
  2518         -** each represented by a [length, data] pair and encoded in the encoding
         4144  +** The remaining arguments to the application-supplied routine are two strings,
         4145  +** each represented by a (length, data) pair and encoded in the encoding
  2519   4146   ** that was passed as the third argument when the collation sequence was
  2520         -** registered. The user routine should return negative, zero or positive if
         4147  +** registered. {END} The application defined collation routine should
         4148  +** return negative, zero or positive if
  2521   4149   ** the first string is less than, equal to, or greater than the second
  2522   4150   ** string. i.e. (STRING1 - STRING2).
  2523   4151   **
  2524   4152   ** The sqlite3_create_collation_v2() works like sqlite3_create_collation()
  2525   4153   ** excapt that it takes an extra argument which is a destructor for
  2526   4154   ** the collation.  The destructor is called when the collation is
  2527   4155   ** destroyed and is passed a copy of the fourth parameter void* pointer
  2528         -** of the sqlite3_create_collation_v2().  Collations are destroyed when
         4156  +** of the sqlite3_create_collation_v2().
         4157  +** Collations are destroyed when
  2529   4158   ** they are overridden by later calls to the collation creation functions
  2530   4159   ** or when the [sqlite3*] database handle is closed using [sqlite3_close()].
  2531   4160   **
  2532         -** The sqlite3_create_collation_v2() interface is experimental and
  2533         -** subject to change in future releases.  The other collation creation
  2534         -** functions are stable.
         4161  +** INVARIANTS:
         4162  +**
         4163  +** {F16603} A successful call to the
         4164  +**          [sqlite3_create_collation_v2(B,X,E,P,F,D)] interface
         4165  +**          registers function F as the comparison function used to
         4166  +**          implement collation X on [database connection] B for
         4167  +**          databases having encoding E.
         4168  +**
         4169  +** {F16604} SQLite understands the X parameter to
         4170  +**          [sqlite3_create_collation_v2(B,X,E,P,F,D)] as a zero-terminated
         4171  +**          UTF-8 string in which case is ignored for ASCII characters and
         4172  +**          is significant for non-ASCII characters.
         4173  +**
         4174  +** {F16606} Successive calls to [sqlite3_create_collation_v2(B,X,E,P,F,D)]
         4175  +**          with the same values for B, X, and E, override prior values
         4176  +**          of P, F, and D.
         4177  +**
         4178  +** {F16609} The destructor D in [sqlite3_create_collation_v2(B,X,E,P,F,D)]
         4179  +**          is not NULL then it is called with argument P when the
         4180  +**          collating function is dropped by SQLite.
         4181  +**
         4182  +** {F16612} A collating function is dropped when it is overloaded.
         4183  +**
         4184  +** {F16615} A collating function is dropped when the database connection
         4185  +**          is closed using [sqlite3_close()].
         4186  +**
         4187  +** {F16618} The pointer P in [sqlite3_create_collation_v2(B,X,E,P,F,D)]
         4188  +**          is passed through as the first parameter to the comparison
         4189  +**          function F for all subsequent invocations of F.
         4190  +**
         4191  +** {F16621} A call to [sqlite3_create_collation(B,X,E,P,F)] is exactly
         4192  +**          the same as a call to [sqlite3_create_collation_v2()] with
         4193  +**          the same parameters and a NULL destructor.
         4194  +**
         4195  +** {F16624} Following a [sqlite3_create_collation_v2(B,X,E,P,F,D)],
         4196  +**          SQLite uses the comparison function F for all text comparison
         4197  +**          operations on [database connection] B on text values that
         4198  +**          use the collating sequence name X.
         4199  +**
         4200  +** {F16627} The [sqlite3_create_collation16(B,X,E,P,F)] works the same
         4201  +**          as [sqlite3_create_collation(B,X,E,P,F)] except that the
         4202  +**          collation name X is understood as UTF-16 in native byte order
         4203  +**          instead of UTF-8.
         4204  +**
         4205  +** {F16630} When multiple comparison functions are available for the same
         4206  +**          collating sequence, SQLite chooses the one whose text encoding
         4207  +**          requires the least amount of conversion from the default
         4208  +**          text encoding of the database.
  2535   4209   */
  2536   4210   int sqlite3_create_collation(
  2537   4211     sqlite3*, 
  2538   4212     const char *zName, 
  2539   4213     int eTextRep, 
  2540   4214     void*,
  2541   4215     int(*xCompare)(void*,int,const void*,int,const void*)
................................................................................
  2553   4227     const char *zName, 
  2554   4228     int eTextRep, 
  2555   4229     void*,
  2556   4230     int(*xCompare)(void*,int,const void*,int,const void*)
  2557   4231   );
  2558   4232   
  2559   4233   /*
  2560         -** CAPI3REF: Collation Needed Callbacks
         4234  +** CAPI3REF: Collation Needed Callbacks {F16700}
  2561   4235   **
  2562   4236   ** To avoid having to register all collation sequences before a database
  2563   4237   ** can be used, a single callback function may be registered with the
  2564   4238   ** database handle to be called whenever an undefined collation sequence is
  2565   4239   ** required.
  2566   4240   **
  2567   4241   ** If the function is registered using the sqlite3_collation_needed() API,
  2568   4242   ** then it is passed the names of undefined collation sequences as strings
  2569         -** encoded in UTF-8. If sqlite3_collation_needed16() is used, the names
         4243  +** encoded in UTF-8. {F16703} If sqlite3_collation_needed16() is used, the names
  2570   4244   ** are passed as UTF-16 in machine native byte order. A call to either
  2571   4245   ** function replaces any existing callback.
  2572   4246   **
  2573   4247   ** When the callback is invoked, the first argument passed is a copy
  2574   4248   ** of the second argument to sqlite3_collation_needed() or
  2575         -** sqlite3_collation_needed16(). The second argument is the database
  2576         -** handle. The third argument is one of [SQLITE_UTF8], [SQLITE_UTF16BE], or
  2577         -** [SQLITE_UTF16LE], indicating the most desirable form of the collation
  2578         -** sequence function required. The fourth parameter is the name of the
         4249  +** sqlite3_collation_needed16().  The second argument is the database
         4250  +** handle.  The third argument is one of [SQLITE_UTF8],
         4251  +** [SQLITE_UTF16BE], or [SQLITE_UTF16LE], indicating the most
         4252  +** desirable form of the collation sequence function required.
         4253  +** The fourth parameter is the name of the
  2579   4254   ** required collation sequence.
  2580   4255   **
  2581   4256   ** The callback function should register the desired collation using
  2582   4257   ** [sqlite3_create_collation()], [sqlite3_create_collation16()], or
  2583   4258   ** [sqlite3_create_collation_v2()].
         4259  +**
         4260  +** INVARIANTS:
         4261  +**
         4262  +** {F16702} A successful call to [sqlite3_collation_needed(D,P,F)]
         4263  +**          or [sqlite3_collation_needed16(D,P,F)] causes
         4264  +**          the [database connection] D to invoke callback F with first
         4265  +**          parameter P whenever it needs a comparison function for a
         4266  +**          collating sequence that it does not know about.
         4267  +**
         4268  +** {F16704} Each successful call to [sqlite3_collation_needed()] or
         4269  +**          [sqlite3_collation_needed16()] overrides the callback registered
         4270  +**          on the same [database connection] by prior calls to either
         4271  +**          interface.
         4272  +**
         4273  +** {F16706} The name of the requested collating function passed in the
         4274  +**          4th parameter to the callback is in UTF-8 if the callback
         4275  +**          was registered using [sqlite3_collation_needed()] and
         4276  +**          is in UTF-16 native byte order if the callback was
         4277  +**          registered using [sqlite3_collation_needed16()].
         4278  +**
         4279  +** 
  2584   4280   */
  2585   4281   int sqlite3_collation_needed(
  2586   4282     sqlite3*, 
  2587   4283     void*, 
  2588   4284     void(*)(void*,sqlite3*,int eTextRep,const char*)
  2589   4285   );
  2590   4286   int sqlite3_collation_needed16(
................................................................................
  2615   4311   */
  2616   4312   int sqlite3_rekey(
  2617   4313     sqlite3 *db,                   /* Database to be rekeyed */
  2618   4314     const void *pKey, int nKey     /* The new key */
  2619   4315   );
  2620   4316   
  2621   4317   /*
  2622         -** CAPI3REF:  Suspend Execution For A Short Time
         4318  +** CAPI3REF:  Suspend Execution For A Short Time {F10530}
  2623   4319   **
  2624         -** This function causes the current thread to suspend execution
  2625         -** a number of milliseconds specified in its parameter.
         4320  +** The sqlite3_sleep() function
         4321  +** causes the current thread to suspend execution
         4322  +** for at least a number of milliseconds specified in its parameter.
  2626   4323   **
  2627   4324   ** If the operating system does not support sleep requests with 
  2628   4325   ** millisecond time resolution, then the time will be rounded up to 
  2629   4326   ** the nearest second. The number of milliseconds of sleep actually 
  2630   4327   ** requested from the operating system is returned.
  2631   4328   **
  2632   4329   ** SQLite implements this interface by calling the xSleep()
  2633   4330   ** method of the default [sqlite3_vfs] object.
         4331  +**
         4332  +** INVARIANTS:
         4333  +**
         4334  +** {F10533} The [sqlite3_sleep(M)] interface invokes the xSleep
         4335  +**          method of the default [sqlite3_vfs|VFS] in order to
         4336  +**          suspend execution of the current thread for at least
         4337  +**          M milliseconds.
         4338  +**
         4339  +** {F10536} The [sqlite3_sleep(M)] interface returns the number of
         4340  +**          milliseconds of sleep actually requested of the operating
         4341  +**          system, which might be larger than the parameter M.
  2634   4342   */
  2635   4343   int sqlite3_sleep(int);
  2636   4344   
  2637   4345   /*
  2638         -** CAPI3REF:  Name Of The Folder Holding Temporary Files
         4346  +** CAPI3REF:  Name Of The Folder Holding Temporary Files {F10310}
  2639   4347   **
  2640   4348   ** If this global variable is made to point to a string which is
  2641   4349   ** the name of a folder (a.ka. directory), then all temporary files
  2642   4350   ** created by SQLite will be placed in that directory.  If this variable
  2643   4351   ** is NULL pointer, then SQLite does a search for an appropriate temporary
  2644   4352   ** file directory.
  2645   4353   **
................................................................................
  2647   4355   ** has been opened.  It is intended that this variable be set once
  2648   4356   ** as part of process initialization and before any SQLite interface
  2649   4357   ** routines have been call and remain unchanged thereafter.
  2650   4358   */
  2651   4359   SQLITE_EXTERN char *sqlite3_temp_directory;
  2652   4360   
  2653   4361   /*
  2654         -** CAPI3REF:  Test To See If The Database Is In Auto-Commit Mode
         4362  +** CAPI3REF:  Test To See If The Database Is In Auto-Commit Mode {F12930}
  2655   4363   **
  2656         -** Test to see whether or not the database connection is in autocommit
  2657         -** mode.  Return TRUE if it is and FALSE if not.  Autocommit mode is on
  2658         -** by default.  Autocommit is disabled by a BEGIN statement and reenabled
  2659         -** by the next COMMIT or ROLLBACK.
         4364  +** The sqlite3_get_autocommit() interfaces returns non-zero or
         4365  +** zero if the given database connection is or is not in autocommit mode,
         4366  +** respectively.   Autocommit mode is on
         4367  +** by default.  Autocommit mode is disabled by a [BEGIN] statement.
         4368  +** Autocommit mode is reenabled by a [COMMIT] or [ROLLBACK].
  2660   4369   **
  2661   4370   ** If certain kinds of errors occur on a statement within a multi-statement
  2662   4371   ** transactions (errors including [SQLITE_FULL], [SQLITE_IOERR], 
  2663   4372   ** [SQLITE_NOMEM], [SQLITE_BUSY], and [SQLITE_INTERRUPT]) then the
  2664   4373   ** transaction might be rolled back automatically.  The only way to
  2665   4374   ** find out if SQLite automatically rolled back the transaction after
  2666   4375   ** an error is to use this function.
  2667   4376   **
  2668         -** If another thread changes the autocommit status of the database
  2669         -** connection while this routine is running, then the return value
  2670         -** is undefined.
         4377  +** INVARIANTS:
         4378  +**
         4379  +** {F12931} The [sqlite3_get_autocommit(D)] interface returns non-zero or
         4380  +**          zero if the [database connection] D is or is not in autocommit
         4381  +**          mode, respectively.
         4382  +**
         4383  +** {F12932} Autocommit mode is on by default.
         4384  +**
         4385  +** {F12933} Autocommit mode is disabled by a successful [BEGIN] statement.
         4386  +**
         4387  +** {F12934} Autocommit mode is enabled by a successful [COMMIT] or [ROLLBACK]
         4388  +**          statement.
         4389  +** 
         4390  +**
         4391  +** LIMITATIONS:
         4392  +***
         4393  +** {U12936} If another thread changes the autocommit status of the database
         4394  +**          connection while this routine is running, then the return value
         4395  +**          is undefined.
  2671   4396   */
  2672   4397   int sqlite3_get_autocommit(sqlite3*);
  2673   4398   
  2674   4399   /*
  2675         -** CAPI3REF:  Find The Database Handle Associated With A Prepared Statement
         4400  +** CAPI3REF:  Find The Database Handle Of A Prepared Statement {F13120}
  2676   4401   **
  2677         -** Return the [sqlite3*] database handle to which a
  2678         -** [sqlite3_stmt | prepared statement] belongs.
  2679         -** This is the same database handle that was
         4402  +** The sqlite3_db_handle interface
         4403  +** returns the [sqlite3*] database handle to which a
         4404  +** [prepared statement] belongs.
         4405  +** The database handle returned by sqlite3_db_handle
         4406  +** is the same database handle that was
  2680   4407   ** the first argument to the [sqlite3_prepare_v2()] or its variants
  2681   4408   ** that was used to create the statement in the first place.
         4409  +**
         4410  +** INVARIANTS:
         4411  +**
         4412  +** {F13123} The [sqlite3_db_handle(S)] interface returns a pointer
         4413  +**          to the [database connection] associated with
         4414  +**          [prepared statement] S.
  2682   4415   */
  2683   4416   sqlite3 *sqlite3_db_handle(sqlite3_stmt*);
  2684   4417   
  2685   4418   
  2686   4419   /*
  2687         -** CAPI3REF: Commit And Rollback Notification Callbacks
         4420  +** CAPI3REF: Commit And Rollback Notification Callbacks {F12950}
  2688   4421   **
  2689         -** These routines
  2690         -** register callback functions to be invoked whenever a transaction
  2691         -** is committed or rolled back.  The pArg argument is passed through
         4422  +** The sqlite3_commit_hook() interface registers a callback
         4423  +** function to be invoked whenever a transaction is committed.
         4424  +** Any callback set by a previous call to sqlite3_commit_hook()
         4425  +** for the same database connection is overridden.
         4426  +** The sqlite3_rollback_hook() interface registers a callback
         4427  +** function to be invoked whenever a transaction is committed.
         4428  +** Any callback set by a previous call to sqlite3_commit_hook()
         4429  +** for the same database connection is overridden.
         4430  +** The pArg argument is passed through
  2692   4431   ** to the callback.  If the callback on a commit hook function 
  2693   4432   ** returns non-zero, then the commit is converted into a rollback.
  2694   4433   **
  2695         -** If another function was previously registered, its pArg value is returned.
  2696         -** Otherwise NULL is returned.
         4434  +** If another function was previously registered, its
         4435  +** pArg value is returned.  Otherwise NULL is returned.
  2697   4436   **
  2698   4437   ** Registering a NULL function disables the callback.
  2699   4438   **
  2700   4439   ** For the purposes of this API, a transaction is said to have been 
  2701   4440   ** rolled back if an explicit "ROLLBACK" statement is executed, or
  2702         -** an error or constraint causes an implicit rollback to occur. The 
  2703         -** callback is not invoked if a transaction is automatically rolled
  2704         -** back because the database connection is closed.
         4441  +** an error or constraint causes an implicit rollback to occur.
         4442  +** The rollback callback is not invoked if a transaction is
         4443  +** automatically rolled back because the database connection is closed.
         4444  +** The rollback callback is not invoked if a transaction is
         4445  +** rolled back because a commit callback returned non-zero.
         4446  +** <todo> Check on this </todo>
  2705   4447   **
  2706   4448   ** These are experimental interfaces and are subject to change.
         4449  +**
         4450  +** INVARIANTS:
         4451  +**
         4452  +** {F12951} The [sqlite3_commit_hook(D,F,P)] interface registers the
         4453  +**          callback function F to be invoked with argument P whenever
         4454  +**          a transaction commits on [database connection] D.
         4455  +**
         4456  +** {F12952} The [sqlite3_commit_hook(D,F,P)] interface returns the P
         4457  +**          argument from the previous call with the same 
         4458  +**          [database connection ] D , or NULL on the first call
         4459  +**          for a particular [database connection] D.
         4460  +**
         4461  +** {F12953} Each call to [sqlite3_commit_hook()] overwrites the callback
         4462  +**          registered by prior calls.
         4463  +**
         4464  +** {F12954} If the F argument to [sqlite3_commit_hook(D,F,P)] is NULL
         4465  +**          then the commit hook callback is cancelled and no callback
         4466  +**          is invoked when a transaction commits.
         4467  +**
         4468  +** {F12955} If the commit callback returns non-zero then the commit is
         4469  +**          converted into a rollback.
         4470  +**
         4471  +** {F12961} The [sqlite3_rollback_hook(D,F,P)] interface registers the
         4472  +**          callback function F to be invoked with argument P whenever
         4473  +**          a transaction rolls back on [database connection] D.
         4474  +**
         4475  +** {F12962} The [sqlite3_rollback_hook(D,F,P)] interface returns the P
         4476  +**          argument from the previous call with the same 
         4477  +**          [database connection ] D , or NULL on the first call
         4478  +**          for a particular [database connection] D.
         4479  +**
         4480  +** {F12963} Each call to [sqlite3_rollback_hook()] overwrites the callback
         4481  +**          registered by prior calls.
         4482  +**
         4483  +** {F12964} If the F argument to [sqlite3_rollback_hook(D,F,P)] is NULL
         4484  +**          then the rollback hook callback is cancelled and no callback
         4485  +**          is invoked when a transaction rolls back.
  2707   4486   */
  2708   4487   void *sqlite3_commit_hook(sqlite3*, int(*)(void*), void*);
  2709   4488   void *sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*);
  2710   4489   
  2711   4490   /*
  2712         -** CAPI3REF: Data Change Notification Callbacks
         4491  +** CAPI3REF: Data Change Notification Callbacks {F12970}
  2713   4492   **
  2714         -** Register a callback function with the database connection identified by the 
         4493  +** The sqlite3_update_hook() interface
         4494  +** registers a callback function with the database connection identified by the 
  2715   4495   ** first argument to be invoked whenever a row is updated, inserted or deleted.
  2716   4496   ** Any callback set by a previous call to this function for the same 
  2717   4497   ** database connection is overridden.
  2718   4498   **
  2719   4499   ** The second argument is a pointer to the function to invoke when a 
  2720         -** row is updated, inserted or deleted. The first argument to the callback is
  2721         -** a copy of the third argument to sqlite3_update_hook(). The second callback 
  2722         -** argument is one of SQLITE_INSERT, SQLITE_DELETE or SQLITE_UPDATE, depending
  2723         -** on the operation that caused the callback to be invoked. The third and 
         4500  +** row is updated, inserted or deleted. 
         4501  +** The first argument to the callback is
         4502  +** a copy of the third argument to sqlite3_update_hook().
         4503  +** The second callback 
         4504  +** argument is one of [SQLITE_INSERT], [SQLITE_DELETE] or [SQLITE_UPDATE],
         4505  +** depending on the operation that caused the callback to be invoked.
         4506  +** The third and 
  2724   4507   ** fourth arguments to the callback contain pointers to the database and 
  2725         -** table name containing the affected row. The final callback parameter is 
  2726         -** the rowid of the row. In the case of an update, this is the rowid after 
         4508  +** table name containing the affected row.
         4509  +** The final callback parameter is 
         4510  +** the rowid of the row.
         4511  +** In the case of an update, this is the rowid after 
  2727   4512   ** the update takes place.
  2728   4513   **
  2729   4514   ** The update hook is not invoked when internal system tables are
  2730   4515   ** modified (i.e. sqlite_master and sqlite_sequence).
  2731   4516   **
  2732         -** If another function was previously registered, its pArg value is returned.
  2733         -** Otherwise NULL is returned.
         4517  +** If another function was previously registered, its pArg value
         4518  +** is returned.  Otherwise NULL is returned.
         4519  +**
         4520  +** INVARIANTS:
         4521  +**
         4522  +** {F12971} The [sqlite3_update_hook(D,F,P)] interface causes callback
         4523  +**          function F to be invoked with first parameter P whenever
         4524  +**          a table row is modified, inserted, or deleted on
         4525  +**          [database connection] D.
         4526  +**
         4527  +** {F12973} The [sqlite3_update_hook(D,F,P)] interface returns the value
         4528  +**          of P for the previous call on the same [database connection] D,
         4529  +**          or NULL for the first call.
         4530  +**
         4531  +** {F12975} If the update hook callback F in [sqlite3_update_hook(D,F,P)]
         4532  +**          is NULL then the no update callbacks are made.
         4533  +**
         4534  +** {F12977} Each call to [sqlite3_update_hook(D,F,P)] overrides prior calls
         4535  +**          to the same interface on the same [database connection] D.
         4536  +**
         4537  +** {F12979} The update hook callback is not invoked when internal system
         4538  +**          tables such as sqlite_master and sqlite_sequence are modified.
         4539  +**
         4540  +** {F12981} The second parameter to the update callback 
         4541  +**          is one of [SQLITE_INSERT], [SQLITE_DELETE] or [SQLITE_UPDATE],
         4542  +**          depending on the operation that caused the callback to be invoked.
         4543  +**
         4544  +** {F12983} The third and fourth arguments to the callback contain pointers
         4545  +**          to zero-terminated UTF-8 strings which are the names of the
         4546  +**          database and table that is being updated.
         4547  +
         4548  +** {F12985} The final callback parameter is the rowid of the row after
         4549  +**          the change occurs.
  2734   4550   */
  2735   4551   void *sqlite3_update_hook(
  2736   4552     sqlite3*, 
  2737   4553     void(*)(void *,int ,char const *,char const *,sqlite3_int64),
  2738   4554     void*
  2739   4555   );
  2740   4556   
  2741   4557   /*
  2742         -** CAPI3REF:  Enable Or Disable Shared Pager Cache
         4558  +** CAPI3REF:  Enable Or Disable Shared Pager Cache {F10330}
  2743   4559   **
  2744   4560   ** This routine enables or disables the sharing of the database cache
  2745   4561   ** and schema data structures between connections to the same database.
  2746   4562   ** Sharing is enabled if the argument is true and disabled if the argument
  2747   4563   ** is false.
  2748   4564   **
  2749         -** Beginning in SQLite version 3.5.0, cache sharing is enabled and disabled
  2750         -** for an entire process.  In prior versions of SQLite, sharing was
         4565  +** Cache sharing is enabled and disabled
         4566  +** for an entire process. {END} This is a change as of SQLite version 3.5.0.
         4567  +** In prior versions of SQLite, sharing was
  2751   4568   ** enabled or disabled for each thread separately.
  2752   4569   **
  2753   4570   ** The cache sharing mode set by this interface effects all subsequent
  2754   4571   ** calls to [sqlite3_open()], [sqlite3_open_v2()], and [sqlite3_open16()].
  2755         -** Existing database connections continue use the sharing mode that was
  2756         -** in effect at the time they were opened.
         4572  +** Existing database connections continue use the sharing mode
         4573  +** that was in effect at the time they were opened.
  2757   4574   **
  2758         -** Virtual tables cannot be used with a shared cache.  When shared
         4575  +** Virtual tables cannot be used with a shared cache.   When shared
  2759   4576   ** cache is enabled, the [sqlite3_create_module()] API used to register
  2760   4577   ** virtual tables will always return an error.
  2761   4578   **
  2762   4579   ** This routine returns [SQLITE_OK] if shared cache was
  2763         -** enabled or disabled successfully.  An [SQLITE_ERROR | error code]
         4580  +** enabled or disabled successfully.  An [error code]
  2764   4581   ** is returned otherwise.
  2765   4582   **
  2766         -** Shared cache is disabled by default.  But this might change in
         4583  +** Shared cache is disabled by default. But this might change in
  2767   4584   ** future releases of SQLite.  Applications that care about shared
  2768   4585   ** cache setting should set it explicitly.
         4586  +**
         4587  +** INVARIANTS:
         4588  +** 
         4589  +** {F10331} A successful invocation of [sqlite3_enable_shared_cache(B)]
         4590  +**          will enable or disable shared cache mode for any subsequently
         4591  +**          created [database connection] in the same process.
         4592  +**
         4593  +** {F10336} When shared cache is enabled, the [sqlite3_create_module()]
         4594  +**          interface will always return an error.
         4595  +**
         4596  +** {F10337} The [sqlite3_enable_shared_cache(B)] interface returns
         4597  +**          [SQLITE_OK] if shared cache was enabled or disabled successfully.
         4598  +**
         4599  +** {F10339} Shared cache is disabled by default.
  2769   4600   */
  2770   4601   int sqlite3_enable_shared_cache(int);
  2771   4602   
  2772   4603   /*
  2773         -** CAPI3REF:  Attempt To Free Heap Memory
         4604  +** CAPI3REF:  Attempt To Free Heap Memory {F17340}
  2774   4605   **
  2775         -** Attempt to free N bytes of heap memory by deallocating non-essential
  2776         -** memory allocations held by the database library (example: memory 
  2777         -** used to cache database pages to improve performance).
         4606  +** The sqlite3_release_memory() interface attempts to
         4607  +** free N bytes of heap memory by deallocating non-essential memory
         4608  +** allocations held by the database labrary. {END}  Memory used
         4609  +** to cache database pages to improve performance is an example of
         4610  +** non-essential memory.  Sqlite3_release_memory() returns
         4611  +** the number of bytes actually freed, which might be more or less
         4612  +** than the amount requested.
         4613  +**
         4614  +** INVARIANTS:
         4615  +**
         4616  +** {F17341} The [sqlite3_release_memory(N)] interface attempts to
         4617  +**          free N bytes of heap memory by deallocating non-essential
         4618  +**          memory allocations held by the database labrary.
         4619  +**
         4620  +** {F16342} The [sqlite3_release_memory(N)] returns the number
         4621  +**          of bytes actually freed, which might be more or less
         4622  +**          than the amount requested.
  2778   4623   */
  2779   4624   int sqlite3_release_memory(int);
  2780   4625   
  2781   4626   /*
  2782         -** CAPI3REF:  Impose A Limit On Heap Size
         4627  +** CAPI3REF:  Impose A Limit On Heap Size {F17350}
  2783   4628   **
  2784         -** Place a "soft" limit on the amount of heap memory that may be allocated
  2785         -** by SQLite.  If an internal allocation is requested 
  2786         -** that would exceed the specified limit, [sqlite3_release_memory()] is
         4629  +** The sqlite3_soft_heap_limit() interface
         4630  +** places a "soft" limit on the amount of heap memory that may be allocated
         4631  +** by SQLite. If an internal allocation is requested 
         4632  +** that would exceed the soft heap limit, [sqlite3_release_memory()] is
  2787   4633   ** invoked one or more times to free up some space before the allocation
  2788   4634   ** is made.
  2789   4635   **
  2790         -** The limit is called "soft", because if [sqlite3_release_memory()] cannot
         4636  +** The limit is called "soft", because if
         4637  +** [sqlite3_release_memory()] cannot
  2791   4638   ** free sufficient memory to prevent the limit from being exceeded,
  2792   4639   ** the memory is allocated anyway and the current operation proceeds.
  2793   4640   **
  2794   4641   ** A negative or zero value for N means that there is no soft heap limit and
  2795   4642   ** [sqlite3_release_memory()] will only be called when memory is exhausted.
  2796   4643   ** The default value for the soft heap limit is zero.
  2797   4644   **
  2798         -** SQLite makes a best effort to honor the soft heap limit.  But if it
  2799         -** is unable to reduce memory usage below the soft limit, execution will
         4645  +** SQLite makes a best effort to honor the soft heap limit.  
         4646  +** But if the soft heap limit cannot honored, execution will
  2800   4647   ** continue without error or notification.  This is why the limit is 
  2801   4648   ** called a "soft" limit.  It is advisory only.
  2802   4649   **
  2803   4650   ** Prior to SQLite version 3.5.0, this routine only constrained the memory
  2804   4651   ** allocated by a single thread - the same thread in which this routine
  2805   4652   ** runs.  Beginning with SQLite version 3.5.0, the soft heap limit is
  2806         -** applied to all threads.  The value specified for the soft heap limit
  2807         -** is an upper bound on the total memory allocation for all threads.  In
         4653  +** applied to all threads. The value specified for the soft heap limit
         4654  +** is an upper bound on the total memory allocation for all threads. In
  2808   4655   ** version 3.5.0 there is no mechanism for limiting the heap usage for
  2809   4656   ** individual threads.
         4657  +**
         4658  +** INVARIANTS:
         4659  +**
         4660  +** {F16351} The [sqlite3_soft_heap_limit(N)] interface places a soft limit
         4661  +**          of N bytes on the amount of heap memory that may be allocated
         4662  +**          using [sqlite3_malloc()] or [sqlite3_realloc()] at any point
         4663  +**          in time.
         4664  +**
         4665  +** {F16352} If a call to [sqlite3_malloc()] or [sqlite3_realloc()] would
         4666  +**          cause the total amount of allocated memory to exceed the
         4667  +**          soft heap limit, then [sqlite3_release_memory()] is invoked
         4668  +**          in an attempt to reduce the memory usage prior to proceeding
         4669  +**          with the memory allocation attempt.
         4670  +**
         4671  +** {F16353} Calls to [sqlite3_malloc()] or [sqlite3_realloc()] that trigger
         4672  +**          attempts to reduce memory usage through the soft heap limit
         4673  +**          mechanism continue even if the attempt to reduce memory
         4674  +**          usage is unsuccessful.
         4675  +**
         4676  +** {F16354} A negative or zero value for N in a call to
         4677  +**          [sqlite3_soft_heap_limit(N)] means that there is no soft
         4678  +**          heap limit and [sqlite3_release_memory()] will only be
         4679  +**          called when memory is completely exhausted.
         4680  +**
         4681  +** {F16355} The default value for the soft heap limit is zero.
         4682  +**
         4683  +** {F16358} Each call to [sqlite3_soft_heap_limit(N)] overrides the
         4684  +**          values set by all prior calls.
  2810   4685   */
  2811   4686   void sqlite3_soft_heap_limit(int);
  2812   4687   
  2813   4688   /*
  2814         -** CAPI3REF:  Extract Metadata About A Column Of A Table
         4689  +** CAPI3REF:  Extract Metadata About A Column Of A Table {F12850}
  2815   4690   **
  2816   4691   ** This routine
  2817   4692   ** returns meta-data about a specific column of a specific database
  2818   4693   ** table accessible using the connection handle passed as the first function 
  2819   4694   ** argument.
  2820   4695   **
  2821   4696   ** The column is identified by the second, third and fourth parameters to 
................................................................................
  2883   4758     char const **pzCollSeq,     /* OUTPUT: Collation sequence name */
  2884   4759     int *pNotNull,              /* OUTPUT: True if NOT NULL constraint exists */
  2885   4760     int *pPrimaryKey,           /* OUTPUT: True if column part of PK */
  2886   4761     int *pAutoinc               /* OUTPUT: True if column is auto-increment */
  2887   4762   );
  2888   4763   
  2889   4764   /*
  2890         -** CAPI3REF: Load An Extension
         4765  +** CAPI3REF: Load An Extension {F12600}
  2891   4766   **
  2892         -** Attempt to load an SQLite extension library contained in the file
  2893         -** zFile.  The entry point is zProc.  zProc may be 0 in which case the
  2894         -** name of the entry point defaults to "sqlite3_extension_init".
         4767  +** {F12601} The sqlite3_load_extension() interface
         4768  +** attempts to load an SQLite extension library contained in the file
         4769  +** zFile. {F12602} The entry point is zProc. {F12603} zProc may be 0
         4770  +** in which case the name of the entry point defaults
         4771  +** to "sqlite3_extension_init".
  2895   4772   **
  2896         -** Return [SQLITE_OK] on success and [SQLITE_ERROR] if something goes wrong.
         4773  +** {F12604} The sqlite3_load_extension() interface shall
         4774  +** return [SQLITE_OK] on success and [SQLITE_ERROR] if something goes wrong.
  2897   4775   **
  2898         -** If an error occurs and pzErrMsg is not 0, then fill *pzErrMsg with 
  2899         -** error message text.  The calling function should free this memory
         4776  +** {F12605}
         4777  +** If an error occurs and pzErrMsg is not 0, then the
         4778  +** sqlite3_load_extension() interface shall attempt to fill *pzErrMsg with 
         4779  +** error message text stored in memory obtained from [sqlite3_malloc()].
         4780  +** {END}  The calling function should free this memory
  2900   4781   ** by calling [sqlite3_free()].
  2901   4782   **
         4783  +** {F12606}
  2902   4784   ** Extension loading must be enabled using [sqlite3_enable_load_extension()]
  2903   4785   ** prior to calling this API or an error will be returned.
  2904   4786   */
  2905   4787   int sqlite3_load_extension(
  2906   4788     sqlite3 *db,          /* Load the extension into this database connection */
  2907   4789     const char *zFile,    /* Name of the shared library containing extension */
  2908   4790     const char *zProc,    /* Entry point.  Derived from zFile if 0 */
  2909   4791     char **pzErrMsg       /* Put error message here if not 0 */
  2910   4792   );
  2911   4793   
  2912   4794   /*
  2913         -** CAPI3REF:  Enable Or Disable Extension Loading
         4795  +** CAPI3REF:  Enable Or Disable Extension Loading {F12620}
  2914   4796   **
  2915   4797   ** So as not to open security holes in older applications that are
  2916   4798   ** unprepared to deal with extension loading, and as a means of disabling
  2917   4799   ** extension loading while evaluating user-entered SQL, the following
  2918   4800   ** API is provided to turn the [sqlite3_load_extension()] mechanism on and
  2919         -** off.  It is off by default.  See ticket #1863.
         4801  +** off.  {F12622} It is off by default. {END} See ticket #1863.
  2920   4802   **
  2921         -** Call this routine with onoff==1 to turn extension loading on
  2922         -** and call it with onoff==0 to turn it back off again.
         4803  +** {F12621} Call the sqlite3_enable_load_extension() routine
         4804  +** with onoff==1 to turn extension loading on
         4805  +** and call it with onoff==0 to turn it back off again. {END}
  2923   4806   */
  2924   4807   int sqlite3_enable_load_extension(sqlite3 *db, int onoff);
  2925   4808   
  2926   4809   /*
  2927         -** CAPI3REF: Make Arrangements To Automatically Load An Extension
         4810  +** CAPI3REF: Make Arrangements To Automatically Load An Extension {F12640}
  2928   4811   **
  2929         -** Register an extension entry point that is automatically invoked
         4812  +** {F12641} This function
         4813  +** registers an extension entry point that is automatically invoked
  2930   4814   ** whenever a new database connection is opened using
  2931         -** [sqlite3_open()], [sqlite3_open16()], or [sqlite3_open_v2()].
         4815  +** [sqlite3_open()], [sqlite3_open16()], or [sqlite3_open_v2()]. {END}
  2932   4816   **
  2933   4817   ** This API can be invoked at program startup in order to register
  2934   4818   ** one or more statically linked extensions that will be available
  2935   4819   ** to all new database connections.
  2936   4820   **
  2937         -** Duplicate extensions are detected so calling this routine multiple
         4821  +** {F12642} Duplicate extensions are detected so calling this routine multiple
  2938   4822   ** times with the same extension is harmless.
  2939   4823   **
  2940         -** This routine stores a pointer to the extension in an array
  2941         -** that is obtained from malloc().  If you run a memory leak
         4824  +** {F12643} This routine stores a pointer to the extension in an array
         4825  +** that is obtained from sqlite_malloc(). {END} If you run a memory leak
  2942   4826   ** checker on your program and it reports a leak because of this
  2943   4827   ** array, then invoke [sqlite3_reset_auto_extension()] prior
  2944   4828   ** to shutdown to free the memory.
  2945   4829   **
  2946         -** Automatic extensions apply across all threads.
         4830  +** {F12644} Automatic extensions apply across all threads. {END}
  2947   4831   **
  2948   4832   ** This interface is experimental and is subject to change or
  2949   4833   ** removal in future releases of SQLite.
  2950   4834   */
  2951   4835   int sqlite3_auto_extension(void *xEntryPoint);
  2952   4836   
  2953   4837   
  2954   4838   /*
  2955         -** CAPI3REF: Reset Automatic Extension Loading
         4839  +** CAPI3REF: Reset Automatic Extension Loading {F12660}
  2956   4840   **
  2957         -** Disable all previously registered automatic extensions.  This
  2958         -** routine undoes the effect of all prior [sqlite3_automatic_extension()]
         4841  +** {F12661} This function disables all previously registered
         4842  +** automatic extensions. {END}  This
         4843  +** routine undoes the effect of all prior [sqlite3_auto_extension()]
  2959   4844   ** calls.
  2960   4845   **
  2961         -** This call disabled automatic extensions in all threads.
         4846  +** {F12662} This call disabled automatic extensions in all threads. {END}
  2962   4847   **
  2963   4848   ** This interface is experimental and is subject to change or
  2964   4849   ** removal in future releases of SQLite.
  2965   4850   */
  2966   4851   void sqlite3_reset_auto_extension(void);
  2967   4852   
  2968   4853   
................................................................................
  2982   4867   */
  2983   4868   typedef struct sqlite3_vtab sqlite3_vtab;
  2984   4869   typedef struct sqlite3_index_info sqlite3_index_info;
  2985   4870   typedef struct sqlite3_vtab_cursor sqlite3_vtab_cursor;
  2986   4871   typedef struct sqlite3_module sqlite3_module;
  2987   4872   
  2988   4873   /*
         4874  +** CAPI3REF: Virtual Table Object {F18000}
         4875  +** KEYWORDS: sqlite3_module
         4876  +**
  2989   4877   ** A module is a class of virtual tables.  Each module is defined
  2990   4878   ** by an instance of the following structure.  This structure consists
  2991   4879   ** mostly of methods for the module.
  2992   4880   */
  2993   4881   struct sqlite3_module {
  2994   4882     int iVersion;
  2995   4883     int (*xCreate)(sqlite3*, void *pAux,
................................................................................
  3018   4906                          void (**pxFunc)(sqlite3_context*,int,sqlite3_value**),
  3019   4907                          void **ppArg);
  3020   4908   
  3021   4909     int (*xRename)(sqlite3_vtab *pVtab, const char *zNew);
  3022   4910   };
  3023   4911   
  3024   4912   /*
         4913  +** CAPI3REF: Virtual Table Indexing Information {F18100}
         4914  +** KEYWORDS: sqlite3_index_info
         4915  +**
  3025   4916   ** The sqlite3_index_info structure and its substructures is used to
  3026   4917   ** pass information into and receive the reply from the xBestIndex
  3027   4918   ** method of an sqlite3_module.  The fields under **Inputs** are the
  3028   4919   ** inputs to xBestIndex and are read-only.  xBestIndex inserts its
  3029   4920   ** results into the **Outputs** fields.
  3030   4921   **
  3031   4922   ** The aConstraint[] array records WHERE clause constraints of the
  3032   4923   ** form:
  3033   4924   **
  3034   4925   **         column OP expr
  3035   4926   **
  3036         -** Where OP is =, <, <=, >, or >=.  The particular operator is stored
         4927  +** Where OP is =, &lt;, &lt;=, &gt;, or &gt;=.  
         4928  +** The particular operator is stored
  3037   4929   ** in aConstraint[].op.  The index of the column is stored in 
  3038   4930   ** aConstraint[].iColumn.  aConstraint[].usable is TRUE if the
  3039   4931   ** expr on the right-hand side can be evaluated (and thus the constraint
  3040   4932   ** is usable) and false if it cannot.
  3041   4933   **
  3042   4934   ** The optimizer automatically inverts terms of the form "expr OP column"
  3043   4935   ** and makes other simplifications to the WHERE clause in an attempt to
................................................................................
  3097   4989   #define SQLITE_INDEX_CONSTRAINT_GT    4
  3098   4990   #define SQLITE_INDEX_CONSTRAINT_LE    8
  3099   4991   #define SQLITE_INDEX_CONSTRAINT_LT    16
  3100   4992   #define SQLITE_INDEX_CONSTRAINT_GE    32
  3101   4993   #define SQLITE_INDEX_CONSTRAINT_MATCH 64
  3102   4994   
  3103   4995   /*
         4996  +** CAPI3REF: Register A Virtual Table Implementation {F18200}
         4997  +**
  3104   4998   ** This routine is used to register a new module name with an SQLite
  3105   4999   ** connection.  Module names must be registered before creating new
  3106   5000   ** virtual tables on the module, or before using preexisting virtual
  3107   5001   ** tables of the module.
  3108   5002   */
  3109   5003   int sqlite3_create_module(
  3110   5004     sqlite3 *db,               /* SQLite connection to register module with */
  3111   5005     const char *zName,         /* Name of the module */
  3112   5006     const sqlite3_module *,    /* Methods for the module */
  3113   5007     void *                     /* Client data for xCreate/xConnect */
  3114   5008   );
  3115   5009   
  3116   5010   /*
         5011  +** CAPI3REF: Register A Virtual Table Implementation {F18210}
         5012  +**
  3117   5013   ** This routine is identical to the sqlite3_create_module() method above,
  3118   5014   ** except that it allows a destructor function to be specified. It is
  3119   5015   ** even more experimental than the rest of the virtual tables API.
  3120   5016   */
  3121   5017   int sqlite3_create_module_v2(
  3122   5018     sqlite3 *db,               /* SQLite connection to register module with */
  3123   5019     const char *zName,         /* Name of the module */
  3124   5020     const sqlite3_module *,    /* Methods for the module */
  3125   5021     void *,                    /* Client data for xCreate/xConnect */
  3126   5022     void(*xDestroy)(void*)     /* Module destructor function */
  3127   5023   );
  3128   5024   
  3129   5025   /*
         5026  +** CAPI3REF: Virtual Table Instance Object {F18010}
         5027  +** KEYWORDS: sqlite3_vtab
         5028  +**
  3130   5029   ** Every module implementation uses a subclass of the following structure
  3131   5030   ** to describe a particular instance of the module.  Each subclass will
  3132   5031   ** be tailored to the specific needs of the module implementation.   The
  3133   5032   ** purpose of this superclass is to define certain fields that are common
  3134   5033   ** to all module implementations.
  3135   5034   **
  3136   5035   ** Virtual tables methods can set an error message by assigning a
................................................................................
  3146   5045   struct sqlite3_vtab {
  3147   5046     const sqlite3_module *pModule;  /* The module for this virtual table */
  3148   5047     int nRef;                       /* Used internally */
  3149   5048     char *zErrMsg;                  /* Error message from sqlite3_mprintf() */
  3150   5049     /* Virtual table implementations will typically add additional fields */
  3151   5050   };
  3152   5051   
  3153         -/* Every module implementation uses a subclass of the following structure
         5052  +/*
         5053  +** CAPI3REF: Virtual Table Cursor Object  {F18020}
         5054  +** KEYWORDS: sqlite3_vtab_cursor
         5055  +**
         5056  +** Every module implementation uses a subclass of the following structure
  3154   5057   ** to describe cursors that point into the virtual table and are used
  3155   5058   ** to loop through the virtual table.  Cursors are created using the
  3156   5059   ** xOpen method of the module.  Each module implementation will define
  3157   5060   ** the content of a cursor structure to suit its own needs.
  3158   5061   **
  3159   5062   ** This superclass exists in order to define fields of the cursor that
  3160   5063   ** are common to all implementations.
................................................................................
  3161   5064   */
  3162   5065   struct sqlite3_vtab_cursor {
  3163   5066     sqlite3_vtab *pVtab;      /* Virtual table of this cursor */
  3164   5067     /* Virtual table implementations will typically add additional fields */
  3165   5068   };
  3166   5069   
  3167   5070   /*
         5071  +** CAPI3REF: Declare The Schema Of A Virtual Table {F18280}
         5072  +**
  3168   5073   ** The xCreate and xConnect methods of a module use the following API
  3169   5074   ** to declare the format (the names and datatypes of the columns) of
  3170   5075   ** the virtual tables they implement.
  3171   5076   */
  3172   5077   int sqlite3_declare_vtab(sqlite3*, const char *zCreateTable);
  3173   5078   
  3174   5079   /*
         5080  +** CAPI3REF: Overload A Function For A Virtual Table {F18300}
         5081  +**
  3175   5082   ** Virtual tables can provide alternative implementations of functions
  3176   5083   ** using the xFindFunction method.  But global versions of those functions
  3177   5084   ** must exist in order to be overloaded.
  3178   5085   **
  3179   5086   ** This API makes sure a global version of a function with a particular
  3180   5087   ** name and number of parameters exists.  If no such function exists
  3181   5088   ** before this API is called, a new function is created.  The implementation
................................................................................
  3198   5105   ** When the virtual-table mechanism stabilizes, we will declare the
  3199   5106   ** interface fixed, support it indefinitely, and remove this comment.
  3200   5107   **
  3201   5108   ****** EXPERIMENTAL - subject to change without notice **************
  3202   5109   */
  3203   5110   
  3204   5111   /*
  3205         -** CAPI3REF: A Handle To An Open BLOB
         5112  +** CAPI3REF: A Handle To An Open BLOB {F17800}
  3206   5113   **
  3207         -** An instance of the following opaque structure is used to 
  3208         -** represent an blob-handle.  A blob-handle is created by
         5114  +** An instance of this object represents an open BLOB on which
         5115  +** incremental I/O can be preformed.
         5116  +** Objects of this type are created by
  3209   5117   ** [sqlite3_blob_open()] and destroyed by [sqlite3_blob_close()].
  3210   5118   ** The [sqlite3_blob_read()] and [sqlite3_blob_write()] interfaces
  3211   5119   ** can be used to read or write small subsections of the blob.
  3212   5120   ** The [sqlite3_blob_bytes()] interface returns the size of the
  3213   5121   ** blob in bytes.
  3214   5122   */
  3215   5123   typedef struct sqlite3_blob sqlite3_blob;
  3216   5124   
  3217   5125   /*
  3218         -** CAPI3REF: Open A BLOB For Incremental I/O
         5126  +** CAPI3REF: Open A BLOB For Incremental I/O {F17810}
  3219   5127   **
  3220         -** Open a handle to the blob located in row iRow,, column zColumn, 
  3221         -** table zTable in database zDb. i.e. the same blob that would
  3222         -** be selected by:
         5128  +** This interfaces opens a handle to the blob located
         5129  +** in row iRow, column zColumn, table zTable in database zDb;
         5130  +** in other words,  the same blob that would be selected by:
  3223   5131   **
  3224   5132   ** <pre>
  3225   5133   **     SELECT zColumn FROM zDb.zTable WHERE rowid = iRow;
  3226         -** </pre>
         5134  +** </pre> {END}
  3227   5135   **
  3228   5136   ** If the flags parameter is non-zero, the blob is opened for 
  3229   5137   ** read and write access. If it is zero, the blob is opened for read 
  3230   5138   ** access.
         5139  +**
         5140  +** Note that the database name is not the filename that contains
         5141  +** the database but rather the symbolic name of the database that
         5142  +** is assigned when the database is connected using [ATTACH].
         5143  +** For the main database file, the database name is "main".  For
         5144  +** TEMP tables, the database name is "temp".
  3231   5145   **
  3232   5146   ** On success, [SQLITE_OK] is returned and the new 
  3233         -** [sqlite3_blob | blob handle] is written to *ppBlob.
         5147  +** [sqlite3_blob | blob handle] is written to *ppBlob. 
  3234   5148   ** Otherwise an error code is returned and 
  3235   5149   ** any value written to *ppBlob should not be used by the caller.
  3236   5150   ** This function sets the database-handle error code and message
  3237   5151   ** accessible via [sqlite3_errcode()] and [sqlite3_errmsg()].
         5152  +** 
         5153  +** INVARIANTS:
         5154  +**
         5155  +** {F17813} A successful invocation of the [sqlite3_blob_open(D,B,T,C,R,F,P)]
         5156  +**          interface opens an [sqlite3_blob] object P on the blob
         5157  +**          in column C of table T in database B on [database connection] D.
         5158  +**
         5159  +** {F17814} A successful invocation of [sqlite3_blob_open(D,...)] starts
         5160  +**          a new transaction on [database connection] D if that connection
         5161  +**          is not already in a transaction.
         5162  +**
         5163  +** {F17816} The [sqlite3_blob_open(D,B,T,C,R,F,P)] interface opens the blob
         5164  +**          for read and write access if and only if the F parameter
         5165  +**          is non-zero.
         5166  +**
         5167  +** {F17819} The [sqlite3_blob_open()] interface returns [SQLITE_OK] on 
         5168  +**          success and an appropriate [error code] on failure.
         5169  +**
         5170  +** {F17821} If an error occurs during evaluation of [sqlite3_blob_open(D,...)]
         5171  +**          then subsequent calls to [sqlite3_errcode(D)],
         5172  +**          [sqlite3_errmsg(D)], and [sqlite3_errmsg16(D)] will return
         5173  +**          information approprate for that error.
  3238   5174   */
  3239   5175   int sqlite3_blob_open(
  3240   5176     sqlite3*,
  3241   5177     const char *zDb,
  3242   5178     const char *zTable,
  3243   5179     const char *zColumn,
  3244   5180     sqlite3_int64 iRow,
  3245   5181     int flags,
  3246   5182     sqlite3_blob **ppBlob
  3247   5183   );
  3248   5184   
  3249   5185   /*
  3250         -** CAPI3REF:  Close A BLOB Handle
         5186  +** CAPI3REF:  Close A BLOB Handle {F17830}
  3251   5187   **
  3252   5188   ** Close an open [sqlite3_blob | blob handle].
         5189  +**
         5190  +** Closing a BLOB shall cause the current transaction to commit
         5191  +** if there are no other BLOBs, no pending prepared statements, and the
         5192  +** database connection is in autocommit mode.
         5193  +** If any writes were made to the BLOB, they might be held in cache
         5194  +** until the close operation if they will fit. {END}
         5195  +** Closing the BLOB often forces the changes
         5196  +** out to disk and so if any I/O errors occur, they will likely occur
         5197  +** at the time when the BLOB is closed.  {F17833} Any errors that occur during
         5198  +** closing are reported as a non-zero return value.
         5199  +**
         5200  +** The BLOB is closed unconditionally.  Even if this routine returns
         5201  +** an error code, the BLOB is still closed.
         5202  +**
         5203  +** INVARIANTS:
         5204  +**
         5205  +** {F17833} The [sqlite3_blob_close(P)] interface closes an
         5206  +**          [sqlite3_blob] object P previously opened using
         5207  +**          [sqlite3_blob_open()].
         5208  +**
         5209  +** {F17836} Closing an [sqlite3_blob] object using
         5210  +**          [sqlite3_blob_close()] shall cause the current transaction to
         5211  +**          commit if there are no other open [sqlite3_blob] objects
         5212  +**          or [prepared statements] on the same [database connection] and
         5213  +**          the [database connection] is in
         5214  +**          [sqlite3_get_autocommit | autocommit mode].
         5215  +**
         5216  +** {F17839} The [sqlite3_blob_close(P)] interfaces closes the 
         5217  +**          [sqlite3_blob] object P unconditionally, even if
         5218  +**          [sqlite3_blob_close(P)] returns something other than [SQLITE_OK].
         5219  +**          
  3253   5220   */
  3254   5221   int sqlite3_blob_close(sqlite3_blob *);
  3255   5222   
  3256   5223   /*
  3257         -** CAPI3REF:  Return The Size Of An Open BLOB
         5224  +** CAPI3REF:  Return The Size Of An Open BLOB {F17840}
  3258   5225   **
  3259   5226   ** Return the size in bytes of the blob accessible via the open 
  3260         -** [sqlite3_blob | blob-handle] passed as an argument.
         5227  +** [sqlite3_blob] object in its only argument.
         5228  +**
         5229  +** INVARIANTS:
         5230  +**
         5231  +** {F17843} The [sqlite3_blob_bytes(P)] interface returns the size
         5232  +**          in bytes of the BLOB that the [sqlite3_blob] object P
         5233  +**          refers to.
  3261   5234   */
  3262   5235   int sqlite3_blob_bytes(sqlite3_blob *);
  3263   5236   
  3264   5237   /*
  3265         -** CAPI3REF:  Read Data From A BLOB Incrementally
         5238  +** CAPI3REF:  Read Data From A BLOB Incrementally {F17850}
  3266   5239   **
  3267   5240   ** This function is used to read data from an open 
  3268   5241   ** [sqlite3_blob | blob-handle] into a caller supplied buffer.
  3269         -** n bytes of data are copied into buffer
  3270         -** z from the open blob, starting at offset iOffset.
         5242  +** N bytes of data are copied into buffer
         5243  +** Z from the open blob, starting at offset iOffset.
         5244  +**
         5245  +** If offset iOffset is less than N bytes from the end of the blob, 
         5246  +** [SQLITE_ERROR] is returned and no data is read.  If N or iOffset is
         5247  +** less than zero [SQLITE_ERROR] is returned and no data is read.
  3271   5248   **
  3272   5249   ** On success, SQLITE_OK is returned. Otherwise, an 
  3273         -** [SQLITE_ERROR | SQLite error code] or an
  3274         -** [SQLITE_IOERR_READ | extended error code] is returned.
         5250  +** [error code] or an [extended error code] is returned.
         5251  +**
         5252  +** INVARIANTS:
         5253  +**
         5254  +** {F17853} The [sqlite3_blob_read(P,Z,N,X)] interface reads N bytes
         5255  +**          beginning at offset X from
         5256  +**          the blob that [sqlite3_blob] object P refers to
         5257  +**          and writes those N bytes into buffer Z.
         5258  +**
         5259  +** {F17856} In [sqlite3_blob_read(P,Z,N,X)] if the size of the blob
         5260  +**          is less than N+X bytes, then the function returns [SQLITE_ERROR]
         5261  +**          and nothing is read from the blob.
         5262  +**
         5263  +** {F17859} In [sqlite3_blob_read(P,Z,N,X)] if X or N is less than zero
         5264  +**          then the function returns [SQLITE_ERROR]
         5265  +**          and nothing is read from the blob.
         5266  +**
         5267  +** {F17862} The [sqlite3_blob_read(P,Z,N,X)] interface returns [SQLITE_OK]
         5268  +**          if N bytes where successfully read into buffer Z.
         5269  +**
         5270  +** {F17865} If the requested read could not be completed,
         5271  +**          the [sqlite3_blob_read(P,Z,N,X)] interface returns an
         5272  +**          appropriate [error code] or [extended error code].
         5273  +**
         5274  +** {F17868} If an error occurs during evaluation of [sqlite3_blob_read(P,...)]
         5275  +**          then subsequent calls to [sqlite3_errcode(D)],
         5276  +**          [sqlite3_errmsg(D)], and [sqlite3_errmsg16(D)] will return
         5277  +**          information approprate for that error, where D is the
         5278  +**          database handle that was used to open blob handle P.
  3275   5279   */
  3276         -int sqlite3_blob_read(sqlite3_blob *, void *z, int n, int iOffset);
         5280  +int sqlite3_blob_read(sqlite3_blob *, void *Z, int N, int iOffset);
  3277   5281   
  3278   5282   /*
  3279         -** CAPI3REF:  Write Data Into A BLOB Incrementally
         5283  +** CAPI3REF:  Write Data Into A BLOB Incrementally {F17870}
  3280   5284   **
  3281   5285   ** This function is used to write data into an open 
  3282   5286   ** [sqlite3_blob | blob-handle] from a user supplied buffer.
  3283   5287   ** n bytes of data are copied from the buffer
  3284   5288   ** pointed to by z into the open blob, starting at offset iOffset.
  3285   5289   **
  3286   5290   ** If the [sqlite3_blob | blob-handle] passed as the first argument
  3287   5291   ** was not opened for writing (the flags parameter to [sqlite3_blob_open()]
  3288   5292   *** was zero), this function returns [SQLITE_READONLY].
  3289   5293   **
  3290         -** This function may only modify the contents of the blob, it is
  3291         -** not possible to increase the size of a blob using this API. If
  3292         -** offset iOffset is less than n bytes from the end of the blob, 
  3293         -** [SQLITE_ERROR] is returned and no data is written.
         5294  +** This function may only modify the contents of the blob; it is
         5295  +** not possible to increase the size of a blob using this API.
         5296  +** If offset iOffset is less than n bytes from the end of the blob, 
         5297  +** [SQLITE_ERROR] is returned and no data is written.  If n is
         5298  +** less than zero [SQLITE_ERROR] is returned and no data is written.
  3294   5299   **
  3295   5300   ** On success, SQLITE_OK is returned. Otherwise, an 
  3296         -** [SQLITE_ERROR | SQLite error code] or an
  3297         -** [SQLITE_IOERR_READ | extended error code] is returned.
         5301  +** [error code] or an [extended error code] is returned.
         5302  +**
         5303  +** INVARIANTS:
         5304  +**
         5305  +** {F17873} The [sqlite3_blob_write(P,Z,N,X)] interface writes N bytes
         5306  +**          from buffer Z into
         5307  +**          the blob that [sqlite3_blob] object P refers to
         5308  +**          beginning at an offset of X into the blob.
         5309  +**
         5310  +** {F17875} The [sqlite3_blob_write(P,Z,N,X)] interface returns
         5311  +**          [SQLITE_READONLY] if the [sqlite3_blob] object P was
         5312  +**          [sqlite3_blob_open | opened] for reading only.
         5313  +**
         5314  +** {F17876} In [sqlite3_blob_write(P,Z,N,X)] if the size of the blob
         5315  +**          is less than N+X bytes, then the function returns [SQLITE_ERROR]
         5316  +**          and nothing is written into the blob.
         5317  +**
         5318  +** {F17879} In [sqlite3_blob_write(P,Z,N,X)] if X or N is less than zero
         5319  +**          then the function returns [SQLITE_ERROR]
         5320  +**          and nothing is written into the blob.
         5321  +**
         5322  +** {F17882} The [sqlite3_blob_write(P,Z,N,X)] interface returns [SQLITE_OK]
         5323  +**          if N bytes where successfully written into blob.
         5324  +**
         5325  +** {F17885} If the requested write could not be completed,
         5326  +**          the [sqlite3_blob_write(P,Z,N,X)] interface returns an
         5327  +**          appropriate [error code] or [extended error code].
         5328  +**
         5329  +** {F17888} If an error occurs during evaluation of [sqlite3_blob_write(D,...)]
         5330  +**          then subsequent calls to [sqlite3_errcode(D)],
         5331  +**          [sqlite3_errmsg(D)], and [sqlite3_errmsg16(D)] will return
         5332  +**          information approprate for that error.
  3298   5333   */
  3299   5334   int sqlite3_blob_write(sqlite3_blob *, const void *z, int n, int iOffset);
  3300   5335   
  3301   5336   /*
  3302         -** CAPI3REF:  Virtual File System Objects
         5337  +** CAPI3REF:  Virtual File System Objects {F11200}
  3303   5338   **
  3304   5339   ** A virtual filesystem (VFS) is an [sqlite3_vfs] object
  3305   5340   ** that SQLite uses to interact
  3306         -** with the underlying operating system.  Most builds come with a
         5341  +** with the underlying operating system.  Most SQLite builds come with a
  3307   5342   ** single default VFS that is appropriate for the host computer.
  3308   5343   ** New VFSes can be registered and existing VFSes can be unregistered.
  3309   5344   ** The following interfaces are provided.
  3310   5345   **
  3311         -** The sqlite3_vfs_find() interface returns a pointer to a VFS given its
  3312         -** name.  Names are case sensitive.  If there is no match, a NULL
         5346  +** The sqlite3_vfs_find() interface returns a pointer to 
         5347  +** a VFS given its name.  Names are case sensitive.
         5348  +** Names are zero-terminated UTF-8 strings.
         5349  +** If there is no match, a NULL
  3313   5350   ** pointer is returned.  If zVfsName is NULL then the default 
  3314         -** VFS is returned.
         5351  +** VFS is returned. 
  3315   5352   **
  3316         -** New VFSes are registered with sqlite3_vfs_register().  Each
  3317         -** new VFS becomes the default VFS if the makeDflt flag is set.
         5353  +** New VFSes are registered with sqlite3_vfs_register().
         5354  +** Each new VFS becomes the default VFS if the makeDflt flag is set.
  3318   5355   ** The same VFS can be registered multiple times without injury.
  3319   5356   ** To make an existing VFS into the default VFS, register it again
  3320   5357   ** with the makeDflt flag set.  If two different VFSes with the
  3321   5358   ** same name are registered, the behavior is undefined.  If a
  3322   5359   ** VFS is registered with a name that is NULL or an empty string,
  3323   5360   ** then the behavior is undefined.
  3324   5361   ** 
  3325   5362   ** Unregister a VFS with the sqlite3_vfs_unregister() interface.
  3326   5363   ** If the default VFS is unregistered, another VFS is chosen as
  3327   5364   ** the default.  The choice for the new VFS is arbitrary.
         5365  +**
         5366  +** INVARIANTS:
         5367  +**
         5368  +** {F11203} The [sqlite3_vfs_find(N)] interface returns a pointer to the
         5369  +**          registered [sqlite3_vfs] object whose name exactly matches
         5370  +**          the zero-terminated UTF-8 string N, or it returns NULL if
         5371  +**          there is no match.
         5372  +**
         5373  +** {F11206} If the N parameter to [sqlite3_vfs_find(N)] is NULL then
         5374  +**          the function returns a pointer to the default [sqlite3_vfs]
         5375  +**          object if there is one, or NULL if there is no default 
         5376  +**          [sqlite3_vfs] object.
         5377  +**
         5378  +** {F11209} The [sqlite3_vfs_register(P,F)] interface registers the
         5379  +**          well-formed [sqlite3_vfs] object P using the name given
         5380  +**          by the zName field of the object.
         5381  +**
         5382  +** {F11212} Using the [sqlite3_vfs_register(P,F)] interface to register
         5383  +**          the same [sqlite3_vfs] object multiple times is a harmless no-op.
         5384  +**
         5385  +** {F11215} The [sqlite3_vfs_register(P,F)] interface makes the
         5386  +**          the [sqlite3_vfs] object P the default [sqlite3_vfs] object
         5387  +**          if F is non-zero.
         5388  +**
         5389  +** {F11218} The [sqlite3_vfs_unregister(P)] interface unregisters the
         5390  +**          [sqlite3_vfs] object P so that it is no longer returned by
         5391  +**          subsequent calls to [sqlite3_vfs_find()].
  3328   5392   */
  3329   5393   sqlite3_vfs *sqlite3_vfs_find(const char *zVfsName);
  3330   5394   int sqlite3_vfs_register(sqlite3_vfs*, int makeDflt);
  3331   5395   int sqlite3_vfs_unregister(sqlite3_vfs*);
  3332   5396   
  3333   5397   /*
  3334         -** CAPI3REF: Mutexes
         5398  +** CAPI3REF: Mutexes {F17000}
  3335   5399   **
  3336   5400   ** The SQLite core uses these routines for thread
  3337   5401   ** synchronization.  Though they are intended for internal
  3338   5402   ** use by SQLite, code that links against SQLite is
  3339   5403   ** permitted to use any of these routines.
  3340   5404   **
  3341   5405   ** The SQLite source code contains multiple implementations 
................................................................................
  3361   5425   ** implementation is included with the library.  The
  3362   5426   ** mutex interface routines defined here become external
  3363   5427   ** references in the SQLite library for which implementations
  3364   5428   ** must be provided by the application.  This facility allows an
  3365   5429   ** application that links against SQLite to provide its own mutex
  3366   5430   ** implementation without having to modify the SQLite core.
  3367   5431   **
  3368         -** The sqlite3_mutex_alloc() routine allocates a new
  3369         -** mutex and returns a pointer to it.  If it returns NULL
  3370         -** that means that a mutex could not be allocated.  SQLite
  3371         -** will unwind its stack and return an error.  The argument
         5432  +** {F17011} The sqlite3_mutex_alloc() routine allocates a new
         5433  +** mutex and returns a pointer to it. {F17012} If it returns NULL
         5434  +** that means that a mutex could not be allocated. {F17013} SQLite
         5435  +** will unwind its stack and return an error. {F17014} The argument
  3372   5436   ** to sqlite3_mutex_alloc() is one of these integer constants:
  3373   5437   **
  3374   5438   ** <ul>
  3375   5439   ** <li>  SQLITE_MUTEX_FAST
  3376   5440   ** <li>  SQLITE_MUTEX_RECURSIVE
  3377   5441   ** <li>  SQLITE_MUTEX_STATIC_MASTER
  3378   5442   ** <li>  SQLITE_MUTEX_STATIC_MEM
  3379   5443   ** <li>  SQLITE_MUTEX_STATIC_MEM2
  3380   5444   ** <li>  SQLITE_MUTEX_STATIC_PRNG
  3381   5445   ** <li>  SQLITE_MUTEX_STATIC_LRU
  3382         -** </ul>
         5446  +** <li>  SQLITE_MUTEX_STATIC_LRU2
         5447  +** </ul> {END}
  3383   5448   **
  3384         -** The first two constants cause sqlite3_mutex_alloc() to create
         5449  +** {F17015} The first two constants cause sqlite3_mutex_alloc() to create
  3385   5450   ** a new mutex.  The new mutex is recursive when SQLITE_MUTEX_RECURSIVE
  3386         -** is used but not necessarily so when SQLITE_MUTEX_FAST is used.
         5451  +** is used but not necessarily so when SQLITE_MUTEX_FAST is used. {END}
  3387   5452   ** The mutex implementation does not need to make a distinction
  3388   5453   ** between SQLITE_MUTEX_RECURSIVE and SQLITE_MUTEX_FAST if it does
  3389         -** not want to.  But SQLite will only request a recursive mutex in
  3390         -** cases where it really needs one.  If a faster non-recursive mutex
         5454  +** not want to.  {F17016} But SQLite will only request a recursive mutex in
         5455  +** cases where it really needs one.  {END} If a faster non-recursive mutex
  3391   5456   ** implementation is available on the host platform, the mutex subsystem
  3392   5457   ** might return such a mutex in response to SQLITE_MUTEX_FAST.
  3393   5458   **
  3394         -** The other allowed parameters to sqlite3_mutex_alloc() each return
  3395         -** a pointer to a static preexisting mutex.  Four static mutexes are
         5459  +** {F17017} The other allowed parameters to sqlite3_mutex_alloc() each return
         5460  +** a pointer to a static preexisting mutex. {END}  Four static mutexes are
  3396   5461   ** used by the current version of SQLite.  Future versions of SQLite
  3397   5462   ** may add additional static mutexes.  Static mutexes are for internal
  3398   5463   ** use by SQLite only.  Applications that use SQLite mutexes should
  3399   5464   ** use only the dynamic mutexes returned by SQLITE_MUTEX_FAST or
  3400   5465   ** SQLITE_MUTEX_RECURSIVE.
  3401   5466   **
  3402         -** Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST
         5467  +** {F17018} Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST
  3403   5468   ** or SQLITE_MUTEX_RECURSIVE) is used then sqlite3_mutex_alloc()
  3404         -** returns a different mutex on every call.  But for the static 
         5469  +** returns a different mutex on every call.  {F17034} But for the static 
  3405   5470   ** mutex types, the same mutex is returned on every call that has
  3406         -** the same type number.
         5471  +** the same type number. {END}
  3407   5472   **
  3408         -** The sqlite3_mutex_free() routine deallocates a previously
  3409         -** allocated dynamic mutex.  SQLite is careful to deallocate every
  3410         -** dynamic mutex that it allocates.  The dynamic mutexes must not be in 
  3411         -** use when they are deallocated.  Attempting to deallocate a static
  3412         -** mutex results in undefined behavior.  SQLite never deallocates
  3413         -** a static mutex.
         5473  +** {F17019} The sqlite3_mutex_free() routine deallocates a previously
         5474  +** allocated dynamic mutex. {F17020} SQLite is careful to deallocate every
         5475  +** dynamic mutex that it allocates. {U17021} The dynamic mutexes must not be in 
         5476  +** use when they are deallocated. {U17022} Attempting to deallocate a static
         5477  +** mutex results in undefined behavior. {F17023} SQLite never deallocates
         5478  +** a static mutex. {END}
  3414   5479   **
  3415   5480   ** The sqlite3_mutex_enter() and sqlite3_mutex_try() routines attempt
  3416         -** to enter a mutex.  If another thread is already within the mutex,
         5481  +** to enter a mutex. {F17024} If another thread is already within the mutex,
  3417   5482   ** sqlite3_mutex_enter() will block and sqlite3_mutex_try() will return
  3418         -** SQLITE_BUSY.  The sqlite3_mutex_try() interface returns SQLITE_OK
  3419         -** upon successful entry.  Mutexes created using SQLITE_MUTEX_RECURSIVE can
  3420         -** be entered multiple times by the same thread.  In such cases the,
         5483  +** SQLITE_BUSY. {F17025}  The sqlite3_mutex_try() interface returns SQLITE_OK
         5484  +** upon successful entry.  {F17026} Mutexes created using
         5485  +** SQLITE_MUTEX_RECURSIVE can be entered multiple times by the same thread.
         5486  +** {F17027} In such cases the,
  3421   5487   ** mutex must be exited an equal number of times before another thread
  3422         -** can enter.  If the same thread tries to enter any other kind of mutex
  3423         -** more than once, the behavior is undefined.   SQLite will never exhibit
  3424         -** such behavior in its own use of mutexes.
         5488  +** can enter.  {U17028} If the same thread tries to enter any other
         5489  +** kind of mutex more than once, the behavior is undefined.
         5490  +** {F17029} SQLite will never exhibit
         5491  +** such behavior in its own use of mutexes. {END}
  3425   5492   **
  3426   5493   ** Some systems (ex: windows95) do not the operation implemented by
  3427   5494   ** sqlite3_mutex_try().  On those systems, sqlite3_mutex_try() will
  3428         -** always return SQLITE_BUSY.  The SQLite core only ever uses
  3429         -** sqlite3_mutex_try() as an optimization so this is acceptable behavior.
         5495  +** always return SQLITE_BUSY.  {F17030} The SQLite core only ever uses
         5496  +** sqlite3_mutex_try() as an optimization so this is acceptable behavior. {END}
  3430   5497   **
  3431         -** The sqlite3_mutex_leave() routine exits a mutex that was
  3432         -** previously entered by the same thread.  The behavior
         5498  +** {F17031} The sqlite3_mutex_leave() routine exits a mutex that was
         5499  +** previously entered by the same thread.  {U17032} The behavior
  3433   5500   ** is undefined if the mutex is not currently entered by the
  3434         -** calling thread or is not currently allocated.  SQLite will
  3435         -** never do either.
         5501  +** calling thread or is not currently allocated.  {F17033} SQLite will
         5502  +** never do either. {END}
  3436   5503   **
  3437   5504   ** See also: [sqlite3_mutex_held()] and [sqlite3_mutex_notheld()].
  3438   5505   */
  3439   5506   sqlite3_mutex *sqlite3_mutex_alloc(int);
  3440   5507   void sqlite3_mutex_free(sqlite3_mutex*);
  3441   5508   void sqlite3_mutex_enter(sqlite3_mutex*);
  3442   5509   int sqlite3_mutex_try(sqlite3_mutex*);
  3443   5510   void sqlite3_mutex_leave(sqlite3_mutex*);
  3444   5511   
  3445   5512   /*
  3446         -** CAPI3REF: Mutex Verifcation Routines
         5513  +** CAPI3REF: Mutex Verifcation Routines {F17080}
  3447   5514   **
  3448   5515   ** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routines
  3449         -** are intended for use inside assert() statements.  The SQLite core
         5516  +** are intended for use inside assert() statements. {F17081} The SQLite core
  3450   5517   ** never uses these routines except inside an assert() and applications
  3451         -** are advised to follow the lead of the core.  The core only
         5518  +** are advised to follow the lead of the core.  {F17082} The core only
  3452   5519   ** provides implementations for these routines when it is compiled
  3453         -** with the SQLITE_DEBUG flag.  External mutex implementations
         5520  +** with the SQLITE_DEBUG flag.  {U17087} External mutex implementations
  3454   5521   ** are only required to provide these routines if SQLITE_DEBUG is
  3455   5522   ** defined and if NDEBUG is not defined.
  3456   5523   **
  3457         -** These routines should return true if the mutex in their argument
  3458         -** is held or not held, respectively, by the calling thread.
         5524  +** {F17083} These routines should return true if the mutex in their argument
         5525  +** is held or not held, respectively, by the calling thread. {END}
  3459   5526   **
  3460         -** The implementation is not required to provided versions of these
         5527  +** {X17084} The implementation is not required to provided versions of these
  3461   5528   ** routines that actually work.
  3462   5529   ** If the implementation does not provide working
  3463   5530   ** versions of these routines, it should at least provide stubs
  3464   5531   ** that always return true so that one does not get spurious
  3465         -** assertion failures.
         5532  +** assertion failures. {END}
  3466   5533   **
  3467         -** If the argument to sqlite3_mutex_held() is a NULL pointer then
  3468         -** the routine should return 1.  This seems counter-intuitive since
         5534  +** {F17085} If the argument to sqlite3_mutex_held() is a NULL pointer then
         5535  +** the routine should return 1.  {END} This seems counter-intuitive since
  3469   5536   ** clearly the mutex cannot be held if it does not exist.  But the
  3470   5537   ** the reason the mutex does not exist is because the build is not
  3471   5538   ** using mutexes.  And we do not want the assert() containing the
  3472   5539   ** call to sqlite3_mutex_held() to fail, so a non-zero return is
  3473         -** the appropriate thing to do.  The sqlite3_mutex_notheld() 
         5540  +** the appropriate thing to do.  {F17086} The sqlite3_mutex_notheld() 
  3474   5541   ** interface should also return 1 when given a NULL pointer.
  3475   5542   */
  3476   5543   int sqlite3_mutex_held(sqlite3_mutex*);
  3477   5544   int sqlite3_mutex_notheld(sqlite3_mutex*);
  3478   5545   
  3479   5546   /*
  3480         -** CAPI3REF: Mutex Types
         5547  +** CAPI3REF: Mutex Types {F17001}
  3481   5548   **
  3482         -** The [sqlite3_mutex_alloc()] interface takes a single argument
  3483         -** which is one of these integer constants.
         5549  +** {F17002} The [sqlite3_mutex_alloc()] interface takes a single argument
         5550  +** which is one of these integer constants. {END}
  3484   5551   */
  3485   5552   #define SQLITE_MUTEX_FAST             0
  3486   5553   #define SQLITE_MUTEX_RECURSIVE        1
  3487   5554   #define SQLITE_MUTEX_STATIC_MASTER    2
  3488   5555   #define SQLITE_MUTEX_STATIC_MEM       3  /* sqlite3_malloc() */
  3489   5556   #define SQLITE_MUTEX_STATIC_MEM2      4  /* sqlite3_release_memory() */
  3490   5557   #define SQLITE_MUTEX_STATIC_PRNG      5  /* sqlite3_random() */
  3491   5558   #define SQLITE_MUTEX_STATIC_LRU       6  /* lru page list */
         5559  +#define SQLITE_MUTEX_STATIC_LRU2      7  /* lru page list */
  3492   5560   
  3493   5561   /*
  3494         -** CAPI3REF: Low-Level Control Of Database Files
         5562  +** CAPI3REF: Low-Level Control Of Database Files {F11300}
  3495   5563   **
  3496         -** The [sqlite3_file_control()] interface makes a direct call to the
         5564  +** {F11301} The [sqlite3_file_control()] interface makes a direct call to the
  3497   5565   ** xFileControl method for the [sqlite3_io_methods] object associated
  3498         -** with a particular database identified by the second argument.  The
         5566  +** with a particular database identified by the second argument. {F11302} The
  3499   5567   ** name of the database is the name assigned to the database by the
  3500   5568   ** <a href="lang_attach.html">ATTACH</a> SQL command that opened the
  3501         -** database.  To control the main database file, use the name "main"
  3502         -** or a NULL pointer.  The third and fourth parameters to this routine
         5569  +** database. {F11303} To control the main database file, use the name "main"
         5570  +** or a NULL pointer. {F11304} The third and fourth parameters to this routine
  3503   5571   ** are passed directly through to the second and third parameters of
  3504         -** the xFileControl method.  The return value of the xFileControl
         5572  +** the xFileControl method.  {F11305} The return value of the xFileControl
  3505   5573   ** method becomes the return value of this routine.
  3506   5574   **
  3507         -** If the second parameter (zDbName) does not match the name of any
  3508         -** open database file, then SQLITE_ERROR is returned.  This error
         5575  +** {F11306} If the second parameter (zDbName) does not match the name of any
         5576  +** open database file, then SQLITE_ERROR is returned. {F11307} This error
  3509   5577   ** code is not remembered and will not be recalled by [sqlite3_errcode()]
  3510         -** or [sqlite3_errmsg()].  The underlying xFileControl method might
  3511         -** also return SQLITE_ERROR.  There is no way to distinguish between
         5578  +** or [sqlite3_errmsg()]. {U11308} The underlying xFileControl method might
         5579  +** also return SQLITE_ERROR.  {U11309} There is no way to distinguish between
  3512   5580   ** an incorrect zDbName and an SQLITE_ERROR return from the underlying
  3513         -** xFileControl method.
         5581  +** xFileControl method. {END}
  3514   5582   **
  3515   5583   ** See also: [SQLITE_FCNTL_LOCKSTATE]
  3516   5584   */
  3517   5585   int sqlite3_file_control(sqlite3*, const char *zDbName, int op, void*);
         5586  +
         5587  +/*
         5588  +** CAPI3REF: Testing Interface {F11400}
         5589  +**
         5590  +** The sqlite3_test_control() interface is used to read out internal
         5591  +** state of SQLite and to inject faults into SQLite for testing
         5592  +** purposes.  The first parameter a operation code that determines
         5593  +** the number, meaning, and operation of all subsequent parameters.
         5594  +**
         5595  +** This interface is not for use by applications.  It exists solely
         5596  +** for verifying the correct operation of the SQLite library.  Depending
         5597  +** on how the SQLite library is compiled, this interface might not exist.
         5598  +**
         5599  +** The details of the operation codes, their meanings, the parameters
         5600  +** they take, and what they do are all subject to change without notice.
         5601  +** Unlike most of the SQLite API, this function is not guaranteed to
         5602  +** operate consistently from one release to the next.
         5603  +*/
         5604  +int sqlite3_test_control(int op, ...);
         5605  +
         5606  +/*
         5607  +** CAPI3REF: Testing Interface Operation Codes {F11410}
         5608  +**
         5609  +** These constants are the valid operation code parameters used
         5610  +** as the first argument to [sqlite3_test_control()].
         5611  +**
         5612  +** These parameters and their meansing are subject to change
         5613  +** without notice.  These values are for testing purposes only.
         5614  +** Applications should not use any of these parameters or the
         5615  +** [sqlite3_test_control()] interface.
         5616  +*/
         5617  +#define SQLITE_TESTCTRL_FAULT_CONFIG             1
         5618  +#define SQLITE_TESTCTRL_FAULT_FAILURES           2
         5619  +#define SQLITE_TESTCTRL_FAULT_BENIGN_FAILURES    3
         5620  +#define SQLITE_TESTCTRL_FAULT_PENDING            4
         5621  +#define SQLITE_TESTCTRL_PRNG_SAVE                5
         5622  +#define SQLITE_TESTCTRL_PRNG_RESTORE             6
         5623  +#define SQLITE_TESTCTRL_PRNG_RESET               7
         5624  +#define SQLITE_TESTCTRL_BITVEC_TEST              8
         5625  +
  3518   5626   
  3519   5627   /*
  3520   5628   ** Undo the hack that converts floating point types to integer for
  3521   5629   ** builds on processors without floating point support.
  3522   5630   */
  3523   5631   #ifdef SQLITE_OMIT_FLOATING_POINT
  3524   5632   # undef double
  3525   5633   #endif
  3526   5634   
  3527   5635   #ifdef __cplusplus
  3528   5636   }  /* End of the 'extern "C"' block */
  3529   5637   #endif
  3530   5638   #endif

Changes to SQLite.Interop/src/sqlite3ext.h.

    11     11   *************************************************************************
    12     12   ** This header file defines the SQLite interface for use by
    13     13   ** shared libraries that want to be imported as extensions into
    14     14   ** an SQLite instance.  Shared libraries that intend to be loaded
    15     15   ** as extensions by SQLite should #include this file instead of 
    16     16   ** sqlite3.h.
    17     17   **
    18         -** @(#) $Id: sqlite3ext.h,v 1.10 2007/12/04 16:11:14 rmsimpson Exp $
           18  +** @(#) $Id: sqlite3ext.h,v 1.11 2008/05/28 08:25:00 rmsimpson Exp $
    19     19   */
    20     20   #ifndef _SQLITE3EXT_H_
    21     21   #define _SQLITE3EXT_H_
    22     22   #include "sqlite3.h"
    23     23   
    24     24   typedef struct sqlite3_api_routines sqlite3_api_routines;
    25     25   
    26     26   /*
    27         -** The following structure hold pointers to all of the SQLite API
           27  +** The following structure holds pointers to all of the SQLite API
    28     28   ** routines.
    29     29   **
    30     30   ** WARNING:  In order to maintain backwards compatibility, add new
    31     31   ** interfaces to the end of this structure only.  If you insert new
    32     32   ** interfaces in the middle of this structure, then older different
    33         -** versions of SQLite will not be able to load each others shared
           33  +** versions of SQLite will not be able to load each others' shared
    34     34   ** libraries!
    35     35   */
    36     36   struct sqlite3_api_routines {
    37     37     void * (*aggregate_context)(sqlite3_context*,int nBytes);
    38     38     int  (*aggregate_count)(sqlite3_context*);
    39     39     int  (*bind_blob)(sqlite3_stmt*,int,const void*,int n,void(*)(void*));
    40     40     int  (*bind_double)(sqlite3_stmt*,int,double);
................................................................................
   178    178     void (*result_error_nomem)(sqlite3_context*);
   179    179     void (*result_error_toobig)(sqlite3_context*);
   180    180     int (*sleep)(int);
   181    181     void (*soft_heap_limit)(int);
   182    182     sqlite3_vfs *(*vfs_find)(const char*);
   183    183     int (*vfs_register)(sqlite3_vfs*,int);
   184    184     int (*vfs_unregister)(sqlite3_vfs*);
          185  +  int (*xthreadsafe)(void);
          186  +  void (*result_zeroblob)(sqlite3_context*,int);
          187  +  void (*result_error_code)(sqlite3_context*,int);
          188  +  int (*test_control)(int, ...);
          189  +  void (*randomness)(int,void*);
          190  +  sqlite3 *(*context_db_handle)(sqlite3_context*);
   185    191   };
   186    192   
   187    193   /*
   188    194   ** The following macros redefine the API routines so that they are
   189    195   ** redirected throught the global sqlite3_api structure.
   190    196   **
   191    197   ** This header file is also used by the loadext.c source file
................................................................................
   338    344   #define sqlite3_result_error_nomem     sqlite3_api->result_error_nomem
   339    345   #define sqlite3_result_error_toobig    sqlite3_api->result_error_toobig
   340    346   #define sqlite3_sleep                  sqlite3_api->sleep
   341    347   #define sqlite3_soft_heap_limit        sqlite3_api->soft_heap_limit
   342    348   #define sqlite3_vfs_find               sqlite3_api->vfs_find
   343    349   #define sqlite3_vfs_register           sqlite3_api->vfs_register
   344    350   #define sqlite3_vfs_unregister         sqlite3_api->vfs_unregister
          351  +#define sqlite3_threadsafe             sqlite3_api->xthreadsafe
          352  +#define sqlite3_result_zeroblob        sqlite3_api->result_zeroblob
          353  +#define sqlite3_result_error_code      sqlite3_api->result_error_code
          354  +#define sqlite3_test_control           sqlite3_api->test_control
          355  +#define sqlite3_randomness             sqlite3_api->randomness
          356  +#define sqlite3_context_db_handle      sqlite3_api->context_db_handle
   345    357   #endif /* SQLITE_CORE */
   346    358   
   347    359   #define SQLITE_EXTENSION_INIT1     const sqlite3_api_routines *sqlite3_api;
   348    360   #define SQLITE_EXTENSION_INIT2(v)  sqlite3_api = v;
   349    361   
   350    362   #endif /* _SQLITE3EXT_H_ */

Changes to System.Data.SQLite/AssemblyInfo.cs.

    44     44   //      Major Version
    45     45   //      Minor Version 
    46     46   //      Build Number
    47     47   //      Revision
    48     48   //
    49     49   // You can specify all the values or you can default the Revision and Build Numbers 
    50     50   // by using the '*' as shown below:
    51         -[assembly: AssemblyVersion("1.0.47.0")]
           51  +[assembly: AssemblyVersion("1.0.49.0")]
    52     52   #if !PLATFORM_COMPACTFRAMEWORK
    53         -[assembly: AssemblyFileVersion("1.0.47.0")]
           53  +[assembly: AssemblyFileVersion("1.0.49.0")]
    54     54   #endif

Changes to System.Data.SQLite/DataTypes.xml.

   342    342       <ColumnSize>2147483647</ColumnSize>
   343    343       <DataType>System.Byte[]</DataType>
   344    344       <CreateFormat>binary</CreateFormat>
   345    345       <IsAutoIncrementable>false</IsAutoIncrementable>
   346    346       <IsCaseSensitive>false</IsCaseSensitive>
   347    347       <IsFixedLength>false</IsFixedLength>
   348    348       <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
   349         -    <IsLong>true</IsLong>
          349  +    <IsLong>false</IsLong>
   350    350       <IsNullable>true</IsNullable>
   351    351       <IsSearchable>false</IsSearchable>
   352    352       <IsSearchableWithLike>false</IsSearchableWithLike>
   353    353       <LiteralPrefix>X'</LiteralPrefix>
   354    354       <LiteralSuffix>'</LiteralSuffix>
   355    355       <IsBestMatch>true</IsBestMatch>
   356    356     </DataTypes>
................................................................................
   360    360       <ColumnSize>2147483647</ColumnSize>
   361    361       <DataType>System.Byte[]</DataType>
   362    362       <CreateFormat>varbinary</CreateFormat>
   363    363       <IsAutoIncrementable>false</IsAutoIncrementable>
   364    364       <IsCaseSensitive>false</IsCaseSensitive>
   365    365       <IsFixedLength>false</IsFixedLength>
   366    366       <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
   367         -    <IsLong>true</IsLong>
          367  +    <IsLong>false</IsLong>
   368    368       <IsNullable>true</IsNullable>
   369    369       <IsSearchable>false</IsSearchable>
   370    370       <IsSearchableWithLike>false</IsSearchableWithLike>
   371    371       <LiteralPrefix>X'</LiteralPrefix>
   372    372       <LiteralSuffix>'</LiteralSuffix>
   373    373       <IsBestMatch>false</IsBestMatch>
   374    374     </DataTypes>
................................................................................
   378    378       <ColumnSize>2147483647</ColumnSize>
   379    379       <DataType>System.Byte[]</DataType>
   380    380       <CreateFormat>blob</CreateFormat>
   381    381       <IsAutoIncrementable>false</IsAutoIncrementable>
   382    382       <IsCaseSensitive>false</IsCaseSensitive>
   383    383       <IsFixedLength>false</IsFixedLength>
   384    384       <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
   385         -    <IsLong>true</IsLong>
          385  +    <IsLong>false</IsLong>
   386    386       <IsNullable>true</IsNullable>
   387    387       <IsSearchable>false</IsSearchable>
   388    388       <IsSearchableWithLike>false</IsSearchableWithLike>
   389    389       <LiteralPrefix>X'</LiteralPrefix>
   390    390       <LiteralSuffix>'</LiteralSuffix>
   391    391       <IsBestMatch>false</IsBestMatch>
   392    392     </DataTypes>
................................................................................
   396    396       <ColumnSize>2147483647</ColumnSize>
   397    397       <DataType>System.Byte[]</DataType>
   398    398       <CreateFormat>image</CreateFormat>
   399    399       <IsAutoIncrementable>false</IsAutoIncrementable>
   400    400       <IsCaseSensitive>false</IsCaseSensitive>
   401    401       <IsFixedLength>false</IsFixedLength>
   402    402       <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
   403         -    <IsLong>true</IsLong>
          403  +    <IsLong>false</IsLong>
   404    404       <IsNullable>true</IsNullable>
   405    405       <IsSearchable>false</IsSearchable>
   406    406       <IsSearchableWithLike>false</IsSearchableWithLike>
   407    407       <LiteralPrefix>X'</LiteralPrefix>
   408    408       <LiteralSuffix>'</LiteralSuffix>
   409    409       <IsBestMatch>false</IsBestMatch>
   410    410     </DataTypes>
................................................................................
   414    414       <ColumnSize>2147483647</ColumnSize>
   415    415       <DataType>System.Byte[]</DataType>
   416    416       <CreateFormat>general</CreateFormat>
   417    417       <IsAutoIncrementable>false</IsAutoIncrementable>
   418    418       <IsCaseSensitive>false</IsCaseSensitive>
   419    419       <IsFixedLength>false</IsFixedLength>
   420    420       <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
   421         -    <IsLong>true</IsLong>
          421  +    <IsLong>false</IsLong>
   422    422       <IsNullable>true</IsNullable>
   423    423       <IsSearchable>false</IsSearchable>
   424    424       <IsSearchableWithLike>false</IsSearchableWithLike>
   425    425       <LiteralPrefix>X'</LiteralPrefix>
   426    426       <LiteralSuffix>'</LiteralSuffix>
   427    427       <IsBestMatch>false</IsBestMatch>
   428    428     </DataTypes>
................................................................................
   432    432       <ColumnSize>2147483647</ColumnSize>
   433    433       <DataType>System.Byte[]</DataType>
   434    434       <CreateFormat>oleobject</CreateFormat>
   435    435       <IsAutoIncrementable>false</IsAutoIncrementable>
   436    436       <IsCaseSensitive>false</IsCaseSensitive>
   437    437       <IsFixedLength>false</IsFixedLength>
   438    438       <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
   439         -    <IsLong>true</IsLong>
          439  +    <IsLong>false</IsLong>
   440    440       <IsNullable>true</IsNullable>
   441    441       <IsSearchable>false</IsSearchable>
   442    442       <IsSearchableWithLike>false</IsSearchableWithLike>
   443    443       <LiteralPrefix>X'</LiteralPrefix>
   444    444       <LiteralSuffix>'</LiteralSuffix>
   445    445       <IsBestMatch>false</IsBestMatch>
   446    446     </DataTypes>

Changes to System.Data.SQLite/LINQ/SQLiteFactory_Linq.cs.

     5      5    * Released to the public domain, use at your own risk!
     6      6    ********************************************************/
     7      7   
     8      8   namespace System.Data.SQLite
     9      9   {
    10     10     using System;
    11     11     using System.Data.Common;
           12  +  using System.Reflection;
           13  +  using System.Security.Permissions;
    12     14   
    13     15     /// <summary>
    14     16     /// SQLite implementation of DbProviderFactory.
    15     17     /// </summary>
    16     18     public sealed partial class SQLiteFactory : IServiceProvider
    17     19     {
           20  +    private static Type _dbProviderServicesType;
           21  +
           22  +    static SQLiteFactory()
           23  +    {
           24  +      _dbProviderServicesType = Type.GetType("System.Data.Common.DbProviderServices, System.Data.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", false);
           25  +    }
           26  +
    18     27       /// <summary>
    19     28       /// Will provide a DbProviderServices object in .NET 3.5
    20     29       /// </summary>
    21     30       /// <param name="serviceType">The class or interface type to query for</param>
    22     31       /// <returns></returns>
    23         -    public object GetService(Type serviceType)
           32  +    [ReflectionPermission(SecurityAction.Assert, MemberAccess = true)]
           33  +    object IServiceProvider.GetService(Type serviceType)
    24     34       {
           35  +      if (_dbProviderServicesType != null)
           36  +      {
           37  +        if (serviceType == _dbProviderServicesType)
           38  +        {
           39  +          Type type = Type.GetType("System.Data.SQLite.SQLiteProviderServices, System.Data.SQLite.Linq, Version=2.0.33.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139", false);
           40  +          if (type != null)
           41  +          {
           42  +            FieldInfo field = type.GetField("Instance", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance);
           43  +            return field.GetValue(null);
           44  +          }
           45  +        }
           46  +      }
    25     47         return null;
    26     48       }
    27     49     }
    28     50   }

Changes to System.Data.SQLite/SQLite3.cs.

   110    110         if (n > 0) throw new SQLiteException(n, SQLiteLastError());
   111    111       }
   112    112   
   113    113       internal override bool Step(SQLiteStatement stmt)
   114    114       {
   115    115         int n;
   116    116         Random rnd = null;
   117         -      uint timeout = (uint)(Environment.TickCount + (stmt._command._commandTimeout * 1000));
          117  +      uint starttick = (uint)Environment.TickCount;
          118  +      uint timeout = (uint)(stmt._command._commandTimeout * 1000);
   118    119   
   119    120         while (true)
   120    121         {
   121    122           n = UnsafeNativeMethods.sqlite3_step_interop(stmt._sqlite_stmt);
   122    123   
   123    124           if (n == 100) return true;
   124    125           if (n == 101) return false;
................................................................................
   138    139             else if ((r == 6 || r == 5) && stmt._command != null) // SQLITE_LOCKED || SQLITE_BUSY
   139    140             {
   140    141               // Keep trying
   141    142               if (rnd == null) // First time we've encountered the lock
   142    143                 rnd = new Random();
   143    144   
   144    145               // If we've exceeded the command's timeout, give up and throw an error
   145         -            if ((uint)Environment.TickCount - timeout > 0)
          146  +            if ((uint)Environment.TickCount - starttick > timeout)
   146    147               {
   147    148                 throw new SQLiteException(r, SQLiteLastError());
   148    149               }
   149    150               else
   150    151               {
   151    152                 // Otherwise sleep for a random amount of time up to 250ms
   152    153                 UnsafeNativeMethods.sqlite3_sleep_interop((uint)rnd.Next(1, 250));
................................................................................
   176    177             tmp._sqlite_stmt = null;
   177    178   
   178    179             // Reapply parameters
   179    180             stmt.BindParameters();
   180    181           }
   181    182           return -1; // Reset was OK, with schema change
   182    183         }
   183         -      else if (n == 6) // SQLITE_LOCKED
          184  +      else if (n == 6 || n == 5) // SQLITE_LOCKED || SQLITE_BUSY
   184    185           return n;
   185    186   
   186    187         if (n > 0)
   187    188           throw new SQLiteException(n, SQLiteLastError());
   188    189   
   189    190         return 0; // We reset OK, no schema changes
   190    191       }

Changes to System.Data.SQLite/SQLiteCommand.cs.

    13     13     using System.Collections.Generic;
    14     14     using System.ComponentModel;
    15     15   
    16     16     /// <summary>
    17     17     /// SQLite implementation of DbCommand.
    18     18     /// </summary>
    19     19   #if !PLATFORM_COMPACTFRAMEWORK
    20         -  [Designer("SQLite.Designer.SQLiteCommandDesigner, SQLite.Designer, Version=1.0.32.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139"), ToolboxItem(true)]
           20  +  [Designer("SQLite.Designer.SQLiteCommandDesigner, SQLite.Designer, Version=1.0.33.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139"), ToolboxItem(true)]
    21     21   #endif
    22     22     public sealed class SQLiteCommand : DbCommand, ICloneable
    23     23     {
    24     24       /// <summary>
    25     25       /// The command text this command is based on
    26     26       /// </summary>
    27     27       private string _commandText;
................................................................................
   133    133         _updateRowSource = UpdateRowSource.FirstReturnedRecord;
   134    134         _transaction = null;
   135    135   
   136    136         if (commandText != null)
   137    137           CommandText = commandText;
   138    138   
   139    139         if (connection != null)
          140  +      {
   140    141           DbConnection = connection;
          142  +        _commandTimeout = connection.DefaultTimeout;
          143  +      }
   141    144   
   142    145         if (transaction != null)
   143    146           Transaction = transaction;
   144    147       }
   145    148   
   146    149       /// <summary>
   147    150       /// Disposes of the command and clears all member variables

Changes to System.Data.SQLite/SQLiteConnection.cs.

   106    106     /// </item>
   107    107     /// <item>
   108    108     /// <description>Legacy Format</description>
   109    109     /// <description><b>True</b> - Use the more compatible legacy 3.x database format<br/><b>False</b> - Use the newer 3.3x database format which compresses numbers more effectively</description>
   110    110     /// <description>N</description>
   111    111     /// <description>True</description>
   112    112     /// </item>
          113  +  /// <item>
          114  +  /// <description>Default Timeout</description>
          115  +  /// <description>{time in seconds}<br/>The default command timeout</description>
          116  +  /// <description>N</description>
          117  +  /// <description>30</description>
          118  +  /// </item>
   113    119     /// </list>
   114    120     /// </remarks>
   115    121     public sealed partial class SQLiteConnection : DbConnection, ICloneable
   116    122     {
   117    123       private const string _dataDirectory = "|DataDirectory|";
          124  +    private const string _masterdb = "sqlite_master";
          125  +    private const string _tempmasterdb = "sqlite_temp_master";
   118    126   
   119    127       /// <summary>
   120    128       /// State of the current connection
   121    129       /// </summary>
   122    130       private ConnectionState _connectionState;
   123    131       /// <summary>
   124    132       /// The connection string
................................................................................
   135    143       internal SQLiteEnlistment _enlistment;
   136    144   #endif
   137    145       /// <summary>
   138    146       /// The base SQLite object to interop with
   139    147       /// </summary>
   140    148       internal SQLiteBase _sql;
   141    149       /// <summary>
   142         -    /// Commands associated with this connection
   143         -    /// </summary>
   144         -    //internal List<WeakReference> _commandList;
   145         -    /// <summary>
   146    150       /// The database filename minus path and extension
   147    151       /// </summary>
   148    152       private string _dataSource;
   149    153       /// <summary>
   150    154       /// Temporary password storage, emptied after the database has been opened
   151    155       /// </summary>
   152    156       private byte[] _password;
   153    157   
          158  +    /// <summary>
          159  +    /// Default command timeout
          160  +    /// </summary>
          161  +    private int _defaultTimeout = 30;
          162  +
   154    163       internal bool _binaryGuid;
   155    164   
   156    165       internal long _version;
   157    166   
   158    167       private event SQLiteUpdateEventHandler _updateHandler;
   159    168       private event SQLiteCommitHandler _commitHandler;
   160    169       private event EventHandler _rollbackHandler;
................................................................................
   164    173       private SQLiteRollbackCallback _rollbackCallback;
   165    174   
   166    175       /// <summary>
   167    176       /// This event is raised whenever the database is opened or closed.
   168    177       /// </summary>
   169    178       public override event StateChangeEventHandler StateChange;
   170    179   
   171         -    /// <summary>
   172         -    /// This event is raised whenever SQLite makes an update/delete/insert into the database on
   173         -    /// this connection.  It only applies to the given connection.
   174         -    /// </summary>
   175         -    public event SQLiteUpdateEventHandler Update
   176         -    {
   177         -      add
   178         -      {
   179         -        if (_updateHandler == null)
   180         -        {
   181         -          _updateCallback = new SQLiteUpdateCallback(UpdateCallback);
   182         -          _sql.SetUpdateHook(_updateCallback);
   183         -        }
   184         -        _updateHandler += value;
   185         -      }
   186         -      remove
   187         -      {
   188         -        _updateHandler -= value;
   189         -        if (_updateHandler == null)
   190         -        {
   191         -          _sql.SetUpdateHook(null);
   192         -          _updateCallback = null;
   193         -        }
   194         -      }
   195         -    }
   196         -
   197         -    private void UpdateCallback(int type, IntPtr database, int databaseLen, IntPtr table, int tableLen, Int64 rowid)
   198         -    {
   199         -      _updateHandler(this, new UpdateEventArgs(
   200         -        SQLiteBase.UTF8ToString(database, databaseLen),
   201         -        SQLiteBase.UTF8ToString(table, tableLen),
   202         -        (UpdateEventType)type,
   203         -        rowid));
   204         -    }
   205         -
   206         -    /// <summary>
   207         -    /// This event is raised whenever SQLite is committing a transaction.
   208         -    /// Return non-zero to trigger a rollback
   209         -    /// </summary>
   210         -    public event SQLiteCommitHandler Commit
   211         -    {
   212         -      add
   213         -      {
   214         -        if (_commitHandler == null)
   215         -        {
   216         -          _commitCallback = new SQLiteCommitCallback(CommitCallback);
   217         -          _sql.SetCommitHook(_commitCallback);
   218         -        }
   219         -        _commitHandler += value;
   220         -      }
   221         -      remove
   222         -      {
   223         -        _commitHandler -= value;
   224         -        if (_commitHandler == null)
   225         -        {
   226         -          _sql.SetCommitHook(null);
   227         -          _commitCallback = null;
   228         -        }
   229         -      }
   230         -    }
   231         -
   232         -    /// <summary>
   233         -    /// This event is raised whenever SQLite is committing a transaction.
   234         -    /// Return non-zero to trigger a rollback
   235         -    /// </summary>
   236         -    public event EventHandler RollBack
   237         -    {
   238         -      add
   239         -      {
   240         -        if (_rollbackHandler == null)
   241         -        {
   242         -          _rollbackCallback = new SQLiteRollbackCallback(RollbackCallback);
   243         -          _sql.SetRollbackHook(_rollbackCallback);
   244         -        }
   245         -        _rollbackHandler += value;
   246         -      }
   247         -      remove
   248         -      {
   249         -        _rollbackHandler -= value;
   250         -        if (_rollbackHandler == null)
   251         -        {
   252         -          _sql.SetRollbackHook(null);
   253         -          _rollbackCallback = null;
   254         -        }
   255         -      }
   256         -    }
   257         -
   258         -
   259         -    private int CommitCallback()
   260         -    {
   261         -      CommitEventArgs e = new CommitEventArgs();
   262         -      _commitHandler(this, e);
   263         -      return (e.AbortTransaction == true) ? 1 : 0;
   264         -    }
   265         -
   266         -    private void RollbackCallback()
   267         -    {
   268         -      _rollbackHandler(this, EventArgs.Empty);
   269         -    }
   270         -
   271    180       ///<overloads>
   272    181       /// Constructs a new SQLiteConnection object
   273    182       /// </overloads>
   274    183       /// <summary>
   275    184       /// Default constructor
   276    185       /// </summary>
   277    186       public SQLiteConnection()
................................................................................
   545    454       /// <description>UseUTF16Encoding</description>
   546    455       /// <description><b>True</b><br/><b>False</b></description>
   547    456       /// <description>N</description>
   548    457       /// <description>False</description>
   549    458       /// </item>
   550    459       /// <item>
   551    460       /// <description>DateTimeFormat</description>
   552         -    /// <description><b>Ticks</b> - Use DateTime.Ticks<br/><b>ISO8601</b> - Use ISO8601 DateTime format</description>
          461  +    /// <description><b>Ticks</b> - Use DateTime.Ticks<br/><b>ISO8601</b> - Use ISO8601 DateTime format<br/><b>JulianDay</b> - Use JulianDay format</description>
   553    462       /// <description>N</description>
   554    463       /// <description>ISO8601</description>
   555    464       /// </item>
   556    465       /// <item>
   557    466       /// <description>BinaryGUID</description>
   558    467       /// <description><b>Yes/On/1</b> - Store GUID columns in binary form<br/><b>No/Off/0</b> - Store GUID columns as text</description>
   559    468       /// <description>N</description>
................................................................................
   609    518       /// </item>
   610    519       /// <item>
   611    520       /// <description>Legacy Format</description>
   612    521       /// <description><b>True</b> - Use the more compatible legacy 3.x database format<br/><b>False</b> - Use the newer 3.3x database format which compresses numbers more effectively</description>
   613    522       /// <description>N</description>
   614    523       /// <description>True</description>
   615    524       /// </item>
          525  +    /// <item>
          526  +    /// <description>Default Timeout</description>
          527  +    /// <description>{time in seconds}<br/>The default command timeout</description>
          528  +    /// <description>N</description>
          529  +    /// <description>30</description>
          530  +    /// </item>
   616    531       /// </list>
   617    532       /// </remarks>
   618    533   #if !PLATFORM_COMPACTFRAMEWORK
   619    534       [RefreshProperties(RefreshProperties.All), DefaultValue("")]
   620         -    [Editor("SQLite.Designer.SQLiteConnectionStringEditor, SQLite.Designer, Version=1.0.32.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
          535  +    [Editor("SQLite.Designer.SQLiteConnectionStringEditor, SQLite.Designer, Version=1.0.33.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
   621    536   #endif
   622    537       public override string ConnectionString
   623    538       {
   624    539         get
   625    540         {
   626    541           return _connectionString;
   627    542         }
................................................................................
   776    691   #endif
   777    692          fileName = ExpandFileName(fileName);
   778    693         }
   779    694         try
   780    695         {
   781    696           bool usePooling = (Convert.ToBoolean(FindKey(opts, "Pooling", Boolean.FalseString), CultureInfo.CurrentCulture) == true);
   782    697           bool bUTF16 = (Convert.ToBoolean(FindKey(opts, "UseUTF16Encoding", Boolean.FalseString), CultureInfo.CurrentCulture) == true);
   783         -        SQLiteDateFormats dateFormat = String.Compare(FindKey(opts, "DateTimeFormat", "ISO8601"), "ticks", true, CultureInfo.InvariantCulture) == 0 ? SQLiteDateFormats.Ticks : SQLiteDateFormats.ISO8601;
          698  +
          699  +        _defaultTimeout = Convert.ToInt32(FindKey(opts, "Default Timeout", "30"), CultureInfo.CurrentCulture);
          700  +
          701  +        SQLiteDateFormats dateFormat = SQLiteDateFormats.ISO8601;
          702  +        string temp = FindKey(opts, "DateTimeFormat", "ISO8601");
          703  +        if (String.Compare(temp, "ticks", true, CultureInfo.InvariantCulture) == 0) dateFormat = SQLiteDateFormats.Ticks;
          704  +        else if (String.Compare(temp, "julianday", true, CultureInfo.InvariantCulture) == 0) dateFormat = SQLiteDateFormats.JulianDay;
   784    705   
   785    706           if (bUTF16) // SQLite automatically sets the encoding of the database to UTF16 if called from sqlite3_open16()
   786    707             _sql = new SQLite3_UTF16(dateFormat);
   787    708           else
   788    709             _sql = new SQLite3(dateFormat);
   789    710   
   790    711           if (Convert.ToBoolean(FindKey(opts, "FailIfMissing", Boolean.FalseString), CultureInfo.CurrentCulture) == true)
................................................................................
   844    765   
   845    766             defValue = FindKey(opts, "Legacy Format", Boolean.TrueString);
   846    767             cmd.CommandText = String.Format(CultureInfo.InvariantCulture, "PRAGMA legacy_file_format={0}", Convert.ToBoolean(defValue, CultureInfo.InvariantCulture) == true ? "ON" : "OFF");
   847    768             cmd.ExecuteNonQuery();
   848    769   
   849    770             defValue = FindKey(opts, "Synchronous", "Normal");
   850    771             if (String.Compare(defValue, "Full", StringComparison.OrdinalIgnoreCase) != 0)
          772  +          {
   851    773               cmd.CommandText = String.Format(CultureInfo.InvariantCulture, "PRAGMA synchronous={0}", defValue);
   852         -          cmd.ExecuteNonQuery();
          774  +            cmd.ExecuteNonQuery();
          775  +          }
   853    776   
   854    777             defValue = FindKey(opts, "Cache Size", "2000");
   855    778             if (Convert.ToInt32(defValue) != 2000)
   856    779             {
   857    780               cmd.CommandText = String.Format(CultureInfo.InvariantCulture, "PRAGMA cache_size={0}", defValue);
   858    781               cmd.ExecuteNonQuery();
   859    782             }
................................................................................
   867    790         }
   868    791         catch (SQLiteException)
   869    792         {
   870    793           Close();
   871    794           throw;
   872    795         }
   873    796       }
          797  +
          798  +    /// <summary>
          799  +    /// Gets/sets the default command timeout for newly-created commands.  This is especially useful for 
          800  +    /// commands used internally such as inside a SQLiteTransaction, where setting the timeout is not possible.
          801  +    /// This can also be set in the ConnectionString with "Default Timeout"
          802  +    /// </summary>
          803  +    public int DefaultTimeout
          804  +    {
          805  +      get { return _defaultTimeout; }
          806  +      set { _defaultTimeout = value; }
          807  +    }
   874    808   
   875    809       /// <summary>
   876    810       /// Returns the version of the underlying SQLite database engine
   877    811       /// </summary>
   878    812   #if !PLATFORM_COMPACTFRAMEWORK
   879    813       [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
   880    814   #endif
................................................................................
  1243   1177         tbl.Columns.Add("DESCRIPTION", typeof(string));
  1244   1178         tbl.Columns.Add("PRIMARY_KEY", typeof(bool));
  1245   1179   
  1246   1180         tbl.BeginLoadData();
  1247   1181   
  1248   1182         if (String.IsNullOrEmpty(strCatalog)) strCatalog = "main";
  1249   1183   
  1250         -      using (SQLiteCommand cmdTables = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[sqlite_master] WHERE [type] LIKE 'table' OR [type] LIKE 'view'", strCatalog), this))
         1184  +      string master = (String.Compare(strCatalog, "temp", true, CultureInfo.InvariantCulture) == 0) ? _tempmasterdb : _masterdb;
         1185  +
         1186  +      using (SQLiteCommand cmdTables = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'table' OR [type] LIKE 'view'", strCatalog, master), this))
  1251   1187         using (SQLiteDataReader rdTables = cmdTables.ExecuteReader())
  1252   1188         {
  1253   1189           while (rdTables.Read())
  1254   1190           {
  1255   1191             if (String.IsNullOrEmpty(strTable) || String.Compare(strTable, rdTables.GetString(2), true, CultureInfo.InvariantCulture) == 0)
  1256   1192             {
  1257         -            using (SQLiteCommand cmd = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}]", strCatalog, rdTables.GetString(2)), this))
  1258         -            using (SQLiteDataReader rd = (SQLiteDataReader)cmd.ExecuteReader(CommandBehavior.SchemaOnly))
  1259         -            using (DataTable tblSchema = rd.GetSchemaTable(false, true))
         1193  +            try
  1260   1194               {
  1261         -              foreach (DataRow schemaRow in tblSchema.Rows)
         1195  +              using (SQLiteCommand cmd = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}]", strCatalog, rdTables.GetString(2)), this))
         1196  +              using (SQLiteDataReader rd = (SQLiteDataReader)cmd.ExecuteReader(CommandBehavior.SchemaOnly))
         1197  +              using (DataTable tblSchema = rd.GetSchemaTable(false, true))
  1262   1198                 {
  1263         -                if (String.Compare(schemaRow[SchemaTableColumn.ColumnName].ToString(), strColumn, true, CultureInfo.InvariantCulture) == 0
  1264         -                  || strColumn == null)
         1199  +                foreach (DataRow schemaRow in tblSchema.Rows)
  1265   1200                   {
  1266         -                  row = tbl.NewRow();
         1201  +                  if (String.Compare(schemaRow[SchemaTableColumn.ColumnName].ToString(), strColumn, true, CultureInfo.InvariantCulture) == 0
         1202  +                    || strColumn == null)
         1203  +                  {
         1204  +                    row = tbl.NewRow();
  1267   1205   
  1268         -                  row["NUMERIC_PRECISION"] = schemaRow[SchemaTableColumn.NumericPrecision];
  1269         -                  row["NUMERIC_SCALE"] = schemaRow[SchemaTableColumn.NumericScale];
  1270         -                  row["TABLE_NAME"] = rdTables.GetString(2);
  1271         -                  row["COLUMN_NAME"] = schemaRow[SchemaTableColumn.ColumnName];
  1272         -                  row["TABLE_CATALOG"] = strCatalog;
  1273         -                  row["ORDINAL_POSITION"] = schemaRow[SchemaTableColumn.ColumnOrdinal];
  1274         -                  row["COLUMN_HASDEFAULT"] = (schemaRow[SchemaTableOptionalColumn.DefaultValue] != DBNull.Value);
  1275         -                  row["COLUMN_DEFAULT"] = schemaRow[SchemaTableOptionalColumn.DefaultValue];
  1276         -                  row["IS_NULLABLE"] = schemaRow[SchemaTableColumn.AllowDBNull];
  1277         -                  row["DATA_TYPE"] = schemaRow["DataTypeName"]; // SQLiteConvert.DbTypeToType((DbType)schemaRow[SchemaTableColumn.ProviderType]).ToString();
  1278         -                  row["CHARACTER_MAXIMUM_LENGTH"] = schemaRow[SchemaTableColumn.ColumnSize];
  1279         -                  row["TABLE_SCHEMA"] = schemaRow[SchemaTableColumn.BaseSchemaName];
  1280         -                  row["PRIMARY_KEY"] = schemaRow[SchemaTableColumn.IsKey];
         1206  +                    row["NUMERIC_PRECISION"] = schemaRow[SchemaTableColumn.NumericPrecision];
         1207  +                    row["NUMERIC_SCALE"] = schemaRow[SchemaTableColumn.NumericScale];
         1208  +                    row["TABLE_NAME"] = rdTables.GetString(2);
         1209  +                    row["COLUMN_NAME"] = schemaRow[SchemaTableColumn.ColumnName];
         1210  +                    row["TABLE_CATALOG"] = strCatalog;
         1211  +                    row["ORDINAL_POSITION"] = schemaRow[SchemaTableColumn.ColumnOrdinal];
         1212  +                    row["COLUMN_HASDEFAULT"] = (schemaRow[SchemaTableOptionalColumn.DefaultValue] != DBNull.Value);
         1213  +                    row["COLUMN_DEFAULT"] = schemaRow[SchemaTableOptionalColumn.DefaultValue];
         1214  +                    row["IS_NULLABLE"] = schemaRow[SchemaTableColumn.AllowDBNull];
         1215  +                    row["DATA_TYPE"] = schemaRow["DataTypeName"]; // SQLiteConvert.DbTypeToType((DbType)schemaRow[SchemaTableColumn.ProviderType]).ToString();
         1216  +                    row["CHARACTER_MAXIMUM_LENGTH"] = schemaRow[SchemaTableColumn.ColumnSize];
         1217  +                    row["TABLE_SCHEMA"] = schemaRow[SchemaTableColumn.BaseSchemaName];
         1218  +                    row["PRIMARY_KEY"] = schemaRow[SchemaTableColumn.IsKey];
  1281   1219   
  1282         -                  tbl.Rows.Add(row);
         1220  +                    tbl.Rows.Add(row);
         1221  +                  }
  1283   1222                   }
  1284   1223                 }
         1224  +            }
         1225  +            catch(SQLiteException)
         1226  +            {
  1285   1227               }
  1286   1228             }
  1287   1229           }
  1288   1230         }
  1289   1231   
  1290   1232         tbl.AcceptChanges();
  1291   1233         tbl.EndLoadData();
................................................................................
  1334   1276         tbl.Columns.Add("FILTER_CONDITION", typeof(string));
  1335   1277         tbl.Columns.Add("INTEGRATED", typeof(bool));
  1336   1278   
  1337   1279         tbl.BeginLoadData();
  1338   1280   
  1339   1281         if (String.IsNullOrEmpty(strCatalog)) strCatalog = "main";
  1340   1282   
  1341         -      using (SQLiteCommand cmdTables = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[sqlite_master] WHERE [type] LIKE 'table'", strCatalog), this))
         1283  +      string master = (String.Compare(strCatalog, "temp", true, CultureInfo.InvariantCulture) == 0) ? _tempmasterdb : _masterdb;
         1284  +      
         1285  +      using (SQLiteCommand cmdTables = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'table'", strCatalog, master), this))
  1342   1286         using (SQLiteDataReader rdTables = cmdTables.ExecuteReader())
  1343   1287         {
  1344   1288           while (rdTables.Read())
  1345   1289           {
  1346   1290             maybeRowId = false;
  1347   1291             primaryKeys.Clear();
  1348   1292             if (String.IsNullOrEmpty(strTable) || String.Compare(rdTables.GetString(2), strTable, true, CultureInfo.InvariantCulture) == 0)
................................................................................
  1369   1313               {
  1370   1314                 row = tbl.NewRow();
  1371   1315   
  1372   1316                 row["TABLE_CATALOG"] = strCatalog;
  1373   1317                 row["TABLE_NAME"] = rdTables.GetString(2);
  1374   1318                 row["INDEX_CATALOG"] = strCatalog;
  1375   1319                 row["PRIMARY_KEY"] = true;
  1376         -              row["INDEX_NAME"] = String.Format(CultureInfo.InvariantCulture, "sqlite_master_PK_{0}", rdTables.GetString(2));
         1320  +              row["INDEX_NAME"] = String.Format(CultureInfo.InvariantCulture, "{1}_PK_{0}", rdTables.GetString(2), master);
  1377   1321                 row["UNIQUE"] = true;
  1378   1322   
  1379   1323                 if (String.Compare((string)row["INDEX_NAME"], strIndex, true, CultureInfo.InvariantCulture) == 0
  1380   1324                 || strIndex == null)
  1381   1325                 {
  1382   1326                   tbl.Rows.Add(row);
  1383   1327                 }
................................................................................
  1464   1408         tbl.Columns.Add("TABLE_ID", typeof(long));
  1465   1409         tbl.Columns.Add("TABLE_ROOTPAGE", typeof(int));
  1466   1410   
  1467   1411         tbl.BeginLoadData();
  1468   1412   
  1469   1413         if (String.IsNullOrEmpty(strCatalog)) strCatalog = "main";
  1470   1414   
  1471         -      using (SQLiteCommand cmd = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT [type], [name], [tbl_name], [rootpage], [sql], [rowid] FROM [{0}].[sqlite_master] WHERE [type] LIKE 'table'", strCatalog), this))
         1415  +      string master = (String.Compare(strCatalog, "temp", true, CultureInfo.InvariantCulture) == 0) ? _tempmasterdb : _masterdb;
         1416  +
         1417  +      using (SQLiteCommand cmd = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT [type], [name], [tbl_name], [rootpage], [sql], [rowid] FROM [{0}].[{1}] WHERE [type] LIKE 'table'", strCatalog, master), this))
  1472   1418         using (SQLiteDataReader rd = (SQLiteDataReader)cmd.ExecuteReader())
  1473   1419         {
  1474   1420           while (rd.Read())
  1475   1421           {
  1476   1422             strItem = rd.GetString(0);
  1477   1423             if (String.Compare(rd.GetString(2), 0, "SQLITE_", 0, 7, true, CultureInfo.InvariantCulture) == 0)
  1478   1424               strItem = "SYSTEM_TABLE";
................................................................................
  1527   1473         tbl.Columns.Add("DATE_CREATED", typeof(DateTime));
  1528   1474         tbl.Columns.Add("DATE_MODIFIED", typeof(DateTime));
  1529   1475   
  1530   1476         tbl.BeginLoadData();
  1531   1477   
  1532   1478         if (String.IsNullOrEmpty(strCatalog)) strCatalog = "main";
  1533   1479   
  1534         -      using (SQLiteCommand cmd = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[sqlite_master] WHERE [type] LIKE 'view'", strCatalog), this))
         1480  +      string master = (String.Compare(strCatalog, "temp", true, CultureInfo.InvariantCulture) == 0) ? _tempmasterdb : _masterdb;
         1481  +
         1482  +      using (SQLiteCommand cmd = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'view'", strCatalog, master), this))
  1535   1483         using (SQLiteDataReader rd = (SQLiteDataReader)cmd.ExecuteReader())
  1536   1484         {
  1537   1485           while (rd.Read())
  1538   1486           {
  1539   1487             if (String.Compare(rd.GetString(1), strView, true, CultureInfo.InvariantCulture) == 0
  1540   1488               || String.IsNullOrEmpty(strView))
  1541   1489             {
................................................................................
  1669   1617         tbl.Columns.Add("TABLE_NAME", typeof(string));
  1670   1618         tbl.Columns.Add("COLUMN_NAME", typeof(string));
  1671   1619         tbl.Columns.Add("ORDINAL_POSITION", typeof(int));
  1672   1620         tbl.Columns.Add("INDEX_NAME", typeof(string));
  1673   1621   
  1674   1622         if (String.IsNullOrEmpty(strCatalog)) strCatalog = "main";
  1675   1623   
         1624  +      string master = (String.Compare(strCatalog, "temp", true, CultureInfo.InvariantCulture) == 0) ? _tempmasterdb : _masterdb;
         1625  +
  1676   1626         tbl.BeginLoadData();
  1677   1627   
  1678         -      using (SQLiteCommand cmdTables = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[sqlite_master] WHERE [type] LIKE 'table'", strCatalog), this))
         1628  +      using (SQLiteCommand cmdTables = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'table'", strCatalog, master), this))
  1679   1629         using (SQLiteDataReader rdTables = cmdTables.ExecuteReader())
  1680   1630         {
  1681   1631           while (rdTables.Read())
  1682   1632           {
  1683   1633             maybeRowId = false;
  1684   1634             primaryKeys.Clear();
  1685   1635             if (String.IsNullOrEmpty(strTable) || String.Compare(rdTables.GetString(2), strTable, true, CultureInfo.InvariantCulture) == 0)
................................................................................
  1699   1649                 }
  1700   1650               }
  1701   1651               // This is a rowid row
  1702   1652               if (primaryKeys.Count == 1 && maybeRowId == true)
  1703   1653               {
  1704   1654                 row = tbl.NewRow();
  1705   1655                 row["CONSTRAINT_CATALOG"] = strCatalog;
  1706         -              row["CONSTRAINT_NAME"] = String.Format(CultureInfo.InvariantCulture, "sqlite_master_PK_{0}", rdTables.GetString(2));
         1656  +              row["CONSTRAINT_NAME"] = String.Format(CultureInfo.InvariantCulture, "{1}_PK_{0}", rdTables.GetString(2), master);
  1707   1657                 row["TABLE_CATALOG"] = strCatalog;
  1708   1658                 row["TABLE_NAME"] = rdTables.GetString(2);
  1709   1659                 row["COLUMN_NAME"] = primaryKeys[0].Value;
  1710   1660                 row["INDEX_NAME"] = row["CONSTRAINT_NAME"];
  1711   1661                 row["ORDINAL_POSITION"] = 0; // primaryKeys[0].Key;
  1712   1662   
  1713   1663                 if (String.IsNullOrEmpty(strIndex) || String.Compare(strIndex, (string)row["INDEX_NAME"], true, CultureInfo.InvariantCulture) == 0)
  1714   1664                   tbl.Rows.Add(row);
  1715   1665               }
  1716   1666   
  1717         -            using (SQLiteCommand cmdIndexes = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[sqlite_master] WHERE [type] LIKE 'index' AND [tbl_name] LIKE '{1}'", strCatalog, rdTables.GetString(2).Replace("'", "''")), this))
         1667  +            using (SQLiteCommand cmdIndexes = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{2}] WHERE [type] LIKE 'index' AND [tbl_name] LIKE '{1}'", strCatalog, rdTables.GetString(2).Replace("'", "''"), master), this))
  1718   1668               using (SQLiteDataReader rdIndexes = cmdIndexes.ExecuteReader())
  1719   1669               {
  1720   1670                 while (rdIndexes.Read())
  1721   1671                 {
  1722   1672                   int ordinal = 0;
  1723   1673                   if (String.IsNullOrEmpty(strIndex) || String.Compare(strIndex, rdIndexes.GetString(1), true, CultureInfo.InvariantCulture) == 0)
  1724   1674                   {
................................................................................
  1779   1729         tbl.Columns.Add("TABLE_CATALOG", typeof(string));
  1780   1730         tbl.Columns.Add("TABLE_SCHEMA", typeof(string));
  1781   1731         tbl.Columns.Add("TABLE_NAME", typeof(string));
  1782   1732         tbl.Columns.Add("COLUMN_NAME", typeof(string));
  1783   1733   
  1784   1734         if (String.IsNullOrEmpty(strCatalog)) strCatalog = "main";
  1785   1735   
         1736  +      string master = (String.Compare(strCatalog, "temp", true, CultureInfo.InvariantCulture) == 0) ? _tempmasterdb : _masterdb;
         1737  +      
  1786   1738         tbl.BeginLoadData();
  1787   1739   
  1788         -      using (SQLiteCommand cmdViews = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[sqlite_master] WHERE [type] LIKE 'view'", strCatalog), this))
         1740  +      using (SQLiteCommand cmdViews = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'view'", strCatalog, master), this))
  1789   1741         using (SQLiteDataReader rdViews = cmdViews.ExecuteReader())
  1790   1742         {
  1791   1743           while (rdViews.Read())
  1792   1744           {
  1793   1745             if (String.IsNullOrEmpty(strView) || String.Compare(strView, rdViews.GetString(2), true, CultureInfo.InvariantCulture) == 0)
  1794   1746             {
  1795   1747               using (SQLiteCommand cmdViewSelect = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}]", strCatalog, rdViews.GetString(2)), this))
................................................................................
  1867   1819         tbl.Columns.Add("FKEY_TO_CATALOG", typeof(string));
  1868   1820         tbl.Columns.Add("FKEY_TO_SCHEMA", typeof(string));
  1869   1821         tbl.Columns.Add("FKEY_TO_TABLE", typeof(string));
  1870   1822         tbl.Columns.Add("FKEY_TO_COLUMN", typeof(string));
  1871   1823   
  1872   1824         if (String.IsNullOrEmpty(strCatalog)) strCatalog = "main";
  1873   1825   
         1826  +      string master = (String.Compare(strCatalog, "temp", true, CultureInfo.InvariantCulture) == 0) ? _tempmasterdb : _masterdb;
         1827  +
  1874   1828         tbl.BeginLoadData();
  1875   1829   
  1876         -      using (SQLiteCommand cmdTables = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[sqlite_master] WHERE [type] LIKE 'table'", strCatalog), this))
         1830  +      using (SQLiteCommand cmdTables = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'table'", strCatalog, master), this))
  1877   1831         using (SQLiteDataReader rdTables = cmdTables.ExecuteReader())
  1878   1832         {
  1879   1833           while (rdTables.Read())
  1880   1834           {
  1881   1835             if (String.IsNullOrEmpty(strTable) || String.Compare(strTable, rdTables.GetString(2), true, CultureInfo.InvariantCulture) == 0)
  1882   1836             {
  1883   1837               using (SQLiteCommand cmdTable = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}]", strCatalog, rdTables.GetString(2)), this))
................................................................................
  1885   1839               using (SQLiteCommand cmdKey = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "PRAGMA [{0}].foreign_key_list([{1}])", strCatalog, rdTables.GetString(2)), this))
  1886   1840               using (SQLiteDataReader rdKey = cmdKey.ExecuteReader())
  1887   1841               {
  1888   1842                 while (rdKey.Read())
  1889   1843                 {
  1890   1844                   row = tbl.NewRow();
  1891   1845                   row["CONSTRAINT_CATALOG"] = strCatalog;
  1892         -                row["CONSTRAINT_NAME"] = String.Format(CultureInfo.InvariantCulture, "FK_{0}_{1}_{2}", rdTables.GetString(2), rdKey.GetString(3), rdKey.GetString(4));
         1846  +                row["CONSTRAINT_NAME"] = String.Format(CultureInfo.InvariantCulture, "FK_{0}_{1}_{2}", rdTables[2], rdKey[3], rdKey[4]);
  1893   1847                   row["TABLE_CATALOG"] = strCatalog;
  1894   1848                   row["TABLE_NAME"] = rdTables.GetString(2);
  1895   1849                   row["CONSTRAINT_TYPE"] = "FOREIGN KEY";
  1896   1850                   row["IS_DEFERRABLE"] = false;
  1897   1851                   row["INITIALLY_DEFERRED"] = false;
  1898         -                row["FKEY_FROM_COLUMN"] = rdKey.GetString(3);
         1852  +                row["FKEY_FROM_COLUMN"] = rdKey[3].ToString();
  1899   1853                   row["FKEY_FROM_ORDINAL_POSITION"] = rdTable.GetOrdinal(row["FKEY_FROM_COLUMN"].ToString());
  1900   1854                   row["FKEY_TO_CATALOG"] = strCatalog;
  1901         -                row["FKEY_TO_TABLE"] = rdKey.GetString(2);
  1902         -                row["FKEY_TO_COLUMN"] = rdKey.GetString(4);
         1855  +                row["FKEY_TO_TABLE"] = rdKey[2].ToString();
         1856  +                row["FKEY_TO_COLUMN"] = rdKey[4].ToString();
  1903   1857   
  1904   1858                   if (String.IsNullOrEmpty(strKeyName) || String.Compare(strKeyName, row["CONSTRAINT_NAME"].ToString(), true, CultureInfo.InvariantCulture) == 0)
  1905   1859                     tbl.Rows.Add(row);
  1906   1860                 }
  1907   1861               }
  1908   1862             }
  1909   1863           }
................................................................................
  1911   1865   
  1912   1866         tbl.EndLoadData();
  1913   1867         tbl.AcceptChanges();
  1914   1868   
  1915   1869         return tbl;
  1916   1870       }
  1917   1871   
  1918         -    //internal void AddCommand(SQLiteCommand cmd)
  1919         -    //{
  1920         -    //  lock (_commandList)
  1921         -    //  {
  1922         -    //    _commandList.Add(new WeakReference(cmd, false));
  1923         -    //  }
  1924         -    //}
  1925         -
  1926         -    //internal void RemoveCommand(SQLiteCommand cmd)
  1927         -    //{
  1928         -    //  lock (_commandList)
  1929         -    //  {
  1930         -    //    foreach (WeakReference r in _commandList)
  1931         -    //    {
  1932         -    //      try
  1933         -    //      {
  1934         -    //        if (r.Target as SQLiteCommand == cmd)
  1935         -    //        {
  1936         -    //          _commandList.Remove(r);
  1937         -    //          return;
  1938         -    //        }
  1939         -    //      }
  1940         -    //      catch
  1941         -    //      {
  1942         -    //      }
  1943         -    //    }
  1944         -    //  }
  1945         -    //}
         1872  +    /// <summary>
         1873  +    /// This event is raised whenever SQLite makes an update/delete/insert into the database on
         1874  +    /// this connection.  It only applies to the given connection.
         1875  +    /// </summary>
         1876  +    public event SQLiteUpdateEventHandler Update
         1877  +    {
         1878  +      add
         1879  +      {
         1880  +        if (_updateHandler == null)
         1881  +        {
         1882  +          _updateCallback = new SQLiteUpdateCallback(UpdateCallback);
         1883  +          _sql.SetUpdateHook(_updateCallback);
         1884  +        }
         1885  +        _updateHandler += value;
         1886  +      }
         1887  +      remove
         1888  +      {
         1889  +        _updateHandler -= value;
         1890  +        if (_updateHandler == null)
         1891  +        {
         1892  +          _sql.SetUpdateHook(null);
         1893  +          _updateCallback = null;
         1894  +        }
         1895  +      }
         1896  +    }
         1897  +
         1898  +    private void UpdateCallback(int type, IntPtr database, int databaseLen, IntPtr table, int tableLen, Int64 rowid)
         1899  +    {
         1900  +      _updateHandler(this, new UpdateEventArgs(
         1901  +        SQLiteBase.UTF8ToString(database, databaseLen),
         1902  +        SQLiteBase.UTF8ToString(table, tableLen),
         1903  +        (UpdateEventType)type,
         1904  +        rowid));
         1905  +    }
         1906  +
         1907  +    /// <summary>
         1908  +    /// This event is raised whenever SQLite is committing a transaction.
         1909  +    /// Return non-zero to trigger a rollback
         1910  +    /// </summary>
         1911  +    public event SQLiteCommitHandler Commit
         1912  +    {
         1913  +      add
         1914  +      {
         1915  +        if (_commitHandler == null)
         1916  +        {
         1917  +          _commitCallback = new SQLiteCommitCallback(CommitCallback);
         1918  +          _sql.SetCommitHook(_commitCallback);
         1919  +        }
         1920  +        _commitHandler += value;
         1921  +      }
         1922  +      remove
         1923  +      {
         1924  +        _commitHandler -= value;
         1925  +        if (_commitHandler == null)
         1926  +        {
         1927  +          _sql.SetCommitHook(null);
         1928  +          _commitCallback = null;
         1929  +        }
         1930  +      }
         1931  +    }
         1932  +
         1933  +    /// <summary>
         1934  +    /// This event is raised whenever SQLite is committing a transaction.
         1935  +    /// Return non-zero to trigger a rollback
         1936  +    /// </summary>
         1937  +    public event EventHandler RollBack
         1938  +    {
         1939  +      add
         1940  +      {
         1941  +        if (_rollbackHandler == null)
         1942  +        {
         1943  +          _rollbackCallback = new SQLiteRollbackCallback(RollbackCallback);
         1944  +          _sql.SetRollbackHook(_rollbackCallback);
         1945  +        }
         1946  +        _rollbackHandler += value;
         1947  +      }
         1948  +      remove
         1949  +      {
         1950  +        _rollbackHandler -= value;
         1951  +        if (_rollbackHandler == null)
         1952  +        {
         1953  +          _sql.SetRollbackHook(null);
         1954  +          _rollbackCallback = null;
         1955  +        }
         1956  +      }
         1957  +    }
         1958  +
         1959  +
         1960  +    private int CommitCallback()
         1961  +    {
         1962  +      CommitEventArgs e = new CommitEventArgs();
         1963  +      _commitHandler(this, e);
         1964  +      return (e.AbortTransaction == true) ? 1 : 0;
         1965  +    }
         1966  +
         1967  +    private void RollbackCallback()
         1968  +    {
         1969  +      _rollbackHandler(this, EventArgs.Empty);
         1970  +    }
  1946   1971     }
  1947   1972   
  1948   1973     /// <summary>
  1949   1974     /// The I/O file cache flushing behavior for the connection
  1950   1975     /// </summary>
  1951   1976     public enum SynchronizationModes
  1952   1977     {

Changes to System.Data.SQLite/SQLiteConnectionStringBuilder.cs.

   179    179           return value.ToString();
   180    180         }
   181    181         set
   182    182         {
   183    183           this["Data Source"] = value;
   184    184         }
   185    185       }
          186  +
          187  +    /// <summary>
          188  +    /// Gets/sets the default command timeout for newly-created commands.  This is especially useful for 
          189  +    /// commands used internally such as inside a SQLiteTransaction, where setting the timeout is not possible.
          190  +    /// </summary>
          191  +    [DisplayName("Default Timeout")]
          192  +    [Browsable(true)]
          193  +    [DefaultValue(30)]
          194  +    public int DefaultTimeout
          195  +    {
          196  +      get
          197  +      {
          198  +        object value;
          199  +        TryGetValue("Default Timeout", out value);
          200  +        return Convert.ToInt32(value, CultureInfo.CurrentCulture);
          201  +      }
          202  +      set
          203  +      {
          204  +        this["Default Timeout"] = value;
          205  +      }
          206  +    }
   186    207   
   187    208       /// <summary>
   188    209       /// Determines whether or not the connection will automatically participate
   189    210       /// in the current distributed transaction (if one exists)
   190    211       /// </summary>
   191    212       [Browsable(true)]
   192    213       [DefaultValue(true)]
................................................................................
   199    220           return Convert.ToBoolean(value, CultureInfo.CurrentCulture);
   200    221         }
   201    222         set
   202    223         {
   203    224           this["Enlist"] = value;
   204    225         }
   205    226       }
          227  +
          228  +    /// <summary>
          229  +    /// If set to true, will throw an exception if the database specified in the connection
          230  +    /// string does not exist.  If false, the database will be created automatically.
          231  +    /// </summary>
          232  +    [Browsable(true)]
          233  +    [DefaultValue(false)]
          234  +    [DisplayName("Fail If Missing")]
          235  +    public bool FailIfMissing
          236  +    {
          237  +      get
          238  +      {
          239  +        object value;
          240  +        TryGetValue("FailIfMissing", out value);
          241  +        return Convert.ToBoolean(value, CultureInfo.CurrentCulture);
          242  +      }
          243  +      set
          244  +      {
          245  +        this["FailIfMissing"] = value;
          246  +      }
          247  +    }
   206    248   
   207    249       /// <summary>
   208    250       /// If enabled, uses the legacy 3.xx format for maximum compatibility, but results in larger
   209    251       /// database sizes.
   210    252       /// </summary>
   211    253       [DisplayName("Legacy Format")]
   212    254       [Browsable(true)]

Changes to System.Data.SQLite/SQLiteConvert.cs.

    70     70       /// Using ticks is more accurate but less compatible with other viewers and utilities that access your database.
    71     71       /// </summary>
    72     72       Ticks = 0,
    73     73       /// <summary>
    74     74       /// The default format for this provider.
    75     75       /// </summary>
    76     76       ISO8601 = 1,
           77  +    /// <summary>
           78  +    /// JulianDay format, which is what SQLite uses internally
           79  +    /// </summary>
           80  +    JulianDay = 2
    77     81     }
    78     82   
    79     83     /// <summary>
    80     84     /// Struct used internally to determine the datatype of a column in a resultset
    81     85     /// </summary>
    82     86     internal class SQLiteType
    83     87     {
................................................................................
   108    112     /// </summary>
   109    113     public abstract class SQLiteConvert
   110    114     {
   111    115       /// <summary>
   112    116       /// An array of ISO8601 datetime formats we support conversion from
   113    117       /// </summary>
   114    118       private static string[] _datetimeFormats = new string[] {
   115         -      "yyyy-MM-dd HH:mm:ss.fffffff",
   116         -      "yyyy-MM-dd HH:mm:ss",
   117         -      "yyyy-MM-dd HH:mm",                               
   118         -      "yyyyMMddHHmmss",
   119         -      "yyyyMMddHHmm",
   120         -      "yyyyMMddTHHmmssfffffff",
   121         -      "yyyy-MM-dd",
   122         -      "yy-MM-dd",
   123         -      "yyyyMMdd",
          119  +      "THHmmss",
          120  +      "THHmm",
   124    121         "HH:mm:ss",
   125    122         "HH:mm",
   126         -      "THHmmss",
   127         -      "THHmm",
   128         -      "yyyy-MM-dd HH:mm:ss.fff",
          123  +      "HH:mm:ss.FFFFFFF",
          124  +      "yy-MM-dd",
          125  +      "yyyy-MM-dd",
          126  +      "yyyy-MM-dd HH:mm:ss.FFFFFFF",
          127  +      "yyyy-MM-dd HH:mm:ss",
          128  +      "yyyy-MM-dd HH:mm",                               
          129  +      "yyyy-MM-ddTHH:mm:ss.FFFFFFF",
   129    130         "yyyy-MM-ddTHH:mm",
   130    131         "yyyy-MM-ddTHH:mm:ss",
   131         -      "yyyy-MM-ddTHH:mm:ss.fff",
   132         -      "yyyy-MM-ddTHH:mm:ss.ffffff",
   133         -      "HH:mm:ss.fff"
          132  +      "yyyyMMddHHmmss",
          133  +      "yyyyMMddHHmm",
          134  +      "yyyyMMddTHHmmssFFFFFFF",
          135  +      "yyyyMMdd"
   134    136       };
   135    137   
   136    138       /// <summary>
   137    139       /// An UTF-8 Encoding instance, so we can convert strings to and from UTF-8
   138    140       /// </summary>
   139    141       private static Encoding _utf8 = new UTF8Encoding();
   140    142       /// <summary>
................................................................................
   224    226       ///   yyyyMMddTHHmmssfffffff
   225    227       ///   yyyy-MM-dd
   226    228       ///   yy-MM-dd
   227    229       ///   yyyyMMdd
   228    230       ///   HH:mm:ss
   229    231       ///   THHmmss
   230    232       /// </remarks>
   231         -    /// <param name="dateText">The string containing either a Tick value or an ISO8601-format string</param>
          233  +    /// <param name="dateText">The string containing either a Tick value, a JulianDay double, or an ISO8601-format string</param>
   232    234       /// <returns>A DateTime value</returns>
   233    235       public DateTime ToDateTime(string dateText)
   234    236       {
   235    237         switch (_datetimeFormat)
   236    238         {
   237    239           case SQLiteDateFormats.Ticks:
   238    240             return new DateTime(Convert.ToInt64(dateText, CultureInfo.InvariantCulture));
          241  +        case SQLiteDateFormats.JulianDay:
          242  +          return ToDateTime(Convert.ToDouble(dateText, CultureInfo.InvariantCulture));
   239    243           default:
   240    244             return DateTime.ParseExact(dateText, _datetimeFormats, DateTimeFormatInfo.InvariantInfo, DateTimeStyles.None);
   241    245         }
   242    246       }
          247  +
          248  +    /// <summary>
          249  +    /// Converts a julianday value into a DateTime
          250  +    /// </summary>
          251  +    /// <param name="julianDay">The value to convert</param>
          252  +    /// <returns>A .NET DateTime</returns>
          253  +    public DateTime ToDateTime(double julianDay)
          254  +    {
          255  +      return DateTime.FromOADate(julianDay - 2415018.5);
          256  +    }
          257  +
          258  +    /// <summary>
          259  +    /// Converts a DateTime struct to a JulianDay double
          260  +    /// </summary>
          261  +    /// <param name="value">The DateTime to convert</param>
          262  +    /// <returns>The JulianDay value the Datetime represents</returns>
          263  +    public double ToJulianDay(DateTime value)
          264  +    {
          265  +      return value.ToOADate() + 2415018.5;
          266  +    }
   243    267   
   244    268       /// <summary>
   245    269       /// Converts a DateTime to a string value, using the current DateTimeFormat specified for the connection when it was opened.
   246    270       /// </summary>
   247    271       /// <param name="dateValue">The DateTime value to convert</param>
   248         -    /// <returns>Either a string consisting of the tick count for DateTimeFormat.Ticks, or a date/time in ISO8601 format.</returns>
          272  +    /// <returns>Either a string consisting of the tick count for DateTimeFormat.Ticks, a JulianDay double, or a date/time in ISO8601 format.</returns>
   249    273       public string ToString(DateTime dateValue)
   250    274       {
   251    275         switch (_datetimeFormat)
   252    276         {
   253    277           case SQLiteDateFormats.Ticks:
   254    278             return dateValue.Ticks.ToString(CultureInfo.InvariantCulture);
          279  +        case SQLiteDateFormats.JulianDay:
          280  +          return ToJulianDay(dateValue).ToString(CultureInfo.InvariantCulture);
   255    281           default:
   256         -          return dateValue.ToString(_datetimeFormats[0], CultureInfo.InvariantCulture);
          282  +          return dateValue.ToString(_datetimeFormats[7], CultureInfo.InvariantCulture);
   257    283         }
   258    284       }
   259    285   
   260    286       /// <summary>
   261    287       /// Internal function to convert a UTF-8 encoded IntPtr of the specified length to a DateTime.
   262    288       /// </summary>
   263    289       /// <remarks>
................................................................................
   267    293       /// <param name="ptr">A pointer to the UTF-8 encoded string</param>
   268    294       /// <param name="len">The length in bytes of the string</param>
   269    295       /// <returns>The parsed DateTime value</returns>
   270    296       internal DateTime ToDateTime(IntPtr ptr, int len)
   271    297       {
   272    298         return ToDateTime(ToString(ptr, len));
   273    299       }
          300  +
   274    301       #endregion
   275    302   
   276    303       /// <summary>
   277    304       /// Smart method of splitting a string.  Skips quoted elements, removes the quotes.
   278    305       /// </summary>
   279    306       /// <remarks>
   280    307       /// This split function works somewhat like the String.Split() function in that it breaks apart a string into
................................................................................
   351    378       /// <summary>
   352    379       /// Converts a SQLiteType to a .NET Type object
   353    380       /// </summary>
   354    381       /// <param name="t">The SQLiteType to convert</param>
   355    382       /// <returns>Returns a .NET Type object</returns>
   356    383       internal static Type SQLiteTypeToType(SQLiteType t)
   357    384       {
   358         -      return SQLiteConvert.DbTypeToType(t.Type);
          385  +      if (t.Type == DbType.Object)
          386  +        return _affinitytotype[(int)t.Affinity];
          387  +      else
          388  +        return SQLiteConvert.DbTypeToType(t.Type);
   359    389       }
          390  +
          391  +    private static Type[] _affinitytotype = {
          392  +      typeof(object),
          393  +      typeof(Int64),
          394  +      typeof(Double),
          395  +      typeof(string),
          396  +      typeof(byte[]),
          397  +      typeof(object),
          398  +      typeof(DateTime),
          399  +      typeof(object)
          400  +    };
   360    401   
   361    402       /// <summary>
   362    403       /// For a given intrinsic type, return a DbType
   363    404       /// </summary>
   364    405       /// <param name="typ">The native type to convert</param>
   365    406       /// <returns>The corresponding (closest match) DbType</returns>
   366    407       internal static DbType TypeToDbType(Type typ)

Changes to System.Data.SQLite/SQLiteDataAdapter.cs.

    13     13     using System.ComponentModel;
    14     14   
    15     15     /// <summary>
    16     16     /// SQLite implementation of DbDataAdapter.
    17     17     /// </summary>
    18     18   #if !PLATFORM_COMPACTFRAMEWORK
    19     19     [DefaultEvent("RowUpdated")]
    20         -  [ToolboxItem("SQLite.Designer.SQLiteDataAdapterToolboxItem, SQLite.Designer, Version=1.0.32.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139")]
           20  +  [ToolboxItem("SQLite.Designer.SQLiteDataAdapterToolboxItem, SQLite.Designer, Version=1.0.33.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139")]
    21     21     [Designer("Microsoft.VSDesigner.Data.VS.SqlDataAdapterDesigner, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
    22     22   #endif
    23     23     public sealed class SQLiteDataAdapter : DbDataAdapter
    24     24     {
    25     25       private static object _updatingEventPH = new object();
    26     26       private static object _updatedEventPH = new object();
    27     27   

Changes to System.Data.SQLite/SQLiteDataReader.cs.

    93     93         if (_command != null)
    94     94         {
    95     95           while (NextResult())
    96     96           {
    97     97           }
    98     98           _command.ClearDataReader();
    99     99   
          100  +        if (_disposeCommand)
          101  +          _command.Dispose();
          102  +
   100    103           // If the datareader's behavior includes closing the connection, then do so here.
   101    104           if ((_commandBehavior & CommandBehavior.CloseConnection) != 0 && _command.Connection != null)
   102    105             _command.Connection.Close();
   103         -
   104         -        if (_disposeCommand)
   105         -          _command.Dispose();
   106    106         }
   107    107   
   108    108         _command = null;
   109    109         _activeStatement = null;
   110    110         _fieldTypeArray = null;
   111    111   
   112    112         if (_keyInfo != null)
................................................................................
   214    214             if (typ == DbType.Double) return affinity;
   215    215             if (typ == DbType.Decimal) return affinity;
   216    216             break;
   217    217           case TypeAffinity.Double:
   218    218             if (typ == DbType.Single) return affinity;
   219    219             if (typ == DbType.Double) return affinity;
   220    220             if (typ == DbType.Decimal) return affinity;
          221  +          if (typ == DbType.DateTime) return affinity;
   221    222             break;
   222    223           case TypeAffinity.Text:
   223    224             if (typ == DbType.SByte) return affinity;
   224    225             if (typ == DbType.String) return affinity;
   225    226             if (typ == DbType.SByte) return affinity;
   226    227             if (typ == DbType.Guid) return affinity;
   227    228             if (typ == DbType.DateTime) return affinity;
................................................................................
   323    324       /// <summary>
   324    325       /// Retrieves the name of the back-end datatype of the column
   325    326       /// </summary>
   326    327       /// <param name="i">The index of the column to retrieve</param>
   327    328       /// <returns>string</returns>
   328    329       public override string GetDataTypeName(int i)
   329    330       {
   330         -      CheckClosed();
   331         -
   332    331         if (i >= VisibleFieldCount && _keyInfo != null)
   333    332           return _keyInfo.GetDataTypeName(i - VisibleFieldCount);
   334    333   
   335    334         SQLiteType typ = GetSQLiteType(i);
   336    335         if (typ.Type == DbType.Object) return SQLiteConvert.SQLiteTypeToType(typ).Name;
   337    336         return _activeStatement._sql.ColumnType(_activeStatement, i, out typ.Affinity);
   338    337       }
................................................................................
   382    381       /// <summary>
   383    382       /// Returns the .NET type of a given column
   384    383       /// </summary>
   385    384       /// <param name="i">The index of the column to retrieve</param>
   386    385       /// <returns>Type</returns>
   387    386       public override Type GetFieldType(int i)
   388    387       {
   389         -      CheckClosed();
   390         -
   391    388         if (i >= VisibleFieldCount && _keyInfo != null)
   392    389           return _keyInfo.GetFieldType(i - VisibleFieldCount);
   393    390   
   394    391         return SQLiteConvert.SQLiteTypeToType(GetSQLiteType(i));
   395    392       }
   396    393   
   397    394       /// <summary>
................................................................................
   474    471       /// <summary>
   475    472       /// Retrieves the name of the column
   476    473       /// </summary>
   477    474       /// <param name="i">The index of the column to retrieve</param>
   478    475       /// <returns>string</returns>
   479    476       public override string GetName(int i)
   480    477       {
   481         -      CheckClosed();
   482    478         if (i >= VisibleFieldCount && _keyInfo != null)
   483    479           return _keyInfo.GetName(i - VisibleFieldCount);
   484    480   
   485    481         return _activeStatement._sql.ColumnName(_activeStatement, i);
   486    482       }
   487    483   
   488    484       /// <summary>
................................................................................
   564    560           // Default settings for the column
   565    561           row[SchemaTableColumn.ColumnName] = GetName(n);
   566    562           row[SchemaTableColumn.ColumnOrdinal] = n;
   567    563           row[SchemaTableColumn.ColumnSize] = SQLiteConvert.DbTypeToColumnSize(typ);
   568    564           row[SchemaTableColumn.NumericPrecision] = SQLiteConvert.DbTypeToNumericPrecision(typ);
   569    565           row[SchemaTableColumn.NumericScale] = SQLiteConvert.DbTypeToNumericScale(typ);
   570    566           row[SchemaTableColumn.ProviderType] = GetSQLiteType(n).Type;
   571         -        row[SchemaTableColumn.IsLong] = (GetSQLiteType(n).Type == DbType.Binary);
          567  +        row[SchemaTableColumn.IsLong] = false;
   572    568           row[SchemaTableColumn.AllowDBNull] = true;
   573    569           row[SchemaTableOptionalColumn.IsReadOnly] = false;
   574    570           row[SchemaTableOptionalColumn.IsRowVersion] = false;
   575    571           row[SchemaTableColumn.IsUnique] = false;
   576    572           row[SchemaTableColumn.IsKey] = false;
   577    573           row[SchemaTableOptionalColumn.IsAutoIncrement] = false;
   578    574           row[SchemaTableOptionalColumn.IsReadOnly] = false;
................................................................................
   735    731       /// <summary>
   736    732       /// Retrieves the column as an object corresponding to the underlying datatype of the column
   737    733       /// </summary>
   738    734       /// <param name="i">The index of the column to retrieve</param>
   739    735       /// <returns>object</returns>
   740    736       public override object GetValue(int i)
   741    737       {
   742         -      CheckClosed();
   743         -
   744    738         if (i >= VisibleFieldCount && _keyInfo != null)
   745    739           return _keyInfo.GetValue(i - VisibleFieldCount);
   746    740   
   747    741         SQLiteType typ = GetSQLiteType(i);
   748    742   
   749    743         return _activeStatement._sql.GetValue(_activeStatement, i, typ);
   750    744       }
................................................................................
   790    784       /// <summary>
   791    785       /// Returns True if the specified column is null
   792    786       /// </summary>
   793    787       /// <param name="i">The index of the column to retrieve</param>
   794    788       /// <returns>True or False</returns>
   795    789       public override bool IsDBNull(int i)
   796    790       {
   797         -      CheckClosed();
   798         -
   799    791         if (i >= VisibleFieldCount && _keyInfo != null)
   800    792           return _keyInfo.IsDBNull(i - VisibleFieldCount);
   801    793   
   802    794         return _activeStatement._sql.IsNull(_activeStatement, i);
   803    795       }
   804    796   
   805    797       /// <summary>

Changes to System.Data.SQLite/SQLiteFunction.cs.

    97     97       /// </summary>
    98     98       private SQLiteCallback  _FinalFunc;
    99     99       /// <summary>
   100    100       /// Holds a reference to the callback function for collation sequences
   101    101       /// </summary>
   102    102       private SQLiteCollation _CompareFunc;
   103    103   
          104  +    private int _count = 1;
          105  +
   104    106       /// <summary>
   105    107       /// This static list contains all the user-defined functions declared using the proper attributes.
   106    108       /// </summary>
   107    109       private static List<SQLiteFunctionAttribute> _registeredFunctions = new List<SQLiteFunctionAttribute>();
   108    110   
   109    111       /// <summary>
   110    112       /// Internal constructor, initializes the function's internal variables.
................................................................................
   328    330       /// binary searches can be done to find the data.
   329    331       /// </remarks>
   330    332       /// <param name="context">A raw context pointer</param>
   331    333       /// <param name="nArgs">Number of arguments passed in</param>
   332    334       /// <param name="argsptr">A pointer to the array of arguments</param>
   333    335       internal void StepCallback(IntPtr context, int nArgs, IntPtr argsptr)
   334    336       {
   335         -      int n = _base.AggregateCount(context);
          337  +      int n = _count;
   336    338         long nAux;
   337    339         object obj = null;
   338    340   
   339    341         nAux = (long)_base.AggregateContext(context);
   340    342         if (n > 1) obj = _contextDataList[nAux];
   341    343   
   342         -      Step(ConvertParams(nArgs, argsptr), n, ref obj);
   343         -      _contextDataList[nAux] = obj;      
          344  +      try
          345  +      {
          346  +        Step(ConvertParams(nArgs, argsptr), n, ref obj);
          347  +        _contextDataList[nAux] = obj;
          348  +      }
          349  +      finally
          350  +      {
          351  +        _count++;
          352  +      }
   344    353       }
   345    354   
   346    355       /// <summary>
   347    356       /// An internal aggregate Final function callback, which wraps the context pointer and calls the virtual Final() method.
   348    357       /// </summary>
   349    358       /// <param name="context">A raw context pointer</param>
   350    359       /// <param name="nArgs">Not used, always zero</param>
   351    360       /// <param name="argsptr">Not used, always zero</param>
   352    361       internal void FinalCallback(IntPtr context, int nArgs, IntPtr argsptr)
   353    362       {
   354    363         long n = (long)_base.AggregateContext(context);
   355    364         object obj = null;
   356    365   
          366  +      _count = 1;
   357    367         if (_contextDataList.ContainsKey(n))
   358    368         {
   359    369           obj = _contextDataList[n];
   360    370           _contextDataList.Remove(n);
   361    371         }
   362    372   
   363    373         SetReturnValue(context, Final(obj));
................................................................................
   406    416       /// <summary>
   407    417       /// Using reflection, enumerate all assemblies in the current appdomain looking for classes that
   408    418       /// have a SQLiteFunctionAttribute attribute, and registering them accordingly.
   409    419       /// </summary>
   410    420       [Security.Permissions.FileIOPermission(Security.Permissions.SecurityAction.Assert, AllFiles = Security.Permissions.FileIOPermissionAccess.PathDiscovery)]
   411    421       static SQLiteFunction()
   412    422       {
   413         -      SQLiteFunctionAttribute at;
   414         -      System.Reflection.Assembly[] arAssemblies = System.AppDomain.CurrentDomain.GetAssemblies();
   415         -      int w = arAssemblies.Length;
   416         -      System.Reflection.AssemblyName sqlite = System.Reflection.Assembly.GetCallingAssembly().GetName();
   417         -
   418         -      for (int n = 0; n < w; n++)
          423  +      try
   419    424         {
   420         -        Type[] arTypes;
   421         -        bool found = false;
   422         -        System.Reflection.AssemblyName[] references;
   423         -        try
          425  +        SQLiteFunctionAttribute at;
          426  +        System.Reflection.Assembly[] arAssemblies = System.AppDomain.CurrentDomain.GetAssemblies();
          427  +        int w = arAssemblies.Length;
          428  +        System.Reflection.AssemblyName sqlite = System.Reflection.Assembly.GetCallingAssembly().GetName();
          429  +
          430  +        for (int n = 0; n < w; n++)
   424    431           {
   425         -          // Inspect only assemblies that reference SQLite
   426         -          references = arAssemblies[n].GetReferencedAssemblies();
   427         -          int t = references.Length;
   428         -          for (int z = 0; z < t; z++)
          432  +          Type[] arTypes;
          433  +          bool found = false;
          434  +          System.Reflection.AssemblyName[] references;
          435  +          try
   429    436             {
   430         -            if (references[z].Name == sqlite.Name)
          437  +            // Inspect only assemblies that reference SQLite
          438  +            references = arAssemblies[n].GetReferencedAssemblies();
          439  +            int t = references.Length;
          440  +            for (int z = 0; z < t; z++)
   431    441               {
   432         -              found = true;
   433         -              break;
          442  +              if (references[z].Name == sqlite.Name)
          443  +              {
          444  +                found = true;
          445  +                break;
          446  +              }
   434    447               }
          448  +
          449  +            if (found == false)
          450  +              continue;
          451  +
          452  +            arTypes = arAssemblies[n].GetTypes();
          453  +          }
          454  +          catch (Reflection.ReflectionTypeLoadException e)
          455  +          {
          456  +            arTypes = e.Types;
   435    457             }
   436    458   
   437         -          if (found == false)
   438         -            continue;
   439         -
   440         -          arTypes = arAssemblies[n].GetTypes();
   441         -        }
   442         -        catch (Reflection.ReflectionTypeLoadException e)
   443         -        {
   444         -          arTypes = e.Types;
   445         -        }
          459  +          int v = arTypes.Length;
          460  +          for (int x = 0; x < v; x++)
          461  +          {
          462  +            if (arTypes[x] == null) continue;
   446    463   
   447         -        int v = arTypes.Length;
   448         -        for (int x = 0; x < v; x++)
   449         -        {
   450         -          if (arTypes[x] == null) continue;
   451         -
   452         -          object[] arAtt = arTypes[x].GetCustomAttributes(typeof(SQLiteFunctionAttribute), false);
   453         -          int u = arAtt.Length;
   454         -          for (int y = 0; y < u; y++)
   455         -          {
   456         -            at = arAtt[y] as SQLiteFunctionAttribute;
   457         -            if (at != null)
          464  +            object[] arAtt = arTypes[x].GetCustomAttributes(typeof(SQLiteFunctionAttribute), false);
          465  +            int u = arAtt.Length;
          466  +            for (int y = 0; y < u; y++)
   458    467               {
   459         -              at._instanceType = arTypes[x];
   460         -              _registeredFunctions.Add(at);
          468  +              at = arAtt[y] as SQLiteFunctionAttribute;
          469  +              if (at != null)
          470  +              {
          471  +                at._instanceType = arTypes[x];
          472  +                _registeredFunctions.Add(at);
          473  +              }
   461    474               }
   462    475             }
   463    476           }
          477  +      }
          478  +      catch // SQLite provider can continue without being able to find built-in functions
          479  +      {
   464    480         }
   465    481       }
   466    482   #endif
   467    483       /// <summary>
   468    484       /// Manual method of registering a function.  The type must still have the SQLiteFunctionAttributes in order to work
   469    485       /// properly, but this is a workaround for the Compact Framework where enumerating assemblies is not currently supported.
   470    486       /// </summary>

Changes to System.Data.SQLite/SR.Designer.cs.

     1      1   //------------------------------------------------------------------------------
     2      2   // <auto-generated>
     3      3   //     This code was generated by a tool.
     4         -//     Runtime Version:2.0.50727.42
            4  +//     Runtime Version:2.0.50727.1433
     5      5   //
     6      6   //     Changes to this file may cause incorrect behavior and will be lost if
     7      7   //     the code is regenerated.
     8      8   // </auto-generated>
     9      9   //------------------------------------------------------------------------------
    10     10   
    11     11   namespace System.Data.SQLite {
................................................................................
    15     15       /// <summary>
    16     16       ///   A strongly-typed resource class, for looking up localized strings, etc.
    17     17       /// </summary>
    18     18       // This class was auto-generated by the StronglyTypedResourceBuilder
    19     19       // class via a tool like ResGen or Visual Studio.
    20     20       // To add or remove a member, edit your .ResX file then rerun ResGen
    21     21       // with the /str option, or rebuild your VS project.
    22         -    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
    23     22       [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    24     23       internal class SR {
    25     24           
    26     25           private static global::System.Resources.ResourceManager resourceMan;
    27     26           
    28     27           private static global::System.Globalization.CultureInfo resourceCulture;
    29     28           
    30         -        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
    31     29           internal SR() {
    32     30           }
    33     31           
    34     32           /// <summary>
    35     33           ///   Returns the cached ResourceManager instance used by this class.
    36     34           /// </summary>
    37     35           [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]

Changes to System.Data.SQLite/SR.resx.

     1      1   <?xml version="1.0" encoding="utf-8"?>
     2      2   <root>
     3         -  <!-- 
            3  +	<!-- 
     4      4       Microsoft ResX Schema 
     5      5       
     6      6       Version 2.0
     7      7       
     8      8       The primary goals of this format is to allow a simple XML format 
     9      9       that is mostly human readable. The generation and parsing of the 
    10     10       various data types are done through the TypeConverter classes 
................................................................................
    55     55               : and then encoded with base64 encoding.
    56     56   
    57     57       mimetype: application/x-microsoft.net.object.bytearray.base64
    58     58       value   : The object must be serialized into a byte array 
    59     59               : using a System.ComponentModel.TypeConverter
    60     60               : and then encoded with base64 encoding.
    61     61       -->
    62         -  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    63         -    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
    64         -    <xsd:element name="root" msdata:IsDataSet="true">
    65         -      <xsd:complexType>
    66         -        <xsd:choice maxOccurs="unbounded">
    67         -          <xsd:element name="metadata">
    68         -            <xsd:complexType>
    69         -              <xsd:sequence>
    70         -                <xsd:element name="value" type="xsd:string" minOccurs="0" />
    71         -              </xsd:sequence>
    72         -              <xsd:attribute name="name" use="required" type="xsd:string" />
    73         -              <xsd:attribute name="type" type="xsd:string" />
    74         -              <xsd:attribute name="mimetype" type="xsd:string" />
    75         -              <xsd:attribute ref="xml:space" />
    76         -            </xsd:complexType>
    77         -          </xsd:element>
    78         -          <xsd:element name="assembly">
    79         -            <xsd:complexType>
    80         -              <xsd:attribute name="alias" type="xsd:string" />
    81         -              <xsd:attribute name="name" type="xsd:string" />
    82         -            </xsd:complexType>
    83         -          </xsd:element>
    84         -          <xsd:element name="data">
    85         -            <xsd:complexType>
    86         -              <xsd:sequence>
    87         -                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
    88         -                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
    89         -              </xsd:sequence>
    90         -              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
    91         -              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
    92         -              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
    93         -              <xsd:attribute ref="xml:space" />
    94         -            </xsd:complexType>
    95         -          </xsd:element>
    96         -          <xsd:element name="resheader">
    97         -            <xsd:complexType>
    98         -              <xsd:sequence>
    99         -                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
   100         -              </xsd:sequence>
   101         -              <xsd:attribute name="name" type="xsd:string" use="required" />
   102         -            </xsd:complexType>
   103         -          </xsd:element>
   104         -        </xsd:choice>
   105         -      </xsd:complexType>
   106         -    </xsd:element>
   107         -  </xsd:schema>
   108         -  <resheader name="resmimetype">
   109         -    <value>text/microsoft-resx</value>
   110         -  </resheader>
   111         -  <resheader name="version">
   112         -    <value>2.0</value>
   113         -  </resheader>
   114         -  <resheader name="reader">
   115         -    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   116         -  </resheader>
   117         -  <resheader name="writer">
   118         -    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   119         -  </resheader>
   120         -  <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
   121         -  <data name="DataTypes" type="System.Resources.ResXFileRef, System.Windows.Forms">
   122         -    <value>datatypes.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
   123         -  </data>
   124         -  <data name="Keywords" xml:space="preserve">
           62  +	<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
           63  +		<xsd:import namespace="http://www.w3.org/XML/1998/namespace"/>
           64  +		<xsd:element name="root" msdata:IsDataSet="true">
           65  +			<xsd:complexType>
           66  +				<xsd:choice maxOccurs="unbounded">
           67  +					<xsd:element name="metadata">
           68  +						<xsd:complexType>
           69  +							<xsd:sequence>
           70  +								<xsd:element name="value" type="xsd:string" minOccurs="0"/>
           71  +							</xsd:sequence>
           72  +							<xsd:attribute name="name" use="required" type="xsd:string"/>
           73  +							<xsd:attribute name="type" type="xsd:string"/>
           74  +							<xsd:attribute name="mimetype" type="xsd:string"/>
           75  +							<xsd:attribute ref="xml:space"/>
           76  +						</xsd:complexType>
           77  +					</xsd:element>
           78  +					<xsd:element name="assembly">
           79  +						<xsd:complexType>
           80  +							<xsd:attribute name="alias" type="xsd:string"/>
           81  +							<xsd:attribute name="name" type="xsd:string"/>
           82  +						</xsd:complexType>
           83  +					</xsd:element>
           84  +					<xsd:element name="data">
           85  +						<xsd:complexType>
           86  +							<xsd:sequence>
           87  +								<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1"/>
           88  +								<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2"/>
           89  +							</xsd:sequence>
           90  +							<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1"/>
           91  +							<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3"/>
           92  +							<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4"/>
           93  +							<xsd:attribute ref="xml:space"/>
           94  +						</xsd:complexType>
           95  +					</xsd:element>
           96  +					<xsd:element name="resheader">
           97  +						<xsd:complexType>
           98  +							<xsd:sequence>
           99  +								<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1"/>
          100  +							</xsd:sequence>
          101  +							<xsd:attribute name="name" type="xsd:string" use="required"/>
          102  +						</xsd:complexType>
          103  +					</xsd:element>
          104  +				</xsd:choice>
          105  +			</xsd:complexType>
          106  +		</xsd:element>
          107  +	</xsd:schema>
          108  +	<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
          109  +	<data name="DataTypes" type="System.Resources.ResXFileRef, System.Windows.Forms">
          110  +		<value>datatypes.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
          111  +	</data>
          112  +	<data name="Keywords" xml:space="preserve">
   125    113       <value>ALL,ALTER,AND,AS,AUTOINCREMENT,BETWEEN,BY,CASE,CHECK,COLLATE,COMMIT,CONSTRAINT,CREATE,CROSS,DEFAULT,DEFERRABLE,DELETE,DISTINCT,DROP,ELSE,ESCAPE,EXCEPT,FOREIGN,FROM,FULL,GROUP,HAVING,IN,INDEX,INNER,INSERT,INTERSECT,INTO,IS,ISNULL,JOIN,LEFT,LIMIT,NATURAL,NOT,NOTNULL,NULL,ON,OR,ORDER,OUTER,PRIMARY,REFERENCES,RIGHT,ROLLBACK,SELECT,SET,TABLE,THEN,TO,TRANSACTION,UNION,UNIQUE,UPDATE,USING,VALUES,WHEN,WHERE</value>
   126    114     </data>
   127         -  <data name="MetaDataCollections" type="System.Resources.ResXFileRef, System.Windows.Forms">
   128         -    <value>metadatacollections.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
   129         -  </data>
   130         -</root>
          115  +	<data name="MetaDataCollections" type="System.Resources.ResXFileRef, System.Windows.Forms">
          116  +		<value>metadatacollections.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
          117  +	</data>
          118  +	<resheader name="resmimetype"><value>text/microsoft-resx</value></resheader><resheader name="version"><value>2.0</value></resheader><resheader name="reader"><value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader><resheader name="writer"><value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader></root>

Changes to System.Data.SQLite/System.Data.SQLite.

     1         -<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
            1  +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
     2      2     <PropertyGroup>
     3      3       <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
     4      4       <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
     5      5       <ProductVersion>8.0.50727</ProductVersion>
     6      6       <SchemaVersion>2.0</SchemaVersion>
     7      7       <ProjectGuid>{AC139952-261A-4463-B6FA-AEBC25283A66}</ProjectGuid>
     8      8       <OutputType>Library</OutputType>
................................................................................
     9      9       <AppDesignerFolder>Properties</AppDesignerFolder>
    10     10       <RootNamespace>System.Data.SQLite</RootNamespace>
    11     11       <AssemblyName>System.Data.SQLite</AssemblyName>
    12     12       <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
    13     13       <SignAssembly>true</SignAssembly>
    14     14       <AssemblyOriginatorKeyFile>System.Data.SQLite.snk</AssemblyOriginatorKeyFile>
    15     15       <RunPostBuildEvent>OnOutputUpdated</RunPostBuildEvent>
           16  +    <FileUpgradeFlags>
           17  +    </FileUpgradeFlags>
           18  +    <OldToolsVersion>2.0</OldToolsVersion>
           19  +    <UpgradeBackupLocation>
           20  +    </UpgradeBackupLocation>
    16     21     </PropertyGroup>
    17     22     <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    18     23       <DebugSymbols>true</DebugSymbols>
    19     24       <DebugType>full</DebugType>
    20     25       <Optimize>false</Optimize>
    21     26       <OutputPath>..\bin\</OutputPath>
    22     27       <DefineConstants>TRACE;DEBUG;USE_INTEROP_DLL</DefineConstants>
................................................................................
    23     28       <ErrorReport>prompt</ErrorReport>
    24     29       <WarningLevel>4</WarningLevel>
    25     30       <DocumentationFile>
    26     31       </DocumentationFile>
    27     32       <GenerateSerializationAssemblies>off</GenerateSerializationAssemblies>
    28     33       <FileAlignment>512</FileAlignment>
    29     34       <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
           35  +    <PlatformTarget>x86</PlatformTarget>
    30     36     </PropertyGroup>
    31     37     <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    32     38       <DebugSymbols>false</DebugSymbols>
    33     39       <OutputPath>bin\</OutputPath>
    34     40       <DefineConstants>
    35     41       </DefineConstants>
    36     42       <DebugType>none</DebugType>
    37     43       <PlatformTarget>AnyCPU</PlatformTarget>
    38         -    <CodeAnalysisRuleAssemblies>C:\Program Files\Microsoft Visual Studio 8\Team Tools\Static Analysis Tools\FxCop\\rules</CodeAnalysisRuleAssemblies>
    39     44       <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
    40     45       <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
    41     46       <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
    42     47       <ErrorReport>prompt</ErrorReport>
    43     48       <FileAlignment>512</FileAlignment>
    44     49       <DocumentationFile>bin\System.Data.SQLite.XML</DocumentationFile>
    45     50       <AllowUnsafeBlocks>false</AllowUnsafeBlocks>

Changes to bin/CompactFramework/System.Data.SQLite.DLL.

cannot compute difference between binary files

Changes to bin/CompactFramework/System.Data.SQLite.lib.

cannot compute difference between binary files

Changes to bin/CompactFramework/testce.exe.

cannot compute difference between binary files

Changes to bin/Designer/SQLite.Designer.dll.

cannot compute difference between binary files

Changes to bin/Designer/install.exe.

cannot compute difference between binary files

Changes to bin/System.Data.SQLite.XML.

    97     97               </item>
    98     98               <item>
    99     99               <description>Legacy Format</description>
   100    100               <description><b>True</b> - Use the more compatible legacy 3.x database format<br/><b>False</b> - Use the newer 3.3x database format which compresses numbers more effectively</description>
   101    101               <description>N</description>
   102    102               <description>True</description>
   103    103               </item>
          104  +            <item>
          105  +            <description>Default Timeout</description>
          106  +            <description>{time in seconds}<br/>The default command timeout</description>
          107  +            <description>N</description>
          108  +            <description>30</description>
          109  +            </item>
   104    110               </list>
   105    111               </remarks>
   106    112           </member>
   107    113           <member name="F:System.Data.SQLite.SQLiteConnection._connectionState">
   108    114               <summary>
   109    115               State of the current connection
   110    116               </summary>
................................................................................
   134    140               The database filename minus path and extension
   135    141               </summary>
   136    142           </member>
   137    143           <member name="F:System.Data.SQLite.SQLiteConnection._password">
   138    144               <summary>
   139    145               Temporary password storage, emptied after the database has been opened
   140    146               </summary>
          147  +        </member>
          148  +        <member name="F:System.Data.SQLite.SQLiteConnection._defaultTimeout">
          149  +            <summary>
          150  +            Default command timeout
          151  +            </summary>
   141    152           </member>
   142    153           <member name="M:System.Data.SQLite.SQLiteConnection.#ctor">
   143    154               <overloads>
   144    155                Constructs a new SQLiteConnection object
   145    156                </overloads>
   146    157                <summary>
   147    158                Default constructor
................................................................................
   475    486               </summary>
   476    487           </member>
   477    488           <member name="E:System.Data.SQLite.SQLiteConnection.StateChange">
   478    489               <summary>
   479    490               This event is raised whenever the database is opened or closed.
   480    491               </summary>
   481    492           </member>
   482         -        <member name="E:System.Data.SQLite.SQLiteConnection.Update">
   483         -            <summary>
   484         -            This event is raised whenever SQLite makes an update/delete/insert into the database on
   485         -            this connection.  It only applies to the given connection.
   486         -            </summary>
   487         -        </member>
   488         -        <member name="E:System.Data.SQLite.SQLiteConnection.Commit">
   489         -            <summary>
   490         -            This event is raised whenever SQLite is committing a transaction.
   491         -            Return non-zero to trigger a rollback
   492         -            </summary>
   493         -        </member>
   494         -        <member name="E:System.Data.SQLite.SQLiteConnection.RollBack">
   495         -            <summary>
   496         -            This event is raised whenever SQLite is committing a transaction.
   497         -            Return non-zero to trigger a rollback
   498         -            </summary>
   499         -        </member>
   500    493           <member name="P:System.Data.SQLite.SQLiteConnection.ConnectionString">
   501    494               <summary>
   502    495               The connection string containing the parameters for the connection
   503    496               </summary>
   504    497               <remarks>
   505    498               <list type="table">
   506    499               <listheader>
................................................................................
   525    518               <description>UseUTF16Encoding</description>
   526    519               <description><b>True</b><br/><b>False</b></description>
   527    520               <description>N</description>
   528    521               <description>False</description>
   529    522               </item>
   530    523               <item>
   531    524               <description>DateTimeFormat</description>
   532         -            <description><b>Ticks</b> - Use DateTime.Ticks<br/><b>ISO8601</b> - Use ISO8601 DateTime format</description>
          525  +            <description><b>Ticks</b> - Use DateTime.Ticks<br/><b>ISO8601</b> - Use ISO8601 DateTime format<br/><b>JulianDay</b> - Use JulianDay format</description>
   533    526               <description>N</description>
   534    527               <description>ISO8601</description>
   535    528               </item>
   536    529               <item>
   537    530               <description>BinaryGUID</description>
   538    531               <description><b>Yes/On/1</b> - Store GUID columns in binary form<br/><b>No/Off/0</b> - Store GUID columns as text</description>
   539    532               <description>N</description>
................................................................................
   589    582               </item>
   590    583               <item>
   591    584               <description>Legacy Format</description>
   592    585               <description><b>True</b> - Use the more compatible legacy 3.x database format<br/><b>False</b> - Use the newer 3.3x database format which compresses numbers more effectively</description>
   593    586               <description>N</description>
   594    587               <description>True</description>
   595    588               </item>
          589  +            <item>
          590  +            <description>Default Timeout</description>
          591  +            <description>{time in seconds}<br/>The default command timeout</description>
          592  +            <description>N</description>
          593  +            <description>30</description>
          594  +            </item>
   596    595               </list>
   597    596               </remarks>
   598    597           </member>
   599    598           <member name="P:System.Data.SQLite.SQLiteConnection.DataSource">
   600    599               <summary>
   601    600               Returns the filename without extension or path
   602    601               </summary>
   603    602           </member>
   604    603           <member name="P:System.Data.SQLite.SQLiteConnection.Database">
   605    604               <summary>
   606    605               Returns an empty string
   607    606               </summary>
          607  +        </member>
          608  +        <member name="P:System.Data.SQLite.SQLiteConnection.DefaultTimeout">
          609  +            <summary>
          610  +            Gets/sets the default command timeout for newly-created commands.  This is especially useful for 
          611  +            commands used internally such as inside a SQLiteTransaction, where setting the timeout is not possible.
          612  +            This can also be set in the ConnectionString with "Default Timeout"
          613  +            </summary>
   608    614           </member>
   609    615           <member name="P:System.Data.SQLite.SQLiteConnection.ServerVersion">
   610    616               <summary>
   611    617               Returns the version of the underlying SQLite database engine
   612    618               </summary>
   613    619           </member>
   614    620           <member name="P:System.Data.SQLite.SQLiteConnection.State">
   615    621               <summary>
   616    622               Returns the state of the connection.
   617    623               </summary>
          624  +        </member>
          625  +        <member name="E:System.Data.SQLite.SQLiteConnection.Update">
          626  +            <summary>
          627  +            This event is raised whenever SQLite makes an update/delete/insert into the database on
          628  +            this connection.  It only applies to the given connection.
          629  +            </summary>
          630  +        </member>
          631  +        <member name="E:System.Data.SQLite.SQLiteConnection.Commit">
          632  +            <summary>
          633  +            This event is raised whenever SQLite is committing a transaction.
          634  +            Return non-zero to trigger a rollback
          635  +            </summary>
          636  +        </member>
          637  +        <member name="E:System.Data.SQLite.SQLiteConnection.RollBack">
          638  +            <summary>
          639  +            This event is raised whenever SQLite is committing a transaction.
          640  +            Return non-zero to trigger a rollback
          641  +            </summary>
   618    642           </member>
   619    643           <member name="T:System.Data.SQLite.SQLiteDataAdapter">
   620    644               <summary>
   621    645               SQLite implementation of DbDataAdapter.
   622    646               </summary>
   623    647           </member>
   624    648           <member name="M:System.Data.SQLite.SQLiteDataAdapter.#ctor">
................................................................................
   750    774               Using ticks is more accurate but less compatible with other viewers and utilities that access your database.
   751    775               </summary>
   752    776           </member>
   753    777           <member name="F:System.Data.SQLite.SQLiteDateFormats.ISO8601">
   754    778               <summary>
   755    779               The default format for this provider.
   756    780               </summary>
          781  +        </member>
          782  +        <member name="F:System.Data.SQLite.SQLiteDateFormats.JulianDay">
          783  +            <summary>
          784  +            JulianDay format, which is what SQLite uses internally
          785  +            </summary>
   757    786           </member>
   758    787           <member name="T:System.Data.SQLite.SQLiteType">
   759    788               <summary>
   760    789               Struct used internally to determine the datatype of a column in a resultset
   761    790               </summary>
   762    791           </member>
   763    792           <member name="F:System.Data.SQLite.SQLiteType.Type">
................................................................................
   841    870                 yyyyMMddTHHmmssfffffff
   842    871                 yyyy-MM-dd
   843    872                 yy-MM-dd
   844    873                 yyyyMMdd
   845    874                 HH:mm:ss
   846    875                 THHmmss
   847    876               </remarks>
   848         -            <param name="dateText">The string containing either a Tick value or an ISO8601-format string</param>
          877  +            <param name="dateText">The string containing either a Tick value, a JulianDay double, or an ISO8601-format string</param>
   849    878               <returns>A DateTime value</returns>
          879  +        </member>
          880  +        <member name="M:System.Data.SQLite.SQLiteConvert.ToDateTime(System.Double)">
          881  +            <summary>
          882  +            Converts a julianday value into a DateTime
          883  +            </summary>
          884  +            <param name="julianDay">The value to convert</param>
          885  +            <returns>A .NET DateTime</returns>
          886  +        </member>
          887  +        <member name="M:System.Data.SQLite.SQLiteConvert.ToJulianDay(System.DateTime)">
          888  +            <summary>
          889  +            Converts a DateTime struct to a JulianDay double
          890  +            </summary>
          891  +            <param name="value">The DateTime to convert</param>
          892  +            <returns>The JulianDay value the Datetime represents</returns>
   850    893           </member>
   851    894           <member name="M:System.Data.SQLite.SQLiteConvert.ToString(System.DateTime)">
   852    895               <summary>
   853    896               Converts a DateTime to a string value, using the current DateTimeFormat specified for the connection when it was opened.
   854    897               </summary>
   855    898               <param name="dateValue">The DateTime value to convert</param>
   856         -            <returns>Either a string consisting of the tick count for DateTimeFormat.Ticks, or a date/time in ISO8601 format.</returns>
          899  +            <returns>Either a string consisting of the tick count for DateTimeFormat.Ticks, a JulianDay double, or a date/time in ISO8601 format.</returns>
   857    900           </member>
   858    901           <member name="M:System.Data.SQLite.SQLiteConvert.ToDateTime(System.IntPtr,System.Int32)">
   859    902               <summary>
   860    903               Internal function to convert a UTF-8 encoded IntPtr of the specified length to a DateTime.
   861    904               </summary>
   862    905               <remarks>
   863    906               This is a convenience function, which first calls ToString() on the IntPtr to convert it to a string, then calls
................................................................................
  1268   1311               </summary>
  1269   1312           </member>
  1270   1313           <member name="M:System.Data.SQLite.SQLiteFunction.#cctor">
  1271   1314               <summary>
  1272   1315               Using reflection, enumerate all assemblies in the current appdomain looking for classes that
  1273   1316               have a SQLiteFunctionAttribute attribute, and registering them accordingly.
  1274   1317               </summary>
         1318  +        </member>
         1319  +        <member name="M:System.Data.SQLite.SQLiteFunction.RegisterFunction(System.Type)">
         1320  +            <summary>
         1321  +            Manual method of registering a function.  The type must still have the SQLiteFunctionAttributes in order to work
         1322  +            properly, but this is a workaround for the Compact Framework where enumerating assemblies is not currently supported.
         1323  +            </summary>
         1324  +            <param name="typ">The type of the function to register</param>
  1275   1325           </member>
  1276   1326           <member name="M:System.Data.SQLite.SQLiteFunction.BindFunctions(System.Data.SQLite.SQLiteBase)">
  1277   1327               <summary>
  1278   1328               Called by SQLiteBase derived classes, this function binds all user-defined functions to a connection.
  1279   1329               It is done this way so that all user-defined functions will access the database using the same encoding scheme
  1280   1330               as the connection (UTF-8 or UTF-16).
  1281   1331               </summary>
................................................................................
  1809   1859               <param name="parameterType">The data type</param>
  1810   1860               <param name="parameterSize">The size of the parameter</param>
  1811   1861               <param name="sourceColumn">The source column</param>
  1812   1862               <param name="rowVersion">The row version information</param>
  1813   1863           </member>
  1814   1864           <member name="M:System.Data.SQLite.SQLiteParameter.ResetDbType">
  1815   1865               <summary>
  1816         -            Not implemented
         1866  +            Resets the DbType of the parameter so it can be inferred from the value
  1817   1867               </summary>
  1818   1868           </member>
  1819   1869           <member name="M:System.Data.SQLite.SQLiteParameter.Clone">
  1820   1870               <summary>
  1821   1871               Clones a parameter
  1822   1872               </summary>
  1823   1873               <returns>A new, unassociated SQLiteParameter</returns>
................................................................................
  2291   2341               which saves space in the database.
  2292   2342               </summary>
  2293   2343           </member>
  2294   2344           <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.DataSource">
  2295   2345               <summary>
  2296   2346               Gets/Sets the filename to open on the connection string.
  2297   2347               </summary>
         2348  +        </member>
         2349  +        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.DefaultTimeout">
         2350  +            <summary>
         2351  +            Gets/sets the default command timeout for newly-created commands.  This is especially useful for 
         2352  +            commands used internally such as inside a SQLiteTransaction, where setting the timeout is not possible.
         2353  +            </summary>
  2298   2354           </member>
  2299   2355           <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.Enlist">
  2300   2356               <summary>
  2301   2357               Determines whether or not the connection will automatically participate
  2302   2358               in the current distributed transaction (if one exists)
  2303   2359               </summary>
         2360  +        </member>
         2361  +        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.FailIfMissing">
         2362  +            <summary>
         2363  +            If set to true, will throw an exception if the database specified in the connection
         2364  +            string does not exist.  If false, the database will be created automatically.
         2365  +            </summary>
  2304   2366           </member>
  2305   2367           <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.LegacyFormat">
  2306   2368               <summary>
  2307   2369               If enabled, uses the legacy 3.xx format for maximum compatibility, but results in larger
  2308   2370               database sizes.
  2309   2371               </summary>
  2310   2372           </member>
................................................................................
  2611   2673               <summary>
  2612   2674               SQLite implementation of DbProviderFactory.
  2613   2675               </summary>
  2614   2676               <summary>
  2615   2677               SQLite implementation of DbProviderFactory.
  2616   2678               </summary>
  2617   2679           </member>
  2618         -        <member name="M:System.Data.SQLite.SQLiteFactory.GetService(System.Type)">
         2680  +        <member name="M:System.Data.SQLite.SQLiteFactory.System#IServiceProvider#GetService(System.Type)">
  2619   2681               <summary>
  2620   2682               Will provide a DbProviderServices object in .NET 3.5
  2621   2683               </summary>
  2622   2684               <param name="serviceType">The class or interface type to query for</param>
  2623   2685               <returns></returns>
  2624   2686           </member>
  2625   2687           <member name="F:System.Data.SQLite.SQLiteFactory.Instance">

Changes to bin/System.Data.SQLite.dll.

cannot compute difference between binary files

Changes to bin/System.Data.SQLite.lib.

cannot compute difference between binary files

Changes to bin/itanium/System.Data.SQLite.DLL.

cannot compute difference between binary files

Changes to bin/itanium/System.Data.SQLite.lib.

cannot compute difference between binary files

Changes to bin/test.exe.

cannot compute difference between binary files

Changes to bin/x64/System.Data.SQLite.DLL.

cannot compute difference between binary files

Changes to bin/x64/System.Data.SQLite.lib.

cannot compute difference between binary files

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 2.0 SQLite Data Provider<br>
     8         -    Version 1.0.47.0 December 4, 2007<br>
     9         -    Using SQLite 3.5.3<br>
            8  +    Version 1.0.49.0 May 28, 2008<br>
            9  +    Using SQLite 3.5.9<br>
    10     10       Written by Robert Simpson (<a href="mailto:robert@blackcastlesoft.com">robert@blackcastlesoft.com</a>)<br>
    11     11       Released to the public domain, use at your own risk!<br>
    12     12       Official provider website:&nbsp; <a href="http://sqlite.phxsoftware.com">http://sqlite.phxsoftware.com</a><br />
    13     13       <br>
    14     14       The latest version can be downloaded <a href="http://sourceforge.net/projects/sqlite-dotnet2">
    15     15         here</a>
    16     16       <br>
................................................................................
    17     17       <br>
    18     18       <b></b>
    19     19       <h2>
    20     20         <b>Features:</b><br>
    21     21       </h2>
    22     22       <UL>
    23     23         <LI>
    24         -      Written from scratch on VS2005/2008 specifically for ADO.NET 2.0, implementing all the
           24  +      Written from scratch on VS2008 specifically for ADO.NET 2.0, implementing all the
    25     25         base classes and features recently introduced in the framework, including automatic
    26     26         transaction enlistment.<li>Supports the Full
    27     27           and Compact .NET Framework, as well as native C/C++ development.&nbsp; 100% binary
    28     28           compatible with the original sqlite3.dll.</li>
    29     29         <LI>
    30     30         On the Compact Framework, it is faster than the newly-introduced Sql Server 
    31     31         Mobile.  SQLite's installed size is a fraction of Sql Mobile's. It uses less memory at runtime, runs queries faster, and has a smaller database file size as well.
    32     32         <li>Encrypted database support.&nbsp; Encrypted databases are fully encrypted and
    33     33           support both binary and cleartext password types.</li>
    34     34         <LI>
    35     35         Visual Studio 2005/2008 Design-Time Support, works with all versions of VS2005/2008,
    36     36           including
    37         -      all Express Editions.&nbsp; You can add a SQLite 
           37  +      all Express Editions of VS2005.&nbsp; You can add a SQLite 
    38     38         database to the Servers list, design queries with the Query Designer, 
    39     39         drag-and-drop tables onto a Typed DataSet, etc.
    40     40         <LI>
    41     41         Single file redistributable.&nbsp; The core sqlite3 codebase and the ADO.NET wrapper 
    42     42         are combined into one multi-module assembly.
    43     43         <LI>
    44     44         Binaries included for Itanium, x64, x86 and ARM processors.
................................................................................
   116    116       <p>
   117    117         The core sqlite engine is compiled directly from the unmodified source code available
   118    118         at the sqlite.org website.&nbsp; Several additional pieces are compiled on top of
   119    119         it to extend its functionality, but the core engine's source is not changed.</p>
   120    120       <p></p>
   121    121       <p>
   122    122         <b>Version History</b></p>
          123  +    <p><b>1.0.49.0 - May 28, 2008</b></p>
          124  +    <ul>
          125  +      <li>Code merge with SQLite 3.5.9</li>
          126  +      <li>Fixed schema problems when querying the TEMP catalog.</li>
          127  +      <li>Changed BLOB datatype schema to return IsLong = False instead of True.&nbsp; This
          128  +        was preventing DbCommandBuilder from using GUID's and BLOB's as primary keys.</li>
          129  +      <li>Fix rollover issue with SQLite3.Reset() using TickCount.</li>
          130  +      <li>Fixed SQLiteDataReader to dispose of its command (if called for) before 
          131  +        closing the connection (when flagged to do so) instead of the other way around.</li>
          132  +      <li>Fixed a DbNull error when retrieving items not backed by a table schema.</li>
          133  +      <li>Fixed foreign key constraint parsing bug.</li>
          134  +      <li>Added FailIfMissing property to the SQLiteConnectionStringBuilder.</li>
          135  +      <li>Converted the source projects to Visual Studio 2008.</li>
          136  +    </ul>
          137  +    <p><b>1.0.48.0 - December 28, 2007</b></p>
          138  +    <ul>
          139  +      <li>Code merge with SQLite 3.5.4</li>
          140  +      <li>Calling SQLiteDataReader.GetFieldType() on a column with no schema information
          141  +        and whos first row is initially NULL now returns type Object instead of type DbNull.</li>
          142  +      <li>Added support for a new DateTime type, JulianDay.&nbsp; SQLite uses Julian dates
          143  +        internally.</li>
          144  +      <li>Added a new connection string parameter "Default Timeout" and a corresponding
          145  +        method on the SQLiteConnection object to change the default command timeout.&nbsp;
          146  +        This is especially useful for changing the timeout on transactions, which use SQLiteCommand
          147  +        objects internally and have no ADO.NET-friendly way to adjust the command timeout
          148  +        on those commands.</li>
          149  +      <li>FTS1 and FTS2 modules were removed from the codebase.&nbsp; Please upgrade all
          150  +        full-text indexes to use the FTS3 module.&nbsp;</li>
          151  +    </ul>
          152  +    <p><b>1.0.47.2 - December 10, 2007</b></p>
          153  +    <ul>
          154  +      <li>Fixed yet one more bug when closing a database with unfinalized command objects</li>
          155  +      <li>Fixed the DataReader's GetFieldType function when dealing with untyped SQLite affinities</li>
          156  +    </ul>
          157  +    <p><b>1.0.47.1 - December 5, 2007</b></p>
          158  +    <ul>
          159  +      <li>Fixed a leftover bug from the codemerge with SQLite 3.5.3 that failed to close a database.</li>
          160  +      <li>Fixed the broken Compact Framework distribution binary.</li>
          161  +      <li>SQLite 3.5.x changed some internal infrastructure pieces in the encryption interface
          162  +        which I didn't catch initially.&nbsp; Fixed.&nbsp;</li>
          163  +    </ul>
   123    164       <p><b>1.0.47.0 - December 4, 2007</b></p>
   124    165       <ul>
   125    166         <li>Code merge with SQLite 3.5.3</li>
   126    167         <li>Added installer support for Visual Studio 2008.&nbsp; Code is still using the
   127    168           VS2005 SDK so one or two bells and whistles are missing, but nothing significant.</li>
   128    169         <li>This is the last version that the FTS1 and FTS2 extensions will appear.&nbsp;
   129    170           Everyone should rebuild their fulltext indexes using the new FTS3 module.&nbsp;

Changes to test/Program.cs.

    13     13       static void Main(string[] args)
    14     14       {
    15     15         DbProviderFactory fact;
    16     16         fact = DbProviderFactories.GetFactory("System.Data.SQLite");
    17     17   
    18     18         System.IO.File.Delete("test.db3");
    19     19   
    20         -      //SqlConnection cnn2 = new SqlConnection("Data Source=(local);Initial Catalog=iDiscover;Integrated Security=True");
    21         -      //cnn2.Open();
    22         -      //cnn2.BeginTransaction();
    23         -      //cnn2.Close();
    24         -
    25         -      //cnn2 = new SqlConnection("Data Source=(local);Initial Catalog=iDiscover;Integrated Security=True");
    26         -      //cnn2.Open();
    27         -      //cnn2.BeginTransaction();
    28         -      //cnn2.Close();
    29         -
    30     20         SQLiteConnection cnn = new SQLiteConnection();
    31     21         {
    32         -        cnn.ConnectionString = "Data Source=test.db3;Pooling=False;Password=yVXL39etehPX";
           22  +        cnn.ConnectionString = "Data Source=test.db3;Pooling=False";
    33     23           cnn.Open();
    34     24   
    35         -        //using (DbCommand cmd = cnn.CreateCommand())
    36         -        //{
    37         -        //  cmd.CommandText = "CREATE TABLE Foo(ID integer primary key, myvalue varchar(50))";
    38         -        //  cmd.ExecuteNonQuery();
    39         -
    40         -        //  cmd.CommandText = "CREATE TABLE Foo2(ID integer primary key, myvalue2)";
    41         -        //  cmd.ExecuteNonQuery();
    42         -
    43         -        //  cmd.CommandText = "create view myview as select a.id, a.myvalue, b.myvalue2 from foo as a inner join foo2 as b on a.id = b.id";
    44         -        //  cmd.ExecuteNonQuery();
    45         -
    46         -        //  cmd.CommandText = "select * from myview";
    47         -        //  using (DbDataReader reader = cmd.ExecuteReader())
    48         -        //  {
    49         -        //    DataTable tbl = reader.GetSchemaTable();
    50         -
    51         -        //    Type t = reader.GetFieldType(0);
    52         -        //    t = reader.GetFieldType(1);
    53         -        //    t = reader.GetFieldType(2);
    54         -        //  }
    55         -        //}
    56         -
    57         -        //cnn.BeginTransaction();
    58         -        //cnn.Close();
    59         -
    60         -        //cnn = new SQLiteConnection("Data Source=test.db3;Pooling=True");
    61         -        //cnn.Open();
    62         -        //cnn.BeginTransaction();
    63         -
    64     25           TestCases.Run(fact, cnn);
    65     26         }
    66     27   
    67     28         Console.ReadKey();
    68     29       }
    69     30   
    70     31       static void cnn_RollBack(object sender, EventArgs e)

Changes to test/test.csproj.

     1         -<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
            1  +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
     2      2     <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
     3      3       <OutputPath>..\bin\x64\</OutputPath>
     4      4       <Optimize>true</Optimize>
     5      5       <FileAlignment>512</FileAlignment>
     6      6       <DebugType>
     7      7       </DebugType>
     8      8       <PlatformTarget>x64</PlatformTarget>
     9         -    <CodeAnalysisRuleAssemblies>C:\Program Files (x86)\Microsoft Visual Studio 8\Team Tools\Static Analysis Tools\FxCop\\rules</CodeAnalysisRuleAssemblies>
    10      9       <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
    11     10       <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
    12     11       <UseVSHostingProcess>false</UseVSHostingProcess>
    13     12       <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
    14     13     </PropertyGroup>
    15     14     <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
    16     15       <DebugSymbols>true</DebugSymbols>
    17     16       <OutputPath>..\bin\x64\</OutputPath>
    18     17       <DefineConstants>DEBUG;TRACE</DefineConstants>
    19     18       <DebugType>full</DebugType>
    20     19       <PlatformTarget>x64</PlatformTarget>
    21         -    <CodeAnalysisRuleAssemblies>C:\Program Files (x86)\Microsoft Visual Studio 8\Team Tools\Static Analysis Tools\FxCop\\rules</CodeAnalysisRuleAssemblies>
    22     20       <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
    23     21       <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
    24     22     </PropertyGroup>
    25     23     <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
    26     24       <OutputPath>..\bin\</OutputPath>
    27     25       <Optimize>true</Optimize>
    28     26       <FileAlignment>512</FileAlignment>
    29     27       <DebugType>
    30     28       </DebugType>
    31     29       <PlatformTarget>x86</PlatformTarget>
    32         -    <CodeAnalysisRuleAssemblies>C:\Program Files (x86)\Microsoft Visual Studio 8\Team Tools\Static Analysis Tools\FxCop\\rules</CodeAnalysisRuleAssemblies>
    33     30       <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
    34     31       <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
    35     32       <UseVSHostingProcess>false</UseVSHostingProcess>
    36     33       <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
    37     34     </PropertyGroup>
    38     35     <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|Itanium' ">
    39     36       <OutputPath>..\bin\Itanium\</OutputPath>
    40     37       <Optimize>true</Optimize>
    41     38       <FileAlignment>512</FileAlignment>
    42     39       <DebugType>
    43     40       </DebugType>
    44     41       <PlatformTarget>Itanium</PlatformTarget>
    45         -    <CodeAnalysisRuleAssemblies>C:\Program Files (x86)\Microsoft Visual Studio 8\Team Tools\Static Analysis Tools\FxCop\\rules</CodeAnalysisRuleAssemblies>
    46     42       <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
    47     43       <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
    48     44       <UseVSHostingProcess>false</UseVSHostingProcess>
    49     45       <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
    50     46     </PropertyGroup>
    51     47     <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|Itanium' ">
    52     48       <DebugSymbols>true</DebugSymbols>
    53     49       <OutputPath>..\bin\Itanium\</OutputPath>
    54     50       <DefineConstants>DEBUG;TRACE</DefineConstants>
    55     51       <DebugType>full</DebugType>
    56     52       <PlatformTarget>Itanium</PlatformTarget>
    57         -    <CodeAnalysisRuleAssemblies>C:\Program Files (x86)\Microsoft Visual Studio 8\Team Tools\Static Analysis Tools\FxCop\\rules</CodeAnalysisRuleAssemblies>
    58     53       <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
    59     54       <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
    60     55     </PropertyGroup>
    61     56     <PropertyGroup>
    62     57       <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    63     58       <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    64     59       <ProductVersion>8.0.50727</ProductVersion>
................................................................................
    77     72       <UpdateInterval>7</UpdateInterval>
    78     73       <UpdateIntervalUnits>Days</UpdateIntervalUnits>
    79     74       <UpdatePeriodically>false</UpdatePeriodically>
    80     75       <UpdateRequired>false</UpdateRequired>
    81     76       <MapFileExtensions>false</MapFileExtensions>
    82     77       <ApplicationVersion>1.0.0.*</ApplicationVersion>
    83     78       <BootstrapperEnabled>true</BootstrapperEnabled>
           79  +    <FileUpgradeFlags>
           80  +    </FileUpgradeFlags>
           81  +    <OldToolsVersion>2.0</OldToolsVersion>
           82  +    <UpgradeBackupLocation>
           83  +    </UpgradeBackupLocation>
    84     84     </PropertyGroup>
    85     85     <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    86     86       <DebugSymbols>true</DebugSymbols>
    87     87       <DebugType>full</DebugType>
    88     88       <Optimize>false</Optimize>
    89     89       <OutputPath>..\bin\</OutputPath>
    90     90       <DefineConstants>DEBUG;TRACE</DefineConstants>
................................................................................
   103    103     </PropertyGroup>
   104    104     <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
   105    105       <DebugSymbols>true</DebugSymbols>
   106    106       <OutputPath>..\bin\</OutputPath>
   107    107       <DefineConstants>DEBUG;TRACE</DefineConstants>
   108    108       <DebugType>full</DebugType>
   109    109       <PlatformTarget>x86</PlatformTarget>
   110         -    <CodeAnalysisRuleAssemblies>C:\Program Files (x86)\Microsoft Visual Studio 8\Team Tools\Static Analysis Tools\FxCop\\rules</CodeAnalysisRuleAssemblies>
   111    110       <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
   112    111       <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
   113    112     </PropertyGroup>
   114    113     <ItemGroup>
   115    114       <Reference Include="System" />
   116    115       <Reference Include="System.Data" />
   117    116       <Reference Include="System.Data.SQLite, Version=1.0.30.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=x86">

Changes to testce/Form1.resx.

     1      1   <?xml version="1.0" encoding="utf-8"?>
     2      2   <root>
     3         -  <!-- 
            3  +	<!-- 
     4      4       Microsoft ResX Schema 
     5      5       
     6      6       Version 2.0
     7      7       
     8      8       The primary goals of this format is to allow a simple XML format 
     9      9       that is mostly human readable. The generation and parsing of the 
    10     10       various data types are done through the TypeConverter classes 
................................................................................
    55     55               : and then encoded with base64 encoding.
    56     56   
    57     57       mimetype: application/x-microsoft.net.object.bytearray.base64
    58     58       value   : The object must be serialized into a byte array 
    59     59               : using a System.ComponentModel.TypeConverter
    60     60               : and then encoded with base64 encoding.
    61     61       -->
    62         -  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    63         -    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
    64         -    <xsd:element name="root" msdata:IsDataSet="true">
    65         -      <xsd:complexType>
    66         -        <xsd:choice maxOccurs="unbounded">
    67         -          <xsd:element name="metadata">
    68         -            <xsd:complexType>
    69         -              <xsd:sequence>
    70         -                <xsd:element name="value" type="xsd:string" minOccurs="0" />
    71         -              </xsd:sequence>
    72         -              <xsd:attribute name="name" use="required" type="xsd:string" />
    73         -              <xsd:attribute name="type" type="xsd:string" />
    74         -              <xsd:attribute name="mimetype" type="xsd:string" />
    75         -              <xsd:attribute ref="xml:space" />
    76         -            </xsd:complexType>
    77         -          </xsd:element>
    78         -          <xsd:element name="assembly">
    79         -            <xsd:complexType>
    80         -              <xsd:attribute name="alias" type="xsd:string" />
    81         -              <xsd:attribute name="name" type="xsd:string" />
    82         -            </xsd:complexType>
    83         -          </xsd:element>
    84         -          <xsd:element name="data">
    85         -            <xsd:complexType>
    86         -              <xsd:sequence>
    87         -                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
    88         -                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
    89         -              </xsd:sequence>
    90         -              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
    91         -              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
    92         -              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
    93         -              <xsd:attribute ref="xml:space" />
    94         -            </xsd:complexType>
    95         -          </xsd:element>
    96         -          <xsd:element name="resheader">
    97         -            <xsd:complexType>
    98         -              <xsd:sequence>
    99         -                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
   100         -              </xsd:sequence>
   101         -              <xsd:attribute name="name" type="xsd:string" use="required" />
   102         -            </xsd:complexType>
   103         -          </xsd:element>
   104         -        </xsd:choice>
   105         -      </xsd:complexType>
   106         -    </xsd:element>
   107         -  </xsd:schema>
   108         -  <resheader name="resmimetype">
   109         -    <value>text/microsoft-resx</value>
   110         -  </resheader>
   111         -  <resheader name="version">
   112         -    <value>2.0</value>
   113         -  </resheader>
   114         -  <resheader name="reader">
   115         -    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   116         -  </resheader>
   117         -  <resheader name="writer">
   118         -    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   119         -  </resheader>
   120         -  <metadata name="mainMenu1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
   121         -    <value>17, 17</value>
   122         -  </metadata>
   123         -  <metadata name="$this.FormFactorShadowProperty" xml:space="preserve">
           62  +	<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
           63  +		<xsd:import namespace="http://www.w3.org/XML/1998/namespace"/>
           64  +		<xsd:element name="root" msdata:IsDataSet="true">
           65  +			<xsd:complexType>
           66  +				<xsd:choice maxOccurs="unbounded">
           67  +					<xsd:element name="metadata">
           68  +						<xsd:complexType>
           69  +							<xsd:sequence>
           70  +								<xsd:element name="value" type="xsd:string" minOccurs="0"/>
           71  +							</xsd:sequence>
           72  +							<xsd:attribute name="name" use="required" type="xsd:string"/>
           73  +							<xsd:attribute name="type" type="xsd:string"/>
           74  +							<xsd:attribute name="mimetype" type="xsd:string"/>
           75  +							<xsd:attribute ref="xml:space"/>
           76  +						</xsd:complexType>
           77  +					</xsd:element>
           78  +					<xsd:element name="assembly">
           79  +						<xsd:complexType>
           80  +							<xsd:attribute name="alias" type="xsd:string"/>
           81  +							<xsd:attribute name="name" type="xsd:string"/>
           82  +						</xsd:complexType>
           83  +					</xsd:element>
           84  +					<xsd:element name="data">
           85  +						<xsd:complexType>
           86  +							<xsd:sequence>
           87  +								<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1"/>
           88  +								<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2"/>
           89  +							</xsd:sequence>
           90  +							<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1"/>
           91  +							<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3"/>
           92  +							<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4"/>
           93  +							<xsd:attribute ref="xml:space"/>
           94  +						</xsd:complexType>
           95  +					</xsd:element>
           96  +					<xsd:element name="resheader">
           97  +						<xsd:complexType>
           98  +							<xsd:sequence>
           99  +								<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1"/>
          100  +							</xsd:sequence>
          101  +							<xsd:attribute name="name" type="xsd:string" use="required"/>
          102  +						</xsd:complexType>
          103  +					</xsd:element>
          104  +				</xsd:choice>
          105  +			</xsd:complexType>
          106  +		</xsd:element>
          107  +	</xsd:schema>
          108  +	<metadata name="mainMenu1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
          109  +		<value>17, 17</value>
          110  +	</metadata>
          111  +	<metadata name="$this.FormFactorShadowProperty" xml:space="preserve">
   124    112       <value>POCKET_PC_2003_PORTRAIT</value>
   125    113     </metadata>
   126         -  <metadata name="$this.Skin" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
   127         -    <value>True</value>
   128         -  </metadata>
   129         -</root>
          114  +	<metadata name="$this.Skin" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
          115  +		<value>True</value>
          116  +	</metadata>
          117  +	<resheader name="resmimetype"><value>text/microsoft-resx</value></resheader><resheader name="version"><value>2.0</value></resheader><resheader name="reader"><value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader><resheader name="writer"><value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader></root>

Changes to testce/Program.cs.

    20     20         try
    21     21         {
    22     22           System.IO.File.Delete("test.db3");
    23     23         }
    24     24         catch
    25     25         {
    26     26         }
           27  +
           28  +      //SQLiteConnection sqlite_con = new SQLiteConnection(@"data source=""|DataDirectory|donnees.db""");
           29  +
           30  +      //SQLiteDataAdapter sqlite_da = new SQLiteDataAdapter();
           31  +      //DataSet dataSet = new DataSet();
           32  +
           33  +      //sqlite_da.SelectCommand = new SQLiteCommand("select * from donnees", sqlite_con);
           34  +
           35  +
           36  +
           37  +      //sqlite_con.Open();
           38  +
           39  +      //sqlite_da.Fill(dataSet);
           40  +
           41  +      //sqlite_con.Close();
    27     42   
    28     43         using (cnn = new SQLiteConnection())
    29     44         {
    30     45           TestCases tests = new TestCases();
    31     46   
    32     47           cnn.ConnectionString = "Data Source=test.db3;Password=yVXL39etehPX";
    33     48           cnn.Open();

Changes to testce/TestCases.cs.

   292    292         }
   293    293       }
   294    294   
   295    295       internal static void FullTextTest(DbConnection cnn)
   296    296       {
   297    297         using (DbCommand cmd = cnn.CreateCommand())
   298    298         {
   299         -        cmd.CommandText = "CREATE VIRTUAL TABLE FullText USING FTS1(name, ingredients);";
          299  +        cmd.CommandText = "CREATE VIRTUAL TABLE FullText USING FTS3(name, ingredients);";
   300    300           cmd.ExecuteNonQuery();
   301    301   
   302    302           string[] names = { "broccoli stew", "pumpkin stew", "broccoli pie", "pumpkin pie" };
   303    303           string[] ingredients = { "broccoli peppers cheese tomatoes", "pumpkin onions garlic celery", "broccoli cheese onions flour", "pumpkin sugar flour butter" };
   304    304           int n;
   305    305   
   306    306           cmd.CommandText = "insert into FullText (name, ingredients) values (@name, @ingredient);";

Changes to testce/testce.csproj.

     1         -<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
            1  +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
     2      2     <PropertyGroup>
     3      3       <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
     4      4       <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
     5      5       <ProductVersion>8.0.50727</ProductVersion>
     6      6       <SchemaVersion>2.0</SchemaVersion>
     7      7       <ProjectGuid>{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}</ProjectGuid>
     8      8       <OutputType>WinExe</OutputType>
................................................................................
    16     16       <DeployDirSuffix>testce</DeployDirSuffix>
    17     17       <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
    18     18       <FormFactorID>
    19     19       </FormFactorID>
    20     20       <StartupObject>
    21     21       </StartupObject>
    22     22       <DeployDirPrefix>%25CSIDL_PROGRAM_FILES%25</DeployDirPrefix>
           23  +    <FileUpgradeFlags>
           24  +    </FileUpgradeFlags>
           25  +    <OldToolsVersion>2.0</OldToolsVersion>
           26  +    <NativePlatformName>Pocket PC 2003</NativePlatformName>
           27  +    <UpgradeBackupLocation>
           28  +    </UpgradeBackupLocation>
    23     29     </PropertyGroup>
    24     30     <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    25     31       <DebugSymbols>true</DebugSymbols>
    26     32       <DebugType>full</DebugType>
    27     33       <Optimize>false</Optimize>
    28     34       <OutputPath>..\bin\CompactFramework\</OutputPath>
    29     35       <DefineConstants>TRACE;DEBUG;PocketPC</DefineConstants>
................................................................................
    51     57       <Reference Include="mscorlib" />
    52     58       <Reference Include="System">
    53     59         <Private>False</Private>
    54     60       </Reference>
    55     61       <Reference Include="System.Data">
    56     62         <Private>False</Private>
    57     63       </Reference>
    58         -    <Reference Include="System.Data.SQLite, Version=1.0.47.0, Culture=neutral, PublicKeyToken=1fdb50b1b62b4c84, processorArchitecture=x86" />
           64  +    <Reference Include="System.Data.SQLite, Version=1.0.47.0, Culture=neutral, PublicKeyToken=1fdb50b1b62b4c84, processorArchitecture=x86">
           65  +      <SpecificVersion>False</SpecificVersion>
           66  +    </Reference>
    59     67       <Reference Include="System.Drawing">
    60     68         <Private>False</Private>
    61     69       </Reference>
    62     70       <Reference Include="System.Windows.Forms">
    63     71         <Private>False</Private>
    64     72       </Reference>
    65     73       <Reference Include="System.Xml">
................................................................................
    92    100     <ProjectExtensions>
    93    101       <VisualStudio>
    94    102         <FlavorProperties GUID="{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}">
    95    103           <HostingProcess disable="1" />
    96    104         </FlavorProperties>
    97    105       </VisualStudio>
    98    106     </ProjectExtensions>
          107  +  <Import Condition="'$(TargetFrameworkVersion)' == 'v3.5'" Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" />
    99    108   </Project>

Changes to tools/install/Properties/Resources.Designer.cs.

     1      1   //------------------------------------------------------------------------------
     2      2   // <auto-generated>
     3      3   //     This code was generated by a tool.
     4         -//     Runtime Version:2.0.50727.42
            4  +//     Runtime Version:2.0.50727.1433
     5      5   //
     6      6   //     Changes to this file may cause incorrect behavior and will be lost if
     7      7   //     the code is regenerated.
     8      8   // </auto-generated>
     9      9   //------------------------------------------------------------------------------
    10     10   
    11     11   namespace install.Properties {

Changes to tools/install/Properties/Settings.Designer.cs.

     1      1   //------------------------------------------------------------------------------
     2      2   // <auto-generated>
     3      3   //     This code was generated by a tool.
     4         -//     Runtime Version:2.0.50727.42
            4  +//     Runtime Version:2.0.50727.1433
     5      5   //
     6      6   //     Changes to this file may cause incorrect behavior and will be lost if
     7      7   //     the code is regenerated.
     8      8   // </auto-generated>
     9      9   //------------------------------------------------------------------------------
    10     10   
    11     11   namespace install.Properties {
    12     12       
    13     13       
    14     14       [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    15         -    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.0.0.0")]
           15  +    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")]
    16     16       internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
    17     17           
    18     18           private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
    19     19           
    20     20           public static Settings Default {
    21     21               get {
    22     22                   return defaultInstance;
    23     23               }
    24     24           }
    25     25       }
    26     26   }

Changes to tools/install/Resources/System.Data.SQLite.dll.

cannot compute difference between binary files

Changes to tools/install/install.csproj.

     1         -<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
            1  +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
     2      2     <PropertyGroup>
     3      3       <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
     4      4       <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
     5         -    <ProductVersion>8.0.50727</ProductVersion>
            5  +    <ProductVersion>9.0.21022</ProductVersion>
     6      6       <SchemaVersion>2.0</SchemaVersion>
     7      7       <ProjectGuid>{71EED886-B5BF-488E-A4AA-1403E393D224}</ProjectGuid>
     8