System.Data.SQLite

Check-in [5a232b012b]
Login

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

Overview
Comment:1.0.45.0
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | sourceforge
Files: files | file ages | folders
SHA1: 5a232b012b026da4a07c167e0311044259ece1c3
User & Date: rmsimpson 2007-09-25 22:45:01.000
Context
2007-09-25
22:46
Fixed section size calculations check-in: 685c65f2d6 user: rmsimpson tags: sourceforge
22:45
1.0.45.0 check-in: 5a232b012b user: rmsimpson tags: sourceforge
2007-07-21
08:46
1.0.44.0 check-in: e2beba4862 user: rmsimpson tags: sourceforge
Changes
Unified Diff Ignore Whitespace Patch
Changes to Doc/Extra/dbfactorysupport.html.
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<configuration>
  <system.data>
    <DbProviderFactories>
      <remove invariant="System.Data.SQLite"/>
      <add name="SQLite Data Provider" invariant="System.Data.SQLite" 
           description=".Net Framework Data Provider for SQLite"
           type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite,
                 Version=1.0.44.0, Culture=neutral,
                 PublicKeyToken=db937bc2d44ff139"/>
    </DbProviderFactories>
  </system.data>
</configuration>
</pre>
      </div>
      <p>







|







93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
&lt;configuration&gt;
  &lt;system.data&gt;
    &lt;DbProviderFactories&gt;
      &lt;remove invariant="System.Data.SQLite"/&gt;
      &lt;add name="SQLite Data Provider" invariant="System.Data.SQLite" 
           description=".Net Framework Data Provider for SQLite"
           type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite,
                 Version=1.0.45.0, Culture=neutral,
                 PublicKeyToken=db937bc2d44ff139"/&gt;
    &lt;/DbProviderFactories&gt;
  &lt;/system.data&gt;
&lt;/configuration&gt;
</pre>
      </div>
      <p>
Changes to Doc/Extra/lang_reindex.html.
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
    <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" />
    <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" />
    <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" />
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            REINDEX&nbsp;</td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite Language Reference Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">







|







17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
    <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" />
    <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" />
    <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" />
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">REINDEX</span>&nbsp;</td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite Language Reference Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">
Changes to Doc/Extra/lang_replace.html.
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
    <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" />
    <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" />
    <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" />
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            REPLACE&nbsp;</td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite Language Reference Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">







|







17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
    <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" />
    <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" />
    <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" />
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">REPLACE</span>&nbsp;</td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite Language Reference Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">
Changes to Doc/Extra/lang_select.html.
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
    <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" />
    <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" />
    <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" />
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            SELECT&nbsp;</td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite Language Reference Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">







|







17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
    <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" />
    <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" />
    <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" />
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">SELECT</span>&nbsp;</td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite Language Reference Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">
Changes to Doc/Extra/lang_types.html.
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
    <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" />
    <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" />
    <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" />
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            TYPES&nbsp;</td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite Language Reference Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">







|







17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
    <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" />
    <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" />
    <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" />
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">TYPES</span>&nbsp;</td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite Language Reference Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">
Changes to Doc/Extra/lang_update.html.
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
    <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" />
    <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" />
    <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" />
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            UPDATE&nbsp;</td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite Language Reference Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">







|







17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
    <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" />
    <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" />
    <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" />
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">UPDATE</span>&nbsp;</td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite Language Reference Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">
Changes to Doc/Extra/lang_vacuum.html.
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
    <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" />
    <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" />
    <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" />
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            TYPES&nbsp;</td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite Language Reference Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">







|







17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
    <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" />
    <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" />
    <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" />
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">VACUUM</span>&nbsp;</td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite Language Reference Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">
      <h1 class="heading">
        SQL As Understood By SQLite</h1>
      <h4>
        TYPES</h4>
      <p>
        <table cellpadding="10">
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">sql-statement</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0">TYPES </font></b>[<b><font color="#2c2cf0"></font></b><i><font
                color="#ff3434">datatype name</font></i><b><font color="#2c2cf0"></font></b>][,<b><font color="#2c2cf0"></font></b><i><font
                color="#ff3434">datatype name</font></i><b><font color="#2c2cf0"></font></b>][,<b><font color="#2c2cf0"></font></b><i><font
                color="#ff3434">datatype
                      name</font></i><b><font color="#2c2cf0"></font></b>][,<b><font color="#2c2cf0"></font></b><i><font
                color="#ff3434">...</font></i>] ; <em><span style="color: #ff3434">select stmt</span></em></td>
          </tr>
        </table>
      </p>
      <p>
        The VACUUM command is an SQLite extension modeled after a similar command found
        in PostgreSQL. If VACUUM is invoked with the name of a table or index then it is
        suppose to clean up the named table or index. In version 1.0 of SQLite, the VACUUM







|






|
<
<
|
<
<







52
53
54
55
56
57
58
59
60
61
62
63
64
65
66


67


68
69
70
71
72
73
74
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">
      <h1 class="heading">
        SQL As Understood By SQLite</h1>
      <h4>
        VACUUM</h4>
      <p>
        <table cellpadding="10">
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">sql-statement</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0">VACUUM </font></b>[<b><font color="#2c2cf0"></font></b><i><font


                color="#ff3434">index-or-tablename</font></i>]</td>


          </tr>
        </table>
      </p>
      <p>
        The VACUUM command is an SQLite extension modeled after a similar command found
        in PostgreSQL. If VACUUM is invoked with the name of a table or index then it is
        suppose to clean up the named table or index. In version 1.0 of SQLite, the VACUUM
Changes to Doc/Extra/syntax.html.
192
193
194
195
196
197
198





199
200
201
202
203
204
205
              ROLLBACK TRANSACTION</a></td>
          </tr>
          <tr>
            <td>
              <a href="lang_select.html">
              SELECT</a></td>
          </tr>





          <tr>
            <td>
              <a href="lang_update.html">
              UPDATE</a></td>
          </tr>
          <tr>
            <td>







>
>
>
>
>







192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
              ROLLBACK TRANSACTION</a></td>
          </tr>
          <tr>
            <td>
              <a href="lang_select.html">
              SELECT</a></td>
          </tr>
          <tr>
            <td>
              <a href="lang_types.html">
              TYPES</a></td>
          </tr>
          <tr>
            <td>
              <a href="lang_update.html">
              UPDATE</a></td>
          </tr>
          <tr>
            <td>
Changes to Doc/Extra/version.html.
52
53
54
55
56
57
58































59
60
61
62
63
64
65
66
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">

      <h1 class="heading">Version History</h1>































    <p><b>1.0.44.0 - July 22, 2007</b></p>
    <ul>
    <li>Code merge with SQLite 3.4.1</li>
      <li>Fixed a bug in SQLiteConnection.Open() which threw the wrong kind of error in
        the wrong kind of way when a database file could not be opened or created.&nbsp;</li>
      <li>Small enhancements to the TYPES keyword, and added documentation for it in the
        help file.</li>
      <li>Hopefully fixed the occasional SQLITE_BUSY errors that cropped up when starting







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|







52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">

      <h1 class="heading">Version History</h1>
    <p><b>1.0.45.0 - September 25, 2007</b></p>
    <ul>
    <li><strong>Breaking change in GetSchema("Indexes") </strong>-- MetaDataCollections
      restrictions and identifier parts counts were wrong for this schema and I was using
      the wrong final parameter as the final restriction.&nbsp; Meaning, if you use the
      Indexes schema and are querying for a specific index the array should now be {catalog,
      null, table, index } instead of {catalog, null, table, null, index}</li>
      <li>Fixed some errors in the encryption module, most notably when a non-default page
        size is specified in the connection string.</li>
      <li>Fixed SQLiteDataReader to better handle type-less usage scenarios, which also
        fixes problems with null values and datetimes.</li>
      <li>Fixed the leftover temp files problem on WinCE </li>
      <li>Added connection pooling.&nbsp; The default is disabled for now, but may change
      in the future.&nbsp; Set "Pooling=True" in the connection string to enable it. </li>
      <li>Sped up SQLiteConnection.Open() considerably.</li>
      <li>Added some more robust cleanup code regarding SQLiteFunctions.</li>
      <li>Minor additions to the code to allow for future LINQ integration into the main
        codebase.</li>
      <li>Fixed a long-standing bug in the Open() command of SQLiteConnection which failed
      to honor the documented default behavior of the SQLite.NET provider to open the
      database in "Synchronous=Normal" mode.&nbsp; The default was "Full". </li>
      <li>If Open() fails, it no longer sets the connection state to Broken.&nbsp; It instead
        reverts back to Closed, and cleans up after itself.</li>
      <li>Added several new parameters to the ConnectionString for setting max page count,
        legacy file format, and another called FailIfMissing to raise an error rather than
        create the database file automatically if it does not already exist.</li>
      <li>Fixed some designer toolbox references to the wrong version of the SQLite.Designer</li>
      <li>Fixed a bug in the mergebin utility with regards to COR20 metadata rowsize computations.&nbsp;
      </li>
      <li>Minor documentation corrections &nbsp;&nbsp;</li>
    </ul>
    <p><b>1.0.44.0 - July 21, 2007</b></p>
    <ul>
    <li>Code merge with SQLite 3.4.1</li>
      <li>Fixed a bug in SQLiteConnection.Open() which threw the wrong kind of error in
        the wrong kind of way when a database file could not be opened or created.&nbsp;</li>
      <li>Small enhancements to the TYPES keyword, and added documentation for it in the
        help file.</li>
      <li>Hopefully fixed the occasional SQLITE_BUSY errors that cropped up when starting
Changes to Doc/SQLite.NET.chm.

cannot compute difference between binary files

Changes to SQLite.Interop/FTS1/FTS1.vcproj.
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
		</Configuration>
		<Configuration
			Name="Release|Pocket PC 2003 (ARMV4)"
			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
			ConfigurationType="4"
			CharacterSet="2"
			WholeProgramOptimization="0"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
				TargetEnvironment="1"
			/>
			<Tool
				Name="VCCLCompilerTool"
				ExecutionBucket="7"
				FavorSizeOrSpeed="1"
				AdditionalIncludeDirectories="..\src"
				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;SQLITE_ENABLE_FTS1;SQLITE_CORE"
				StringPooling="true"
				ExceptionHandling="0"
				BufferSecurityCheck="false"
				EnableFunctionLevelLinking="true"
				RuntimeTypeInfo="false"
				UsePrecompiledHeader="0"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool







|




















<





<







341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368

369
370
371
372
373

374
375
376
377
378
379
380
		</Configuration>
		<Configuration
			Name="Release|Pocket PC 2003 (ARMV4)"
			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
			ConfigurationType="4"
			CharacterSet="2"
			WholeProgramOptimization="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
				TargetEnvironment="1"
			/>
			<Tool
				Name="VCCLCompilerTool"
				ExecutionBucket="7"

				AdditionalIncludeDirectories="..\src"
				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;SQLITE_ENABLE_FTS1;SQLITE_CORE"
				StringPooling="true"
				ExceptionHandling="0"
				BufferSecurityCheck="false"

				RuntimeTypeInfo="false"
				UsePrecompiledHeader="0"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
Changes to SQLite.Interop/FTS2/FTS2.vcproj.
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
		</Configuration>
		<Configuration
			Name="Release|Pocket PC 2003 (ARMV4)"
			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
			ConfigurationType="4"
			CharacterSet="2"
			WholeProgramOptimization="0"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
				TargetEnvironment="1"
			/>
			<Tool
				Name="VCCLCompilerTool"
				ExecutionBucket="7"
				Optimization="1"
				AdditionalIncludeDirectories="..\src"
				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;SQLITE_ENABLE_FTS2;SQLITE_CORE"
				StringPooling="true"
				ExceptionHandling="0"
				BufferSecurityCheck="false"
				EnableFunctionLevelLinking="true"
				RuntimeTypeInfo="false"
				UsePrecompiledHeader="0"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool







|




















<





<







341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368

369
370
371
372
373

374
375
376
377
378
379
380
		</Configuration>
		<Configuration
			Name="Release|Pocket PC 2003 (ARMV4)"
			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
			ConfigurationType="4"
			CharacterSet="2"
			WholeProgramOptimization="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
				TargetEnvironment="1"
			/>
			<Tool
				Name="VCCLCompilerTool"
				ExecutionBucket="7"

				AdditionalIncludeDirectories="..\src"
				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;SQLITE_ENABLE_FTS2;SQLITE_CORE"
				StringPooling="true"
				ExceptionHandling="0"
				BufferSecurityCheck="false"

				RuntimeTypeInfo="false"
				UsePrecompiledHeader="0"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
Changes to SQLite.Interop/SQLite.Interop.rc.
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81

/////////////////////////////////////////////////////////////////////////////
//
// Version
//

VS_VERSION_INFO VERSIONINFO
 FILEVERSION 1,0,44,0
 PRODUCTVERSION 1,0,0,0
 FILEFLAGSMASK 0x17L
#ifdef _DEBUG
 FILEFLAGS 0x1L
#else
 FILEFLAGS 0x0L
#endif
 FILEOS 0x4L
 FILETYPE 0x2L
 FILESUBTYPE 0x0L
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "040904b0"
        BEGIN
            VALUE "Comments", "http://sqlite.phxsoftware.com"
            VALUE "FileDescription", "System.Data.SQLite Interop Library"
            VALUE "FileVersion", "1.0.44.0"
            VALUE "InternalName", "SQLite.Interop.DLL"
            VALUE "LegalCopyright", "Released to the public domain"
            VALUE "OriginalFilename", "SQLite3.DLL 3.4.1"
            VALUE "ProductName", "System.Data.SQLite"
            VALUE "ProductVersion", "1.0"
        END
    END







|

















|







49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81

/////////////////////////////////////////////////////////////////////////////
//
// Version
//

VS_VERSION_INFO VERSIONINFO
 FILEVERSION 1,0,45,0
 PRODUCTVERSION 1,0,0,0
 FILEFLAGSMASK 0x17L
#ifdef _DEBUG
 FILEFLAGS 0x1L
#else
 FILEFLAGS 0x0L
#endif
 FILEOS 0x4L
 FILETYPE 0x2L
 FILESUBTYPE 0x0L
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "040904b0"
        BEGIN
            VALUE "Comments", "http://sqlite.phxsoftware.com"
            VALUE "FileDescription", "System.Data.SQLite Interop Library"
            VALUE "FileVersion", "1.0.45.0"
            VALUE "InternalName", "SQLite.Interop.DLL"
            VALUE "LegalCopyright", "Released to the public domain"
            VALUE "OriginalFilename", "SQLite3.DLL 3.4.1"
            VALUE "ProductName", "System.Data.SQLite"
            VALUE "ProductVersion", "1.0"
        END
    END
Changes to SQLite.Interop/SQLite.Interop.vcproj.
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
				Name="VCCLCompilerTool"
				AdditionalOptions="/GS-"
				Optimization="2"
				FavorSizeOrSpeed="1"
				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;NO_TCL;THREADSAFE=1;SQLITE_HAS_CODEC;SQLITE_ENABLE_COLUMN_METADATA;SQLITE_ENABLE_FTS1;SQLITE_ENABLE_FTS2;SQLITE_OMIT_TRACE"
				StringPooling="true"
				ExceptionHandling="0"
				BufferSecurityCheck="false"
				EnableFunctionLevelLinking="true"
				RuntimeTypeInfo="false"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
			/>







<
<
<







53
54
55
56
57
58
59



60
61
62
63
64
65
66
				Name="VCCLCompilerTool"
				AdditionalOptions="/GS-"
				Optimization="2"
				FavorSizeOrSpeed="1"
				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;NO_TCL;THREADSAFE=1;SQLITE_HAS_CODEC;SQLITE_ENABLE_COLUMN_METADATA;SQLITE_ENABLE_FTS1;SQLITE_ENABLE_FTS2;SQLITE_OMIT_TRACE"
				StringPooling="true"
				ExceptionHandling="0"



			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
			/>
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
		</Configuration>
		<Configuration
			Name="Release|Pocket PC 2003 (ARMV4)"
			OutputDirectory="Pocket PC 2003 (ARMV4)\$(ConfigurationName)"
			IntermediateDirectory="Pocket PC 2003 (ARMV4)\$(ConfigurationName)"
			ConfigurationType="2"
			CharacterSet="1"
			WholeProgramOptimization="0"
			>
			<Tool
				Name="VCPreBuildEventTool"
				CommandLine=""
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				ExecutionBucket="7"
				Optimization="1"
				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_FTS2;SQLITE_OMIT_TRACE"
				StringPooling="true"
				ExceptionHandling="0"
				BufferSecurityCheck="false"
				EnableFunctionLevelLinking="true"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
				PreprocessorDefinitions="NDEBUG;_UNICODE;UNICODE;_WIN32_WCE;UNDER_CE"







|




















<




<







111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138

139
140
141
142

143
144
145
146
147
148
149
		</Configuration>
		<Configuration
			Name="Release|Pocket PC 2003 (ARMV4)"
			OutputDirectory="Pocket PC 2003 (ARMV4)\$(ConfigurationName)"
			IntermediateDirectory="Pocket PC 2003 (ARMV4)\$(ConfigurationName)"
			ConfigurationType="2"
			CharacterSet="1"
			WholeProgramOptimization="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
				CommandLine=""
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				ExecutionBucket="7"

				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_FTS2;SQLITE_OMIT_TRACE"
				StringPooling="true"
				ExceptionHandling="0"
				BufferSecurityCheck="false"

			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
				PreprocessorDefinitions="NDEBUG;_UNICODE;UNICODE;_WIN32_WCE;UNDER_CE"
Changes to SQLite.Interop/crypt.c.
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
  if (pBlock->pvCrypt)
  {
    sqliteFree(pBlock->pvCrypt);
    pBlock->pvCrypt = NULL;
  }

  // Figure out how big to make our spare crypt block
  if (CryptEncrypt(hKey, 0, TRUE, 0, NULL, &pBlock->dwCryptSize, pBlock->dwCryptSize * 2))
  {
    pBlock->pvCrypt = sqliteMalloc(pBlock->dwCryptSize + (CRYPT_OFFSET * 2));
  }
  return pBlock;
}

// Destroy a cryptographic context and any buffers and keys allocated therein
static void DestroyCryptBlock(LPCRYPTBLOCK pBlock)
{
  // Destroy the read key if there is one







|
<
|
|







70
71
72
73
74
75
76
77

78
79
80
81
82
83
84
85
86
  if (pBlock->pvCrypt)
  {
    sqliteFree(pBlock->pvCrypt);
    pBlock->pvCrypt = NULL;
  }

  // Figure out how big to make our spare crypt block
  CryptEncrypt(hKey, 0, TRUE, 0, NULL, &pBlock->dwCryptSize, pBlock->dwCryptSize * 2);

  pBlock->pvCrypt = sqliteMalloc(pBlock->dwCryptSize + (CRYPT_OFFSET * 2));

  return pBlock;
}

// Destroy a cryptographic context and any buffers and keys allocated therein
static void DestroyCryptBlock(LPCRYPTBLOCK pBlock)
{
  // Destroy the read key if there is one
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
    We only use the special block of memory if its absolutely necessary. */
    if (pBlock->dwCryptSize != pBlock->dwPageSize)
    {
      CopyMemory(((LPBYTE)pBlock->pvCrypt) + CRYPT_OFFSET, data, pBlock->dwPageSize);
      pvTemp = data;
      data = ((LPBYTE)pBlock->pvCrypt) + CRYPT_OFFSET;
    }


    dwPageSize = pBlock->dwCryptSize;
    CryptDecrypt(pBlock->hReadKey, 0, TRUE, 0, (LPBYTE)data, &dwPageSize);

    // If the encryption algorithm required extra padding and we were forced to encrypt or
    // decrypt a copy of the page data to a temp buffer, then write the contents of the temp
    // buffer back to the page data minus any padding applied.







<







142
143
144
145
146
147
148

149
150
151
152
153
154
155
    We only use the special block of memory if its absolutely necessary. */
    if (pBlock->dwCryptSize != pBlock->dwPageSize)
    {
      CopyMemory(((LPBYTE)pBlock->pvCrypt) + CRYPT_OFFSET, data, pBlock->dwPageSize);
      pvTemp = data;
      data = ((LPBYTE)pBlock->pvCrypt) + CRYPT_OFFSET;
    }


    dwPageSize = pBlock->dwCryptSize;
    CryptDecrypt(pBlock->hReadKey, 0, TRUE, 0, (LPBYTE)data, &dwPageSize);

    // If the encryption algorithm required extra padding and we were forced to encrypt or
    // decrypt a copy of the page data to a temp buffer, then write the contents of the temp
    // buffer back to the page data minus any padding applied.
Changes to SQLite.Interop/interop.c.
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#endif // NDEBUG

#ifdef OS_WIN

#include <tchar.h>

// Additional flag for sqlite3.flags, we use it as a reference counter
#define SQLITE_WantClose 0x01000000

typedef void (WINAPI *SQLITEUSERFUNC)(void *, int, void **);
typedef int  (WINAPI *SQLITECOLLATION)(int, const void *, int, const void*);

typedef void (WINAPI *SQLITEUPDATEHOOK)(int, const char *, int, const char *, int, sqlite_int64);
typedef int  (WINAPI *SQLITECOMMITHOOK)();
typedef void (WINAPI *SQLITEROLLBACKHOOK)();







|







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#endif // NDEBUG

#ifdef OS_WIN

#include <tchar.h>

// Additional flag for sqlite3.flags, we use it as a reference counter
#define SQLITE_WantClose 0x10000000

typedef void (WINAPI *SQLITEUSERFUNC)(void *, int, void **);
typedef int  (WINAPI *SQLITECOLLATION)(int, const void *, int, const void*);

typedef void (WINAPI *SQLITEUPDATEHOOK)(int, const char *, int, const char *, int, sqlite_int64);
typedef int  (WINAPI *SQLITECOMMITHOOK)();
typedef void (WINAPI *SQLITEROLLBACKHOOK)();
193
194
195
196
197
198
199





200
201
202
203
204
205
206
      db->flags |= SQLITE_WantClose;
      ret = 0;
    }
  }

  return ret;
}






__declspec(dllexport) int WINAPI sqlite3_exec_interop(sqlite3 *db, const char *sql, sqlite3_callback cb, void *pv, char **errmsg, int *plen)
{ 
  int n;

  EnterDbMutex(db);
  n = sqlite3_exec(db, sql, cb, pv, errmsg);







>
>
>
>
>







193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
      db->flags |= SQLITE_WantClose;
      ret = 0;
    }
  }

  return ret;
}

// Returns the number of databases attached to this one
__declspec(dllexport) void WINAPI sqlite3_detach_all_interop(sqlite3 *db)
{
}

__declspec(dllexport) int WINAPI sqlite3_exec_interop(sqlite3 *db, const char *sql, sqlite3_callback cb, void *pv, char **errmsg, int *plen)
{ 
  int n;

  EnterDbMutex(db);
  n = sqlite3_exec(db, sql, cb, pv, errmsg);
Changes to SQLite.Interop/merge.h.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// This code was automatically generated from assembly
// C:\Src\SQLite.NET\System.Data.SQLite\bin\CompactFramework\System.Data.SQLite.dll

#include <windef.h>

#pragma data_seg(".clr")
#pragma comment(linker, "/SECTION:.clr,ER")
  char __ph[130872] = {0}; // The number of bytes to reserve
#pragma data_seg()

typedef BOOL (WINAPI *DLLMAIN)(HANDLE, DWORD, LPVOID);
typedef struct EXTRA_STUFF
{
  DWORD dwNativeEntryPoint;
} EXTRA_STUFF, *LPEXTRA_STUFF;







|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// This code was automatically generated from assembly
// C:\Src\SQLite.NET\System.Data.SQLite\bin\CompactFramework\System.Data.SQLite.dll

#include <windef.h>

#pragma data_seg(".clr")
#pragma comment(linker, "/SECTION:.clr,ER")
  char __ph[131836] = {0}; // The number of bytes to reserve
#pragma data_seg()

typedef BOOL (WINAPI *DLLMAIN)(HANDLE, DWORD, LPVOID);
typedef struct EXTRA_STUFF
{
  DWORD dwNativeEntryPoint;
} EXTRA_STUFF, *LPEXTRA_STUFF;
Changes to SQLite.Interop/merge_full.h.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// This code was automatically generated from assembly
// C:\Src\SQLite.NET\System.Data.SQLite\bin\System.Data.SQLite.dll

#include <windef.h>

#pragma data_seg(".clr")
#pragma comment(linker, "/SECTION:.clr,ER")
  char __ph[140088] = {0}; // The number of bytes to reserve
#pragma data_seg()

typedef BOOL (WINAPI *DLLMAIN)(HANDLE, DWORD, LPVOID);
typedef struct EXTRA_STUFF
{
  DWORD dwNativeEntryPoint;
} EXTRA_STUFF, *LPEXTRA_STUFF;







|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// This code was automatically generated from assembly
// C:\Src\SQLite.NET\System.Data.SQLite\bin\System.Data.SQLite.dll

#include <windef.h>

#pragma data_seg(".clr")
#pragma comment(linker, "/SECTION:.clr,ER")
  char __ph[142004] = {0}; // The number of bytes to reserve
#pragma data_seg()

typedef BOOL (WINAPI *DLLMAIN)(HANDLE, DWORD, LPVOID);
typedef struct EXTRA_STUFF
{
  DWORD dwNativeEntryPoint;
} EXTRA_STUFF, *LPEXTRA_STUFF;
Changes to System.Data.SQLite/AssemblyInfo.cs.
44
45
46
47
48
49
50
51
52
53
54
//      Major Version
//      Minor Version 
//      Build Number
//      Revision
//
// You can specify all the values or you can default the Revision and Build Numbers 
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.44.0")]
#if !PLATFORM_COMPACTFRAMEWORK
[assembly: AssemblyFileVersion("1.0.44.0")]
#endif







|

|

44
45
46
47
48
49
50
51
52
53
54
//      Major Version
//      Minor Version 
//      Build Number
//      Revision
//
// You can specify all the values or you can default the Revision and Build Numbers 
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.45.0")]
#if !PLATFORM_COMPACTFRAMEWORK
[assembly: AssemblyFileVersion("1.0.45.0")]
#endif
Changes to System.Data.SQLite/MetaDataCollections.xml.
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
  <MetaDataCollections>
    <CollectionName>Columns</CollectionName>
    <NumberOfRestrictions>4</NumberOfRestrictions>
    <NumberOfIdentifierParts>4</NumberOfIdentifierParts>
  </MetaDataCollections>
  <MetaDataCollections>
    <CollectionName>Indexes</CollectionName>
    <NumberOfRestrictions>5</NumberOfRestrictions>
    <NumberOfIdentifierParts>4</NumberOfIdentifierParts>
  </MetaDataCollections>
  <MetaDataCollections>
    <CollectionName>IndexColumns</CollectionName>
    <NumberOfRestrictions>5</NumberOfRestrictions>
    <NumberOfIdentifierParts>4</NumberOfIdentifierParts>
  </MetaDataCollections>
  <MetaDataCollections>







|
|







28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
  <MetaDataCollections>
    <CollectionName>Columns</CollectionName>
    <NumberOfRestrictions>4</NumberOfRestrictions>
    <NumberOfIdentifierParts>4</NumberOfIdentifierParts>
  </MetaDataCollections>
  <MetaDataCollections>
    <CollectionName>Indexes</CollectionName>
    <NumberOfRestrictions>4</NumberOfRestrictions>
    <NumberOfIdentifierParts>3</NumberOfIdentifierParts>
  </MetaDataCollections>
  <MetaDataCollections>
    <CollectionName>IndexColumns</CollectionName>
    <NumberOfRestrictions>5</NumberOfRestrictions>
    <NumberOfIdentifierParts>4</NumberOfIdentifierParts>
  </MetaDataCollections>
  <MetaDataCollections>
Changes to System.Data.SQLite/SQLite3.cs.
17
18
19
20
21
22
23


24
25
26
27
28
29
30
31
32
33
34
35
36

37
38
39




40
41
42




43

44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72











73
74
75
76
77
78
79


80
81
82
83
84
85
86
  /// </summary>
  internal class SQLite3 : SQLiteBase
  {
    /// <summary>
    /// The opaque pointer returned to us by the sqlite provider
    /// </summary>
    protected SQLiteConnectionHandle _sql;



    /// <summary>
    /// The user-defined functions registered on this connection
    /// </summary>
    protected SQLiteFunction[] _functionsArray;

    internal SQLite3(SQLiteDateFormats fmt)
      : base(fmt)
    {
    }

    protected override void Dispose(bool bDisposing)
    {

      Close();
    }





    internal override void Close()
    {
      if (_sql != null)




        _sql.Dispose();


      _sql = null;
    }

    internal override void Cancel()
    {
      UnsafeNativeMethods.sqlite3_interrupt_interop(_sql);
    }

    internal override string Version
    {
      get
      {
        int len;
        return ToString(UnsafeNativeMethods.sqlite3_libversion_interop(out len), len);
      }
    }

    internal override int Changes
    {
      get
      {
        return UnsafeNativeMethods.sqlite3_changes_interop(_sql);
      }
    }

    internal override void Open(string strFilename)
    {
      if (_sql != null) return;











      IntPtr db;

      int n = UnsafeNativeMethods.sqlite3_open_interop(ToUTF8(strFilename), out db);
      if (n > 0) throw new SQLiteException(n, null);

      _sql = db;



      _functionsArray = SQLiteFunction.BindFunctions(this);
    }

    internal override void SetTimeout(int nTimeoutMS)
    {
      int n = UnsafeNativeMethods.sqlite3_busy_timeout_interop(_sql, nTimeoutMS);
      if (n > 0) throw new SQLiteException(n, SQLiteLastError());







>
>













>
|


>
>
>
>



>
>
>
>
|
>














|











|


>
>
>
>
>
>
>
>
>
>
>
|

|
|

|
|
>
>







17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
  /// </summary>
  internal class SQLite3 : SQLiteBase
  {
    /// <summary>
    /// The opaque pointer returned to us by the sqlite provider
    /// </summary>
    protected SQLiteConnectionHandle _sql;
    protected string _fileName;
    protected bool _usePool;

    /// <summary>
    /// The user-defined functions registered on this connection
    /// </summary>
    protected SQLiteFunction[] _functionsArray;

    internal SQLite3(SQLiteDateFormats fmt)
      : base(fmt)
    {
    }

    protected override void Dispose(bool bDisposing)
    {
      if (bDisposing)
        Close();
    }

    // It isn't necessary to cleanup any functions we've registered.  If the connection
    // goes to the pool and is resurrected later, re-registered functions will overwrite the
    // previous functions.  The SQLiteFunctionCookieHandle will take care of freeing unmanaged
    // resources belonging to the previously-registered functions.
    internal override void Close()
    {
      if (_sql != null)
      {
        if (_usePool)
          SQLiteConnectionPool.Add(_fileName, _sql);
        else
          _sql.Dispose();
      }

      _sql = null;
    }

    internal override void Cancel()
    {
      UnsafeNativeMethods.sqlite3_interrupt_interop(_sql);
    }

    internal override string Version
    {
      get
      {
        int len;
        return UTF8ToString(UnsafeNativeMethods.sqlite3_libversion_interop(out len), len);
      }
    }

    internal override int Changes
    {
      get
      {
        return UnsafeNativeMethods.sqlite3_changes_interop(_sql);
      }
    }

    internal override void Open(string strFilename, bool usePool)
    {
      if (_sql != null) return;

      _usePool = usePool;
      if (usePool)
      {
        _fileName = strFilename;
        _sql = SQLiteConnectionPool.Remove(strFilename);
      }

      if (_sql == null)
      {
        System.Diagnostics.Debug.WriteLine("Creating a new connection");
        IntPtr db;

        int n = UnsafeNativeMethods.sqlite3_open_interop(ToUTF8(strFilename), out db);
        if (n > 0) throw new SQLiteException(n, null);

        _sql = db;
      }
      // Bind functions to this connection.  If any previous functions of the same name
      // were already bound, then the new bindings replace the old.
      _functionsArray = SQLiteFunction.BindFunctions(this);
    }

    internal override void SetTimeout(int nTimeoutMS)
    {
      int n = UnsafeNativeMethods.sqlite3_busy_timeout_interop(_sql, nTimeoutMS);
      if (n > 0) throw new SQLiteException(n, SQLiteLastError());
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
    {
      return UnsafeNativeMethods.sqlite3_bind_parameter_count_interop(stmt._sqlite_stmt);
    }

    internal override string Bind_ParamName(SQLiteStatement stmt, int index)
    {
      int len;
      return ToString(UnsafeNativeMethods.sqlite3_bind_parameter_name_interop(stmt._sqlite_stmt, index, out len), len);
    }

    internal override int Bind_ParamIndex(SQLiteStatement stmt, string paramName)
    {
      return UnsafeNativeMethods.sqlite3_bind_parameter_index_interop(stmt._sqlite_stmt, ToUTF8(paramName));
    }

    internal override int ColumnCount(SQLiteStatement stmt)
    {
      return UnsafeNativeMethods.sqlite3_column_count_interop(stmt._sqlite_stmt);
    }

    internal override string ColumnName(SQLiteStatement stmt, int index)
    {
      int len;
      return ToString(UnsafeNativeMethods.sqlite3_column_name_interop(stmt._sqlite_stmt, index, out len), len);
    }

    internal override TypeAffinity ColumnAffinity(SQLiteStatement stmt, int index)
    {
      return UnsafeNativeMethods.sqlite3_column_type_interop(stmt._sqlite_stmt, index);
    }

    internal override string ColumnType(SQLiteStatement stmt, int index, out TypeAffinity nAffinity)
    {
      int len;
      IntPtr p = UnsafeNativeMethods.sqlite3_column_decltype_interop(stmt._sqlite_stmt, index, out len);
      nAffinity = ColumnAffinity(stmt, index);

      if (p != IntPtr.Zero) return base.ToString(p, len);
      else
      {
        string[] ar = stmt.TypeDefinitions;
        if (ar != null)
        {
          if (index < ar.Length && ar[index] != null)
            return ar[index];







|















|













|







303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
    {
      return UnsafeNativeMethods.sqlite3_bind_parameter_count_interop(stmt._sqlite_stmt);
    }

    internal override string Bind_ParamName(SQLiteStatement stmt, int index)
    {
      int len;
      return UTF8ToString(UnsafeNativeMethods.sqlite3_bind_parameter_name_interop(stmt._sqlite_stmt, index, out len), len);
    }

    internal override int Bind_ParamIndex(SQLiteStatement stmt, string paramName)
    {
      return UnsafeNativeMethods.sqlite3_bind_parameter_index_interop(stmt._sqlite_stmt, ToUTF8(paramName));
    }

    internal override int ColumnCount(SQLiteStatement stmt)
    {
      return UnsafeNativeMethods.sqlite3_column_count_interop(stmt._sqlite_stmt);
    }

    internal override string ColumnName(SQLiteStatement stmt, int index)
    {
      int len;
      return UTF8ToString(UnsafeNativeMethods.sqlite3_column_name_interop(stmt._sqlite_stmt, index, out len), len);
    }

    internal override TypeAffinity ColumnAffinity(SQLiteStatement stmt, int index)
    {
      return UnsafeNativeMethods.sqlite3_column_type_interop(stmt._sqlite_stmt, index);
    }

    internal override string ColumnType(SQLiteStatement stmt, int index, out TypeAffinity nAffinity)
    {
      int len;
      IntPtr p = UnsafeNativeMethods.sqlite3_column_decltype_interop(stmt._sqlite_stmt, index, out len);
      nAffinity = ColumnAffinity(stmt, index);

      if (p != IntPtr.Zero) return UTF8ToString(p, len);
      else
      {
        string[] ar = stmt.TypeDefinitions;
        if (ar != null)
        {
          if (index < ar.Length && ar[index] != null)
            return ar[index];
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
      }
      return -1;
    }

    internal override string ColumnOriginalName(SQLiteStatement stmt, int index)
    {
      int len;
      return ToString(UnsafeNativeMethods.sqlite3_column_origin_name_interop(stmt._sqlite_stmt, index, out len), len);
    }

    internal override string ColumnDatabaseName(SQLiteStatement stmt, int index)
    {
      int len;
      return ToString(UnsafeNativeMethods.sqlite3_column_database_name_interop(stmt._sqlite_stmt, index, out len), len);
    }

    internal override string ColumnTableName(SQLiteStatement stmt, int index)
    {
      int len;
      return ToString(UnsafeNativeMethods.sqlite3_column_table_name_interop(stmt._sqlite_stmt, index, out len), len);
    }

    internal override void ColumnMetaData(string dataBase, string table, string column, out string dataType, out string collateSequence, out bool notNull, out bool primaryKey, out bool autoIncrement)
    {
      IntPtr dataTypePtr;
      IntPtr collSeqPtr;
      int dtLen;
      int csLen;
      int nnotNull;
      int nprimaryKey;
      int nautoInc;
      int n;

      n = UnsafeNativeMethods.sqlite3_table_column_metadata_interop(_sql, ToUTF8(dataBase), ToUTF8(table), ToUTF8(column), out dataTypePtr, out collSeqPtr, out nnotNull, out nprimaryKey, out nautoInc, out dtLen, out csLen);
      if (n > 0) throw new SQLiteException(n, SQLiteLastError());

      dataType = base.ToString(dataTypePtr, dtLen);
      collateSequence = base.ToString(collSeqPtr, csLen);

      notNull = (nnotNull == 1);
      primaryKey = (nprimaryKey == 1);
      autoIncrement = (nautoInc == 1);
    }

    internal override double GetDouble(SQLiteStatement stmt, int index)







|





|





|
















|
|







372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
      }
      return -1;
    }

    internal override string ColumnOriginalName(SQLiteStatement stmt, int index)
    {
      int len;
      return UTF8ToString(UnsafeNativeMethods.sqlite3_column_origin_name_interop(stmt._sqlite_stmt, index, out len), len);
    }

    internal override string ColumnDatabaseName(SQLiteStatement stmt, int index)
    {
      int len;
      return UTF8ToString(UnsafeNativeMethods.sqlite3_column_database_name_interop(stmt._sqlite_stmt, index, out len), len);
    }

    internal override string ColumnTableName(SQLiteStatement stmt, int index)
    {
      int len;
      return UTF8ToString(UnsafeNativeMethods.sqlite3_column_table_name_interop(stmt._sqlite_stmt, index, out len), len);
    }

    internal override void ColumnMetaData(string dataBase, string table, string column, out string dataType, out string collateSequence, out bool notNull, out bool primaryKey, out bool autoIncrement)
    {
      IntPtr dataTypePtr;
      IntPtr collSeqPtr;
      int dtLen;
      int csLen;
      int nnotNull;
      int nprimaryKey;
      int nautoInc;
      int n;

      n = UnsafeNativeMethods.sqlite3_table_column_metadata_interop(_sql, ToUTF8(dataBase), ToUTF8(table), ToUTF8(column), out dataTypePtr, out collSeqPtr, out nnotNull, out nprimaryKey, out nautoInc, out dtLen, out csLen);
      if (n > 0) throw new SQLiteException(n, SQLiteLastError());

      dataType = UTF8ToString(dataTypePtr, dtLen);
      collateSequence = UTF8ToString(collSeqPtr, csLen);

      notNull = (nnotNull == 1);
      primaryKey = (nprimaryKey == 1);
      autoIncrement = (nautoInc == 1);
    }

    internal override double GetDouble(SQLiteStatement stmt, int index)
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
      UnsafeNativeMethods.sqlite3_column_int64_interop(stmt._sqlite_stmt, index, out value);
      return value;
    }

    internal override string GetText(SQLiteStatement stmt, int index)
    {
      int len;
      return ToString(UnsafeNativeMethods.sqlite3_column_text_interop(stmt._sqlite_stmt, index, out len), len);
    }

    internal override DateTime GetDateTime(SQLiteStatement stmt, int index)
    {
      int len;
      return ToDateTime(UnsafeNativeMethods.sqlite3_column_text_interop(stmt._sqlite_stmt, index, out len), len);
    }







|







431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
      UnsafeNativeMethods.sqlite3_column_int64_interop(stmt._sqlite_stmt, index, out value);
      return value;
    }

    internal override string GetText(SQLiteStatement stmt, int index)
    {
      int len;
      return UTF8ToString(UnsafeNativeMethods.sqlite3_column_text_interop(stmt._sqlite_stmt, index, out len), len);
    }

    internal override DateTime GetDateTime(SQLiteStatement stmt, int index)
    {
      int len;
      return ToDateTime(UnsafeNativeMethods.sqlite3_column_text_interop(stmt._sqlite_stmt, index, out len), len);
    }
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504

      int n = UnsafeNativeMethods.sqlite3_create_collation_interop(_sql, ToUTF8(strCollation), 1, 0, func, out nCookie);
      if (n > 0) throw new SQLiteException(n, SQLiteLastError());

      return nCookie;
    }

    internal override void FreeFunction(IntPtr nCookie)
    {
      UnsafeNativeMethods.sqlite3_function_free_callbackcookie(nCookie);
    }

    internal override long GetParamValueBytes(IntPtr p, int nDataOffset, byte[] bDest, int nStart, int nLength)
    {
      IntPtr ptr;
      int nlen;
      int nCopied = nLength;

      nlen = UnsafeNativeMethods.sqlite3_value_bytes_interop(p);







<
<
<
<
<







511
512
513
514
515
516
517





518
519
520
521
522
523
524

      int n = UnsafeNativeMethods.sqlite3_create_collation_interop(_sql, ToUTF8(strCollation), 1, 0, func, out nCookie);
      if (n > 0) throw new SQLiteException(n, SQLiteLastError());

      return nCookie;
    }






    internal override long GetParamValueBytes(IntPtr p, int nDataOffset, byte[] bDest, int nStart, int nLength)
    {
      IntPtr ptr;
      int nlen;
      int nCopied = nLength;

      nlen = UnsafeNativeMethods.sqlite3_value_bytes_interop(p);
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
      UnsafeNativeMethods.sqlite3_value_int64_interop(ptr, out value);
      return value;
    }

    internal override string GetParamValueText(IntPtr ptr)
    {
      int len;
      return ToString(UnsafeNativeMethods.sqlite3_value_text_interop(ptr, out len), len);
    }

    internal override TypeAffinity GetParamValueType(IntPtr ptr)
    {
      return UnsafeNativeMethods.sqlite3_value_type_interop(ptr);
    }








|







554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
      UnsafeNativeMethods.sqlite3_value_int64_interop(ptr, out value);
      return value;
    }

    internal override string GetParamValueText(IntPtr ptr)
    {
      int len;
      return UTF8ToString(UnsafeNativeMethods.sqlite3_value_text_interop(ptr, out len), len);
    }

    internal override TypeAffinity GetParamValueType(IntPtr ptr)
    {
      return UnsafeNativeMethods.sqlite3_value_type_interop(ptr);
    }

617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647



648
649





650
651



652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669



670


    /// <summary>
    /// Helper function to retrieve a column of data from an active statement.
    /// </summary>
    /// <param name="stmt">The statement being step()'d through</param>
    /// <param name="index">The column index to retrieve</param>
    /// <param name="typ">The type of data contained in the column.  If Uninitialized, this function will retrieve the datatype information.</param>
    /// <returns>Returns the data in the column</returns>
    internal override object GetValue(SQLiteStatement stmt, int index, ref SQLiteType typ)
    {
      if (typ.Affinity == 0) typ = SQLiteConvert.ColumnToType(stmt, index);
      if (IsNull(stmt, index)) return DBNull.Value;

      Type t = SQLiteConvert.SQLiteTypeToType(typ);

      switch (TypeToAffinity(t))
      {
        case TypeAffinity.Blob:
          if (typ.Type == DbType.Guid && typ.Affinity == TypeAffinity.Text)
            return new Guid(GetText(stmt, index));

          int n = (int)GetBytes(stmt, index, 0, null, 0, 0);
          byte[] b = new byte[n];
          GetBytes(stmt, index, 0, b, 0, n);

          if (typ.Type == DbType.Guid && n == 16)
            return new Guid(b);

          return b;
        case TypeAffinity.DateTime:
          return GetDateTime(stmt, index);
        case TypeAffinity.Double:



          return Convert.ChangeType(GetDouble(stmt, index), t, null);
        case TypeAffinity.Int64:





          return Convert.ChangeType(GetInt64(stmt, index), t, null);
        default:



          return GetText(stmt, index);
      }
    }

    internal override int GetCursorForTable(SQLiteStatement stmt, int db, int rootPage)
    {
      return UnsafeNativeMethods.sqlite3_table_cursor(stmt._sqlite_stmt, db, rootPage);
    }

    internal override long GetRowIdForCursor(SQLiteStatement stmt, int cursor)
    {
      long rowid;
      int rc = UnsafeNativeMethods.sqlite3_cursor_rowid(stmt._sqlite_stmt, cursor, out rowid);
      if (rc == 0) return rowid;

      return 0;
    }
  }



}









|

<


<
<
|
















>
>
>
|

>
>
>
>
>
|

>
>
>
|
















|
>
>
>
|
>
>
637
638
639
640
641
642
643
644
645

646
647


648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
    /// <summary>
    /// Helper function to retrieve a column of data from an active statement.
    /// </summary>
    /// <param name="stmt">The statement being step()'d through</param>
    /// <param name="index">The column index to retrieve</param>
    /// <param name="typ">The type of data contained in the column.  If Uninitialized, this function will retrieve the datatype information.</param>
    /// <returns>Returns the data in the column</returns>
    internal override object GetValue(SQLiteStatement stmt, int index, SQLiteType typ)
    {

      if (IsNull(stmt, index)) return DBNull.Value;



      switch (typ.Affinity)
      {
        case TypeAffinity.Blob:
          if (typ.Type == DbType.Guid && typ.Affinity == TypeAffinity.Text)
            return new Guid(GetText(stmt, index));

          int n = (int)GetBytes(stmt, index, 0, null, 0, 0);
          byte[] b = new byte[n];
          GetBytes(stmt, index, 0, b, 0, n);

          if (typ.Type == DbType.Guid && n == 16)
            return new Guid(b);

          return b;
        case TypeAffinity.DateTime:
          return GetDateTime(stmt, index);
        case TypeAffinity.Double:
          if (typ.Type == DbType.Double || typ.Type == DbType.Object)
            return GetDouble(stmt, index);
          else
            return Convert.ChangeType(GetDouble(stmt, index), SQLiteConvert.SQLiteTypeToType(typ), null);
        case TypeAffinity.Int64:
          if (typ.Type == DbType.DateTime && _datetimeFormat == SQLiteDateFormats.ISO8601)
            return GetDateTime(stmt, index);
          else if (typ.Type == DbType.Int64 || typ.Type == DbType.Object)
            return GetInt64(stmt, index);
          else
            return Convert.ChangeType(GetInt64(stmt, index), SQLiteConvert.SQLiteTypeToType(typ), null);
        default:
          if (typ.Type == DbType.DateTime && _datetimeFormat == SQLiteDateFormats.ISO8601)
            return GetDateTime(stmt, index);
          else
            return GetText(stmt, index);
      }
    }

    internal override int GetCursorForTable(SQLiteStatement stmt, int db, int rootPage)
    {
      return UnsafeNativeMethods.sqlite3_table_cursor(stmt._sqlite_stmt, db, rootPage);
    }

    internal override long GetRowIdForCursor(SQLiteStatement stmt, int cursor)
    {
      long rowid;
      int rc = UnsafeNativeMethods.sqlite3_cursor_rowid(stmt._sqlite_stmt, cursor, out rowid);
      if (rc == 0) return rowid;

      return 0;
    }

    internal override void DetachAll()
    {
      UnsafeNativeMethods.sqlite3_detach_all_interop(_sql);
    }
  }
}
Changes to System.Data.SQLite/SQLite3_UTF16.cs.
24
25
26
27
28
29
30





31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46










47
48
49
50
51
52

53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
    /// Overrides SQLiteConvert.ToString() to marshal UTF-16 strings instead of UTF-8
    /// </summary>
    /// <param name="b">A pointer to a UTF-16 string</param>
    /// <param name="nbytelen">The length (IN BYTES) of the string</param>
    /// <returns>A .NET string</returns>
    public override string ToString(IntPtr b, int nbytelen)
    {





      if (nbytelen == 0) return "";
      return Marshal.PtrToStringUni(b, nbytelen / 2);
    }

    internal override string Version
    {
      get
      {
        int len;
        return base.ToString(UnsafeNativeMethods.sqlite3_libversion_interop(out len), len);
      }
    }

    internal override void Open(string strFilename)
    {
      if (_sql != null) return;










      IntPtr db;

      int n = UnsafeNativeMethods.sqlite3_open16_interop(strFilename, out db);
      if (n > 0) throw new SQLiteException(n, null);

      _sql = db;

      _functionsArray = SQLiteFunction.BindFunctions(this);
    }

    internal override void Bind_DateTime(SQLiteStatement stmt, int index, DateTime dt)
    {
      Bind_Text(stmt, index, ToString(dt));
    }

    internal override string Bind_ParamName(SQLiteStatement stmt, int index)
    {
      int len;
      return base.ToString(UnsafeNativeMethods.sqlite3_bind_parameter_name_interop(stmt._sqlite_stmt, index, out len), len);
    }

    internal override void Bind_Text(SQLiteStatement stmt, int index, string value)
    {
      int n = UnsafeNativeMethods.sqlite3_bind_text16_interop(stmt._sqlite_stmt, index, value, value.Length * 2, -1);
      if (n > 0) throw new SQLiteException(n, SQLiteLastError());
    }

    internal override string ColumnName(SQLiteStatement stmt, int index)
    {
      int len;
      return ToString(UnsafeNativeMethods.sqlite3_column_name16_interop(stmt._sqlite_stmt, index, out len), len);
    }

    internal override DateTime GetDateTime(SQLiteStatement stmt, int index)
    {
      return ToDateTime(GetText(stmt, index));
    }

    internal override string GetText(SQLiteStatement stmt, int index)
    {
      int len;
      return ToString(UnsafeNativeMethods.sqlite3_column_text16_interop(stmt._sqlite_stmt, index, out len), len);
    }

    internal override string ColumnOriginalName(SQLiteStatement stmt, int index)
    {
      int len;
      return ToString(UnsafeNativeMethods.sqlite3_column_origin_name16_interop(stmt._sqlite_stmt, index, out len), len);
    }

    internal override string ColumnDatabaseName(SQLiteStatement stmt, int index)
    {
      int len;
      return ToString(UnsafeNativeMethods.sqlite3_column_database_name16_interop(stmt._sqlite_stmt, index, out len), len);
    }

    internal override string ColumnTableName(SQLiteStatement stmt, int index)
    {
      int len;
      return ToString(UnsafeNativeMethods.sqlite3_column_table_name16_interop(stmt._sqlite_stmt, index, out len), len);
    }

    internal override IntPtr CreateFunction(string strFunction, int nArgs, SQLiteCallback func, SQLiteCallback funcstep, SQLiteCallback funcfinal)
    {
      IntPtr nCookie;

      int n = UnsafeNativeMethods.sqlite3_create_function16_interop(_sql, strFunction, nArgs, 4, func, funcstep, funcfinal, out nCookie);







>
>
>
>
>









|



|


>
>
>
>
>
>
>
>
>
>
|

|
|

|
>








<
<
<
<
<
<









|










|





|





|





|







24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76






77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
    /// Overrides SQLiteConvert.ToString() to marshal UTF-16 strings instead of UTF-8
    /// </summary>
    /// <param name="b">A pointer to a UTF-16 string</param>
    /// <param name="nbytelen">The length (IN BYTES) of the string</param>
    /// <returns>A .NET string</returns>
    public override string ToString(IntPtr b, int nbytelen)
    {
      return UTF16ToString(b, nbytelen);
    }

    public static string UTF16ToString(IntPtr b, int nbytelen)
    {
      if (nbytelen == 0) return "";
      return Marshal.PtrToStringUni(b, nbytelen / 2);
    }

    internal override string Version
    {
      get
      {
        int len;
        return UTF8ToString(UnsafeNativeMethods.sqlite3_libversion_interop(out len), len);
      }
    }

    internal override void Open(string strFilename, bool usePool)
    {
      if (_sql != null) return;

      _usePool = usePool;
      if (usePool)
      {
        _fileName = strFilename;
        _sql = SQLiteConnectionPool.Remove(strFilename);
      }

      if (_sql == null)
      {
        IntPtr db;

        int n = UnsafeNativeMethods.sqlite3_open16_interop(strFilename, out db);
        if (n > 0) throw new SQLiteException(n, null);

        _sql = db;
      }
      _functionsArray = SQLiteFunction.BindFunctions(this);
    }

    internal override void Bind_DateTime(SQLiteStatement stmt, int index, DateTime dt)
    {
      Bind_Text(stmt, index, ToString(dt));
    }







    internal override void Bind_Text(SQLiteStatement stmt, int index, string value)
    {
      int n = UnsafeNativeMethods.sqlite3_bind_text16_interop(stmt._sqlite_stmt, index, value, value.Length * 2, -1);
      if (n > 0) throw new SQLiteException(n, SQLiteLastError());
    }

    internal override string ColumnName(SQLiteStatement stmt, int index)
    {
      int len;
      return UTF16ToString(UnsafeNativeMethods.sqlite3_column_name16_interop(stmt._sqlite_stmt, index, out len), len);
    }

    internal override DateTime GetDateTime(SQLiteStatement stmt, int index)
    {
      return ToDateTime(GetText(stmt, index));
    }

    internal override string GetText(SQLiteStatement stmt, int index)
    {
      int len;
      return UTF16ToString(UnsafeNativeMethods.sqlite3_column_text16_interop(stmt._sqlite_stmt, index, out len), len);
    }

    internal override string ColumnOriginalName(SQLiteStatement stmt, int index)
    {
      int len;
      return UTF16ToString(UnsafeNativeMethods.sqlite3_column_origin_name16_interop(stmt._sqlite_stmt, index, out len), len);
    }

    internal override string ColumnDatabaseName(SQLiteStatement stmt, int index)
    {
      int len;
      return UTF16ToString(UnsafeNativeMethods.sqlite3_column_database_name16_interop(stmt._sqlite_stmt, index, out len), len);
    }

    internal override string ColumnTableName(SQLiteStatement stmt, int index)
    {
      int len;
      return UTF16ToString(UnsafeNativeMethods.sqlite3_column_table_name16_interop(stmt._sqlite_stmt, index, out len), len);
    }

    internal override IntPtr CreateFunction(string strFunction, int nArgs, SQLiteCallback func, SQLiteCallback funcstep, SQLiteCallback funcfinal)
    {
      IntPtr nCookie;

      int n = UnsafeNativeMethods.sqlite3_create_function16_interop(_sql, strFunction, nArgs, 4, func, funcstep, funcfinal, out nCookie);
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144

      return nCookie;
    }

    internal override string GetParamValueText(IntPtr ptr)
    {
      int len;
      return ToString(UnsafeNativeMethods.sqlite3_value_text16_interop(ptr, out len), len);
    }

    internal override void ReturnError(IntPtr context, string value)
    {
      UnsafeNativeMethods.sqlite3_result_error16_interop(context, value, value.Length);
    }

    internal override void ReturnText(IntPtr context, string value)
    {
      UnsafeNativeMethods.sqlite3_result_text16_interop(context, value, value.Length, (IntPtr)(-1));
    }
  }
}







|













134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154

      return nCookie;
    }

    internal override string GetParamValueText(IntPtr ptr)
    {
      int len;
      return UTF16ToString(UnsafeNativeMethods.sqlite3_value_text16_interop(ptr, out len), len);
    }

    internal override void ReturnError(IntPtr context, string value)
    {
      UnsafeNativeMethods.sqlite3_result_error16_interop(context, value, value.Length);
    }

    internal override void ReturnText(IntPtr context, string value)
    {
      UnsafeNativeMethods.sqlite3_result_text16_interop(context, value, value.Length, (IntPtr)(-1));
    }
  }
}
Changes to System.Data.SQLite/SQLiteBase.cs.
28
29
30
31
32
33
34

35
36
37
38
39
40
41
42
43
44
45
46
47
    /// <summary>
    /// Returns the number of changes the last executing insert/update caused.
    /// </summary>
    internal abstract int Changes { get; }
    /// <summary>
    /// Opens a database.
    /// </summary>

    /// <remarks>
    /// Implementers should call SQLiteFunction.BindFunctions() and save the array after opening a connection
    /// to bind all attributed user-defined functions and collating sequences to the new connection.
    /// </remarks>
    /// <param name="strFilename">The filename of the database to open.  SQLite automatically creates it if it doesn't exist.</param>
    internal abstract void Open(string strFilename);
    /// <summary>
    /// Closes the currently-open database.
    /// </summary>
    /// <remarks>
    /// After the database has been closed implemeters should call SQLiteFunction.UnbindFunctions() to deallocate all interop allocated
    /// memory associated with the user-defined functions and collating sequences tied to the closed connection.
    /// </remarks>







>





|







28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
    /// <summary>
    /// Returns the number of changes the last executing insert/update caused.
    /// </summary>
    internal abstract int Changes { get; }
    /// <summary>
    /// Opens a database.
    /// </summary>
    /// <param name="usePool">If true, the connection can be pulled from the connection pool</param>
    /// <remarks>
    /// Implementers should call SQLiteFunction.BindFunctions() and save the array after opening a connection
    /// to bind all attributed user-defined functions and collating sequences to the new connection.
    /// </remarks>
    /// <param name="strFilename">The filename of the database to open.  SQLite automatically creates it if it doesn't exist.</param>
    internal abstract void Open(string strFilename, bool usePool);
    /// <summary>
    /// Closes the currently-open database.
    /// </summary>
    /// <remarks>
    /// After the database has been closed implemeters should call SQLiteFunction.UnbindFunctions() to deallocate all interop allocated
    /// memory associated with the user-defined functions and collating sequences tied to the closed connection.
    /// </remarks>
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
    internal abstract long GetBytes(SQLiteStatement stmt, int index, int nDataoffset, byte[] bDest, int nStart, int nLength);
    internal abstract long GetChars(SQLiteStatement stmt, int index, int nDataoffset, char[] bDest, int nStart, int nLength);
    internal abstract DateTime GetDateTime(SQLiteStatement stmt, int index);
    internal abstract bool IsNull(SQLiteStatement stmt, int index);

    internal abstract IntPtr CreateCollation(string strCollation, SQLiteCollation func);
    internal abstract IntPtr CreateFunction(string strFunction, int nArgs, SQLiteCallback func, SQLiteCallback funcstep, SQLiteCallback funcfinal);
    internal abstract void FreeFunction(IntPtr cookie);

    internal abstract int AggregateCount(IntPtr context);
    internal abstract IntPtr AggregateContext(IntPtr context);

    internal abstract long GetParamValueBytes(IntPtr ptr, int nDataOffset, byte[] bDest, int nStart, int nLength);
    internal abstract double GetParamValueDouble(IntPtr ptr);
    internal abstract int GetParamValueInt32(IntPtr ptr);







<







113
114
115
116
117
118
119

120
121
122
123
124
125
126
    internal abstract long GetBytes(SQLiteStatement stmt, int index, int nDataoffset, byte[] bDest, int nStart, int nLength);
    internal abstract long GetChars(SQLiteStatement stmt, int index, int nDataoffset, char[] bDest, int nStart, int nLength);
    internal abstract DateTime GetDateTime(SQLiteStatement stmt, int index);
    internal abstract bool IsNull(SQLiteStatement stmt, int index);

    internal abstract IntPtr CreateCollation(string strCollation, SQLiteCollation func);
    internal abstract IntPtr CreateFunction(string strFunction, int nArgs, SQLiteCallback func, SQLiteCallback funcstep, SQLiteCallback funcfinal);


    internal abstract int AggregateCount(IntPtr context);
    internal abstract IntPtr AggregateContext(IntPtr context);

    internal abstract long GetParamValueBytes(IntPtr ptr, int nDataOffset, byte[] bDest, int nStart, int nLength);
    internal abstract double GetParamValueDouble(IntPtr ptr);
    internal abstract int GetParamValueInt32(IntPtr ptr);
141
142
143
144
145
146
147

148
149
150
151
152
153
154
155
156
157
158
159





160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183



184




    internal abstract void SetUpdateHook(SQLiteUpdateCallback func);
    internal abstract void SetCommitHook(SQLiteCommitCallback func);
    internal abstract void SetRollbackHook(SQLiteRollbackCallback func);

    internal abstract int GetCursorForTable(SQLiteStatement stmt, int database, int rootPage);
    internal abstract long GetRowIdForCursor(SQLiteStatement stmt, int cursor);


    internal abstract object GetValue(SQLiteStatement stmt, int index, ref SQLiteType typ);

    protected virtual void Dispose(bool bDisposing)
    {
    }

    public void Dispose()
    {
      Dispose(true);
    }






    internal static string SQLiteLastError(SQLiteConnectionHandle db)
    {
      int len;
      return UTF8ToString(UnsafeNativeMethods.sqlite3_errmsg_interop(db, out len), len);
    }

    internal static string SQLiteLastError(SQLiteStatementHandle stmt)
    {
      int len;
      return UTF8ToString(UnsafeNativeMethods.sqlite3_errmsg_stmt_interop(stmt, out len), len);
    }

    internal static void FinalizeStatement(SQLiteStatementHandle stmt)
    {
      int n = UnsafeNativeMethods.sqlite3_finalize_interop(stmt);
      if (n > 0) throw new SQLiteException(n, SQLiteLastError(stmt));
    }

    internal static void Close(SQLiteConnectionHandle db)
    {
      int n = UnsafeNativeMethods.sqlite3_close_interop(db);
      if (n > 0) throw new SQLiteException(n, SQLiteLastError(db));
    }
  }



}










>

|










>
>
>
>
>


















|




|
>
>
>
|
>
>
>
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196

    internal abstract void SetUpdateHook(SQLiteUpdateCallback func);
    internal abstract void SetCommitHook(SQLiteCommitCallback func);
    internal abstract void SetRollbackHook(SQLiteRollbackCallback func);

    internal abstract int GetCursorForTable(SQLiteStatement stmt, int database, int rootPage);
    internal abstract long GetRowIdForCursor(SQLiteStatement stmt, int cursor);
    internal abstract void DetachAll();

    internal abstract object GetValue(SQLiteStatement stmt, int index, SQLiteType typ);

    protected virtual void Dispose(bool bDisposing)
    {
    }

    public void Dispose()
    {
      Dispose(true);
    }

    // These statics are here for lack of a better place to put them.
    // They exist here because they are called during the finalization of
    // a SQLiteStatementHandle, SQLiteConnectionHandle, and SQLiteFunctionCookieHandle.
    // Therefore these functions have to be static, and have to be low-level.

    internal static string SQLiteLastError(SQLiteConnectionHandle db)
    {
      int len;
      return UTF8ToString(UnsafeNativeMethods.sqlite3_errmsg_interop(db, out len), len);
    }

    internal static string SQLiteLastError(SQLiteStatementHandle stmt)
    {
      int len;
      return UTF8ToString(UnsafeNativeMethods.sqlite3_errmsg_stmt_interop(stmt, out len), len);
    }

    internal static void FinalizeStatement(SQLiteStatementHandle stmt)
    {
      int n = UnsafeNativeMethods.sqlite3_finalize_interop(stmt);
      if (n > 0) throw new SQLiteException(n, SQLiteLastError(stmt));
    }

    internal static void CloseConnection(SQLiteConnectionHandle db)
    {
      int n = UnsafeNativeMethods.sqlite3_close_interop(db);
      if (n > 0) throw new SQLiteException(n, SQLiteLastError(db));
    }

    internal static void FreeFunction(IntPtr nCookie)
    {
      UnsafeNativeMethods.sqlite3_function_free_callbackcookie(nCookie);
    }

  }
}
Changes to System.Data.SQLite/SQLiteCommand.cs.
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31




32
33
34
35
36
37
38
  using System.Collections.Generic;
  using System.ComponentModel;

  /// <summary>
  /// SQLite implementation of DbCommand.
  /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
  [Designer("SQLite.Designer.SQLiteCommandDesigner, SQLite.Designer, Version=1.0.31.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139"), ToolboxItem(true)]
#endif
  public sealed class SQLiteCommand : DbCommand, ICloneable
  {
    /// <summary>
    /// The command text this command is based on
    /// </summary>
    private string _commandText;
    /// <summary>
    /// The connection the command is associated with
    /// </summary>
    private SQLiteConnection _cnn;




    /// <summary>
    /// Indicates whether or not a DataReader is active on the command.
    /// </summary>
    private WeakReference _activeReader;
    /// <summary>
    /// The timeout for the command, kludged because SQLite doesn't support per-command timeout values
    /// </summary>







|











>
>
>
>







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
  using System.Collections.Generic;
  using System.ComponentModel;

  /// <summary>
  /// SQLite implementation of DbCommand.
  /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
  [Designer("SQLite.Designer.SQLiteCommandDesigner, SQLite.Designer, Version=1.0.32.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139"), ToolboxItem(true)]
#endif
  public sealed class SQLiteCommand : DbCommand, ICloneable
  {
    /// <summary>
    /// The command text this command is based on
    /// </summary>
    private string _commandText;
    /// <summary>
    /// The connection the command is associated with
    /// </summary>
    private SQLiteConnection _cnn;
    /// <summary>
    /// The version of the connection the command is associated with
    /// </summary>
    private long _version;
    /// <summary>
    /// Indicates whether or not a DataReader is active on the command.
    /// </summary>
    private WeakReference _activeReader;
    /// <summary>
    /// The timeout for the command, kludged because SQLite doesn't support per-command timeout values
    /// </summary>
374
375
376
377
378
379
380
381
382
383
384


385
386
387
388
389
390
391
392
393
394
      {
        if (_activeReader != null && _activeReader.IsAlive)
          throw new InvalidOperationException("Cannot set Connection while a DataReader is active");

        if (_cnn != null)
        {
          ClearCommands();
          _cnn.RemoveCommand(this);
        }

        _cnn = value;



        if (_cnn != null)
          _cnn.AddCommand(this);
      }
    }

    /// <summary>
    /// Forwards to the local Connection property
    /// </summary>
    protected override DbConnection DbConnection







|



>
>

|
|







378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
      {
        if (_activeReader != null && _activeReader.IsAlive)
          throw new InvalidOperationException("Cannot set Connection while a DataReader is active");

        if (_cnn != null)
        {
          ClearCommands();
          //_cnn.RemoveCommand(this);
        }

        _cnn = value;
        if (_cnn != null)
          _version = _cnn._version;

        //if (_cnn != null)
        //  _cnn.AddCommand(this);
      }
    }

    /// <summary>
    /// Forwards to the local Connection property
    /// </summary>
    protected override DbConnection DbConnection
480
481
482
483
484
485
486







487
488
489
490
491
492
493
        throw new InvalidOperationException("DataReader already active on this command");

      if (_cnn == null)
        throw new InvalidOperationException("No connection associated with this command");

      if (_cnn.State != ConnectionState.Open)
        throw new InvalidOperationException("Database is not open");








      // Map all parameters for statements already built
      _parameterCollection.MapParameters(null);

      // Set the default command timeout
      _cnn._sql.SetTimeout(_commandTimeout * 1000);
    }







>
>
>
>
>
>
>







486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
        throw new InvalidOperationException("DataReader already active on this command");

      if (_cnn == null)
        throw new InvalidOperationException("No connection associated with this command");

      if (_cnn.State != ConnectionState.Open)
        throw new InvalidOperationException("Database is not open");

      // If the version of the connection has changed, clear out any previous commands before starting
      if (_cnn._version != _version)
      {
        _version = _cnn._version;
        ClearCommands();
      }

      // Map all parameters for statements already built
      _parameterCollection.MapParameters(null);

      // Set the default command timeout
      _cnn._sql.SetTimeout(_commandTimeout * 1000);
    }
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
      {
        stmt = GetStatement(x);
        x++;
        if (stmt == null) break;

        if (_cnn._sql.Step(stmt) == true && ret == null)
        {
          ret = _cnn._sql.GetValue(stmt, 0, ref typ);
        }
        _cnn._sql.Reset(stmt);
      }

      return ret;
    }








|







593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
      {
        stmt = GetStatement(x);
        x++;
        if (stmt == null) break;

        if (_cnn._sql.Step(stmt) == true && ret == null)
        {
          ret = _cnn._sql.GetValue(stmt, 0, typ);
        }
        _cnn._sql.Reset(stmt);
      }

      return ret;
    }

Changes to System.Data.SQLite/SQLiteConnection.cs.
78
79
80
81
82
83
84
85
86
87
88
























89
90
91
92
93
94
95
96
97
98
  /// <description>Password</description>
  /// <description>{password}</description>
  /// <description>N</description>
  /// <description></description>
  /// </item>
  /// <item>
  /// <description>Enlist</description>
  /// <description><B>Y</B> - Automatically enlist in distributed transactions<br/><b>N</b> - No automatic enlistment</description>
  /// <description>N</description>
  /// <description>Y</description>
  /// </item>
























  /// </list>
  /// </remarks>
  public sealed class SQLiteConnection : DbConnection, ICloneable
  {
    private const string _dataDirectory = "|DataDirectory|";

    /// <summary>
    /// State of the current connection
    /// </summary>
    private ConnectionState _connectionState;







|



>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


|







78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
  /// <description>Password</description>
  /// <description>{password}</description>
  /// <description>N</description>
  /// <description></description>
  /// </item>
  /// <item>
  /// <description>Enlist</description>
  /// <description><b>Y</b> - Automatically enlist in distributed transactions<br/><b>N</b> - No automatic enlistment</description>
  /// <description>N</description>
  /// <description>Y</description>
  /// </item>
  /// <item>
  /// <description>Pooling</description>
  /// <description><b>True</b> - Use connection pooling<br/><b>False</b> - Do not use connection pooling</description>
  /// <description>N</description>
  /// <description>False</description>
  /// </item>
  /// <item>
  /// <description>FailIfMissing</description>
  /// <description><b>True</b> - Don't create the database if it does not exist, throw an error instead<br/><b>False</b> - Automatically create the database if it does not exist</description>
  /// <description>N</description>
  /// <description>False</description>
  /// </item>
  /// <item>
  /// <description>Max Page Count</description>
  /// <description>{size in pages} - Limits the maximum number of pages (limits the size) of the database</description>
  /// <description>N</description>
  /// <description>0</description>
  /// </item>
  /// <item>
  /// <description>Legacy Format</description>
  /// <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>
  /// <description>N</description>
  /// <description>True</description>
  /// </item>
  /// </list>
  /// </remarks>
  public sealed partial class SQLiteConnection : DbConnection, ICloneable
  {
    private const string _dataDirectory = "|DataDirectory|";

    /// <summary>
    /// State of the current connection
    /// </summary>
    private ConnectionState _connectionState;
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
    /// <summary>
    /// The base SQLite object to interop with
    /// </summary>
    internal SQLiteBase _sql;
    /// <summary>
    /// Commands associated with this connection
    /// </summary>
    internal List<WeakReference> _commandList;
    /// <summary>
    /// The database filename minus path and extension
    /// </summary>
    private string _dataSource;
    /// <summary>
    /// Temporary password storage, emptied after the database has been opened
    /// </summary>







|







137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
    /// <summary>
    /// The base SQLite object to interop with
    /// </summary>
    internal SQLiteBase _sql;
    /// <summary>
    /// Commands associated with this connection
    /// </summary>
    //internal List<WeakReference> _commandList;
    /// <summary>
    /// The database filename minus path and extension
    /// </summary>
    private string _dataSource;
    /// <summary>
    /// Temporary password storage, emptied after the database has been opened
    /// </summary>
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
    public SQLiteConnection(string connectionString)
    {
      _sql = null;
      _connectionState = ConnectionState.Closed;
      _connectionString = "";
      _transactionLevel = 0;
      _version = 0;
      _commandList = new List<WeakReference>();

      if (connectionString != null)
        ConnectionString = connectionString;
    }

    /// <summary>
    /// Clones the settings and connection string from an existing connection.  If the existing connection is already open, this







|







286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
    public SQLiteConnection(string connectionString)
    {
      _sql = null;
      _connectionState = ConnectionState.Closed;
      _connectionString = "";
      _transactionLevel = 0;
      _version = 0;
      //_commandList = new List<WeakReference>();

      if (connectionString != null)
        ConnectionString = connectionString;
    }

    /// <summary>
    /// Clones the settings and connection string from an existing connection.  If the existing connection is already open, this
462
463
464
465
466
467
468
469
470
471
472

473
474

475
476
477
478

479
480
481

482
483

484
485
486


487
488
489

490
491
492
493
494
495
496
    {
      if (_sql != null)
      {
        // Force any commands associated with this connection to release their unmanaged
        // resources.  The commands are still valid and will automatically re-acquire the
        // unmanaged resources the next time they are run -- provided this connection is
        // re-opened before then.
        WeakReference[] clone;

        lock (_commandList)
        {

          clone = new WeakReference[_commandList.Count];
          _commandList.CopyTo(clone);

        }

        for (int n = 0; n < clone.Length; n++)
        {

          SQLiteCommand cmd = null;
          try
          {

            cmd = clone[n].Target as SQLiteCommand;
          }

          catch
          {
          }


          if (cmd != null)
            cmd.ClearCommands();
        }


#if !PLATFORM_COMPACTFRAMEWORK
        if (_enlistment != null)
        {
          // If the connection is enlisted in a transaction scope and the scope is still active,
          // we cannot truly shut down this connection until the scope has completed.  Therefore make a 
          // hidden connection temporarily to hold open the connection until the scope has completed.







|

|
<
>
|
|
>
|
<
|
<
>
|
|
<
>
|
<
>
|
<
<
>
>
|
|
<
>







486
487
488
489
490
491
492
493
494
495

496
497
498
499
500

501

502
503
504

505
506

507
508


509
510
511
512

513
514
515
516
517
518
519
520
    {
      if (_sql != null)
      {
        // Force any commands associated with this connection to release their unmanaged
        // resources.  The commands are still valid and will automatically re-acquire the
        // unmanaged resources the next time they are run -- provided this connection is
        // re-opened before then.
        //WeakReference[] clone;

        //lock (_commandList)

        //{
        //  clone = new WeakReference[_commandList.Count];
        //  _commandList.CopyTo(clone);
        //}


        //for (int n = 0; n < clone.Length; n++)

        //{
        //  SQLiteCommand cmd = null;
        //  try

        //  {
        //    cmd = clone[n].Target as SQLiteCommand;

        //  }
        //  catch


        //  {
        //  }
        //  if (cmd != null)
        //    cmd.ClearCommands();

        //}

#if !PLATFORM_COMPACTFRAMEWORK
        if (_enlistment != null)
        {
          // If the connection is enlisted in a transaction scope and the scope is still active,
          // we cannot truly shut down this connection until the scope has completed.  Therefore make a 
          // hidden connection temporarily to hold open the connection until the scope has completed.
585
586
587
588
589
590
591
























592
593
594
595
596
597
598
599
600
601
602
603
    /// </item>
    /// <item>
    /// <description>Enlist</description>
    /// <description><B>Y</B> - Automatically enlist in distributed transactions<br/><b>N</b> - No automatic enlistment</description>
    /// <description>N</description>
    /// <description>Y</description>
    /// </item>
























    /// </list>
    /// </remarks>
#if !PLATFORM_COMPACTFRAMEWORK
    [RefreshProperties(RefreshProperties.All), DefaultValue("")]
    [Editor("SQLite.Designer.SQLiteConnectionStringEditor, SQLite.Designer, Version=1.0.31.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
#endif
    public override string ConnectionString
    {
      get
      {
        return _connectionString;
      }







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>




|







609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
    /// </item>
    /// <item>
    /// <description>Enlist</description>
    /// <description><B>Y</B> - Automatically enlist in distributed transactions<br/><b>N</b> - No automatic enlistment</description>
    /// <description>N</description>
    /// <description>Y</description>
    /// </item>
    /// <item>
    /// <description>Pooling</description>
    /// <description><b>True</b> - Use connection pooling<br/><b>False</b> - Do not use connection pooling</description>
    /// <description>N</description>
    /// <description>False</description>
    /// </item>
    /// <item>
    /// <description>FailIfMissing</description>
    /// <description><b>True</b> - Don't create the database if it does not exist, throw an error instead<br/><b>False</b> - Automatically create the database if it does not exist</description>
    /// <description>N</description>
    /// <description>False</description>
    /// </item>
    /// <item>
    /// <description>Max Page Count</description>
    /// <description>{size in pages} - Limits the maximum number of pages (limits the size) of the database</description>
    /// <description>N</description>
    /// <description>0</description>
    /// </item>
    /// <item>
    /// <description>Legacy Format</description>
    /// <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>
    /// <description>N</description>
    /// <description>True</description>
    /// </item>
    /// </list>
    /// </remarks>
#if !PLATFORM_COMPACTFRAMEWORK
    [RefreshProperties(RefreshProperties.All), DefaultValue("")]
    [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")]
#endif
    public override string ConnectionString
    {
      get
      {
        return _connectionString;
      }
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
      }
    }

    /// <summary>
    /// Parses the connection string into component parts
    /// </summary>
    /// <returns>An array of key-value pairs representing each parameter of the connection string</returns>
    internal KeyValuePair<string, string>[] ParseConnectionString()
    {
      string s = _connectionString;
      int n;
      List<KeyValuePair<string, string>> ls = new List<KeyValuePair<string, string>>();

      // First split into semi-colon delimited values.  The Split() function of SQLiteBase accounts for and properly
      // skips semi-colons in quoted strings
      string[] arParts = SQLiteConvert.Split(s, ';');
      string[] arPiece;

      int x = arParts.Length;
      // For each semi-colon piece, split into key and value pairs by the presence of the = sign
      for (n = 0; n < x; n++)
      {
        arPiece = SQLiteConvert.Split(arParts[n], '=');
        if (arPiece.Length == 2)
        {
          ls.Add(new KeyValuePair<string, string>(arPiece[0], arPiece[1]));
        }
        else throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, "Invalid ConnectionString format for parameter \"{0}\"", (arPiece.Length > 0) ? arPiece[0] : "null"));
      }
      KeyValuePair<string, string>[] ar = new KeyValuePair<string, string>[ls.Count];
      ls.CopyTo(ar, 0);

      // Return the array of key-value pairs
      return ar;
    }

#if !PLATFORM_COMPACTFRAMEWORK
    /// <summary>
    /// Manual distributed transaction enlistment support
    /// </summary>
    /// <param name="transaction">The distributed transaction to enlist in</param>







|



|













|



<
<
<
<
|







707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735




736
737
738
739
740
741
742
743
      }
    }

    /// <summary>
    /// Parses the connection string into component parts
    /// </summary>
    /// <returns>An array of key-value pairs representing each parameter of the connection string</returns>
    internal SortedList<string, string> ParseConnectionString()
    {
      string s = _connectionString;
      int n;
      SortedList<string, string> ls = new SortedList<string, string>(StringComparer.OrdinalIgnoreCase);

      // First split into semi-colon delimited values.  The Split() function of SQLiteBase accounts for and properly
      // skips semi-colons in quoted strings
      string[] arParts = SQLiteConvert.Split(s, ';');
      string[] arPiece;

      int x = arParts.Length;
      // For each semi-colon piece, split into key and value pairs by the presence of the = sign
      for (n = 0; n < x; n++)
      {
        arPiece = SQLiteConvert.Split(arParts[n], '=');
        if (arPiece.Length == 2)
        {
          ls.Add(arPiece[0], arPiece[1]);
        }
        else throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, "Invalid ConnectionString format for parameter \"{0}\"", (arPiece.Length > 0) ? arPiece[0] : "null"));
      }




      return ls;
    }

#if !PLATFORM_COMPACTFRAMEWORK
    /// <summary>
    /// Manual distributed transaction enlistment support
    /// </summary>
    /// <param name="transaction">The distributed transaction to enlist in</param>
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760

761
762
763
764
765
766
767
768
769
770


771
772




773
774
775

776
777

778
779

780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824


825





















826
827

828
829
830
831
832
833
834
835
836
837
838
839
840
      _enlistment = new SQLiteEnlistment(this, transaction);
    }
#endif

    /// <summary>
    /// Looks for a key in the array of key/values of the parameter string.  If not found, return the specified default value
    /// </summary>
    /// <param name="opts">The Key/Value pair array to look in</param>
    /// <param name="key">The key to find</param>
    /// <param name="defValue">The default value to return if the key is not found</param>
    /// <returns>The value corresponding to the specified key, or the default value if not found.</returns>
    static internal string FindKey(KeyValuePair<string, string>[] opts, string key, string defValue)
    {
      int x = opts.Length;
      for (int n = 0; n < x; n++)
      {
        if (String.Compare(opts[n].Key, key, true, CultureInfo.InvariantCulture) == 0)
        {
          return opts[n].Value;
        }
      }
      return defValue;
    }

    /// <summary>
    /// Opens the connection using the parameters found in the <see cref="ConnectionString">ConnectionString</see>
    /// </summary>
    public override void Open()
    {
      if (_connectionState != ConnectionState.Closed)
        throw new InvalidOperationException();

      Close();

      KeyValuePair<string, string>[] opts = ParseConnectionString();
      string fileName;

      if (Convert.ToInt32(FindKey(opts, "Version", "3"), CultureInfo.InvariantCulture) != 3)
        throw new NotSupportedException("Only SQLite Version 3 is supported at this time");

      fileName = FindKey(opts, "Data Source", "");

      if (String.IsNullOrEmpty(fileName))
        throw new ArgumentException("Data Source cannot be empty.  Use :memory: to open an in-memory database");

      if (String.Compare(fileName, ":MEMORY:", true, CultureInfo.InvariantCulture) == 0)
        fileName = ":memory:";
#if PLATFORM_COMPACTFRAMEWORK
      else if (fileName.StartsWith(".\\"))
        fileName = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetCallingAssembly().GetName().CodeBase) + fileName.Substring(1);
#endif
      try
      {

        bool bUTF16 = (Convert.ToBoolean(FindKey(opts, "UseUTF16Encoding", "False"), CultureInfo.InvariantCulture) == true);
        SQLiteDateFormats dateFormat = String.Compare(FindKey(opts, "DateTimeFormat", "ISO8601"), "ticks", true, CultureInfo.InvariantCulture) == 0 ? SQLiteDateFormats.Ticks : SQLiteDateFormats.ISO8601;

        if (bUTF16) // SQLite automatically sets the encoding of the database to UTF16 if called from sqlite3_open16()
          _sql = new SQLite3_UTF16(dateFormat);
        else
          _sql = new SQLite3(dateFormat);

        fileName = ExpandFileName(fileName);



        try
        {




          if (IO.File.Exists(fileName) == false)
            throw new IO.FileNotFoundException(String.Format(CultureInfo.CurrentCulture, "Unable to locate file \"{0}\", creating new database.", fileName));
        }

        catch
        {

        }


        _sql.Open(fileName);

        _binaryGuid = (Convert.ToBoolean(FindKey(opts, "BinaryGUID", "True"), CultureInfo.InvariantCulture) == true);

        string password = FindKey(opts, "Password", null);

        if (String.IsNullOrEmpty(password) == false)
          _sql.SetPassword(System.Text.UTF8Encoding.UTF8.GetBytes(password));
        else if (_password != null)
          _sql.SetPassword(_password);
        _password = null;

        _dataSource = System.IO.Path.GetFileNameWithoutExtension(fileName);

        OnStateChange(ConnectionState.Open);
        _version++;

        using (SQLiteCommand cmd = CreateCommand())
        {
          string defValue;

          defValue = FindKey(opts, "Synchronous", "Normal");
          if (String.Compare(defValue, "Normal", true, CultureInfo.InvariantCulture) != 0)
          {
            cmd.CommandText = String.Format(CultureInfo.InvariantCulture, "PRAGMA Synchronous={0}", defValue);
            cmd.ExecuteNonQuery();
          }

          defValue = FindKey(opts, "Cache Size", "2000");
          if (Convert.ToInt32(defValue) != 2000)
          {
            cmd.CommandText = String.Format(CultureInfo.InvariantCulture, "PRAGMA Cache_Size={0}", defValue);
            cmd.ExecuteNonQuery();
          }

          if (fileName != ":memory:")
          {
            defValue = FindKey(opts, "Page Size", "1024");
            if (Convert.ToInt32(defValue) != 1024)
            {
              cmd.CommandText = String.Format(CultureInfo.InvariantCulture, "PRAGMA Page_Size={0}", defValue);
              cmd.ExecuteNonQuery();
            }
          }
        }
























#if !PLATFORM_COMPACTFRAMEWORK
        if (FindKey(opts, "Enlist", "Y").ToUpper()[0] == 'Y' && Transactions.Transaction.Current != null)

          EnlistTransaction(Transactions.Transaction.Current);
#endif
      }
      catch (SQLiteException)
      {
        OnStateChange(ConnectionState.Broken);
        throw;
      }
    }

    /// <summary>
    /// Returns the version of the underlying SQLite database engine
    /// </summary>







|



|

|
<
|
<
<
|
|
<













|


















>
|









>
>
|
|
>
>
>
>
|
<
|
>
|
|
>
|
|
>
|

|


















<
<
<
<
<
<
<
<
<
<
<
<
<
<





|



|
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

|
>





|







752
753
754
755
756
757
758
759
760
761
762
763
764
765

766


767
768

769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820

821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849














850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
      _enlistment = new SQLiteEnlistment(this, transaction);
    }
#endif

    /// <summary>
    /// Looks for a key in the array of key/values of the parameter string.  If not found, return the specified default value
    /// </summary>
    /// <param name="items">The list to look in</param>
    /// <param name="key">The key to find</param>
    /// <param name="defValue">The default value to return if the key is not found</param>
    /// <returns>The value corresponding to the specified key, or the default value if not found.</returns>
    static internal string FindKey(SortedList<string, string> items, string key, string defValue)
    {
      string ret;




      if (items.TryGetValue(key, out ret)) return ret;


      return defValue;
    }

    /// <summary>
    /// Opens the connection using the parameters found in the <see cref="ConnectionString">ConnectionString</see>
    /// </summary>
    public override void Open()
    {
      if (_connectionState != ConnectionState.Closed)
        throw new InvalidOperationException();

      Close();

      SortedList<string, string> opts = ParseConnectionString();
      string fileName;

      if (Convert.ToInt32(FindKey(opts, "Version", "3"), CultureInfo.InvariantCulture) != 3)
        throw new NotSupportedException("Only SQLite Version 3 is supported at this time");

      fileName = FindKey(opts, "Data Source", "");

      if (String.IsNullOrEmpty(fileName))
        throw new ArgumentException("Data Source cannot be empty.  Use :memory: to open an in-memory database");

      if (String.Compare(fileName, ":MEMORY:", true, CultureInfo.InvariantCulture) == 0)
        fileName = ":memory:";
#if PLATFORM_COMPACTFRAMEWORK
      else if (fileName.StartsWith(".\\"))
        fileName = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetCallingAssembly().GetName().CodeBase) + fileName.Substring(1);
#endif
      try
      {
        bool usePooling = (Convert.ToBoolean(FindKey(opts, "Pooling", Boolean.FalseString), CultureInfo.CurrentCulture) == true);
        bool bUTF16 = (Convert.ToBoolean(FindKey(opts, "UseUTF16Encoding", Boolean.FalseString), CultureInfo.CurrentCulture) == true);
        SQLiteDateFormats dateFormat = String.Compare(FindKey(opts, "DateTimeFormat", "ISO8601"), "ticks", true, CultureInfo.InvariantCulture) == 0 ? SQLiteDateFormats.Ticks : SQLiteDateFormats.ISO8601;

        if (bUTF16) // SQLite automatically sets the encoding of the database to UTF16 if called from sqlite3_open16()
          _sql = new SQLite3_UTF16(dateFormat);
        else
          _sql = new SQLite3(dateFormat);

        fileName = ExpandFileName(fileName);

        if (Convert.ToBoolean(FindKey(opts, "FailIfMissing", Boolean.FalseString), CultureInfo.CurrentCulture) == true)
        {
          try
          {
            // Try and open the file, and keep it open while SQLite tries to open it -- otherwise its possible it could be deleted between calls in a race
            // condition.
            using (System.IO.FileStream fs = new System.IO.FileStream(fileName, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.ReadWrite))
            {
              _sql.Open(fileName, usePooling);

            }
          }
          catch (Exception e)
          {
            throw new SQLiteException("Unable to open database file", e);
          }
        }
        else // This will create the database if it doesn't exist.
          _sql.Open(fileName, usePooling);

        _binaryGuid = (Convert.ToBoolean(FindKey(opts, "BinaryGUID", Boolean.TrueString), CultureInfo.CurrentCulture) == true);

        string password = FindKey(opts, "Password", null);

        if (String.IsNullOrEmpty(password) == false)
          _sql.SetPassword(System.Text.UTF8Encoding.UTF8.GetBytes(password));
        else if (_password != null)
          _sql.SetPassword(_password);
        _password = null;

        _dataSource = System.IO.Path.GetFileNameWithoutExtension(fileName);

        OnStateChange(ConnectionState.Open);
        _version++;

        using (SQLiteCommand cmd = CreateCommand())
        {
          string defValue;















          if (fileName != ":memory:")
          {
            defValue = FindKey(opts, "Page Size", "1024");
            if (Convert.ToInt32(defValue) != 1024)
            {
              cmd.CommandText = String.Format(CultureInfo.InvariantCulture, "PRAGMA page_size={0}", defValue);
              cmd.ExecuteNonQuery();
            }
          }

          defValue = FindKey(opts, "Max Page Count", "0");
          if (Convert.ToInt32(defValue) != 0)
          {
            cmd.CommandText = String.Format(CultureInfo.InvariantCulture, "PRAGMA max_page_count={0}", defValue);
            cmd.ExecuteNonQuery();
          }

          defValue = FindKey(opts, "Legacy Format", Boolean.TrueString);
          cmd.CommandText = String.Format(CultureInfo.InvariantCulture, "PRAGMA legacy_file_format={0}", Convert.ToBoolean(defValue, CultureInfo.InvariantCulture) == true ? "ON" : "OFF");
          cmd.ExecuteNonQuery();

          defValue = FindKey(opts, "Synchronous", "Normal");
          if (String.Compare(defValue, "Full", StringComparison.OrdinalIgnoreCase) != 0)
            cmd.CommandText = String.Format(CultureInfo.InvariantCulture, "PRAGMA synchronous={0}", defValue);
          cmd.ExecuteNonQuery();

          defValue = FindKey(opts, "Cache Size", "2000");
          if (Convert.ToInt32(defValue) != 2000)
          {
            cmd.CommandText = String.Format(CultureInfo.InvariantCulture, "PRAGMA cache_size={0}", defValue);
            cmd.ExecuteNonQuery();
          }
        }

#if !PLATFORM_COMPACTFRAMEWORK
        if (Transactions.Transaction.Current != null && (FindKey(opts, "Enlist", "Y").ToUpper()[0] == 'Y'
             || Convert.ToBoolean(FindKey(opts, "Enlist", "True"), CultureInfo.CurrentCulture) == true))
          EnlistTransaction(Transactions.Transaction.Current);
#endif
      }
      catch (SQLiteException)
      {
        Close();
        throw;
      }
    }

    /// <summary>
    /// Returns the version of the underlying SQLite database engine
    /// </summary>
946
947
948
949
950
951
952




953
954
955
956
957
958
959
        {
          if (sourceFile[_dataDirectory.Length] == System.IO.Path.DirectorySeparatorChar ||
              sourceFile[_dataDirectory.Length] == System.IO.Path.AltDirectorySeparatorChar)
            sourceFile = sourceFile.Remove(_dataDirectory.Length, 1);
        }
        sourceFile = System.IO.Path.Combine(dataDirectory, sourceFile.Substring(_dataDirectory.Length));
      }





      return sourceFile;
    }
    ///<overloads>
    /// The following commands are used to extract schema information out of the database.  Valid schema types are:
    /// <list type="bullet">
    /// <item>







>
>
>
>







1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
        {
          if (sourceFile[_dataDirectory.Length] == System.IO.Path.DirectorySeparatorChar ||
              sourceFile[_dataDirectory.Length] == System.IO.Path.AltDirectorySeparatorChar)
            sourceFile = sourceFile.Remove(_dataDirectory.Length, 1);
        }
        sourceFile = System.IO.Path.Combine(dataDirectory, sourceFile.Substring(_dataDirectory.Length));
      }

#if !PLATFORM_COMPACTFRAMEWORK
      sourceFile = System.IO.Path.GetFullPath(sourceFile);
#endif

      return sourceFile;
    }
    ///<overloads>
    /// The following commands are used to extract schema information out of the database.  Valid schema types are:
    /// <list type="bullet">
    /// <item>
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
        case "DATASOURCEINFORMATION":
          return Schema_DataSourceInformation();
        case "DATATYPES":
          return Schema_DataTypes();
        case "COLUMNS":
          return Schema_Columns(parms[0], parms[2], parms[3]);
        case "INDEXES":
          return Schema_Indexes(parms[0], parms[2], parms[4]);
        case "INDEXCOLUMNS":
          return Schema_IndexColumns(parms[0], parms[2], parms[3], parms[4]);
        case "TABLES":
          return Schema_Tables(parms[0], parms[2], parms[3]);
        case "VIEWS":
          return Schema_Views(parms[0], parms[2]);
        case "VIEWCOLUMNS":







|







1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
        case "DATASOURCEINFORMATION":
          return Schema_DataSourceInformation();
        case "DATATYPES":
          return Schema_DataTypes();
        case "COLUMNS":
          return Schema_Columns(parms[0], parms[2], parms[3]);
        case "INDEXES":
          return Schema_Indexes(parms[0], parms[2], parms[3]);
        case "INDEXCOLUMNS":
          return Schema_IndexColumns(parms[0], parms[2], parms[3], parms[4]);
        case "TABLES":
          return Schema_Tables(parms[0], parms[2], parms[3]);
        case "VIEWS":
          return Schema_Views(parms[0], parms[2]);
        case "VIEWCOLUMNS":
1870
1871
1872
1873
1874
1875
1876
1877
1878

1879
1880

1881


1882
1883
1884
1885
1886

1887
1888

1889
1890

1891
1892

1893
1894

1895
1896
1897
1898


1899
1900
1901
1902
1903
1904





1905
1906
1907
1908
1909
1910
1911

      tbl.EndLoadData();
      tbl.AcceptChanges();

      return tbl;
    }

    internal void AddCommand(SQLiteCommand cmd)
    {

      lock (_commandList)
      {

        _commandList.Add(new WeakReference(cmd, false));


      }
    }

    internal void RemoveCommand(SQLiteCommand cmd)
    {

      lock (_commandList)
      {

        foreach (WeakReference r in _commandList)
        {

          try
          {

            if (r.Target as SQLiteCommand == cmd)
            {

              _commandList.Remove(r);
              return;
            }
          }


          catch
          {
          }
        }
      }
    }





  }

  /// <summary>
  /// The I/O file cache flushing behavior for the connection
  /// </summary>
  public enum SynchronizationModes
  {







|
<
>
|
<
>
|
>
>
|
<
<
|
<
>
|
<
>
|
<
>
|
<
>
|
<
>
|
|
<
<
>
>
|
<
<
<
<
<
>
>
>
>
>







1933
1934
1935
1936
1937
1938
1939
1940

1941
1942

1943
1944
1945
1946
1947


1948

1949
1950

1951
1952

1953
1954

1955
1956

1957
1958
1959


1960
1961
1962





1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974

      tbl.EndLoadData();
      tbl.AcceptChanges();

      return tbl;
    }

    //internal void AddCommand(SQLiteCommand cmd)

    //{
    //  lock (_commandList)

    //  {
    //    _commandList.Add(new WeakReference(cmd, false));
    //  }
    //}



    //internal void RemoveCommand(SQLiteCommand cmd)

    //{
    //  lock (_commandList)

    //  {
    //    foreach (WeakReference r in _commandList)

    //    {
    //      try

    //      {
    //        if (r.Target as SQLiteCommand == cmd)

    //        {
    //          _commandList.Remove(r);
    //          return;


    //        }
    //      }
    //      catch





    //      {
    //      }
    //    }
    //  }
    //}
  }

  /// <summary>
  /// The I/O file cache flushing behavior for the connection
  /// </summary>
  public enum SynchronizationModes
  {
Added System.Data.SQLite/SQLiteConnectionPool.cs.






































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace System.Data.SQLite
{
  using System;
  using System.Collections.Generic;

  internal static class SQLiteConnectionPool
  {
    private static SortedList<string, Queue<WeakReference>> _connections = new SortedList<string, Queue<WeakReference>>(StringComparer.OrdinalIgnoreCase);
    
    internal static SQLiteConnectionHandle Remove(string fileName)
    {
      lock (_connections)
      {
        Queue<WeakReference> queue;

        if (_connections.TryGetValue(fileName, out queue) == false) return null;

        while (queue.Count > 0)
        {
          WeakReference cnn = queue.Dequeue();
          SQLiteConnectionHandle hdl = cnn.Target as SQLiteConnectionHandle;
          if (hdl != null)
            return hdl;
        }
        return null;
      }
    }

    internal static void Add(string fileName, SQLiteConnectionHandle hdl)
    {
      lock (_connections)
      {
        Queue<WeakReference> queue;
        if (_connections.TryGetValue(fileName, out queue) == false)
        {
          queue = new Queue<WeakReference>();
          _connections.Add(fileName, queue);
        }
        queue.Enqueue(new WeakReference(hdl, false));
        GC.KeepAlive(hdl);
      }
    }
  }
}
Changes to System.Data.SQLite/SQLiteConnectionStringBuilder.cs.
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96



97

98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113


114
115
116
117
118
119
120







































121
122
123
124
125
126

127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151

152

153


154

















155
156
157
158
159
160

161
162
163
164
165

166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189

190
191
192
193
194
195
196
197




















198
199
200
201
202
203
204
205
206
207
208

209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226

227
228
229

230
231
232
233
234
235
236
    /// </summary>
    [Browsable(true)]
    [DefaultValue(3)]
    public int Version
    {
      get
      {
        if (ContainsKey("Version") == false) return 3;

        return Convert.ToInt32(this["Version"], CultureInfo.CurrentCulture);
      }
      set
      {
        if (value != 3)
          throw new NotSupportedException();

        this["Version"] = value;
      }
    }

    /// <summary>
    /// Gets/Sets the synchronous mode of the connection string.  Default is "Normal".
    /// </summary>
    [DisplayName("Synchronous")]
    [Browsable(true)]
    [DefaultValue(SynchronizationModes.Normal)]
    public SynchronizationModes SyncMode
    {
      get
      {



        return (SynchronizationModes)TypeDescriptor.GetConverter(typeof(SynchronizationModes)).ConvertFrom(this["Synchronous"]);

      }
      set
      {
        this["Synchronous"] = value;
      }
    }

    /// <summary>
    /// Gets/Sets the encoding for the connection string.  The default is "False" which indicates UTF-8 encoding.
    /// </summary>
    [Browsable(true)]
    [DefaultValue(false)]
    public bool UseUTF16Encoding
    {
      get
      {


        return Convert.ToBoolean(this["UseUTF16Encoding"], CultureInfo.CurrentCulture);
      }
      set
      {
        this["UseUTF16Encoding"] = value;
      }
    }








































    /// <summary>
    /// Gets/Sets the filename to open on the connection string.
    /// </summary>
    [DisplayName("Data Source")]
    [Browsable(true)]

    public string DataSource
    {
      get
      {
        if (ContainsKey("Data Source") == false) return "";

        return this["Data Source"].ToString();
      }
      set
      {
        this["Data Source"] = value;
      }
    }

    /// <summary>
    /// Determines whether or not the connection will automatically participate
    /// in the current distributed transaction (if one exists)
    /// </summary>
    [DisplayName("Automatic Enlistment")]
    [Browsable(true)]
    [DefaultValue(true)]
    public bool Enlist
    {
      get
      {

        if (ContainsKey("Enlist") == false) return true;




        return (this["Enlist"].ToString() == "Y");

















      }
      set
      {
        this["Enlist"] = (value == true) ? "Y" : "N";
      }
    }

    /// <summary>
    /// Gets/sets the database encryption password
    /// </summary>
    [Browsable(true)]
    [PasswordPropertyText(true)]

    public string Password
    {
      get
      {
        if (ContainsKey("Password") == false) return "";

        return this["Password"].ToString();
      }
      set
      {
        this["Password"] = value;
      }
    }

    /// <summary>
    /// Gets/Sets the page size for the connection.
    /// </summary>
    [DisplayName("Page Size")]
    [Browsable(true)]
    [DefaultValue(1024)]
    public int PageSize
    {
      get
      {

        if (ContainsKey("Page Size") == false) return 1024;
        return Convert.ToInt32(this["Page Size"], CultureInfo.InvariantCulture);
      }
      set
      {
        this["Page Size"] = value;
      }
    }





















    /// <summary>
    /// Gets/Sets the cache size for the connection.
    /// </summary>
    [DisplayName("Cache Size")]
    [Browsable(true)]
    [DefaultValue(2000)]
    public int CacheSize
    {
      get
      {

        if (ContainsKey("Cache Size") == false) return 2000;
        return Convert.ToInt32(this["Cache Size"], CultureInfo.InvariantCulture);
      }
      set
      {
        this["Cache Size"] = value;
      }
    }

    /// <summary>
    /// Gets/Sets the datetime format for the connection.
    /// </summary>
    [Browsable(true)]
    [DefaultValue(SQLiteDateFormats.ISO8601)]
    public SQLiteDateFormats DateTimeFormat
    {
      get
      {

        if (ContainsKey("DateTimeFormat") == false) return SQLiteDateFormats.ISO8601;

        return (SQLiteDateFormats)TypeDescriptor.GetConverter(typeof(SQLiteDateFormats)).ConvertFrom(this["DateTimeFormat"]);

      }
      set
      {
        this["DateTimeFormat"] = value;
      }
    }








|
|
|




















>
>
>
|
>
















>
>
|






>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>






>




|
|
|











<






>
|
>
|
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>



|


>





>




|
|
|

















>
|
|






>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>











>
|
|
















>
|
|
|
>







67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190

191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
    /// </summary>
    [Browsable(true)]
    [DefaultValue(3)]
    public int Version
    {
      get
      {
        object value;
        TryGetValue("Version", out value);
        return Convert.ToInt32(value, CultureInfo.CurrentCulture);
      }
      set
      {
        if (value != 3)
          throw new NotSupportedException();

        this["Version"] = value;
      }
    }

    /// <summary>
    /// Gets/Sets the synchronous mode of the connection string.  Default is "Normal".
    /// </summary>
    [DisplayName("Synchronous")]
    [Browsable(true)]
    [DefaultValue(SynchronizationModes.Normal)]
    public SynchronizationModes SyncMode
    {
      get
      {
        object value;
        TryGetValue("Synchronous", out value);
        if (value is string)
          return (SynchronizationModes)TypeDescriptor.GetConverter(typeof(SynchronizationModes)).ConvertFrom(value);
        else return (SynchronizationModes)value;
      }
      set
      {
        this["Synchronous"] = value;
      }
    }

    /// <summary>
    /// Gets/Sets the encoding for the connection string.  The default is "False" which indicates UTF-8 encoding.
    /// </summary>
    [Browsable(true)]
    [DefaultValue(false)]
    public bool UseUTF16Encoding
    {
      get
      {
        object value;
        TryGetValue("UseUTF16Encoding", out value);
        return Convert.ToBoolean(value, CultureInfo.CurrentCulture);
      }
      set
      {
        this["UseUTF16Encoding"] = value;
      }
    }

    /// <summary>
    /// Gets/Sets whether or not to use connection pooling.  The default is "False"
    /// </summary>
    [Browsable(true)]
    [DefaultValue(false)]
    public bool Pooling
    {
      get
      {
        object value;
        TryGetValue("Pooling", out value);
        return Convert.ToBoolean(value, CultureInfo.CurrentCulture);
      }
      set
      {
        this["Pooling"] = value;
      }
    }

    /// <summary>
    /// Gets/Sets whethor not to store GUID's in binary format.  The default is True
    /// which saves space in the database.
    /// </summary>
    [Browsable(true)]
    [DefaultValue(true)]
    public bool BinaryGUID
    {
      get
      {
        object value;
        TryGetValue("BinaryGUID", out value);
        return Convert.ToBoolean(value, CultureInfo.CurrentCulture);
      }
      set
      {
        this["BinaryGUID"] = value;
      }
    }

    /// <summary>
    /// Gets/Sets the filename to open on the connection string.
    /// </summary>
    [DisplayName("Data Source")]
    [Browsable(true)]
    [DefaultValue("")]
    public string DataSource
    {
      get
      {
        object value;
        TryGetValue("Data Source", out value);
        return value.ToString();
      }
      set
      {
        this["Data Source"] = value;
      }
    }

    /// <summary>
    /// Determines whether or not the connection will automatically participate
    /// in the current distributed transaction (if one exists)
    /// </summary>

    [Browsable(true)]
    [DefaultValue(true)]
    public bool Enlist
    {
      get
      {
        object value;
        TryGetValue("Enlist", out value);
        return Convert.ToBoolean(value, CultureInfo.CurrentCulture);
      }
      set
      {
        this["Enlist"] = value;
      }
    }

    /// <summary>
    /// If enabled, uses the legacy 3.xx format for maximum compatibility, but results in larger
    /// database sizes.
    /// </summary>
    [DisplayName("Legacy Format")]
    [Browsable(true)]
    [DefaultValue(true)]
    public bool LegacyFormat
    {
      get
      {
        object value;
        TryGetValue("Legacy Format", out value);
        return Convert.ToBoolean(value, CultureInfo.CurrentCulture);
      }
      set
      {
        this["Legacy Format"] = value;
      }
    }

    /// <summary>
    /// Gets/sets the database encryption password
    /// </summary>
    [Browsable(true)]
    [PasswordPropertyText(true)]
    [DefaultValue("")]
    public string Password
    {
      get
      {
        object value;
        TryGetValue("Password", out value);
        return value.ToString();
      }
      set
      {
        this["Password"] = value;
      }
    }

    /// <summary>
    /// Gets/Sets the page size for the connection.
    /// </summary>
    [DisplayName("Page Size")]
    [Browsable(true)]
    [DefaultValue(1024)]
    public int PageSize
    {
      get
      {
        object value;
        TryGetValue("Page Size", out value);
        return Convert.ToInt32(value, CultureInfo.CurrentCulture);
      }
      set
      {
        this["Page Size"] = value;
      }
    }

    /// <summary>
    /// Gets/Sets the maximum number of pages the database may hold
    /// </summary>
    [DisplayName("Max Page Count")]
    [Browsable(true)]
    [DefaultValue(0)]
    public int MaxPageCount
    {
      get
      {
        object value;
        TryGetValue("Max Page Count", out value);
        return Convert.ToInt32(value, CultureInfo.CurrentCulture);
      }
      set
      {
        this["Max Page Count"] = value;
      }
    }

    /// <summary>
    /// Gets/Sets the cache size for the connection.
    /// </summary>
    [DisplayName("Cache Size")]
    [Browsable(true)]
    [DefaultValue(2000)]
    public int CacheSize
    {
      get
      {
        object value;
        TryGetValue("Cache Size", out value);
        return Convert.ToInt32(value, CultureInfo.CurrentCulture);
      }
      set
      {
        this["Cache Size"] = value;
      }
    }

    /// <summary>
    /// Gets/Sets the datetime format for the connection.
    /// </summary>
    [Browsable(true)]
    [DefaultValue(SQLiteDateFormats.ISO8601)]
    public SQLiteDateFormats DateTimeFormat
    {
      get
      {
        object value;
        TryGetValue("DateTimeFormat", out value);
        if (value is string)
          return (SQLiteDateFormats)TypeDescriptor.GetConverter(typeof(SQLiteDateFormats)).ConvertFrom(value);
        else return (SQLiteDateFormats)value;
      }
      set
      {
        this["DateTimeFormat"] = value;
      }
    }

Changes to System.Data.SQLite/SQLiteConvert.cs.
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
    /// </summary>
    ISO8601 = 1,
  }

  /// <summary>
  /// Struct used internally to determine the datatype of a column in a resultset
  /// </summary>
  internal struct SQLiteType
  {
    /// <summary>
    /// The DbType of the column, or DbType.Object if it cannot be determined
    /// </summary>
    internal DbType Type;
    /// <summary>
    /// The affinity of a column, used for expressions or when Type is DbType.Object







|







75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
    /// </summary>
    ISO8601 = 1,
  }

  /// <summary>
  /// Struct used internally to determine the datatype of a column in a resultset
  /// </summary>
  internal class SQLiteType
  {
    /// <summary>
    /// The DbType of the column, or DbType.Object if it cannot be determined
    /// </summary>
    internal DbType Type;
    /// <summary>
    /// The affinity of a column, used for expressions or when Type is DbType.Object
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359

    #region Type Conversions
    /// <summary>
    /// Determines the data type of a column in a statement
    /// </summary>
    /// <param name="stmt">The statement to retrieve information for</param>
    /// <param name="i">The column to retrieve type information on</param>
    /// <returns>Returns a SQLiteType struct</returns>
    internal static SQLiteType ColumnToType(SQLiteStatement stmt, int i)
    {
      SQLiteType typ;

      typ.Type = TypeNameToDbType(stmt._sql.ColumnType(stmt, i, out typ.Affinity));

      return typ;
    }

    /// <summary>
    /// Converts a SQLiteType to a .NET Type object
    /// </summary>
    /// <param name="t">The SQLiteType to convert</param>
    /// <returns>Returns a .NET Type object</returns>







|
|

<
<

<
<







338
339
340
341
342
343
344
345
346
347


348


349
350
351
352
353
354
355

    #region Type Conversions
    /// <summary>
    /// Determines the data type of a column in a statement
    /// </summary>
    /// <param name="stmt">The statement to retrieve information for</param>
    /// <param name="i">The column to retrieve type information on</param>
    /// <param name="typ">The SQLiteType to receive the affinity for the given column</param>
    internal static void ColumnToType(SQLiteStatement stmt, int i, SQLiteType typ)
    {


      typ.Type = TypeNameToDbType(stmt._sql.ColumnType(stmt, i, out typ.Affinity));


    }

    /// <summary>
    /// Converts a SQLiteType to a .NET Type object
    /// </summary>
    /// <param name="t">The SQLiteType to convert</param>
    /// <returns>Returns a .NET Type object</returns>
Changes to System.Data.SQLite/SQLiteDataAdapter.cs.
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
  using System.ComponentModel;

  /// <summary>
  /// SQLite implementation of DbDataAdapter.
  /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
  [DefaultEvent("RowUpdated")]
  [ToolboxItem("SQLite.Designer.SQLiteDataAdapterToolboxItem, SQLite.Designer, Version=1.0.31.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139")]
  [Designer("Microsoft.VSDesigner.Data.VS.SqlDataAdapterDesigner, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
#endif
  public sealed class SQLiteDataAdapter : DbDataAdapter
  {
    private static object _updatingEventPH = new object();
    private static object _updatedEventPH = new object();








|







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
  using System.ComponentModel;

  /// <summary>
  /// SQLite implementation of DbDataAdapter.
  /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
  [DefaultEvent("RowUpdated")]
  [ToolboxItem("SQLite.Designer.SQLiteDataAdapterToolboxItem, SQLite.Designer, Version=1.0.32.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139")]
  [Designer("Microsoft.VSDesigner.Data.VS.SqlDataAdapterDesigner, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
#endif
  public sealed class SQLiteDataAdapter : DbDataAdapter
  {
    private static object _updatingEventPH = new object();
    private static object _updatedEventPH = new object();

Changes to System.Data.SQLite/SQLiteDataReader.cs.
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
    internal SQLiteDataReader(SQLiteCommand cmd, CommandBehavior behave)
    {
      _command = cmd;
      _commandBehavior = behave;
      _activeStatementIndex = -1;
      _activeStatement = null;
      _rowsAffected = -1;
      _fieldCount = -1;

      if (_command != null)
        NextResult();
    }

    /// <summary>
    /// Closes the datareader, potentially closing the connection as well if CommandBehavior.CloseConnection was specified.







|







75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
    internal SQLiteDataReader(SQLiteCommand cmd, CommandBehavior behave)
    {
      _command = cmd;
      _commandBehavior = behave;
      _activeStatementIndex = -1;
      _activeStatement = null;
      _rowsAffected = -1;
      _fieldCount = 0;

      if (_command != null)
        NextResult();
    }

    /// <summary>
    /// Closes the datareader, potentially closing the connection as well if CommandBehavior.CloseConnection was specified.
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
      if (_keyInfo != null)
      {
        _keyInfo.Dispose();
        _keyInfo = null;
      }
    }

    /// <summary>
    /// Disposes the datareader.  Base class calls Close() to ensure everything is cleaned up.
    /// </summary>
    protected override void Dispose(bool disposing)
    {
      base.Dispose(disposing);
    }

    /// <summary>
    /// Throw an error if the datareader is closed
    /// </summary>
    private void CheckClosed()
    {
      if (_command == null)
        throw new InvalidOperationException("DataReader has been closed");







<
<
<
<
<
<
<
<







112
113
114
115
116
117
118








119
120
121
122
123
124
125
      if (_keyInfo != null)
      {
        _keyInfo.Dispose();
        _keyInfo = null;
      }
    }









    /// <summary>
    /// Throw an error if the datareader is closed
    /// </summary>
    private void CheckClosed()
    {
      if (_command == null)
        throw new InvalidOperationException("DataReader has been closed");
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
    /// </returns>
    /// <param name="i">The index of the column to type-check</param>
    /// <param name="typ">The type we want to get out of the column</param>
    private TypeAffinity VerifyType(int i, DbType typ)
    {
      CheckClosed();
      CheckValidRow();
      TypeAffinity affinity;

      affinity = _activeStatement._sql.ColumnAffinity(_activeStatement, i);

      switch (affinity)
      {
        case TypeAffinity.Int64:
          if (typ == DbType.Int16) return affinity;
          if (typ == DbType.Int32) return affinity;
          if (typ == DbType.Int64) return affinity;
          if (typ == DbType.Boolean) return affinity;
          if (typ == DbType.Byte) return affinity;
          if (typ == DbType.DateTime && _command.Connection._sql._datetimeFormat == SQLiteDateFormats.Ticks) return affinity;
          if (typ == DbType.Single) return affinity;
          if (typ == DbType.Double) return affinity;
          if (typ == DbType.Decimal) return affinity;
          break;
        case TypeAffinity.Double:
          if (typ == DbType.Single) return affinity;
          if (typ == DbType.Double) return affinity;







|
<
<









|







195
196
197
198
199
200
201
202


203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
    /// </returns>
    /// <param name="i">The index of the column to type-check</param>
    /// <param name="typ">The type we want to get out of the column</param>
    private TypeAffinity VerifyType(int i, DbType typ)
    {
      CheckClosed();
      CheckValidRow();
      TypeAffinity affinity = GetSQLiteType(i).Affinity;



      switch (affinity)
      {
        case TypeAffinity.Int64:
          if (typ == DbType.Int16) return affinity;
          if (typ == DbType.Int32) return affinity;
          if (typ == DbType.Int64) return affinity;
          if (typ == DbType.Boolean) return affinity;
          if (typ == DbType.Byte) return affinity;
          if (typ == DbType.DateTime) return affinity;
          if (typ == DbType.Single) return affinity;
          if (typ == DbType.Double) return affinity;
          if (typ == DbType.Decimal) return affinity;
          break;
        case TypeAffinity.Double:
          if (typ == DbType.Single) return affinity;
          if (typ == DbType.Double) return affinity;
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
      CheckClosed();

      if (i >= VisibleFieldCount && _keyInfo != null)
        return _keyInfo.GetValue(i - VisibleFieldCount);

      SQLiteType typ = GetSQLiteType(i);

      // Because SQLite is inherently type-less, check this column and row's type
      // against the cache.  If they're different, then the db owner put varying datatypes in 
      // this column.  If that's the case, then stick with using SQLite's base datatypes rather
      // than the richer declared type in the table schema.
      if (typ.Type != DbType.Object)
      {
        TypeAffinity aff = _activeStatement._sql.ColumnAffinity(_activeStatement, i);
        if (aff != typ.Affinity)
        {
          typ.Type = DbType.Object;
          typ.Affinity = aff;
        }
      }

      return _activeStatement._sql.GetValue(_activeStatement, i, ref typ);
    }

    /// <summary>
    /// Retreives the values of multiple columns, up to the size of the supplied array
    /// </summary>
    /// <param name="values">The array to fill with values from the columns in the current resultset</param>
    /// <returns>The number of columns retrieved</returns>







<
<
<
<
<
<
<
<
<
<
<
<
<
<
|







742
743
744
745
746
747
748














749
750
751
752
753
754
755
756
      CheckClosed();

      if (i >= VisibleFieldCount && _keyInfo != null)
        return _keyInfo.GetValue(i - VisibleFieldCount);

      SQLiteType typ = GetSQLiteType(i);















      return _activeStatement._sql.GetValue(_activeStatement, i, typ);
    }

    /// <summary>
    /// Retreives the values of multiple columns, up to the size of the supplied array
    /// </summary>
    /// <param name="values">The array to fill with values from the columns in the current resultset</param>
    /// <returns>The number of columns retrieved</returns>
916
917
918
919
920
921
922




923
924







925
926


















927
928
929
930
931
932
933
934
    /// <summary>
    /// Retrieves the SQLiteType for a given column, and caches it to avoid repetetive interop calls.
    /// </summary>
    /// <param name="i">The index of the column to retrieve</param>
    /// <returns>A SQLiteType structure</returns>
    private SQLiteType GetSQLiteType(int i)
    {




      if (_fieldTypeArray == null) _fieldTypeArray = new SQLiteType[VisibleFieldCount];








      if (_fieldTypeArray[i].Affinity == TypeAffinity.Uninitialized)
        _fieldTypeArray[i].Type = SQLiteConvert.TypeNameToDbType(_activeStatement._sql.ColumnType(_activeStatement, i, out _fieldTypeArray[i].Affinity));


















      return _fieldTypeArray[i];
    }

    /// <summary>
    /// Reads the next row from the resultset
    /// </summary>
    /// <returns>True if a new row was successfully loaded and is ready for processing</returns>
    public override bool Read()







>
>
>
>
|

>
>
>
>
>
>
>
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|







892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
    /// <summary>
    /// Retrieves the SQLiteType for a given column, and caches it to avoid repetetive interop calls.
    /// </summary>
    /// <param name="i">The index of the column to retrieve</param>
    /// <returns>A SQLiteType structure</returns>
    private SQLiteType GetSQLiteType(int i)
    {
      SQLiteType typ;

      // Initialize the field types array if not already initialized
      if (_fieldTypeArray == null)
        _fieldTypeArray = new SQLiteType[VisibleFieldCount];

      // Initialize this column's field type instance
      if (_fieldTypeArray[i] == null) _fieldTypeArray[i] = new SQLiteType();

      typ = _fieldTypeArray[i];

      // If not initialized, then fetch the declared column datatype and attempt to convert it 
      // to a known DbType.
      if (typ.Affinity == TypeAffinity.Uninitialized)
        typ.Type = SQLiteConvert.TypeNameToDbType(_activeStatement._sql.ColumnType(_activeStatement, i, out typ.Affinity));
      else if (typ.Type != DbType.Object)
      {
        TypeAffinity newaffinity = _activeStatement._sql.ColumnAffinity(_activeStatement, i);

        // If the affinity of a column changes over time, then the database must be taking advantage of
        // SQLite's typelessness.  So we have to fallback to using basic SQLite affinities instead of the
        // column's declared type.
        // The exceptions to the rule are DateTime, which can be Int64 or Text, and Guid which can be Blob or Text.
        // If either of those is the case, then allow the variation row to row.
        if (newaffinity != typ.Affinity && newaffinity != TypeAffinity.Null && typ.Affinity != TypeAffinity.Null
          && !(typ.Type == DbType.Guid && (newaffinity == TypeAffinity.Blob || newaffinity == TypeAffinity.Text))
          && !(typ.Type == DbType.DateTime && (newaffinity == TypeAffinity.Text || newaffinity == TypeAffinity.Int64))
          )
          typ.Type = DbType.Object;

        typ.Affinity = newaffinity;
      }

      return typ;
    }

    /// <summary>
    /// Reads the next row from the resultset
    /// </summary>
    /// <returns>True if a new row was successfully loaded and is ready for processing</returns>
    public override bool Read()
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
    }

    /// <summary>
    /// Retrieve the count of records affected by an update/insert command.  Only valid once the data reader is closed!
    /// </summary>
    public override int RecordsAffected
    {
      get { return _rowsAffected; }
    }

    /// <summary>
    /// Indexer to retrieve data from a column given its name
    /// </summary>
    /// <param name="name">The name of the column to retrieve data for</param>
    /// <returns>The value contained in the column</returns>







|







962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
    }

    /// <summary>
    /// Retrieve the count of records affected by an update/insert command.  Only valid once the data reader is closed!
    /// </summary>
    public override int RecordsAffected
    {
      get { return (_rowsAffected < 0) ? 0 : _rowsAffected; }
    }

    /// <summary>
    /// Indexer to retrieve data from a column given its name
    /// </summary>
    /// <param name="name">The name of the column to retrieve data for</param>
    /// <returns>The value contained in the column</returns>
Changes to System.Data.SQLite/SQLiteFactory.cs.
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
  using System;
  using System.Data.Common;

#if !PLATFORM_COMPACTFRAMEWORK
  /// <summary>
  /// SQLite implementation of DbProviderFactory.
  /// </summary>
  public sealed class SQLiteFactory : DbProviderFactory
  {
    /// <summary>
    /// Static instance member which returns an instanced SQLiteFactory class.
    /// </summary>
    public static readonly SQLiteFactory Instance = new SQLiteFactory();

    /// <summary>







|







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
  using System;
  using System.Data.Common;

#if !PLATFORM_COMPACTFRAMEWORK
  /// <summary>
  /// SQLite implementation of DbProviderFactory.
  /// </summary>
  public sealed partial class SQLiteFactory : DbProviderFactory
  {
    /// <summary>
    /// Static instance member which returns an instanced SQLiteFactory class.
    /// </summary>
    public static readonly SQLiteFactory Instance = new SQLiteFactory();

    /// <summary>
Changes to System.Data.SQLite/SQLiteFunction.cs.
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
    /// <summary>
    /// The base connection this function is attached to
    /// </summary>
    private SQLiteBase              _base;
    /// <summary>
    /// Used internally to keep track of memory allocated for aggregate functions
    /// </summary>
    private IntPtr                     _interopCookie;
    /// <summary>
    /// Internal array used to keep track of aggregate function context data
    /// </summary>
    private Dictionary<long, object> _contextDataList;

    /// <summary>
    /// Holds a reference to the callback function for user functions







|







74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
    /// <summary>
    /// The base connection this function is attached to
    /// </summary>
    private SQLiteBase              _base;
    /// <summary>
    /// Used internally to keep track of memory allocated for aggregate functions
    /// </summary>
    private SQLiteFunctionCookieHandle _interopCookie;
    /// <summary>
    /// Internal array used to keep track of aggregate function context data
    /// </summary>
    private Dictionary<long, object> _contextDataList;

    /// <summary>
    /// Holds a reference to the callback function for user functions
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
      }

      SQLiteFunction[] arFunctions = new SQLiteFunction[lFunctions.Count];
      lFunctions.CopyTo(arFunctions, 0);

      return arFunctions;
    }

    /// <summary>
    /// Issued after the base connection is closed, this function cleans up all user-defined functions and disposes of them.
    /// </summary>
    /// <remarks>
    /// Cleaning up here is done mainly because of the interop wrapper.  It allocated memory to hold a reference to all the
    /// delegates, and now must free that memory.
    /// Freeing is done after the connection is closed to ensure no callbacks get hit after we've freed the cookie.
    /// </remarks>
    /// <param name="sqlbase">The base SQLite connection object</param>
    /// <param name="ar">An array of user-defined functions for this object</param>
    internal static void UnbindFunctions(SQLiteBase sqlbase, SQLiteFunction[] ar)
    {
      if (ar == null) return;

      int x = ar.Length;
      for (int n = 0; n < x; n++)
      {
        sqlbase.FreeFunction(ar[n]._interopCookie);
        ar[n].Dispose();
      }
    }
  }
}







|
<
<
<
<
<
<
<
<
<
<
<
<
<
|
<
<
<
<
<
<
<
<
<
521
522
523
524
525
526
527
528













529









      }

      SQLiteFunction[] arFunctions = new SQLiteFunction[lFunctions.Count];
      lFunctions.CopyTo(arFunctions, 0);

      return arFunctions;
    }
  }













}









Changes to System.Data.SQLite/System.Data.SQLite.
49
50
51
52
53
54
55






56
57
58
59
60
61
62
63
64
65
66
67

68
69
70
71
72
73
74
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Transactions" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="AssemblyInfo.cs" />






    <Compile Include="SQLite3.cs" />
    <Compile Include="SQLite3_UTF16.cs" />
    <Compile Include="SQLiteBase.cs" />
    <Compile Include="SQLiteCommand.cs">
      <SubType>Component</SubType>
    </Compile>
    <Compile Include="SQLiteCommandBuilder.cs">
      <SubType>Component</SubType>
    </Compile>
    <Compile Include="SQLiteConnection.cs">
      <SubType>Component</SubType>
    </Compile>

    <Compile Include="SQLiteConnectionStringBuilder.cs" />
    <Compile Include="SQLiteConvert.cs" />
    <Compile Include="SQLiteDataAdapter.cs">
      <SubType>Component</SubType>
    </Compile>
    <Compile Include="SQLiteDataReader.cs" />
    <Compile Include="SQLiteEnlistment.cs" />







>
>
>
>
>
>












>







49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Transactions" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="AssemblyInfo.cs" />
    <Compile Include="LINQ\SQLiteConnection_Linq.cs">
      <SubType>Component</SubType>
    </Compile>
    <Compile Include="LINQ\SQLiteFactory_Linq.cs">
      <SubType>Code</SubType>
    </Compile>
    <Compile Include="SQLite3.cs" />
    <Compile Include="SQLite3_UTF16.cs" />
    <Compile Include="SQLiteBase.cs" />
    <Compile Include="SQLiteCommand.cs">
      <SubType>Component</SubType>
    </Compile>
    <Compile Include="SQLiteCommandBuilder.cs">
      <SubType>Component</SubType>
    </Compile>
    <Compile Include="SQLiteConnection.cs">
      <SubType>Component</SubType>
    </Compile>
    <Compile Include="SQLiteConnectionPool.cs" />
    <Compile Include="SQLiteConnectionStringBuilder.cs" />
    <Compile Include="SQLiteConvert.cs" />
    <Compile Include="SQLiteDataAdapter.cs">
      <SubType>Component</SubType>
    </Compile>
    <Compile Include="SQLiteDataReader.cs" />
    <Compile Include="SQLiteEnlistment.cs" />
Changes to System.Data.SQLite/UnsafeNativeMethods.cs.
79
80
81
82
83
84
85

86
87
88
89
90
91
92
      get;
    }

  }

#endif


  internal class SQLiteConnectionHandle : CriticalHandle
  {
    public static implicit operator IntPtr(SQLiteConnectionHandle db)
    {
      return db.handle;
    }








>







79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
      get;
    }

  }

#endif

  // Handles the unmanaged database pointer, and provides finalization support for it.
  internal class SQLiteConnectionHandle : CriticalHandle
  {
    public static implicit operator IntPtr(SQLiteConnectionHandle db)
    {
      return db.handle;
    }

104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120

121
122
123
124
125
126
127
    internal SQLiteConnectionHandle()
      : base(IntPtr.Zero)
    {
    }

    protected override bool ReleaseHandle()
    {
      SQLiteBase.Close(this);
      return true;
    }

    public override bool IsInvalid
    {
      get { return (handle == IntPtr.Zero); }
    }
  }


  internal class SQLiteStatementHandle : CriticalHandle
  {
    public static implicit operator IntPtr(SQLiteStatementHandle stmt)
    {
      return stmt.handle;
    }








|









>







105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
    internal SQLiteConnectionHandle()
      : base(IntPtr.Zero)
    {
    }

    protected override bool ReleaseHandle()
    {
      SQLiteBase.CloseConnection(this);
      return true;
    }

    public override bool IsInvalid
    {
      get { return (handle == IntPtr.Zero); }
    }
  }

  // Provides finalization support for unmanaged SQLite statements.
  internal class SQLiteStatementHandle : CriticalHandle
  {
    public static implicit operator IntPtr(SQLiteStatementHandle stmt)
    {
      return stmt.handle;
    }

142
143
144
145
146
147
148





































149
150
151
152
153
154
155
    }

    protected override bool ReleaseHandle()
    {
      SQLiteBase.FinalizeStatement(this);
      return true;
    }






































    public override bool IsInvalid
    {
      get { return (handle == IntPtr.Zero); }
    }
  }








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
    }

    protected override bool ReleaseHandle()
    {
      SQLiteBase.FinalizeStatement(this);
      return true;
    }

    public override bool IsInvalid
    {
      get { return (handle == IntPtr.Zero); }
    }
  }

  // Handles and provides finalization for the unmanaged interop cookie
  // created to support calling back into .NET.
  internal class SQLiteFunctionCookieHandle : CriticalHandle
  {
    public static implicit operator IntPtr(SQLiteFunctionCookieHandle cookie)
    {
      return cookie.handle;
    }

    public static implicit operator SQLiteFunctionCookieHandle(IntPtr cookie)
    {
      return new SQLiteFunctionCookieHandle(cookie);
    }

    private SQLiteFunctionCookieHandle(IntPtr cookie)
      : this()
    {
      SetHandle(cookie);
    }

    internal SQLiteFunctionCookieHandle()
      : base(IntPtr.Zero)
    {
    }

    protected override bool ReleaseHandle()
    {
      SQLiteBase.FreeFunction(this);
      return true;
    }

    public override bool IsInvalid
    {
      get { return (handle == IntPtr.Zero); }
    }
  }

412
413
414
415
416
417
418
419


420

    internal static extern IntPtr sqlite3_rollback_hook_interop(IntPtr db, SQLiteRollbackCallback func);

    [DllImport(SQLITE_DLL)]
    internal static extern int sqlite3_cursor_rowid(IntPtr stmt, int cursor, out long rowid);

    [DllImport(SQLITE_DLL)]
    internal static extern int sqlite3_table_cursor(IntPtr stmt, int db, int tableRootPage);
  }


}








|
>
>
|
>
451
452
453
454
455
456
457
458
459
460
461
462
    internal static extern IntPtr sqlite3_rollback_hook_interop(IntPtr db, SQLiteRollbackCallback func);

    [DllImport(SQLITE_DLL)]
    internal static extern int sqlite3_cursor_rowid(IntPtr stmt, int cursor, out long rowid);

    [DllImport(SQLITE_DLL)]
    internal static extern int sqlite3_table_cursor(IntPtr stmt, int db, int tableRootPage);

    [DllImport(SQLITE_DLL)]
    internal static extern void sqlite3_detach_all_interop(IntPtr db);
  }
}
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.
1
2
3
4
5
6




































































































































































































































































































































































































































































































































































































































7
8
9
10
11
12
13
<?xml version="1.0"?>
<doc>
    <assembly>
        <name>System.Data.SQLite</name>
    </assembly>
    <members>




































































































































































































































































































































































































































































































































































































































        <member name="T:System.Data.SQLite.SQLiteDataAdapter">
            <summary>
            SQLite implementation of DbDataAdapter.
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataAdapter.#ctor">
            <overloads>






>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
<?xml version="1.0"?>
<doc>
    <assembly>
        <name>System.Data.SQLite</name>
    </assembly>
    <members>
        <member name="T:System.Data.SQLite.SQLiteConnection">
            <summary>
            SQLite implentation of DbConnection.
            </summary>
            <remarks>
            The <see cref="P:System.Data.SQLite.SQLiteConnection.ConnectionString">ConnectionString</see> property of the SQLiteConnection class can contain the following parameter(s), delimited with a semi-colon:
            <list type="table">
            <listheader>
            <term>Parameter</term>
            <term>Values</term>
            <term>Required</term>
            <term>Default</term>
            </listheader>
            <item>
            <description>Data Source</description>
            <description>{filename}</description>
            <description>Y</description>
            <description></description>
            </item>
            <item>
            <description>Version</description>
            <description>3</description>
            <description>N</description>
            <description>3</description>
            </item>
            <item>
            <description>UseUTF16Encoding</description>
            <description><b>True</b><br/><b>False</b></description>
            <description>N</description>
            <description>False</description>
            </item>
            <item>
            <description>DateTimeFormat</description>
            <description><b>Ticks</b> - Use DateTime.Ticks<br/><b>ISO8601</b> - Use ISO8601 DateTime format</description>
            <description>N</description>
            <description>ISO8601</description>
            </item>
            <item>
            <description>BinaryGUID</description>
            <description><b>True</b> - Store GUID columns in binary form<br/><b>False</b> - Store GUID columns as text</description>
            <description>N</description>
            <description>True</description>
            </item>
            <item>
            <description>Cache Size</description>
            <description>{size in bytes}</description>
            <description>N</description>
            <description>2000</description>
            </item>
            <item>
            <description>Synchronous</description>
            <description><b>Normal</b> - Normal file flushing behavior<br/><b>Full</b> - Full flushing after all writes<br/><b>Off</b> - Underlying OS flushes I/O's</description>
            <description>N</description>
            <description>Normal</description>
            </item>
            <item>
            <description>Page Size</description>
            <description>{size in bytes}</description>
            <description>N</description>
            <description>1024</description>
            </item>
            <item>
            <description>Password</description>
            <description>{password}</description>
            <description>N</description>
            <description></description>
            </item>
            <item>
            <description>Enlist</description>
            <description><b>Y</b> - Automatically enlist in distributed transactions<br/><b>N</b> - No automatic enlistment</description>
            <description>N</description>
            <description>Y</description>
            </item>
            <item>
            <description>Pooling</description>
            <description><b>True</b> - Use connection pooling<br/><b>False</b> - Do not use connection pooling</description>
            <description>N</description>
            <description>False</description>
            </item>
            <item>
            <description>FailIfMissing</description>
            <description><b>True</b> - Don't create the database if it does not exist, throw an error instead<br/><b>False</b> - Automatically create the database if it does not exist</description>
            <description>N</description>
            <description>False</description>
            </item>
            <item>
            <description>Max Page Count</description>
            <description>{size in pages} - Limits the maximum number of pages (limits the size) of the database</description>
            <description>N</description>
            <description>0</description>
            </item>
            <item>
            <description>Legacy Format</description>
            <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>
            <description>N</description>
            <description>True</description>
            </item>
            </list>
            </remarks>
        </member>
        <member name="F:System.Data.SQLite.SQLiteConnection._connectionState">
            <summary>
            State of the current connection
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteConnection._connectionString">
            <summary>
            The connection string
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteConnection._transactionLevel">
            <summary>
            Nesting level of the transactions open on the connection
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteConnection._enlistment">
            <summary>
            Whether or not the connection is enlisted in a distrubuted transaction
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteConnection._sql">
            <summary>
            The base SQLite object to interop with
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteConnection._dataSource">
            <summary>
            The database filename minus path and extension
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteConnection._password">
            <summary>
            Temporary password storage, emptied after the database has been opened
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.#ctor">
            <overloads>
             Constructs a new SQLiteConnection object
             </overloads>
             <summary>
             Default constructor
             </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.#ctor(System.String)">
            <summary>
            Initializes the connection with the specified connection string
            </summary>
            <param name="connectionString">The connection string to use on the connection</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.#ctor(System.Data.SQLite.SQLiteConnection)">
            <summary>
            Clones the settings and connection string from an existing connection.  If the existing connection is already open, this
            function will open its own connection, enumerate any attached databases of the original connection, and automatically
            attach to them.
            </summary>
            <param name="connection"></param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Clone">
            <summary>
            Creates a clone of the connection.  All attached databases and user-defined functions are cloned.  If the existing connection is open, the cloned connection 
            will also be opened.
            </summary>
            <returns></returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Dispose(System.Boolean)">
            <summary>
            Disposes of the SQLiteConnection, closing it if it is active.
            </summary>
            <param name="disposing">True if the connection is being explicitly closed.</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.CreateFile(System.String)">
            <summary>
            Creates a database file.  This just creates a zero-byte file which SQLite
            will turn into a database when the file is opened properly.
            </summary>
            <param name="databaseFileName">The file to create</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.CompressFile(System.String)">
            <summary>
            On NTFS volumes, this function turns on the compression attribute for the given file.
            It must not be open or referenced at the time of the function call.
            </summary>
            <param name="databaseFileName">The file to compress</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.DecompressFile(System.String)">
            <summary>
            On NTFS volumes, this function removes the compression attribute for the given file.
            It must not be open or referenced at the time of the function call.
            </summary>
            <param name="databaseFileName">The file to decompress</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.OnStateChange(System.Data.ConnectionState)">
            <summary>
            Raises the state change event when the state of the connection changes
            </summary>
            <param name="newState">The new state.  If it is different from the previous state, an event is raised.</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.BeginTransaction(System.Data.IsolationLevel,System.Boolean)">
            <summary>
            Creates a new SQLiteTransaction if one isn't already active on the connection.
            </summary>
            <param name="isolationLevel">SQLite doesn't support varying isolation levels, so this parameter is ignored.</param>
            <param name="deferredLock">When TRUE, SQLite defers obtaining a write lock until a write operation is requested.
            When FALSE, a writelock is obtained immediately.  The default is TRUE, but in a multi-threaded multi-writer 
            environment, one may instead choose to lock the database immediately to avoid any possible writer deadlock.</param>
            <returns>Returns a SQLiteTransaction object.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.BeginTransaction(System.Boolean)">
            <summary>
            Creates a new SQLiteTransaction if one isn't already active on the connection.
            </summary>
            <param name="deferredLock">When TRUE, SQLite defers obtaining a write lock until a write operation is requested.
            When FALSE, a writelock is obtained immediately.  The default is TRUE, but in a multi-threaded multi-writer 
            environment, one may instead choose to lock the database immediately to avoid any possible writer deadlock.</param>
            <returns>Returns a SQLiteTransaction object.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.BeginTransaction(System.Data.IsolationLevel)">
            <summary>
            Creates a new SQLiteTransaction if one isn't already active on the connection.
            </summary>
            <param name="isolationLevel">SQLite supports only serializable transactions.</param>
            <returns>Returns a SQLiteTransaction object.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.BeginTransaction">
            <summary>
            Creates a new SQLiteTransaction if one isn't already active on the connection.
            </summary>
            <returns>Returns a SQLiteTransaction object.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.BeginDbTransaction(System.Data.IsolationLevel)">
            <summary>
            Forwards to the local BeginTransaction() function
            </summary>
            <param name="isolationLevel"></param>
            <returns></returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.ChangeDatabase(System.String)">
            <summary>
            Not implemented
            </summary>
            <param name="databaseName"></param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Close">
            <summary>
            When the database connection is closed, all commands linked to this connection are automatically reset.
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.CreateCommand">
            <summary>
            Create a new SQLiteCommand and associate it with this connection.
            </summary>
            <returns>Returns an instantiated SQLiteCommand object already assigned to this connection.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.CreateDbCommand">
            <summary>
            Forwards to the local CreateCommand() function
            </summary>
            <returns></returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.ParseConnectionString">
            <summary>
            Parses the connection string into component parts
            </summary>
            <returns>An array of key-value pairs representing each parameter of the connection string</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.EnlistTransaction(System.Transactions.Transaction)">
            <summary>
            Manual distributed transaction enlistment support
            </summary>
            <param name="transaction">The distributed transaction to enlist in</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.FindKey(System.Collections.Generic.SortedList{System.String,System.String},System.String,System.String)">
            <summary>
            Looks for a key in the array of key/values of the parameter string.  If not found, return the specified default value
            </summary>
            <param name="items">The list to look in</param>
            <param name="key">The key to find</param>
            <param name="defValue">The default value to return if the key is not found</param>
            <returns>The value corresponding to the specified key, or the default value if not found.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Open">
            <summary>
            Opens the connection using the parameters found in the <see cref="P:System.Data.SQLite.SQLiteConnection.ConnectionString">ConnectionString</see>
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.ChangePassword(System.String)">
            <summary>
            Change the password (or assign a password) to an open database.
            </summary>
            <remarks>
            No readers or writers may be active for this process.  The database must already be open
            and if it already was password protected, the existing password must already have been supplied.
            </remarks>
            <param name="newPassword">The new password to assign to the database</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.ChangePassword(System.Byte[])">
            <summary>
            Change the password (or assign a password) to an open database.
            </summary>
            <remarks>
            No readers or writers may be active for this process.  The database must already be open
            and if it already was password protected, the existing password must already have been supplied.
            </remarks>
            <param name="newPassword">The new password to assign to the database</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.SetPassword(System.String)">
            <summary>
            Sets the password for a password-protected database.  A password-protected database is
            unusable for any operation until the password has been set.
            </summary>
            <param name="databasePassword">The password for the database</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.SetPassword(System.Byte[])">
            <summary>
            Sets the password for a password-protected database.  A password-protected database is
            unusable for any operation until the password has been set.
            </summary>
            <param name="databasePassword">The password for the database</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.ExpandFileName(System.String)">
            <summary>
            Expand the filename of the data source, resolving the |DataDirectory| macro as appropriate.
            </summary>
            <param name="sourceFile">The database filename to expand</param>
            <returns>The expanded path and filename of the filename</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.GetSchema">
            <overloads>
             The following commands are used to extract schema information out of the database.  Valid schema types are:
             <list type="bullet">
             <item>
             <description>MetaDataCollections</description>
             </item>
             <item>
             <description>DataSourceInformation</description>
             </item>
             <item>
             <description>Catalogs</description>
             </item>
             <item>
             <description>Columns</description>
             </item>
             <item>
             <description>ForeignKeys</description>
             </item>
             <item>
             <description>Indexes</description>
             </item>
             <item>
             <description>IndexColumns</description>
             </item>
             <item>
             <description>Tables</description>
             </item>
             <item>
             <description>Views</description>
             </item>
             <item>
             <description>ViewColumns</description>
             </item>
             </list>
             </overloads>
             <summary>
             Returns the MetaDataCollections schema
             </summary>
             <returns>A DataTable of the MetaDataCollections schema</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.GetSchema(System.String)">
            <summary>
            Returns schema information of the specified collection
            </summary>
            <param name="collectionName">The schema collection to retrieve</param>
            <returns>A DataTable of the specified collection</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.GetSchema(System.String,System.String[])">
            <summary>
            Retrieves schema information using the specified constraint(s) for the specified collection
            </summary>
            <param name="collectionName">The collection to retrieve</param>
            <param name="restrictionValues">The restrictions to impose</param>
            <returns>A DataTable of the specified collection</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Schema_MetaDataCollections">
            <summary>
            Builds a MetaDataCollections schema datatable
            </summary>
            <returns>DataTable</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Schema_DataSourceInformation">
            <summary>
            Builds a DataSourceInformation datatable
            </summary>
            <returns>DataTable</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Schema_Columns(System.String,System.String,System.String)">
            <summary>
            Build a Columns schema
            </summary>
            <param name="strCatalog">The catalog (attached database) to query, can be null</param>
            <param name="strTable">The table to retrieve schema information for, must not be null</param>
            <param name="strColumn">The column to retrieve schema information for, can be null</param>
            <returns>DataTable</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Schema_Indexes(System.String,System.String,System.String)">
            <summary>
            Returns index information for the given database and catalog
            </summary>
            <param name="strCatalog">The catalog (attached database) to query, can be null</param>
            <param name="strIndex">The name of the index to retrieve information for, can be null</param>
            <param name="strTable">The table to retrieve index information for, can be null</param>
            <returns>DataTable</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Schema_Tables(System.String,System.String,System.String)">
            <summary>
            Retrieves table schema information for the database and catalog
            </summary>
            <param name="strCatalog">The catalog (attached database) to retrieve tables on</param>
            <param name="strTable">The table to retrieve, can be null</param>
            <param name="strType">The table type, can be null</param>
            <returns>DataTable</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Schema_Views(System.String,System.String)">
            <summary>
            Retrieves view schema information for the database
            </summary>
            <param name="strCatalog">The catalog (attached database) to retrieve views on</param>
            <param name="strView">The view name, can be null</param>
            <returns>DataTable</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Schema_Catalogs(System.String)">
            <summary>
            Retrieves catalog (attached databases) schema information for the database
            </summary>
            <param name="strCatalog">The catalog to retrieve, can be null</param>
            <returns>DataTable</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Schema_IndexColumns(System.String,System.String,System.String,System.String)">
            <summary>
            Returns the base column information for indexes in a database
            </summary>
            <param name="strCatalog">The catalog to retrieve indexes for (can be null)</param>
            <param name="strTable">The table to restrict index information by (can be null)</param>
            <param name="strIndex">The index to restrict index information by (can be null)</param>
            <param name="strColumn">The source column to restrict index information by (can be null)</param>
            <returns>A DataTable containing the results</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Schema_ViewColumns(System.String,System.String,System.String)">
            <summary>
            Returns detailed column information for a specified view
            </summary>
            <param name="strCatalog">The catalog to retrieve columns for (can be null)</param>
            <param name="strView">The view to restrict column information by (can be null)</param>
            <param name="strColumn">The source column to restrict column information by (can be null)</param>
            <returns>A DataTable containing the results</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Schema_ForeignKeys(System.String,System.String,System.String)">
            <summary>
            Retrieves foreign key information from the specified set of filters
            </summary>
            <param name="strCatalog">An optional catalog to restrict results on</param>
            <param name="strTable">An optional table to restrict results on</param>
            <param name="strKeyName">An optional foreign key name to restrict results on</param>
            <returns>A DataTable with the results of the query</returns>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnection.DbProviderFactory">
            <summary>
            Returns a SQLiteProviderFactory object.  This will be mandatory in .NET 3.5, so we'll eat the warning for now
            and allow .NET 2.0 objects to have this capability
            </summary>
        </member>
        <member name="E:System.Data.SQLite.SQLiteConnection.StateChange">
            <summary>
            This event is raised whenever the database is opened or closed.
            </summary>
        </member>
        <member name="E:System.Data.SQLite.SQLiteConnection.Update">
            <summary>
            This event is raised whenever SQLite makes an update/delete/insert into the database on
            this connection.  It only applies to the given connection.
            </summary>
        </member>
        <member name="E:System.Data.SQLite.SQLiteConnection.Commit">
            <summary>
            This event is raised whenever SQLite is committing a transaction.
            Return non-zero to trigger a rollback
            </summary>
        </member>
        <member name="E:System.Data.SQLite.SQLiteConnection.RollBack">
            <summary>
            This event is raised whenever SQLite is committing a transaction.
            Return non-zero to trigger a rollback
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnection.ConnectionString">
            <summary>
            The connection string containing the parameters for the connection
            </summary>
            <remarks>
            <list type="table">
            <listheader>
            <term>Parameter</term>
            <term>Values</term>
            <term>Required</term>
            <term>Default</term>
            </listheader>
            <item>
            <description>Data Source</description>
            <description>{filename}</description>
            <description>Y</description>
            <description></description>
            </item>
            <item>
            <description>Version</description>
            <description>3</description>
            <description>N</description>
            <description>3</description>
            </item>
            <item>
            <description>UseUTF16Encoding</description>
            <description><b>True</b><br/><b>False</b></description>
            <description>N</description>
            <description>False</description>
            </item>
            <item>
            <description>DateTimeFormat</description>
            <description><b>Ticks</b> - Use DateTime.Ticks<br/><b>ISO8601</b> - Use ISO8601 DateTime format</description>
            <description>N</description>
            <description>ISO8601</description>
            </item>
            <item>
            <description>BinaryGUID</description>
            <description><b>Yes/On/1</b> - Store GUID columns in binary form<br/><b>No/Off/0</b> - Store GUID columns as text</description>
            <description>N</description>
            <description>On</description>
            </item>
            <item>
            <description>Cache Size</description>
            <description>{size in bytes}</description>
            <description>N</description>
            <description>2000</description>
            </item>
            <item>
            <description>Synchronous</description>
            <description><b>Normal</b> - Normal file flushing behavior<br/><b>Full</b> - Full flushing after all writes<br/><b>Off</b> - Underlying OS flushes I/O's</description>
            <description>N</description>
            <description>Normal</description>
            </item>
            <item>
            <description>Page Size</description>
            <description>{size in bytes}</description>
            <description>N</description>
            <description>1024</description>
            </item>
            <item>
            <description>Password</description>
            <description>{password}</description>
            <description>N</description>
            <description></description>
            </item>
            <item>
            <description>Enlist</description>
            <description><B>Y</B> - Automatically enlist in distributed transactions<br/><b>N</b> - No automatic enlistment</description>
            <description>N</description>
            <description>Y</description>
            </item>
            <item>
            <description>Pooling</description>
            <description><b>True</b> - Use connection pooling<br/><b>False</b> - Do not use connection pooling</description>
            <description>N</description>
            <description>False</description>
            </item>
            <item>
            <description>FailIfMissing</description>
            <description><b>True</b> - Don't create the database if it does not exist, throw an error instead<br/><b>False</b> - Automatically create the database if it does not exist</description>
            <description>N</description>
            <description>False</description>
            </item>
            <item>
            <description>Max Page Count</description>
            <description>{size in pages} - Limits the maximum number of pages (limits the size) of the database</description>
            <description>N</description>
            <description>0</description>
            </item>
            <item>
            <description>Legacy Format</description>
            <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>
            <description>N</description>
            <description>True</description>
            </item>
            </list>
            </remarks>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnection.DataSource">
            <summary>
            Returns the filename without extension or path
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnection.Database">
            <summary>
            Returns an empty string
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnection.ServerVersion">
            <summary>
            Returns the version of the underlying SQLite database engine
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnection.State">
            <summary>
            Returns the state of the connection.
            </summary>
        </member>
        <member name="T:System.Data.SQLite.SQLiteDataAdapter">
            <summary>
            SQLite implementation of DbDataAdapter.
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataAdapter.#ctor">
            <overloads>
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
            <br/>
            Note that the leading and trailing spaces were removed from each item during the split.
            </remarks>
            <param name="source">Source string to split apart</param>
            <param name="separator">Separator character</param>
            <returns>A string array of the split up elements</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConvert.ColumnToType(System.Data.SQLite.SQLiteStatement,System.Int32)">
            <summary>
            Determines the data type of a column in a statement
            </summary>
            <param name="stmt">The statement to retrieve information for</param>
            <param name="i">The column to retrieve type information on</param>
            <returns>Returns a SQLiteType struct</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConvert.SQLiteTypeToType(System.Data.SQLite.SQLiteType)">
            <summary>
            Converts a SQLiteType to a .NET Type object
            </summary>
            <param name="t">The SQLiteType to convert</param>
            <returns>Returns a .NET Type object</returns>







|





|







889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
            <br/>
            Note that the leading and trailing spaces were removed from each item during the split.
            </remarks>
            <param name="source">Source string to split apart</param>
            <param name="separator">Separator character</param>
            <returns>A string array of the split up elements</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConvert.ColumnToType(System.Data.SQLite.SQLiteStatement,System.Int32,System.Data.SQLite.SQLiteType)">
            <summary>
            Determines the data type of a column in a statement
            </summary>
            <param name="stmt">The statement to retrieve information for</param>
            <param name="i">The column to retrieve type information on</param>
            <param name="typ">The SQLiteType to receive the affinity for the given column</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConvert.SQLiteTypeToType(System.Data.SQLite.SQLiteType)">
            <summary>
            Converts a SQLiteType to a .NET Type object
            </summary>
            <param name="t">The SQLiteType to convert</param>
            <returns>Returns a .NET Type object</returns>
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
            <remarks>
            The wrapper functions that interop with SQLite will create a unique cooke value, which internally is a pointer to
            all the wrapped callback functions.  The interop function uses it to map CDecl callbacks to StdCall callbacks.
            </remarks>
            <param name="sqlbase">The base object on which the functions are to bind</param>
            <returns>Returns an array of functions which the connection object should retain until the connection is closed.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFunction.UnbindFunctions(System.Data.SQLite.SQLiteBase,System.Data.SQLite.SQLiteFunction[])">
            <summary>
            Issued after the base connection is closed, this function cleans up all user-defined functions and disposes of them.
            </summary>
            <remarks>
            Cleaning up here is done mainly because of the interop wrapper.  It allocated memory to hold a reference to all the
            delegates, and now must free that memory.
            Freeing is done after the connection is closed to ensure no callbacks get hit after we've freed the cookie.
            </remarks>
            <param name="sqlbase">The base SQLite connection object</param>
            <param name="ar">An array of user-defined functions for this object</param>
        </member>
        <member name="P:System.Data.SQLite.SQLiteFunction.SQLiteConvert">
            <summary>
            Returns a reference to the underlying connection's SQLiteConvert class, which can be used to convert
            strings and DateTime's into the current connection's encoding schema.
            </summary>
        </member>
        <member name="T:System.Data.SQLite.SQLiteDataReader">







<
<
<
<
<
<
<
<
<
<
<
<







1282
1283
1284
1285
1286
1287
1288












1289
1290
1291
1292
1293
1294
1295
            <remarks>
            The wrapper functions that interop with SQLite will create a unique cooke value, which internally is a pointer to
            all the wrapped callback functions.  The interop function uses it to map CDecl callbacks to StdCall callbacks.
            </remarks>
            <param name="sqlbase">The base object on which the functions are to bind</param>
            <returns>Returns an array of functions which the connection object should retain until the connection is closed.</returns>
        </member>












        <member name="P:System.Data.SQLite.SQLiteFunction.SQLiteConvert">
            <summary>
            Returns a reference to the underlying connection's SQLiteConvert class, which can be used to convert
            strings and DateTime's into the current connection's encoding schema.
            </summary>
        </member>
        <member name="T:System.Data.SQLite.SQLiteDataReader">
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
            <param name="behave">The expected behavior of the data reader</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.Close">
            <summary>
            Closes the datareader, potentially closing the connection as well if CommandBehavior.CloseConnection was specified.
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.Dispose(System.Boolean)">
            <summary>
            Disposes the datareader.  Base class calls Close() to ensure everything is cleaned up.
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.CheckClosed">
            <summary>
            Throw an error if the datareader is closed
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.CheckValidRow">
            <summary>







<
<
<
<
<







1359
1360
1361
1362
1363
1364
1365





1366
1367
1368
1369
1370
1371
1372
            <param name="behave">The expected behavior of the data reader</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.Close">
            <summary>
            Closes the datareader, potentially closing the connection as well if CommandBehavior.CloseConnection was specified.
            </summary>
        </member>





        <member name="M:System.Data.SQLite.SQLiteDataReader.CheckClosed">
            <summary>
            Throw an error if the datareader is closed
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.CheckValidRow">
            <summary>
1327
1328
1329
1330
1331
1332
1333





1334
1335
1336
1337
1338
1339
1340
            The command text this command is based on
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteCommand._cnn">
            <summary>
            The connection the command is associated with
            </summary>





        </member>
        <member name="F:System.Data.SQLite.SQLiteCommand._activeReader">
            <summary>
            Indicates whether or not a DataReader is active on the command.
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteCommand._commandTimeout">







>
>
>
>
>







1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
            The command text this command is based on
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteCommand._cnn">
            <summary>
            The connection the command is associated with
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteCommand._version">
            <summary>
            The version of the connection the command is associated with
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteCommand._activeReader">
            <summary>
            Indicates whether or not a DataReader is active on the command.
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteCommand._commandTimeout">
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565

1566
1567
1568
1569
1570
1571
1572
        </member>
        <member name="T:System.Data.SQLite.SQLiteBase">
            <summary>
            This internal class provides the foundation of SQLite support.  It defines all the abstract members needed to implement
            a SQLite data provider, and inherits from SQLiteConvert which allows for simple translations of string to and from SQLite.
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteBase.Open(System.String)">
            <summary>
            Opens a database.
            </summary>

            <remarks>
            Implementers should call SQLiteFunction.BindFunctions() and save the array after opening a connection
            to bind all attributed user-defined functions and collating sequences to the new connection.
            </remarks>
            <param name="strFilename">The filename of the database to open.  SQLite automatically creates it if it doesn't exist.</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteBase.Close">







|



>







2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
        </member>
        <member name="T:System.Data.SQLite.SQLiteBase">
            <summary>
            This internal class provides the foundation of SQLite support.  It defines all the abstract members needed to implement
            a SQLite data provider, and inherits from SQLiteConvert which allows for simple translations of string to and from SQLite.
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteBase.Open(System.String,System.Boolean)">
            <summary>
            Opens a database.
            </summary>
            <param name="usePool">If true, the connection can be pulled from the connection pool</param>
            <remarks>
            Implementers should call SQLiteFunction.BindFunctions() and save the array after opening a connection
            to bind all attributed user-defined functions and collating sequences to the new connection.
            </remarks>
            <param name="strFilename">The filename of the database to open.  SQLite automatically creates it if it doesn't exist.</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteBase.Close">
1674
1675
1676
1677
1678
1679
1680











1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691






1692
1693
1694
1695
1696
1697
1698
1699
1700
1701





1702
1703
1704
1705
1706
1707
1708
            Gets/Sets the synchronous mode of the connection string.  Default is "Normal".
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.UseUTF16Encoding">
            <summary>
            Gets/Sets the encoding for the connection string.  The default is "False" which indicates UTF-8 encoding.
            </summary>











        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.DataSource">
            <summary>
            Gets/Sets the filename to open on the connection string.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.Enlist">
            <summary>
            Determines whether or not the connection will automatically participate
            in the current distributed transaction (if one exists)
            </summary>






        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.Password">
            <summary>
            Gets/sets the database encryption password
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.PageSize">
            <summary>
            Gets/Sets the page size for the connection.
            </summary>





        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.CacheSize">
            <summary>
            Gets/Sets the cache size for the connection.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.DateTimeFormat">







>
>
>
>
>
>
>
>
>
>
>











>
>
>
>
>
>










>
>
>
>
>







2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
            Gets/Sets the synchronous mode of the connection string.  Default is "Normal".
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.UseUTF16Encoding">
            <summary>
            Gets/Sets the encoding for the connection string.  The default is "False" which indicates UTF-8 encoding.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.Pooling">
            <summary>
            Gets/Sets whether or not to use connection pooling.  The default is "False"
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.BinaryGUID">
            <summary>
            Gets/Sets whethor not to store GUID's in binary format.  The default is True
            which saves space in the database.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.DataSource">
            <summary>
            Gets/Sets the filename to open on the connection string.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.Enlist">
            <summary>
            Determines whether or not the connection will automatically participate
            in the current distributed transaction (if one exists)
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.LegacyFormat">
            <summary>
            If enabled, uses the legacy 3.xx format for maximum compatibility, but results in larger
            database sizes.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.Password">
            <summary>
            Gets/sets the database encryption password
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.PageSize">
            <summary>
            Gets/Sets the page size for the connection.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.MaxPageCount">
            <summary>
            Gets/Sets the maximum number of pages the database may hold
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.CacheSize">
            <summary>
            Gets/Sets the cache size for the connection.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.DateTimeFormat">
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLite3._functionsArray">
            <summary>
            The user-defined functions registered on this connection
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLite3.GetValue(System.Data.SQLite.SQLiteStatement,System.Int32,System.Data.SQLite.SQLiteType@)">
            <summary>
            Helper function to retrieve a column of data from an active statement.
            </summary>
            <param name="stmt">The statement being step()'d through</param>
            <param name="index">The column index to retrieve</param>
            <param name="typ">The type of data contained in the column.  If Uninitialized, this function will retrieve the datatype information.</param>
            <returns>Returns the data in the column</returns>







|







2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLite3._functionsArray">
            <summary>
            The user-defined functions registered on this connection
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLite3.GetValue(System.Data.SQLite.SQLiteStatement,System.Int32,System.Data.SQLite.SQLiteType)">
            <summary>
            Helper function to retrieve a column of data from an active statement.
            </summary>
            <param name="stmt">The statement being step()'d through</param>
            <param name="index">The column index to retrieve</param>
            <param name="typ">The type of data contained in the column.  If Uninitialized, this function will retrieve the datatype information.</param>
            <returns>Returns the data in the column</returns>
1980
1981
1982
1983
1984
1985
1986
























































1987
1988
1989
1990
1991
1992
1993
            <summary>
            Overrides SQLiteConvert.ToString() to marshal UTF-16 strings instead of UTF-8
            </summary>
            <param name="b">A pointer to a UTF-16 string</param>
            <param name="nbytelen">The length (IN BYTES) of the string</param>
            <returns>A .NET string</returns>
        </member>
























































        <member name="T:System.Data.SQLite.SR">
            <summary>
              A strongly-typed resource class, for looking up localized strings, etc.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SR.ResourceManager">
            <summary>







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
            <summary>
            Overrides SQLiteConvert.ToString() to marshal UTF-16 strings instead of UTF-8
            </summary>
            <param name="b">A pointer to a UTF-16 string</param>
            <param name="nbytelen">The length (IN BYTES) of the string</param>
            <returns>A .NET string</returns>
        </member>
        <member name="T:System.Data.SQLite.SQLiteFactory">
            <summary>
            SQLite implementation of DbProviderFactory.
            </summary>
            <summary>
            SQLite implementation of DbProviderFactory.
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFactory.GetService(System.Type)">
            <summary>
            Will provide a DbProviderServices object in .NET 3.5
            </summary>
            <param name="serviceType">The class or interface type to query for</param>
            <returns></returns>
        </member>
        <member name="F:System.Data.SQLite.SQLiteFactory.Instance">
            <summary>
            Static instance member which returns an instanced SQLiteFactory class.
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFactory.CreateCommand">
            <summary>
            Returns a new SQLiteCommand object.
            </summary>
            <returns>A SQLiteCommand object.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFactory.CreateCommandBuilder">
            <summary>
            Returns a new SQLiteCommandBuilder object.
            </summary>
            <returns>A SQLiteCommandBuilder object.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFactory.CreateConnection">
            <summary>
            Creates a new SQLiteConnection.
            </summary>
            <returns>A SQLiteConnection object.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFactory.CreateConnectionStringBuilder">
            <summary>
            Creates a new SQLiteConnectionStringBuilder.
            </summary>
            <returns>A SQLiteConnectionStringBuilder object.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFactory.CreateDataAdapter">
            <summary>
            Creates a new SQLiteDataAdapter.
            </summary>
            <returns>A SQLiteDataAdapter object.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFactory.CreateParameter">
            <summary>
            Creates a new SQLiteParameter.
            </summary>
            <returns>A SQLiteParameter object.</returns>
        </member>
        <member name="T:System.Data.SQLite.SR">
            <summary>
              A strongly-typed resource class, for looking up localized strings, etc.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SR.ResourceManager">
            <summary>
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.Done">
            <summary>
            sqlite3_step() has finished executing
            </summary>
        </member>
        <member name="T:System.Data.SQLite.SQLiteConnection">
            <summary>
            SQLite implentation of DbConnection.
            </summary>
            <remarks>
            The <see cref="P:System.Data.SQLite.SQLiteConnection.ConnectionString">ConnectionString</see> property of the SQLiteConnection class can contain the following parameter(s), delimited with a semi-colon:
            <list type="table">
            <listheader>
            <term>Parameter</term>
            <term>Values</term>
            <term>Required</term>
            <term>Default</term>
            </listheader>
            <item>
            <description>Data Source</description>
            <description>{filename}</description>
            <description>Y</description>
            <description></description>
            </item>
            <item>
            <description>Version</description>
            <description>3</description>
            <description>N</description>
            <description>3</description>
            </item>
            <item>
            <description>UseUTF16Encoding</description>
            <description><b>True</b><br/><b>False</b></description>
            <description>N</description>
            <description>False</description>
            </item>
            <item>
            <description>DateTimeFormat</description>
            <description><b>Ticks</b> - Use DateTime.Ticks<br/><b>ISO8601</b> - Use ISO8601 DateTime format</description>
            <description>N</description>
            <description>ISO8601</description>
            </item>
            <item>
            <description>BinaryGUID</description>
            <description><b>True</b> - Store GUID columns in binary form<br/><b>False</b> - Store GUID columns as text</description>
            <description>N</description>
            <description>True</description>
            </item>
            <item>
            <description>Cache Size</description>
            <description>{size in bytes}</description>
            <description>N</description>
            <description>2000</description>
            </item>
            <item>
            <description>Synchronous</description>
            <description><b>Normal</b> - Normal file flushing behavior<br/><b>Full</b> - Full flushing after all writes<br/><b>Off</b> - Underlying OS flushes I/O's</description>
            <description>N</description>
            <description>Normal</description>
            </item>
            <item>
            <description>Page Size</description>
            <description>{size in bytes}</description>
            <description>N</description>
            <description>1024</description>
            </item>
            <item>
            <description>Password</description>
            <description>{password}</description>
            <description>N</description>
            <description></description>
            </item>
            <item>
            <description>Enlist</description>
            <description><B>Y</B> - Automatically enlist in distributed transactions<br/><b>N</b> - No automatic enlistment</description>
            <description>N</description>
            <description>Y</description>
            </item>
            </list>
            </remarks>
        </member>
        <member name="F:System.Data.SQLite.SQLiteConnection._connectionState">
            <summary>
            State of the current connection
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteConnection._connectionString">
            <summary>
            The connection string
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteConnection._transactionLevel">
            <summary>
            Nesting level of the transactions open on the connection
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteConnection._enlistment">
            <summary>
            Whether or not the connection is enlisted in a distrubuted transaction
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteConnection._sql">
            <summary>
            The base SQLite object to interop with
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteConnection._commandList">
            <summary>
            Commands associated with this connection
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteConnection._dataSource">
            <summary>
            The database filename minus path and extension
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteConnection._password">
            <summary>
            Temporary password storage, emptied after the database has been opened
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.#ctor">
            <overloads>
             Constructs a new SQLiteConnection object
             </overloads>
             <summary>
             Default constructor
             </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.#ctor(System.String)">
            <summary>
            Initializes the connection with the specified connection string
            </summary>
            <param name="connectionString">The connection string to use on the connection</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.#ctor(System.Data.SQLite.SQLiteConnection)">
            <summary>
            Clones the settings and connection string from an existing connection.  If the existing connection is already open, this
            function will open its own connection, enumerate any attached databases of the original connection, and automatically
            attach to them.
            </summary>
            <param name="connection"></param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Clone">
            <summary>
            Creates a clone of the connection.  All attached databases and user-defined functions are cloned.  If the existing connection is open, the cloned connection 
            will also be opened.
            </summary>
            <returns></returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Dispose(System.Boolean)">
            <summary>
            Disposes of the SQLiteConnection, closing it if it is active.
            </summary>
            <param name="disposing">True if the connection is being explicitly closed.</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.CreateFile(System.String)">
            <summary>
            Creates a database file.  This just creates a zero-byte file which SQLite
            will turn into a database when the file is opened properly.
            </summary>
            <param name="databaseFileName">The file to create</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.CompressFile(System.String)">
            <summary>
            On NTFS volumes, this function turns on the compression attribute for the given file.
            It must not be open or referenced at the time of the function call.
            </summary>
            <param name="databaseFileName">The file to compress</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.DecompressFile(System.String)">
            <summary>
            On NTFS volumes, this function removes the compression attribute for the given file.
            It must not be open or referenced at the time of the function call.
            </summary>
            <param name="databaseFileName">The file to decompress</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.OnStateChange(System.Data.ConnectionState)">
            <summary>
            Raises the state change event when the state of the connection changes
            </summary>
            <param name="newState">The new state.  If it is different from the previous state, an event is raised.</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.BeginTransaction(System.Data.IsolationLevel,System.Boolean)">
            <summary>
            Creates a new SQLiteTransaction if one isn't already active on the connection.
            </summary>
            <param name="isolationLevel">SQLite doesn't support varying isolation levels, so this parameter is ignored.</param>
            <param name="deferredLock">When TRUE, SQLite defers obtaining a write lock until a write operation is requested.
            When FALSE, a writelock is obtained immediately.  The default is TRUE, but in a multi-threaded multi-writer 
            environment, one may instead choose to lock the database immediately to avoid any possible writer deadlock.</param>
            <returns>Returns a SQLiteTransaction object.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.BeginTransaction(System.Boolean)">
            <summary>
            Creates a new SQLiteTransaction if one isn't already active on the connection.
            </summary>
            <param name="deferredLock">When TRUE, SQLite defers obtaining a write lock until a write operation is requested.
            When FALSE, a writelock is obtained immediately.  The default is TRUE, but in a multi-threaded multi-writer 
            environment, one may instead choose to lock the database immediately to avoid any possible writer deadlock.</param>
            <returns>Returns a SQLiteTransaction object.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.BeginTransaction(System.Data.IsolationLevel)">
            <summary>
            Creates a new SQLiteTransaction if one isn't already active on the connection.
            </summary>
            <param name="isolationLevel">SQLite supports only serializable transactions.</param>
            <returns>Returns a SQLiteTransaction object.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.BeginTransaction">
            <summary>
            Creates a new SQLiteTransaction if one isn't already active on the connection.
            </summary>
            <returns>Returns a SQLiteTransaction object.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.BeginDbTransaction(System.Data.IsolationLevel)">
            <summary>
            Forwards to the local BeginTransaction() function
            </summary>
            <param name="isolationLevel"></param>
            <returns></returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.ChangeDatabase(System.String)">
            <summary>
            Not implemented
            </summary>
            <param name="databaseName"></param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Close">
            <summary>
            When the database connection is closed, all commands linked to this connection are automatically reset.
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.CreateCommand">
            <summary>
            Create a new SQLiteCommand and associate it with this connection.
            </summary>
            <returns>Returns an instantiated SQLiteCommand object already assigned to this connection.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.CreateDbCommand">
            <summary>
            Forwards to the local CreateCommand() function
            </summary>
            <returns></returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.ParseConnectionString">
            <summary>
            Parses the connection string into component parts
            </summary>
            <returns>An array of key-value pairs representing each parameter of the connection string</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.EnlistTransaction(System.Transactions.Transaction)">
            <summary>
            Manual distributed transaction enlistment support
            </summary>
            <param name="transaction">The distributed transaction to enlist in</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.FindKey(System.Collections.Generic.KeyValuePair{System.String,System.String}[],System.String,System.String)">
            <summary>
            Looks for a key in the array of key/values of the parameter string.  If not found, return the specified default value
            </summary>
            <param name="opts">The Key/Value pair array to look in</param>
            <param name="key">The key to find</param>
            <param name="defValue">The default value to return if the key is not found</param>
            <returns>The value corresponding to the specified key, or the default value if not found.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Open">
            <summary>
            Opens the connection using the parameters found in the <see cref="P:System.Data.SQLite.SQLiteConnection.ConnectionString">ConnectionString</see>
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.ChangePassword(System.String)">
            <summary>
            Change the password (or assign a password) to an open database.
            </summary>
            <remarks>
            No readers or writers may be active for this process.  The database must already be open
            and if it already was password protected, the existing password must already have been supplied.
            </remarks>
            <param name="newPassword">The new password to assign to the database</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.ChangePassword(System.Byte[])">
            <summary>
            Change the password (or assign a password) to an open database.
            </summary>
            <remarks>
            No readers or writers may be active for this process.  The database must already be open
            and if it already was password protected, the existing password must already have been supplied.
            </remarks>
            <param name="newPassword">The new password to assign to the database</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.SetPassword(System.String)">
            <summary>
            Sets the password for a password-protected database.  A password-protected database is
            unusable for any operation until the password has been set.
            </summary>
            <param name="databasePassword">The password for the database</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.SetPassword(System.Byte[])">
            <summary>
            Sets the password for a password-protected database.  A password-protected database is
            unusable for any operation until the password has been set.
            </summary>
            <param name="databasePassword">The password for the database</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.ExpandFileName(System.String)">
            <summary>
            Expand the filename of the data source, resolving the |DataDirectory| macro as appropriate.
            </summary>
            <param name="sourceFile">The database filename to expand</param>
            <returns>The expanded path and filename of the filename</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.GetSchema">
            <overloads>
             The following commands are used to extract schema information out of the database.  Valid schema types are:
             <list type="bullet">
             <item>
             <description>MetaDataCollections</description>
             </item>
             <item>
             <description>DataSourceInformation</description>
             </item>
             <item>
             <description>Catalogs</description>
             </item>
             <item>
             <description>Columns</description>
             </item>
             <item>
             <description>ForeignKeys</description>
             </item>
             <item>
             <description>Indexes</description>
             </item>
             <item>
             <description>IndexColumns</description>
             </item>
             <item>
             <description>Tables</description>
             </item>
             <item>
             <description>Views</description>
             </item>
             <item>
             <description>ViewColumns</description>
             </item>
             </list>
             </overloads>
             <summary>
             Returns the MetaDataCollections schema
             </summary>
             <returns>A DataTable of the MetaDataCollections schema</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.GetSchema(System.String)">
            <summary>
            Returns schema information of the specified collection
            </summary>
            <param name="collectionName">The schema collection to retrieve</param>
            <returns>A DataTable of the specified collection</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.GetSchema(System.String,System.String[])">
            <summary>
            Retrieves schema information using the specified constraint(s) for the specified collection
            </summary>
            <param name="collectionName">The collection to retrieve</param>
            <param name="restrictionValues">The restrictions to impose</param>
            <returns>A DataTable of the specified collection</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Schema_MetaDataCollections">
            <summary>
            Builds a MetaDataCollections schema datatable
            </summary>
            <returns>DataTable</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Schema_DataSourceInformation">
            <summary>
            Builds a DataSourceInformation datatable
            </summary>
            <returns>DataTable</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Schema_Columns(System.String,System.String,System.String)">
            <summary>
            Build a Columns schema
            </summary>
            <param name="strCatalog">The catalog (attached database) to query, can be null</param>
            <param name="strTable">The table to retrieve schema information for, must not be null</param>
            <param name="strColumn">The column to retrieve schema information for, can be null</param>
            <returns>DataTable</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Schema_Indexes(System.String,System.String,System.String)">
            <summary>
            Returns index information for the given database and catalog
            </summary>
            <param name="strCatalog">The catalog (attached database) to query, can be null</param>
            <param name="strIndex">The name of the index to retrieve information for, can be null</param>
            <param name="strTable">The table to retrieve index information for, can be null</param>
            <returns>DataTable</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Schema_Tables(System.String,System.String,System.String)">
            <summary>
            Retrieves table schema information for the database and catalog
            </summary>
            <param name="strCatalog">The catalog (attached database) to retrieve tables on</param>
            <param name="strTable">The table to retrieve, can be null</param>
            <param name="strType">The table type, can be null</param>
            <returns>DataTable</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Schema_Views(System.String,System.String)">
            <summary>
            Retrieves view schema information for the database
            </summary>
            <param name="strCatalog">The catalog (attached database) to retrieve views on</param>
            <param name="strView">The view name, can be null</param>
            <returns>DataTable</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Schema_Catalogs(System.String)">
            <summary>
            Retrieves catalog (attached databases) schema information for the database
            </summary>
            <param name="strCatalog">The catalog to retrieve, can be null</param>
            <returns>DataTable</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Schema_IndexColumns(System.String,System.String,System.String,System.String)">
            <summary>
            Returns the base column information for indexes in a database
            </summary>
            <param name="strCatalog">The catalog to retrieve indexes for (can be null)</param>
            <param name="strTable">The table to restrict index information by (can be null)</param>
            <param name="strIndex">The index to restrict index information by (can be null)</param>
            <param name="strColumn">The source column to restrict index information by (can be null)</param>
            <returns>A DataTable containing the results</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Schema_ViewColumns(System.String,System.String,System.String)">
            <summary>
            Returns detailed column information for a specified view
            </summary>
            <param name="strCatalog">The catalog to retrieve columns for (can be null)</param>
            <param name="strView">The view to restrict column information by (can be null)</param>
            <param name="strColumn">The source column to restrict column information by (can be null)</param>
            <returns>A DataTable containing the results</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Schema_ForeignKeys(System.String,System.String,System.String)">
            <summary>
            Retrieves foreign key information from the specified set of filters
            </summary>
            <param name="strCatalog">An optional catalog to restrict results on</param>
            <param name="strTable">An optional table to restrict results on</param>
            <param name="strKeyName">An optional foreign key name to restrict results on</param>
            <returns>A DataTable with the results of the query</returns>
        </member>
        <member name="E:System.Data.SQLite.SQLiteConnection.StateChange">
            <summary>
            This event is raised whenever the database is opened or closed.
            </summary>
        </member>
        <member name="E:System.Data.SQLite.SQLiteConnection.Update">
            <summary>
            This event is raised whenever SQLite makes an update/delete/insert into the database on
            this connection.  It only applies to the given connection.
            </summary>
        </member>
        <member name="E:System.Data.SQLite.SQLiteConnection.Commit">
            <summary>
            This event is raised whenever SQLite is committing a transaction.
            Return non-zero to trigger a rollback
            </summary>
        </member>
        <member name="E:System.Data.SQLite.SQLiteConnection.RollBack">
            <summary>
            This event is raised whenever SQLite is committing a transaction.
            Return non-zero to trigger a rollback
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnection.ConnectionString">
            <summary>
            The connection string containing the parameters for the connection
            </summary>
            <remarks>
            <list type="table">
            <listheader>
            <term>Parameter</term>
            <term>Values</term>
            <term>Required</term>
            <term>Default</term>
            </listheader>
            <item>
            <description>Data Source</description>
            <description>{filename}</description>
            <description>Y</description>
            <description></description>
            </item>
            <item>
            <description>Version</description>
            <description>3</description>
            <description>N</description>
            <description>3</description>
            </item>
            <item>
            <description>UseUTF16Encoding</description>
            <description><b>True</b><br/><b>False</b></description>
            <description>N</description>
            <description>False</description>
            </item>
            <item>
            <description>DateTimeFormat</description>
            <description><b>Ticks</b> - Use DateTime.Ticks<br/><b>ISO8601</b> - Use ISO8601 DateTime format</description>
            <description>N</description>
            <description>ISO8601</description>
            </item>
            <item>
            <description>BinaryGUID</description>
            <description><b>Yes/On/1</b> - Store GUID columns in binary form<br/><b>No/Off/0</b> - Store GUID columns as text</description>
            <description>N</description>
            <description>On</description>
            </item>
            <item>
            <description>Cache Size</description>
            <description>{size in bytes}</description>
            <description>N</description>
            <description>2000</description>
            </item>
            <item>
            <description>Synchronous</description>
            <description><b>Normal</b> - Normal file flushing behavior<br/><b>Full</b> - Full flushing after all writes<br/><b>Off</b> - Underlying OS flushes I/O's</description>
            <description>N</description>
            <description>Normal</description>
            </item>
            <item>
            <description>Page Size</description>
            <description>{size in bytes}</description>
            <description>N</description>
            <description>1024</description>
            </item>
            <item>
            <description>Password</description>
            <description>{password}</description>
            <description>N</description>
            <description></description>
            </item>
            <item>
            <description>Enlist</description>
            <description><B>Y</B> - Automatically enlist in distributed transactions<br/><b>N</b> - No automatic enlistment</description>
            <description>N</description>
            <description>Y</description>
            </item>
            </list>
            </remarks>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnection.DataSource">
            <summary>
            Returns the filename without extension or path
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnection.Database">
            <summary>
            Returns an empty string
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnection.ServerVersion">
            <summary>
            Returns the version of the underlying SQLite database engine
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnection.State">
            <summary>
            Returns the state of the connection.
            </summary>
        </member>
        <member name="T:System.Data.SQLite.SynchronizationModes">
            <summary>
            The I/O file cache flushing behavior for the connection
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SynchronizationModes.Normal">
            <summary>







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







2908
2909
2910
2911
2912
2913
2914



















































































































































































































































































































































































































































































































































































2915
2916
2917
2918
2919
2920
2921
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.Done">
            <summary>
            sqlite3_step() has finished executing
            </summary>
        </member>



















































































































































































































































































































































































































































































































































































        <member name="T:System.Data.SQLite.SynchronizationModes">
            <summary>
            The I/O file cache flushing behavior for the connection
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SynchronizationModes.Normal">
            <summary>
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteFunctionAttribute.FuncType">
            <summary>
            The type of function this implementation will be.
            </summary>
        </member>
        <member name="T:System.Data.SQLite.SQLiteFactory">
            <summary>
            SQLite implementation of DbProviderFactory.
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteFactory.Instance">
            <summary>
            Static instance member which returns an instanced SQLiteFactory class.
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFactory.CreateCommand">
            <summary>
            Returns a new SQLiteCommand object.
            </summary>
            <returns>A SQLiteCommand object.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFactory.CreateCommandBuilder">
            <summary>
            Returns a new SQLiteCommandBuilder object.
            </summary>
            <returns>A SQLiteCommandBuilder object.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFactory.CreateConnection">
            <summary>
            Creates a new SQLiteConnection.
            </summary>
            <returns>A SQLiteConnection object.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFactory.CreateConnectionStringBuilder">
            <summary>
            Creates a new SQLiteConnectionStringBuilder.
            </summary>
            <returns>A SQLiteConnectionStringBuilder object.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFactory.CreateDataAdapter">
            <summary>
            Creates a new SQLiteDataAdapter.
            </summary>
            <returns>A SQLiteDataAdapter object.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFactory.CreateParameter">
            <summary>
            Creates a new SQLiteParameter.
            </summary>
            <returns>A SQLiteParameter object.</returns>
        </member>
        <member name="T:System.Data.SQLite.SQLiteCommandBuilder">
            <summary>
            SQLite implementation of DbCommandBuilder.
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommandBuilder.#ctor">
            <summary>







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







3100
3101
3102
3103
3104
3105
3106














































3107
3108
3109
3110
3111
3112
3113
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteFunctionAttribute.FuncType">
            <summary>
            The type of function this implementation will be.
            </summary>
        </member>














































        <member name="T:System.Data.SQLite.SQLiteCommandBuilder">
            <summary>
            SQLite implementation of DbCommandBuilder.
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommandBuilder.#ctor">
            <summary>
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 test/Program.cs.
10
11
12
13
14
15
16
17

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
  {
    static void Main(string[] args)
    {
      DbProviderFactory fact;
      fact = DbProviderFactories.GetFactory("System.Data.SQLite");

      System.IO.File.Delete("test.db3");
      using (DbConnection cnn = fact.CreateConnection())

      {
        cnn.ConnectionString = "Data Source=test.db3";
        cnn.Open();

//        using (DbCommand cmd = cnn.CreateCommand())
//        {
//          cmd.CommandText = @"CREATE TABLE test (col1 VARCHAR(30), col2 DECIMAL(10, 4));
//INSERT INTO test VALUES('test 1', 3);
//INSERT INTO test VALUES('test 2', 4.44);";
//          object value = cmd.ExecuteNonQuery();

//          cmd.CommandText = "SELECT col1, SUM(col2) FROM test GROUP BY col1";

//          using (DbDataReader reader = cmd.ExecuteReader())
//          {
//            while (reader.Read())
//            {
//              object val1 = reader[0];
//              object val2 = reader[1];
//            }
//          }
//          Console.ReadLine();
//        }

        TestCases.Run(fact, cnn);
      }

      Console.ReadKey();
    }








|
>

|

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







10
11
12
13
14
15
16
17
18
19
20
21




















22
23
24
25
26
27
28
  {
    static void Main(string[] args)
    {
      DbProviderFactory fact;
      fact = DbProviderFactories.GetFactory("System.Data.SQLite");

      System.IO.File.Delete("test.db3");

      using (SQLiteConnection cnn = new SQLiteConnection())
      {
        cnn.ConnectionString = "Data Source=test.db3;Cache Size=4000;Page Size=4096;Legacy Format=False";
        cnn.Open();





















        TestCases.Run(fact, cnn);
      }

      Console.ReadKey();
    }

Changes to test/TestCases.cs.
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
    internal static void DisposePattenTest(DbConnection cnn)
    {
      using (DbConnection newcnn = ((ICloneable)cnn).Clone() as DbConnection)
      {
        for (int x = 0; x < 10000; x++)
        {
          DbCommand cmd = newcnn.CreateCommand();
          cmd.CommandText = "SELECT * FROM sqlite_master";
          DbDataReader reader = cmd.ExecuteReader();
          reader.Read();
        }
      }
    }

    internal static void KeyInfoTest(DbProviderFactory fact, DbConnection cnn)







|







158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
    internal static void DisposePattenTest(DbConnection cnn)
    {
      using (DbConnection newcnn = ((ICloneable)cnn).Clone() as DbConnection)
      {
        for (int x = 0; x < 10000; x++)
        {
          DbCommand cmd = newcnn.CreateCommand();
          cmd.CommandText = "SELECT * FROM TestCase";
          DbDataReader reader = cmd.ExecuteReader();
          reader.Read();
        }
      }
    }

    internal static void KeyInfoTest(DbProviderFactory fact, DbConnection cnn)
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
      }
    }

    internal static void CreateTable(DbConnection cnn)
    {
      using (DbCommand cmd = cnn.CreateCommand())
      {
        cmd.CommandText = "CREATE TABLE TestCase (ID integer primary key autoincrement, Field1 Integer, Field2 Float, Field3 VARCHAR(50), Field4 CHAR(10), Field5 DateTime, Field6 Image)";
        //cmd.CommandText = "CREATE TABLE TestCase (ID bigint primary key identity, Field1 Integer, Field2 Float, Field3 VARCHAR(50), Field4 CHAR(10), Field5 DateTime, Field6 Image)";
        cmd.ExecuteNonQuery();
      }
    }

    internal static void DropTable(DbConnection cnn)
    {







|







327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
      }
    }

    internal static void CreateTable(DbConnection cnn)
    {
      using (DbCommand cmd = cnn.CreateCommand())
      {
        cmd.CommandText = "CREATE TABLE TestCase (ID integer primary key autoincrement, Field1 int, Field2 Float, Field3 VARCHAR(50), Field4 CHAR(10), Field5 DateTime, Field6 Image)";
        //cmd.CommandText = "CREATE TABLE TestCase (ID bigint primary key identity, Field1 Integer, Field2 Float, Field3 VARCHAR(50), Field4 CHAR(10), Field5 DateTime, Field6 Image)";
        cmd.ExecuteNonQuery();
      }
    }

    internal static void DropTable(DbConnection cnn)
    {
649
650
651
652
653
654
655






656
657
658
659
660
661
662

                  dtStart = Environment.TickCount;
                  dbTrans.Commit();
                  dtEnd = Environment.TickCount;
                  dtEnd -= dtStart;
                  Console.WriteLine(String.Format("Commits in {0} ms", (dtEnd)));
                }






              }
            }
          }
        }
      }
    }








>
>
>
>
>
>







649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668

                  dtStart = Environment.TickCount;
                  dbTrans.Commit();
                  dtEnd = Environment.TickCount;
                  dtEnd -= dtStart;
                  Console.WriteLine(String.Format("Commits in {0} ms", (dtEnd)));
                }

                using (DataTable tbl = new DataTable())
                {
                  adp.SelectCommand.CommandText = "SELECT * FROM TestCase";
                  adp.Fill(tbl);
                }
              }
            }
          }
        }
      }
    }

698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
    // Causes the user-defined function to be called
    internal static void UserFunction(DbConnection cnn)
    {
      using (DbCommand cmd = cnn.CreateCommand())
      {
        int nTimes;
        int dtStart;

        nTimes = 0;
        cmd.CommandText = "SELECT Foo('ee','foo')";
        dtStart = Environment.TickCount;
        while (Environment.TickCount - dtStart < 1000)
        {
          cmd.ExecuteNonQuery();
          nTimes++;







|







704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
    // Causes the user-defined function to be called
    internal static void UserFunction(DbConnection cnn)
    {
      using (DbCommand cmd = cnn.CreateCommand())
      {
        int nTimes;
        int dtStart;
        
        nTimes = 0;
        cmd.CommandText = "SELECT Foo('ee','foo')";
        dtStart = Environment.TickCount;
        while (Environment.TickCount - dtStart < 1000)
        {
          cmd.ExecuteNonQuery();
          nTimes++;
Changes to tools/install/Resources/System.Data.SQLite.dll.

cannot compute difference between binary files

Changes to tools/mergebin/MetaDataTables.cpp.
92
93
94
95
96
97
98

99
100
101
102
103
104
105
    pdwLength = m_pdwTableLengthIndex[*puiTables];
    if (pdwLength)
      dwMaxRows = max(dwMaxRows, pdwLength[0]);

    puiTables ++;
  }


  return (dwMaxRows > (ULONG)(2 << (16 - uCount))) ? 4 : 2;
}

CTableData *CMetadataTables::GetTable(UINT uId)
{
  return m_pTables[uId];
}







>
|






92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
    pdwLength = m_pdwTableLengthIndex[*puiTables];
    if (pdwLength)
      dwMaxRows = max(dwMaxRows, pdwLength[0]);

    puiTables ++;
  }

  return (dwMaxRows > 0xFFFF) ? 4 : 2;
  //return (dwMaxRows > (ULONG)(2 << (16 - uCount))) ? 4 : 2;
}

CTableData *CMetadataTables::GetTable(UINT uId)
{
  return m_pTables[uId];
}
Changes to tools/setup/exe/setup/setup.rc.
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85

/////////////////////////////////////////////////////////////////////////////
//
// Version
//

VS_VERSION_INFO VERSIONINFO
 FILEVERSION 1,0,43,0
 PRODUCTVERSION 1,0,0,0
 FILEFLAGSMASK 0x17L
#ifdef _DEBUG
 FILEFLAGS 0x1L
#else
 FILEFLAGS 0x0L
#endif
 FILEOS 0x4L
 FILETYPE 0x1L
 FILESUBTYPE 0x0L
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "040904b0"
        BEGIN
            VALUE "Comments", "http://sqlite.phxsoftware.com"
            VALUE "FileDescription", "SQLite ADO.NET 2.0 Setup"
            VALUE "FileVersion", "1.0.43.0"
            VALUE "InternalName", "setup"
            VALUE "LegalCopyright", "Released to the public domain"
            VALUE "OriginalFilename", "setup.exe"
            VALUE "ProductName", "System.Data.SQLite"
            VALUE "ProductVersion", "1.0"
        END
    END







|

















|







53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85

/////////////////////////////////////////////////////////////////////////////
//
// Version
//

VS_VERSION_INFO VERSIONINFO
 FILEVERSION 1,0,45,0
 PRODUCTVERSION 1,0,0,0
 FILEFLAGSMASK 0x17L
#ifdef _DEBUG
 FILEFLAGS 0x1L
#else
 FILEFLAGS 0x0L
#endif
 FILEOS 0x4L
 FILETYPE 0x1L
 FILESUBTYPE 0x0L
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "040904b0"
        BEGIN
            VALUE "Comments", "http://sqlite.phxsoftware.com"
            VALUE "FileDescription", "SQLite ADO.NET 2.0 Setup"
            VALUE "FileVersion", "1.0.45.0"
            VALUE "InternalName", "setup"
            VALUE "LegalCopyright", "Released to the public domain"
            VALUE "OriginalFilename", "setup.exe"
            VALUE "ProductName", "System.Data.SQLite"
            VALUE "ProductVersion", "1.0"
        END
    END
Changes to tools/setup/sqlite_setup.suo.

cannot compute difference between binary files

Changes to tools/setup/sqlite_setup.vdproj.
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
            "IsDependency" = "11:FALSE"
            "IsolateTo" = "8:"
            }
            "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_2C7EDFF06B61482393D94E3A63D90113"
            {
            "AssemblyRegister" = "3:1"
            "AssemblyIsInGAC" = "11:FALSE"
            "AssemblyAsmDisplayName" = "8:test, Version=1.0.0.2191, Culture=neutral, processorArchitecture=x86"
                "ScatterAssemblies"
                {
                    "_2C7EDFF06B61482393D94E3A63D90113"
                    {
                    "Name" = "8:test.exe"
                    "Attributes" = "3:512"
                    }







|







618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
            "IsDependency" = "11:FALSE"
            "IsolateTo" = "8:"
            }
            "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_2C7EDFF06B61482393D94E3A63D90113"
            {
            "AssemblyRegister" = "3:1"
            "AssemblyIsInGAC" = "11:FALSE"
            "AssemblyAsmDisplayName" = "8:test, Version=1.0.0.27079, Culture=neutral, processorArchitecture=x86"
                "ScatterAssemblies"
                {
                    "_2C7EDFF06B61482393D94E3A63D90113"
                    {
                    "Name" = "8:test.exe"
                    "Attributes" = "3:512"
                    }
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
            "IsDependency" = "11:FALSE"
            "IsolateTo" = "8:"
            }
            "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_40DFF08BA903482D807E715A041CA8B1"
            {
            "AssemblyRegister" = "3:1"
            "AssemblyIsInGAC" = "11:FALSE"
            "AssemblyAsmDisplayName" = "8:install, Version=1.0.0.2313, Culture=neutral, processorArchitecture=x86"
                "ScatterAssemblies"
                {
                    "_40DFF08BA903482D807E715A041CA8B1"
                    {
                    "Name" = "8:install.exe"
                    "Attributes" = "3:512"
                    }







|







751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
            "IsDependency" = "11:FALSE"
            "IsolateTo" = "8:"
            }
            "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_40DFF08BA903482D807E715A041CA8B1"
            {
            "AssemblyRegister" = "3:1"
            "AssemblyIsInGAC" = "11:FALSE"
            "AssemblyAsmDisplayName" = "8:install, Version=1.0.0.27432, Culture=neutral, processorArchitecture=x86"
                "ScatterAssemblies"
                {
                    "_40DFF08BA903482D807E715A041CA8B1"
                    {
                    "Name" = "8:install.exe"
                    "Attributes" = "3:512"
                    }
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
            "IsDependency" = "11:FALSE"
            "IsolateTo" = "8:"
            }
            "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_40F352185F3B41A485F42BFC64BF9162"
            {
            "AssemblyRegister" = "3:1"
            "AssemblyIsInGAC" = "11:FALSE"
            "AssemblyAsmDisplayName" = "8:testce, Version=1.0.0.2295, Culture=neutral, processorArchitecture=MSIL"
                "ScatterAssemblies"
                {
                    "_40F352185F3B41A485F42BFC64BF9162"
                    {
                    "Name" = "8:testce.exe"
                    "Attributes" = "3:512"
                    }







|







782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
            "IsDependency" = "11:FALSE"
            "IsolateTo" = "8:"
            }
            "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_40F352185F3B41A485F42BFC64BF9162"
            {
            "AssemblyRegister" = "3:1"
            "AssemblyIsInGAC" = "11:FALSE"
            "AssemblyAsmDisplayName" = "8:testce, Version=1.0.0.27115, Culture=neutral, processorArchitecture=MSIL"
                "ScatterAssemblies"
                {
                    "_40F352185F3B41A485F42BFC64BF9162"
                    {
                    "Name" = "8:testce.exe"
                    "Attributes" = "3:512"
                    }
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
            "IsDependency" = "11:FALSE"
            "IsolateTo" = "8:"
            }
            "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_A18DBDB7776215EAD9A52C96F8CA1E91"
            {
            "AssemblyRegister" = "3:1"
            "AssemblyIsInGAC" = "11:FALSE"
            "AssemblyAsmDisplayName" = "8:System.Data.SQLite, Version=1.0.44.0, Culture=neutral, PublicKeyToken=1fdb50b1b62b4c84, processorArchitecture=x86"
                "ScatterAssemblies"
                {
                    "_A18DBDB7776215EAD9A52C96F8CA1E91"
                    {
                    "Name" = "8:System.Data.SQLite.DLL"
                    "Attributes" = "3:512"
                    }







|







935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
            "IsDependency" = "11:FALSE"
            "IsolateTo" = "8:"
            }
            "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_A18DBDB7776215EAD9A52C96F8CA1E91"
            {
            "AssemblyRegister" = "3:1"
            "AssemblyIsInGAC" = "11:FALSE"
            "AssemblyAsmDisplayName" = "8:System.Data.SQLite, Version=1.0.45.0, Culture=neutral, PublicKeyToken=1fdb50b1b62b4c84, processorArchitecture=x86"
                "ScatterAssemblies"
                {
                    "_A18DBDB7776215EAD9A52C96F8CA1E91"
                    {
                    "Name" = "8:System.Data.SQLite.DLL"
                    "Attributes" = "3:512"
                    }
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
            "IsDependency" = "11:TRUE"
            "IsolateTo" = "8:"
            }
            "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_F320FBAE871DA320178BEEA242900CC7"
            {
            "AssemblyRegister" = "3:1"
            "AssemblyIsInGAC" = "11:FALSE"
            "AssemblyAsmDisplayName" = "8:System.Data.SQLite, Version=1.0.44.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=x86"
                "ScatterAssemblies"
                {
                    "_F320FBAE871DA320178BEEA242900CC7"
                    {
                    "Name" = "8:System.Data.SQLite.DLL"
                    "Attributes" = "3:512"
                    }







|







1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
            "IsDependency" = "11:TRUE"
            "IsolateTo" = "8:"
            }
            "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_F320FBAE871DA320178BEEA242900CC7"
            {
            "AssemblyRegister" = "3:1"
            "AssemblyIsInGAC" = "11:FALSE"
            "AssemblyAsmDisplayName" = "8:System.Data.SQLite, Version=1.0.45.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=x86"
                "ScatterAssemblies"
                {
                    "_F320FBAE871DA320178BEEA242900CC7"
                    {
                    "Name" = "8:System.Data.SQLite.DLL"
                    "Attributes" = "3:512"
                    }
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
        {
        "LangId" = "3:1033"
        }
        "Product"
        {
        "Name" = "8:Microsoft Visual Studio"
        "ProductName" = "8:SQLite ADO.NET 2.0 Provider"
        "ProductCode" = "8:{0328624C-229F-495A-82CB-F06A9E0DC49C}"
        "PackageCode" = "8:{F20F973B-8E83-4DFB-8E1F-48879C65ACBB}"
        "UpgradeCode" = "8:{78329A82-AFB1-453B-AF00-D46AC911DA89}"
        "RestartWWWService" = "11:FALSE"
        "RemovePreviousVersions" = "11:TRUE"
        "DetectNewerInstalledVersion" = "11:TRUE"
        "InstallAllUsers" = "11:TRUE"
        "ProductVersion" = "8:1.044.0"
        "Manufacturer" = "8:Phoenix Software Solutions, LLC"
        "ARPHELPTELEPHONE" = "8:"
        "ARPHELPLINK" = "8:http://sqlite.phxsoftware.com"
        "Title" = "8:SQLite ADO.NET 2.0 Provider"
        "Subject" = "8:"
        "ARPCONTACT" = "8:Phoenix Software Solutions, LLC"
        "Keywords" = "8:"







|
|





|







1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
        {
        "LangId" = "3:1033"
        }
        "Product"
        {
        "Name" = "8:Microsoft Visual Studio"
        "ProductName" = "8:SQLite ADO.NET 2.0 Provider"
        "ProductCode" = "8:{C8C58E1B-E2E4-4838-A284-A0BF4BAC2E17}"
        "PackageCode" = "8:{6C5503A2-52F8-4C54-8DC1-D970D0F17756}"
        "UpgradeCode" = "8:{78329A82-AFB1-453B-AF00-D46AC911DA89}"
        "RestartWWWService" = "11:FALSE"
        "RemovePreviousVersions" = "11:TRUE"
        "DetectNewerInstalledVersion" = "11:TRUE"
        "InstallAllUsers" = "11:TRUE"
        "ProductVersion" = "8:1.045.0"
        "Manufacturer" = "8:Phoenix Software Solutions, LLC"
        "ARPHELPTELEPHONE" = "8:"
        "ARPHELPLINK" = "8:http://sqlite.phxsoftware.com"
        "Title" = "8:SQLite ADO.NET 2.0 Provider"
        "Subject" = "8:"
        "ARPCONTACT" = "8:Phoenix Software Solutions, LLC"
        "Keywords" = "8:"