System.Data.SQLite

Check-in Differences
Login

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

Difference From aa7259812fea0aac To 7cf3031f35a5acf1

2012-09-14
12:18
Merge all Visual Studio 2012 related changes to trunk. check-in: 3def70ce5e user: mistachkin tags: trunk
07:34
Initial work on supporting Visual Studio 2012. check-in: 58dc41d4c8 user: mistachkin tags: vs2012
2012-09-12
04:29
Update SQLite core library to the latest trunk code and add support for the sqlite3_errstr API. check-in: aa7259812f user: mistachkin tags: trunk
01:56
Fix comments in the SQLiteException class, including an out-of-order summary end-tag. Make sure the error code of the SQLiteException class gets serialized. Make the test project for the .NET Compact Framework more flexible. check-in: 94c5213e35 user: mistachkin tags: trunk
2012-03-24
16:48
Add support for the native SQLite Online Backup API. check-in: 4926b5d713 user: mistachkin tags: trunk
16:46
Update version history docs. Closed-Leaf check-in: 7cf3031f35 user: mistachkin tags: backupApi
16:12
Fix typo in test case. check-in: ca5d14e4ae user: mistachkin tags: backupApi

Changes to Doc/Extra/dbfactorysupport.html.
81
82
83
84
85
86
87
88

89
90
91
92
93
94
95
81
82
83
84
85
86
87

88
89
90
91
92
93
94
95







-
+







<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.83.0, Culture=neutral,
                 Version=1.0.80.0, Culture=neutral,
                 PublicKeyToken=db937bc2d44ff139"/>
    </DbProviderFactories>
  </system.data>
</configuration>
</pre>
      </div>
      <p>
Deleted Doc/Extra/environment.html.
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















































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<html dir="LTR" xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:MSHelp="http://msdn.microsoft.com/mshelp" xmlns:tool="http://www.microsoft.com/tooltip" xmlns:ndoc="urn:ndoc-preprocess">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <title>Environment Variables</title>
    <link rel="stylesheet" type="text/css" href="ndoc.css" />
  </head>
  <body>
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">Environment Variables</span>
          </td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite.NET Class Library Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">
          <td>
            <a id="seeAlsoSectionLink" href="#seeAlsoToggle" onclick="OpenSection(seeAlsoToggle)">See Also</a>
            <a id="exampleSectionLink" href="#codeExampleToggle" onclick="OpenSection(codeExampleToggle)">Example</a>
          </td>
        </tr>
     </table>
      <table width="100%" id="bottomTable" cellspacing="0" cellpadding="0" style="display:none">
        <tr>
          <td>
            <span onclick="ExpandCollapseAll(toggleAllImage)" style="cursor:default;" onkeypress="ExpandCollapseAll_CheckKey(toggleAllImage)" tabindex="0">
              <img ID="toggleAllImage" class="toggleAll" src="collall.gif" />
              <label id="collapseAllLabel" for="toggleAllImage" style="display: none;">
							Collapse All
						</label>
              <label id="expandAllLabel" for="toggleAllImage" style="display: none;">
							Expand All
						</label>
            </span>
          </td>
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">
      <p>These environment variables are used to control several features of
        the System.Data.SQLite library.  All of these environment variables
        are optional.
      </p>
      <p>
        <font color="red">
          None of these environment variables are supported by the Compact
          Framework builds of System.Data.SQLite, due to limitations imposed
          by the platform itself.
        </font>
      </p>
      <table width="80%" cellpadding="0" cellspacing="0">
        <tr valign="top">
          <th>Name</th>
          <th>Description</th>
        </tr>
        <tr valign="top">
          <td>Force_SQLiteLog</td>
          <td>If this environment variable is set [to anything], the SQLite
          logging subsystem may be initialized in a non-default application
          domain.  By default, this is not allowed due to the potential for
          application domain unloading issues.</td>
        </tr>
        <tr valign="top">
          <td>No_PreLoadSQLite</td>
          <td>If this environment variable is set [to anything], the native
          library pre-loading functionality will be disabled.  By default,
          the native library pre-loading will attempt to load the native
          SQLite library from architecture-specific (e.g. "Win32") or
          platform-specific (e.g. "x86", "amd64", "x64") directories that
          reside underneath the application base directory.</td>
        </tr>
        <tr valign="top">
          <td>PreLoadSQLite_BaseDirectory</td>
          <td>If this environment variable is set [to anything], it will be
          used instead of the application base directory by the native
          library pre-loader.</td>
        </tr>
        <tr valign="top">
          <td>PreLoadSQLite_ProcessorArchitecture</td>
          <td>If this environment variable is set [to anything], it will be
          used instead of the processor architecture value contained in the
          PROCESSOR_ARCHITECTURE environment variable to help build the path
          of the native library to pre-load.</td>
        </tr>
        <tr valign="top">
          <td>PROCESSOR_ARCHITECTURE</td>
          <td>This environment variable is normally set by the operating
          system itself and should reflect the native processor architecture
          of the current process (e.g. a 32-bit x86 application running on a
          64-bit x64 operating system should have the value &quot;x86&quot;).
          </td>
        </tr>
      </table>
      <hr/>
      <div id="footer">
        <p>
          <a href="mailto:sqlite-users@sqlite.org?subject=SQLite.NET%20Class%20Library%20Documentation%20Feedback:%20Environment%20Variables">
            Send comments on this topic.</a>
        </p>
        <p>
        </p>
      </div>
    </div>
    </div>
  </body>
</html>
Changes to Doc/Extra/ndoc.css.
Changes to Doc/Extra/version.html.
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
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







-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+

-











-
+







          </td>
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">
    <h1 class="heading">Version History</h1>
    <p><b>1.0.83.0 - November XX, 2012 <font color="red">(release scheduled)</font></b></p>
    <ul>
      <li>Updated to <a href="http://www.sqlite.org/src/info/trunk">SQLite 3.7.15</a>.</li>
      <li>Add an overload of the SQLiteLog.LogMessage method that takes a single string argument.</li>
      <li>All applicable calls into the SQLite core library now return a SQLiteErrorCode instead of an integer error code.</li>
      <li>Make sure the error code of the SQLiteException class gets serialized.</li>
      <li>Make the test project for the .NET Compact Framework more flexible.</li>
      <li>When available, the new sqlite3_errstr function from the core library is used to get the error message for a specific return code.</li>
      <li>The SetMemoryStatus, Shutdown, ResultCode, ExtendedResultCode, and SetAvRetry methods of the SQLiteConnection class now return a SQLiteErrorCode instead of an integer error code.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>The public constructor for the SQLiteException now takes a SQLiteErrorCode instead of an integer error code.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>The ErrorCode field of the LogEventArgs is now an object instead of an integer.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>The names and messages associated with the SQLiteErrorCode enumeration values have been normalized to match those in the SQLite core library.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    </ul>
    <p><b>1.0.82.0 - September 3, 2012</b></p>
    <ul>
      <li>Updated to <a href="http://www.sqlite.org/releaselog/3_7_14.html">SQLite 3.7.14</a>.</li>
      <li>Properly handle quoted data source values in the connection string. Fix for <a href="http://system.data.sqlite.org/index.html/info/8c3bee31c8">[8c3bee31c8]</a>.</li>
      <li>The <a href="http://nuget.org/packages/System.Data.SQLite">primary NuGet package</a> now supports x86 / x64 and the .NET Framework 2.0 / 4.0 (i.e. in a single package).</li>
      <li>Change the default value for the Synchronous connection string property to Full to match the default used by the SQLite core library itself.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Add the ability to skip applying default connection settings to opened databases via the new SetDefaults connection string property.</li>
      <li>Add the ability to skip expanding data source file names to their fully qualified paths via the new ToFullPath connection string property.</li>
      <li>Fix the database cleanup ordering in the tests for ticket <a href="http://system.data.sqlite.org/index.html/info/343d392b51">[343d392b51]</a>.</li>
      <li>Add support for the sqlite3_close_v2 function from the SQLite core library.</li>
      <li>Add support for <a href="http://www.sqlite.org/uri.html">URI file names</a> via the new FullUri connection string property.</li>
      <li>Improve support for the standard SQLite core library in the LINQ assembly and the test suite.</li>
      <li>Add SetMemoryStatus static method to the SQLiteConnection class.</li>
      <li>Improve threaded handling of the delegate used by the SQLiteLog class.</li>
      <li>Add define constants to support enabling or disabling individual groups of trace statements.</li>
    </ul>
    <p><b>1.0.81.0 - May 27, 2012</b></p>
    <ul>
      <li>Updated to <a href="http://www.sqlite.org/releaselog/3_7_12_1.html">SQLite 3.7.12.1</a>.</li>
      <li>Support compiling the interop assembly without support for the custom extension functions and the CryptoAPI based codec.</li>
      <li>Add DefineConstants property to the SQLiteConnection class to return the list of define constants used when compiling the core managed assembly.</li>
      <li>Add release archive verification tool to the release automation.</li>
      <li>Fix NullReferenceException when calling the SQLiteDataAdapter.FillSchema method on a query that returns multiple result sets. Fix for <a href="http://system.data.sqlite.org/index.html/info/3aa50d8413">[3aa50d8413]</a>.</li>
      <li>Fix subtle race condition between threads fetching connection handles from the connection pool and any garbage collection (GC) threads that may be running. Fix for <a href="http://system.data.sqlite.org/index.html/info/996d13cd87">[996d13cd87]</a>.</li>
      <li>Add missing call to SetTimeout in the SQLite3_UTF16.Open method.</li>
      <li>Add checks to prevent the SQLiteConnectionPool.Remove method from returning any connection handles that are closed or invalid.</li>
      <li>Modify static SQLiteBase helper methods to prevent them from passing IntPtr.Zero to the SQLite native library.</li>
      <li>Remove static locks from the static helper methods in the SQLiteBase class, replacing them with a lock on the connection handle instance being operated upon.</li>
      <li>Revise CriticalHandle derived classes to make them more thread-safe.</li>
      <li>Add connection pool related diagnostic messages when compiled with the DEBUG define constant.</li>
      <li>Add PoolCount property to the SQLiteConnection class to return the number of pool entries for the file name associated with the connection.</li>
      <li>Rename internal SQLiteLastError methods to GetLastError.</li>
      <li>Add assembly file test constraints to all tests that execute the &quot;test.exe&quot; or &quot;testlinq.exe&quot; files.</li>
    </ul>
    <p><b>1.0.80.0 - April 1, 2012</b></p>
    <p><b>1.0.80.0 - April XX, 2012</b></p>
    <ul>
      <li>Updated to <a href="http://www.sqlite.org/releaselog/3_7_11.html">SQLite 3.7.11</a>.</li>
      <li>In the SQLiteFunction class, when calling user-provided methods from a delegate called by native code, avoid throwing exceptions, optionally tracing the caught exceptions. Fix for <a href="http://system.data.sqlite.org/index.html/info/8a426d12eb">[8a426d12eb]</a>.</li>
      <li>Add Visual Studio 2005 support to all the applicable solution/project files, their associated supporting files, and the test suite.</li>
      <li>Add Visual Studio 2005 support to the redesigned designer support installer.</li>
      <li>Add experimental support for &quot;pre-loading&quot; the native SQLite library based on the processor architecture of the current process.  This feature is now enabled by default at compile-time.</li>
      <li>Add support for the native <a href="http://www.sqlite.org/backup.html">SQLite Online Backup API</a>. Fix for <a href="http://system.data.sqlite.org/index.html/info/c71846ed57">[c71846ed57]</a>.</li>
      <li>Acquire and hold a static data lock while checking if the native SQLite library has been initialized to prevent a subtle race condition that can result in superfluous error messages. Fix for <a href="http://system.data.sqlite.org/index.html/info/72905c9a77">[72905c9a77]</a>.</li>
      <li>Support tracing of all parameter binding activity and use the connection flags to control what is traced.</li>
      <li>When converting a DateTime instance of an &quot;Unspecified&quot; kind to a string, use the same kind as the connection, if available.</li>
      <li>Add overload of the SQLiteDataReader.GetValues method that returns a NameValueCollection.</li>
      <li>Add static ToUnixEpoch method to the SQLiteConvert class to convert a DateTime value to the number of whole seconds since the Unix epoch.</li>
      <li>In the implicit conversion operators (to IntPtr) for both the SQLiteConnectionHandle and SQLiteStatementHandle classes, return IntPtr.Zero if the instance being converted is null.</li>
      <li>Write warning message to the active trace listeners (for the Debug build configuration only) if a column type or type name cannot be mapped properly. See <a href="http://system.data.sqlite.org/index.html/info/4bbf851fa5">[4bbf851fa5]</a>.</li>
      <li>Write warning message to the active trace listners (for the Debug build configuration only) if a column type or type name cannot be mapped properly. See <a href="http://system.data.sqlite.org/index.html/info/4bbf851fa5">[4bbf851fa5]</a>.</li>
      <li>When tracing SQL statements to be prepared, bypass the internal length limit of the sqlite3_log function by using the SQLiteLog class directly instead. Also, detect null and/or empty strings and emit a special message in that case.</li>
      <li>For the setup, the Visual Studio task should only be initially checked if the GAC task is available and vice-versa.</li>
      <li>Improve compatibility with custom command processors by using __ECHO instead of _ECHO in batch tools.</li>
      <li>Add OpenAndReturn method to the SQLiteConnection class to open a connection and return it.</li>
      <li>Add missing CheckDisposed calls to the SQLiteConnection class.</li>
      <li>Add missing throw statement to the SQLiteConnection class.</li>
      <li>Make sure the interop project uses /fp:precise for Windows CE.</li>
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
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







-
-
-
-
-


-
-
-
-
-
+
+
+
+
+



-
-
+
+



-
-
+
+







      <li>Add the correct directory to the path. Fix for <a href="http://system.data.sqlite.org/index.html/info/50515a0c8e">[50515a0c8e]</a>.</li>
    </ul>
    <p><b>1.0.71.0 - April 27, 2011</b></p>
    <ul>
      <li>Updated to SQLite 3.7.6+ <a href="http://www.sqlite.org/src/info/1bd1484cd7">[1bd1484cd7]</a> to get additional Windows error logging.</li>
      <li>Updated setup to optionally add install directory to PATH if GAC option selected.</li>
    </ul>
    <p><b>1.0.70.0 - April 22, 2011</b></p>
    <ul>
      <li>Added support for sqlite3_extended_result_codes(), sqlite3_errcode(), and sqlite3_extended_errcode() via SetExtendedResultCodes(), ResultCode(), and ExtendedResultCode().</li>
      <li>Added support for SQLITE_CONFIG_LOG via SQLiteLogEventHandler().</li>
    </ul>
    <p><b>1.0.69.0 - April 12, 2011</b></p>
    <ul>
      <li>Code merge with <a href="http://www.sqlite.org/releaselog/3_7_6.html">SQLite 3.7.6</a>.</li>
      <li>New VS2008 and VS2010 solution files.</li>
      <li>Build and packaging automation.</li>
      <li>New Inno Setup files.</li>
      <li>Designer support currently not ready for release.</li>
      <li>Code merge with <a href="http://www.sqlite.org/releaselog/3_7_6.html">SQLite 3.7.6</a></li>
      <li>New VS2008 and VS2010 solution files</li>
      <li>Build and packaging automation</li>
      <li>New Inno Setup files</li>
      <li>Designer support currently not ready for release</li>
    </ul>
    <p><b>1.0.68.0 - February 2011</b></p>
    <ul>
      <li>Code merge with <a href="http://www.sqlite.org/releaselog/3_7_5.html">SQLite 3.7.5</a>.</li>
      <li>Continuing work on supporting Visual Studio 2010.</li>
      <li>Code merge with <a href="http://www.sqlite.org/releaselog/3_7_5.html">SQLite 3.7.5</a></li>
      <li>Continuing work on supporting Visual Studio 2010</li>
    </ul>
    <p><b>1.0.67.0 - January 3, 2011</b></p>
    <ul>
      <li>Code merge with <a href="http://www.sqlite.org/releaselog/3_7_4.html">SQLite 3.7.4</a>.</li>
      <li>Continuing work on supporting Visual Studio 2010.</li>
      <li>Code merge with <a href="http://www.sqlite.org/releaselog/3_7_4.html">SQLite 3.7.4</a></li>
      <li>Continuing work on supporting Visual Studio 2010</li>
    </ul>
    <p><b>1.0.66.1 - August 1, 2010</b></p>
    <ul>
      <li>Code merge with SQLite 3.7.0.1</li>
      <li>Re-enabled VS2005 designer support, broken in previous versions during the 2008 transition</li>
      <li>Implemented new forms of Take/Skip in the EF framework courtesy jlsantiago</li>
      <li>Added "Foreign Keys" to the connection string parameters</li>
Changes to Doc/Extra/welcome.html.
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
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







-
-
-
-
+
+
+
+

-
-
+
+


-
-
-
-




-
+





-
+



-
+


-
+



-
+







-
+








-
-
+
+

-
+


-
+













-
+




-
+



-
+




-
+




-
-
+
+


-
+


-
+



















-
+











          </td>
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">
      <h1 class="heading">About SQLite.NET</h1>
      <p>This class library is an ADO.NET wrapper around the popular (and free!)
        SQLite database engine. For information on SQL syntax, features of SQLite and a
        good understanding of how it works and what it does, I highly recommend heading
        over to <a target="_blank" href="http://www.sqlite.org">sqlite.org</a> and
      <p>This class library is an ADO.NET wrapper around the popular (and free!) 
        SQLite database engine. For information on SQL syntax, features of SQLite and a 
        good understanding of how it works and what it does, I highly recommend heading 
        over to <a target="_blank" href="http://www.sqlite.org">sqlite.org</a> and 
        reading the documentation there.</p>
      <P>The C# provider, the very minor C code modifications to SQLite, documentation and
        etc&nbsp;were written by <A href="mailto:robert@blackcastlesoft.com">Robert
      <P>The C# provider, the very minor C code modifications to SQLite, documentation and 
        etc&nbsp;were written by <A href="mailto:robert@blackcastlesoft.com">Robert 
          Simpson</A>, and the SourceForge project page can be found <A target="_blank" href="http://sourceforge.net/projects/sqlite-dotnet2">
          here</A>.</P>
      <p>The System.Data.SQLite project is currently maintained by the
         <A target="_blank" href="http://www.sqlite.org/">SQLite Development Team</a> and
         the latest source code and project information can be found
         <A target="_blank" href="http://system.data.sqlite.org/">here</A>.</p>
      <DIV>
        <br>
      </DIV>
      <h1 class="heading">What's New?</h1>
      <p><a href="version.html">Click here to see the version history of this SQLite.NET
      <p><a href="version.html">Click here to see the version history of this SQLite.NET 
          provider</a></p>
      <DIV>
        <br>
      </DIV>
      <h1 class="heading">Using this library</h1>
      <p>The following are links to information on various aspects of the library and
      <p>The following are links to information on various aspects of the library and 
        how to use it in your application(s)
      </p>
      <p><a href="designer.html">How to install&nbsp;Visual Studio Design-Time Support</a></p>
      <P><A href="dbfactorysupport.html">How to configure and enumerate SQLite.NET
      <P><A href="dbfactorysupport.html">How to configure and enumerate SQLite.NET 
          through the DbProviderFactories object</A></P>
      <p><a href="optimizing.html">Getting the best performance out of SQLite</a></p>
      <p><a href="limitations.html">Limitations of the SQLite.NET provider and the SQLite
      <p><a href="limitations.html">Limitations of the SQLite.NET provider and the SQLite 
          engine (compared to other providers and engines)</a></p>
      <br>
      <h1 class="heading">SQLite.NET Provider Features</h1>
      <p>This SQLite provider implements every feature of the underlying SQLite
      <p>This SQLite provider implements every feature of the underlying SQLite 
        database engine without omission. Here's a brief summary:</p>
      <UL>
        <LI>
        Written from scratch on Visual Studio 2008 specifically for ADO.NET, implenting all the
        base classes and features recently introduced in the framework, including automatic
        transaction enlistment.<li>Supports the Full and Compact .NET Framework, as well as
          native C/C++ development.&nbsp; 100% binary compatible with the original sqlite3.dll.</li>
        <li>Full support for Mono via a &quot;managed only&quot; provider that runs against the
        <li>Full support for Mono via a &quot;managed only&quot; provider that runs against the 
          official SQLite 3.6.1 or higher library.</li>
        <li>Full Entity Framework support (ADO.NET 3.5 SP1)</li>
        <li>
        On the Compact Framework, it is faster than Sql Server Mobile.
          SQLite's installed size is a fraction of Sql Mobile's. It uses less memory at runtime,
          runs queries faster, and has a smaller database file size as well. </li>
        <li>Encrypted database support.&nbsp; Encrypted databases are fully encrypted and
          support both binary and cleartext password types. </li>
        <li>Visual Studio 2005/2008/2010 Design-Time Support.&nbsp; You can add a SQLite
        database to the Servers list, design queries with the Query Designer,
        <li>Visual Studio 2005/2008/2010 Design-Time Support.&nbsp; You can add a SQLite 
        database to the Servers list, design queries with the Query Designer, 
        drag-and-drop tables onto a Typed DataSet, etc.</li>
            <li>Full SQLite schema editing inside Visual Studio.&nbsp; You can create/edit
            <li>Full SQLite schema editing inside Visual Studio.&nbsp; You can create/edit 
              tables, views, triggers, indexes, check constraints and foreign keys. </li>
        <li>
        Available as a single file redistributable (except Compact Framework).&nbsp; The core sqlite3 codebase and the ADO.NET wrapper
        Available as a single file redistributable (except Compact Framework).&nbsp; The core sqlite3 codebase and the ADO.NET wrapper 
        are combined into one multi-module assembly. </li>
        <li>Also available as separate native and managed assemblies and optionally with the Visual C++ Runtime statically linked. </li>
        <li>
          Binaries included for Itanium, x64, x86 and ARM processors.
          <br />
          <font color="red">
            Itanium processor support not currently included.
          </font>
        </li>
        <li>
        DbProviderFactory support. </li>
        <li>
          Full support for ATTACH'ed databases.&nbsp; Exposed as <i>Catalogs</i>
        in the schema.&nbsp; When cloning a connection, all attached databases are
        in the schema.&nbsp; When cloning a connection, all attached databases are 
        automatically re-attached to the new connection. </li>
        <li>
          DbConnection.GetSchema(...) support includes the <i>MetaDataCollections</i>, <i>
          DataSourceInformation</i>, <i>Columns</i>, <i>Tables</i>, <i>Views, ViewColumns, </i>
          <i>Catalogs, </i><i>Indexes,
          <i>Catalogs, </i><i>Indexes, 
            IndexColumns, ForeignKeys </i>and <em>Triggers</em>.
        </li>
        <li>
        Enhanced DbDataReader.GetSchemaTable() functionality returns catalog, namespace
        Enhanced DbDataReader.GetSchemaTable() functionality returns catalog, namespace 
        and detailed schema information even for complex queries. </li>
        <li>
        Named and unnamed parameters. </li>
        <li>
        Full UTF-8 and UTF-16 support, each with optimized pipelines into the native
        Full UTF-8 and UTF-16 support, each with optimized pipelines into the native 
        database core. </li>
        <li>
        Multiple simultaneous DataReaders (one DataReader per Command however). </li>
        <li>
        Full support for user-defined scalar and aggregate functions, encapsulated into
        an easy-to-use base class in which only a couple of overrides are necessary to
        Full support for user-defined scalar and aggregate functions, encapsulated into 
        an easy-to-use base class in which only a couple of overrides are necessary to 
        implement new SQL functions. </li>
        <li>
        Full support for user-defined collating sequences, every bit as simple to
        Full support for user-defined collating sequences, every bit as simple to 
        implement as user-defined functions and uses the same base class. </li>
        <li>
          Full source for the entire engine and wrapper.&nbsp; No copyrights.&nbsp;
          Full source for the entire engine and wrapper.&nbsp; No copyrights.&nbsp; 
          Public Domain.&nbsp; 100% free for commercial and non-commercial use.&nbsp;</li>
      </UL>
      <br>
      <h1 class="heading">Distributing the Binaries (Desktop)</h1>
      <p>When using the mixed-mode assembly, the <b>System.Data.SQLite.DLL</b> file
        includes all the native and managed code. In that case, this is the only
        DLL required to be redistributed with your SQLite.NET application(s).&nbsp;
        When using separate native and managed assemblies, the
        <b>System.Data.SQLite.DLL</b> file contains all the managed code and the
        <b>SQLite.Interop.DLL</b> file contains all the native code.
        The native code comes in&nbsp;3 flavors: Win32, Itanium and x64 (AMD64).
        <br />
        <font color="red">
          Itanium processor support not currently included.
        </font>
      </p>
      <h1 class="heading">Distributing the Binaries (Compact Framework)</h1>
      <p>Both the <b>System.Data.SQLite.DLL </b>and <b>SQLite.Interop.XXX.DLL</b> files
        must be deployed on the Compact Framework.&nbsp; The XXX is the build number of
        the System.Data.SQLite library (e.g. &quot;083&quot;).&nbsp; The
        the System.Data.SQLite library (e.g. &quot;080&quot;).&nbsp; The
        <b>SQLite.Interop.XXX.DLL</b> file is a fully native assembly compiled for
        the ARM processor, and System.Data.SQLite is the fully-managed Compact
        Framework assembly.</p>
      <hr />
      <div id="footer">
        <p>
          <a href="mailto:sqlite-users@sqlite.org?subject=SQLite.NET%20Class%20Library%20Documentation%20Feedback:%20Welcome">
          Send comments on this topic.<!--[if gte IE 5]><tool:tip element="seeAlsoToolTip" avoidmouse="false" /><tool:tip element="languageFilterToolTip" avoidmouse="false" /><![endif]-->    </div>
    </div>
  </body>
</html>
Changes to Doc/SQLite.NET.chm.

cannot compute difference between binary files

Changes to Doc/SQLite.NET.hhc.
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
14
15
16
17
18
19
20




21
22
23
24
25
26
27







-
-
-
-







			<param name="Name" value="Installing Design-Time Support">
			<param name="Local" value="designer.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="Using DbProviderFactories">
			<param name="Local" value="dbfactorysupport.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="Environment Variables">
			<param name="Local" value="environment.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="Optimizing SQL Queries">
			<param name="Local" value="optimizing.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="Provider Limitations">
			<param name="Local" value="LImitations.html">
Changes to Doc/SQLite.NET.hhp.
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
9
10
11
12
13
14
15

16
17
18
19
20
21
22







-







Language=0x409 English (United States)
Title=SQLite.NET Help

[FILES]
Extra\ndoc.css
Extra\dbfactorysupport.html
Extra\designer.html
Extra\environment.html
Extra\lang_altertable.html
Extra\lang_analyze.html
Extra\lang_attach.html
Extra\lang_comment.html
Extra\lang_conflict.html
Extra\lang_createindex.html
Extra\lang_createtable.html
Changes to Externals/Eagle/bin/Eagle.dll.

cannot compute difference between binary files

Changes to Externals/Eagle/bin/EagleShell.exe.

cannot compute difference between binary files

Changes to Externals/Eagle/bin/EagleShell.exe.config.
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
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





-
+














-







<?xml version="1.0" encoding="UTF-8" ?>
<!--
 *
 * EagleShell.exe.config -
 *
 * Copyright (c) 2007-2012 by Joe Mistachkin.  All rights reserved.
 * Copyright (c) 2007-2010 by Joe Mistachkin.  All rights reserved.
 *
 * See the file "license.terms" for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: $
 *
-->
<configuration>
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
  </startup>

  <runtime>
    <!--
    <legacyCorruptedStateExceptionsPolicy enabled="true" />
    <NetFx40_LegacySecurityPolicy enabled="true" />
    <generatePublisherEvidence enabled="false" />
    -->

    <!--
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
Changes to Externals/Eagle/bin/EagleShell.exe.mda.config.
1
2
3
4
5
6

7
8
9
10
11
12
13
1
2
3
4
5

6
7
8
9
10
11
12
13





-
+







<?xml version="1.0" encoding="UTF-8" ?>
<!--
 *
 * EagleShell.exe.mda.config -
 *
 * Copyright (c) 2007-2012 by Joe Mistachkin.  All rights reserved.
 * Copyright (c) 2007-2010 by Joe Mistachkin.  All rights reserved.
 *
 * See the file "license.terms" for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: $
 *
-->
Changes to Externals/Eagle/lib/Eagle1.0/init.eagle.
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
222
223
224
225
226
227
228
















































229
230
231
232
233
234
235







-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-







      #
      set result [getColumnValue $row $column $default $wrap]
    }

    return $result
  }

  proc tqputs { channel string } {
    #
    # NOTE: If an output channel was provided, use it; otherwise, ignore the
    #       message.
    #
    if {[string length $channel] > 0} then {
      puts -nonewline $channel $string
    }

    tqlog $string
  }

  proc tqlog { string } {
    #
    # NOTE: If an empty string is supplied by the caller, do nothing.
    #
    if {[string length $string] > 0} then {
      #
      # NOTE: *SPECIAL* The special global variable "test_log_queue" is used
      #       by the [tlog] script library procedure from the test package to
      #       enable it to emit "queued" data into the test log file prior to
      #       emitting the string requested by its caller.  The only job for
      #       this procedure is to populate the "test_log_queue" variable for
      #       later use by the test package.
      #
      if {[info exists ::test_log_queue]} then {
        #
        # NOTE: Use the next queued test log entry.
        #
        set entry [expr {[array size ::test_log_queue] + 1}]
      } else {
        #
        # NOTE: Use the first queued test log entry.
        #
        set entry 1
      }

      #
      # NOTE: Add the new entry to the test log queue.  All entries will be
      #       sent to the actual test log file the very next time the [tlog]
      #       command from the test package is executed.
      #
      set ::test_log_queue($entry) $string
    }

    return ""
  }

  proc readFile { fileName } {
    #
    # NOTE: This should work properly in both Tcl and Eagle.
    #
    set file_id [open $fileName RDONLY]
    fconfigure $file_id -encoding binary -translation binary; # BINARY DATA
    set result [read $file_id]
470
471
472
473
474
475
476

477

478
479
480
481
482
483
484
422
423
424
425
426
427
428
429

430
431
432
433
434
435
436
437







+
-
+







      return [file normalize [file join [pwd] $path]]
    }
  }

  proc addToPath { dir } {
    #
    # NOTE: This should work properly in both Tcl and Eagle.
    #
    #       Normalize to an operating system native path.
    # NOTE: Normalize to an operating system native path.
    #
    set dir [file nativename $dir]

    #
    # NOTE: On Windows, use PATH; otherwise (i.e. Unix), use
    #       LD_LIBRARY_PATH.
    #
543
544
545
546
547
548
549

550

551
552
553
554
555
556
557
496
497
498
499
500
501
502
503

504
505
506
507
508
509
510
511







+
-
+







    #
    return false
  }

  proc removeFromPath { dir } {
    #
    # NOTE: This should work properly in both Tcl and Eagle.
    #
    #       Normalize to an operating system native path.
    # NOTE: Normalize to an operating system native path.
    #
    set dir [file nativename $dir]

    #
    # NOTE: On Windows, use PATH; otherwise (i.e. Unix), use
    #       LD_LIBRARY_PATH.
    #
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
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







-
-
-
-
-
-
-
-
-
+
+
+
+
+

-
-
-
-
+
+
+
+

-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+

-
-
-
-
-
+
+
+
+
+

-
-
-
-
+
+
+
+
-







    } elseif {$::tcl_platform(platform) eq "windows"} then {
      set separator \;
    } else {
      set separator :
    }

    #
    # NOTE: Does the necessary environment variable exist?
    #
    if {[info exists ::env($name)]} then {
      #
      # NOTE: We need to separate the directories in the path
      #       so that we can selectively remove the one we are
      #       looking for.
      #
      set dirs [split $::env($name) $separator]
    # NOTE: We need to separate the directories in the path
    #       so that we can selectively remove the one we are
    #       looking for.
    #
    set dirs [split $::env($name) $separator]

      #
      # BUGBUG: Consider exact case only for now.
      #
      set index [lsearch -exact $dirs $dir]
    #
    # BUGBUG: Consider exact case only for now.
    #
    set index [lsearch -exact $dirs $dir]

      #
      # NOTE: Is the directory in the loader search path?
      #
      if {$index != -1} then {
        #
        # NOTE: Remove the directory from the loader search path.
        #
        set dirs [lreplace $dirs $index $index]
    #
    # NOTE: Is the directory in the loader search path?
    #
    if {$index != -1} then {
      #
      # NOTE: Remove the directory from the loader search path.
      #
      set dirs [lreplace $dirs $index $index]

        #
        # NOTE: Replace the original loader search path with
        #       our modified one.
        #
        set ::env($name) [join $dirs $separator]
      #
      # NOTE: Replace the original loader search path with
      #       our modified one.
      #
      set ::env($name) [join $dirs $separator]

        #
        # NOTE: Yes, we altered the search path.
        #
        return true
      #
      # NOTE: Yes, we altered the search path.
      #
      return true
      }
    }

    #
    # NOTE: No, we did not alter the search path.
    #
    return false
  }
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
730
731
732
733
734
735
736

737










738
739
740
741
742
743
744







-
+
-
-
-
-
-
-
-
-
-
-








      #
      # NOTE: Return the list of process Ids, which may be empty.
      #
      return $result
    }

    proc waitForProcesses { ids timeout {collect true} } {
    proc waitForProcesses { ids timeout } {
      #
      # NOTE: If requested, run the garbage collector now.  This may be
      #       necessary to successfully wait for processes that are being
      #       kept alive via runtime callable wrappers for out-of-process
      #       COM servers (e.g. Excel).
      #
      if {$collect} then {
        debug collect true true
      }

      #
      # NOTE: Wait for each process in the list to exit.
      #
      foreach id $ids {
        #
        # NOTE: Get the process object by its Id.  If it does not exist,
        #       this will raise an error.
1388
1389
1390
1391
1392
1393
1394
1395

1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406

1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419

1420
1421
1422
1423
1424
1425
1426
1427
1428
1429


1430
1431
1432
1433
1434
1435
1436
1327
1328
1329
1330
1331
1332
1333

1334




1335
1336
1337
1338
1339
1340

1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353

1354
1355
1356
1357
1358
1359
1360
1361
1362


1363
1364
1365
1366
1367
1368
1369
1370
1371







-
+
-
-
-
-






-
+












-
+








-
-
+
+







      if {[string length $type] == 0} then {
        return ""
      }

      return [expr {[$type IsValueType] ? 0 : "null"}]
    }

    proc parray { a args } {
    proc parray { a {pattern *} } {
      if {[llength $args] > 2} then {
        error "wrong # args: should be \"parray a ?pattern?\""
      }

      upvar 1 $a array

      if {![array exists array]} {
        error "\"$a\" isn't an array"
      }

      set names [lsort [eval array names array $args]]
      set names [lsort [array names array $pattern]]
      set maxLength 0

      foreach name $names {
        set length [string length $name]

        if {$length > $maxLength} {
          set maxLength $length
        }
      }

      set maxLength [expr {$maxLength + [string length $a] + 2}]
      set hostLength [lindex [host size] 0]
      set valueLength [expr {$hostLength - $maxLength - 5}]; # " ... "
      set valueLength [expr {$hostLength - $maxLength - 5}]

      foreach name $names {
        #
        # NOTE: Format the array element name for display.
        #
        set nameString [appendArgs $a ( $name )]

        #
        # NOTE: If the value by itself is too long to fit on one host line,
        #       just truncate and ellipsis it.
        # NOTE: If the value by itself is too long to fit on one host
        #       line, just truncate and ellipsis it.
        #
        set valueString $array($name)

        if {[string length $valueString] > $valueLength} then {
          set valueString [appendArgs [string range $valueString 0 \
              [expr {$valueLength - 4}]] " ..."]
        }
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494

1495
1496
1497
1498
1499
1500
1501
1384
1385
1386
1387
1388
1389
1390


1391




































1392
1393
1394
1395
1396
1397
1398
1399







-
-

-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+







        }

        puts stdout $line
      }
    }

    proc pdict { d } {
      set maxLength 0

      foreach {name value} $d {
        set length [string length $name]

        if {$length > $maxLength} {
          set maxLength $length
        }
      }

      set hostLength [lindex [host size] 0]
      set valueLength [expr {$hostLength - $maxLength - 5}]; # " ... "

      foreach {name value} $d {
        #
        # NOTE: If the value by itself is too long to fit on one host line,
        #       just truncate and ellipsis it.
        #
        set valueString $value

        if {[string length $valueString] > $valueLength} then {
          set valueString [appendArgs [string range $valueString 0 \
              [expr {$valueLength - 4}]] " ..."]
        }

        #
        # HACK: Mono does not currently support calling the String.Format
        #       overload that takes a variable number of arguments via
        #       reflection (Mono bug #636939).
        #
        if {![isMono]} then {
          set line [string format -verbatim -- "{0,-$maxLength} = {1}" \
              $name $valueString]
        } else {
          set line [object invoke String Format "{0,-$maxLength} = {1}" \
              $name $valueString]
        }

        puts stdout $line
        puts stdout "$name = $value"
      }
    }

    proc test { name description args } {
      #
      # NOTE: Determine if the caller is trying to run an old style or
      #       new style test and use the appropriate command.
1792
1793
1794
1795
1796
1797
1798
1799

1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1690
1691
1692
1693
1694
1695
1696

1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710







-
+













    # NOTE: Exports the necessary commands from this package and import them
    #       into the global namespace.
    #
    exportAndImportPackageCommands [namespace current] [list \
        exportAndImportPackageCommands isEagle isMono getEnvironmentVariable \
        getPluginPath getDictionaryValue getColumnValue getRowColumnValue \
        appendArgs haveGaruda lappendArgs readFile filter map reduce \
        getPlatformInfo execShell combineFlags tqputs tqlog] false false
        getPlatformInfo execShell combineFlags] false false

    ###########################################################################
    ############################## END Tcl ONLY ###############################
    ###########################################################################
  }

  #
  # NOTE: Provide the Eagle library package to the interpreter.
  #
  package provide Eagle.Library \
    [expr {[isEagle] ? [info engine PatchLevel] : "1.0"}]
}

Changes to Externals/Eagle/lib/Eagle1.0/test.eagle.
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
38
39
40
41
42
43
44


45
46
47
48
49
50



























51

52
53
54
55
56
57
58







-
-
+
+




-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-







    }

    tlog $string
  }

  proc tlog { string } {
    #
    # NOTE: If a test log file was configured, use it; otherwise, ignore the
    #       message.
    # NOTE: If a log file was configured, use it; otherwise,
    #       ignore the message.
    #
    set fileName [getTestLog]

    if {[string length $fileName] > 0} then {
      #
      # NOTE: Check for any queued test log data that needs to be sent to the
      #       log file prior to sending the current string.
      #
      if {[info exists ::test_log_queue]} then {
        #
        # NOTE: Process each queued test log entry, in order, sending them to
        #       the test log file (as long as they are not empty strings).
        #       Each entry is removed from the queue after it is sent to the
        #       test log file.
        #
        foreach entry [lsort -integer [array names ::test_log_queue]] {
          set newString $::test_log_queue($entry)

          if {[string length $newString] > 0} then {
            appendSharedLogFile $fileName $newString
          }

          unset ::test_log_queue($entry)
        }
      }

      #
      # NOTE: If an empty string is supplied by the caller, do nothing.
      #
      if {[string length $string] > 0} then {
        appendSharedLogFile $fileName $string
      appendSharedLogFile $fileName $string
      }
    }
  }

  proc getSoftwareRegistryKey { wow64 } {
    if {$wow64 && [info exists ::tcl_platform(machine)] && \
        $::tcl_platform(machine) eq "amd64"} then {
      #
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
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







-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-





-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-







        }
      }
    }

    return $result
  }

  proc removeConstraint { name } {
    if {[isEagle]} then {
      if {[info exists ::eagle_tests(constraints)]} then {
        set index [lsearch -exact $::eagle_tests(constraints) $name]

        if {$index != -1} then {
          set ::eagle_tests(constraints) [lreplace \
              $::eagle_tests(constraints) $index $index]
        }
      }
    } else {
      if {[info exists ::tcltest::testConstraints($name)]} then {
        unset ::tcltest::testConstraints($name)
      }
    }

    return ""
  }

  proc fixConstraints { constraints } {
    set result [string trim $constraints]

    if {[string length $result] > 0} then {
      #
      # HACK: Fixup for the semi-magical expression (via [expr]) test
      #       constraint syntax supported by the Tcltest package and not
      #       by the Eagle.Test package.  This needs to happen for Tcl
      #       in test constraints that contain any characters that are
      #       not alphanumeric, not a period, and not a colon (e.g. in
      #       this case, the exclamation point); however, it should only
      #       be required when the number of test constraints is greater
      # HACK: Fixup for the magic expression (via [expr]) test
      #       constraint syntax supported by Tcltest and not by
      #       EagleTest.  This needs to happen for Tcl in test
      #       constraints that contain any characters that are
      #       not alphanumeric, not a period, and not a colon
      #       (e.g. in this case, the exclamation point);
      #       however, it should only be required when the
      #       number of test constraints is greater than one.
      #       than one.
      #
      if {![isEagle]} then {
        if {[string first ! $result] != -1} then {
          #
          # HACK: All of our test constraints assume they are
          #       "logically and-ed" together.
          #
          set result [join [split $result] " && "]
        }
      }
    }

    return $result
  }

  proc calculateBogoCops { {milliseconds 2000} {legacy false} } {
    #
    # NOTE: Verify that the number of milliseconds requested is greater than
    #       zero.
    #
    if {$milliseconds <= 0} then {
      error "number of milliseconds must be greater than zero"
    }

    #
    # HACK: Different techniques are used here to calculate the performance of
    #       the machine for Tcl and Eagle.
    #
    if {!$legacy && [isEagle]} then {
      #
      # NOTE: Save the current background error handler for later restoration
      #       and then reset the current background error handler to nothing.
      #
      set bgerror [interp bgerror {}]
      interp bgerror {} ""

      try {
        #
        # NOTE: Save the current [after] flags for later restoration and then
        #       reset them to process events immediately.
        #
        set flags [after flags]
        after flags =Immediate

        try {
          set code [catch {
            #
            # NOTE: First, make sure that the [after] event queue for the
            #       interpreter is totally empty.
            #
            catch {eval after cancel [after info]}

            #
            # NOTE: Schedule the event to cancel the script we are about to
            #       evaluate, capturing the name so we can cancel it later, if
            #       necessary.
            #
            set event [after $milliseconds [list interp cancel]]

            #
            # HACK: There is the potential for a "race condition" here.  If the
            #       specified number of milliseconds elapses before (or after)
            #       entering the [catch] script block (below) then the resulting
            #       script cancellation error will not be caught and we will be
            #       unable to return the correct result to the caller.
            #
            set before [info cmdcount]
            catch {time {nop} -1}; # uses the [time] internal busy loop.
            set after [info cmdcount]

            #
            # HACK: Mono has a bug that results in excessive trailing zeros
            #       here (Mono bug #655780).
            #
            if {[isMono]} then {
              expr {double(($after - $before) / ($milliseconds / 1000.0))}
            } else {
              expr {($after - $before) / ($milliseconds / 1000.0)}
            }
          } result]

          #
          # NOTE: If we failed to calculate the number of commands-per-second
          #       due to some subtle race condition [as explained above], return
          #       an obviously invalid result instead.
          #
          if {$code == 0} then {
            return $result
          } else {
            return 0
          }
        } finally {
          if {[info exists event]} then {
            catch {after cancel $event}
          }

          after flags =$flags
        }
      } finally {
        interp bgerror {} $bgerror
      }
    } else {
      #
      # NOTE: Record the initial Tcl command count.
      #
      set before [info cmdcount]

      #
      # NOTE: Calculate how many whole seconds we need to spin for.
      #
      set seconds [expr {$milliseconds / 1000}]

      #
      # NOTE: Calculate the value of [clock seconds] now and at the stop time.
      #
      set start [clock seconds]; set stop [expr {$start + $seconds}]

      #
      # NOTE: Do nothing for X seconds (i.e. except call [clock seconds]).
      #
      while {$start <= [clock seconds] && [clock seconds] < $stop} {}

      #
      # NOTE: Record the final Tcl command count.
      #
      set after [info cmdcount]

      #
      # NOTE: Calculate approximately how many Tcl commands per second were
      #       executed during the timed loop (above).  Due to various things,
      #       including overhead associated with [clock seconds], this number
      #       is not as accurate as the one for Eagle; however, it's generally
      #       good enough.
      #
      expr {($after - $before) / double($seconds)}
    }
  }

  proc calculateRelativePerformance { type value } {
    #
    # NOTE: Adjust the expected performance number based on the
    #       relative performance of this machine, if available.
    #
    if {[info exists ::test_base_cops] && [info exists ::test_cops]} then {
      #
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
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







-
-
+
+
+











-
-
-
-
-
-
-



-
+



-
+




-
-
-
-
-







            "\", it does not exist\n"]
      }
    }
  }

  proc processTestArguments { varName args } {
    #
    # NOTE: We are going to place the configured options in the variable
    #       identified by the name provided by the caller.
    # NOTE: We are going to place the configured options in
    #       the variable identified by the name provided by
    #       the caller.
    #
    upvar 1 $varName array

    #
    # TODO: Add more support for standard tcltest options here.
    #
    set options [list -configuration -constraints -exitOnComplete -file \
        -logFile -match -no -notFile -postTest -preTest -skip -stopOnFailure \
        -suffix -threshold]

    foreach {name value} $args {
      #
      # NOTE: Use the [tqputs] command here just in case the test log file
      #       has not been setup yet (i.e. by default, this procedure is
      #       almost always called by the test prologue file prior to the
      #       test log file having been setup and we do not want to just
      #       lose this output).
      #
      if {[lsearch -exact $options $name] != -1} then {
        set array($name) $value

        tqputs $::test_channel [appendArgs \
        tputs $::test_channel [appendArgs \
            "---- overrode test option \"" $name "\" with value \"" $value \
            \"\n]
      } else {
        tqputs $::test_channel [appendArgs \
        tputs $::test_channel [appendArgs \
            "---- unknown test option \"" $name "\" with value \"" $value \
            "\" ignored\n"]
      }
    }

    #
    # NOTE: Now, attempt to flush the test log queue, if available.
    #
    tlog ""
  }

  proc getTemporaryPath {} {
    #
    # NOTE: Build the list of "temporary directory" override
    #       environment variables to check.
    #
701
702
703
704
705
706
707
708
709
710
711
712
713








714
715
716
717
718
719
720
521
522
523
524
525
526
527






528
529
530
531
532
533
534
535
536
537
538
539
540
541
542







-
-
-
-
-
-
+
+
+
+
+
+
+
+







          if {[lindex $args 0] eq "-nonewline"} then {
            set channel [lindex $args 1]
            set newLine ""
          }
        }
      }

      if {[info exists channel] && $channel eq "stdout"} then {
        #
        # NOTE: Write output for stdout to the test channel.
        #
        return [tputs $::test_channel [appendArgs [lindex $args end] \
            $newLine]]
      if {[info exists channel]} then {
        if {$channel eq "stdout"} then {
          #
          # NOTE: Write output for stdout to the test channel.
          #
          return [tputs $::test_channel [appendArgs [lindex $args end] \
              $newLine]]
        }
      }

      #
      # NOTE: If we haven't returned by now, we don't know how to
      #       handle the input.  Let puts handle it.
      #
      return [eval ::tcl::save::puts $args]
858
859
860
861
862
863
864

865

866
867
868
869
870
871
872
680
681
682
683
684
685
686
687

688
689
690
691
692
693
694
695







+
-
+







    if {[isEagle]} then {
      set array(scopes,$index) [llength [scope list]]
      set array(objects,$index) [llength [info objects]]
      set array(callbacks,$index) [llength [info callbacks]]
      set array(types,$index) [llength [object types]]
      set array(interfaces,$index) [llength [object interfaces]]
      set array(namespaces,$index) [llength [object namespaces]]
      set array(processes,$index,list) [getProcesses ""]; # volatile, external
      set array(processes,$index) [llength [getProcesses ""]]
      set array(processes,$index) [llength $array(processes,$index,list)]
      set array(assemblies,$index) [llength [object assemblies]]

      #
      # NOTE: Support for some of all of these entity types may not be
      #       present in the interpreter, initialize all these counts
      #       to zero and then try to query each one individually below
      #       wrapped in a catch.
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
811
812
813
814
815
816
817



















818
819
820
821
822
823
824







-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-







        append result <noValue>
      }
    }

    return [expr {[string length $result] > 0 ? $result : $default}]
  }

  proc pathToRegexp { path {list false} } {
    #
    # NOTE: This procedure needs to escape all characters that
    #       have any special meaning to the regular expression
    #       engine.  Typically, the only characters we need to
    #       really worry about are the directory separator and
    #       the file extension separator (e.g. backslash and
    #       period on Windows and/or forward slash and period
    #       on Unix).  Since the forward slash has no special
    #       meaning to the regular expression engine, Windows
    #       is somewhat more difficult to handle.
    #
    set map [list \
        \\ \\\\ \$ \\\$ ( \\( ) \\) * \\* + \\+ - \\- . \\. \
        ? \\? \[ \\\[ \] \\\] ^ \\^ \{ \\\{ \} \\\}]

    return [string map $map [expr {$list ? [list $path] : $path}]]
  }

  proc inverseLsearchGlob { noCase patterns element } {
    #
    # NOTE: Perform the inverse of [lsearch -glob], attempt
    #       to match an element against a list of patterns.
    #
    set command [list string match]
    if {$noCase} then {lappend command -nocase}
1360
1361
1362
1363
1364
1365
1366
1367

1368
1369
1370
1371
1372
1373
1374
1375


1376
1377
1378



1379
1380
1381
1382
1383
1384
1385
1164
1165
1166
1167
1168
1169
1170

1171
1172
1173
1174
1175
1176
1177


1178
1179
1180


1181
1182
1183
1184
1185
1186
1187
1188
1189
1190







-
+






-
-
+
+

-
-
+
+
+







    }

    if {[llength $leaked] > 0} then {
      tputs $channel [appendArgs "---- files with leaking tests: " $leaked \n]
    }
  }

  proc configureTcltest { constraints imports force } {
  proc configureTcltest { imports force } {
    if {[isEagle]} then {
      #
      # HACK: Flag the "test" and "runTest" script library procedures so
      #       that they use the script location of their caller and not
      #       their own.
      #
      # BUGBUG: Even this does not yet fix the script location issues in
      #         the test suite:
      # BUGBUG: This does not yet fix the script location issues in the
      #         test suite.
      #
      #         debug procedureflags test +ScriptLocation
      #         debug procedureflags runTest +ScriptLocation
      # debug procedureflags test +ScriptLocation
      # debug procedureflags runTest +ScriptLocation

      #
      # HACK: Compatibility shim(s) for use with various tests in the Tcl
      #       test suite.  Make sure these commands do not already exist
      #       prior to attempt to adding them.
      #
      if {[llength [info commands testConstraint]] == 0} then {
        interp alias {} testConstraint {} haveOrAddConstraint
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411

1412
1413
1414
1415
1416

1417
1418
1419

1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1204
1205
1206
1207
1208
1209
1210






1211
1212
1213
1214
1215

1216
1217


1218








1219
1220
1221
1222
1223
1224
1225







-
-
-
-
-
-
+




-
+

-
-
+
-
-
-
-
-
-
-
-








      #
      # NOTE: Fake having the tcltest package.
      #
      package provide tcltest 2.2.10; # Tcl 8.4
    } else {
      #
      # NOTE: Attempt to detect if the tcltest package is already loaded.
      #
      set loaded [expr {[catch {package present tcltest}] == 0}]

      #
      # NOTE: Always attempt to load the tcltest package.
      # NOTE: Load the tcltest package.
      #
      package require tcltest

      #
      # NOTE: Configure tcltest for our use (only when it was not loaded).
      # NOTE: Configure tcltest for our use.
      #
      if {!$loaded} then {
        ::tcltest::configure -verbose bpste
      ::tcltest::configure -verbose bpste
      }

      #
      # NOTE: We need to copy the Eagle test constraints over to Tcl.
      #
      if {[llength $constraints] > 0} then {
        ::tcltest::configure -constraints $constraints
      }

      #
      # NOTE: We need the [test] command in the global namespace.
      #
      if {[llength $imports] > 0} then {
        set command [list namespace import]

1599
1600
1601
1602
1603
1604
1605







1606
1607
1608
1609
1610
1611
1612
1613
1614































































1615
1616
1617
1618
1619
1620
1621
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403









1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473







+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







      } else {
        return true; # already dead?
      }

      return false; # still alive (or error).
    }

    proc calculateBogoCops { {milliseconds 2000} } {
      #
      # NOTE: Save the current background error handler for later restoration
      #       and then reset the current background error handler to nothing.
      #
      set bgerror [interp bgerror {}]
      interp bgerror {} ""
    proc evalWithTimeout { script {milliseconds 2000} {resultVarName ""} } {
      #
      # NOTE: Verify that the number of milliseconds requested is greater than
      #       zero.
      #
      if {$milliseconds <= 0} then {
        error "number of milliseconds must be greater than zero"
      }


      try {
        #
        # NOTE: Save the current [after] flags for later restoration and then
        #       reset them to process events immediately.
        #
        set flags [after flags]
        after flags =Immediate

        try {
          set code [catch {
            #
            # NOTE: Schedule the event to cancel the script we are about to
            #       evaluate, capturing the name so we can cancel it later, if
            #       necessary.
            #
            set event [after $milliseconds [list interp cancel]]

            #
            # HACK: There is the potential for a "race condition" here.  If the
            #       specified number of milliseconds elapses before (or after)
            #       entering the [catch] script block (below) then the resulting
            #       script cancellation error will not be caught and we will be
            #       unable to return the correct result to the caller.
            #
            set before [info cmdcount]
            catch {time {nop} -1}; # uses the [time] internal busy loop.
            set after [info cmdcount]

            #
            # HACK: Mono has a bug that results in excessive trailing zeros
            #       here (Mono bug #655780).
            #
            if {[isMono]} then {
              expr {double(($after - $before) / ($milliseconds / 1000.0))}
            } else {
              expr {($after - $before) / ($milliseconds / 1000.0)}
            }
          } result]

          #
          # NOTE: If we failed to calculate the number of commands-per-second
          #       due to some subtle race condition [as explained above], return
          #       an obviously invalid result instead.
          #
          if {$code == 0} then {
            return $result
          } else {
            return 0
          }
        } finally {
          if {[info exists event]} then {
            catch {after cancel $event}
          }

          after flags =$flags
        }
      } finally {
        interp bgerror {} $bgerror
      }
    }

    proc evalWithTimeout { script {milliseconds 2000} {resultVarName ""} } {
      #
      # NOTE: Save the current background error handler for later restoration
      #       and then reset the current background error handler to nothing.
      #
      set bgerror [interp bgerror {}]
      interp bgerror {} ""

1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1485
1486
1487
1488
1489
1490
1491






1492
1493
1494
1495
1496
1497
1498







-
-
-
-
-
-







          #       returning the result to the caller.
          #
          if {[string length $resultVarName] > 0} then {
            upvar 1 $resultVarName result
          }

          return [catch {
            #
            # NOTE: First, make sure that the [after] event queue for the
            #       interpreter is totally empty.
            #
            catch {eval after cancel [after info]}

            #
            # NOTE: Schedule the event to cancel the script we are about to
            #       evaluate, capturing the name so we can cancel it later, if
            #       necessary.
            #
            set event [after $milliseconds [list interp cancel]]

1885
1886
1887
1888
1889
1890
1891
1892

1893
1894
1895
1896
1897
1898
1899
1731
1732
1733
1734
1735
1736
1737

1738
1739
1740
1741
1742
1743
1744
1745







-
+







      }
    }

    #
    # NOTE: Fake having the tcltest package unless we are prevented.
    #
    if {![info exists ::no(configureTcltest)]} then {
      configureTcltest [list] [list] false
      configureTcltest [list] false
    }

    ###########################################################################
    ############################# END Eagle ONLY ##############################
    ###########################################################################
  } else {
    ###########################################################################
1953
1954
1955
1956
1957
1958
1959
1960

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

1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1799
1800
1801
1802
1803
1804
1805

1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819

1820

1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833







-
+













-
+
-













      }
    }

    #
    # NOTE: Load and configure the tcltest package unless we are prevented.
    #
    if {![interp issafe] && ![info exists ::no(configureTcltest)]} then {
      configureTcltest [list] [list test testConstraint] false
      configureTcltest [list test testConstraint] false
    }

    #
    # NOTE: We need several of our test related commands in the global
    #       namespace as well.
    #
    exportAndImportPackageCommands [namespace current] [list addConstraint \
        calculateRelativePerformance haveConstraint haveOrAddConstraint \
        processTestArguments getTemporaryPath getTestLog getTestLogId getFiles \
        getConstraints getTestFiles getTestRunId execTestShell runTestPrologue \
        runTestEpilogue runTest runAllTests fixConstraints sourceIfValid \
        isExitOnComplete getPassPercentage getSkipPercentage testExec tlog \
        returnInfoScript tputs formatDecimal formatList configureTcltest \
        calculateBogoCops removeConstraint machineToPlatform tsource testShim] \
        machineToPlatform tsource testShim] false false
        false false

    ###########################################################################
    ############################## END Tcl ONLY ###############################
    ###########################################################################
  }

  #
  # NOTE: Provide the Eagle test package to the interpreter.
  #
  package provide Eagle.Test \
    [expr {[isEagle] ? [info engine PatchLevel] : "1.0"}]
}

Changes to Externals/Eagle/lib/Eagle1.0/vendor.eagle.
37
38
39
40
41
42
43
44
45


46
47
48
49
50
51
52
37
38
39
40
41
42
43


44
45
46
47
48
49
50
51
52







-
-
+
+







      set result 0

      foreach varName $varNames {
        if {[uplevel 1 [list info exists $varName]]} then {
          incr result

          if {!$quiet} then {
            tqputs $channel [appendArgs \
                "---- found vendor-specific test override \"" $varName "\".\n"]
            puts -nonewline $channel [appendArgs \
                "Found vendor-specific test override \"" $varName "\".\n"]
          }
        }
      }

      return $result
    }

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
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







-
-
-
+
+
+













-
+


















-
-
+
+
















-
-
+
+




-
-
-
-
-
-
-
+
+
+
+



-
+
-
-

-
-
-
-
-
-
+
+
+
-


-
+
-
-
-

-
+
-
-
-







          #
          if {![info exists ::env(EAGLELIBPATH)] || \
              [lsearch -exact $::env(EAGLELIBPATH) $dir2] == -1} then {
            #
            # NOTE: If we have NOT been instructed to be quiet, report now.
            #
            if {!$quiet} then {
              tqputs $channel [appendArgs \
                  "---- found vendor-specific test package directory \"" \
                  $dir2 "\", adding...\n"]
              puts -nonewline $channel [appendArgs \
                  "Found vendor-specific test package directory \"" $dir2 \
                  "\", adding...\n"]
            }

            #
            # NOTE: Append the directory to the necessary environment variable
            #       so that it will get picked up when Eagle actually rebuilds
            #       the auto-path list (below).
            #
            lappend ::env(EAGLELIBPATH) $dir2

            #
            # NOTE: Force Eagle to rebuild the auto-path list for the current
            #       interpreter right now.
            #
            object invoke Utility RefreshAutoPathList true
            object invoke Utility RefreshAutoPathList
          }

          #
          # NOTE: We are done, return success.
          #
          return true
        }

        #
        # NOTE: Keep going up the directory tree...
        #
        set dir [file dirname $dir]
      }

      #
      # NOTE: If we have NOT been instructed to be quiet, report now.
      #
      if {!$quiet} then {
        tqputs $channel \
            "---- could not find vendor-specific test package directory.\n"
        puts -nonewline $channel \
            "Could not find vendor-specific test package directory.\n"
      }

      #
      # NOTE: Directory not found, return failure.
      #
      return false
    }

    proc setupInterpreterTestPath { channel dir quiet } {
      set testPath [object invoke -flags +NonPublic Interpreter.GetActive \
          TestPath]

      if {$dir ne $testPath} then {
        object invoke -flags +NonPublic Interpreter.GetActive TestPath $dir

        if {!$quiet} then {
          tqputs $channel [appendArgs \
              "---- set interpreter test path to \"" $dir \".\n]
          puts -nonewline $channel [appendArgs \
              "Set interpreter test path to \"" $dir \".\n]
        }
      }
    }

    #
    # NOTE: Check for any overridden settings that may have been specified via
    #       the command line, etc.
    #
    checkForTestOverrides stdout [list binary_directory build_base_directory \
        build_directory common_directory connection_flags database_directory \
        datetime_format test_configuration test_year vendor_directory] false
    checkForTestOverrides stdout \
        [list binary_directory build_base_directory build_directory \
              common_directory connection_flags database_directory \
              datetime_format test_configuration test_year] false

    #
    # NOTE: This variable will contain the name of the directory containing the
    #       vendor-specific testing infrastructure.  If the variable does not
    #       vendor-specific testing infrastructure.
    #       already exist, create it; otherwise, it has been overridden and the
    #       existing value should be left intact.
    #
    set have_vendor_directory [info exists ::vendor_directory]

    if {!$have_vendor_directory} then {
      set ::vendor_directory ""
    }

    set ::vendor_directory ""

    #
    #
    # NOTE: This procedure will attempt to find the vendor-specific testing
    #       infrastructure directory and add it to the auto-path for the
    #       current interpreter.  Normally, this will also set the variable
    #       current interpreter.
    #       created above to point to the directory added to the auto-path;
    #       however, this will not be done if the variable was not created
    #       by us.
    #
    addTestSuiteToAutoPath stdout [expr {$have_vendor_directory ? "" : \
    addTestSuiteToAutoPath stdout ::vendor_directory false
        "::vendor_directory"}] false

    unset have_vendor_directory

    #
    # NOTE: If we actually found a vendor-specific testing infrastructure
    #       directory then modify the TestPath property of the current
    #       interpreter to point directly to it.
    #
    if {[string length $::vendor_directory] > 0} then {
Changes to Externals/Eagle/lib/Test1.0/constraints.eagle.
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
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







-
+
+

-
-
+

-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+

-
-
-
-
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-







      tputs $channel [appendArgs unknown \n]
    }

    ###########################################################################

    if {![isEagle]} then {
      #
      # BUGFIX: We do not normally want to skip any Mono bugs in native Tcl.
      # BUGFIX: We do not want to skip any Mono bugs in Tcl.
      #         Also, fake the culture.
      #
      if {![info exists ::no(runtimeVersion)]} then {
        set constraints [list monoToDo monoBug monoCrash]
      set constraints [list monoToDo monoBug monoCrash culture.en_US]

        #
        # NOTE: Add the necessary constraints for each version of Mono that
        #       we know about.
        #
        foreach version [list 20 22 24 26 28 210 211 212 30] {
          addConstraint [appendArgs monoToDo $version]
          addConstraint [appendArgs monoBug $version]
          addConstraint [appendArgs monoCrash $version]
        }
      #
      # NOTE: Add the necessary constraints for each version
      #       of Mono we know about.
      #
      foreach version [list 20 22 24 26 28 210 212 30] {
        addConstraint [appendArgs monoToDo $version]
        addConstraint [appendArgs monoBug $version]
        addConstraint [appendArgs monoCrash $version]
      }

        #
        # NOTE: Also add just the generic Mono constraints that do not have
        #       a trailing version.
        #
        foreach constraint $constraints {
          addConstraint $constraint
        }
      foreach constraint $constraints {
        addConstraint $constraint; # running in Tcl.
      }
      }
    }
  }

  proc checkForVariable { channel name {notEmpty true} {constraint ""} } {
    tputs $channel [appendArgs "---- checking for variable \"" $name \
        "\"... "]

    #
    # NOTE: First, normalize the variable name to be in the global scope.
    #
    set newName [appendArgs :: [string trimleft $name :]]

    #
    # NOTE: Next, always check if it actually exists (as of right now).
    #
    if {[info exists $newName]} then {
      #
      # NOTE: Next, optionally check if it constains anything.
      #
      if {!$notEmpty || [string length [set $newName]] > 0} then {
        #
        # NOTE: The variable exists and it either contains something
        #       or we do not care about its contents.
        #
        if {[string length $constraint] > 0} then {
          addConstraint [appendArgs variable_ $constraint]
        } else {
          addConstraint [appendArgs variable_ [string trimleft $newName :]]
        }

        #
        # NOTE: Show that we found the variable and whether it actually
        #       contained anything.
        #
        tputs $channel [appendArgs "yes (" \
            [expr {$notEmpty ? "exists, not empty" : "exists"}] ")\n"]

        #
        # NOTE: We are done here, return now.
        #
        return
      }
    }

    tputs $channel no\n
  }

  proc checkForTclOptions { channel } {
    tputs $channel "---- checking for Tcl options..."

    if {![isEagle]} then {
      set result [list]

      #
      # NOTE: This test constraint is needed by test "benchmark-1.22".
      #
      if {![info exists ::no(compileNative)]} then {
        lappend result compile.NATIVE
        addConstraint compile.NATIVE
      }

      #
      # NOTE: This test constraint is needed by test "benchmark-1.22".
      #
      if {![info exists ::no(compileWindows)]} then {
        #
        # NOTE: If the current platform is Windows the Tcl binary must have
        #       been compiled for Windows.
        #
        if {[info exists ::tcl_platform(platform)] && \
            $::tcl_platform(platform) eq "windows"} then {
          lappend result compile.WINDOWS
          addConstraint compile.WINDOWS
        }
      }

      #
      # NOTE: This test constraint is needed by tests "socket-*.*".
      #
      if {![info exists ::no(compileNetwork)]} then {
        lappend result compile.NETWORK
        addConstraint compile.NETWORK
      }

      #
      # NOTE: Just fake the invariant culture when running in native Tcl.
      #
      if {![info exists ::no(culture)]} then {
        lappend result culture.invariant
        addConstraint culture.invariant
      }

      tputs $channel [appendArgs "yes (" $result ")\n"]
    } else {
      tputs $channel no\n
    }
  }

  proc checkForWindowsCommandProcessor { channel pattern {constraint ""} } {
    tputs $channel "---- checking for Windows Command Processor... "

    if {[info exists ::tcl_platform(platform)] && \
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
82
83
84
85
86
87
88















































































89
90
91
92
93
94
95







-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-







        #
        # NOTE: We are done here, return now.
        #
        return
      }
    }

    tputs $channel no\n
  }

  proc checkForFossil { channel } {
    tputs $channel "---- checking for Fossil... "

    if {[catch {set version [exec -- fossil version]}] == 0} then {
      set version [string trim $version]
      set pattern {^This is fossil version (.*) \[([0-9a-f]+)\]\
          \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} UTC$}

      if {[regexp -- $pattern $version dummy version sourceId]} then {
        #
        # NOTE: Add a constraint to show that the Fossil executable
        #       itself is available.
        #
        addConstraint fossil_version

        #
        # NOTE: Append the version of Fossil currently in use.
        #
        append result version " " $version " \[" $sourceId \]

        if {[catch {set remote [exec -- fossil remote]}] == 0} then {
          set remote [string trim $remote]; set valid false

          if {[isEagle]} then {
            #
            # NOTE: With Eagle, we can actually validate the URI.
            #
            if {[uri isvalid $remote]} then {
              set valid true
            }
          } else {
            #
            # HACK: Currently, there is no simple way to validate
            #       an arbitrary URI with Tcl (i.e. without using
            #       some hideously complex regular expression).
            #
            if {[string length $remote] > 0} then {
              set valid true
            }
          }

          if {$valid} then {
            #
            # NOTE: Add a constraint to show that a valid Fossil
            #       repository URI appears to be available.
            #
            addConstraint fossil_repository

            #
            # NOTE: If we are not prevented from doing so, save the
            #       test repository to the repository URI currently
            #       in use to a suitably named global variable.
            #
            if {![info exists ::no(setRepository)]} then {
              set ::test_repository $remote
            }

            #
            # NOTE: Append the repository URI currently in use.
            #
            append result ", repository \"" $remote \"

            #
            # NOTE: Show the result of the checking.
            #
            tputs $channel [appendArgs "yes (" $result ")\n"]

            #
            # NOTE: We are done here, return now.
            #
            return
          }
        }
      }
    }

    tputs $channel no\n
  }

  proc checkForEagle { channel } {
    tputs $channel "---- checking for Eagle... "

    if {[isEagle]} then {
328
329
330
331
332
333
334







335
336
337
338
339
340
341
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169







+
+
+
+
+
+
+







      #
      # NOTE: We do not want to skip bugs or crashing
      #       issues for Eagle since we are not running
      #       in Eagle.
      #
      addConstraint eagleBug
      addConstraint eagleCrash

      #
      # HACK: Needed by tests "socket-*.*".
      #
      if {![info exists ::no(compileNetwork)]} then {
        addConstraint compile.NETWORK
      }

      tputs $channel no\n
    }
  }

  proc checkForSymbols { channel name {constraint ""} } {
    set fileName [file normalize [appendArgs [file rootname $name] .pdb]]
703
704
705
706
707
708
709







710
711
712
713
714
715
716
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551







+
+
+
+
+
+
+







        tputs $channel no\n
      }
    } else {
      #
      # NOTE: Tcl is always native code and can always execute native code.
      #
      addConstraint native

      #
      # HACK: Needed by test "benchmark-1.22".
      #
      if {![info exists ::no(compileNative)]} then {
        addConstraint compile.NATIVE
      }

      tputs $channel yes\n
    }
  }

  proc checkForTip127 { channel } {
    tputs $channel "---- checking for TIP #127... "
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
607
608
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







-
+
-
-

-
+
-











-
+
-

-
-
+
-
-
+
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-





-
+








      tputs $channel yes\n
    } else {
      tputs $channel no\n
    }
  }

  proc checkForTiming {
  proc checkForTiming { channel threshold {constraint ""} {tries 1} } {
          channel threshold {constraint ""} {tries 1} {delay 1000}
          {asynchronous false} } {
    tputs $channel [appendArgs \
        "---- checking for precision timing (threshold of " $threshold \
        "---- checking for precision timing (" $threshold " milliseconds)... "]
        " milliseconds, delay of " $delay " milliseconds)... "]

    #
    # HACK: Sometimes the first try takes quite a bit longer than subsequent
    #       tries.  We attempt to bypass this problem by retrying a set number
    #       of times (which can be overridden by the caller) before giving up.
    #
    set try 0
    set difference unknown

    for {} {$try < $tries} {incr try} {
      #
      # NOTE: Create a script that will set the final clicks value.  This must
      # NOTE: Attempt to block for exactly one second.
      #       use a global variable due to the nature of [after].
      #
      set stopScript {
        set ::stopClicks [expr {[clock clicks -milliseconds] & 0x7fffffff}]
      set start [expr {[clock clicks -milliseconds] & 0x7fffffff}]
      }

      after 1000; # wait for "exactly" one second.
      #
      # NOTE: Set the initial clicks value and then attempt to wait for about
      #       one second, either synchronously or asynchronously, depending on
      #       the preference of the caller.
      #
      set start [expr {[clock clicks -milliseconds] & 0x7fffffff}]
      set stop [expr {[clock clicks -milliseconds] & 0x7fffffff}]

      if {$asynchronous} then {
        set event [after $delay $stopScript]; vwait ::stopClicks
      } else {
        after $delay; eval $stopScript
      }

      #
      # NOTE: Move the final clicks value from the global frame to this one.
      #
      set stop $::stopClicks; unset ::stopClicks

      #
      # NOTE: Calculate the difference between the actual and expected
      #       number of milliseconds.
      #
      set difference [expr {abs($stop - $start - $delay)}]
      set difference [expr {abs($stop - $start - 1000)}]

      #
      # NOTE: Are we within the threshold specified by the caller?
      #
      if {$difference >= 0 && $difference <= $threshold} then {
        #
        # NOTE: We appear to be capable of fairly precise timing.
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
884
885
886
887
888
889
890

















891
892
893
894
895
896
897







-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-







      } elseif {$code == 0} then {
        tputs $channel closed\n
      } else {
        tlog $result; tputs $channel error\n]
      }
    }

    proc checkForHostType { channel } {
      tputs $channel "---- checking for host type... "

      if {[set code [catch {object invoke \
              Interpreter.GetActive.Host.GetType ToString} hostType]] == 0 && \
          [string length $hostType] > 0} then {
        addConstraint [appendArgs hostType. [string map \
            [list , _ + _ & _ * _ \[ _ \] _ . _ \\ _] $hostType]]

        tputs $channel [appendArgs $hostType \n]
      } elseif {$code == 0} then {
        tputs $channel unknown\n
      } else {
        tputs $channel error\n
      }
    }

    proc checkForPrimaryThread { channel } {
      tputs $channel "---- checking for primary thread... "

      if {[catch {object invoke Interpreter.GetActive ThreadId} \
              threadId] == 0 && \
          [info tid] == $threadId} then {
        addConstraint primaryThread
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1058
1059
1060
1061
1062
1063
1064







1065
1066
1067
1068
1069
1070
1071







-
-
-
-
-
-
-







              #
              # NOTE: Check for any Mono version higher than 2.10.
              #
              if {$majorVersion > 2 || $minorVersion > 10} then {
                lappend monoVersions 210
              }

              #
              # NOTE: Check for any Mono version higher than 2.11.
              #
              if {$majorVersion > 2 || $minorVersion > 11} then {
                lappend monoVersions 211
              }

              #
              # NOTE: Check for any Mono version higher than 2.12.
              #
              if {$majorVersion > 2 || $minorVersion > 12} then {
                lappend monoVersions 212
              }
            }
1313
1314
1315
1316
1317
1318
1319
1320

1321
1322
1323
1324
1325
1326
1327
1102
1103
1104
1105
1106
1107
1108

1109
1110
1111
1112
1113
1114
1115
1116







-
+







          }

          #
          # NOTE: We do not want to skip any Mono bugs on .NET.  Add the
          #       necessary constraints for each version of Mono we know
          #       about.
          #
          foreach monoVersion [list 20 22 24 26 28 210 211 212 30] {
          foreach monoVersion [list 20 22 24 26 28 210 212 30] {
            addConstraint [appendArgs monoToDo $monoVersion]
            addConstraint [appendArgs monoBug $monoVersion]
            addConstraint [appendArgs monoCrash $monoVersion]
          }
        }

        tputs $channel [appendArgs $::eagle_platform(runtimeVersion) \
2118
2119
2120
2121
2122
2123
2124
2125

2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
1907
1908
1909
1910
1911
1912
1913

1914

1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927







-
+
-













    exportAndImportPackageCommands [namespace current] [list checkForPlatform \
        checkForEagle checkForGaruda checkForShell checkForDebug checkForTk \
        checkForVersion checkForCommand checkForFile checkForNativeCode \
        checkForTip127 checkForTip194 checkForTip241 checkForTip285 \
        checkForPerformance checkForTiming checkForInteractive checkForSymbols \
        checkForLogFile checkForNetwork checkForCompileOption \
        checkForWindowsCommandProcessor checkForUserInteraction \
        checkForTclOptions checkForTestConfiguration checkForVariable \
        checkForTestConfiguration] false false
        checkForFossil] false false

    ###########################################################################
    ############################## END Tcl ONLY ###############################
    ###########################################################################
  }

  #
  # NOTE: Provide the Eagle test constraints package to the interpreter.
  #
  package provide Eagle.Test.Constraints \
    [expr {[isEagle] ? [info engine PatchLevel] : "1.0"}]
}

Changes to Externals/Eagle/lib/Test1.0/epilogue.eagle.
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
15
16
17
18
19
20
21






22
23
24
25
26
27






28







29
30
31
32
33
34
35







-
-
-
-
-
-






-
-
-
-
-
-

-
-
-
-
-
-
-







###############################################################################

if {![info exists no([file tail [info script]])]} then {
  if {[info level] > 0} then {
    error "cannot run, current level is not global"
  }

  #
  # NOTE: Make sure all the variables used by this epilogue are unset.
  #
  unset -nocomplain memory stack name count passedOrSkipped percent \
      exitCode

  #
  # NOTE: Show when the tests actually ended (now).
  #
  tputs $test_channel [appendArgs "---- tests ended at " \
      [clock format [clock seconds]] \n]

  #
  # NOTE: Show the ending command count (for both Tcl and Eagle).
  #
  tputs $test_channel [appendArgs "---- ending command count: " \
      [info cmdcount] \n]

  if {[isEagle]} then {
    #
    # NOTE: Show the ending operation count (for Eagle only).
    #
    tputs $test_channel [appendArgs "---- ending operation count: " \
        [object invoke -flags +NonPublic Interpreter.GetActive \
            OperationCount] \n]

    #
    # NOTE: Show the current state of the memory.
    #
    catch {debug memory} memory

    tputs $test_channel [appendArgs "---- ending memory: " \
        [formatListAsDict $memory] \n]
Changes to Externals/Eagle/lib/Test1.0/prologue.eagle.
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
15
16
17
18
19
20
21







22
23
24
25
26
27
28







-
-
-
-
-
-
-







###############################################################################

if {![info exists no([file tail [info script]])]} then {
  if {[info level] > 0} then {
    error "cannot run, current level is not global"
  }

  #
  # NOTE: Make sure all the variables used by this prologue are unset.
  #
  unset -nocomplain pkg_dir pattern exec dummy directory name value \
      expr publicKeyToken encoding memory stack drive server database \
      timeout user password percent checkout timeStamp

  #
  # NOTE: Set the location of the test suite, if necessary.
  #
  if {![info exists test_path]} then {
    set test_path [file normalize [file dirname [info script]]]
  }

73
74
75
76
77
78
79
80
81

82
83
84


85
86
87


88
89
90
91
92
93
94
66
67
68
69
70
71
72


73



74
75
76


77
78
79
80
81
82
83
84
85







-
-
+
-
-
-
+
+

-
-
+
+







      #
      set base_path [file dirname $base_path]
    }

    unset pkg_dir
  }

  #############################################################################

  #
  #
  # NOTE: Set the local root directory of the source checkout (i.e. of Eagle or
  #       whatever project the Eagle binaries are being used by).
  # NOTE: Set the local root directory of the source checkout (i.e. of
  #       Eagle or whatever project the Eagle binaries are being used by).
  #
  if {![info exists root_path] && ![info exists no(fossil)]} then {
    set pattern {^local-root:\s+(.*?)\s+$}
  if {![info exists root_path]} then {
    set pattern {^local-root:\s+(.*)\s+$}

    if {[catch {set exec [exec -- fossil info]}] || \
        [regexp -line -- $pattern $exec dummy directory] == 0} then {
      #
      # NOTE: We could not query local root directory of the source checkout
      #       from Fossil; therefore, attempt to make an educated guess.  This
      #       value will probably be wrong for any project(s) other than Eagle.
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
96
97
98
99
100
101
102


103
104
105
106
107
108
109







-
-







      #
      set root_path [file normalize $directory]
    }

    unset -nocomplain directory dummy exec pattern
  }

  #############################################################################

  #
  # NOTE: Set the executable file name for the process, if
  #       necessary.
  #
  if {![info exists bin_file]} then {
    set bin_file [info nameofexecutable]
  }
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
593
594
595
596
597
598
599







600
601
602
603
604
605
606







-
-
-
-
-
-
-







    #
    # NOTE: Has host detection support been disabled?
    #
    if {![info exists no(host)]} then {
      checkForHost $test_channel
    }

    #
    # NOTE: Has host type detection support been disabled?
    #
    if {![info exists no(hostType)]} then {
      checkForHostType $test_channel
    }

    #
    # NOTE: Has primary thread detection support been disabled?  We do
    #       this check [nearly] first as it may [eventually] be used
    #       to help determine if other constraints should be skipped.
    #
    if {![info exists no(primaryThread)]} then {
      checkForPrimaryThread $test_channel
700
701
702
703
704
705
706
707

708
709
710
711
712
713
714
682
683
684
685
686
687
688

689
690
691
692
693
694
695
696







-
+







    if {![info exists no(certificate)]} then {
      checkForCertificate $test_channel
    }

    #
    # NOTE: Has database testing support been disabled?
    #
    if {![info exists no(database)]} then {
    if {![info exists no(sql)]} then {
      #
      # NOTE: Set the server name, if necessary.
      #
      if {![info exists server]} then {
        set server .
      }

845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
827
828
829
830
831
832
833










834
835
836
837
838
839
840







-
-
-
-
-
-
-
-
-
-







      if {![info exists no(compileIsolatedInterpreters)]} then {
        #
        # NOTE: For test "xaml-1.2".
        #
        checkForCompileOption $test_channel ISOLATED_INTERPRETERS
      }

      #
      # NOTE: Has expression flags support been enabled (at compile-time)?
      #
      if {![info exists no(compileExpressionFlags)]} then {
        #
        # NOTE: For test "function-2.16".
        #
        checkForCompileOption $test_channel EXPRESSION_FLAGS
      }

      #
      # NOTE: Has isolated plugin support been enabled (at compile-time)?
      #
      if {![info exists no(compileIsolatedPlugins)]} then {
        #
        # NOTE: For test "load-1.1.1".
        #
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1034
1035
1036
1037
1038
1039
1040











1041
1042
1043
1044
1045
1046
1047







-
-
-
-
-
-
-
-
-
-
-







      }
    }

    #
    # NOTE: Has custom test method support been disabled?
    #
    if {![info exists no(test)]} then {
      #
      # NOTE: Has script stream testing support been disabled?
      #
      if {![info exists no(testScriptStream)]} then {
        #
        # NOTE: For tests "basic-1.46" and "basic-1.47".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestScriptStream*
      }

      #
      # NOTE: Has DateTime testing support been disabled?
      #
      if {![info exists no(testDateTime)]} then {
        #
        # NOTE: For test "vwait-1.11".
        #
1156
1157
1158
1159
1160
1161
1162











1163
1164
1165
1166
1167
1168
1169
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141







+
+
+
+
+
+
+
+
+
+
+








        #
        # NOTE: For tests "basic-1.36" and "debug-1.3".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestSetQuiet*
      }

      #
      # NOTE: Has IDisposable testing support been disabled?
      #
      if {![info exists no(testDisposable)]} then {
        #
        # NOTE: For test "object-2.8".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default+Disposable \
            *ToString* Eagle._Tests.Default.Disposable.ToString
      }

      #
      # NOTE: Has linked variable testing support been disabled?
      #
      if {![info exists no(testLinkedVariables)]} then {
        #
        # NOTE: For tests "basic-1.39", "basic-1.40", "basic-1.41",
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1337
1338
1339
1340
1341
1342
1343











1344
1345
1346
1347
1348
1349
1350







-
-
-
-
-
-
-
-
-
-
-








        #
        # NOTE: For test "object-14.6".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TypeProperty*
      }

      #
      # NOTE: Has IDisposable testing support been disabled?
      #
      if {![info exists no(testDisposable)]} then {
        #
        # NOTE: For test "object-2.8".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default+Disposable \
            *ToString* Eagle._Tests.Default.Disposable.ToString
      }
    }

    #
    # NOTE: Has Excel testing support been disabled?
    #
    if {![info exists no(excel)]} then {
      #
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1488
1489
1490
1491
1492
1493
1494





1495
1496
1497
1498
1499
1500
1501







-
-
-
-
-







      checkForGarudaDll $test_channel
    }

    ###########################################################################
    ########################## END Eagle Constraints ##########################
    ###########################################################################
  } else {
    #
    # NOTE: Make sure that Tcl honors the Eagle test constraints.
    #
    configureTcltest $test_flags(-constraints) [list] false

    #
    # HACK: Reset the test counts for tcltest.
    #
    set ::tcltest::numTests(Total) 0
    set ::tcltest::numTests(Skipped) 0
    set ::tcltest::numTests(Passed) 0
    set ::tcltest::numTests(Failed) 0
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1753
1754
1755
1756
1757
1758
1759




1760
1761
1762
1763








1764
1765
1766
1767
1768
1769
1770







-
-
-
-




-
-
-
-
-
-
-
-







  # NOTE: Check the core test constraints unless they have been
  #       explicitly disabled.
  #
  if {![info exists no(platform)]} then {
    checkForPlatform $test_channel
  }

  if {![info exists no(tclOptions)]} then {
    checkForTclOptions $test_channel
  }

  if {![info exists no(windowsCommandProcessor)]} then {
    checkForWindowsCommandProcessor $test_channel cmd.exe
  }

  if {![info exists no(fossil)]} then {
    checkForFossil $test_channel
  }

  if {![info exists no(testRepository)]} then {
    checkForVariable $test_channel test_repository
  }

  if {![info exists no(version)]} then {
    checkForVersion $test_channel
  }

  if {![info exists no(eagle)]} then {
    checkForEagle $test_channel
  }
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
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004


2005
2006
2007



2008
2009
2010

2011
2012






2013
2014

2015
2016
2017
2018
2019




2020
2021




2022
2023



2024
2025
2026





2027
2028


2029
2030
2031
2032
2033
2034
2035
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

1912
1913
1914
1915
1916
1917
1918

1919
1920
1921



1922
1923
1924
1925


1926
1927
1928
1929


1930
1931
1932
1933


1934
1935
1936
1937
1938
1939

1940
1941
1942
1943
1944
1945
1946
1947
1948







-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-










-
-
+
+

-
-
+
+
+

-
-
+

-
+
+
+
+
+
+

-
+


-
-
-
+
+
+
+
-
-
+
+
+
+
-
-
+
+
+

-
-
+
+
+
+
+

-
+
+







  # NOTE: Check for network connectivity to our test host (i.e.
  #       the Eagle distribution site).
  #
  if {![info exists no(network)]} then {
    checkForNetwork $test_channel $test_host $test_timeout
  }

  #
  # NOTE: Figure out the approximate relative performance of this machine.
  #
  if {[haveConstraint performance]} then {
    tputs $test_channel [appendArgs \
        "---- checking for baseline BogoCops (commands-per-second)... "]

    if {![info exists test_base_cops]} then {
      #
      # NOTE: The expected performance numbers for all the
      #       performance tests will be calibrated based on
      #       this number (which is based on the measured
      #       performance of the actual machine that was
      #       used to determine those expected performance
      #       numbers).
      #
      if {[isEagle]} then {
        set test_base_cops 36000.0; # NOTE: Eagle 1.0 Win32
      } else {
        set test_base_cops 1570000.0; # NOTE: Tcl 8.4.19 Win32
      }
    }

    tputs $test_channel [appendArgs $test_base_cops \n]
    tputs $test_channel [appendArgs \
        "---- checking for current BogoCops (commands-per-second)... "]

    if {![info exists test_cops]} then {
      set test_cops [calculateBogoCops]
    }

    tputs $test_channel [appendArgs [formatDecimal $test_cops] \n]

    set percent [expr {[calculateRelativePerformance iterations 1] * 100}]

    tputs $test_channel [appendArgs \
        "---- current BogoCops (commands-per-second) is " [formatDecimal \
        [expr {$percent > 100 ? $percent - 100 : $percent}] 2] "% " \
        [expr {$percent > 100 ? "faster than" : "as fast as"}] \
        " the baseline\n"]

    unset percent
  }

  #############################################################################
  ######################## END Eagle & Tcl Constraints ########################
  #############################################################################

  #
  # NOTE: For Eagle, dump the platform information, including
  #       the compile options.
  #
  if {[isEagle]} then {
    #
    # NOTE: Get the source checkout (i.e. of Eagle or whatever project the
    #       Eagle binaries are being used by).
    # NOTE: Figure out the approximate relative performance
    #       of this machine.
    #
    if {![info exists no(fossil)]} then {
      set pattern {^checkout:\s+(.*?)\s+$}
    if {[haveConstraint performance]} then {
      tputs $test_channel [appendArgs \
          "---- checking for baseline BogoCops (commands-per-second)... "]

      if {[catch {set exec [exec -- fossil info]}] || \
          [regexp -line -- $pattern $exec dummy checkout] == 0} then {
      if {![info exists test_base_cops]} then {
        #
        # NOTE: We could not query the source checkout from Fossil.
        # NOTE: The expected performance numbers for all the
        #       performance tests will be calibrated based on
        #       this number (which is based on the measured
        #       performance of the actual machine that was
        #       used to determine those expected performance
        #       numbers).
        #
        set checkout <none>
        set test_base_cops 36000.0
      }

      unset -nocomplain dummy exec pattern
    } else {
      #
      tputs $test_channel [appendArgs $test_base_cops \n]
      tputs $test_channel [appendArgs \
          "---- checking for current BogoCops (commands-per-second)... "]

      # NOTE: Querying the source checkout from Fossil was disabled.
      #
      if {![info exists test_cops]} then {
        set test_cops [calculateBogoCops]
      }

      set checkout <none>
    }
      tputs $test_channel [appendArgs [formatDecimal $test_cops] \n]

      set percent [expr {[calculateRelativePerformance iterations 1] * 100}]

    tputs $test_channel [appendArgs "---- checkout: " \
        $checkout \n]
      tputs $test_channel [appendArgs \
          "---- current BogoCops (commands-per-second) is " [formatDecimal \
          [expr {$percent > 100 ? $percent - 100 : $percent}] 2] "% " \
          [expr {$percent > 100 ? "faster than" : "as fast as"}] \
          " the baseline\n"]

    unset checkout
      unset percent
    }

    ###########################################################################

    set timeStamp [getPlatformInfo timeStamp ""]

    if {[string length $timeStamp] > 0} then {
      #########################################################################
2052
2053
2054
2055
2056
2057
2058
2059

2060
2061
2062
2063
2064
2065
2066
2067
2068
1965
1966
1967
1968
1969
1970
1971

1972


1973
1974
1975
1976
1977
1978
1979







-
+
-
-







        [list [getPlatformInfo engine <none>]] " " \
        [list [getPlatformInfo patchLevel <none>]] " " \
        [list [getPlatformInfo tag <none>]] " " \
        [list [getPlatformInfo release <none>]] " " \
        [list [getPlatformInfo text <none>]] " " \
        [list [getPlatformInfo configuration <none>]] " " \
        [list [getPlatformInfo suffix <none>]] " " \
        [list $timeStamp] " " \
        [list $timeStamp] \n]
        [list [getPlatformInfo sourceId <none>]] " " \
        [list [getPlatformInfo sourceTimeStamp <none>]] \n]

    unset timeStamp

    tputs $test_channel [appendArgs "---- os: " \
        [getPlatformInfo os <none>] \n]

    tputs $test_channel [appendArgs "---- globalAssemblyCache: " \
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2001
2002
2003
2004
2005
2006
2007















2008
2009
2010
2011
2012
2013







-
-
-
-
-
-
-
-
-
-
-
-
-
-
-







  #
  # NOTE: Show the active test constraints.
  #
  tputs $test_channel [appendArgs "---- constraints: " \
      [formatList [lsort [getConstraints]]] \n]

  #
  # NOTE: Show the starting command count (for both Tcl and Eagle).
  #
  tputs $test_channel [appendArgs "---- starting command count: " \
      [info cmdcount] \n]

  if {[isEagle]} then {
    #
    # NOTE: Show the starting operation count (for Eagle only).
    #
    tputs $test_channel [appendArgs "---- starting operation count: " \
        [object invoke -flags +NonPublic Interpreter.GetActive \
            OperationCount] \n]
  }

  #
  # NOTE: Show when the tests actually began (now).
  #
  tputs $test_channel [appendArgs "---- tests began at " \
      [clock format [clock seconds]] \n]
}
Changes to Membership/Properties/AssemblyInfo.cs.
29
30
31
32
33
34
35
36
37


29
30
31
32
33
34
35


36
37







-
-
+
+
//      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.83.0")]
[assembly: AssemblyFileVersion("1.0.83.0")]
[assembly: AssemblyVersion("1.0.80.0")]
[assembly: AssemblyFileVersion("1.0.80.0")]
Changes to Membership/Properties/Settings.Designer.cs.
Changes to Membership/Properties/Settings.settings.
Changes to Membership/Sql/ApplicationSql.Designer.cs.
Changes to Membership/Sql/MembershipSql.Designer.cs.
Changes to Membership/Sql/RoleSql.Designer.cs.
Changes to Membership/Sql/SiteMapSql.Designer.cs.
Changes to Membership/Sql/SiteMapSql.resx.
Changes to SQLite.Designer/AssemblyInfo.cs.
39
40
41
42
43
44
45
46
47


39
40
41
42
43
44
45


46
47







-
-
+
+
//      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.83.0")]
[assembly: AssemblyFileVersion("1.0.83.0")]
[assembly: AssemblyVersion("1.0.80.0")]
[assembly: AssemblyFileVersion("1.0.80.0")]
Changes to SQLite.Designer/ChangeScriptDialog.Designer.cs.
Changes to SQLite.Designer/ChangeScriptDialog.cs.
Changes to SQLite.Designer/Design/Check.cs.
Changes to SQLite.Designer/Design/ForeignKey.cs.
Changes to SQLite.Designer/Design/Index.cs.
Changes to SQLite.Designer/Design/SimpleTokenizer.cs.
Changes to SQLite.Designer/Design/Trigger.cs.
Changes to SQLite.Designer/Design/View.cs.
Changes to SQLite.Designer/Editors/ViewDesignerDoc.Designer.cs.
Changes to SQLite.Designer/Editors/ViewDesignerDoc.cs.
Changes to SQLite.Designer/PkgCmd.vsct.
Changes to SQLite.Designer/SQLiteDataObjectSupport.xml.
Changes to SQLite.Designer/TableNameDialog.Designer.cs.
Changes to SQLite.Designer/TableNameDialog.cs.
Changes to SQLite.Designer/VSPackage.Designer.cs.
Changes to SQLite.Designer/VSPackage.resx.
Changes to SQLite.Designer/source.extension.vsixmanifest.
1
2
3
4
5
6

7
8
9
10
11
12
13
1
2
3
4
5

6
7
8
9
10
11
12
13





-
+







<?xml version="1.0" encoding="utf-8"?>
<Vsix Version="1.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2010">
  <Identifier Id="67b5f3a9-cde1-430f-a12b-af95bb064851">
    <Name>System.Data.SQLite Designer</Name>
    <Author>http://system.data.sqlite.org/</Author>
    <Version>1.0.83.0</Version>
    <Version>1.0.80.0</Version>
    <Description>ADO.NET Data Designer for SQLite</Description>
    <Locale>1033</Locale>
    <InstalledByMsi>false</InstalledByMsi>
    <SupportedProducts>
      <VisualStudio Version="10.0">
        <Edition>Pro</Edition>
      </VisualStudio>
Changes to SQLite.Interop/SQLite.Interop.2005.vcproj.
49
50
51
52
53
54
55
56

57
58
59
60
61
62
63
49
50
51
52
53
54
55

56
57
58
59
60
61
62
63







-
+







			/>
			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="0"
				PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0400;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES)"
				PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0400;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES)"
				MinimalRebuild="false"
				ExceptionHandling="0"
				BasicRuntimeChecks="0"
				RuntimeLibrary="3"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
146
147
148
149
150
151
152
153

154
155
156
157
158
159
160
146
147
148
149
150
151
152

153
154
155
156
157
158
159
160







-
+







			<Tool
				Name="VCMIDLTool"
				TargetEnvironment="3"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="0"
				PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0400;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES)"
				PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0400;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES)"
				MinimalRebuild="false"
				ExceptionHandling="0"
				BasicRuntimeChecks="0"
				RuntimeLibrary="3"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
242
243
244
245
246
247
248
249

250
251
252
253
254
255
256
242
243
244
245
246
247
248

249
250
251
252
253
254
255
256







-
+







			/>
			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="0"
				PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0400;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES)"
				PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0400;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES)"
				MinimalRebuild="false"
				ExceptionHandling="0"
				BasicRuntimeChecks="0"
				RuntimeLibrary="3"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
303
304
305
306
307
308
309
310

311
312
313
314
315
316
317
303
304
305
306
307
308
309

310
311
312
313
314
315
316
317







-
+







				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine="IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;&quot; XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Debug\bin\$(PlatformName)\&quot; /D /E /V /I /F /H /Y &amp;&amp; IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;&quot; XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Debug\bin\&quot; /D /E /V /I /F /H /Y"
				CommandLine="XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Debug\bin\$(PlatformName)\&quot; /D /E /V /I /F /H /Y &amp;&amp; IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;&quot; XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Debug\bin\&quot; /D /E /V /I /F /H /Y"
			/>
		</Configuration>
		<Configuration
			Name="DebugNativeOnly|x64"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			ConfigurationType="2"
333
334
335
336
337
338
339
340

341
342
343
344
345
346
347
333
334
335
336
337
338
339

340
341
342
343
344
345
346
347







-
+







			<Tool
				Name="VCMIDLTool"
				TargetEnvironment="3"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="0"
				PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0400;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES)"
				PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0400;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES)"
				MinimalRebuild="false"
				ExceptionHandling="0"
				BasicRuntimeChecks="0"
				RuntimeLibrary="3"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
394
395
396
397
398
399
400
401

402
403
404
405
406
407
408
394
395
396
397
398
399
400

401
402
403
404
405
406
407
408







-
+







				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine="IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;AMD64&quot; XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Debug\bin\$(PlatformName)\&quot; /D /E /V /I /F /H /Y &amp;&amp; IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;AMD64&quot; XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Debug\bin\&quot; /D /E /V /I /F /H /Y"
				CommandLine="XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Debug\bin\$(PlatformName)\&quot; /D /E /V /I /F /H /Y &amp;&amp; IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;AMD64&quot; XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Debug\bin\&quot; /D /E /V /I /F /H /Y"
			/>
		</Configuration>
		<Configuration
			Name="Release|Win32"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			ConfigurationType="2"
426
427
428
429
430
431
432
433

434
435
436
437
438
439
440
426
427
428
429
430
431
432

433
434
435
436
437
438
439
440







-
+







				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="3"
				EnableIntrinsicFunctions="true"
				FavorSizeOrSpeed="1"
				PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0400;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES)"
				PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0400;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES)"
				StringPooling="true"
				ExceptionHandling="0"
				RuntimeLibrary="2"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
				CompileAs="0"
525
526
527
528
529
530
531
532

533
534
535
536
537
538
539
525
526
527
528
529
530
531

532
533
534
535
536
537
538
539







-
+







				TargetEnvironment="3"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="3"
				EnableIntrinsicFunctions="true"
				FavorSizeOrSpeed="1"
				PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0400;x64;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES)"
				PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0400;x64;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES)"
				StringPooling="true"
				ExceptionHandling="0"
				RuntimeLibrary="2"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
				CompileAs="0"
623
624
625
626
627
628
629
630

631
632
633
634
635
636
637
623
624
625
626
627
628
629

630
631
632
633
634
635
636
637







-
+







				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="3"
				EnableIntrinsicFunctions="true"
				FavorSizeOrSpeed="1"
				PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0400;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES)"
				PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0400;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES)"
				StringPooling="true"
				ExceptionHandling="0"
				RuntimeLibrary="2"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
				CompileAs="0"
683
684
685
686
687
688
689
690

691
692
693
694
695
696
697
683
684
685
686
687
688
689

690
691
692
693
694
695
696
697







-
+







				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine="IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;&quot; XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Release\bin\$(PlatformName)\&quot; /D /E /V /I /F /H /Y &amp;&amp; IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;&quot; XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Release\bin\&quot; /D /E /V /I /F /H /Y"
				CommandLine="XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Release\bin\$(PlatformName)\&quot; /D /E /V /I /F /H /Y &amp;&amp; IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;&quot; XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Release\bin\&quot; /D /E /V /I /F /H /Y"
			/>
		</Configuration>
		<Configuration
			Name="ReleaseNativeOnly|x64"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			ConfigurationType="2"
716
717
718
719
720
721
722
723

724
725
726
727
728
729
730
716
717
718
719
720
721
722

723
724
725
726
727
728
729
730







-
+







				TargetEnvironment="3"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="3"
				EnableIntrinsicFunctions="true"
				FavorSizeOrSpeed="1"
				PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0400;x64;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES)"
				PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0400;x64;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES)"
				StringPooling="true"
				ExceptionHandling="0"
				RuntimeLibrary="2"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
				CompileAs="0"
776
777
778
779
780
781
782
783

784
785
786
787
788
789
790
776
777
778
779
780
781
782

783
784
785
786
787
788
789
790







-
+







				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine="IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;AMD64&quot; XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Release\bin\$(PlatformName)\&quot; /D /E /V /I /F /H /Y &amp;&amp; IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;AMD64&quot; XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Release\bin\&quot; /D /E /V /I /F /H /Y"
				CommandLine="XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Release\bin\$(PlatformName)\&quot; /D /E /V /I /F /H /Y &amp;&amp; IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;AMD64&quot; XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Release\bin\&quot; /D /E /V /I /F /H /Y"
			/>
		</Configuration>
	</Configurations>
	<References>
	</References>
	<Files>
		<Filter
Changes to SQLite.Interop/SQLite.Interop.2008.vcproj.
49
50
51
52
53
54
55
56

57
58
59
60
61
62
63
49
50
51
52
53
54
55

56
57
58
59
60
61
62
63







-
+







			/>
			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="0"
				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES)"
				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES)"
				MinimalRebuild="false"
				ExceptionHandling="0"
				BasicRuntimeChecks="0"
				RuntimeLibrary="3"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
146
147
148
149
150
151
152
153

154
155
156
157
158
159
160
146
147
148
149
150
151
152

153
154
155
156
157
158
159
160







-
+







			<Tool
				Name="VCMIDLTool"
				TargetEnvironment="3"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="0"
				PreprocessorDefinitions="WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES)"
				PreprocessorDefinitions="WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES)"
				MinimalRebuild="false"
				ExceptionHandling="0"
				BasicRuntimeChecks="0"
				RuntimeLibrary="3"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
242
243
244
245
246
247
248
249

250
251
252
253
254
255
256
242
243
244
245
246
247
248

249
250
251
252
253
254
255
256







-
+







			/>
			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="0"
				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES)"
				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES)"
				MinimalRebuild="false"
				ExceptionHandling="0"
				BasicRuntimeChecks="0"
				RuntimeLibrary="3"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
303
304
305
306
307
308
309
310

311
312
313
314
315
316
317
303
304
305
306
307
308
309

310
311
312
313
314
315
316
317







-
+







				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine="IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;&quot; XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Debug\bin\$(PlatformName)\&quot; /D /E /V /I /F /H /Y &amp;&amp; IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;&quot; XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Debug\bin\&quot; /D /E /V /I /F /H /Y"
				CommandLine="XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Debug\bin\$(PlatformName)\&quot; /D /E /V /I /F /H /Y &amp;&amp; IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;&quot; XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Debug\bin\&quot; /D /E /V /I /F /H /Y"
			/>
		</Configuration>
		<Configuration
			Name="DebugNativeOnly|x64"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			ConfigurationType="2"
333
334
335
336
337
338
339
340

341
342
343
344
345
346
347
333
334
335
336
337
338
339

340
341
342
343
344
345
346
347







-
+







			<Tool
				Name="VCMIDLTool"
				TargetEnvironment="3"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="0"
				PreprocessorDefinitions="WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES)"
				PreprocessorDefinitions="WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES)"
				MinimalRebuild="false"
				ExceptionHandling="0"
				BasicRuntimeChecks="0"
				RuntimeLibrary="3"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
394
395
396
397
398
399
400
401

402
403
404
405
406
407
408
394
395
396
397
398
399
400

401
402
403
404
405
406
407
408







-
+







				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine="IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;AMD64&quot; XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Debug\bin\$(PlatformName)\&quot; /D /E /V /I /F /H /Y &amp;&amp; IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;AMD64&quot; XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Debug\bin\&quot; /D /E /V /I /F /H /Y"
				CommandLine="XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Debug\bin\$(PlatformName)\&quot; /D /E /V /I /F /H /Y &amp;&amp; IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;AMD64&quot; XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Debug\bin\&quot; /D /E /V /I /F /H /Y"
			/>
		</Configuration>
		<Configuration
			Name="Release|Win32"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			ConfigurationType="2"
426
427
428
429
430
431
432
433

434
435
436
437
438
439
440
426
427
428
429
430
431
432

433
434
435
436
437
438
439
440







-
+







				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="3"
				EnableIntrinsicFunctions="true"
				FavorSizeOrSpeed="1"
				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES)"
				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES)"
				StringPooling="true"
				ExceptionHandling="0"
				RuntimeLibrary="2"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
				CompileAs="0"
525
526
527
528
529
530
531
532

533
534
535
536
537
538
539
525
526
527
528
529
530
531

532
533
534
535
536
537
538
539







-
+







				TargetEnvironment="3"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="3"
				EnableIntrinsicFunctions="true"
				FavorSizeOrSpeed="1"
				PreprocessorDefinitions="WIN32;x64;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES)"
				PreprocessorDefinitions="WIN32;x64;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES)"
				StringPooling="true"
				ExceptionHandling="0"
				RuntimeLibrary="2"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
				CompileAs="0"
623
624
625
626
627
628
629
630

631
632
633
634
635
636
637
623
624
625
626
627
628
629

630
631
632
633
634
635
636
637







-
+







				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="3"
				EnableIntrinsicFunctions="true"
				FavorSizeOrSpeed="1"
				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES)"
				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES)"
				StringPooling="true"
				ExceptionHandling="0"
				RuntimeLibrary="2"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
				CompileAs="0"
683
684
685
686
687
688
689
690

691
692
693
694
695
696
697
683
684
685
686
687
688
689

690
691
692
693
694
695
696
697







-
+







				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine="IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;&quot; XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Release\bin\$(PlatformName)\&quot; /D /E /V /I /F /H /Y &amp;&amp; IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;&quot; XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Release\bin\&quot; /D /E /V /I /F /H /Y"
				CommandLine="XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Release\bin\$(PlatformName)\&quot; /D /E /V /I /F /H /Y &amp;&amp; IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;&quot; XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Release\bin\&quot; /D /E /V /I /F /H /Y"
			/>
		</Configuration>
		<Configuration
			Name="ReleaseNativeOnly|x64"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			ConfigurationType="2"
716
717
718
719
720
721
722
723

724
725
726
727
728
729
730
716
717
718
719
720
721
722

723
724
725
726
727
728
729
730







-
+







				TargetEnvironment="3"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="3"
				EnableIntrinsicFunctions="true"
				FavorSizeOrSpeed="1"
				PreprocessorDefinitions="WIN32;x64;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES)"
				PreprocessorDefinitions="WIN32;x64;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES)"
				StringPooling="true"
				ExceptionHandling="0"
				RuntimeLibrary="2"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
				CompileAs="0"
776
777
778
779
780
781
782
783

784
785
786
787
788
789
790
776
777
778
779
780
781
782

783
784
785
786
787
788
789
790







-
+







				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine="IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;AMD64&quot; XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Release\bin\$(PlatformName)\&quot; /D /E /V /I /F /H /Y &amp;&amp; IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;AMD64&quot; XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Release\bin\&quot; /D /E /V /I /F /H /Y"
				CommandLine="XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Release\bin\$(PlatformName)\&quot; /D /E /V /I /F /H /Y &amp;&amp; IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;AMD64&quot; XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Release\bin\&quot; /D /E /V /I /F /H /Y"
			/>
		</Configuration>
	</Configurations>
	<References>
	</References>
	<Files>
		<Filter
Changes to SQLite.Interop/SQLite.Interop.2010.vcxproj.
121
122
123
124
125
126
127
128

129
130
131
132
133
134
135
121
122
123
124
125
126
127

128
129
130
131
132
133
134
135







-
+







    <LinkDelaySign Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkDelaySign>
    <LinkDelaySign Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</LinkDelaySign>
    <LinkDelaySign Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</LinkDelaySign>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <ClCompile>
      <Optimization>Disabled</Optimization>
      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
162
163
164
165
166
167
168
169

170
171
172
173
174
175
176
162
163
164
165
166
167
168

169
170
171
172
173
174
175
176







-
+







    <PostBuildEvent>
      <Command>"$(FrameworkSDKDir)Bin\sn.exe" -Ra "$(TargetPath)" "$(INTEROP_KEY_FILE)"</Command>
    </PostBuildEvent>
  </ItemDefinitionGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <ClCompile>
      <Optimization>Disabled</Optimization>
      <PreprocessorDefinitions>WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <PreprocessorDefinitions>WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
203
204
205
206
207
208
209
210

211
212
213
214
215
216
217
203
204
205
206
207
208
209

210
211
212
213
214
215
216
217







-
+







    <PostBuildEvent>
      <Command>"$(FrameworkSDKDir)Bin\sn.exe" -Ra "$(TargetPath)" "$(INTEROP_KEY_FILE)"</Command>
    </PostBuildEvent>
  </ItemDefinitionGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|Win32'">
    <ClCompile>
      <Optimization>Disabled</Optimization>
      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
238
239
240
241
242
243
244
245

246
247
248
249
250
251
252
238
239
240
241
242
243
244

245
246
247
248
249
250
251
252







-
+







      <Command>XCOPY "$(TargetPath)" "$(OutDir)..\..\Debug\bin\$(Platform)\" /D /E /V /I /F /H /Y
XCOPY "$(TargetPath)" "$(OutDir)..\..\Debug\bin\" /D /E /V /I /F /H /Y</Command>
    </PostBuildEvent>
  </ItemDefinitionGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|x64'">
    <ClCompile>
      <Optimization>Disabled</Optimization>
      <PreprocessorDefinitions>WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <PreprocessorDefinitions>WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
275
276
277
278
279
280
281
282

283
284
285
286
287
288
289
275
276
277
278
279
280
281

282
283
284
285
286
287
288
289







-
+







    </PostBuildEvent>
  </ItemDefinitionGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    <ClCompile>
      <Optimization>Full</Optimization>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <StringPooling>true</StringPooling>
      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
318
319
320
321
322
323
324
325

326
327
328
329
330
331
332
318
319
320
321
322
323
324

325
326
327
328
329
330
331
332







-
+







    </PostBuildEvent>
  </ItemDefinitionGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    <ClCompile>
      <Optimization>Full</Optimization>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
      <PreprocessorDefinitions>WIN32;x64;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <PreprocessorDefinitions>WIN32;x64;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <StringPooling>true</StringPooling>
      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
361
362
363
364
365
366
367
368

369
370
371
372
373
374
375
361
362
363
364
365
366
367

368
369
370
371
372
373
374
375







-
+







    </PostBuildEvent>
  </ItemDefinitionGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|Win32'">
    <ClCompile>
      <Optimization>Full</Optimization>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <StringPooling>true</StringPooling>
      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
399
400
401
402
403
404
405
406

407
408
409
410
411
412
413
399
400
401
402
403
404
405

406
407
408
409
410
411
412
413







-
+







    </PostBuildEvent>
  </ItemDefinitionGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|x64'">
    <ClCompile>
      <Optimization>Full</Optimization>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
      <PreprocessorDefinitions>WIN32;x64;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <PreprocessorDefinitions>WIN32;x64;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <StringPooling>true</StringPooling>
      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
Changes to SQLite.Interop/SQLite.Interop.CE.2005.vcproj.
53
54
55
56
57
58
59
60

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

60
61
62
63
64
65
66
67







-
+







				Name="VCMIDLTool"
				TargetEnvironment="1"
			/>
			<Tool
				Name="VCCLCompilerTool"
				ExecutionBucket="7"
				Optimization="0"
				PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;DEBUG;_WINDOWS;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE;$(SQLITE_WINCE_DEFINES);$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES)"
				PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;DEBUG;_WINDOWS;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE;$(SQLITE_WINCE_DEFINES);$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES)"
				MinimalRebuild="true"
				RuntimeLibrary="1"
				FloatingPointModel="0"
				UsePrecompiledHeader="0"
				WarningLevel="3"
				DebugInformationFormat="3"
				CompileAs="1"
151
152
153
154
155
156
157
158

159
160
161
162
163
164
165
151
152
153
154
155
156
157

158
159
160
161
162
163
164
165







-
+







				TargetEnvironment="1"
			/>
			<Tool
				Name="VCCLCompilerTool"
				ExecutionBucket="7"
				Optimization="2"
				FavorSizeOrSpeed="2"
				PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;_WINDOWS;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE;$(SQLITE_WINCE_DEFINES);$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES)"
				PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;_WINDOWS;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE;$(SQLITE_WINCE_DEFINES);$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES)"
				RuntimeLibrary="0"
				FloatingPointModel="0"
				UsePrecompiledHeader="0"
				WarningLevel="3"
				DebugInformationFormat="3"
				CompileAs="1"
				DisableSpecificWarnings="$(SQLITE_DISABLE_WARNINGS)"
248
249
250
251
252
253
254
255

256
257
258
259
260
261
262
248
249
250
251
252
253
254

255
256
257
258
259
260
261
262







-
+







			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				ExecutionBucket="7"
				Optimization="0"
				PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;DEBUG;_WINDOWS;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE;$(SQLITE_WINCE_DEFINES);$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES)"
				PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;DEBUG;_WINDOWS;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE;$(SQLITE_WINCE_DEFINES);$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES)"
				MinimalRebuild="true"
				RuntimeLibrary="1"
				FloatingPointModel="0"
				UsePrecompiledHeader="0"
				WarningLevel="3"
				DebugInformationFormat="3"
				CompileAs="1"
342
343
344
345
346
347
348
349

350
351
352
353
354
355
356
342
343
344
345
346
347
348

349
350
351
352
353
354
355
356







-
+







			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				ExecutionBucket="7"
				Optimization="0"
				PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;DEBUG;_WINDOWS;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE;$(SQLITE_WINCE_DEFINES);$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES)"
				PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;DEBUG;_WINDOWS;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE;$(SQLITE_WINCE_DEFINES);$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES)"
				MinimalRebuild="true"
				RuntimeLibrary="1"
				FloatingPointModel="0"
				UsePrecompiledHeader="0"
				WarningLevel="3"
				DebugInformationFormat="3"
				CompileAs="1"
437
438
439
440
441
442
443
444

445
446
447
448
449
450
451
437
438
439
440
441
442
443

444
445
446
447
448
449
450
451







-
+







				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				ExecutionBucket="7"
				Optimization="2"
				FavorSizeOrSpeed="2"
				PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;_WINDOWS;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE;$(SQLITE_WINCE_DEFINES);$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES)"
				PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;_WINDOWS;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE;$(SQLITE_WINCE_DEFINES);$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES)"
				RuntimeLibrary="0"
				FloatingPointModel="0"
				UsePrecompiledHeader="0"
				WarningLevel="3"
				DebugInformationFormat="3"
				CompileAs="1"
				DisableSpecificWarnings="$(SQLITE_DISABLE_WARNINGS)"
533
534
535
536
537
538
539
540

541
542
543
544
545
546
547
533
534
535
536
537
538
539

540
541
542
543
544
545
546
547







-
+







				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				ExecutionBucket="7"
				Optimization="2"
				FavorSizeOrSpeed="2"
				PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;_WINDOWS;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE;$(SQLITE_WINCE_DEFINES);$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES)"
				PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;_WINDOWS;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE;$(SQLITE_WINCE_DEFINES);$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES)"
				RuntimeLibrary="0"
				FloatingPointModel="0"
				UsePrecompiledHeader="0"
				WarningLevel="3"
				DebugInformationFormat="3"
				CompileAs="1"
				DisableSpecificWarnings="$(SQLITE_DISABLE_WARNINGS)"
Changes to SQLite.Interop/SQLite.Interop.CE.2008.vcproj.
53
54
55
56
57
58
59
60

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

60
61
62
63
64
65
66
67







-
+







				Name="VCMIDLTool"
				TargetEnvironment="1"
			/>
			<Tool
				Name="VCCLCompilerTool"
				ExecutionBucket="7"
				Optimization="0"
				PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;DEBUG;_WINDOWS;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE;$(SQLITE_WINCE_DEFINES);$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES)"
				PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;DEBUG;_WINDOWS;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE;$(SQLITE_WINCE_DEFINES);$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES)"
				MinimalRebuild="true"
				RuntimeLibrary="1"
				FloatingPointModel="0"
				UsePrecompiledHeader="0"
				WarningLevel="3"
				DebugInformationFormat="3"
				CompileAs="1"
151
152
153
154
155
156
157
158

159
160
161
162
163
164
165
151
152
153
154
155
156
157

158
159
160
161
162
163
164
165







-
+







				TargetEnvironment="1"
			/>
			<Tool
				Name="VCCLCompilerTool"
				ExecutionBucket="7"
				Optimization="2"
				FavorSizeOrSpeed="2"
				PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;_WINDOWS;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE;$(SQLITE_WINCE_DEFINES);$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES)"
				PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;_WINDOWS;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE;$(SQLITE_WINCE_DEFINES);$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES)"
				RuntimeLibrary="0"
				FloatingPointModel="0"
				UsePrecompiledHeader="0"
				WarningLevel="3"
				DebugInformationFormat="3"
				CompileAs="1"
				DisableSpecificWarnings="$(SQLITE_DISABLE_WARNINGS)"
248
249
250
251
252
253
254
255

256
257
258
259
260
261
262
248
249
250
251
252
253
254

255
256
257
258
259
260
261
262







-
+







			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				ExecutionBucket="7"
				Optimization="0"
				PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;DEBUG;_WINDOWS;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE;$(SQLITE_WINCE_DEFINES);$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES)"
				PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;DEBUG;_WINDOWS;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE;$(SQLITE_WINCE_DEFINES);$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES)"
				MinimalRebuild="true"
				RuntimeLibrary="1"
				FloatingPointModel="0"
				UsePrecompiledHeader="0"
				WarningLevel="3"
				DebugInformationFormat="3"
				CompileAs="1"
342
343
344
345
346
347
348
349

350
351
352
353
354
355
356
342
343
344
345
346
347
348

349
350
351
352
353
354
355
356







-
+







			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				ExecutionBucket="7"
				Optimization="0"
				PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;DEBUG;_WINDOWS;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE;$(SQLITE_WINCE_DEFINES);$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES)"
				PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;DEBUG;_WINDOWS;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE;$(SQLITE_WINCE_DEFINES);$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES)"
				MinimalRebuild="true"
				RuntimeLibrary="1"
				FloatingPointModel="0"
				UsePrecompiledHeader="0"
				WarningLevel="3"
				DebugInformationFormat="3"
				CompileAs="1"
437
438
439
440
441
442
443
444

445
446
447
448
449
450
451
437
438
439
440
441
442
443

444
445
446
447
448
449
450
451







-
+







				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				ExecutionBucket="7"
				Optimization="2"
				FavorSizeOrSpeed="2"
				PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;_WINDOWS;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE;$(SQLITE_WINCE_DEFINES);$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES)"
				PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;_WINDOWS;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE;$(SQLITE_WINCE_DEFINES);$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES)"
				RuntimeLibrary="0"
				FloatingPointModel="0"
				UsePrecompiledHeader="0"
				WarningLevel="3"
				DebugInformationFormat="3"
				CompileAs="1"
				DisableSpecificWarnings="$(SQLITE_DISABLE_WARNINGS)"
533
534
535
536
537
538
539
540

541
542
543
544
545
546
547
533
534
535
536
537
538
539

540
541
542
543
544
545
546
547







-
+







				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				ExecutionBucket="7"
				Optimization="2"
				FavorSizeOrSpeed="2"
				PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;_WINDOWS;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE;$(SQLITE_WINCE_DEFINES);$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES)"
				PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;_WINDOWS;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE;$(SQLITE_WINCE_DEFINES);$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES)"
				RuntimeLibrary="0"
				FloatingPointModel="0"
				UsePrecompiledHeader="0"
				WarningLevel="3"
				DebugInformationFormat="3"
				CompileAs="1"
				DisableSpecificWarnings="$(SQLITE_DISABLE_WARNINGS)"
Changes to SQLite.Interop/SQLite.Interop.Static.2005.vcproj.
49
50
51
52
53
54
55
56

57
58
59
60
61
62
63
49
50
51
52
53
54
55

56
57
58
59
60
61
62
63







-
+







			/>
			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="0"
				PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0400;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES)"
				PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0400;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES)"
				MinimalRebuild="false"
				ExceptionHandling="0"
				BasicRuntimeChecks="0"
				RuntimeLibrary="1"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
146
147
148
149
150
151
152
153

154
155
156
157
158
159
160
146
147
148
149
150
151
152

153
154
155
156
157
158
159
160







-
+







			<Tool
				Name="VCMIDLTool"
				TargetEnvironment="3"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="0"
				PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0400;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES)"
				PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0400;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES)"
				MinimalRebuild="false"
				ExceptionHandling="0"
				BasicRuntimeChecks="0"
				RuntimeLibrary="1"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
242
243
244
245
246
247
248
249

250
251
252
253
254
255
256
242
243
244
245
246
247
248

249
250
251
252
253
254
255
256







-
+







			/>
			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="0"
				PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0400;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES)"
				PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0400;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES)"
				MinimalRebuild="false"
				ExceptionHandling="0"
				BasicRuntimeChecks="0"
				RuntimeLibrary="1"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
303
304
305
306
307
308
309
310

311
312
313
314
315
316
317
303
304
305
306
307
308
309

310
311
312
313
314
315
316
317







-
+







				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine="IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;&quot; XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Debug\bin\$(PlatformName)\&quot; /D /E /V /I /F /H /Y &amp;&amp; IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;&quot; XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Debug\bin\&quot; /D /E /V /I /F /H /Y"
				CommandLine="XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Debug\bin\$(PlatformName)\&quot; /D /E /V /I /F /H /Y &amp;&amp; IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;&quot; XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Debug\bin\&quot; /D /E /V /I /F /H /Y"
			/>
		</Configuration>
		<Configuration
			Name="DebugNativeOnly|x64"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)Static"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)Static"
			ConfigurationType="2"
333
334
335
336
337
338
339
340

341
342
343
344
345
346
347
333
334
335
336
337
338
339

340
341
342
343
344
345
346
347







-
+







			<Tool
				Name="VCMIDLTool"
				TargetEnvironment="3"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="0"
				PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0400;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES)"
				PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0400;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES)"
				MinimalRebuild="false"
				ExceptionHandling="0"
				BasicRuntimeChecks="0"
				RuntimeLibrary="1"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
394
395
396
397
398
399
400
401

402
403
404
405
406
407
408
394
395
396
397
398
399
400

401
402
403
404
405
406
407
408







-
+







				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine="IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;AMD64&quot; XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Debug\bin\$(PlatformName)\&quot; /D /E /V /I /F /H /Y &amp;&amp; IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;AMD64&quot; XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Debug\bin\&quot; /D /E /V /I /F /H /Y"
				CommandLine="XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Debug\bin\$(PlatformName)\&quot; /D /E /V /I /F /H /Y &amp;&amp; IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;AMD64&quot; XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Debug\bin\&quot; /D /E /V /I /F /H /Y"
			/>
		</Configuration>
		<Configuration
			Name="Release|Win32"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)Static"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)Static"
			ConfigurationType="2"
426
427
428
429
430
431
432
433

434
435
436
437
438
439
440
426
427
428
429
430
431
432

433
434
435
436
437
438
439
440







-
+







				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="3"
				EnableIntrinsicFunctions="true"
				FavorSizeOrSpeed="1"
				PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0400;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES)"
				PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0400;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES)"
				StringPooling="true"
				ExceptionHandling="0"
				RuntimeLibrary="0"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
				CompileAs="0"
525
526
527
528
529
530
531
532

533
534
535
536
537
538
539
525
526
527
528
529
530
531

532
533
534
535
536
537
538
539







-
+







				TargetEnvironment="3"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="3"
				EnableIntrinsicFunctions="true"
				FavorSizeOrSpeed="1"
				PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0400;x64;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES)"
				PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0400;x64;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES)"
				StringPooling="true"
				ExceptionHandling="0"
				RuntimeLibrary="0"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
				CompileAs="0"
623
624
625
626
627
628
629
630

631
632
633
634
635
636
637
623
624
625
626
627
628
629

630
631
632
633
634
635
636
637







-
+







				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="3"
				EnableIntrinsicFunctions="true"
				FavorSizeOrSpeed="1"
				PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0400;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES)"
				PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0400;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES)"
				StringPooling="true"
				ExceptionHandling="0"
				RuntimeLibrary="0"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
				CompileAs="0"
683
684
685
686
687
688
689
690

691
692
693
694
695
696
697
683
684
685
686
687
688
689

690
691
692
693
694
695
696
697







-
+







				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine="IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;&quot; XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Release\bin\$(PlatformName)\&quot; /D /E /V /I /F /H /Y &amp;&amp; IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;&quot; XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Release\bin\&quot; /D /E /V /I /F /H /Y"
				CommandLine="XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Release\bin\$(PlatformName)\&quot; /D /E /V /I /F /H /Y &amp;&amp; IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;&quot; XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Release\bin\&quot; /D /E /V /I /F /H /Y"
			/>
		</Configuration>
		<Configuration
			Name="ReleaseNativeOnly|x64"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)Static"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)Static"
			ConfigurationType="2"
716
717
718
719
720
721
722
723

724
725
726
727
728
729
730
716
717
718
719
720
721
722

723
724
725
726
727
728
729
730







-
+







				TargetEnvironment="3"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="3"
				EnableIntrinsicFunctions="true"
				FavorSizeOrSpeed="1"
				PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0400;x64;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES)"
				PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0400;x64;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES)"
				StringPooling="true"
				ExceptionHandling="0"
				RuntimeLibrary="0"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
				CompileAs="0"
776
777
778
779
780
781
782
783

784
785
786
787
788
789
790
776
777
778
779
780
781
782

783
784
785
786
787
788
789
790







-
+







				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine="IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;AMD64&quot; XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Release\bin\$(PlatformName)\&quot; /D /E /V /I /F /H /Y &amp;&amp; IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;AMD64&quot; XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Release\bin\&quot; /D /E /V /I /F /H /Y"
				CommandLine="XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Release\bin\$(PlatformName)\&quot; /D /E /V /I /F /H /Y &amp;&amp; IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;AMD64&quot; XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Release\bin\&quot; /D /E /V /I /F /H /Y"
			/>
		</Configuration>
	</Configurations>
	<References>
	</References>
	<Files>
		<Filter
Changes to SQLite.Interop/SQLite.Interop.Static.2008.vcproj.
49
50
51
52
53
54
55
56

57
58
59
60
61
62
63
49
50
51
52
53
54
55

56
57
58
59
60
61
62
63







-
+







			/>
			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="0"
				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES)"
				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES)"
				MinimalRebuild="false"
				ExceptionHandling="0"
				BasicRuntimeChecks="0"
				RuntimeLibrary="1"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
146
147
148
149
150
151
152
153

154
155
156
157
158
159
160
146
147
148
149
150
151
152

153
154
155
156
157
158
159
160







-
+







			<Tool
				Name="VCMIDLTool"
				TargetEnvironment="3"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="0"
				PreprocessorDefinitions="WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES)"
				PreprocessorDefinitions="WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES)"
				MinimalRebuild="false"
				ExceptionHandling="0"
				BasicRuntimeChecks="0"
				RuntimeLibrary="1"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
242
243
244
245
246
247
248
249

250
251
252
253
254
255
256
242
243
244
245
246
247
248

249
250
251
252
253
254
255
256







-
+







			/>
			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="0"
				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES)"
				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES)"
				MinimalRebuild="false"
				ExceptionHandling="0"
				BasicRuntimeChecks="0"
				RuntimeLibrary="1"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
303
304
305
306
307
308
309
310

311
312
313
314
315
316
317
303
304
305
306
307
308
309

310
311
312
313
314
315
316
317







-
+







				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine="IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;&quot; XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Debug\bin\$(PlatformName)\&quot; /D /E /V /I /F /H /Y &amp;&amp; IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;&quot; XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Debug\bin\&quot; /D /E /V /I /F /H /Y"
				CommandLine="XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Debug\bin\$(PlatformName)\&quot; /D /E /V /I /F /H /Y &amp;&amp; IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;&quot; XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Debug\bin\&quot; /D /E /V /I /F /H /Y"
			/>
		</Configuration>
		<Configuration
			Name="DebugNativeOnly|x64"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)Static"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)Static"
			ConfigurationType="2"
333
334
335
336
337
338
339
340

341
342
343
344
345
346
347
333
334
335
336
337
338
339

340
341
342
343
344
345
346
347







-
+







			<Tool
				Name="VCMIDLTool"
				TargetEnvironment="3"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="0"
				PreprocessorDefinitions="WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES)"
				PreprocessorDefinitions="WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES)"
				MinimalRebuild="false"
				ExceptionHandling="0"
				BasicRuntimeChecks="0"
				RuntimeLibrary="1"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
394
395
396
397
398
399
400
401

402
403
404
405
406
407
408
394
395
396
397
398
399
400

401
402
403
404
405
406
407
408







-
+







				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine="IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;AMD64&quot; XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Debug\bin\$(PlatformName)\&quot; /D /E /V /I /F /H /Y &amp;&amp; IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;AMD64&quot; XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Debug\bin\&quot; /D /E /V /I /F /H /Y"
				CommandLine="XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Debug\bin\$(PlatformName)\&quot; /D /E /V /I /F /H /Y &amp;&amp; IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;AMD64&quot; XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Debug\bin\&quot; /D /E /V /I /F /H /Y"
			/>
		</Configuration>
		<Configuration
			Name="Release|Win32"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)Static"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)Static"
			ConfigurationType="2"
426
427
428
429
430
431
432
433

434
435
436
437
438
439
440
426
427
428
429
430
431
432

433
434
435
436
437
438
439
440







-
+







				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="3"
				EnableIntrinsicFunctions="true"
				FavorSizeOrSpeed="1"
				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES)"
				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES)"
				StringPooling="true"
				ExceptionHandling="0"
				RuntimeLibrary="0"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
				CompileAs="0"
525
526
527
528
529
530
531
532

533
534
535
536
537
538
539
525
526
527
528
529
530
531

532
533
534
535
536
537
538
539







-
+







				TargetEnvironment="3"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="3"
				EnableIntrinsicFunctions="true"
				FavorSizeOrSpeed="1"
				PreprocessorDefinitions="WIN32;x64;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES)"
				PreprocessorDefinitions="WIN32;x64;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES)"
				StringPooling="true"
				ExceptionHandling="0"
				RuntimeLibrary="0"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
				CompileAs="0"
623
624
625
626
627
628
629
630

631
632
633
634
635
636
637
623
624
625
626
627
628
629

630
631
632
633
634
635
636
637







-
+







				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="3"
				EnableIntrinsicFunctions="true"
				FavorSizeOrSpeed="1"
				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES)"
				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES)"
				StringPooling="true"
				ExceptionHandling="0"
				RuntimeLibrary="0"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
				CompileAs="0"
683
684
685
686
687
688
689
690

691
692
693
694
695
696
697
683
684
685
686
687
688
689

690
691
692
693
694
695
696
697







-
+







				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine="IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;&quot; XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Release\bin\$(PlatformName)\&quot; /D /E /V /I /F /H /Y &amp;&amp; IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;&quot; XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Release\bin\&quot; /D /E /V /I /F /H /Y"
				CommandLine="XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Release\bin\$(PlatformName)\&quot; /D /E /V /I /F /H /Y &amp;&amp; IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;&quot; XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Release\bin\&quot; /D /E /V /I /F /H /Y"
			/>
		</Configuration>
		<Configuration
			Name="ReleaseNativeOnly|x64"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)Static"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)Static"
			ConfigurationType="2"
716
717
718
719
720
721
722
723

724
725
726
727
728
729
730
716
717
718
719
720
721
722

723
724
725
726
727
728
729
730







-
+







				TargetEnvironment="3"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="3"
				EnableIntrinsicFunctions="true"
				FavorSizeOrSpeed="1"
				PreprocessorDefinitions="WIN32;x64;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES)"
				PreprocessorDefinitions="WIN32;x64;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES)"
				StringPooling="true"
				ExceptionHandling="0"
				RuntimeLibrary="0"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
				CompileAs="0"
776
777
778
779
780
781
782
783

784
785
786
787
788
789
790
776
777
778
779
780
781
782

783
784
785
786
787
788
789
790







-
+







				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine="IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;AMD64&quot; XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Release\bin\$(PlatformName)\&quot; /D /E /V /I /F /H /Y &amp;&amp; IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;AMD64&quot; XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Release\bin\&quot; /D /E /V /I /F /H /Y"
				CommandLine="XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Release\bin\$(PlatformName)\&quot; /D /E /V /I /F /H /Y &amp;&amp; IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;AMD64&quot; XCOPY &quot;$(TargetPath)&quot; &quot;$(OutDir)..\..\..\Release\bin\&quot; /D /E /V /I /F /H /Y"
			/>
		</Configuration>
	</Configurations>
	<References>
	</References>
	<Files>
		<Filter
Changes to SQLite.Interop/SQLite.Interop.Static.2010.vcxproj.
121
122
123
124
125
126
127
128

129
130
131
132
133
134
135
121
122
123
124
125
126
127

128
129
130
131
132
133
134
135







-
+







    <LinkDelaySign Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkDelaySign>
    <LinkDelaySign Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</LinkDelaySign>
    <LinkDelaySign Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</LinkDelaySign>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <ClCompile>
      <Optimization>Disabled</Optimization>
      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
162
163
164
165
166
167
168
169

170
171
172
173
174
175
176
162
163
164
165
166
167
168

169
170
171
172
173
174
175
176







-
+







    <PostBuildEvent>
      <Command>"$(FrameworkSDKDir)Bin\sn.exe" -Ra "$(TargetPath)" "$(INTEROP_KEY_FILE)"</Command>
    </PostBuildEvent>
  </ItemDefinitionGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <ClCompile>
      <Optimization>Disabled</Optimization>
      <PreprocessorDefinitions>WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <PreprocessorDefinitions>WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
203
204
205
206
207
208
209
210

211
212
213
214
215
216
217
203
204
205
206
207
208
209

210
211
212
213
214
215
216
217







-
+







    <PostBuildEvent>
      <Command>"$(FrameworkSDKDir)Bin\sn.exe" -Ra "$(TargetPath)" "$(INTEROP_KEY_FILE)"</Command>
    </PostBuildEvent>
  </ItemDefinitionGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|Win32'">
    <ClCompile>
      <Optimization>Disabled</Optimization>
      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
238
239
240
241
242
243
244
245

246
247
248
249
250
251
252
238
239
240
241
242
243
244

245
246
247
248
249
250
251
252







-
+







      <Command>XCOPY "$(TargetPath)" "$(OutDir)..\..\Debug\bin\$(Platform)\" /D /E /V /I /F /H /Y
XCOPY "$(TargetPath)" "$(OutDir)..\..\Debug\bin\" /D /E /V /I /F /H /Y</Command>
    </PostBuildEvent>
  </ItemDefinitionGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|x64'">
    <ClCompile>
      <Optimization>Disabled</Optimization>
      <PreprocessorDefinitions>WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <PreprocessorDefinitions>WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
275
276
277
278
279
280
281
282

283
284
285
286
287
288
289
275
276
277
278
279
280
281

282
283
284
285
286
287
288
289







-
+







    </PostBuildEvent>
  </ItemDefinitionGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    <ClCompile>
      <Optimization>Full</Optimization>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <StringPooling>true</StringPooling>
      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
318
319
320
321
322
323
324
325

326
327
328
329
330
331
332
318
319
320
321
322
323
324

325
326
327
328
329
330
331
332







-
+







    </PostBuildEvent>
  </ItemDefinitionGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    <ClCompile>
      <Optimization>Full</Optimization>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
      <PreprocessorDefinitions>WIN32;x64;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <PreprocessorDefinitions>WIN32;x64;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <StringPooling>true</StringPooling>
      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
361
362
363
364
365
366
367
368

369
370
371
372
373
374
375
361
362
363
364
365
366
367

368
369
370
371
372
373
374
375







-
+







    </PostBuildEvent>
  </ItemDefinitionGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|Win32'">
    <ClCompile>
      <Optimization>Full</Optimization>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <StringPooling>true</StringPooling>
      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
399
400
401
402
403
404
405
406

407
408
409
410
411
412
413
399
400
401
402
403
404
405

406
407
408
409
410
411
412
413







-
+







    </PostBuildEvent>
  </ItemDefinitionGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|x64'">
    <ClCompile>
      <Optimization>Full</Optimization>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
      <PreprocessorDefinitions>WIN32;x64;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <PreprocessorDefinitions>WIN32;x64;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_RELEASE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <StringPooling>true</StringPooling>
      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
Changes to SQLite.Interop/props/SQLite.Interop.2005.vsprops.
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
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







-
+




-
+




-
+
-
-
-
-
-







	<UserMacro
		Name="ConfigurationYear"
		Value="2005"
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="INTEROP_BUILD_NUMBER"
		Value="083"
		Value="080"
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="INTEROP_MANIFEST_VERSION"
		Value="1.0.83.0"
		Value="1.0.80.0"
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="INTEROP_RC_VERSION"
		Value="1,0,83,0"
		Value="1,0,80,0"
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="INTEROP_EXTRA_DEFINES"
		Value="INTEROP_EXTENSION_FUNCTIONS=1;INTEROP_CODEC=1"
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="INTEROP_ASSEMBLY_RESOURCES"
		Value="/ASSEMBLYRESOURCE:..\System.Data.SQLite\SQLiteCommand.bmp,System.Data.SQLite.SQLiteCommand.bmp /ASSEMBLYRESOURCE:..\System.Data.SQLite\SQLiteConnection.bmp,System.Data.SQLite.SQLiteConnection.bmp /ASSEMBLYRESOURCE:..\System.Data.SQLite\SQLiteDataAdapter.bmp,System.Data.SQLite.SQLiteDataAdapter.bmp"
		PerformEnvironmentSet="true"
	/>
Changes to SQLite.Interop/props/SQLite.Interop.2008.vsprops.
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
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







-
+




-
+




-
+
-
-
-
-
-







	<UserMacro
		Name="ConfigurationYear"
		Value="2008"
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="INTEROP_BUILD_NUMBER"
		Value="083"
		Value="080"
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="INTEROP_MANIFEST_VERSION"
		Value="1.0.83.0"
		Value="1.0.80.0"
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="INTEROP_RC_VERSION"
		Value="1,0,83,0"
		Value="1,0,80,0"
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="INTEROP_EXTRA_DEFINES"
		Value="INTEROP_EXTENSION_FUNCTIONS=1;INTEROP_CODEC=1"
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="INTEROP_ASSEMBLY_RESOURCES"
		Value="/ASSEMBLYRESOURCE:..\System.Data.SQLite\SQLiteCommand.bmp,System.Data.SQLite.SQLiteCommand.bmp /ASSEMBLYRESOURCE:..\System.Data.SQLite\SQLiteConnection.bmp,System.Data.SQLite.SQLiteConnection.bmp /ASSEMBLYRESOURCE:..\System.Data.SQLite\SQLiteDataAdapter.bmp,System.Data.SQLite.SQLiteDataAdapter.bmp"
		PerformEnvironmentSet="true"
	/>
Changes to SQLite.Interop/props/SQLite.Interop.2010.props.
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
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












-
-
-
+
+
+
-





+
+
+















-
-
-
-







<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.Interop.2010.props -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
  <PropertyGroup Label="UserMacros">
    <ConfigurationYear>2010</ConfigurationYear>
    <INTEROP_BUILD_NUMBER>083</INTEROP_BUILD_NUMBER>
    <INTEROP_MANIFEST_VERSION>1.0.83.0</INTEROP_MANIFEST_VERSION>
    <INTEROP_RC_VERSION>1,0,83,0</INTEROP_RC_VERSION>
    <INTEROP_BUILD_NUMBER>080</INTEROP_BUILD_NUMBER>
    <INTEROP_MANIFEST_VERSION>1.0.80.0</INTEROP_MANIFEST_VERSION>
    <INTEROP_RC_VERSION>1,0,80,0</INTEROP_RC_VERSION>
    <INTEROP_EXTRA_DEFINES>INTEROP_EXTENSION_FUNCTIONS=1;INTEROP_CODEC=1</INTEROP_EXTRA_DEFINES>
    <INTEROP_ASSEMBLY_RESOURCES>/ASSEMBLYRESOURCE:..\System.Data.SQLite\SQLiteCommand.bmp,System.Data.SQLite.SQLiteCommand.bmp /ASSEMBLYRESOURCE:..\System.Data.SQLite\SQLiteConnection.bmp,System.Data.SQLite.SQLiteConnection.bmp /ASSEMBLYRESOURCE:..\System.Data.SQLite\SQLiteDataAdapter.bmp,System.Data.SQLite.SQLiteDataAdapter.bmp</INTEROP_ASSEMBLY_RESOURCES>
    <INTEROP_KEY_FILE>$(ProjectDir)..\System.Data.SQLite\System.Data.SQLite.snk</INTEROP_KEY_FILE>
    <INTEROP_NATIVE_NAME>SQLite.Interop</INTEROP_NATIVE_NAME>
    <INTEROP_MIXED_NAME>System.Data.SQLite</INTEROP_MIXED_NAME>
  </PropertyGroup>
  <PropertyGroup>
    <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
  </PropertyGroup>
  <ItemGroup>
    <BuildMacro Include="ConfigurationYear">
      <Value>$(ConfigurationYear)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_BUILD_NUMBER">
      <Value>$(INTEROP_BUILD_NUMBER)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_MANIFEST_VERSION">
      <Value>$(INTEROP_MANIFEST_VERSION)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_RC_VERSION">
      <Value>$(INTEROP_RC_VERSION)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_EXTRA_DEFINES">
      <Value>$(INTEROP_EXTRA_DEFINES)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_ASSEMBLY_RESOURCES">
      <Value>$(INTEROP_ASSEMBLY_RESOURCES)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_KEY_FILE">
Changes to SQLite.Interop/props/sqlite3.props.
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
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











-
-
-
+
+
+







+
+
+







<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * sqlite3.props -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
  <PropertyGroup Label="UserMacros">
    <SQLITE_MANIFEST_VERSION>3.7.15</SQLITE_MANIFEST_VERSION>
    <SQLITE_RC_VERSION>3,7,15</SQLITE_RC_VERSION>
    <SQLITE_COMMON_DEFINES>SQLITE_THREADSAFE=1;SQLITE_USE_URI=1;SQLITE_ENABLE_COLUMN_METADATA=1;SQLITE_ENABLE_STAT3=1;SQLITE_ENABLE_FTS3=1;SQLITE_ENABLE_LOAD_EXTENSION=1;SQLITE_ENABLE_RTREE=1;SQLITE_SOUNDEX=1</SQLITE_COMMON_DEFINES>
    <SQLITE_MANIFEST_VERSION>3.7.11.0</SQLITE_MANIFEST_VERSION>
    <SQLITE_RC_VERSION>3,7,11,0</SQLITE_RC_VERSION>
    <SQLITE_COMMON_DEFINES>SQLITE_THREADSAFE=1;SQLITE_ENABLE_COLUMN_METADATA=1;SQLITE_ENABLE_STAT3=1;SQLITE_ENABLE_FTS3=1;SQLITE_ENABLE_LOAD_EXTENSION=1;SQLITE_ENABLE_RTREE=1;SQLITE_SOUNDEX=1</SQLITE_COMMON_DEFINES>
    <SQLITE_EXTRA_DEFINES>SQLITE_HAS_CODEC=1</SQLITE_EXTRA_DEFINES>
    <SQLITE_WINCE_DEFINES>SQLITE_OMIT_WAL=1</SQLITE_WINCE_DEFINES>
    <SQLITE_DEBUG_DEFINES>SQLITE_DEBUG=1;SQLITE_MEMDEBUG=1</SQLITE_DEBUG_DEFINES>
    <SQLITE_RELEASE_DEFINES>SQLITE_WIN32_MALLOC=1</SQLITE_RELEASE_DEFINES>
    <SQLITE_DISABLE_WARNINGS>4018;4055;4057;4090;4100;4127;4132;4146;4152;4210;4232;4244;4245;4389;4701;4706;4996</SQLITE_DISABLE_WARNINGS>
    <SQLITE_DISABLE_X64_WARNINGS>4232;4267;4306</SQLITE_DISABLE_X64_WARNINGS>
  </PropertyGroup>
  <PropertyGroup>
    <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
  </PropertyGroup>
  <ItemGroup>
    <BuildMacro Include="SQLITE_MANIFEST_VERSION">
      <Value>$(SQLITE_MANIFEST_VERSION)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="SQLITE_RC_VERSION">
      <Value>$(SQLITE_RC_VERSION)</Value>
Changes to SQLite.Interop/props/sqlite3.vsprops.
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
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







-
+




-
+




-
+







<VisualStudioPropertySheet
	ProjectType="Visual C++"
	Version="8.00"
	Name="sqlite3"
	>
	<UserMacro
		Name="SQLITE_MANIFEST_VERSION"
		Value="3.7.15"
		Value="3.7.11.0"
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="SQLITE_RC_VERSION"
		Value="3,7,15"
		Value="3,7,11,0"
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="SQLITE_COMMON_DEFINES"
		Value="SQLITE_THREADSAFE=1;SQLITE_USE_URI=1;SQLITE_ENABLE_COLUMN_METADATA=1;SQLITE_ENABLE_STAT3=1;SQLITE_ENABLE_FTS3=1;SQLITE_ENABLE_LOAD_EXTENSION=1;SQLITE_ENABLE_RTREE=1;SQLITE_SOUNDEX=1"
		Value="SQLITE_THREADSAFE=1;SQLITE_ENABLE_COLUMN_METADATA=1;SQLITE_ENABLE_STAT3=1;SQLITE_ENABLE_FTS3=1;SQLITE_ENABLE_LOAD_EXTENSION=1;SQLITE_ENABLE_RTREE=1;SQLITE_SOUNDEX=1"
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="SQLITE_EXTRA_DEFINES"
		Value="SQLITE_HAS_CODEC=1"
		PerformEnvironmentSet="true"
	/>
Changes to SQLite.Interop/src/core/sqlite3.c.

more than 10,000 changes

Changes to SQLite.Interop/src/core/sqlite3.h.
103
104
105
106
107
108
109
110
111
112



113
114
115
116
117
118
119
103
104
105
106
107
108
109



110
111
112
113
114
115
116
117
118
119







-
-
-
+
+
+







** string contains the date and time of the check-in (UTC) and an SHA1
** hash of the entire source tree.
**
** See also: [sqlite3_libversion()],
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
** [sqlite_version()] and [sqlite_source_id()].
*/
#define SQLITE_VERSION        "3.7.15"
#define SQLITE_VERSION_NUMBER 3007015
#define SQLITE_SOURCE_ID      "2012-09-12 00:11:20 9402f81fade5fcae0a3a6efdc7a5cdf71fc2e79f"
#define SQLITE_VERSION        "3.7.11"
#define SQLITE_VERSION_NUMBER 3007011
#define SQLITE_SOURCE_ID      "2012-03-19 17:42:46 036395c0a8e08883b11df025e3da9e2461e4b1eb"

/*
** CAPI3REF: Run-Time Library Version Numbers
** KEYWORDS: sqlite3_version, sqlite3_sourceid
**
** These interfaces provide the same information as the [SQLITE_VERSION],
** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros
215
216
217
218
219
220
221
222

223
224
225
226
227
228
229
230
215
216
217
218
219
220
221

222

223
224
225
226
227
228
229







-
+
-







** CAPI3REF: Database Connection Handle
** KEYWORDS: {database connection} {database connections}
**
** Each open SQLite database is represented by a pointer to an instance of
** the opaque structure named "sqlite3".  It is useful to think of an sqlite3
** pointer as an object.  The [sqlite3_open()], [sqlite3_open16()], and
** [sqlite3_open_v2()] interfaces are its constructors, and [sqlite3_close()]
** and [sqlite3_close_v2()] are its destructors.  There are many other
** is its destructor.  There are many other interfaces (such as
** interfaces (such as
** [sqlite3_prepare_v2()], [sqlite3_create_function()], and
** [sqlite3_busy_timeout()] to name but three) that are methods on an
** sqlite3 object.
*/
typedef struct sqlite3 sqlite3;

/*
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
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







-
-
-
-
+
+
+
-

-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
+

-
-
+
+
-
-

-
+


-
+
-



-
-
+
+

-
+
-







#ifdef SQLITE_OMIT_FLOATING_POINT
# define double sqlite3_int64
#endif

/*
** CAPI3REF: Closing A Database Connection
**
** ^The sqlite3_close() and sqlite3_close_v2() routines are destructors
** for the [sqlite3] object.
** ^Calls to sqlite3_close() and sqlite3_close_v2() return SQLITE_OK if
** the [sqlite3] object is successfully destroyed and all associated
** ^The sqlite3_close() routine is the destructor for the [sqlite3] object.
** ^Calls to sqlite3_close() return SQLITE_OK if the [sqlite3] object is
** successfully destroyed and all associated resources are deallocated.
** resources are deallocated.
**
** ^If the database connection is associated with unfinalized prepared
** statements or unfinished sqlite3_backup objects then sqlite3_close()
** will leave the database connection open and return [SQLITE_BUSY].
** ^If sqlite3_close_v2() is called with unfinalized prepared statements
** and unfinished sqlite3_backups, then the database connection becomes
** an unusable "zombie" which will automatically be deallocated when the
** last prepared statement is finalized or the last sqlite3_backup is
** finished.  The sqlite3_close_v2() interface is intended for use with
** host languages that are garbage collected, and where the order in which
** destructors are called is arbitrary.
**
** Applications should [sqlite3_finalize | finalize] all [prepared statements],
** [sqlite3_blob_close | close] all [BLOB handles], and 
** Applications must [sqlite3_finalize | finalize] all [prepared statements]
** and [sqlite3_blob_close | close] all [BLOB handles] associated with
** [sqlite3_backup_finish | finish] all [sqlite3_backup] objects associated
** with the [sqlite3] object prior to attempting to close the object.  ^If
** the [sqlite3] object prior to attempting to close the object.  ^If
** sqlite3_close() is called on a [database connection] that still has
** outstanding [prepared statements], [BLOB handles], and/or
** [sqlite3_backup] objects then it returns SQLITE_OK but the deallocation
** outstanding [prepared statements] or [BLOB handles], then it returns
** SQLITE_BUSY.
** of resources is deferred until all [prepared statements], [BLOB handles],
** and [sqlite3_backup] objects are also destroyed.
**
** ^If an [sqlite3] object is destroyed while a transaction is open,
** ^If [sqlite3_close()] is invoked while a transaction is open,
** the transaction is automatically rolled back.
**
** The C parameter to [sqlite3_close(C)] and [sqlite3_close_v2(C)]
** The C parameter to [sqlite3_close(C)] must be either a NULL
** must be either a NULL
** pointer or an [sqlite3] object pointer obtained
** from [sqlite3_open()], [sqlite3_open16()], or
** [sqlite3_open_v2()], and not previously closed.
** ^Calling sqlite3_close() or sqlite3_close_v2() with a NULL pointer
** argument is a harmless no-op.
** ^Calling sqlite3_close() with a NULL pointer argument is a 
** harmless no-op.
*/
SQLITE_API int sqlite3_close(sqlite3*);
SQLITE_API int sqlite3_close(sqlite3 *);
SQLITE_API int sqlite3_close_v2(sqlite3*);

/*
** The type for a callback function.
** This is legacy and deprecated.  It is included for historical
** compatibility and is not documented.
*/
typedef int (*sqlite3_callback)(void*,int,char**, char**);
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
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







-



















-



















-
+







#define SQLITE_IOERR_SHMSIZE           (SQLITE_IOERR | (19<<8))
#define SQLITE_IOERR_SHMLOCK           (SQLITE_IOERR | (20<<8))
#define SQLITE_IOERR_SHMMAP            (SQLITE_IOERR | (21<<8))
#define SQLITE_IOERR_SEEK              (SQLITE_IOERR | (22<<8))
#define SQLITE_LOCKED_SHAREDCACHE      (SQLITE_LOCKED |  (1<<8))
#define SQLITE_BUSY_RECOVERY           (SQLITE_BUSY   |  (1<<8))
#define SQLITE_CANTOPEN_NOTEMPDIR      (SQLITE_CANTOPEN | (1<<8))
#define SQLITE_CANTOPEN_ISDIR          (SQLITE_CANTOPEN | (2<<8))
#define SQLITE_CORRUPT_VTAB            (SQLITE_CORRUPT | (1<<8))
#define SQLITE_READONLY_RECOVERY       (SQLITE_READONLY | (1<<8))
#define SQLITE_READONLY_CANTLOCK       (SQLITE_READONLY | (2<<8))
#define SQLITE_ABORT_ROLLBACK          (SQLITE_ABORT | (2<<8))

/*
** CAPI3REF: Flags For File Open Operations
**
** These bit values are intended for use in the
** 3rd parameter to the [sqlite3_open_v2()] interface and
** in the 4th parameter to the [sqlite3_vfs.xOpen] method.
*/
#define SQLITE_OPEN_READONLY         0x00000001  /* Ok for sqlite3_open_v2() */
#define SQLITE_OPEN_READWRITE        0x00000002  /* Ok for sqlite3_open_v2() */
#define SQLITE_OPEN_CREATE           0x00000004  /* Ok for sqlite3_open_v2() */
#define SQLITE_OPEN_DELETEONCLOSE    0x00000008  /* VFS only */
#define SQLITE_OPEN_EXCLUSIVE        0x00000010  /* VFS only */
#define SQLITE_OPEN_AUTOPROXY        0x00000020  /* VFS only */
#define SQLITE_OPEN_URI              0x00000040  /* Ok for sqlite3_open_v2() */
#define SQLITE_OPEN_MEMORY           0x00000080  /* Ok for sqlite3_open_v2() */
#define SQLITE_OPEN_MAIN_DB          0x00000100  /* VFS only */
#define SQLITE_OPEN_TEMP_DB          0x00000200  /* VFS only */
#define SQLITE_OPEN_TRANSIENT_DB     0x00000400  /* VFS only */
#define SQLITE_OPEN_MAIN_JOURNAL     0x00000800  /* VFS only */
#define SQLITE_OPEN_TEMP_JOURNAL     0x00001000  /* VFS only */
#define SQLITE_OPEN_SUBJOURNAL       0x00002000  /* VFS only */
#define SQLITE_OPEN_MASTER_JOURNAL   0x00004000  /* VFS only */
#define SQLITE_OPEN_NOMUTEX          0x00008000  /* Ok for sqlite3_open_v2() */
#define SQLITE_OPEN_FULLMUTEX        0x00010000  /* Ok for sqlite3_open_v2() */
#define SQLITE_OPEN_SHAREDCACHE      0x00020000  /* Ok for sqlite3_open_v2() */
#define SQLITE_OPEN_PRIVATECACHE     0x00040000  /* Ok for sqlite3_open_v2() */
#define SQLITE_OPEN_WAL              0x00080000  /* VFS only */

/* Reserved:                         0x00F00000 */

/*
** CAPI3REF: Device Characteristics
**
** The xDeviceCharacteristics method of the [sqlite3_io_methods]
** object returns an integer which is a vector of these
** object returns an integer which is a vector of the these
** bit values expressing I/O characteristics of the mass storage
** device that holds the file that the [sqlite3_io_methods]
** refers to.
**
** The SQLITE_IOCAP_ATOMIC property means that all writes of
** any size are atomic.  The SQLITE_IOCAP_ATOMICnnn values
** mean that writes of blocks that are nnn bytes in size and
788
789
790
791
792
793
794
795

796
797
798
799
800
801
802
767
768
769
770
771
772
773

774
775
776
777
778
779
780
781







-
+







** integer is the delay.  If either integer is negative, then the setting
** is not changed but instead the prior value of that setting is written
** into the array entry, allowing the current retry settings to be
** interrogated.  The zDbName parameter is ignored.
**
** <li>[[SQLITE_FCNTL_PERSIST_WAL]]
** ^The [SQLITE_FCNTL_PERSIST_WAL] opcode is used to set or query the
** persistent [WAL | Write Ahead Log] setting.  By default, the auxiliary
** persistent [WAL | Write AHead Log] setting.  By default, the auxiliary
** write ahead log and shared memory files used for transaction control
** are automatically deleted when the latest connection to the database
** closes.  Setting persistent WAL mode causes those files to persist after
** close.  Persisting the files is useful when other processes that do not
** have write permission on the directory containing the database file want
** to read the database file, as the WAL and shared memory files must exist
** in order for the database to be readable.  The fourth parameter to
1564
1565
1566
1567
1568
1569
1570
1571

1572
1573
1574
1575
1576
1577
1578
1543
1544
1545
1546
1547
1548
1549

1550
1551
1552
1553
1554
1555
1556
1557







-
+







** connection is opened. If it is globally disabled, filenames are
** only interpreted as URIs if the SQLITE_OPEN_URI flag is set when the
** database connection is opened. By default, URI handling is globally
** disabled. The default value may be changed by compiling with the
** [SQLITE_USE_URI] symbol defined.
**
** [[SQLITE_CONFIG_PCACHE]] [[SQLITE_CONFIG_GETPCACHE]]
** <dt>SQLITE_CONFIG_PCACHE and SQLITE_CONFIG_GETPCACHE
** <dt>SQLITE_CONFIG_PCACHE and SQLITE_CONFNIG_GETPCACHE
** <dd> These options are obsolete and should not be used by new code.
** They are retained for backwards compatibility but are now no-ops.
** </dl>
*/
#define SQLITE_CONFIG_SINGLETHREAD  1  /* nil */
#define SQLITE_CONFIG_MULTITHREAD   2  /* nil */
#define SQLITE_CONFIG_SERIALIZED    3  /* nil */
2185
2186
2187
2188
2189
2190
2191
2192

2193
2194
2195
2196
2197


2198
2199
2200
2201
2202
2203
2204
2164
2165
2166
2167
2168
2169
2170

2171
2172
2173
2174


2175
2176
2177
2178
2179
2180
2181
2182
2183







-
+



-
-
+
+







** option is used.
**
** In SQLite version 3.5.0 and 3.5.1, it was possible to define
** the SQLITE_OMIT_MEMORY_ALLOCATION which would cause the built-in
** implementation of these routines to be omitted.  That capability
** is no longer provided.  Only built-in memory allocators can be used.
**
** Prior to SQLite version 3.7.10, the Windows OS interface layer called
** The Windows OS interface layer calls
** the system malloc() and free() directly when converting
** filenames between the UTF-8 encoding used by SQLite
** and whatever filename encoding is used by the particular Windows
** installation.  Memory allocation errors were detected, but
** they were reported back as [SQLITE_CANTOPEN] or
** installation.  Memory allocation errors are detected, but
** they are reported back as [SQLITE_CANTOPEN] or
** [SQLITE_IOERR] rather than [SQLITE_NOMEM].
**
** The pointer arguments to [sqlite3_free()] and [sqlite3_realloc()]
** must be either NULL or else pointers obtained from a prior
** invocation of [sqlite3_malloc()] or [sqlite3_realloc()] that have
** not yet been released.
**
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
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







-
-
+
+
-


-
+



-
+
-
-
-
-
+
+
+







**     a VFS object that provides the operating system interface that should
**     be used to access the database file on disk. ^If this option is set to
**     an empty string the default VFS object is used. ^Specifying an unknown
**     VFS is an error. ^If sqlite3_open_v2() is used and the vfs option is
**     present, then the VFS specified by the option takes precedence over
**     the value passed as the fourth parameter to sqlite3_open_v2().
**
**   <li> <b>mode</b>: ^(The mode parameter may be set to either "ro", "rw",
**     "rwc", or "memory". Attempting to set it to any other value is
**   <li> <b>mode</b>: ^(The mode parameter may be set to either "ro", "rw" or
**     "rwc". Attempting to set it to any other value is an error)^. 
**     an error)^. 
**     ^If "ro" is specified, then the database is opened for read-only 
**     access, just as if the [SQLITE_OPEN_READONLY] flag had been set in the 
**     third argument to sqlite3_open_v2(). ^If the mode option is set to 
**     third argument to sqlite3_prepare_v2(). ^If the mode option is set to 
**     "rw", then the database is opened for read-write (but not create) 
**     access, as if SQLITE_OPEN_READWRITE (but not SQLITE_OPEN_CREATE) had 
**     been set. ^Value "rwc" is equivalent to setting both 
**     SQLITE_OPEN_READWRITE and SQLITE_OPEN_CREATE.  ^If the mode option is
**     SQLITE_OPEN_READWRITE and SQLITE_OPEN_CREATE. ^If sqlite3_open_v2() is 
**     set to "memory" then a pure [in-memory database] that never reads
**     or writes from disk is used. ^It is an error to specify a value for
**     the mode parameter that is less restrictive than that specified by
**     the flags passed in the third parameter to sqlite3_open_v2().
**     used, it is an error to specify a value for the mode parameter that is 
**     less restrictive than that specified by the flags passed as the third 
**     parameter.
**
**   <li> <b>cache</b>: ^The cache parameter may be set to either "shared" or
**     "private". ^Setting it to "shared" is equivalent to setting the
**     SQLITE_OPEN_SHAREDCACHE bit in the flags argument passed to
**     sqlite3_open_v2(). ^Setting the cache parameter to "private" is 
**     equivalent to setting the SQLITE_OPEN_PRIVATECACHE bit.
**     ^If sqlite3_open_v2() is used and the "cache" parameter is present in
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2640
2641
2642
2643
2644
2645
2646






2647
2648
2649
2650
2651
2652
2653







-
-
-
-
-
-







** the results are undefined.
**
** <b>Note to Windows users:</b>  The encoding used for the filename argument
** of sqlite3_open() and sqlite3_open_v2() must be UTF-8, not whatever
** codepage is currently defined.  Filenames containing international
** characters must be converted to UTF-8 prior to passing them into
** sqlite3_open() or sqlite3_open_v2().
**
** <b>Note to Windows Runtime users:</b>  The temporary directory must be set
** prior to calling sqlite3_open() or sqlite3_open_v2().  Otherwise, various
** features that require the use of temporary files may fail.
**
** See also: [sqlite3_temp_directory]
*/
SQLITE_API int sqlite3_open(
  const char *filename,   /* Database filename (UTF-8) */
  sqlite3 **ppDb          /* OUT: SQLite db handle */
);
SQLITE_API int sqlite3_open16(
  const void *filename,   /* Database filename (UTF-16) */
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
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







-
-
-
-
-


















-







** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language
** text that describes the error, as either UTF-8 or UTF-16 respectively.
** ^(Memory to hold the error message string is managed internally.
** The application does not need to worry about freeing the result.
** However, the error string might be overwritten or deallocated by
** subsequent calls to other SQLite interface functions.)^
**
** ^The sqlite3_errstr() interface returns the English-language text
** that describes the [result code], as UTF-8.
** ^(Memory to hold the error message string is managed internally
** and must not be freed by the application)^.
**
** When the serialized [threading mode] is in use, it might be the
** case that a second error occurs on a separate thread in between
** the time of the first error and the call to these interfaces.
** When that happens, the second error will be reported since these
** interfaces always report the most recent result.  To avoid
** this, each thread can obtain exclusive use of the [database connection] D
** by invoking [sqlite3_mutex_enter]([sqlite3_db_mutex](D)) before beginning
** to use D and invoking [sqlite3_mutex_leave]([sqlite3_db_mutex](D)) after
** all calls to the interfaces listed here are completed.
**
** If an interface fails with SQLITE_MISUSE, that means the interface
** was invoked incorrectly by the application.  In that case, the
** error code and message may or may not be set.
*/
SQLITE_API int sqlite3_errcode(sqlite3 *db);
SQLITE_API int sqlite3_extended_errcode(sqlite3 *db);
SQLITE_API const char *sqlite3_errmsg(sqlite3*);
SQLITE_API const void *sqlite3_errmsg16(sqlite3*);
SQLITE_API const char *sqlite3_errstr(int);

/*
** CAPI3REF: SQL Statement Object
** KEYWORDS: {prepared statement} {prepared statements}
**
** An instance of this object represents a single SQL statement.
** This object is variously known as a "prepared statement" or a
3167
3168
3169
3170
3171
3172
3173
3174

3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3132
3133
3134
3135
3136
3137
3138

3139

3140


3141
3142
3143
3144
3145
3146
3147







-
+
-

-
-







** parameter [SQLITE_LIMIT_VARIABLE_NUMBER] (default value: 999).
**
** ^The third argument is the value to bind to the parameter.
**
** ^(In those routines that have a fourth argument, its value is the
** number of bytes in the parameter.  To be clear: the value is the
** number of <u>bytes</u> in the value, not the number of characters.)^
** ^If the fourth parameter to sqlite3_bind_text() or sqlite3_bind_text16()
** ^If the fourth parameter is negative, the length of the string is
** is negative, then the length of the string is
** the number of bytes up to the first zero terminator.
** If the fourth parameter to sqlite3_bind_blob() is negative, then
** the behavior is undefined.
** If a non-negative fourth parameter is provided to sqlite3_bind_text()
** or sqlite3_bind_text16() then that parameter must be the byte offset
** where the NUL terminator would occur assuming the string were NUL
** terminated.  If any NUL characters occur at byte offsets less than 
** the value of the fourth parameter then the resulting string value will
** contain embedded NULs.  The result of expressions involving strings
** with embedded NULs is undefined.
4168
4169
4170
4171
4172
4173
4174
4175
4176


4177
4178
4179


4180
4181
4182
4183
4184
4185
4186
4130
4131
4132
4133
4134
4135
4136


4137
4138
4139


4140
4141
4142
4143
4144
4145
4146
4147
4148







-
-
+
+

-
-
+
+







** they return.  Hence, the calling function can deallocate or
** modify the text after they return without harm.
** ^The sqlite3_result_error_code() function changes the error code
** returned by SQLite as a result of an error in a function.  ^By default,
** the error code is SQLITE_ERROR.  ^A subsequent call to sqlite3_result_error()
** or sqlite3_result_error16() resets the error code to SQLITE_ERROR.
**
** ^The sqlite3_result_error_toobig() interface causes SQLite to throw an
** error indicating that a string or BLOB is too long to represent.
** ^The sqlite3_result_toobig() interface causes SQLite to throw an error
** indicating that a string or BLOB is too long to represent.
**
** ^The sqlite3_result_error_nomem() interface causes SQLite to throw an
** error indicating that a memory allocation failed.
** ^The sqlite3_result_nomem() interface causes SQLite to throw an error
** indicating that a memory allocation failed.
**
** ^The sqlite3_result_int() interface sets the return value
** of the application-defined function to be the 32-bit signed integer
** value given in the 2nd argument.
** ^The sqlite3_result_int64() interface sets the return value
** of the application-defined function to be the 64-bit signed integer
** value given in the 2nd argument.
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4441
4442
4443
4444
4445
4446
4447















4448
4449
4450





































4451
4452
4453
4454
4455
4456
4457







-
-
-
-
-
-
-
-
-
-
-
-
-
-
-



-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-







** the [temp_store_directory pragma] always assumes that any string
** that this variable points to is held in memory obtained from 
** [sqlite3_malloc] and the pragma may attempt to free that memory
** using [sqlite3_free].
** Hence, if this variable is modified directly, either it should be
** made NULL or made to point to memory obtained from [sqlite3_malloc]
** or else the use of the [temp_store_directory pragma] should be avoided.
**
** <b>Note to Windows Runtime users:</b>  The temporary directory must be set
** prior to calling [sqlite3_open] or [sqlite3_open_v2].  Otherwise, various
** features that require the use of temporary files may fail.  Here is an
** example of how to do this using C++ with the Windows Runtime:
**
** <blockquote><pre>
** LPCWSTR zPath = Windows::Storage::ApplicationData::Current->
** &nbsp;     TemporaryFolder->Path->Data();
** char zPathBuf&#91;MAX_PATH + 1&#93;;
** memset(zPathBuf, 0, sizeof(zPathBuf));
** WideCharToMultiByte(CP_UTF8, 0, zPath, -1, zPathBuf, sizeof(zPathBuf),
** &nbsp;     NULL, NULL);
** sqlite3_temp_directory = sqlite3_mprintf("%s", zPathBuf);
** </pre></blockquote>
*/
SQLITE_API SQLITE_EXTERN char *sqlite3_temp_directory;

/*
** CAPI3REF: Name Of The Folder Holding Database Files
**
** ^(If this global variable is made to point to a string which is
** the name of a folder (a.k.a. directory), then all database files
** specified with a relative pathname and created or accessed by
** SQLite when using a built-in windows [sqlite3_vfs | VFS] will be assumed
** to be relative to that directory.)^ ^If this variable is a NULL
** pointer, then SQLite assumes that all database files specified
** with a relative pathname are relative to the current directory
** for the process.  Only the windows VFS makes use of this global
** variable; it is ignored by the unix VFS.
**
** Changing the value of this variable while a database connection is
** open can result in a corrupt database.
**
** It is not safe to read or modify this variable in more than one
** thread at a time.  It is not safe to read or modify this variable
** if a [database connection] is being used at the same time in a separate
** thread.
** It is intended that this variable be set once
** as part of process initialization and before any SQLite interface
** routines have been called and that this variable remain unchanged
** thereafter.
**
** ^The [data_store_directory pragma] may modify this variable and cause
** it to point to memory obtained from [sqlite3_malloc].  ^Furthermore,
** the [data_store_directory pragma] always assumes that any string
** that this variable points to is held in memory obtained from 
** [sqlite3_malloc] and the pragma may attempt to free that memory
** using [sqlite3_free].
** Hence, if this variable is modified directly, either it should be
** made NULL or made to point to memory obtained from [sqlite3_malloc]
** or else the use of the [data_store_directory pragma] should be avoided.
*/
SQLITE_API SQLITE_EXTERN char *sqlite3_data_directory;

/*
** CAPI3REF: Test For Auto-Commit Mode
** KEYWORDS: {autocommit mode}
**
** ^The sqlite3_get_autocommit() interface returns non-zero or
** zero if the given database connection is or is not in autocommit mode,
** respectively.  ^Autocommit mode is on by default.
4712
4713
4714
4715
4716
4717
4718

4719
4720
4721
4722
4723
4724
4725
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636







+







  sqlite3*, 
  void(*)(void *,int ,char const *,char const *,sqlite3_int64),
  void*
);

/*
** CAPI3REF: Enable Or Disable Shared Pager Cache
** KEYWORDS: {shared cache}
**
** ^(This routine enables or disables the sharing of the database cache
** and schema data structures between [database connection | connections]
** to the same database. Sharing is enabled if the argument is true
** and disabled if the argument is false.)^
**
** ^Cache sharing is enabled and disabled for an entire process.
5539
5540
5541
5542
5543
5544
5545

5546
5547
5548
5549
5550
5551
5552
5553
5554
5555



5556
5557
5558
5559
5560
5561
5562
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464



5465
5466
5467
5468
5469
5470
5471
5472
5473
5474







+







-
-
-
+
+
+







**
** The SQLite source code contains multiple implementations
** of these mutex routines.  An appropriate implementation
** is selected automatically at compile-time.  ^(The following
** implementations are available in the SQLite core:
**
** <ul>
** <li>   SQLITE_MUTEX_OS2
** <li>   SQLITE_MUTEX_PTHREADS
** <li>   SQLITE_MUTEX_W32
** <li>   SQLITE_MUTEX_NOOP
** </ul>)^
**
** ^The SQLITE_MUTEX_NOOP implementation is a set of routines
** that does no real locking and is appropriate for use in
** a single-threaded application.  ^The SQLITE_MUTEX_PTHREADS and
** SQLITE_MUTEX_W32 implementations are appropriate for use on Unix
** and Windows.
** a single-threaded application.  ^The SQLITE_MUTEX_OS2,
** SQLITE_MUTEX_PTHREADS, and SQLITE_MUTEX_W32 implementations
** are appropriate for use on OS/2, Unix, and Windows.
**
** ^(If SQLite is compiled with the SQLITE_MUTEX_APPDEF preprocessor
** macro defined (with "-DSQLITE_MUTEX_APPDEF=1"), then no mutex
** implementation is included with the library. In this case the
** application must supply a custom mutex implementation using the
** [SQLITE_CONFIG_MUTEX] option of the sqlite3_config() function
** before calling sqlite3_initialize() or any other public sqlite3_
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120

6121
6122
6123
6124
6125
6126
6127
6002
6003
6004
6005
6006
6007
6008











6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019


6020
6021
6022
6023
6024
6025
6026
6027







-
-
-
-
-
-
-
-
-
-
-











-
-
+







** </dd>
**
** [[SQLITE_DBSTATUS_CACHE_MISS]] ^(<dt>SQLITE_DBSTATUS_CACHE_MISS</dt>
** <dd>This parameter returns the number of pager cache misses that have
** occurred.)^ ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_MISS 
** is always 0.
** </dd>
**
** [[SQLITE_DBSTATUS_CACHE_WRITE]] ^(<dt>SQLITE_DBSTATUS_CACHE_WRITE</dt>
** <dd>This parameter returns the number of dirty cache entries that have
** been written to disk. Specifically, the number of pages written to the
** wal file in wal mode databases, or the number of pages written to the
** database file in rollback mode databases. Any pages written as part of
** transaction rollback or database recovery operations are not included.
** If an IO or other error occurs while writing a page to disk, the effect
** on subsequent SQLITE_DBSTATUS_CACHE_WRITE requests is undefined.)^ ^The
** highwater mark associated with SQLITE_DBSTATUS_CACHE_WRITE is always 0.
** </dd>
** </dl>
*/
#define SQLITE_DBSTATUS_LOOKASIDE_USED       0
#define SQLITE_DBSTATUS_CACHE_USED           1
#define SQLITE_DBSTATUS_SCHEMA_USED          2
#define SQLITE_DBSTATUS_STMT_USED            3
#define SQLITE_DBSTATUS_LOOKASIDE_HIT        4
#define SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE  5
#define SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL  6
#define SQLITE_DBSTATUS_CACHE_HIT            7
#define SQLITE_DBSTATUS_CACHE_MISS           8
#define SQLITE_DBSTATUS_CACHE_WRITE          9
#define SQLITE_DBSTATUS_MAX                  9   /* Largest defined DBSTATUS */
#define SQLITE_DBSTATUS_MAX                  8   /* Largest defined DBSTATUS */


/*
** CAPI3REF: Prepared Statement Status
**
** ^(Each prepared statement maintains various
** [SQLITE_STMTSTATUS counters] that measure the number
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079

7080
7081
7082
7083
7084
7085
7086
7087
6969
6970
6971
6972
6973
6974
6975




6976

6977
6978
6979
6980
6981
6982
6983







-
-
-
-
+
-







** R-Tree geometry query as follows:
**
**   SELECT ... FROM <rtree> WHERE <rtree col> MATCH $zGeom(... params ...)
*/
SQLITE_API int sqlite3_rtree_geometry_callback(
  sqlite3 *db,
  const char *zGeom,
#ifdef SQLITE_RTREE_INT_ONLY
  int (*xGeom)(sqlite3_rtree_geometry*, int n, sqlite3_int64 *a, int *pRes),
#else
  int (*xGeom)(sqlite3_rtree_geometry*, int n, double *a, int *pRes),
  int (*xGeom)(sqlite3_rtree_geometry *, int nCoord, double *aCoord, int *pRes),
#endif
  void *pContext
);


/*
** A pointer to a structure of the following type is passed as the first
** argument to callbacks registered using rtree_geometry_callback().
Changes to SQLite.Interop/src/win/interop.c.
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
1
2


3




4

5
6
7
8
9
10
11
12
13
14
15

16
17
18
19
20
21
22


-
-

-
-
-
-

-
+
+









-







#define SQLITE_API __declspec(dllexport)
#include "../core/sqlite3.c"

#if defined(INTEROP_EXTENSION_FUNCTIONS)
#include "../contrib/extension-functions.c"
extern int RegisterExtensionFunctions(sqlite3 *db);
#endif

#if defined(INTEROP_CODEC)
#include "crypt.c"
#endif

extern int RegisterExtensionFunctions(sqlite3 *db);

#ifdef SQLITE_OS_WIN

// Additional open flags, we use this one privately
//#define SQLITE_OPEN_SHAREDCACHE      0x01000000

typedef void (*SQLITEUSERFUNC)(sqlite3_context *, int, sqlite3_value **);
typedef void (*SQLITEFUNCFINAL)(sqlite3_context *);

#if SQLITE_VERSION_NUMBER < 3007014
SQLITE_PRIVATE void * sqlite3DbMallocZero_interop(sqlite3 *db, int n)
{
  void *p;
  if (db) {
    sqlite3_mutex_enter(db->mutex);
  }
  p = sqlite3DbMallocZero(db,n);
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
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







-
















-
-
-
-
+
+
+

-
+

-
-
-
-
-
-
-
-







    sqlite3MemdebugSetType(p, MEMTYPE_DB|MEMTYPE_HEAP);
  }
  sqlite3DbFree(db,p);
  if (db) {
    sqlite3_mutex_leave(db->mutex);
  }
}
#endif

/*
    The goal of this version of close is different than that of sqlite3_close(), and is designed to lend itself better to .NET's non-deterministic finalizers and
    the GC thread.  SQLite will not close a database if statements are open on it -- but for our purposes, we'd rather finalize all active statements
    and forcibly close the database.  The reason is simple -- a lot of people don't Dispose() of their objects correctly and let the garbage collector
    do it.  This leads to unexpected behavior when a user thinks they've closed a database, but it's still open because not all the statements have
    hit the GC yet.

    So, here we have a problem ... .NET has a pointer to any number of sqlite3_stmt objects.  We can't call sqlite3_finalize() on these because
    their memory is freed and can be used for something else.  The GC thread could potentially try and call finalize again on the statement after
    that memory was deallocated.  BAD.  So, what we need to do is make a copy of each statement, and call finalize() on the copy -- so that the original
    statement's memory is preserved, and marked as BAD, but we can still manage to finalize everything and forcibly close the database.  Later when the 
    GC gets around to calling finalize_interop() on the "bad" statement, we detect that and finish deallocating the pointer.
*/
SQLITE_API int WINAPI sqlite3_close_interop(sqlite3 *db)
{
#if SQLITE_VERSION_NUMBER >= 3007014
  return sqlite3_close_v2(db);
#else
  int ret = sqlite3_close(db);
  int ret;
  
  ret = sqlite3_close(db);

  if (ret == SQLITE_BUSY)
  if (ret == SQLITE_BUSY && db->pVdbe)
  {
    sqlite3_mutex_enter(db->mutex);

    if (!db->pVdbe)
    {
      sqlite3_mutex_leave(db->mutex);
      return ret;
    }

    while (db->pVdbe)
    {
      // Make a copy of the first prepared statement
      Vdbe *p = (Vdbe *)sqlite3DbMallocZero_interop(db, sizeof(Vdbe));
      Vdbe *po = db->pVdbe;

      if (!p) 
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
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







-


+

-












-


-







      }
      else
      {
        ZeroMemory(po, sizeof(Vdbe));
        po->magic = VDBE_MAGIC_DEAD;
      }
    }
    sqlite3_mutex_leave(db->mutex);
    ret = sqlite3_close(db);
  }

  return ret;
#endif
}

SQLITE_API int WINAPI sqlite3_open_interop(const char*filename, int flags, sqlite3 **ppdb)
{
  int ret;
  //int sharedcache = ((flags & SQLITE_OPEN_SHAREDCACHE) != 0);
  //flags &= ~SQLITE_OPEN_SHAREDCACHE;

  //sqlite3_enable_shared_cache(sharedcache);
  ret = sqlite3_open_v2(filename, ppdb, flags, NULL);
  //sqlite3_enable_shared_cache(0);

#if defined(INTEROP_EXTENSION_FUNCTIONS)
  if (ret == 0)
    RegisterExtensionFunctions(*ppdb);
#endif

  return ret;
}

SQLITE_API int WINAPI sqlite3_open16_interop(const char *filename, int flags, sqlite3 **ppdb)
{
  int ret = sqlite3_open_interop(filename, flags, ppdb);
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
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







-
-
-

+
-
+


-
+

-
+
-
-
+
-
-
+
-
-

+

+
-
+
-
-
-
+
+
-
-
-
-
-

-




-
-
-





-







  const void *pval = sqlite3_column_text16(stmt, iCol);
  *plen = (pval != 0) ? wcslen((wchar_t *)pval) * sizeof(wchar_t): 0;
  return pval;
}

SQLITE_API int WINAPI sqlite3_finalize_interop(sqlite3_stmt *stmt)
{
#if SQLITE_VERSION_NUMBER >= 3007014
  return sqlite3_finalize(stmt);
#else
  Vdbe *p;
  sqlite3 *db;
  int ret = SQLITE_OK;
  int ret;

  p = (Vdbe *)stmt;
  if (p)
  if (p && p->magic == VDBE_MAGIC_DEAD)
  {
    sqlite3 *db = p->db;
    db = p->db;

    if (db != NULL)
    if (db == NULL)
      sqlite3_mutex_enter(db->mutex);

    {
    if ((p->magic == VDBE_MAGIC_DEAD) && (db == NULL))
    {
      sqlite3DbFree_interop(db, p);
      ret = SQLITE_OK;
    }
  }
    else
  else
    {
      ret = sqlite3_finalize(stmt);
    }
    ret = sqlite3_finalize(stmt);


    if (db != NULL)
      sqlite3_mutex_leave(db->mutex);
  }

  return ret;
#endif
}

SQLITE_API int WINAPI sqlite3_reset_interop(sqlite3_stmt *stmt)
{
#if SQLITE_VERSION_NUMBER >= 3007014
  return sqlite3_reset(stmt);
#else
  int ret;

  if (((Vdbe *)stmt)->magic == VDBE_MAGIC_DEAD) return SQLITE_SCHEMA;
  ret = sqlite3_reset(stmt);
  return ret;
#endif
}

SQLITE_API int WINAPI sqlite3_create_function_interop(sqlite3 *psql, const char *zFunctionName, int nArg, int eTextRep, void *pvUser, SQLITEUSERFUNC func, SQLITEUSERFUNC funcstep, SQLITEFUNCFINAL funcfinal, int needCollSeq)
{
  int n;

  if (eTextRep == SQLITE_UTF16)
Changes to SQLite.Interop/src/win/interop.h.
1
2
3
4
5
6
7
8
9
10
11

12
1
2
3
4
5
6
7
8
9
10

11
12










-
+

/*
 *
 * interop.h -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
 */

#ifndef INTEROP_VERSION
#define INTEROP_VERSION       "1.0.83.0"
#define INTEROP_VERSION       "1.0.80.0"
#endif
Changes to SQLite.MSIL.nuspec.
1
2
3
4
5
6
7
8
9
10
11
12
13

14
15
16
17
18
19
20
1








2
3
4

5
6
7
8
9
10
11
12

-
-
-
-
-
-
-
-



-
+







<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.MSIL.nuspec -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<package>
  <metadata>
    <id>System.Data.SQLite.MSIL</id>
    <version>1.0.83.0</version>
    <version>1.0.80.0</version>
    <authors>SQLite Development Team</authors>
    <description>An ADO.NET provider for SQLite (managed-only).</description>
    <language>en-US</language>
    <projectUrl>http://system.data.sqlite.org/</projectUrl>
    <iconUrl>http://system.data.sqlite.org/images/sqlite32.png</iconUrl>
    <licenseUrl>http://www.sqlite.org/copyright.html</licenseUrl>
    <tags>sqlite database ado.net provider interop</tags>
Changes to SQLite.NET.Settings.targets.
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
74
75
76
77
78
79
80







81
82
83
84
85
86
87







-
-
-
-
-
-
-








    <!--
        NOTE: The suffix for the name of the build configuration directory .  By
              default, this is an empty string.
    -->
    <ConfigurationSuffix Condition="'$(ConfigurationSuffix)' == ''"></ConfigurationSuffix>

    <!--
        NOTE: Enable extra internal state checking for the public members of
              several key classes that use a connection.  By default, this is
              disabled.
    -->
    <CheckState Condition="'$(CheckState)' == ''">false</CheckState>

    <!--
        NOTE: For interaction with the native SQLite implementation, use the
              custom built interop DLL (i.e. "SQLite.Interop.dll")?  By default,
              this is enabled.  This property is mutually exclusive with the
              "UseSqliteStandard" one, below.  This should always be disabled in
              the project file that builds the NetModule target.
    -->
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
120
121
122
123
124
125
126









































































127
128
129
130
131
132
133







-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-







              default, this is enabled.  If this is disabled, no attempt will be
              made to pre-load the native SQLite library appropriate to the
              processor architecture of the currently running process upon using
              the component.  This feature is experimental and may be modified
              or removed in a future release.
    -->
    <PreLoadNativeLibrary Condition="'$(PreLoadNativeLibrary)' == ''">true</PreLoadNativeLibrary>

    <!--
        NOTE: Enable using the "well-known" extension functions from the custom
              built interop DLL (i.e. "SQLite.Interop.dll")?  By default, this
              is enabled.  If this is disabled, the "well-known" extension
              functions will be unavailable.  If this is enabled, it must also
              be enabled via the "INTEROP_EXTENSION_FUNCTIONS=1" preprocessor
              define being present in the "INTEROP_EXTRA_DEFINES" macro in the
              build properties file:

                  "SQLite.Interop\props\SQLite.Interop.20XX.[vs]props"

              for the corresponding version(s) of Visual Studio.
    -->
    <InteropExtensionFunctions Condition="'$(InteropExtensionFunctions)' == ''">true</InteropExtensionFunctions>

    <!--
        NOTE: Enable exposing the CryptoAPI based codec from the custom built
              interop DLL (i.e. "SQLite.Interop.dll")?  By default, this is
              enabled.  If this is disabled, support for encrypted databases
              will be unavailable.  If this is enabled, it must also be enabled
              via the "SQLITE_HAS_CODEC=1" preprocessor define being present in
              the "SQLITE_EXTRA_DEFINES" macro in the build properties file:

                  "SQLite.Interop\props\sqlite3.[vs]props"

              AND via the "INTEROP_CODEC=1" preprocessor define being present in
              the "INTEROP_EXTRA_DEFINES" macro in the build properties file:

                  "SQLite.Interop\props\SQLite.Interop.20XX.[vs]props"

              both for the corresponding version(s) of Visual Studio.
    -->
    <InteropCodec Condition="'$(InteropCodec)' == ''">true</InteropCodec>
  </PropertyGroup>

  <!--
  ******************************************************************************
  **                             Trace Properties                             **
  ******************************************************************************
  -->

  <PropertyGroup>
    <!--
        NOTE: Enable tracing of events related to connection handling?  By
              default, this is disabled.
    -->
    <TraceConnection Condition="'$(TraceConnection)' == ''">false</TraceConnection>

    <!--
        NOTE: Enable tracing of events related to CriticalHandle handling?  By
              default, this is disabled.
    -->
    <TraceHandle Condition="'$(TraceHandle)' == ''">false</TraceHandle>

    <!--
        NOTE: Enable tracing of events related to the native library pre-loading
              code?  By default, this is enabled.
    -->
    <TracePreLoad Condition="'$(TracePreLoad)' == ''">true</TracePreLoad>

    <!--
        NOTE: Enable tracing of events related to the prepared statements?  By
              default, this is disabled.
    -->
    <TraceStatement Condition="'$(TraceStatement)' == ''">false</TraceStatement>

    <!--
        NOTE: Enable tracing of potentially important, but non-fatal error
              conditions that cannot be reported another way?  By default, this
              is enabled.
    -->
    <TraceWarning Condition="'$(TraceWarning)' == ''">true</TraceWarning>
  </PropertyGroup>

  <!--
  ******************************************************************************
  **                            Warning Properties                            **
  ******************************************************************************
  -->
Changes to SQLite.nuspec.
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
1








2
3
4


5
6
7

8
9
10
11
12
13
14
15
16


17
18
19
20





21
22

-
-
-
-
-
-
-
-



-
-
+
+

-
+








-
-
+
+


-
-
-
-
-


<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.nuspec -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<package>
  <metadata>
    <id>System.Data.SQLite</id>
    <title>System.Data.SQLite (x86/x64)</title>
    <version>1.0.83.0</version>
    <title>System.Data.SQLite (x86)</title>
    <version>1.0.80.0</version>
    <authors>SQLite Development Team</authors>
    <description>The official SQLite database engine for both x86 and x64 along with the ADO.NET provider.</description>
    <description>The official SQLite database engine combined with a complete ADO.NET provider all rolled into a single mixed-mode assembly for x86.</description>
    <language>en-US</language>
    <projectUrl>http://system.data.sqlite.org/</projectUrl>
    <iconUrl>http://system.data.sqlite.org/images/sqlite32.png</iconUrl>
    <licenseUrl>http://www.sqlite.org/copyright.html</licenseUrl>
    <tags>sqlite database ado.net provider interop</tags>
    <copyright>Public Domain</copyright>
  </metadata>
  <files>
    <file src="bin\2008\Release\bin\System.Data.SQLite.dll" target="lib\net20" />
    <file src="bin\2010\Release\bin\System.Data.SQLite.dll" target="lib\net40" />
    <file src="bin\2008\Win32\ReleaseStatic\System.Data.SQLite.dll" target="lib\net20" />
    <file src="bin\2010\Win32\ReleaseStatic\System.Data.SQLite.dll" target="lib\net40" />
    <file src="bin\2008\Release\bin\System.Data.SQLite.Linq.dll" target="lib\net20" />
    <file src="bin\2010\Release\bin\System.Data.SQLite.Linq.dll" target="lib\net40" />
    <file src="bin\2008\Win32\ReleaseNativeOnlyStatic\SQLite.Interop.dll" target="content\net20\x86" />
    <file src="bin\2008\x64\ReleaseNativeOnlyStatic\SQLite.Interop.dll" target="content\net20\x64" />
    <file src="bin\2010\Win32\ReleaseNativeOnlyStatic\SQLite.Interop.dll" target="content\net40\x86" />
    <file src="bin\2010\x64\ReleaseNativeOnlyStatic\SQLite.Interop.dll" target="content\net40\x64" />
    <file src="install.ps1" target="tools\install.ps1" />
  </files>
</package>
Changes to SQLite.x64.nuspec.
1
2
3
4
5
6
7
8
9
10
11
12
13

14
15
16
17
18
19
20
1








2
3
4

5
6
7
8
9
10
11
12

-
-
-
-
-
-
-
-



-
+







<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.x64.nuspec -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<package>
  <metadata>
    <id>System.Data.SQLite.x64</id>
    <version>1.0.83.0</version>
    <version>1.0.80.0</version>
    <authors>SQLite Development Team</authors>
    <description>The official SQLite database engine combined with a complete ADO.NET provider all rolled into a single mixed-mode assembly for x64.</description>
    <language>en-US</language>
    <projectUrl>http://system.data.sqlite.org/</projectUrl>
    <iconUrl>http://system.data.sqlite.org/images/sqlite32.png</iconUrl>
    <licenseUrl>http://www.sqlite.org/copyright.html</licenseUrl>
    <tags>sqlite database ado.net provider interop</tags>
Changes to SQLite.x86.nuspec.
1
2
3
4
5
6
7
8
9
10
11
12
13

14
15
16
17
18
19
20
1








2
3
4

5
6
7
8
9
10
11
12

-
-
-
-
-
-
-
-



-
+







<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.x86.nuspec -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<package>
  <metadata>
    <id>System.Data.SQLite.x86</id>
    <version>1.0.83.0</version>
    <version>1.0.80.0</version>
    <authors>SQLite Development Team</authors>
    <description>The official SQLite database engine combined with a complete ADO.NET provider all rolled into a single mixed-mode assembly for x86.</description>
    <language>en-US</language>
    <projectUrl>http://system.data.sqlite.org/</projectUrl>
    <iconUrl>http://system.data.sqlite.org/images/sqlite32.png</iconUrl>
    <licenseUrl>http://www.sqlite.org/copyright.html</licenseUrl>
    <tags>sqlite database ado.net provider interop</tags>
Changes to Setup/SQLite.iss.
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
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







-












-








-







[Tasks]
Components: Application\Core\MSIL Or Application\LINQ; Name: ngen; Description: Generate native images for the assemblies and install the images in the native image cache.; Check: CheckIsNetFx2Setup() or CheckIsNetFx4Setup()

#if Pos("NativeOnly", AppConfiguration) == 0
Components: Application\Core\MSIL Or Application\LINQ; Name: gac; Description: Install the assemblies into the global assembly cache.; Flags: unchecked; Check: CheckIsNetFx2Setup() or CheckIsNetFx4Setup()

#if AppProcessor == "x86"
Components: {#InstallerCondition}; Name: gac\vs2005; Description: Install the designer components for Visual Studio 2005.; Flags: unchecked; Check: CheckIsNetFx2Setup()
Components: {#InstallerCondition}; Name: gac\vs2008; Description: Install the designer components for Visual Studio 2008.; Flags: unchecked; Check: CheckIsNetFx2Setup()
Components: {#InstallerCondition}; Name: gac\vs2010; Description: Install the designer components for Visual Studio 2010.; Flags: unchecked; Check: CheckIsNetFx4Setup()
#endif
#endif

[Run]
Components: Application\Core\MSIL; Tasks: ngen; Filename: {code:GetNetFx2InstallRoot|Ngen.exe}; Parameters: "install ""{app}\bin\System.Data.SQLite.dll"" /nologo"; Flags: skipifdoesntexist; Check: CheckIsNetFx2Setup()
Components: Application\Core\MSIL; Tasks: ngen; Filename: {code:GetNetFx4InstallRoot|Ngen.exe}; Parameters: "install ""{app}\bin\System.Data.SQLite.dll"" /nologo"; Flags: skipifdoesntexist; Check: CheckIsNetFx4Setup()
Components: Application\LINQ; Tasks: ngen; Filename: {code:GetNetFx2InstallRoot|Ngen.exe}; Parameters: "install ""{app}\bin\System.Data.SQLite.Linq.dll"" /nologo"; Flags: skipifdoesntexist; Check: CheckIsNetFx2Setup() and CheckForNetFx35(1)
Components: Application\LINQ; Tasks: ngen; Filename: {code:GetNetFx4InstallRoot|Ngen.exe}; Parameters: "install ""{app}\bin\System.Data.SQLite.Linq.dll"" /nologo"; Flags: skipifdoesntexist; Check: CheckIsNetFx4Setup()

#if Pos("NativeOnly", AppConfiguration) == 0 && AppProcessor == "x86"
Components: {#InstallerCondition}; Tasks: gac\vs2005; Filename: {app}\bin\Installer.exe; Parameters: "-install true -wow64 true -installFlags AllExceptGAC -tracePriority Lowest -verbose true -noCompact true -noNetFx40 true -noVs2008 true -noVs2010 true -whatIf false -confirm true"; Flags: skipifdoesntexist; Check: CheckIsNetFx2Setup()
Components: {#InstallerCondition}; Tasks: gac\vs2008; Filename: {app}\bin\Installer.exe; Parameters: "-install true -wow64 true -installFlags AllExceptGAC -tracePriority Lowest -verbose true -noCompact true -noNetFx40 true -noVs2005 true -noVs2010 true -whatIf false -confirm true"; Flags: skipifdoesntexist; Check: CheckIsNetFx2Setup()
Components: {#InstallerCondition}; Tasks: gac\vs2010; Filename: {app}\bin\Installer.exe; Parameters: "-install true -wow64 true -installFlags AllExceptGAC -tracePriority Lowest -verbose true -noCompact true -noNetFx20 true -noVs2005 true -noVs2008 true -whatIf false -confirm true"; Flags: skipifdoesntexist; Check: CheckIsNetFx4Setup()
#endif

[UninstallRun]
#if Pos("NativeOnly", AppConfiguration) == 0 && AppProcessor == "x86"
Components: {#InstallerCondition}; Tasks: gac\vs2010; Filename: {app}\bin\Installer.exe; Parameters: "-install false -wow64 true -installFlags AllExceptGAC -tracePriority Lowest -verbose true -noCompact true -noNetFx20 true -noVs2005 true -noVs2008 true -whatIf false -confirm true"; Flags: skipifdoesntexist; Check: CheckIsNetFx4Setup()
Components: {#InstallerCondition}; Tasks: gac\vs2008; Filename: {app}\bin\Installer.exe; Parameters: "-install false -wow64 true -installFlags AllExceptGAC -tracePriority Lowest -verbose true -noCompact true -noNetFx40 true -noVs2005 true -noVs2010 true -whatIf false -confirm true"; Flags: skipifdoesntexist; Check: CheckIsNetFx2Setup()
Components: {#InstallerCondition}; Tasks: gac\vs2005; Filename: {app}\bin\Installer.exe; Parameters: "-install false -wow64 true -installFlags AllExceptGAC -tracePriority Lowest -verbose true -noCompact true -noNetFx40 true -noVs2008 true -noVs2010 true -whatIf false -confirm true"; Flags: skipifdoesntexist; Check: CheckIsNetFx2Setup()
#endif

Components: Application\LINQ; Tasks: ngen; Filename: {code:GetNetFx4InstallRoot|Ngen.exe}; Parameters: "uninstall ""{app}\bin\System.Data.SQLite.Linq.dll"" /nologo"; Flags: skipifdoesntexist; Check: CheckIsNetFx4Setup()
Components: Application\LINQ; Tasks: ngen; Filename: {code:GetNetFx2InstallRoot|Ngen.exe}; Parameters: "uninstall ""{app}\bin\System.Data.SQLite.Linq.dll"" /nologo"; Flags: skipifdoesntexist; Check: CheckIsNetFx2Setup() and CheckForNetFx35(1)
Components: Application\Core\MSIL; Tasks: ngen; Filename: {code:GetNetFx4InstallRoot|Ngen.exe}; Parameters: "uninstall ""{app}\bin\System.Data.SQLite.dll"" /nologo"; Flags: skipifdoesntexist; Check: CheckIsNetFx4Setup()
Components: Application\Core\MSIL; Tasks: ngen; Filename: {code:GetNetFx2InstallRoot|Ngen.exe}; Parameters: "uninstall ""{app}\bin\System.Data.SQLite.dll"" /nologo"; Flags: skipifdoesntexist; Check: CheckIsNetFx2Setup()

Changes to Setup/archive.bat.
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
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







-

















-
+







:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SETLOCAL

REM SET __ECHO=ECHO
REM SET __ECHO2=ECHO
IF NOT DEFINED _AECHO (SET _AECHO=REM)
IF NOT DEFINED _CECHO (SET _CECHO=REM)
IF NOT DEFINED _VECHO (SET _VECHO=REM)

%_AECHO% Running %0 %*

SET ROOT=%~dp0\..
SET ROOT=%ROOT:\\=\%

SET TOOLS=%~dp0
SET TOOLS=%TOOLS:~0,-1%

%_VECHO% Root = '%ROOT%'
%_VECHO% Tools = '%TOOLS%'

CALL :fn_ResetErrorLevel

%__ECHO2% PUSHD "%ROOT%"
%__ECHO% PUSHD "%ROOT%"

IF ERRORLEVEL 1 (
  ECHO Could not change directory to "%ROOT%".
  GOTO errors
)

FOR /F "delims=" %%V IN ('find.exe "AssemblyVersion" System.Data.SQLite\AssemblyInfo.cs') DO (
79
80
81
82
83
84
85
86

87
88
89
90
91
92
93
78
79
80
81
82
83
84

85
86
87
88
89
90
91
92







-
+







%__ECHO% zip.exe -v -r Setup\Output\sqlite-netFx-source-%VERSION%.zip * -x @exclude_src.txt

IF ERRORLEVEL 1 (
  ECHO Failed to archive source files.
  GOTO errors
)

%__ECHO2% POPD
%__ECHO% POPD

IF ERRORLEVEL 1 (
  ECHO Could not restore directory.
  GOTO errors
)

GOTO no_errors
Changes to Setup/bake_all.bat.
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
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







-













-
+






-
+







:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SETLOCAL

REM SET __ECHO=ECHO
REM SET __ECHO3=ECHO
IF NOT DEFINED _AECHO (SET _AECHO=REM)
IF NOT DEFINED _CECHO (SET _CECHO=REM)
IF NOT DEFINED _VECHO (SET _VECHO=REM)

%_AECHO% Running %0 %*

SET TOOLS=%~dp0
SET TOOLS=%TOOLS:~0,-1%

%_VECHO% Tools = '%TOOLS%'

CALL :fn_ResetErrorLevel

%__ECHO3% CALL "%TOOLS%\vsSp.bat"
%__ECHO% CALL "%TOOLS%\vsSp.bat"

IF ERRORLEVEL 1 (
  ECHO Could not detect Visual Studio.
  GOTO errors
)

%__ECHO3% CALL "%TOOLS%\set_common.bat"
%__ECHO% CALL "%TOOLS%\set_common.bat"

IF ERRORLEVEL 1 (
  ECHO Could not set common variables.
  GOTO errors
)

IF NOT DEFINED BAKE_CONFIGURATIONS (
57
58
59
60
61
62
63
64

65
66
67
68
69
70
71

72
73
74
75
76
77
78
56
57
58
59
60
61
62

63
64
65
66
67
68
69

70
71
72
73
74
75
76
77







-
+






-
+







)

%_VECHO% Years = '%YEARS%'

FOR %%C IN (%BAKE_CONFIGURATIONS%) DO (
  FOR %%P IN (%PROCESSORS%) DO (
    FOR %%Y IN (%YEARS%) DO (
      %__ECHO3% CALL "%TOOLS%\set_%%C_%%P_%%Y.bat"
      %__ECHO% CALL "%TOOLS%\set_%%C_%%P_%%Y.bat"

      IF ERRORLEVEL 1 (
        ECHO Could not set variables for %%C/%%P/%%Y.
        GOTO errors
      )

      %__ECHO3% CALL "%TOOLS%\bake.bat"
      %__ECHO% CALL "%TOOLS%\bake.bat"

      IF ERRORLEVEL 1 (
        ECHO Could not bake setup for %%C/%%P/%%Y.
        GOTO errors
      )
    )
  )
Changes to Setup/build.bat.
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
8
9
10
11
12
13
14


15
16
17
18
19
20
21







-
-







:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SETLOCAL

REM SET __ECHO=ECHO
REM SET __ECHO2=ECHO
REM SET __ECHO3=ECHO
IF NOT DEFINED _AECHO (SET _AECHO=REM)
IF NOT DEFINED _CECHO (SET _CECHO=REM)
IF NOT DEFINED _VECHO (SET _VECHO=REM)

%_AECHO% Running %0 %*

SET ROOT=%~dp0\..
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
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







-
-
-
-
-
-

-
+







-
+







-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-







) ELSE (
  %_AECHO% No platform specified, using default...
  SET PLATFORM=Win32
)

%_VECHO% Platform = '%PLATFORM%'

SET BASE_CONFIGURATION=%CONFIGURATION%
SET BASE_CONFIGURATION=%BASE_CONFIGURATION:ManagedOnly=%
SET BASE_CONFIGURATION=%BASE_CONFIGURATION:NativeOnly=%

%_VECHO% BaseConfiguration = '%BASE_CONFIGURATION%'

SET TOOLS=%~dp0
SET TOOLS=%TOOLS:~0,-1%
SET TOOLS=%TOOLS:\\=\%

%_VECHO% Tools = '%TOOLS%'

IF EXIST "%TOOLS%\set_%CONFIGURATION%_%PLATFORM%.bat" (
  CALL :fn_ResetErrorLevel

  %_AECHO% Running "%TOOLS%\set_%CONFIGURATION%_%PLATFORM%.bat"...
  %__ECHO3% CALL "%TOOLS%\set_%CONFIGURATION%_%PLATFORM%.bat"
  %__ECHO% CALL "%TOOLS%\set_%CONFIGURATION%_%PLATFORM%.bat"

  IF ERRORLEVEL 1 (
    ECHO File "%TOOLS%\set_%CONFIGURATION%_%PLATFORM%.bat" failed.
    GOTO errors
  )
)

IF EXIST "%TOOLS%\set_user_%USERNAME%_%BASE_CONFIGURATION%_%PLATFORM%.bat" (
  CALL :fn_ResetErrorLevel

  %_AECHO% Running "%TOOLS%\set_user_%USERNAME%_%BASE_CONFIGURATION%_%PLATFORM%.bat"...
  %__ECHO3% CALL "%TOOLS%\set_user_%USERNAME%_%BASE_CONFIGURATION%_%PLATFORM%.bat"

  IF ERRORLEVEL 1 (
    ECHO File "%TOOLS%\set_user_%USERNAME%_%BASE_CONFIGURATION%_%PLATFORM%.bat" failed.
    GOTO errors
  )
)

IF EXIST "%TOOLS%\set_user_%USERNAME%_%BASE_CONFIGURATION%.bat" (
  CALL :fn_ResetErrorLevel

  %_AECHO% Running "%TOOLS%\set_user_%USERNAME%_%BASE_CONFIGURATION%.bat"...
  %__ECHO3% CALL "%TOOLS%\set_user_%USERNAME%_%BASE_CONFIGURATION%.bat"

  IF ERRORLEVEL 1 (
    ECHO File "%TOOLS%\set_user_%USERNAME%_%BASE_CONFIGURATION%.bat" failed.
    GOTO errors
  )
)

IF EXIST "%TOOLS%\set_user_%USERNAME%.bat" (
  CALL :fn_ResetErrorLevel

  %_AECHO% Running "%TOOLS%\set_user_%USERNAME%.bat"...
  %__ECHO3% CALL "%TOOLS%\set_user_%USERNAME%.bat"

  IF ERRORLEVEL 1 (
    ECHO File "%TOOLS%\set_user_%USERNAME%.bat" failed.
    GOTO errors
  )
)

IF DEFINED NETFX20ONLY (
  %_AECHO% Forcing the use of the .NET Framework 2.0...
  SET YEAR=2005
  SET FRAMEWORKDIR=%windir%\Microsoft.NET\Framework\v2.0.50727
  GOTO skip_netFxCheck
)

170
171
172
173
174
175
176
177

178
179
180
181
182
183
184
126
127
128
129
130
131
132

133
134
135
136
137
138
139
140







-
+







)

%_VECHO% Year = '%YEAR%'
%_VECHO% FrameworkDir = '%FRAMEWORKDIR%'

CALL :fn_ResetErrorLevel

%__ECHO2% PUSHD "%ROOT%"
%__ECHO% PUSHD "%ROOT%"

IF ERRORLEVEL 1 (
  ECHO Could not change directory to "%ROOT%".
  GOTO errors
)

SET PATH=%FRAMEWORKDIR%;%PATH%
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248

249
250
251
252
253
254
255
188
189
190
191
192
193
194

195
196
197
198
199
200
201
202

203
204
205
206
207
208
209
210







-








-
+







IF DEFINED NOLOG GOTO skip_setLogging

SET LOGGING="/logger:FileLogger,Microsoft.Build.Engine;Logfile=%LOGDIR%\%LOGPREFIX%_%CONFIGURATION%_%PLATFORM%_%YEAR%_%LOGSUFFIX%.log;Verbosity=diagnostic"

:skip_setLogging

%_VECHO% Logging = '%LOGGING%'
%_VECHO% MsBuildArgs = '%MSBUILD_ARGS%'

%__ECHO% MSBuild.exe "%SOLUTION%" "/target:%TARGET%" "/property:Configuration=%CONFIGURATION%" "/property:Platform=%PLATFORM%" %LOGGING% %MSBUILD_ARGS%

IF ERRORLEVEL 1 (
  ECHO Build failed.
  GOTO errors
)

%__ECHO2% POPD
%__ECHO% POPD

IF ERRORLEVEL 1 (
  ECHO Could not restore directory.
  GOTO errors
)

GOTO no_errors
Changes to Setup/build_all.bat.
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
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







-













-
+






-
+







:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SETLOCAL

REM SET __ECHO=ECHO
REM SET __ECHO3=ECHO
IF NOT DEFINED _AECHO (SET _AECHO=REM)
IF NOT DEFINED _CECHO (SET _CECHO=REM)
IF NOT DEFINED _VECHO (SET _VECHO=REM)

%_AECHO% Running %0 %*

SET TOOLS=%~dp0
SET TOOLS=%TOOLS:~0,-1%

%_VECHO% Tools = '%TOOLS%'

CALL :fn_ResetErrorLevel

%__ECHO3% CALL "%TOOLS%\vsSp.bat"
%__ECHO% CALL "%TOOLS%\vsSp.bat"

IF ERRORLEVEL 1 (
  ECHO Could not detect Visual Studio.
  GOTO errors
)

%__ECHO3% CALL "%TOOLS%\set_common.bat"
%__ECHO% CALL "%TOOLS%\set_common.bat"

IF ERRORLEVEL 1 (
  ECHO Could not set common variables.
  GOTO errors
)

IF NOT DEFINED BUILD_CONFIGURATIONS (
57
58
59
60
61
62
63
64

65
66
67
68
69
70
71

72
73
74
75
76
77
78
56
57
58
59
60
61
62

63
64
65
66
67
68
69

70
71
72
73
74
75
76
77







-
+






-
+







)

%_VECHO% Years = '%YEARS%'

FOR %%C IN (%BUILD_CONFIGURATIONS%) DO (
  FOR %%P IN (%PLATFORMS%) DO (
    FOR %%Y IN (%YEARS%) DO (
      %__ECHO3% CALL "%TOOLS%\set_%%Y.bat"
      %__ECHO% CALL "%TOOLS%\set_%%Y.bat"

      IF ERRORLEVEL 1 (
        ECHO Could not set variables for %%Y.
        GOTO errors
      )

      %__ECHO3% CALL "%TOOLS%\build.bat" %%C %%P
      %__ECHO% CALL "%TOOLS%\build.bat" %%C %%P

      IF ERRORLEVEL 1 (
        ECHO Could not build binaries for %%C/%%P/%%Y.
        GOTO errors
      )
    )
  )
Changes to Setup/build_ce.bat.
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
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







-




















-
+







:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SETLOCAL

REM SET __ECHO=ECHO
REM SET __ECHO3=ECHO
IF NOT DEFINED _AECHO (SET _AECHO=REM)
IF NOT DEFINED _CECHO (SET _CECHO=REM)
IF NOT DEFINED _VECHO (SET _VECHO=REM)

%_AECHO% Running %0 %*

SET TOOLS=%~dp0
SET TOOLS=%TOOLS:~0,-1%

%_VECHO% Tools = '%TOOLS%'

SET BUILD_CONFIGURATIONS=Release
SET BASE_CONFIGURATIONSUFFIX=Compact
SET PLATFORMS="Pocket PC 2003 (ARMV4)"
SET PROCESSORS=arm
SET YEARS=2008
SET BASE_PLATFORM=PocketPC

CALL :fn_ResetErrorLevel

%__ECHO3% CALL "%TOOLS%\build_all.bat"
%__ECHO% CALL "%TOOLS%\build_all.bat"

IF ERRORLEVEL 1 (
  ECHO Failed to build PocketPC binaries.
  GOTO errors
)

:fn_ResetErrorLevel
Changes to Setup/release.bat.
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
8
9
10
11
12
13
14


15
16
17
18
19
20
21







-
-







:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SETLOCAL

REM SET __ECHO=ECHO
REM SET __ECHO2=ECHO
REM SET __ECHO3=ECHO
IF NOT DEFINED _AECHO (SET _AECHO=REM)
IF NOT DEFINED _CECHO (SET _CECHO=REM)
IF NOT DEFINED _VECHO (SET _VECHO=REM)

%_AECHO% Running %0 %*

SET TOOLS=%~dp0
80
81
82
83
84
85
86
87

88
89
90
91
92
93
94
78
79
80
81
82
83
84

85
86
87
88
89
90
91
92







-
+







  )
)

%_VECHO% Type = '%TYPE%'

CALL :fn_ResetErrorLevel

%__ECHO3% CALL "%TOOLS%\set_common.bat"
%__ECHO% CALL "%TOOLS%\set_common.bat"

IF ERRORLEVEL 1 (
  ECHO Could not set common variables.
  GOTO errors
)

IF NOT DEFINED FRAMEWORK (
108
109
110
111
112
113
114
115

116
117
118
119
120
121
122
106
107
108
109
110
111
112

113
114
115
116
117
118
119
120







-
+







SET TOOLS=%TOOLS:~0,-1%

%_VECHO% Root = '%ROOT%'
%_VECHO% Tools = '%TOOLS%'

CALL :fn_ResetErrorLevel

%__ECHO2% PUSHD "%ROOT%"
%__ECHO% PUSHD "%ROOT%"

IF ERRORLEVEL 1 (
  ECHO Could not change directory to "%ROOT%".
  GOTO errors
)

FOR /F "delims=" %%V IN ('find.exe "AssemblyVersion" System.Data.SQLite\AssemblyInfo.cs') DO (
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
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







-
-
-


-
-
-
















-
+







  IF ERRORLEVEL 1 (
    ECHO Could not create directory "Setup\Output".
    GOTO errors
  )
)

IF DEFINED BASE_CONFIGURATIONSUFFIX (
  FOR /F "delims=" %%F IN ('DIR /B /S /AD "bin\%YEAR%\%BASE_CONFIGURATION%%BASE_CONFIGURATIONSUFFIX%\bin" 2^> NUL') DO (
    %__ECHO% RMDIR /S /Q "%%F"
  )
  %__ECHO% zip.exe -v -j -r "Setup\Output\sqlite-%FRAMEWORK%-%TYPE%-%BASE_PLATFORM%-%YEAR%-%VERSION%.zip" "bin\%YEAR%\%BASE_CONFIGURATION%%BASE_CONFIGURATIONSUFFIX%\bin" -x @exclude_bin.txt
) ELSE (
  FOR /F "delims=" %%F IN ('DIR /B /S /AD "bin\%YEAR%\%BASE_CONFIGURATION%\bin" 2^> NUL') DO (
    %__ECHO% RMDIR /S /Q "%%F"
  )
  %__ECHO% zip.exe -v -j -r "Setup\Output\sqlite-%FRAMEWORK%-%TYPE%-%BASE_PLATFORM%-%YEAR%-%VERSION%.zip" "bin\%YEAR%\%BASE_CONFIGURATION%\bin" -x @exclude_bin.txt
)

IF /I "%CONFIGURATION%" == "%BASE_CONFIGURATION%" (
  IF NOT DEFINED BASE_CONFIGURATIONSUFFIX (
    %__ECHO% zip -v -d "Setup\Output\sqlite-%FRAMEWORK%-%TYPE%-%BASE_PLATFORM%-%YEAR%-%VERSION%.zip" SQLite.Interop.*
  )
)

%__ECHO% zip.exe -v -j -r "Setup\Output\sqlite-%FRAMEWORK%-%TYPE%-%BASE_PLATFORM%-%YEAR%-%VERSION%.zip" "bin\%YEAR%\%PLATFORM%\%CONFIGURATION%%CONFIGURATIONSUFFIX%" -x @exclude_bin.txt

IF ERRORLEVEL 1 (
  ECHO Failed to archive binary files.
  GOTO errors
)

%__ECHO2% POPD
%__ECHO% POPD

IF ERRORLEVEL 1 (
  ECHO Could not restore directory.
  GOTO errors
)

GOTO no_errors
Changes to Setup/release_all.bat.
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
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







-













-
+






-
+







:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SETLOCAL

REM SET __ECHO=ECHO
REM SET __ECHO3=ECHO
IF NOT DEFINED _AECHO (SET _AECHO=REM)
IF NOT DEFINED _CECHO (SET _CECHO=REM)
IF NOT DEFINED _VECHO (SET _VECHO=REM)

%_AECHO% Running %0 %*

SET TOOLS=%~dp0
SET TOOLS=%TOOLS:~0,-1%

%_VECHO% Tools = '%TOOLS%'

CALL :fn_ResetErrorLevel

%__ECHO3% CALL "%TOOLS%\vsSp.bat"
%__ECHO% CALL "%TOOLS%\vsSp.bat"

IF ERRORLEVEL 1 (
  ECHO Could not detect Visual Studio.
  GOTO errors
)

%__ECHO3% CALL "%TOOLS%\set_common.bat"
%__ECHO% CALL "%TOOLS%\set_common.bat"

IF ERRORLEVEL 1 (
  ECHO Could not set common variables.
  GOTO errors
)

IF NOT DEFINED RELEASE_CONFIGURATIONS (
57
58
59
60
61
62
63
64

65
66
67
68
69
70
71
56
57
58
59
60
61
62

63
64
65
66
67
68
69
70







-
+







)

%_VECHO% Years = '%YEARS%'

FOR %%C IN (%RELEASE_CONFIGURATIONS%) DO (
  FOR %%P IN (%PLATFORMS%) DO (
    FOR %%Y IN (%YEARS%) DO (
      %__ECHO3% CALL "%TOOLS%\release.bat" %%C %%P %%Y
      %__ECHO% CALL "%TOOLS%\release.bat" %%C %%P %%Y

      IF ERRORLEVEL 1 (
        ECHO Could not build release archive for %%C/%%P/%%Y.
        GOTO errors
      )
    )
  )
Changes to Setup/release_ce.bat.
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
8
9
10
11
12
13
14

15
16
17
18
19
20
21







-







:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SETLOCAL

REM SET __ECHO=ECHO
REM SET __ECHO3=ECHO
IF NOT DEFINED _AECHO (SET _AECHO=REM)
IF NOT DEFINED _CECHO (SET _CECHO=REM)
IF NOT DEFINED _VECHO (SET _VECHO=REM)

%_AECHO% Running %0 %*

SET TOOLS=%~dp0
30
31
32
33
34
35
36
37

38
39
40
41
42
43
44
29
30
31
32
33
34
35

36
37
38
39
40
41
42
43







-
+







SET PROCESSORS=arm
SET YEARS=2008
SET BASE_PLATFORM=PocketPC
SET TYPE=binary

CALL :fn_ResetErrorLevel

%__ECHO3% CALL "%TOOLS%\release_all.bat"
%__ECHO% CALL "%TOOLS%\release_all.bat"

IF ERRORLEVEL 1 (
  ECHO Failed to build PocketPC release files.
  GOTO errors
)

:fn_ResetErrorLevel
Changes to Setup/release_static.bat.
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
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







-
















-
+







:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SETLOCAL

REM SET __ECHO=ECHO
REM SET __ECHO3=ECHO
IF NOT DEFINED _AECHO (SET _AECHO=REM)
IF NOT DEFINED _CECHO (SET _CECHO=REM)
IF NOT DEFINED _VECHO (SET _VECHO=REM)

%_AECHO% Running %0 %*

SET TOOLS=%~dp0
SET TOOLS=%TOOLS:~0,-1%

%_VECHO% Tools = '%TOOLS%'

SET CONFIGURATIONSUFFIX=Static
SET TYPE_PREFIX=static-

CALL :fn_ResetErrorLevel

%__ECHO3% CALL "%TOOLS%\release_all.bat"
%__ECHO% CALL "%TOOLS%\release_all.bat"

IF ERRORLEVEL 1 (
  ECHO Failed to build static release files.
  GOTO errors
)

:fn_ResetErrorLevel
Deleted Setup/set_user_mistachkin_Debug.bat.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18


















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@ECHO OFF

::
:: set_user_mistachkin_Debug.bat --
::
:: Custom Per-User Debug Build Settings
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

REM
REM NOTE: Enables the extra debug code helpful in troubleshooting issues.
REM
SET MSBUILD_ARGS=/p:CheckState=true
SET MSBUILD_ARGS=%MSBUILD_ARGS% /p:TraceConnection=true
SET MSBUILD_ARGS=%MSBUILD_ARGS% /p:TraceHandle=true
SET MSBUILD_ARGS=%MSBUILD_ARGS% /p:TraceStatement=true
Deleted Setup/set_user_mistachkin_Release.bat.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18


















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@ECHO OFF

::
:: set_user_mistachkin_Release.bat --
::
:: Custom Per-User Release Build Settings
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

REM
REM NOTE: Unsets any extra MSBuild arguments that may be present to force the
REM       use of all the default settings.
REM
SET MSBUILD_ARGS=

VERIFY > NUL
Changes to Setup/test_all.bat.
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
8
9
10
11
12
13
14


15
16
17
18
19
20
21







-
-







:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SETLOCAL

REM SET __ECHO=ECHO
REM SET __ECHO2=ECHO
REM SET __ECHO3=ECHO
IF NOT DEFINED _AECHO (SET _AECHO=REM)
IF NOT DEFINED _CECHO (SET _CECHO=REM)
IF NOT DEFINED _VECHO (SET _VECHO=REM)

%_AECHO% Running %0 %*

SET DUMMY2=%1
42
43
44
45
46
47
48
49

50
51
52
53
54
55
56

57
58
59
60
61
62
63
40
41
42
43
44
45
46

47
48
49
50
51
52
53

54
55
56
57
58
59
60
61







-
+






-
+







SET TOOLS=%~dp0
SET TOOLS=%TOOLS:~0,-1%

%_VECHO% Tools = '%TOOLS%'

CALL :fn_ResetErrorLevel

%__ECHO3% CALL "%TOOLS%\vsSp.bat"
%__ECHO% CALL "%TOOLS%\vsSp.bat"

IF ERRORLEVEL 1 (
  ECHO Could not detect Visual Studio.
  GOTO errors
)

%__ECHO3% CALL "%TOOLS%\set_common.bat"
%__ECHO% CALL "%TOOLS%\set_common.bat"

IF ERRORLEVEL 1 (
  ECHO Could not set common variables.
  GOTO errors
)

IF NOT DEFINED YEARS (
77
78
79
80
81
82
83
84

85
86
87
88
89
90
91
75
76
77
78
79
80
81

82
83
84
85
86
87
88
89







-
+







IF NOT DEFINED PLATFORM (
  ECHO Unsupported platform.
  GOTO errors
)

%_VECHO% Platform = '%PLATFORM%'

%__ECHO2% PUSHD "%ROOT%"
%__ECHO% PUSHD "%ROOT%"

IF ERRORLEVEL 1 (
  ECHO Could not change directory to "%ROOT%".
  GOTO errors
)

FOR %%Y IN (%YEARS%) DO (
148
149
150
151
152
153
154
155

156
157
158
159
160
161
162
146
147
148
149
150
151
152

153
154
155
156
157
158
159
160







-
+







    IF ERRORLEVEL 1 (
      ECHO Testing of "%%Y" mixed-mode assembly failed.
      GOTO errors
    )
  )
)

%__ECHO2% POPD
%__ECHO% POPD

IF ERRORLEVEL 1 (
  ECHO Could not restore directory.
  GOTO errors
)

GOTO no_errors
Changes to Setup/updateFileInfo.tcl.
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
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







-
-
+
+


-
-
-
-






-
+
+



-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
-
-
-
+
+

-
-
-
-
-
-
-
+
+
+
+
+
+
+

-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
+
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
+

-
-
+
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-







#       pattern is mostly non-greedy; however, at the end we need to match
#       exactly 40 hexadecimal characters.  In theory, in Tcl, this could have
#       an undefined result due to the mixing of greedy and non-greedy
#       quantifiers; however, in practice, this seems to work properly.  Also,
#       this pattern assumes a particular structure for the [HTML] file to be
#       updated.
#
set pattern1 {<a\
    href=".*?/(.*?\.(?:exe|zip|nupkg))">.*?\((\d+?\.\d+?) MiB\).*?sha1:\
set pattern {<a\
    href=".*?/(.*?\.(?:exe|zip))">.*?\((\d+?\.\d+?) MiB\).*?sha1:\
    ([0-9A-F]{40})}

set pattern2 {<a\
    href=".*?/package/.*?/\d+\.\d+\.\d+\.\d+">(.*?)</a>.*?\((\d+?\.\d+?)\
    MiB\).*?sha1: ([0-9A-F]{40})}

#
# NOTE: Grab all the data from the file to be updated.
#
set data [readFile $updateFileName]

#
# NOTE: Initialize the total number of changes made to zero.
# NOTE: Process each match in the data and capture the file name, size, and
#       hash.
#
set count 0

#
# NOTE: Process each regular expression pattern against the page text.
#
foreach pattern [list $pattern1 $pattern2] {
  #
  # NOTE: Process each match in the data and capture the file name, size, and
  #       hash.
  #
  foreach {dummy fileName fileSize fileHash} \
      [regexp -all -inline -nocase -- $pattern $data] {
    #
    # NOTE: Get the fully qualified file name based on the configured
foreach {dummy fileName fileSize fileHash} \
    [regexp -all -inline -nocase -- $pattern $data] {
  #
  # NOTE: Get the fully qualified file name based on the configured directory.
    #       directory.
    #
    set fullFileName [file join $directory [file tail $fileName]]
  #
  set fullFileName [file join $directory $fileName]

    #
    # NOTE: If the file does not exist, issue a warning and skip it.
    #
    if {![file exists $fullFileName]} then {
      puts stdout "WARNING: File \"$fullFileName\" does not exist, skipped."
      continue
    }
  #
  # NOTE: If the file does not exist, issue a warning and skip it.
  #
  if {![file exists $fullFileName]} then {
    puts stdout "WARNING: File \"$fullFileName\" does not exist, skipped."
    continue
  }

    #
    # NOTE: Replace the captured size and hash with ones calculated from the
    #       actual file name.  This will only replace the first instance of
    #       each (literal) match.  Since we are processing the matches in the
    #       exact order they appear in the data AND we are only replacing one
    #       literal instance per match AND the size sub-pattern is nothing like
    #       the hash sub-pattern, this should be 100% reliable.  In order to
  #
  # NOTE: Replace the captured size and hash with ones calculated from the
  #       actual file name.  This will only replace the first instance of
  #       each (literal) match.  Since we are processing the matches in the
  #       exact order they appear in the data AND we are only replacing one
  #       literal instance per match AND the size sub-pattern is nothing like
  #       the hash sub-pattern, this should be 100% reliable.
    #       avoid superfluous matches of the file size or hash, the starting
    #       index is set to a position just beyond the matching file name.
    #
  #
    set start [string first $fileName $data]

  incr count [regsub -nocase -- "***=$fileSize" $data [getFileSize \
    if {$start == -1} then {
      puts stdout "WARNING: Position for \"$fileName\" not found, skipped."
      continue
    }

    incr start [string length $fileName]

    #
    # NOTE: Calculate the new file size and compare it to the old one.  If it
    #       has not changed, do nothing.
    #
    set newFileSize [getFileSize $fullFileName]
      $fullFileName] data]

    if {$fileSize ne $newFileSize} then {
      incr count [regsub -nocase -start $start -- "***=$fileSize" $data \
  incr count [regsub -nocase -- "***=$fileHash" $data [getFileHash \
          $newFileSize data]

      incr start [string length $fileSize]
    }

    #
    # NOTE: Calculate the new file hash and compare it to the old one.  If it
    #       has not changed, do nothing.
    #
    set newFileHash [getFileHash $fullFileName]
      $fullFileName] data]

    if {$fileHash ne $newFileHash} then {
      incr count [regsub -nocase -start $start -- "***=$fileHash" $data \
          $newFileHash data]

      incr start [string length $fileHash]
    }
  }
}

#
# NOTE: Write the [modified] data to the file to be updated.
#
if {$count > 0} then {
  writeFile $updateFileName $data
Deleted Setup/verify.eagle.
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


































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
###############################################################################
#
# verify.eagle -- Release Archive Verification Tool
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle

proc usage { error } {
  if {[string length $error] > 0} then {puts stdout $error}

  puts stdout "usage:\
[file tail [info nameofexecutable]]\
[file tail [info script]] <directory>"

  #
  # NOTE: Indicate to the caller, if any, that we have failed.
  #
  exit 1
}

set argc [llength $argv]

if {$argc == 1} then {
  set directory [lindex $argv 0]

  if {[string length $directory] > 0} then {
    set exitCode 0

    set script [info script]
    set path [file dirname $script]
    set rootName [file rootname [file tail $script]]

    if {![info exists rar]} then {
      if {[info exists env(UnRARTool)]} then {
        set rar $env(UnRARTool)
      }

      if {![info exists rar] || ![file exists $rar]} then {
        set rar [file join $path UnRAR.exe]
      }
    }

    if {![info exists zip]} then {
      if {[info exists env(UnZipTool)]} then {
        set zip $env(UnZipTool)
      }

      if {![info exists zip] || ![file exists $zip]} then {
        set zip [file join $path UnZip.exe]
      }
    }

    source [file join $path [appendArgs $rootName .lst]]

    if {![array exists manifests]} then {
      usage "master archive manifest is missing"
    }

    set archiveFileNames [list]

    foreach extension [list exe rar zip] {
      eval lappend archiveFileNames [findFilesRecursive \
          [file join $directory [appendArgs *. $extension]]]
    }

    foreach archiveFileName $archiveFileNames {
      set manifest [file tail $archiveFileName]

      #
      # HACK: Skip all the Inno Setup files because we cannot
      #       easily validate them from this tool.
      #
      if {[string match -nocase *Setup*.exe $manifest]} then {
        continue
      }

      #
      # NOTE: Attempt to extract the version and/or date/time
      #       information from the manifest file name.
      #
      regexp -- {(\d+)\.(\d+)\.(\d+)\.(\d+)} $manifest dummy \
          major minor build revision

      regexp -- {(\d{4})-(\d{2})-(\d{2})-(\d{2})} $manifest \
          dummy year month day sequence

      #
      # HACK: Attempt to match and remove sub-strings from the
      #       manifest file name that look like a version number
      #       in the format "<major>.<minor>.<build>.<revision>"
      #       and/or a date/time string matching the format
      #       "YYYY-MM-DD-NN" (where the NN portion is a generic
      #       incrementing sequence number).
      #
      regsub -- {\d+\.\d+\.\d+\.\d+} $manifest {} manifest
      regsub -- {\d{4}-\d{2}-\d{2}-\d{2}} $manifest {} manifest

      if {![info exists manifests($manifest)]} then {
        puts stdout [appendArgs \
            "WARNING: Cannot find master manifest \"" \
            $manifest "\" for archive \"" $archiveFileName \
            "\", skipped."]

        continue
      }

      set manifestFileNames [list]

      foreach list [lrange $manifests($manifest) 1 end] {
        set rawManifestFileNames [set [appendArgs \
            [appendArgs [lindex $manifests($manifest) 0] \
            _manifests] ( $list )]]

        if {[info exists manifests($manifest,subst)]} then {
          set rawManifestFileNames [subst $rawManifestFileNames]
        }

        foreach manifestFileName $rawManifestFileNames {
          lappend manifestFileNames $manifestFileName
        }
      }

      set listCommand [list]
      lappend listCommand exec -success Success -nocarriagereturns --

      if {[file extension $archiveFileName] eq ".zip"} then {
        if {![file exists $zip]} then {
          usage [appendArgs "tool \"" $zip "\" is missing"]
        }

        lappend listCommand $zip -Z -1 $archiveFileName
      } else {
        if {![file exists $rar]} then {
          usage [appendArgs "tool \"" $rar "\" is missing"]
        }

        lappend listCommand $rar vb -- $archiveFileName
      }

      if {[catch {eval $listCommand} result] == 0} then {
        set containedFileNames [split [string map [list \\ /] \
            [string trim $result]] \n]

        foreach manifestFileName $manifestFileNames {
          #
          # TODO: Should we use -nocase here because Windows
          #       is the primary release platform?
          #
          if {[lsearch -exact -- $containedFileNames \
              $manifestFileName] == -1} then {
            puts stdout [appendArgs \
                "ERROR: Archive \"" $archiveFileName \
                "\" missing file \"" $manifestFileName \
                "\" from manifest \"" $manifest "\"."]

            set exitCode 1
          }
        }

        foreach containedFileName $containedFileNames {
          #
          # TODO: Should we use -nocase here because Windows
          #       is the primary release platform?
          #
          if {[lsearch -exact -- $manifestFileNames \
              $containedFileName] == -1} then {
            puts stdout [appendArgs \
                "ERROR: Archive \"" $archiveFileName \
                "\" contains file \"" $containedFileName \
                "\" not in manifest \"" $manifest "\"."]

            set exitCode 1
          }
        }
      } else {
        puts stdout [appendArgs \
            "ERROR: Failed to get list of files in archive \"" \
            $archiveFileName "\", error: " $result]

        set exitCode 1
      }
    }

    exit $exitCode
  } else {
    usage "invalid directory"
  }
} else {
  usage ""
}
Deleted Setup/verify.lst.
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


















































































































































































































































































































































































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
###############################################################################
#
# verify.lst -- Release Archive Manifest
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################
#
# NOTE: This file contains the master lists of all files that should be present
#       in the various archives generated during the release process.
#
###############################################################################
#
# NOTE: This is the list of all files that should be present in the source code
#       archive.
#
set sds_manifests(source) {
  Doc/
  Doc/buildChm.tcl
  Doc/Extra/
  Doc/Extra/dbfactorysupport.html
  Doc/Extra/designer.html
  Doc/Extra/environment.html
  Doc/Extra/lang_altertable.html
  Doc/Extra/lang_analyze.html
  Doc/Extra/lang_attach.html
  Doc/Extra/lang_comment.html
  Doc/Extra/lang_conflict.html
  Doc/Extra/lang_createindex.html
  Doc/Extra/lang_createtable.html
  Doc/Extra/lang_createtrigger.html
  Doc/Extra/lang_createview.html
  Doc/Extra/lang_createvtab.html
  Doc/Extra/lang_datetime.html
  Doc/Extra/lang_delete.html
  Doc/Extra/lang_detach.html
  Doc/Extra/lang_dropindex.html
  Doc/Extra/lang_droptable.html
  Doc/Extra/lang_droptrigger.html
  Doc/Extra/lang_dropview.html
  Doc/Extra/lang_explain.html
  Doc/Extra/lang_expr.html
  Doc/Extra/lang_insert.html
  Doc/Extra/lang_reindex.html
  Doc/Extra/lang_replace.html
  Doc/Extra/lang_select.html
  Doc/Extra/lang_transaction.html
  Doc/Extra/lang_types.html
  Doc/Extra/lang_update.html
  Doc/Extra/lang_vacuum.html
  Doc/Extra/limitations.html
  Doc/Extra/ndoc.css
  Doc/Extra/optimizing.html
  Doc/Extra/pragma.html
  Doc/Extra/syntax.html
  Doc/Extra/version.html
  Doc/Extra/welcome.html
  Doc/SQLite.NET.chm
  Doc/SQLite.NET.hhc
  Doc/SQLite.NET.hhp
  Doc/SQLite.NET.ndoc
  exclude_bin.txt
  exclude_src.txt
  Externals/
  Externals/Eagle/
  Externals/Eagle/bin/
  Externals/Eagle/bin/EagleShell.exe.config
  Externals/Eagle/bin/EagleShell.exe.mda.config
  Externals/Eagle/lib/
  Externals/Eagle/lib/Eagle1.0/
  Externals/Eagle/lib/Eagle1.0/vendor.eagle
  Externals/Eagle/lib/Test1.0/
  install.ps1
  readme.htm
  Setup/
  Setup/archive.bat
  Setup/bake.bat
  Setup/bake_all.bat
  Setup/build.bat
  Setup/build_all.bat
  Setup/build_ce.bat
  Setup/CheckForNetFx.pas
  Setup/clean.bat
  Setup/InitializeSetup.pas
  Setup/release.bat
  Setup/release_all.bat
  Setup/release_ce.bat
  Setup/release_static.bat
  Setup/set_2008.bat
  Setup/set_2010.bat
  Setup/set_common.bat
  Setup/set_netFx20.bat
  Setup/set_netFx40.bat
  Setup/set_Release.bat
  Setup/set_ReleaseNativeOnly.bat
  "Setup/set_ReleaseNativeOnly_Pocket PC 2003 (ARMV4).bat"
  Setup/set_ReleaseNativeOnly_Win32.bat
  Setup/set_ReleaseNativeOnly_x64.bat
  Setup/set_ReleaseNativeOnly_x64_2008.bat
  Setup/set_ReleaseNativeOnly_x64_2010.bat
  Setup/set_ReleaseNativeOnly_x86_2008.bat
  Setup/set_ReleaseNativeOnly_x86_2010.bat
  "Setup/set_Release_Pocket PC 2003 (ARMV4).bat"
  Setup/set_Release_Win32.bat
  Setup/set_Release_x64.bat
  Setup/set_Release_x64_2008.bat
  Setup/set_Release_x64_2010.bat
  Setup/set_Release_x86_2008.bat
  Setup/set_Release_x86_2010.bat
  Setup/set_x64_2008.bat
  Setup/set_x64_2010.bat
  Setup/set_x86_2008.bat
  Setup/set_x86_2010.bat
  Setup/SQLite.iss
  Setup/test_all.bat
  Setup/updateFileInfo.tcl
  Setup/verify.eagle
  Setup/verify.lst
  Setup/vsSp.bat
  SQLite.Designer/
  SQLite.Designer/AssemblyInfo.cs
  SQLite.Designer/ChangePasswordDialog.cs
  SQLite.Designer/ChangePasswordDialog.Designer.cs
  SQLite.Designer/ChangePasswordDialog.resx
  SQLite.Designer/ChangeScriptDialog.cs
  SQLite.Designer/ChangeScriptDialog.Designer.cs
  SQLite.Designer/ChangeScriptDialog.resx
  SQLite.Designer/CtcComponents/
  SQLite.Designer/CtcComponents/Guids.h
  SQLite.Designer/CtcComponents/PkgCmd.ctc
  SQLite.Designer/CtcComponents/PkgCmdID.h
  SQLite.Designer/Design/
  SQLite.Designer/Design/Check.cs
  SQLite.Designer/Design/Column.cs
  SQLite.Designer/Design/ForeignKey.cs
  SQLite.Designer/Design/Index.cs
  SQLite.Designer/Design/PrimaryKey.cs
  SQLite.Designer/Design/SimpleTokenizer.cs
  SQLite.Designer/Design/Table.cs
  SQLite.Designer/Design/Trigger.cs
  SQLite.Designer/Design/Unique.cs
  SQLite.Designer/Design/View.cs
  SQLite.Designer/Editors/
  SQLite.Designer/Editors/AutoCompleteColumn.cs
  SQLite.Designer/Editors/TableDesignerDoc.cs
  SQLite.Designer/Editors/TableDesignerDoc.Designer.cs
  SQLite.Designer/Editors/TableDesignerDoc.resx
  SQLite.Designer/Editors/ViewDesignerDoc.cs
  SQLite.Designer/Editors/ViewDesignerDoc.Designer.cs
  SQLite.Designer/Editors/ViewDesignerDoc.resx
  SQLite.Designer/Pkgcmd.h
  SQLite.Designer/PkgCmd.vsct
  SQLite.Designer/plk.txt
  SQLite.Designer/Resources/
  SQLite.Designer/Resources/info.png
  SQLite.Designer/Resources/ToolboxItems.txt
  SQLite.Designer/source.extension.vsixmanifest
  SQLite.Designer/SQLite.Designer.2005.csproj
  SQLite.Designer/SQLite.Designer.2008.csproj
  SQLite.Designer/SQLite.Designer.2010.csproj
  SQLite.Designer/SQLiteAdapterDesigner.cs
  SQLite.Designer/SQLiteCommandDesigner.cs
  SQLite.Designer/SQLiteCommandHandler.cs
  SQLite.Designer/SQLiteConnectionProperties.cs
  SQLite.Designer/SQLiteConnectionStringEditor.cs
  SQLite.Designer/SQLiteConnectionUIControl.cs
  SQLite.Designer/SQLiteConnectionUIControl.Designer.cs
  SQLite.Designer/SQLiteConnectionUIControl.resx
  SQLite.Designer/SQLiteDataAdapterToolboxItem.cs
  SQLite.Designer/SQLiteDataConnectionSupport.cs
  SQLite.Designer/SQLiteDataObjectIdentifierResolver.cs
  SQLite.Designer/SQLiteDataObjectSupport.cs
  SQLite.Designer/SQLiteDataObjectSupport.xml
  SQLite.Designer/SQLiteDataSourceInformation.cs
  SQLite.Designer/SQLiteDataViewSupport.cs
  SQLite.Designer/SQLiteDataViewSupport2005.xml
  SQLite.Designer/SQLiteDataViewSupport2008.xml
  SQLite.Designer/SQLiteDataViewSupport2010.xml
  SQLite.Designer/SQLitePackage.cs
  SQLite.Designer/SQLiteProviderObjectFactory.cs
  SQLite.Designer/TableNameDialog.cs
  SQLite.Designer/TableNameDialog.Designer.cs
  SQLite.Designer/TableNameDialog.resx
  SQLite.Designer/VSPackage.Designer.cs
  SQLite.Designer/VSPackage.resx
  SQLite.Interop/
  SQLite.Interop/props/
  SQLite.Interop/props/SQLite.Interop.2005.vsprops
  SQLite.Interop/props/SQLite.Interop.2008.vsprops
  SQLite.Interop/props/SQLite.Interop.2010.props
  SQLite.Interop/props/sqlite3.props
  SQLite.Interop/props/sqlite3.vsprops
  SQLite.Interop/SQLite.Interop.2005.vcproj
  SQLite.Interop/SQLite.Interop.2008.vcproj
  SQLite.Interop/SQLite.Interop.2010.vcxproj
  SQLite.Interop/SQLite.Interop.2010.vcxproj.filters
  SQLite.Interop/SQLite.Interop.CE.2005.vcproj
  SQLite.Interop/SQLite.Interop.CE.2008.vcproj
  SQLite.Interop/SQLite.Interop.Static.2005.vcproj
  SQLite.Interop/SQLite.Interop.Static.2008.vcproj
  SQLite.Interop/SQLite.Interop.Static.2010.vcxproj
  SQLite.Interop/SQLite.Interop.Static.2010.vcxproj.filters
  SQLite.Interop/src/
  SQLite.Interop/src/contrib/
  SQLite.Interop/src/contrib/extension-functions.c
  SQLite.Interop/src/core/
  SQLite.Interop/src/core/sqlite3.c
  SQLite.Interop/src/core/sqlite3.h
  SQLite.Interop/src/core/sqlite3ext.h
  SQLite.Interop/src/win/
  SQLite.Interop/src/win/AssemblyInfo.cpp
  SQLite.Interop/src/win/crypt.c
  SQLite.Interop/src/win/interop.c
  SQLite.Interop/src/win/interop.h
  SQLite.Interop/src/win/SQLite.Interop.rc
  SQLite.MSIL.nuspec
  SQLite.NET.2005.MSBuild.sln
  SQLite.NET.2005.sln
  SQLite.NET.2008.MSBuild.sln
  SQLite.NET.2008.sln
  SQLite.NET.2010.MSBuild.sln
  SQLite.NET.2010.sln
  SQLite.NET.Settings.targets
  SQLite.NET.targets
  SQLite.nuspec
  SQLite.x64.nuspec
  SQLite.x86.nuspec
  System.Data.SQLite/
  System.Data.SQLite/AssemblyInfo.cs
  System.Data.SQLite/DataTypes.xml
  System.Data.SQLite/LINQ/
  System.Data.SQLite/LINQ/SQLiteConnection_Linq.cs
  System.Data.SQLite/LINQ/SQLiteFactory_Linq.cs
  System.Data.SQLite/MetaDataCollections.xml
  System.Data.SQLite/SQLite3.cs
  System.Data.SQLite/SQLite3_UTF16.cs
  System.Data.SQLite/SQLiteBackup.cs
  System.Data.SQLite/SQLiteBase.cs
  System.Data.SQLite/SQLiteCommand.bmp
  System.Data.SQLite/SQLiteCommand.cs
  System.Data.SQLite/SQLiteCommandBuilder.cs
  System.Data.SQLite/SQLiteConnection.bmp
  System.Data.SQLite/SQLiteConnection.cs
  System.Data.SQLite/SQLiteConnectionPool.cs
  System.Data.SQLite/SQLiteConnectionStringBuilder.cs
  System.Data.SQLite/SQLiteConvert.cs
  System.Data.SQLite/SQLiteDataAdapter.bmp
  System.Data.SQLite/SQLiteDataAdapter.cs
  System.Data.SQLite/SQLiteDataReader.cs
  System.Data.SQLite/SQLiteDefineConstants.cs
  System.Data.SQLite/SQLiteEnlistment.cs
  System.Data.SQLite/SQLiteException.cs
  System.Data.SQLite/SQLiteFactory.cs
  System.Data.SQLite/SQLiteFunction.cs
  System.Data.SQLite/SQLiteFunctionAttribute.cs
  System.Data.SQLite/SQLiteKeyReader.cs
  System.Data.SQLite/SQLiteLog.cs
  System.Data.SQLite/SQLiteMetaDataCollectionNames.cs
  System.Data.SQLite/SQLiteParameter.cs
  System.Data.SQLite/SQLiteParameterCollection.cs
  System.Data.SQLite/SQLiteStatement.cs
  System.Data.SQLite/SQLiteTransaction.cs
  System.Data.SQLite/SR.Designer.cs
  System.Data.SQLite/SR.resx
  System.Data.SQLite/System.Data.SQLite.2005.csproj
  System.Data.SQLite/System.Data.SQLite.2008.csproj
  System.Data.SQLite/System.Data.SQLite.2010.csproj
  System.Data.SQLite/System.Data.SQLite.CF.snk
  System.Data.SQLite/System.Data.SQLite.Compact.2005.csproj
  System.Data.SQLite/System.Data.SQLite.Compact.2008.csproj
  System.Data.SQLite/System.Data.SQLite.Files.targets
  System.Data.SQLite/System.Data.SQLite.Module.2005.csproj
  System.Data.SQLite/System.Data.SQLite.Module.2008.csproj
  System.Data.SQLite/System.Data.SQLite.Module.2010.csproj
  System.Data.SQLite/System.Data.SQLite.Properties.targets
  System.Data.SQLite/System.Data.SQLite.References.targets
  System.Data.SQLite/System.Data.SQLite.snk
  System.Data.SQLite/UnsafeNativeMethods.cs
  System.Data.SQLite.Linq/
  System.Data.SQLite.Linq/AssemblyInfo.cs
  System.Data.SQLite.Linq/Properties/
  System.Data.SQLite.Linq/Properties/Resources.Designer.cs
  System.Data.SQLite.Linq/Properties/Resources.resx
  System.Data.SQLite.Linq/Resources/
  System.Data.SQLite.Linq/Resources/Common.ConceptualSchemaDefinition.csdl
  System.Data.SQLite.Linq/Resources/Common.ProviderManifest.xsd
  System.Data.SQLite.Linq/Resources/SQLiteProviderServices.ProviderManifest.xml
  System.Data.SQLite.Linq/Resources/SQLiteProviderServices.StoreSchemaDefinition.ssdl
  System.Data.SQLite.Linq/Resources/SQLiteProviderServices.StoreSchemaMapping.msl
  System.Data.SQLite.Linq/Resources/System.Data.Resources.CodeGenerationSchema.xsd
  System.Data.SQLite.Linq/Resources/System.Data.Resources.CSDLSchema.xsd
  System.Data.SQLite.Linq/Resources/System.Data.Resources.CSMSL.xsd
  System.Data.SQLite.Linq/Resources/System.Data.Resources.EntityStoreSchemaGenerator.xsd
  System.Data.SQLite.Linq/Resources/System.Data.Resources.SSDLSchema.xsd
  "System.Data.SQLite.Linq/SQL Generation/"
  "System.Data.SQLite.Linq/SQL Generation/DmlSqlGenerator.cs"
  "System.Data.SQLite.Linq/SQL Generation/InternalBase.cs"
  "System.Data.SQLite.Linq/SQL Generation/ISqlFragment.cs"
  "System.Data.SQLite.Linq/SQL Generation/JoinSymbol.cs"
  "System.Data.SQLite.Linq/SQL Generation/KeyToListMap.cs"
  "System.Data.SQLite.Linq/SQL Generation/License.txt"
  "System.Data.SQLite.Linq/SQL Generation/MetadataHelpers.cs"
  "System.Data.SQLite.Linq/SQL Generation/SkipClause.cs"
  "System.Data.SQLite.Linq/SQL Generation/SqlBuilder.cs"
  "System.Data.SQLite.Linq/SQL Generation/SqlChecker.cs"
  "System.Data.SQLite.Linq/SQL Generation/SqlGenerator.cs"
  "System.Data.SQLite.Linq/SQL Generation/SqlSelectStatement.cs"
  "System.Data.SQLite.Linq/SQL Generation/SqlWriter.cs"
  "System.Data.SQLite.Linq/SQL Generation/StringUtil.cs"
  "System.Data.SQLite.Linq/SQL Generation/Symbol.cs"
  "System.Data.SQLite.Linq/SQL Generation/SymbolPair.cs"
  "System.Data.SQLite.Linq/SQL Generation/SymbolTable.cs"
  "System.Data.SQLite.Linq/SQL Generation/TopClause.cs"
  System.Data.SQLite.Linq/SQLiteProviderManifest.cs
  System.Data.SQLite.Linq/SQLiteProviderServices.cs
  System.Data.SQLite.Linq/System.Data.SQLite.Linq.2008.csproj
  System.Data.SQLite.Linq/System.Data.SQLite.Linq.2010.csproj
  test/
  test/app.config
  test/AssemblyInfo.cs
  test/Program.cs
  test/Properties/
  test/Properties/Resources.Designer.cs
  test/Properties/Resources.resx
  test/test.2005.csproj
  test/test.2008.csproj
  test/test.2010.csproj
  test/TestCases.cs
  test/TestCasesDialog.cs
  test/TestCasesDialog.Designer.cs
  test/TestCasesDialog.resx
  testce/
  testce/AssemblyInfo.cs
  testce/Form1.cs
  testce/Form1.Designer.cs
  testce/Form1.resx
  testce/Program.cs
  testce/TestCases.cs
  testce/testce.2005.csproj
  testce/testce.2008.csproj
  testlinq/
  testlinq/2008/
  testlinq/2008/App.config
  testlinq/2010/
  testlinq/2010/App.config
  testlinq/northwindEF.db
  testlinq/NorthwindModel2008.Designer.cs
  testlinq/NorthwindModel2008.edmx
  testlinq/NorthwindModel2010.Designer.cs
  testlinq/NorthwindModel2010.edmx
  testlinq/Program.cs
  testlinq/Properties/
  testlinq/Properties/AssemblyInfo.cs
  testlinq/testlinq.2008.csproj
  testlinq/testlinq.2010.csproj
  Tests/
  Tests/all.eagle
  Tests/backup.eagle
  Tests/basic.eagle
  Tests/common.eagle
  Tests/installer.eagle
  Tests/Installer_Test_Vs2005.log
  Tests/Installer_Test_Vs2008.log
  Tests/Installer_Test_Vs2010.log
  Tests/nonWal.db
  Tests/pkgIndex.eagle
  Tests/stress.eagle
  Tests/testlinq.out
  Tests/tkt-00f86f9739.eagle
  Tests/tkt-0d5b1ef362.eagle
  Tests/tkt-201128cc88.eagle
  Tests/tkt-2c630bffa7.eagle
  Tests/tkt-2ce0870fad.eagle
  Tests/tkt-343d392b51.eagle
  Tests/tkt-3aa50d8413.eagle
  Tests/tkt-448d663d11.eagle
  Tests/tkt-544dba0a2f.eagle
  Tests/tkt-59edc1018b.eagle
  Tests/tkt-72905c9a77.eagle
  Tests/tkt-7e3fa93744.eagle
  Tests/tkt-84718e79fa.eagle
  Tests/tkt-8554170e09.eagle
  Tests/tkt-8b7d179c3c.eagle
  Tests/tkt-8c3bee31c8.eagle
  Tests/tkt-996d13cd87.eagle
  Tests/tkt-ac47dd230a.eagle
  Tests/tkt-b4a7ddc83f.eagle
  Tests/tkt-bb4b04d457.eagle
  Tests/tkt-ccfa69fc32.eagle
  Tests/tkt-e1b2e0f769.eagle
  Tests/tkt-e30b820248.eagle
  Tests/Uninstaller_Test_Vs2005.log
  Tests/Uninstaller_Test_Vs2008.log
  Tests/Uninstaller_Test_Vs2010.log
  Tests/version.eagle
  Tests/wal.db
  tools/
  tools/install/
  tools/install/Installer.2005.csproj
  tools/install/Installer.2008.csproj
  tools/install/Installer.2010.csproj
  tools/install/Installer.cs
  tools/install/Properties/
  tools/install/Properties/AssemblyInfo.cs
  tools/install/Resources/
  tools/install/Resources/manifest.xml
}

###############################################################################
#
# NOTE: This is the list of all files that should be present in the standard
#       binary archives (i.e. those not containing the mixed-mode assembly).
#
set sds_manifests(binary) {
  Installer.exe
  Installer.pdb
  SQLite.Designer.dll
  SQLite.Designer.pdb
  SQLite.Designer.xml
  SQLite.Interop.dll
  SQLite.Interop.pdb
  System.Data.SQLite.Linq.dll
  System.Data.SQLite.Linq.pdb
  System.Data.SQLite.Linq.xml
  System.Data.SQLite.dll
  System.Data.SQLite.pdb
  System.Data.SQLite.xml
  northwindEF.db
  test.exe
  test.exe.config
  test.pdb
  testlinq.exe
  testlinq.exe.config
  testlinq.pdb
}

###############################################################################
#
# NOTE: This is the list of all files that should be present in the "bundle"
#       binary archives (i.e. those not containing separate managed and native
#       assemblies).
#
set sds_manifests(bundle) {
  Installer.exe
  Installer.pdb
  SQLite.Designer.dll
  SQLite.Designer.pdb
  SQLite.Designer.xml
  System.Data.SQLite.Linq.dll
  System.Data.SQLite.Linq.pdb
  System.Data.SQLite.Linq.xml
  System.Data.SQLite.dll
  System.Data.SQLite.pdb
  System.Data.SQLite.xml
  northwindEF.db
  test.exe
  test.exe.config
  test.pdb
  testlinq.exe
  testlinq.exe.config
  testlinq.pdb
}

###############################################################################
#
# NOTE: This is the list of all files that should be present in the "PocketPC"
#       binary archives (i.e. for the .NET Compact Framework).
#
set sds_manifests(compact) {
  "SQLite.Interop.[format %03d $build].dll"
  "SQLite.Interop.[format %03d $build].pdb"
  System.Data.SQLite.dll
  System.Data.SQLite.pdb
  System.Data.SQLite.xml
  testce.exe
  testce.pdb
}

###############################################################################
#
# NOTE: These are the master archive manifest groups, based on file name.  The
#       first element in each list is the array variable name prefix used to
#       locate another array containing the named elements referenced by the
#       remaining elements in each list.  Here is an example:
#
#       1. First, the archive file name has the patch level removed from it.
#          Next, it is mapped to the name of the array containing the file
#          lists via the first element of the corresponding list.
#
#       [lindex $manifests(EagleCore.exe) 0] ==> eagle ==> eagle_manifests
#
#       2. Next, the remaining elements are used to query the named file lists
#          from the array discovered in the previous step.
#
#       [lrange $manifests(EagleCore.exe) 1 end] ==> core library
#
#       3. Finally, the final list of files for this archive file name is built
#          by combining all the file names in the file lists discovered in the
#          previous step.  Duplicate file names, if any, should be harmless.
#
#       $result == $eagle_manifests(core) UNION $eagle_manifests(library)
#
###############################################################################

set manifests(sqlite-netFx-source-.zip) [list sds source]

###############################################################################

set manifests(sqlite-netFx35-binary-Win32-2008-.zip) [list sds binary]
set manifests(sqlite-netFx35-binary-x64-2008-.zip) [list sds binary]
set manifests(sqlite-netFx35-binary-bundle-Win32-2008-.zip) [list sds bundle]
set manifests(sqlite-netFx35-binary-bundle-x64-2008-.zip) [list sds bundle]
set manifests(sqlite-netFx35-static-binary-Win32-2008-.zip) [list sds binary]
set manifests(sqlite-netFx35-static-binary-x64-2008-.zip) [list sds binary]
set manifests(sqlite-netFx35-static-binary-bundle-Win32-2008-.zip) [list sds bundle]
set manifests(sqlite-netFx35-static-binary-bundle-x64-2008-.zip) [list sds bundle]
set manifests(sqlite-netFx35-binary-PocketPC-2008-.zip) [list sds compact]
set manifests(sqlite-netFx35-binary-PocketPC-2008-.zip,subst) ""; # dynamic
set manifests(sqlite-netFx40-binary-Win32-2010-.zip) [list sds binary]
set manifests(sqlite-netFx40-binary-x64-2010-.zip) [list sds binary]
set manifests(sqlite-netFx40-binary-bundle-Win32-2010-.zip) [list sds bundle]
set manifests(sqlite-netFx40-binary-bundle-x64-2010-.zip) [list sds bundle]
set manifests(sqlite-netFx40-static-binary-Win32-2010-.zip) [list sds binary]
set manifests(sqlite-netFx40-static-binary-x64-2010-.zip) [list sds binary]
set manifests(sqlite-netFx40-static-binary-bundle-Win32-2010-.zip) [list sds bundle]
set manifests(sqlite-netFx40-static-binary-bundle-x64-2010-.zip) [list sds bundle]

###############################################################################
# end of file
Changes to System.Data.SQLite.Linq/AssemblyInfo.cs.
40
41
42
43
44
45
46
47
48


40
41
42
43
44
45
46


47
48







-
-
+
+
//      Minor Version 
//      Build Number
//      Revision
//
// You can specify all the values or you can default the Build and Revision Numbers 
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.83.0")]
[assembly: AssemblyFileVersion("1.0.83.0")]
[assembly: AssemblyVersion("1.0.80.0")]
[assembly: AssemblyFileVersion("1.0.80.0")]
Changes to System.Data.SQLite.Linq/Properties/Resources.Designer.cs.
Changes to System.Data.SQLite.Linq/Properties/Resources.resx.
Changes to System.Data.SQLite.Linq/Resources/Common.ConceptualSchemaDefinition.csdl.
Changes to System.Data.SQLite.Linq/Resources/Common.ProviderManifest.xsd.
Changes to System.Data.SQLite.Linq/Resources/SQLiteProviderServices.ProviderManifest.xml.
Changes to System.Data.SQLite.Linq/Resources/SQLiteProviderServices.StoreSchemaDefinition.ssdl.
Changes to System.Data.SQLite.Linq/Resources/SQLiteProviderServices.StoreSchemaMapping.msl.
Changes to System.Data.SQLite.Linq/SQL Generation/DmlSqlGenerator.cs.
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
193
194
195
196
197
198
199

200



201
202
203
204
205
206
207







-

-
-
-








      // from
      commandText.Append("FROM ");
      tree.Target.Expression.Accept(translator);
      commandText.AppendLine();

      // where
#if USE_INTEROP_DLL && INTEROP_EXTENSION_FUNCTIONS
      commandText.Append("WHERE last_rows_affected() > 0");
#else
      commandText.Append("WHERE changes() > 0");
#endif
      EntitySetBase table = ((DbScanExpression)tree.Target.Expression).Target;
      bool identity = false;
      foreach (EdmMember keyMember in table.ElementType.KeyMembers)
      {
        commandText.Append(" AND ");
        commandText.Append(GenerateMemberTSql(keyMember));
        commandText.Append(" = ");
Changes to System.Data.SQLite.Linq/SQL Generation/InternalBase.cs.
Changes to System.Data.SQLite.Linq/SQL Generation/KeyToListMap.cs.
Changes to System.Data.SQLite.Linq/SQL Generation/SqlChecker.cs.
Changes to System.Data.SQLite.Linq/SQL Generation/SqlGenerator.cs.
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
324
325
326
327
328
329
330


331


332
333
334
335
336
337

338
339
340
341
342
343
344







-
-

-
-






-







    /// <summary>
    /// All special non-aggregate canonical functions and their handlers
    /// </summary>
    /// <returns></returns>
    private static Dictionary<string, FunctionHandler> InitializeCanonicalFunctionHandlers()
    {
      Dictionary<string, FunctionHandler> functionHandlers = new Dictionary<string, FunctionHandler>(16, StringComparer.Ordinal);

#if USE_INTEROP_DLL && INTEROP_EXTENSION_FUNCTIONS
      functionHandlers.Add("IndexOf", HandleCanonicalFunctionIndexOf);
#endif

      functionHandlers.Add("Length", HandleCanonicalFunctionLength);
      functionHandlers.Add("NewGuid", HandleCanonicalFunctionNewGuid);
      functionHandlers.Add("Round", HandleCanonicalFunctionRound);
      functionHandlers.Add("ToLower", HandleCanonicalFunctionToLower);
      functionHandlers.Add("ToUpper", HandleCanonicalFunctionToUpper);
      functionHandlers.Add("Trim", HandleCanonicalFunctionTrim);
      functionHandlers.Add("Left", HandleCanonicalFunctionLeft);
      functionHandlers.Add("Right", HandleCanonicalFunctionRight);
      functionHandlers.Add("CurrentDateTime", HandleGetDateFunction);
      functionHandlers.Add("CurrentUtcDateTime", HandleGetUtcDateFunction);

      //DatePartFunctions
      functionHandlers.Add("Year", HandleCanonicalFunctionDatepart);
      functionHandlers.Add("Month", HandleCanonicalFunctionDatepart);
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2856
2857
2858
2859
2860
2861
2862

2863
2864
2865
2866
2867
2868
2869
2870
2871
2872

2873
2874
2875
2876
2877
2878
2879







-










-







      }

      result.Append(") AS integer)");

      return result;
    }

#if USE_INTEROP_DLL && INTEROP_EXTENSION_FUNCTIONS
    /// <summary>
    ///  Function rename IndexOf -> CHARINDEX
    /// </summary>
    /// <param name="sqlgen"></param>
    /// <param name="e"></param>
    /// <returns></returns>
    private static ISqlFragment HandleCanonicalFunctionIndexOf(SqlGenerator sqlgen, DbFunctionExpression e)
    {
      return sqlgen.HandleFunctionDefaultGivenName(e, "CHARINDEX");
    }
#endif

    /// <summary>
    ///  Function rename NewGuid -> NEWID
    /// </summary>
    /// <param name="sqlgen"></param>
    /// <param name="e"></param>
    /// <returns></returns>
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2941
2942
2943
2944
2945
2946
2947





















2948
2949
2950
2951
2952
2953
2954







-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-







      result.Append(e.Arguments[0].Accept(sqlgen));

      result.Append(")");

      return result;
    }

    /// <summary>
    /// LEFT(string, length) -> SUBSTR(string, 1, length)
    /// </summary>
    /// <param name="sqlgen"></param>
    /// <param name="e"></param>
    /// <returns></returns>
    private static ISqlFragment HandleCanonicalFunctionLeft(SqlGenerator sqlgen, DbFunctionExpression e)
    {
        SqlBuilder result = new SqlBuilder();

        result.Append("SUBSTR(");

        Debug.Assert(e.Arguments.Count == 2, "Left should have two arguments");
        result.Append(e.Arguments[0].Accept(sqlgen));
        result.Append(", 1, ");
        result.Append(e.Arguments[1].Accept(sqlgen));
        result.Append(")");

        return result;
    }

    /// <summary>
    /// RIGHT(string, length) -> SUBSTR(string, -(length), length)
    /// </summary>
    /// <param name="sqlgen"></param>
    /// <param name="e"></param>
    /// <returns></returns>
    private static ISqlFragment HandleCanonicalFunctionRight(SqlGenerator sqlgen, DbFunctionExpression e)
Changes to System.Data.SQLite.Linq/SQL Generation/StringUtil.cs.
Changes to System.Data.SQLite.Linq/SQLiteProviderManifest.cs.
Changes to System.Data.SQLite.Linq/SQLiteProviderServices.cs.
Changes to System.Data.SQLite/AssemblyInfo.cs.
60
61
62
63
64
65
66
67

68
69

70
60
61
62
63
64
65
66

67
68

69
70







-
+

-
+

//      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.83.0")]
[assembly: AssemblyVersion("1.0.80.0")]
#if !PLATFORM_COMPACTFRAMEWORK
[assembly: AssemblyFileVersion("1.0.83.0")]
[assembly: AssemblyFileVersion("1.0.80.0")]
#endif
Changes to System.Data.SQLite/DataTypes.xml.
Changes to System.Data.SQLite/LINQ/SQLiteFactory_Linq.cs.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
1
2
3
4
5
6
7
8
9
10

11
12
13
14
15
16
17










-







/********************************************************
 * 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.Globalization;
  using System.Reflection;
  using System.Security.Permissions;

  /// <summary>
  /// SQLite implementation of DbProviderFactory.
  /// </summary>
  public sealed partial class SQLiteFactory : IServiceProvider
33
34
35
36
37
38
39
40

41
42
43
44
45
46
47
32
33
34
35
36
37
38

39
40
41
42
43
44
45
46







-
+







        string version =
#if NET_20
            "3.5.0.0";
#else
            "4.0.0.0";
#endif

        _dbProviderServicesType = Type.GetType(String.Format(CultureInfo.InvariantCulture, "System.Data.Common.DbProviderServices, System.Data.Entity, Version={0}, Culture=neutral, PublicKeyToken=b77a5c561934e089", version), false);
        _dbProviderServicesType = Type.GetType(String.Format("System.Data.Common.DbProviderServices, System.Data.Entity, Version={0}, Culture=neutral, PublicKeyToken=b77a5c561934e089", version), false);
    }

    /// <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>
57
58
59
60
61
62
63
64

65
66
67
68
69
70
71
72
73
74
75
56
57
58
59
60
61
62

63
64
65
66
67
68
69
70
71
72
73
74







-
+












    [ReflectionPermission(SecurityAction.Assert, MemberAccess = true)]
    private object GetSQLiteProviderServicesInstance()
    {
        if (_sqliteServices == null)
        {
            Version version = this.GetType().Assembly.GetName().Version;
            Type type = Type.GetType(String.Format(CultureInfo.InvariantCulture, "System.Data.SQLite.SQLiteProviderServices, System.Data.SQLite.Linq, Version={0}, Culture=neutral, PublicKeyToken=db937bc2d44ff139", version), false);
            Type type = Type.GetType(String.Format("System.Data.SQLite.SQLiteProviderServices, System.Data.SQLite.Linq, Version={0}, Culture=neutral, PublicKeyToken=db937bc2d44ff139", version), false);

            if (type != null)
            {
                FieldInfo field = type.GetField("Instance", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance);
                _sqliteServices = field.GetValue(null);
            }
        }
        return _sqliteServices;
    }
  }
}
Changes to System.Data.SQLite/MetaDataCollections.xml.
Changes to System.Data.SQLite/SQLite3.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
52
53
54
55
56
57
58
59
60

61
62
63
64
65
66

67
68
69
70
71
72
73
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










-
-
+
-


-
-



-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-



-
+



















-
+





-
+







/********************************************************
 * 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;

#if DEBUG
#if !NET_COMPACT_20 && (TRACE_CONNECTION || TRACE_STATEMENT)
  using System.Diagnostics;
#endif

  using System.Globalization;
  using System.Runtime.InteropServices;
  using System.Text;

  /// <summary>
  /// This is the method signature for the SQLite core library logging callback
  /// function for use with sqlite3_log() and the SQLITE_CONFIG_LOG.
  ///
  /// WARNING: This delegate is used more-or-less directly by native code, do
  ///          not modify its type signature.
  /// </summary>
  /// <param name="pUserData">
  /// The extra data associated with this message, if any.
  /// </param>
  /// <param name="errorCode">
  /// The error code associated with this message.
  /// </param>
  /// <param name="pMessage">
  /// The message string to be logged.
  /// </param>
#if !PLATFORM_COMPACTFRAMEWORK
  [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif
  internal delegate void SQLiteLogCallback(IntPtr pUserData, int errorCode, IntPtr pMessage);
  internal delegate void SQLiteLogCallback(IntPtr puser, int err_code, IntPtr message);

  /// <summary>
  /// This class implements SQLiteBase completely, and is the guts of the code that interop's SQLite with .NET
  /// </summary>
  internal class SQLite3 : SQLiteBase
  {
    private static object syncRoot = new object();

    //
    // NOTE: This is the public key for the System.Data.SQLite assembly.  If you change the
    //       SNK file, you will need to change this as well.
    //
    internal const string PublicKey =
        "002400000480000094000000060200000024000052534131000400000100010005a288de5687c4e1" +
        "b621ddff5d844727418956997f475eb829429e411aff3e93f97b70de698b972640925bdd44280df0" +
        "a25a843266973704137cbb0e7441c1fe7cae4e2440ae91ab8cde3933febcb1ac48dd33b40e13c421" +
        "d8215c18a4349a436dd499e3c385cc683015f886f6c10bd90115eb2bd61b67750839e3a19941dc9c";

#if !PLATFORM_COMPACTFRAMEWORK
    internal const string DesignerVersion = "1.0.83.0";
    internal const string DesignerVersion = "1.0.80.0";
#endif

    /// <summary>
    /// The opaque pointer returned to us by the sqlite provider
    /// </summary>
    protected internal SQLiteConnectionHandle _sql;
    protected SQLiteConnectionHandle _sql;
    protected string _fileName;
    protected bool _usePool;
    protected int _poolVersion;

#if !PLATFORM_COMPACTFRAMEWORK
    private bool _buildingSchema;
#endif
132
133
134
135
136
137
138
139

140
141
142
143
144
145
146
147
148
149
150
151
112
113
114
115
116
117
118

119
120




121
122
123
124
125
126
127







-
+

-
-
-
-







    // resources belonging to the previously-registered functions.
    internal override void Close()
    {
      if (_sql != null)
      {
          if (_usePool)
          {
              SQLiteBase.ResetConnection(_sql, _sql);
              SQLiteBase.ResetConnection(_sql);
              SQLiteConnectionPool.Add(_fileName, _sql, _poolVersion);

#if !NET_COMPACT_20 && TRACE_CONNECTION
              Trace.WriteLine(String.Format("Close (Pool): {0}", _sql));
#endif
          }
          else
          {
              _sql.Dispose();
          }
          _sql = null;
      }
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
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







-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-




















-
+







    {
      get
      {
        return SQLite3.SQLiteVersion;
      }
    }

    internal static string DefineConstants
    {
        get
        {
            StringBuilder result = new StringBuilder();
            IList<string> list = SQLiteDefineConstants.OptionList;

            if (list != null)
            {
                foreach (string element in list)
                {
                    if (element == null)
                        continue;

                    if (result.Length > 0)
                        result.Append(' ');

                    result.Append(element);
                }
            }

            return result.ToString();
        }
    }

    internal static string SQLiteVersion
    {
      get
      {
        return UTF8ToString(UnsafeNativeMethods.sqlite3_libversion(), -1);
      }
    }

    internal static string SQLiteSourceId
    {
      get
      {
        return UTF8ToString(UnsafeNativeMethods.sqlite3_sourceid(), -1);
      }
    }

    internal override bool AutoCommit
    {
      get
      {
        return IsAutocommit(_sql, _sql);
        return IsAutocommit(_sql);
      }
    }

    internal override long LastInsertRowId
    {
      get
      {
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
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







-
-
-
-
-
-
-
-
-
-
-
-
-





-
+

-
+













-
-


+

-
-
-
-







-
+

-
+


-
+



-
+

-
+
-





-







-
-
-
-
-
-
-
-
-
-
-
-
-
-


-
-
+
+




-
+








-
-
+
+

-
+

-
+






-
-
+
+

-
+








-
+











-
+

-
+








-
+














-
+

-
+


-
-
+
+

-
+


-
+

-
+

















-
-
+


-
-
+










-
+

-
+
-






-
+











-
+








-
-
+
+


-
+

-
+

-
+







    {
      get
      {
        return UnsafeNativeMethods.sqlite3_memory_highwater(0);
      }
    }

    internal override SQLiteErrorCode SetMemoryStatus(bool value)
    {
        return StaticSetMemoryStatus(value);
    }

    internal static SQLiteErrorCode StaticSetMemoryStatus(bool value)
    {
        SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3_config_int(
            SQLiteConfigOpsEnum.SQLITE_CONFIG_MEMSTATUS, value ? 1 : 0);

        return rc;
    }

    /// <summary>
    /// Shutdown the SQLite engine so that it can be restarted with different config options.
    /// We depend on auto initialization to recover.
    /// </summary>
    /// <returns>Returns a result code</returns>
    internal override SQLiteErrorCode Shutdown()
    internal override int Shutdown()
    {
        SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3_shutdown();
        int rc = UnsafeNativeMethods.sqlite3_shutdown();
        return rc;
    }

    internal override bool IsOpen()
    {
        return (_sql != null);
    }

    internal override void Open(string strFilename, SQLiteConnectionFlags connectionFlags, SQLiteOpenFlagsEnum openFlags, int maxPoolSize, bool usePool)
    {
      if (_sql != null) return;

      _usePool = usePool;
      _fileName = strFilename;

      if (usePool)
      {
        _fileName = strFilename;
        _sql = SQLiteConnectionPool.Remove(strFilename, maxPoolSize, out _poolVersion);

#if !NET_COMPACT_20 && TRACE_CONNECTION
        Trace.WriteLine(String.Format("Open (Pool): {0}", (_sql != null) ? _sql.ToString() : "<null>"));
#endif
      }

      if (_sql == null)
      {
        IntPtr db;

#if !SQLITE_STANDARD
        SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_open_interop(ToUTF8(strFilename), (int)openFlags, out db);
        int n = UnsafeNativeMethods.sqlite3_open_interop(ToUTF8(strFilename), (int)openFlags, out db);
#else
        SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_open_v2(ToUTF8(strFilename), out db, (int)openFlags, IntPtr.Zero);
        int n = UnsafeNativeMethods.sqlite3_open_v2(ToUTF8(strFilename), out db, (int)openFlags, IntPtr.Zero);
#endif

#if !NET_COMPACT_20 && TRACE_CONNECTION
#if DEBUG && !NET_COMPACT_20
        Trace.WriteLine(String.Format("Open: {0}", db));
#endif

        if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, null);
        if (n > 0) throw new SQLiteException(n, null);

        _sql = new SQLiteConnectionHandle(db);
        _sql = db;
        lock (_sql) { /* HACK: Force the SyncBlock to be "created" now. */ }
      }
      // 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, connectionFlags);
      SetTimeout(0);
      GC.KeepAlive(_sql);
    }

    internal override void ClearPool()
    {
      SQLiteConnectionPool.ClearPool(_fileName);
    }

    internal override int CountPool()
    {
        Dictionary<string, int> counts = null;
        int openCount = 0;
        int closeCount = 0;
        int totalCount = 0;

        SQLiteConnectionPool.GetCounts(_fileName,
            ref counts, ref openCount, ref closeCount,
            ref totalCount);

        return totalCount;
    }

    internal override void SetTimeout(int nTimeoutMS)
    {
      SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_busy_timeout(_sql, nTimeoutMS);
      if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError());
      int n = UnsafeNativeMethods.sqlite3_busy_timeout(_sql, nTimeoutMS);
      if (n > 0) throw new SQLiteException(n, SQLiteLastError());
    }

    internal override bool Step(SQLiteStatement stmt)
    {
      SQLiteErrorCode n;
      int n;
      Random rnd = null;
      uint starttick = (uint)Environment.TickCount;
      uint timeout = (uint)(stmt._command._commandTimeout * 1000);

      while (true)
      {
        n = UnsafeNativeMethods.sqlite3_step(stmt._sqlite_stmt);

        if (n == SQLiteErrorCode.Row) return true;
        if (n == SQLiteErrorCode.Done) return false;
        if (n == 100) return true;
        if (n == 101) return false;

        if (n != SQLiteErrorCode.Ok)
        if (n > 0)
        {
          SQLiteErrorCode r;
          int r;

          // An error occurred, attempt to reset the statement.  If the reset worked because the
          // schema has changed, re-try the step again.  If it errored our because the database
          // is locked, then keep retrying until the command timeout occurs.
          r = Reset(stmt);

          if (r == SQLiteErrorCode.Ok)
            throw new SQLiteException(n, GetLastError());
          if (r == 0)
            throw new SQLiteException(n, SQLiteLastError());

          else if ((r == SQLiteErrorCode.Locked || r == SQLiteErrorCode.Busy) && stmt._command != null)
          else if ((r == 6 || r == 5) && stmt._command != null) // SQLITE_LOCKED || SQLITE_BUSY
          {
            // Keep trying
            if (rnd == null) // First time we've encountered the lock
              rnd = new Random();

            // If we've exceeded the command's timeout, give up and throw an error
            if ((uint)Environment.TickCount - starttick > timeout)
            {
              throw new SQLiteException(r, GetLastError());
              throw new SQLiteException(r, SQLiteLastError());
            }
            else
            {
              // Otherwise sleep for a random amount of time up to 150ms
              System.Threading.Thread.Sleep(rnd.Next(1, 150));
            }
          }
        }
      }
    }

    internal override SQLiteErrorCode Reset(SQLiteStatement stmt)
    internal override int Reset(SQLiteStatement stmt)
    {
      SQLiteErrorCode n;
      int n;

#if !SQLITE_STANDARD
      n = UnsafeNativeMethods.sqlite3_reset_interop(stmt._sqlite_stmt);
#else
      n = UnsafeNativeMethods.sqlite3_reset(stmt._sqlite_stmt);
#endif

      // If the schema changed, try and re-prepare it
      if (n == SQLiteErrorCode.Schema)
      if (n == 17) // SQLITE_SCHEMA
      {
        // Recreate a dummy statement
        string str;
        using (SQLiteStatement tmp = Prepare(null, stmt._sqlStatement, null, (uint)(stmt._command._commandTimeout * 1000), out str))
        {
          // Finalize the existing statement
          stmt._sqlite_stmt.Dispose();
          // Reassign a new statement pointer to the old statement and clear the temporary one
          stmt._sqlite_stmt = tmp._sqlite_stmt;
          tmp._sqlite_stmt = null;

          // Reapply parameters
          stmt.BindParameters();
        }
        return (SQLiteErrorCode)(-1); // Reset was OK, with schema change
        return -1; // Reset was OK, with schema change
      }
      else if (n == SQLiteErrorCode.Locked || n == SQLiteErrorCode.Busy)
      else if (n == 6 || n == 5) // SQLITE_LOCKED || SQLITE_BUSY
        return n;

      if (n != SQLiteErrorCode.Ok)
        throw new SQLiteException(n, GetLastError());
      if (n > 0)
        throw new SQLiteException(n, SQLiteLastError());

      return SQLiteErrorCode.Ok; // We reset OK, no schema changes
      return 0; // We reset OK, no schema changes
    }

    internal override string GetLastError()
    internal override string SQLiteLastError()
    {
      return SQLiteBase.GetLastError(_sql, _sql);
      return SQLiteBase.SQLiteLastError(_sql);
    }

    internal override SQLiteStatement Prepare(SQLiteConnection cnn, string strSql, SQLiteStatement previous, uint timeoutMS, out string strRemain)
    {
      if (!String.IsNullOrEmpty(strSql))
      {
        //
        // NOTE: SQLite does not support the concept of separate schemas
        //       in one database; therefore, remove the base schema name
        //       used to smooth integration with the base .NET Framework
        //       data classes.
        //
        string baseSchemaName = (cnn != null) ? cnn._baseSchemaName : null;

        if (!String.IsNullOrEmpty(baseSchemaName))
        {
          strSql = strSql.Replace(
              String.Format(CultureInfo.InvariantCulture,
              "[{0}].", baseSchemaName), String.Empty);
              String.Format("[{0}].", baseSchemaName), String.Empty);

          strSql = strSql.Replace(
              String.Format(CultureInfo.InvariantCulture,
              "{0}.", baseSchemaName), String.Empty);
              String.Format("{0}.", baseSchemaName), String.Empty);
        }
      }

      SQLiteConnectionFlags flags =
          (cnn != null) ? cnn.Flags : SQLiteConnectionFlags.Default;

#if !PLATFORM_COMPACTFRAMEWORK
      if ((flags & SQLiteConnectionFlags.LogPrepare) == SQLiteConnectionFlags.LogPrepare)
      {
          if ((strSql == null) || (strSql.Length == 0) || (strSql.Trim().Length == 0))
              SQLiteLog.LogMessage("Preparing {<nothing>}...");
              SQLiteLog.LogMessage(0, "Preparing {<nothing>}...");
          else
              SQLiteLog.LogMessage(String.Format(
              SQLiteLog.LogMessage(0, String.Format("Preparing {{{0}}}...", strSql));
                  CultureInfo.CurrentCulture, "Preparing {{{0}}}...", strSql));
      }
#endif

      IntPtr stmt = IntPtr.Zero;
      IntPtr ptr = IntPtr.Zero;
      int len = 0;
      SQLiteErrorCode n = SQLiteErrorCode.Schema;
      int n = 17;
      int retries = 0;
      byte[] b = ToUTF8(strSql);
      string typedefs = null;
      SQLiteStatement cmd = null;
      Random rnd = null;
      uint starttick = (uint)Environment.TickCount;

      GCHandle handle = GCHandle.Alloc(b, GCHandleType.Pinned);
      IntPtr psql = handle.AddrOfPinnedObject();
      try
      {
        while ((n == SQLiteErrorCode.Schema || n == SQLiteErrorCode.Locked || n == SQLiteErrorCode.Busy) && retries < 3)
        while ((n == 17 || n == 6 || n == 5) && retries < 3)
        {
#if !SQLITE_STANDARD
          n = UnsafeNativeMethods.sqlite3_prepare_interop(_sql, psql, b.Length - 1, out stmt, out ptr, out len);
#else
          n = UnsafeNativeMethods.sqlite3_prepare(_sql, psql, b.Length - 1, out stmt, out ptr);
          len = -1;
#endif

#if !NET_COMPACT_20 && TRACE_STATEMENT
          Trace.WriteLine(String.Format("Prepare ({0}): {1}", n, stmt));
#if DEBUG && !NET_COMPACT_20
          Trace.WriteLine(String.Format("Prepare: {0}", stmt));
#endif

          if (n == SQLiteErrorCode.Schema)
          if (n == 17)
            retries++;
          else if (n == SQLiteErrorCode.Error)
          else if (n == 1)
          {
            if (String.Compare(GetLastError(), "near \"TYPES\": syntax error", StringComparison.OrdinalIgnoreCase) == 0)
            if (String.Compare(SQLiteLastError(), "near \"TYPES\": syntax error", StringComparison.OrdinalIgnoreCase) == 0)
            {
              int pos = strSql.IndexOf(';');
              if (pos == -1) pos = strSql.Length - 1;

              typedefs = strSql.Substring(0, pos + 1);
              strSql = strSql.Substring(pos + 1);

520
521
522
523
524
525
526
527

528
529
530
531
532
533
534
434
435
436
437
438
439
440

441
442
443
444
445
446
447
448







-
+








              if (cmd != null)
                cmd.SetTypes(typedefs);

              return cmd;
            }
#if !PLATFORM_COMPACTFRAMEWORK
            else if (_buildingSchema == false && String.Compare(GetLastError(), 0, "no such table: TEMP.SCHEMA", 0, 26, StringComparison.OrdinalIgnoreCase) == 0)
            else if (_buildingSchema == false && String.Compare(SQLiteLastError(), 0, "no such table: TEMP.SCHEMA", 0, 26, StringComparison.OrdinalIgnoreCase) == 0)
            {
              strRemain = "";
              _buildingSchema = true;
              try
              {
                ISQLiteSchemaExtensions ext = ((IServiceProvider)SQLiteFactory.Instance).GetService(typeof(ISQLiteSchemaExtensions)) as ISQLiteSchemaExtensions;

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
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







-
+








-
+









-
+



-
+














-
+








-
+







              finally
              {
                _buildingSchema = false;
              }
            }
#endif
          }
          else if (n == SQLiteErrorCode.Locked || n == SQLiteErrorCode.Busy) // Locked -- delay a small amount before retrying
          else if (n == 6 || n == 5) // Locked -- delay a small amount before retrying
          {
            // Keep trying
            if (rnd == null) // First time we've encountered the lock
              rnd = new Random();

            // If we've exceeded the command's timeout, give up and throw an error
            if ((uint)Environment.TickCount - starttick > timeoutMS)
            {
              throw new SQLiteException(n, GetLastError());
              throw new SQLiteException(n, SQLiteLastError());
            }
            else
            {
              // Otherwise sleep for a random amount of time up to 150ms
              System.Threading.Thread.Sleep(rnd.Next(1, 150));
            }
          }
        }

        if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError());
        if (n > 0) throw new SQLiteException(n, SQLiteLastError());

        strRemain = UTF8ToString(ptr, len);

        if (stmt != IntPtr.Zero) cmd = new SQLiteStatement(this, flags, new SQLiteStatementHandle(_sql, stmt), strSql.Substring(0, strSql.Length - strRemain.Length), previous);
        if (stmt != IntPtr.Zero) cmd = new SQLiteStatement(this, flags, stmt, strSql.Substring(0, strSql.Length - strRemain.Length), previous);

        return cmd;
      }
      finally
      {
        handle.Free();
      }
    }

#if !PLATFORM_COMPACTFRAMEWORK
    protected static void LogBind(SQLiteStatementHandle handle, int index)
    {
        IntPtr handleIntPtr = handle;

        SQLiteLog.LogMessage(String.Format(
        SQLiteLog.LogMessage(0, String.Format(
            "Binding statement {0} paramter #{1} as NULL...",
            handleIntPtr, index));
    }

    protected static void LogBind(SQLiteStatementHandle handle, int index, ValueType value)
    {
        IntPtr handleIntPtr = handle;

        SQLiteLog.LogMessage(String.Format(
        SQLiteLog.LogMessage(0, String.Format(
            "Binding statement {0} paramter #{1} as type {2} with value {{{3}}}...",
            handleIntPtr, index, value.GetType(), value));
    }

    private static string FormatDateTime(DateTime value)
    {
        StringBuilder result = new StringBuilder();
615
616
617
618
619
620
621
622

623
624
625
626
627
628
629
630
631

632
633
634
635
636
637
638
529
530
531
532
533
534
535

536
537
538
539
540
541
542
543
544

545
546
547
548
549
550
551
552







-
+








-
+







        return result.ToString();
    }

    protected static void LogBind(SQLiteStatementHandle handle, int index, DateTime value)
    {
        IntPtr handleIntPtr = handle;

        SQLiteLog.LogMessage(String.Format(
        SQLiteLog.LogMessage(0, String.Format(
            "Binding statement {0} paramter #{1} as type {2} with value {{{3}}}...",
            handleIntPtr, index, typeof(DateTime), FormatDateTime(value)));
    }

    protected static void LogBind(SQLiteStatementHandle handle, int index, string value)
    {
        IntPtr handleIntPtr = handle;

        SQLiteLog.LogMessage(String.Format(
        SQLiteLog.LogMessage(0, String.Format(
            "Binding statement {0} paramter #{1} as type {2} with value {{{3}}}...",
            handleIntPtr, index, typeof(String), (value != null) ? value : "<null>"));
    }

    private static string ToHexadecimalString(
        byte[] array
        )
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
704
705
706
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
744
745
746
747
748
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
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







-
+















-
+

-
+

-
+













-
-
+
+













-
-
+
+












-
+

-
+

-
+












-
+

-
+

-
+







        return result.ToString();
    }

    protected static void LogBind(SQLiteStatementHandle handle, int index, byte[] value)
    {
        IntPtr handleIntPtr = handle;

        SQLiteLog.LogMessage(String.Format(
        SQLiteLog.LogMessage(0, String.Format(
            "Binding statement {0} paramter #{1} as type {2} with value {{{3}}}...",
            handleIntPtr, index, typeof(Byte[]), (value != null) ? ToHexadecimalString(value) : "<null>"));
    }
#endif

    internal override void Bind_Double(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, double value)
    {
        SQLiteStatementHandle handle = stmt._sqlite_stmt;

#if !PLATFORM_COMPACTFRAMEWORK
        if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind)
        {
            LogBind(handle, index, value);
        }

        SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_double(handle, index, value);
        int n = UnsafeNativeMethods.sqlite3_bind_double(handle, index, value);
#else
        SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_double_interop(handle, index, ref value);
        int n = UnsafeNativeMethods.sqlite3_bind_double_interop(handle, index, ref value);
#endif
        if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError());
        if (n > 0) throw new SQLiteException(n, SQLiteLastError());
    }

    internal override void Bind_Int32(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, int value)
    {
        SQLiteStatementHandle handle = stmt._sqlite_stmt;

#if !PLATFORM_COMPACTFRAMEWORK
        if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind)
        {
            LogBind(handle, index, value);
        }
#endif

        SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_int(handle, index, value);
        if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError());
        int n = UnsafeNativeMethods.sqlite3_bind_int(handle, index, value);
        if (n > 0) throw new SQLiteException(n, SQLiteLastError());
    }

    internal override void Bind_UInt32(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, uint value)
    {
        SQLiteStatementHandle handle = stmt._sqlite_stmt;

#if !PLATFORM_COMPACTFRAMEWORK
        if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind)
        {
            LogBind(handle, index, value);
        }
#endif

        SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_uint(handle, index, value);
        if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError());
        int n = UnsafeNativeMethods.sqlite3_bind_uint(handle, index, value);
        if (n > 0) throw new SQLiteException(n, SQLiteLastError());
    }

    internal override void Bind_Int64(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, long value)
    {
        SQLiteStatementHandle handle = stmt._sqlite_stmt;

#if !PLATFORM_COMPACTFRAMEWORK
        if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind)
        {
            LogBind(handle, index, value);
        }

        SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_int64(handle, index, value);
        int n = UnsafeNativeMethods.sqlite3_bind_int64(handle, index, value);
#else
        SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_int64_interop(handle, index, ref value);
        int n = UnsafeNativeMethods.sqlite3_bind_int64_interop(handle, index, ref value);
#endif
        if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError());
        if (n > 0) throw new SQLiteException(n, SQLiteLastError());
    }

    internal override void Bind_UInt64(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, ulong value)
    {
        SQLiteStatementHandle handle = stmt._sqlite_stmt;

#if !PLATFORM_COMPACTFRAMEWORK
        if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind)
        {
            LogBind(handle, index, value);
        }

        SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_uint64(handle, index, value);
        int n = UnsafeNativeMethods.sqlite3_bind_uint64(handle, index, value);
#else
        SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_uint64_interop(handle, index, ref value);
        int n = UnsafeNativeMethods.sqlite3_bind_uint64_interop(handle, index, ref value);
#endif
        if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError());
        if (n > 0) throw new SQLiteException(n, SQLiteLastError());
    }

    internal override void Bind_Text(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, string value)
    {
        SQLiteStatementHandle handle = stmt._sqlite_stmt;

#if !PLATFORM_COMPACTFRAMEWORK
757
758
759
760
761
762
763
764
765


766
767
768
769
770
771
772
671
672
673
674
675
676
677


678
679
680
681
682
683
684
685
686







-
-
+
+







#if !PLATFORM_COMPACTFRAMEWORK
        if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind)
        {
            LogBind(handle, index, b);
        }
#endif

        SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_text(handle, index, b, b.Length - 1, (IntPtr)(-1));
        if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError());
        int n = UnsafeNativeMethods.sqlite3_bind_text(handle, index, b, b.Length - 1, (IntPtr)(-1));
        if (n > 0) throw new SQLiteException(n, SQLiteLastError());
    }

    internal override void Bind_DateTime(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, DateTime dt)
    {
        SQLiteStatementHandle handle = stmt._sqlite_stmt;

#if !PLATFORM_COMPACTFRAMEWORK
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
698
699
700
701
702
703
704

705
706

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
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







-
+

-
+

-
+












-
+

-
+

-
+












-
+

-
+

-
+













-
-
+
+
















-
-
+
+













-
-
+
+












-
+








#if !PLATFORM_COMPACTFRAMEWORK
                    if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind)
                    {
                        LogBind(handle, index, value);
                    }

                    SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_int64(handle, index, value);
                    int n = UnsafeNativeMethods.sqlite3_bind_int64(handle, index, value);
#else
                    SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_int64_interop(handle, index, ref value);
                    int n = UnsafeNativeMethods.sqlite3_bind_int64_interop(handle, index, ref value);
#endif
                    if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError());
                    if (n > 0) throw new SQLiteException(n, SQLiteLastError());
                    break;
                }
            case SQLiteDateFormats.JulianDay:
                {
                    double value = ToJulianDay(dt);

#if !PLATFORM_COMPACTFRAMEWORK
                    if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind)
                    {
                        LogBind(handle, index, value);
                    }

                    SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_double(handle, index, value);
                    int n = UnsafeNativeMethods.sqlite3_bind_double(handle, index, value);
#else
                    SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_double_interop(handle, index, ref value);
                    int n = UnsafeNativeMethods.sqlite3_bind_double_interop(handle, index, ref value);
#endif
                    if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError());
                    if (n > 0) throw new SQLiteException(n, SQLiteLastError());
                    break;
                }
            case SQLiteDateFormats.UnixEpoch:
                {
                    long value = Convert.ToInt64(dt.Subtract(UnixEpoch).TotalSeconds);

#if !PLATFORM_COMPACTFRAMEWORK
                    if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind)
                    {
                        LogBind(handle, index, value);
                    }

                    SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_int64(handle, index, value);
                    int n = UnsafeNativeMethods.sqlite3_bind_int64(handle, index, value);
#else
                    SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_int64_interop(handle, index, ref value);
                    int n = UnsafeNativeMethods.sqlite3_bind_int64_interop(handle, index, ref value);
#endif
                    if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError());
                    if (n > 0) throw new SQLiteException(n, SQLiteLastError());
                    break;
                }
            default:
                {
                    byte[] b = ToUTF8(dt);

#if !PLATFORM_COMPACTFRAMEWORK
                    if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind)
                    {
                        LogBind(handle, index, b);
                    }
#endif

                    SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_text(handle, index, b, b.Length - 1, (IntPtr)(-1));
                    if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError());
                    int n = UnsafeNativeMethods.sqlite3_bind_text(handle, index, b, b.Length - 1, (IntPtr)(-1));
                    if (n > 0) throw new SQLiteException(n, SQLiteLastError());
                    break;
                }
        }
    }

    internal override void Bind_Blob(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, byte[] blobData)
    {
        SQLiteStatementHandle handle = stmt._sqlite_stmt;

#if !PLATFORM_COMPACTFRAMEWORK
        if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind)
        {
            LogBind(handle, index, blobData);
        }
#endif

        SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_blob(handle, index, blobData, blobData.Length, (IntPtr)(-1));
        if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError());
        int n = UnsafeNativeMethods.sqlite3_bind_blob(handle, index, blobData, blobData.Length, (IntPtr)(-1));
        if (n > 0) throw new SQLiteException(n, SQLiteLastError());
    }

    internal override void Bind_Null(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index)
    {
        SQLiteStatementHandle handle = stmt._sqlite_stmt;

#if !PLATFORM_COMPACTFRAMEWORK
        if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind)
        {
            LogBind(handle, index);
        }
#endif

        SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_null(handle, index);
        if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError());
        int n = UnsafeNativeMethods.sqlite3_bind_null(handle, index);
        if (n > 0) throw new SQLiteException(n, SQLiteLastError());
    }

    internal override int Bind_ParamCount(SQLiteStatement stmt, SQLiteConnectionFlags flags)
    {
        SQLiteStatementHandle handle = stmt._sqlite_stmt;
        int value = UnsafeNativeMethods.sqlite3_bind_parameter_count(handle);

#if !PLATFORM_COMPACTFRAMEWORK
        if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind)
        {
            IntPtr handleIntPtr = handle;

            SQLiteLog.LogMessage(String.Format(
            SQLiteLog.LogMessage(0, String.Format(
                "Statement {0} paramter count is {1}.",
                handleIntPtr, value));
        }
#endif

        return value;
    }
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
940
941
942
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







-
+


















-
+







#endif

#if !PLATFORM_COMPACTFRAMEWORK
        if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind)
        {
            IntPtr handleIntPtr = handle;

            SQLiteLog.LogMessage(String.Format(
            SQLiteLog.LogMessage(0, String.Format(
                "Statement {0} paramter #{1} name is {{{2}}}.",
                handleIntPtr, index, name));
        }
#endif

        return name;
    }

    internal override int Bind_ParamIndex(SQLiteStatement stmt, SQLiteConnectionFlags flags, string paramName)
    {
        SQLiteStatementHandle handle = stmt._sqlite_stmt;
        int index = UnsafeNativeMethods.sqlite3_bind_parameter_index(handle, ToUTF8(paramName));

#if !PLATFORM_COMPACTFRAMEWORK
        if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind)
        {
            IntPtr handleIntPtr = handle;

            SQLiteLog.LogMessage(String.Format(
            SQLiteLog.LogMessage(0, String.Format(
                "Statement {0} paramter index of name {{{1}}} is #{2}.",
                handleIntPtr, paramName, index));
        }
#endif

        return index;
    }
1042
1043
1044
1045
1046
1047
1048
1049

1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061

1062
1063
1064
1065
1066
1067
1068
956
957
958
959
960
961
962

963
964
965
966
967
968
969
970
971
972
973
974

975
976
977
978
979
980
981
982







-
+











-
+







    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 nnotNull;
      int nprimaryKey;
      int nautoInc;
      SQLiteErrorCode n;
      int n;
      int dtLen;
      int csLen;

#if !SQLITE_STANDARD
      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);
#else
      dtLen = -1;
      csLen = -1;

      n = UnsafeNativeMethods.sqlite3_table_column_metadata(_sql, ToUTF8(dataBase), ToUTF8(table), ToUTF8(column), out dataTypePtr, out collSeqPtr, out nnotNull, out nprimaryKey, out nautoInc);
#endif
      if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError());
      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);
1169
1170
1171
1172
1173
1174
1175
1176

1177
1178
1179
1180

1181
1182
1183

1184
1185

1186
1187
1188
1189
1190
1191
1192



1193
1194
1195
1196
1197
1198
1199
1083
1084
1085
1086
1087
1088
1089

1090
1091
1092
1093

1094
1095
1096

1097
1098

1099
1100
1101
1102
1103



1104
1105
1106
1107
1108
1109
1110
1111
1112
1113







-
+



-
+


-
+

-
+




-
-
-
+
+
+







    internal override int AggregateCount(IntPtr context)
    {
      return UnsafeNativeMethods.sqlite3_aggregate_count(context);
    }

    internal override void CreateFunction(string strFunction, int nArgs, bool needCollSeq, SQLiteCallback func, SQLiteCallback funcstep, SQLiteFinalCallback funcfinal)
    {
      SQLiteErrorCode n;
      int n;

#if !SQLITE_STANDARD
      n = UnsafeNativeMethods.sqlite3_create_function_interop(_sql, ToUTF8(strFunction), nArgs, 4, IntPtr.Zero, func, funcstep, funcfinal, (needCollSeq == true) ? 1 : 0);
      if (n == SQLiteErrorCode.Ok) n = UnsafeNativeMethods.sqlite3_create_function_interop(_sql, ToUTF8(strFunction), nArgs, 1, IntPtr.Zero, func, funcstep, funcfinal, (needCollSeq == true) ? 1 : 0);
      if (n == 0) n = UnsafeNativeMethods.sqlite3_create_function_interop(_sql, ToUTF8(strFunction), nArgs, 1, IntPtr.Zero, func, funcstep, funcfinal, (needCollSeq == true) ? 1 : 0);
#else
      n = UnsafeNativeMethods.sqlite3_create_function(_sql, ToUTF8(strFunction), nArgs, 4, IntPtr.Zero, func, funcstep, funcfinal);
      if (n == SQLiteErrorCode.Ok) n = UnsafeNativeMethods.sqlite3_create_function(_sql, ToUTF8(strFunction), nArgs, 1, IntPtr.Zero, func, funcstep, funcfinal);
      if (n == 0) n = UnsafeNativeMethods.sqlite3_create_function(_sql, ToUTF8(strFunction), nArgs, 1, IntPtr.Zero, func, funcstep, funcfinal);
#endif
      if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError());
      if (n > 0) throw new SQLiteException(n, SQLiteLastError());
    }

    internal override void CreateCollation(string strCollation, SQLiteCollation func, SQLiteCollation func16)
    {
      SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_create_collation(_sql, ToUTF8(strCollation), 2, IntPtr.Zero, func16);
      if (n == SQLiteErrorCode.Ok) n = UnsafeNativeMethods.sqlite3_create_collation(_sql, ToUTF8(strCollation), 1, IntPtr.Zero, func);
      if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError());
      int n = UnsafeNativeMethods.sqlite3_create_collation(_sql, ToUTF8(strCollation), 2, IntPtr.Zero, func16);
      if (n == 0) n = UnsafeNativeMethods.sqlite3_create_collation(_sql, ToUTF8(strCollation), 1, IntPtr.Zero, func);
      if (n > 0) throw new SQLiteException(n, SQLiteLastError());
    }

    internal override int ContextCollateCompare(CollationEncodingEnum enc, IntPtr context, string s1, string s2)
    {
#if !SQLITE_STANDARD
      byte[] b1;
      byte[] b2;
1389
1390
1391
1392
1393
1394
1395
1396

1397
1398
1399
1400
1401

1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416


1417
1418
1419
1420
1421
1422


1423
1424
1425
1426
1427
1428
1429
1430
1431
1303
1304
1305
1306
1307
1308
1309

1310
1311
1312
1313
1314

1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325

1326
1327


1328
1329
1330
1331
1332
1333


1334
1335
1336

1337
1338
1339
1340
1341
1342
1343







-
+




-
+










-


-
-
+
+




-
-
+
+

-








    /// Enables or disabled extended result codes returned by SQLite
    internal override void SetExtendedResultCodes(bool bOnOff)
    {
      UnsafeNativeMethods.sqlite3_extended_result_codes(_sql, (bOnOff ? -1 : 0));
    }
    /// Gets the last SQLite error code
    internal override SQLiteErrorCode ResultCode()
    internal override int ResultCode()
    {
      return UnsafeNativeMethods.sqlite3_errcode(_sql);
    }
    /// Gets the last SQLite extended error code
    internal override SQLiteErrorCode ExtendedResultCode()
    internal override int ExtendedResultCode()
    {
      return UnsafeNativeMethods.sqlite3_extended_errcode(_sql);
    }

    /// Add a log message via the SQLite sqlite3_log interface.
    internal override void LogMessage(int iErrCode, string zMessage)
    {
      UnsafeNativeMethods.sqlite3_log(iErrCode, ToUTF8(zMessage));
    }

#if INTEROP_CODEC
    internal override void SetPassword(byte[] passwordBytes)
    {
      SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_key(_sql, passwordBytes, passwordBytes.Length);
      if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError());
      int n = UnsafeNativeMethods.sqlite3_key(_sql, passwordBytes, passwordBytes.Length);
      if (n > 0) throw new SQLiteException(n, SQLiteLastError());
    }

    internal override void ChangePassword(byte[] newPasswordBytes)
    {
      SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_rekey(_sql, newPasswordBytes, (newPasswordBytes == null) ? 0 : newPasswordBytes.Length);
      if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError());
      int n = UnsafeNativeMethods.sqlite3_rekey(_sql, newPasswordBytes, (newPasswordBytes == null) ? 0 : newPasswordBytes.Length);
      if (n > 0) throw new SQLiteException(n, SQLiteLastError());
    }
#endif

    internal override void SetUpdateHook(SQLiteUpdateCallback func)
    {
      UnsafeNativeMethods.sqlite3_update_hook(_sql, func, IntPtr.Zero);
    }

    internal override void SetCommitHook(SQLiteCommitCallback func)
1446
1447
1448
1449
1450
1451
1452
1453

1454
1455
1456


1457
1458
1459
1460
1461
1462
1463
1358
1359
1360
1361
1362
1363
1364

1365
1366


1367
1368
1369
1370
1371
1372
1373
1374
1375







-
+

-
-
+
+







    /// <summary>
    /// Allows the setting of a logging callback invoked by SQLite when a
    /// log event occurs.  Only one callback may be set.  If NULL is passed,
    /// the logging callback is unregistered.
    /// </summary>
    /// <param name="func">The callback function to invoke.</param>
    /// <returns>Returns a result code</returns>
    internal override SQLiteErrorCode SetLogCallback(SQLiteLogCallback func)
    internal override int SetLogCallback(SQLiteLogCallback func)
    {
        SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3_config_log(
            SQLiteConfigOpsEnum.SQLITE_CONFIG_LOG, func, IntPtr.Zero);
        int rc = UnsafeNativeMethods.sqlite3_config(
            (int)SQLiteConfigOpsEnum.SQLITE_CONFIG_LOG, func, (IntPtr)0);

        return rc;
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
1508
1509
1510
1511
1512
1513
1514
1515

1516
1517
1518
1519

1520
1521
1522
1523
1524
1525
1526
1420
1421
1422
1423
1424
1425
1426

1427
1428
1429


1430
1431
1432
1433
1434
1435
1436
1437







-
+


-
-
+







        byte[] zDestName = ToUTF8(destName);
        byte[] zSourceName = ToUTF8(sourceName);

        IntPtr backup = UnsafeNativeMethods.sqlite3_backup_init(
            destHandle, zDestName, sourceHandle, zSourceName);

        if (backup == IntPtr.Zero)
            throw new SQLiteException(ResultCode(), GetLastError());
            throw new SQLiteException(ResultCode(), SQLiteLastError());

        return new SQLiteBackup(
            this, new SQLiteBackupHandle(destHandle, backup),
            destHandle, zDestName, sourceHandle, zSourceName);
            this, backup, destHandle, zDestName, sourceHandle, zSourceName);
    }

    /// <summary>
    /// Copies up to N pages from the source database to the destination
    /// database associated with the specified backup object.
    /// </summary>
    /// <param name="backup">The backup object to use.</param>
1547
1548
1549
1550
1551
1552
1553
1554


1555
1556

1557
1558
1559

1560
1561
1562
1563



1564

1565
1566
1567

1568
1569
1570
1571
1572
1573
1574
1575
1576
1577

1578
1579
1580
1581
1582
1583

1584
1585
1586
1587
1588
1589
1590
1458
1459
1460
1461
1462
1463
1464

1465
1466
1467

1468



1469




1470
1471
1472
1473
1474
1475
1476

1477
1478
1479
1480
1481






1482
1483
1484
1485
1486
1487

1488
1489
1490
1491
1492
1493
1494
1495







-
+
+

-
+
-
-
-
+
-
-
-
-
+
+
+

+


-
+




-
-
-
-
-
-
+





-
+








        SQLiteBackupHandle handle = backup._sqlite_backup;

        if (handle == null)
            throw new InvalidOperationException(
                "Backup object has an invalid handle.");

        IntPtr handlePtr = handle;
        int n = UnsafeNativeMethods.sqlite3_backup_step(handle, nPage);
        backup._stepResult = n; /* NOTE: Save for use by FinishBackup. */

        if (handlePtr == IntPtr.Zero)
        if (n == (int)SQLiteErrorCode.Ok)
            throw new InvalidOperationException(
                "Backup object has an invalid handle pointer.");

        {
        SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_backup_step(handlePtr, nPage);
        backup._stepResult = n; /* NOTE: Save for use by FinishBackup. */

        if (n == SQLiteErrorCode.Ok)
            return true;
        }
        else if (n == (int)SQLiteErrorCode.Busy)
        {
            retry = true;
            return true;
        }
        else if (n == SQLiteErrorCode.Busy)
        else if (n == (int)SQLiteErrorCode.Locked)
        {
            retry = true;
            return true;
        }
        else if (n == SQLiteErrorCode.Locked)
        {
            retry = true;
            return true;
        }
        else if (n == SQLiteErrorCode.Done)
        else if (n == (int)SQLiteErrorCode.Done)
        {
            return false;
        }
        else
        {
            throw new SQLiteException(n, GetLastError());
            throw new SQLiteException(n, SQLiteLastError());
        }
    }

    /// <summary>
    /// Returns the number of pages remaining to be copied from the source
    /// database to the destination database associated with the specified
    /// backup object.
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613

1614
1615
1616
1617
1618
1619
1620
1505
1506
1507
1508
1509
1510
1511







1512
1513
1514
1515
1516
1517
1518
1519







-
-
-
-
-
-
-
+








        SQLiteBackupHandle handle = backup._sqlite_backup;

        if (handle == null)
            throw new InvalidOperationException(
                "Backup object has an invalid handle.");

        IntPtr handlePtr = handle;

        if (handlePtr == IntPtr.Zero)
            throw new InvalidOperationException(
                "Backup object has an invalid handle pointer.");

        return UnsafeNativeMethods.sqlite3_backup_remaining(handlePtr);
        return UnsafeNativeMethods.sqlite3_backup_remaining(handle);
    }

    /// <summary>
    /// Returns the total number of pages in the source database associated
    /// with the specified backup object.
    /// </summary>
    /// <param name="backup">The backup object to check.</param>
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641

1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668

1669
1670
1671
1672


1673
1674
1675
1676
1677
1678
1679
1527
1528
1529
1530
1531
1532
1533







1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554







1555
1556
1557


1558
1559
1560
1561
1562
1563
1564
1565
1566







-
-
-
-
-
-
-
+




















-
-
-
-
-
-
-
+


-
-
+
+








        SQLiteBackupHandle handle = backup._sqlite_backup;

        if (handle == null)
            throw new InvalidOperationException(
                "Backup object has an invalid handle.");

        IntPtr handlePtr = handle;

        if (handlePtr == IntPtr.Zero)
            throw new InvalidOperationException(
                "Backup object has an invalid handle pointer.");

        return UnsafeNativeMethods.sqlite3_backup_pagecount(handlePtr);
        return UnsafeNativeMethods.sqlite3_backup_pagecount(handle);
    }

    /// <summary>
    /// Destroys the backup object, rolling back any backup that may be in
    /// progess.
    /// </summary>
    /// <param name="backup">The backup object to destroy.</param>
    internal override void FinishBackup(
        SQLiteBackup backup
        )
    {
        if (backup == null)
            throw new ArgumentNullException("backup");

        SQLiteBackupHandle handle = backup._sqlite_backup;

        if (handle == null)
            throw new InvalidOperationException(
                "Backup object has an invalid handle.");

        IntPtr handlePtr = handle;

        if (handlePtr == IntPtr.Zero)
            throw new InvalidOperationException(
                "Backup object has an invalid handle pointer.");

        SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_backup_finish(handlePtr);
        int n = UnsafeNativeMethods.sqlite3_backup_finish(handle);
        handle.SetHandleAsInvalid();

        if ((n != SQLiteErrorCode.Ok) && (n != backup._stepResult))
            throw new SQLiteException(n, GetLastError());
        if ((n > 0) && (n != backup._stepResult))
            throw new SQLiteException(n, SQLiteLastError());
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Determines if the SQLite core library has been initialized for the
    /// current process.
1716
1717
1718
1719
1720
1721
1722
1723
1724


1725
1726

1727
1728
1729
1730
1731
1732
1733
1603
1604
1605
1606
1607
1608
1609


1610
1611
1612

1613
1614
1615
1616
1617
1618
1619
1620







-
-
+
+

-
+







#endif
                //
                // NOTE: This method [ab]uses the fact that SQLite will always
                //       return SQLITE_ERROR for any unknown configuration option
                //       *unless* the SQLite library has already been initialized.
                //       In that case it will always return SQLITE_MISUSE.
                //
                SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3_config_none(
                    SQLiteConfigOpsEnum.SQLITE_CONFIG_NONE);
                int rc = UnsafeNativeMethods.sqlite3_config(
                    (int)SQLiteConfigOpsEnum.SQLITE_CONFIG_NONE, null, (IntPtr)0);

                return (rc == SQLiteErrorCode.Misuse);
                return (rc == /* SQLITE_MISUSE */ 21);
#if !PLATFORM_COMPACTFRAMEWORK
            }
            finally
            {
                SQLiteLog.Enabled = savedEnabled;
            }
#endif
1791
1792
1793
1794
1795
1796
1797
1798
1799


1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812

1813
1814
1815

1816
1817
1818
1819
1820
1821
1822
1823
1824
1825

1826
1827
1828
1829
1830
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
1709
1710
1711

1712
1713
1714
1715
1716
1717







-
-
+
+












-
+


-
+









-
+





#endif
    }

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

      return 0;
#else
      return 0;
#endif
    }

    internal override void GetIndexColumnExtendedInfo(string database, string index, string column, out int sortMode, out int onError, out string collationSequence)
    {
#if !SQLITE_STANDARD
      IntPtr coll;
      int colllen;
      SQLiteErrorCode rc;
      int rc;

      rc = UnsafeNativeMethods.sqlite3_index_column_info_interop(_sql, ToUTF8(database), ToUTF8(index), ToUTF8(column), out sortMode, out onError, out coll, out colllen);
      if (rc != SQLiteErrorCode.Ok) throw new SQLiteException(rc, null);
      if (rc != 0) throw new SQLiteException(rc, "");

      collationSequence = UTF8ToString(coll, colllen);
#else
      sortMode = 0;
      onError = 2;
      collationSequence = "BINARY";
#endif
    }

    internal override SQLiteErrorCode FileControl(string zDbName, int op, IntPtr pArg)
    internal override int FileControl(string zDbName, int op, IntPtr pArg)
    {
      return UnsafeNativeMethods.sqlite3_file_control(_sql, (zDbName != null) ? ToUTF8(zDbName) : null, op, pArg);
    }
  }
}
Changes to System.Data.SQLite/SQLite3_UTF16.cs.
1
2
3
4
5
6
7
8
9
10
11

12
13
14
15
16
17
18
19
20
21
22
1
2
3
4
5
6
7
8
9
10

11

12
13

14
15
16
17
18
19
20










-
+
-


-







/********************************************************
 * 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;

#if DEBUG
#if !NET_COMPACT_20 && TRACE_CONNECTION
  using System.Diagnostics;
#endif

  using System.Runtime.InteropServices;

  /// <summary>
  /// Alternate SQLite3 object, overriding many text behaviors to support UTF-16 (Unicode)
  /// </summary>
  internal class SQLite3_UTF16 : SQLite3
  {
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
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







-
-


+

-
-
-
-







-
+




-
+


-
+



-
+

-
+
-


-
-







    }

    internal override void Open(string strFilename, SQLiteConnectionFlags connectionFlags, SQLiteOpenFlagsEnum openFlags, int maxPoolSize, bool usePool)
    {
      if (_sql != null) return;

      _usePool = usePool;
      _fileName = strFilename;

      if (usePool)
      {
        _fileName = strFilename;
        _sql = SQLiteConnectionPool.Remove(strFilename, maxPoolSize, out _poolVersion);

#if !NET_COMPACT_20 && TRACE_CONNECTION
        Trace.WriteLine(String.Format("Open (Pool): {0}", (_sql != null) ? _sql.ToString() : "<null>"));
#endif
      }

      if (_sql == null)
      {
        IntPtr db;

#if !SQLITE_STANDARD
        SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_open16_interop(ToUTF8(strFilename), (int)openFlags, out db);
        int n = UnsafeNativeMethods.sqlite3_open16_interop(ToUTF8(strFilename), (int)openFlags, out db);
#else
        if ((openFlags & SQLiteOpenFlagsEnum.Create) == 0 && System.IO.File.Exists(strFilename) == false)
          throw new SQLiteException((int)SQLiteErrorCode.CantOpen, strFilename);

        SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_open16(strFilename, out db);
        int n = UnsafeNativeMethods.sqlite3_open16(strFilename, out db);
#endif

#if !NET_COMPACT_20 && TRACE_CONNECTION
#if DEBUG && !NET_COMPACT_20
        Trace.WriteLine(String.Format("Open: {0}", db));
#endif

        if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, null);
        if (n > 0) throw new SQLiteException(n, null);

        _sql = new SQLiteConnectionHandle(db);
        _sql = db;
        lock (_sql) { /* HACK: Force the SyncBlock to be "created" now. */ }
      }
      _functionsArray = SQLiteFunction.BindFunctions(this, connectionFlags);
      SetTimeout(0);
      GC.KeepAlive(_sql);
    }

    internal override void Bind_DateTime(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, DateTime dt)
    {
        switch (_datetimeFormat)
        {
            case SQLiteDateFormats.Ticks:
169
170
171
172
173
174
175
176
177


178
179
180
181
182
183
184
159
160
161
162
163
164
165


166
167
168
169
170
171
172
173
174







-
-
+
+







#if !PLATFORM_COMPACTFRAMEWORK
        if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind)
        {
            LogBind(handle, index, value);
        }
#endif

        SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_text16(handle, index, value, value.Length * 2, (IntPtr)(-1));
        if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError());
        int n = UnsafeNativeMethods.sqlite3_bind_text16(handle, index, value, value.Length * 2, (IntPtr)(-1));
        if (n > 0) throw new SQLiteException(n, SQLiteLastError());
    }

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

Changes to System.Data.SQLite/SQLiteBackup.cs.
46
47
48
49
50
51
52
53

54
55
56
57
58
59
60
46
47
48
49
50
51
52

53
54
55
56
57
58
59
60







-
+








        /// <summary>
        /// The last result from the StepBackup method of the SQLite3 class.
        /// This is used to determine if the call to the FinishBackup method of
        /// the SQLite3 class should throw an exception when it receives a non-Ok
        /// return code from the core SQLite library.
        /// </summary>
        internal SQLiteErrorCode _stepResult;
        internal int _stepResult;

        /// <summary>
        /// Initializes the backup.
        /// </summary>
        /// <param name="sqlbase">The base SQLite object.</param>
        /// <param name="backup">The backup handle.</param>
        /// <param name="destDb">The destination database for the backup.</param>
Changes to System.Data.SQLite/SQLiteBase.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
52
53
54
55
56
57
58
59

60
61
62
63
64
65
66
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











-
-
-
-








+
+














-
+
-




-



-
-
-
-
-
-
-
-



-
+







/********************************************************
 * 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;

#if !PLATFORM_COMPACTFRAMEWORK
  using System.Runtime.InteropServices;
#endif

  /// <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>
  internal abstract class SQLiteBase : SQLiteConvert, IDisposable
  {
    internal SQLiteBase(SQLiteDateFormats fmt, DateTimeKind kind)
      : base(fmt, kind) { }

    static internal object _lock = new object();

    /// <summary>
    /// Returns a string representing the active version of SQLite
    /// </summary>
    internal abstract string Version { get; }
    /// <summary>
    /// Returns the rowid of the most recent successful INSERT into the database from this connection.
    /// </summary>
    internal abstract long LastInsertRowId { get; }
    /// <summary>
    /// Returns the number of changes the last executing insert/update caused.
    /// </summary>
    internal abstract int Changes { get; }
    /// <summary>
    /// Returns the amount of memory (in bytes) currently in use by the SQLite core library.  This is not really a per-connection
    /// Returns the amount of memory (in bytes) currently in use by the SQLite core library.
    /// value, it is global to the process.
    /// </summary>
    internal abstract long MemoryUsed { get; }
    /// <summary>
    /// Returns the maximum amount of memory (in bytes) used by the SQLite core library since the high-water mark was last reset.
    /// This is not really a per-connection value, it is global to the process.
    /// </summary>
    internal abstract long MemoryHighwater { get; }
    /// <summary>
    /// Sets the status of the memory usage tracking subsystem in the SQLite core library.  By default, this is enabled.
    /// If this is disabled, memory usage tracking will not be performed.  This is not really a per-connection value, it is
    /// global to the process.
    /// </summary>
    /// <param name="value">Non-zero to enable memory usage tracking, zero otherwise.</param>
    /// <returns>A standard SQLite return code (i.e. zero for success and non-zero for failure).</returns>
    internal abstract SQLiteErrorCode SetMemoryStatus(bool value);
    /// <summary>
    /// Shutdown the SQLite engine so that it can be restarted with different config options.
    /// We depend on auto initialization to recover.
    /// </summary>
    internal abstract SQLiteErrorCode Shutdown();
    internal abstract int Shutdown();
    /// <summary>
    /// Returns non-zero if a database connection is open.
    /// </summary>
    /// <returns></returns>
    internal abstract bool IsOpen();
    /// <summary>
    /// Opens a database.
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
76
77
78
79
80
81
82

83
84
85
86
87
88
89






90
91
92
93
94
95
96







-
+






-
-
-
-
-
-







    /// </summary>
    /// <param name="nTimeoutMS">The number of milliseconds to wait before returning SQLITE_BUSY</param>
    internal abstract void SetTimeout(int nTimeoutMS);
    /// <summary>
    /// Returns the text of the last error issued by SQLite
    /// </summary>
    /// <returns></returns>
    internal abstract string GetLastError();
    internal abstract string SQLiteLastError();

    /// <summary>
    /// When pooling is enabled, force this connection to be disposed rather than returned to the pool
    /// </summary>
    internal abstract void ClearPool();

    /// <summary>
    /// When pooling is enabled, returns the number of pool entries matching the current file name.
    /// </summary>
    /// <returns>The number of pool entries matching the current file name.</returns>
    internal abstract int CountPool();

    /// <summary>
    /// Prepares a SQL statement for execution.
    /// </summary>
    /// <param name="cnn">The source connection preparing the command.  Can be null for any caller except LINQ</param>
    /// <param name="strSql">The SQL command text to prepare</param>
    /// <param name="previous">The previous statement in a multi-statement command, or null if no previous statement exists</param>
    /// <param name="timeoutMS">The timeout to wait before aborting the prepare</param>
125
126
127
128
129
130
131
132

133
134
135
136
137
138
139
107
108
109
110
111
112
113

114
115
116
117
118
119
120
121







-
+







    internal abstract bool Step(SQLiteStatement stmt);
    /// <summary>
    /// Resets a prepared statement so it can be executed again.  If the error returned is SQLITE_SCHEMA, 
    /// transparently attempt to rebuild the SQL statement and throw an error if that was not possible.
    /// </summary>
    /// <param name="stmt">The statement to reset</param>
    /// <returns>Returns -1 if the schema changed while resetting, 0 if the reset was sucessful or 6 (SQLITE_LOCKED) if the reset failed due to a lock</returns>
    internal abstract SQLiteErrorCode Reset(SQLiteStatement stmt);
    internal abstract int Reset(SQLiteStatement stmt);
    internal abstract void Cancel();

    internal abstract void Bind_Double(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, double value);
    internal abstract void Bind_Int32(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, Int32 value);
    internal abstract void Bind_UInt32(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, UInt32 value);
    internal abstract void Bind_Int64(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, Int64 value);
    internal abstract void Bind_UInt64(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, UInt64 value);
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
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







-
+





-
+











-


-





-
+
-
-
-
-
-
-
-
-












-
+







    /// <returns></returns>
    internal abstract void SetExtendedResultCodes(bool bOnOff);
    /// <summary>
    /// Returns the numeric result code for the most recent failed SQLite API call 
    /// associated with the database connection. 
    /// </summary>
    /// <returns>Result code</returns>
    internal abstract SQLiteErrorCode ResultCode();
    internal abstract int ResultCode();
    /// <summary>
    /// Returns the extended numeric result code for the most recent failed SQLite API call 
    /// associated with the database connection. 
    /// </summary>
    /// <returns>Extended result code</returns>
    internal abstract SQLiteErrorCode ExtendedResultCode();
    internal abstract int ExtendedResultCode();

    /// <summary>
    /// Add a log message via the SQLite sqlite3_log interface.
    /// </summary>
    /// <param name="iErrCode">Error code to be logged with the message.</param>
    /// <param name="zMessage">String to be logged.  Unlike the SQLite sqlite3_log() 
    /// interface, this should be pre-formatted.  Consider using the 
    /// String.Format() function.</param>
    /// <returns></returns>
    internal abstract void LogMessage(int iErrCode, string zMessage);

#if INTEROP_CODEC
    internal abstract void SetPassword(byte[] passwordBytes);
    internal abstract void ChangePassword(byte[] newPasswordBytes);
#endif

    internal abstract void SetUpdateHook(SQLiteUpdateCallback func);
    internal abstract void SetCommitHook(SQLiteCommitCallback func);
    internal abstract void SetTraceCallback(SQLiteTraceCallback func);
    internal abstract void SetRollbackHook(SQLiteRollbackCallback func);
    internal abstract SQLiteErrorCode SetLogCallback(SQLiteLogCallback func);
    internal abstract int SetLogCallback(SQLiteLogCallback func);

    /// <summary>
    /// Checks if the SQLite core library has been initialized in the current process.
    /// </summary>
    /// <returns>
    /// Non-zero if the SQLite core library has been initialized in the current process,
    /// zero otherwise.
    /// </returns>
    internal abstract bool IsInitialized();

    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, SQLiteType typ);

    internal abstract bool AutoCommit
    {
      get;
    }

    internal abstract SQLiteErrorCode FileControl(string zDbName, int op, IntPtr pArg);
    internal abstract int FileControl(string zDbName, int op, IntPtr pArg);

    /// <summary>
    /// Creates a new SQLite backup object based on the provided destination
    /// database connection.  The source database connection is the one
    /// associated with this object.  The source and destination database
    /// connections cannot be the same.
    /// </summary>
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
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







-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+

-
-
-
-
-
-
-
-

-
-
+
+

-
+

-
+

-
-
-
-
-
-
+

-
-
+

-
-
+
+
+



-
+

-
-
-
+
+

-
+

-
+

-
-
+
+

-
-
-
-
-
-
+
+
+
+
+

-
+

-
+
-
-
-
-
-
-
-
-
-
-
+
-

-
-
+
+


-
+

-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+

-
+

-
+

-
-
+
+

-
-
-
-
-
-
+
+
+
+
+
+
-


-
+

-
-
-
-
-
-
+
+
-
-
-
-
+














-







    ///////////////////////////////////////////////////////////////////////////////////////////////

    // 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.

    ///////////////////////////////////////////////////////////////////////////////////////////////

    private static string[] _errorMessages = {
        /* SQLITE_OK          */ "not an error",
        /* SQLITE_ERROR       */ "SQL logic error or missing database",
        /* SQLITE_INTERNAL    */ "internal logic error",
        /* SQLITE_PERM        */ "access permission denied",
        /* SQLITE_ABORT       */ "callback requested query abort",
        /* SQLITE_BUSY        */ "database is locked",
        /* SQLITE_LOCKED      */ "database table is locked",
        /* SQLITE_NOMEM       */ "out of memory",
        /* SQLITE_READONLY    */ "attempt to write a readonly database",
        /* SQLITE_INTERRUPT   */ "interrupted",
        /* SQLITE_IOERR       */ "disk I/O error",
        /* SQLITE_CORRUPT     */ "database disk image is malformed",
        /* SQLITE_NOTFOUND    */ "unknown operation",
        /* SQLITE_FULL        */ "database or disk is full",
        /* SQLITE_CANTOPEN    */ "unable to open database file",
        /* SQLITE_PROTOCOL    */ "locking protocol",
        /* SQLITE_EMPTY       */ "table contains no data",
        /* SQLITE_SCHEMA      */ "database schema has changed",
        /* SQLITE_TOOBIG      */ "string or blob too big",
        /* SQLITE_CONSTRAINT  */ "constraint failed",
        /* SQLITE_MISMATCH    */ "datatype mismatch",
        /* SQLITE_MISUSE      */ "library routine called out of sequence",
        /* SQLITE_NOLFS       */ "large file support is disabled",
        /* SQLITE_AUTH        */ "authorization denied",
        /* SQLITE_FORMAT      */ "auxiliary database format error",
        /* SQLITE_RANGE       */ "bind or column index out of range",
        /* SQLITE_NOTADB      */ "file is encrypted or is not a database"
    };

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Returns the error message for the specified SQLite return code using
    /// the internal static lookup table.
    /// </summary>
    /// <param name="rc">The SQLite return code.</param>
    /// <returns>The error message or null if it cannot be found.</returns>
    private static string FallbackGetErrorString(SQLiteErrorCode rc)
    {
        if (_errorMessages == null)
            return null;

        int index = (int)rc;

        if ((index < 0) || (index >= _errorMessages.Length))
            index = (int)SQLiteErrorCode.Error; /* Make into generic error. */

        return _errorMessages[index];
    }

    /// <summary>
    /// Returns the error message for the specified SQLite return code using
    /// the sqlite3_errstr() function, falling back to the internal lookup
    /// table if necessary.
    /// </summary>
    /// <param name="rc">The SQLite return code.</param>
    /// <returns>The error message or null if it cannot be found.</returns>
    internal static string GetErrorString(SQLiteErrorCode rc)
    {
        try
        {
            IntPtr ptr = UnsafeNativeMethods.sqlite3_errstr(rc);

            if (ptr != IntPtr.Zero)
            {
#if !PLATFORM_COMPACTFRAMEWORK
                return Marshal.PtrToStringAnsi(ptr);
#else
                return UTF8ToString(ptr, -1);
#endif
            }
        }
        catch (EntryPointNotFoundException)
        {
            // do nothing.
        }

        return FallbackGetErrorString(rc);
    }

    internal static string GetLastError(SQLiteConnectionHandle hdl, IntPtr db)
    internal static string SQLiteLastError(SQLiteConnectionHandle db)
    {
        if ((hdl == null) || (db == IntPtr.Zero))
            return "null connection or database handle";

        lock (hdl)
        {
            if (hdl.IsClosed || hdl.IsInvalid)
                return "closed or invalid connection handle";

#if !SQLITE_STANDARD
            int len;
            return UTF8ToString(UnsafeNativeMethods.sqlite3_errmsg_interop(db, out len), len);
      int len;
      return UTF8ToString(UnsafeNativeMethods.sqlite3_errmsg_interop(db, out len), len);
#else
            return UTF8ToString(UnsafeNativeMethods.sqlite3_errmsg(db), -1);
      return UTF8ToString(UnsafeNativeMethods.sqlite3_errmsg(db), -1);
#endif
        }
    }

#pragma warning disable 162
        GC.KeepAlive(hdl); /* NOTE: Unreachable code. */
#pragma warning restore 162
    }

    internal static void FinishBackup(SQLiteConnectionHandle hdl, IntPtr backup)
    internal static void FinishBackup(SQLiteBackupHandle backup)
    {
        if ((hdl == null) || (backup == IntPtr.Zero)) return;
        lock (hdl)
        lock (_lock)
        {
            SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_backup_finish(backup);
            if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, null);
            int n = UnsafeNativeMethods.sqlite3_backup_finish(backup);
            backup.SetHandleAsInvalid();
            if (n > 0) throw new SQLiteException(n, null);
        }
    }

    internal static void FinalizeStatement(SQLiteConnectionHandle hdl, IntPtr stmt)
    internal static void FinalizeStatement(SQLiteStatementHandle stmt)
    {
        if ((hdl == null) || (stmt == IntPtr.Zero)) return;
        lock (hdl)
        {
      lock (_lock)
      {
#if !SQLITE_STANDARD
            SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_finalize_interop(stmt);
        int n = UnsafeNativeMethods.sqlite3_finalize_interop(stmt);
#else
            SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_finalize(stmt);
      int n = UnsafeNativeMethods.sqlite3_finalize(stmt);
#endif
            if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, null);
        }
        if (n > 0) throw new SQLiteException(n, null);
      }
    }

    internal static void CloseConnection(SQLiteConnectionHandle hdl, IntPtr db)
    {
        if ((hdl == null) || (db == IntPtr.Zero)) return;
        lock (hdl)
        {

    internal static void CloseConnection(SQLiteConnectionHandle db)
    {
      lock (_lock)
      {
#if !SQLITE_STANDARD
            SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_close_interop(db);
        int n = UnsafeNativeMethods.sqlite3_close_interop(db);
#else
            ResetConnection(hdl, db);
      ResetConnection(db);

            SQLiteErrorCode n;

            try
            {
                n = UnsafeNativeMethods.sqlite3_close_v2(db);
            }
            catch (EntryPointNotFoundException)
            {
                n = UnsafeNativeMethods.sqlite3_close(db);
      int n = UnsafeNativeMethods.sqlite3_close(db);
            }
#endif
            if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError(hdl, db));
        }
        if (n > 0) throw new SQLiteException(n, SQLiteLastError(db));
      }
    }

    internal static void ResetConnection(SQLiteConnectionHandle hdl, IntPtr db)
    internal static void ResetConnection(SQLiteConnectionHandle db)
    {
        if ((hdl == null) || (db == IntPtr.Zero)) return;
        if (hdl.IsClosed || hdl.IsInvalid) return;
        lock (hdl)
        {
            IntPtr stmt = IntPtr.Zero;
            SQLiteErrorCode n;
            do
            {
                stmt = UnsafeNativeMethods.sqlite3_next_stmt(db, stmt);
                if (stmt != IntPtr.Zero)
                {
      lock (_lock)
      {
        IntPtr stmt = IntPtr.Zero;
        int n;
        do
        {
          stmt = UnsafeNativeMethods.sqlite3_next_stmt(db, stmt);
          if (stmt != IntPtr.Zero)
          {
#if !SQLITE_STANDARD
                    n = UnsafeNativeMethods.sqlite3_reset_interop(stmt);
            n = UnsafeNativeMethods.sqlite3_reset_interop(stmt);
#else
                    n = UnsafeNativeMethods.sqlite3_reset(stmt);
            n = UnsafeNativeMethods.sqlite3_reset(stmt);
#endif
                }
            } while (stmt != IntPtr.Zero);
          }
        } while (stmt != IntPtr.Zero);

            if (IsAutocommit(hdl, db) == false) // a transaction is pending on the connection
            {
                n = UnsafeNativeMethods.sqlite3_exec(db, ToUTF8("ROLLBACK"), IntPtr.Zero, IntPtr.Zero, out stmt);
                if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError(hdl, db));
            }
        }
        if (IsAutocommit(db) == false) // a transaction is pending on the connection
        {
          n = UnsafeNativeMethods.sqlite3_exec(db, ToUTF8("ROLLBACK"), IntPtr.Zero, IntPtr.Zero, out stmt);
          if (n > 0) throw new SQLiteException(n, SQLiteLastError(db));
        }
      }
        GC.KeepAlive(hdl);
    }

    internal static bool IsAutocommit(SQLiteConnectionHandle hdl, IntPtr db)
    internal static bool IsAutocommit(SQLiteConnectionHandle hdl)
    {
      if (db == IntPtr.Zero) return false;
      if (hdl.IsClosed || hdl.IsInvalid) return false;
      lock (hdl)
      {
          return (UnsafeNativeMethods.sqlite3_get_autocommit(db) == 1);
      }
      return (UnsafeNativeMethods.sqlite3_get_autocommit(hdl) == 1);
    }
#pragma warning disable 162
      GC.KeepAlive(hdl); /* NOTE: Unreachable code. */
#pragma warning restore 162
    }

  }

  internal interface ISQLiteSchemaExtensions
  {
    void BuildTempSchema(SQLiteConnection cnn);
  }

  [Flags]
  internal enum SQLiteOpenFlagsEnum
  {
    None = 0,
    ReadOnly = 0x01,
    ReadWrite = 0x02,
    Create = 0x04,
    Uri = 0x40,
    SharedCache = 0x01000000,
    Default = 0x06,
  }

  /// <summary>
  /// The extra behavioral flags that can be applied to a connection.
  /// </summary>
Changes to System.Data.SQLite/SQLiteCommand.cs.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19












-







/********************************************************
 * 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.Data;
  using System.Data.Common;
  using System.Diagnostics;
  using System.Collections.Generic;
  using System.ComponentModel;

  /// <summary>
  /// SQLite implementation of DbCommand.
  /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
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
139
140
141
142
143
144
145












146
147
148
149
150
151
152







-
-
-
-
-
-
-
-
-
-
-
-







        _commandTimeout = connection.DefaultTimeout;
      }

      if (transaction != null)
        Transaction = transaction;
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    [Conditional("CHECK_STATE")]
    internal static void Check(SQLiteCommand command)
    {
        if (command == null)
            throw new ArgumentNullException("command");

        command.CheckDisposed();
        SQLiteConnection.Check(command._cnn);
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    #region IDisposable "Pattern" Members
    private bool disposed;
    private void CheckDisposed() /* throw */
    {
#if THROW_ON_DISPOSED
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
335
336
337
338
339
340
341

342
343
344
345
346
347
348







-







    [DefaultValue(""), RefreshProperties(RefreshProperties.All), Editor("Microsoft.VSDesigner.Data.SQL.Design.SqlCommandTextEditor, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
#endif
    public override string CommandText
    {
      get
      {
        CheckDisposed();

        return _commandText;
      }
      set
      {
        CheckDisposed();

        if (_commandText == value) return;
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
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
671
672
673
674
675
676
677
678
679
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
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







-















-


















-
















-















-







    /// Overrides the default behavior to return a SQLiteDataReader specialization class
    /// </summary>
    /// <param name="behavior">The flags to be associated with the reader</param>
    /// <returns>A SQLiteDataReader</returns>
    public new SQLiteDataReader ExecuteReader(CommandBehavior behavior)
    {
      CheckDisposed();
      SQLiteConnection.Check(_cnn);
      InitializeForReader();

      SQLiteDataReader rd = new SQLiteDataReader(this, behavior);
      _activeReader = new WeakReference(rd, false);

      return rd;
    }

    /// <summary>
    /// Overrides the default behavior of DbDataReader to return a specialized SQLiteDataReader class
    /// </summary>
    /// <returns>A SQLiteDataReader</returns>
    public new SQLiteDataReader ExecuteReader()
    {
      CheckDisposed();
      SQLiteConnection.Check(_cnn);
      return ExecuteReader(CommandBehavior.Default);
    }

    /// <summary>
    /// Called by the SQLiteDataReader when the data reader is closed.
    /// </summary>
    internal void ClearDataReader()
    {
      _activeReader = null;
    }

    /// <summary>
    /// Execute the command and return the number of rows inserted/updated affected by it.
    /// </summary>
    /// <returns></returns>
    public override int ExecuteNonQuery()
    {
      CheckDisposed();
      SQLiteConnection.Check(_cnn);

      using (SQLiteDataReader reader = ExecuteReader(CommandBehavior.SingleRow | CommandBehavior.SingleResult))
      {
        while (reader.NextResult()) ;
        return reader.RecordsAffected;
      }
    }

    /// <summary>
    /// Execute the command and return the first column of the first row of the resultset
    /// (if present), or null if no resultset was returned.
    /// </summary>
    /// <returns>The first column of the first row of the first resultset from the query</returns>
    public override object ExecuteScalar()
    {
      CheckDisposed();
      SQLiteConnection.Check(_cnn);

      using (SQLiteDataReader reader = ExecuteReader(CommandBehavior.SingleRow | CommandBehavior.SingleResult))
      {
        if (reader.Read())
          return reader[0];
      }
      return null;
    }

    /// <summary>
    /// Does nothing.  Commands are prepared as they are executed the first time, and kept in prepared state afterwards.
    /// </summary>
    public override void Prepare()
    {
      CheckDisposed();
      SQLiteConnection.Check(_cnn);
    }

    /// <summary>
    /// Sets the method the SQLiteCommandBuilder uses to determine how to update inserted or updated rows in a DataTable.
    /// </summary>
    [DefaultValue(UpdateRowSource.None)]
    public override UpdateRowSource UpdatedRowSource
Changes to System.Data.SQLite/SQLiteCommandBuilder.cs.
Changes to System.Data.SQLite/SQLiteConnection.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
52

53
54
55
56
57
58
59
60
61
62
63
64
65
66
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



-
+








-




















-
+

















-
+
-
-
-
-
-
-
-







/********************************************************
 * 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.Data;
  using System.Data.Common;
  using System.Diagnostics;
  using System.Collections.Generic;
  using System.Globalization;
  using System.ComponentModel;
  using System.Runtime.InteropServices;
  using System.IO;

  /// <summary>
  /// SQLite implentation of DbConnection.
  /// </summary>
  /// <remarks>
  /// The <see cref="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>This may be a file name, the string ":memory:", or any supported URI (starting with SQLite 3.7.7).</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>
  /// <description><b>Ticks</b> - Use DateTime.Ticks<br/><b>ISO8601</b> - Use ISO8601 DateTime format</description>
  /// <b>Ticks</b> - Use the value of DateTime.Ticks.<br/>
  /// <b>ISO8601</b> - Use the ISO-8601 format.  Uses the "yyyy-MM-dd HH:mm:ss.FFFFFFFK" format for UTC
  /// DateTime values and "yyyy-MM-dd HH:mm:ss.FFFFFFF" format for local DateTime values).<br/>
  /// <b>JulianDay</b> - The interval of time in days and fractions of a day since January 1, 4713 BC.<br/>
  /// <b>UnixEpoch</b> - The whole number of seconds since the Unix epoch (January 1, 1970).<br/>
  /// <b>InvariantCulture</b> - Any culture-independent string value that the .NET Framework can interpret as a valid DateTime.<br/>
  /// <b>CurrentCulture</b> - Any string value that the .NET Framework can interpret as a valid DateTime using the current culture.</description>
  /// <description>N</description>
  /// <description>ISO8601</description>
  /// </item>
  /// <item>
  /// <description>DateTimeKind</description>
  /// <description><b>Unspecified</b> - Not specified as either UTC or local time.<br/><b>Utc</b> - The time represented is UTC.<br/><b>Local</b> - The time represented is local time.</description>
  /// <description>N</description>
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
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







-
+









-
+







  /// <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>Full</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} - Using this parameter requires that the CryptoAPI based codec be enabled at compile-time for both the native interop assembly and the core managed assemblies; otherwise, using this parameter may result in an exception being thrown when attempting to open the connection.</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>
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
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







-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-













-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-







  /// </item>
  /// <item>
  /// <description>Flags</description>
  /// <description>Extra behavioral flags for the connection.  See the SQLiteConnectionFlags enumeration for possible values.</description>
  /// <description>N</description>
  /// <description>Default</description>
  /// </item>
  /// <item>
  /// <description>SetDefaults</description>
  /// <description>
  /// <b>True</b> - Apply the default connection settings to the opened database.<br/>
  /// <b>False</b> - Skip applying the default connection settings to the opened database.
  /// </description>
  /// <description>N</description>
  /// <description>True</description>
  /// </item>
  /// <item>
  /// <description>ToFullPath</description>
  /// <description>
  /// <b>True</b> - Attempt to expand the data source file name to a fully qualified path before opening.<br/>
  /// <b>False</b> - Skip attempting to expand the data source file name to a fully qualified path before opening.
  /// </description>
  /// <description>N</description>
  /// <description>True</description>
  /// </item>
  /// </list>
  /// </remarks>
  public sealed partial class SQLiteConnection : DbConnection, ICloneable
  {
    /// <summary>
    /// The default "stub" (i.e. placeholder) base schema name to use when
    /// returning column schema information.  Used as the initial value of
    /// the BaseSchemaName property.  This should start with "sqlite_*"
    /// because those names are reserved for use by SQLite (i.e. they cannot
    /// be confused with the names of user objects).
    /// </summary>
    internal const string DefaultBaseSchemaName = "sqlite_default_schema";

    private const string MemoryFileName = ":memory:";

    private const SQLiteConnectionFlags DefaultFlags = SQLiteConnectionFlags.Default;
    private const SQLiteSynchronousEnum DefaultSynchronous = SQLiteSynchronousEnum.Default;
    private const SQLiteJournalModeEnum DefaultJournalMode = SQLiteJournalModeEnum.Default;
    private const IsolationLevel DefaultIsolationLevel = IsolationLevel.Serializable;
    private const SQLiteDateFormats DefaultDateTimeFormat = SQLiteDateFormats.ISO8601;
    private const DateTimeKind DefaultDateTimeKind = DateTimeKind.Unspecified;
    private const string DefaultDataSource = null;
    private const string DefaultUri = null;
    private const string DefaultFullUri = null;
    private const string DefaultPassword = null;
    private const int DefaultVersion = 3;
    private const int DefaultPageSize = 1024;
    private const int DefaultMaxPageCount = 0;
    private const int DefaultCacheSize = 2000;
    private const int DefaultMaxPoolSize = 100;
    private const int DefaultConnectionTimeout = 30;
    private const bool DefaultFailIfMissing = false;
    private const bool DefaultReadOnly = false;
    private const bool DefaultBinaryGUID = true;
    private const bool DefaultUseUTF16Encoding = false;
    private const bool DefaultToFullPath = true;
    private const bool DefaultPooling = false;
    private const bool DefaultLegacyFormat = false;
    private const bool DefaultForeignKeys = false;
    private const bool DefaultEnlist = true;
    private const bool DefaultSetDefaults = true;

    private const int SQLITE_FCNTL_WIN32_AV_RETRY = 9;

    private const string _dataDirectory = "|DataDirectory|";
    private const string _masterdb = "sqlite_master";
    private const string _tempmasterdb = "sqlite_temp_master";

    /// <summary>
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
216
217
218
219
220
221
222


223
224
225
226

227
228
229
230
231
232
233







-
-




-







    /// The base SQLite object to interop with
    /// </summary>
    internal SQLiteBase _sql;
    /// <summary>
    /// The database filename minus path and extension
    /// </summary>
    private string _dataSource;

#if INTEROP_CODEC
    /// <summary>
    /// Temporary password storage, emptied after the database has been opened
    /// </summary>
    private byte[] _password;
#endif

    /// <summary>
    /// The "stub" (i.e. placeholder) base schema name to use when returning
    /// column schema information.
    /// </summary>
    internal string _baseSchemaName;

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
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







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







-
+















-
+







        }
      }
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    #region Backup API Members
    /// <summary>
    /// Raised between each backup step.
    /// </summary>
    /// <param name="source">
    /// The source database connection.
    /// </param>
    /// <param name="destination">
    /// The destination database connection.
    /// </param>
    /// <param name="remainingPages">
    /// The number of pages remaining to be copied.
    /// </param>
    /// <param name="totalPages">
    /// The total number of pages in the source database.
    /// </param>
    /// <param name="retry">
    /// Set to true if the operation needs to be retried due to database
    /// locking issues; otherwise, set to false.
    /// </param>
    /// <returns>
    /// True to continue with the backup process or false to halt the backup
    /// process, rolling back any changes that have been made so far.
    /// </returns>
    public delegate bool SQLiteBackupCallback(
        SQLiteConnection source, SQLiteConnection destination,
        int remainingPages, int totalPages, bool retry);

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Backs up the database, using the specified database connection as the
    /// destination.
    /// </summary>
    /// <param name="destination">The destination database connection.</param>
    /// <param name="destinationName">The destination database name.</param>
    /// <param name="sourceName">The source database name.</param>
    /// <param name="pages">
    /// <param name="nPage">
    /// The number of pages to copy or negative to copy all remaining pages.
    /// </param>
    /// <param name="callback">
    /// The method to invoke between each step of the backup process.  This
    /// parameter may be null (i.e. no callbacks will be performed).
    /// </param>
    /// <param name="retryMilliseconds">
    /// The number of milliseconds to sleep after encountering a locking error
    /// during the backup process.  A value less than zero means that no sleep
    /// should be performed.
    /// </param>
    public void BackupDatabase(
        SQLiteConnection destination,
        string destinationName,
        string sourceName,
        int pages,
        int nPage,
        SQLiteBackupCallback callback,
        int retryMilliseconds
        )
    {
        CheckDisposed();

        if (_connectionState != ConnectionState.Open)
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
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







-
+





-
+
-
-
+














-
+
-
-
-
-
-
-
-
+
-
-


+


-
+
-


+



-








-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-







        try
        {
            backup = sqliteBase.InitializeBackup(
                destination, destinationName, sourceName); /* throw */

            bool retry;

            while (sqliteBase.StepBackup(backup, pages, out retry)) /* throw */
            while (sqliteBase.StepBackup(backup, nPage, out retry)) /* throw */
            {
                //
                // NOTE: If a callback was supplied by our caller, call it.
                //       If it returns false, halt the backup process.
                //
                if ((callback != null) && !callback(this, sourceName,
                if ((callback != null) && !callback(this,
                        destination, destinationName, pages,
                        sqliteBase.RemainingBackup(backup),
                        destination, sqliteBase.RemainingBackup(backup),
                        sqliteBase.PageCountBackup(backup), retry))
                {
                    break;
                }

                //
                // NOTE: If we need to retry the previous operation, wait for
                //       the number of milliseconds specified by our caller
                //       unless the caller used a negative number, in that case
                //       skip sleeping at all because we do not want to block
                //       this thread forever.
                //
                if (retry && (retryMilliseconds >= 0))
                    System.Threading.Thread.Sleep(retryMilliseconds);

            }
                //
                // NOTE: There is no point in calling the native API to copy
                //       zero pages as it does nothing; therefore, stop now.
                //
                if (pages == 0)
                    break;
            }
        }
        }
#if !PLATFORM_COMPACTFRAMEWORK
        catch (Exception e)
        {
#if !PLATFORM_COMPACTFRAMEWORK
            if ((_flags & SQLiteConnectionFlags.LogBackup) == SQLiteConnectionFlags.LogBackup)
            {
                SQLiteLog.LogMessage(String.Format(
                SQLiteLog.LogMessage(0, String.Format(
                    CultureInfo.CurrentCulture,
                    "Caught exception while backing up database: {0}", e));
            }
#endif

            throw;
        }
#endif
        finally
        {
            if (backup != null)
                sqliteBase.FinishBackup(backup); /* throw */
        }
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////////////////////////

    [Conditional("CHECK_STATE")]
    internal static void Check(SQLiteConnection connection)
    {
        if (connection == null)
            throw new ArgumentNullException("connection");

        connection.CheckDisposed();

        if (connection._connectionState != ConnectionState.Open)
            throw new InvalidOperationException("The connection is not open.");

        SQLite3 sql = connection._sql as SQLite3;

        if (sql == null)
            throw new InvalidOperationException("The connection handle wrapper is null.");

        SQLiteConnectionHandle handle = sql._sql;

        if (handle == null)
            throw new InvalidOperationException("The connection handle is null.");

        if (handle.IsInvalid)
            throw new InvalidOperationException("The connection handle is invalid.");

        if (handle.IsClosed)
            throw new InvalidOperationException("The connection handle is closed.");
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    #region IDisposable "Pattern" Members
    private bool disposed;
    private void CheckDisposed() /* throw */
    {
#if THROW_ON_DISPOSED
592
593
594
595
596
597
598
599

600
601
602
603
604
605
606
524
525
526
527
528
529
530

531
532
533
534
535
536
537
538







-
+







        CheckDisposed();
        return 30;
      }
    }
#endif

    /// <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
    /// 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>
    public object Clone()
    {
      CheckDisposed();
      return new SQLiteConnection(this);
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

671
672
673
674
675
676
677
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







-
+













-
+














-
+







    }

    /// <summary>
    /// OBSOLETE.  Creates a new SQLiteTransaction if one isn't already active on the connection.
    /// </summary>
    /// <param name="isolationLevel">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
    /// 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>
    [Obsolete("Use one of the standard BeginTransaction methods, this one will be removed soon")]
    public SQLiteTransaction BeginTransaction(IsolationLevel isolationLevel, bool deferredLock)
    {
      CheckDisposed();
      return (SQLiteTransaction)BeginDbTransaction(deferredLock == false ? IsolationLevel.Serializable : IsolationLevel.ReadCommitted);
    }

    /// <summary>
    /// OBSOLETE.  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 false, but in a multi-threaded multi-writer
    /// When FALSE, a writelock is obtained immediately.  The default is false, 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>
    [Obsolete("Use one of the standard BeginTransaction methods, this one will be removed soon")]
    public SQLiteTransaction BeginTransaction(bool deferredLock)
    {
      CheckDisposed();
      return (SQLiteTransaction)BeginDbTransaction(deferredLock == false ? IsolationLevel.Serializable : IsolationLevel.ReadCommitted);
    }

    /// <summary>
    /// Creates a new SQLiteTransaction if one isn't already active on the connection.
    /// </summary>
    /// <param name="isolationLevel">Supported isolation levels are Serializable, ReadCommitted and Unspecified.</param>
    /// <remarks>
    /// Unspecified will use the default isolation level specified in the connection string.  If no isolation level is specified in the
    /// Unspecified will use the default isolation level specified in the connection string.  If no isolation level is specified in the 
    /// connection string, Serializable is used.
    /// Serializable transactions are the default.  In this mode, the engine gets an immediate lock on the database, and no other threads
    /// may begin a transaction.  Other threads may read from the database, but not write.
    /// With a ReadCommitted isolation level, locks are deferred and elevated as needed.  It is possible for multiple threads to start
    /// a transaction in ReadCommitted mode, but if a thread attempts to commit a transaction while another thread
    /// has a ReadCommitted lock, it may timeout or cause a deadlock on both threads until both threads' CommandTimeout's are reached.
    /// </remarks>
729
730
731
732
733
734
735
736

737
738
739
740
741
742
743
661
662
663
664
665
666
667

668
669
670
671
672
673
674
675







-
+








      if (_sql != null)
      {
#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
          // 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.
          SQLiteConnection cnn = new SQLiteConnection();
          cnn._sql = _sql;
          cnn._transactionLevel = _transactionLevel;
          cnn._enlistment = _enlistment;
          cnn._connectionState = _connectionState;
          cnn._version = _version;
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
687
688
689
690
691
692
693












694
695
696
697
698
699
700







-
-
-
-
-
-
-
-
-
-
-
-







          _sql = null;
        }
        _transactionLevel = 0;
      }
      OnStateChange(ConnectionState.Closed);
    }

    /// <summary>
    /// Returns the number of pool entries for the file name associated with this connection.
    /// </summary>
    public int PoolCount
    {
        get
        {
            if (_sql == null) return 0;
            return _sql.CountPool();
        }
    }

    /// <summary>
    /// Clears the connection pool associated with the connection.  Any other active connections using the same database file
    /// will be discarded instead of returned to the pool when they are closed.
    /// </summary>
    /// <param name="connection"></param>
    public static void ClearPool(SQLiteConnection connection)
    {
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
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







-
+

















-
+
-
-
-
-
-
-
-




-
-
-
-
-
-
-
-
-
-
-
-
-
-
-

-
+

-
+











-
+









-
+





-
+







    /// <term>Parameter</term>
    /// <term>Values</term>
    /// <term>Required</term>
    /// <term>Default</term>
    /// </listheader>
    /// <item>
    /// <description>Data Source</description>
    /// <description>This may be a file name, the string ":memory:", or any supported URI (starting with SQLite 3.7.7).</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>
    /// <description><b>Ticks</b> - Use DateTime.Ticks<br/><b>ISO8601</b> - Use ISO8601 DateTime format<br/><b>JulianDay</b> - Use JulianDay format</description>
    /// <b>Ticks</b> - Use the value of DateTime.Ticks.<br/>
    /// <b>ISO8601</b> - Use the ISO-8601 format.  Uses the "yyyy-MM-dd HH:mm:ss.FFFFFFFK" format for UTC
    /// DateTime values and "yyyy-MM-dd HH:mm:ss.FFFFFFF" format for local DateTime values).<br/>
    /// <b>JulianDay</b> - The interval of time in days and fractions of a day since January 1, 4713 BC.<br/>
    /// <b>UnixEpoch</b> - The whole number of seconds since the Unix epoch (January 1, 1970).<br/>
    /// <b>InvariantCulture</b> - Any culture-independent string value that the .NET Framework can interpret as a valid DateTime.<br/>
    /// <b>CurrentCulture</b> - Any string value that the .NET Framework can interpret as a valid DateTime using the current culture.</description>
    /// <description>N</description>
    /// <description>ISO8601</description>
    /// </item>
    /// <item>
    /// <description>DateTimeKind</description>
    /// <description><b>Unspecified</b> - Not specified as either UTC or local time.<br/><b>Utc</b> - The time represented is UTC.<br/><b>Local</b> - The time represented is local time.</description>
    /// <description>N</description>
    /// <description>Unspecified</description>
    /// </item>
    /// <item>
    /// <description>BaseSchemaName</description>
    /// <description>Some base data classes in the framework (e.g. those that build SQL queries dynamically)
    /// assume that an ADO.NET provider cannot support an alternate catalog (i.e. database) without supporting
    /// alternate schemas as well; however, SQLite does not fit into this model.  Therefore, this value is used
    /// as a placeholder and removed prior to preparing any SQL statements that may contain it.</description>
    /// <description>N</description>
    /// <description>sqlite_default_schema</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><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>True</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>Full</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} - Using this parameter requires that the CryptoAPI based codec be enabled at compile-time for both the native interop assembly and the core managed assemblies; otherwise, using this parameter may result in an exception being thrown when attempting to open the connection.</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><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>
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
831
832
833
834
835
836
837






























838
839
840
841
842
843
844







-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-







    /// </item>
    /// <item>
    /// <description>Default IsolationLevel</description>
    /// <description>The default transaciton isolation level</description>
    /// <description>N</description>
    /// <description>Serializable</description>
    /// </item>
    /// <item>
    /// <description>Foreign Keys</description>
    /// <description>Enable foreign key constraints</description>
    /// <description>N</description>
    /// <description>False</description>
    /// </item>
    /// <item>
    /// <description>Flags</description>
    /// <description>Extra behavioral flags for the connection.  See the SQLiteConnectionFlags enumeration for possible values.</description>
    /// <description>N</description>
    /// <description>Default</description>
    /// </item>
    /// <item>
    /// <description>SetDefaults</description>
    /// <description>
    /// <b>True</b> - Apply the default connection settings to the opened database.<br/>
    /// <b>False</b> - Skip applying the default connection settings to the opened database.
    /// </description>
    /// <description>N</description>
    /// <description>True</description>
    /// </item>
    /// <item>
    /// <description>ToFullPath</description>
    /// <description>
    /// <b>True</b> - Attempt to expand the data source file name to a fully qualified path before opening.<br/>
    /// <b>False</b> - Skip attempting to expand the data source file name to a fully qualified path before opening.
    /// </description>
    /// <description>N</description>
    /// <description>True</description>
    /// </item>
    /// </list>
    /// </remarks>
#if !PLATFORM_COMPACTFRAMEWORK
    [RefreshProperties(RefreshProperties.All), DefaultValue("")]
    [Editor("SQLite.Designer.SQLiteConnectionStringEditor, SQLite.Designer, Version=" + SQLite3.DesignerVersion + ", Culture=neutral, PublicKeyToken=db937bc2d44ff139", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
#endif
    public override string ConnectionString
1050
1051
1052
1053
1054
1055
1056
1057

1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071

1072
1073
1074
1075
1076
1077
1078



1079
1080

1081
1082


1083
1084
1085
1086
1087
1088
1089
918
919
920
921
922
923
924

925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945


946
947
948


949


950
951
952
953
954
955
956
957
958







-
+














+





-
-
+
+
+
-
-
+
-
-
+
+







      else if (path.StartsWith ("file:", StringComparison.OrdinalIgnoreCase))
            return path.Substring (5);
      else if (path.StartsWith ("/", StringComparison.OrdinalIgnoreCase))
            return path;
      else
            throw new InvalidOperationException ("Invalid connection string: invalid URI");
    }

    
    /// <summary>
    /// Parses the connection string into component parts
    /// </summary>
    /// <param name="connectionString">The connection string to parse</param>
    /// <returns>An array of key-value pairs representing each parameter of the connection string</returns>
    internal static SortedList<string, string> ParseConnectionString(string connectionString)
    {
      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++)
      {
        int indexOf = arParts[n].IndexOf('=');

        arPiece = SQLiteConvert.Split(arParts[n], '=');
        if (arPiece.Length == 2)
        {
        if (indexOf != -1)
          ls.Add(arParts[n].Substring(0, indexOf), arParts[n].Substring(indexOf + 1));
          ls.Add(arPiece[0], arPiece[1]);
        else
          throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, "Invalid ConnectionString format for part \"{0}\"", arParts[n]));
        }
        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
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167

1168
1169
1170
1171
1172
1173
1174


1175
1176

1177
1178
1179
1180
1181

1182
1183
1184
1185
1186
1187


1188
1189
1190
1191
1192
1193
1194
1195

1196
1197
1198
1199
1200
1201



1202
1203
1204


1205
1206
1207

1208
1209
1210
1211
1212
1213
1214


1215
1216

1217
1218

1219
1220
1221
1222
1223
1224
1225




1226
1227
1228
1229
1230
1231
1232
1233




1234
1235
1236
1237
1238


1239
1240
1241

1242
1243
1244
1245
1246
1247

1248
1249

1250
1251
1252
1253



1254
1255
1256
1257

1258
1259
1260

1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276

1277
1278
1279

1280
1281

1282
1283
1284
1285
1286
1287
1288
1289
1290

1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311



1312
1313
1314
1315
1316




1317
1318
1319
1320
1321
1322





1323
1324
1325


1326
1327
1328
1329
1330




1331
1332

1333
1334
1335
1336
1337
1338



1339
1340

1341
1342
1343
1344
1345
1346





1347
1348
1349


1350
1351
1352
1353
1354




1355
1356

1357
1358
1359
1360
1361
1362





1363
1364

1365
1366
1367
1368
1369


1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387

1388
1389

1390
1391
1392
1393
1394
1395
1396
1397
988
989
990
991
992
993
994

























995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008



1009

1010

1011
1012


1013
1014
1015

1016

1017
1018
1019

1020
1021





1022
1023



1024
1025
1026


1027






1028
1029
1030
1031


1032
1033
1034


1035

1036

1037
1038


1039
1040
1041

1042
1043

1044


1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055






1056
1057
1058
1059


1060


1061
1062
1063


1064






1065


1066




1067
1068
1069

1070
1071

1072
1073
1074

1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085



1086
1087

1088
1089


1090
1091

1092
1093
1094
1095

1096

1097


1098


1099
1100
1101
1102
1103

1104
1105











1106
1107
1108
1109




1110
1111
1112
1113






1114
1115
1116
1117
1118
1119


1120
1121





1122
1123
1124
1125
1126

1127






1128
1129
1130


1131






1132
1133
1134
1135
1136
1137


1138
1139





1140
1141
1142
1143
1144

1145






1146
1147
1148
1149
1150
1151

1152





1153
1154


1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166




1167


1168

1169
1170
1171
1172
1173
1174
1175







-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-














-
-
-
+
-

-


-
-
+
+

-
+
-



-
+

-
-
-
-
-
+
+
-
-
-



-
-
+
-
-
-
-
-
-
+
+
+

-
-
+
+

-
-
+
-

-


-
-
+
+

-
+

-
+
-
-





+
+
+
+


-
-
-
-
-
-
+
+
+
+
-
-

-
-
+
+

-
-
+
-
-
-
-
-
-
+
-
-
+
-
-
-
-
+
+
+
-


-
+


-
+










-
-
-


-
+

-
-
+

-
+



-

-

-
-
+
-
-





-


-
-
-
-
-
-
-
-
-
-
-
+
+
+

-
-
-
-
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+

-
-
+
+
-
-
-
-
-
+
+
+
+

-
+
-
-
-
-
-
-
+
+
+
-
-
+
-
-
-
-
-
-
+
+
+
+
+

-
-
+
+
-
-
-
-
-
+
+
+
+

-
+
-
-
-
-
-
-
+
+
+
+
+

-
+
-
-
-
-
-
+
+
-
-












-
-
-
-
+
-
-
+
-







      string ret;

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

      return defValue;
    }

    /// <summary>
    /// Attempts to convert the string value to an enumerated value of the specified type.
    /// </summary>
    /// <param name="type">The enumerated type to convert the string value to.</param>
    /// <param name="value">The string value to be converted.</param>
    /// <param name="ignoreCase">Non-zero to make the conversion case-insensitive.</param>
    /// <returns>The enumerated value upon success or null upon error.</returns>
    private static object TryParseEnum(
        Type type,
        string value,
        bool ignoreCase
        )
    {
        try
        {
            return Enum.Parse(type, value, ignoreCase);
        }
        catch
        {
            // do nothing.
        }

        return null;
    }

    /// <summary>
    /// Opens the connection using the parameters found in the <see cref="ConnectionString">ConnectionString</see>
    /// </summary>
    public override void Open()
    {
      CheckDisposed();

      if (_connectionState != ConnectionState.Closed)
        throw new InvalidOperationException();

      Close();

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

      object enumValue;

      enumValue = TryParseEnum(typeof(SQLiteConnectionFlags), FindKey(opts, "Flags", DefaultFlags.ToString()), true);
      _flags = (SQLiteConnectionFlags)Enum.Parse(typeof(SQLiteConnectionFlags), FindKey(opts, "Flags", "Default"), true);
      _flags = (enumValue is SQLiteConnectionFlags) ? (SQLiteConnectionFlags)enumValue : DefaultFlags;

      bool fullUri = false;
      string fileName;

      if (Convert.ToInt32(FindKey(opts, "Version", DefaultVersion.ToString()), CultureInfo.InvariantCulture) != DefaultVersion)
        throw new NotSupportedException(String.Format(CultureInfo.CurrentCulture, "Only SQLite Version {0} is supported at this time", DefaultVersion));
      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", DefaultDataSource);
      fileName = FindKey(opts, "Data Source", "");
      fileName = UnwrapFileName(fileName);

      if (String.IsNullOrEmpty(fileName))
      {
        fileName = FindKey(opts, "Uri", DefaultUri);
        fileName = FindKey(opts, "Uri", "");
        if (String.IsNullOrEmpty(fileName))
        {
          fileName = FindKey(opts, "FullUri", DefaultFullUri);
          if (String.IsNullOrEmpty(fileName))
            throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, "Data Source cannot be empty.  Use {0} to open an in-memory database", MemoryFileName));
          else
          throw new ArgumentException("Data Source cannot be empty.  Use :memory: to open an in-memory database");
        else
            fullUri = true;
        }
        else
          fileName = MapUriPath(fileName);
      }

      bool isMemory = (String.Compare(fileName, MemoryFileName, StringComparison.OrdinalIgnoreCase) == 0);

      if (String.Compare(fileName, ":MEMORY:", StringComparison.OrdinalIgnoreCase) == 0)
      if (!fullUri)
      {
        if (isMemory)
          fileName = MemoryFileName;
        else
        {
        fileName = ":memory:";
      else
      {
#if PLATFORM_COMPACTFRAMEWORK
          if (fileName.StartsWith("./") || fileName.StartsWith(".\\"))
            fileName = Path.GetDirectoryName(System.Reflection.Assembly.GetCallingAssembly().GetName().CodeBase) + fileName.Substring(1);
       if (fileName.StartsWith("./") || fileName.StartsWith(".\\"))
         fileName = Path.GetDirectoryName(System.Reflection.Assembly.GetCallingAssembly().GetName().CodeBase) + fileName.Substring(1);
#endif
          bool toFullPath = SQLiteConvert.ToBoolean(FindKey(opts, "ToFullPath", DefaultToFullPath.ToString()));
          fileName = ExpandFileName(fileName, toFullPath);
       fileName = ExpandFileName(fileName);
        }
      }

      try
      {
        bool usePooling = SQLiteConvert.ToBoolean(FindKey(opts, "Pooling", DefaultPooling.ToString()));
        int maxPoolSize = Convert.ToInt32(FindKey(opts, "Max Pool Size", DefaultMaxPoolSize.ToString()), CultureInfo.InvariantCulture);
        bool usePooling = (SQLiteConvert.ToBoolean(FindKey(opts, "Pooling", Boolean.FalseString)) == true);
        int maxPoolSize = Convert.ToInt32(FindKey(opts, "Max Pool Size", "100"), CultureInfo.InvariantCulture);

        _defaultTimeout = Convert.ToInt32(FindKey(opts, "Default Timeout", DefaultConnectionTimeout.ToString()), CultureInfo.InvariantCulture);
        _defaultTimeout = Convert.ToInt32(FindKey(opts, "Default Timeout", "30"), CultureInfo.CurrentCulture);

        enumValue = TryParseEnum(typeof(IsolationLevel), FindKey(opts, "Default IsolationLevel", DefaultIsolationLevel.ToString()), true);
        _defaultIsolation = (IsolationLevel)Enum.Parse(typeof(IsolationLevel), FindKey(opts, "Default IsolationLevel", "Serializable"), true);
        _defaultIsolation = (enumValue is IsolationLevel) ? (IsolationLevel)enumValue : DefaultIsolationLevel;

        if (_defaultIsolation != IsolationLevel.Serializable && _defaultIsolation != IsolationLevel.ReadCommitted)
          throw new NotSupportedException("Invalid Default IsolationLevel specified");

        _baseSchemaName = FindKey(opts, "BaseSchemaName", DefaultBaseSchemaName);

        //string temp = FindKey(opts, "DateTimeFormat", "ISO8601");
        //if (String.Compare(temp, "ticks", StringComparison.OrdinalIgnoreCase) == 0) dateFormat = SQLiteDateFormats.Ticks;
        //else if (String.Compare(temp, "julianday", StringComparison.OrdinalIgnoreCase) == 0) dateFormat = SQLiteDateFormats.JulianDay;

        if (_sql == null)
        {
            enumValue = TryParseEnum(typeof(SQLiteDateFormats), FindKey(opts,
                "DateTimeFormat", DefaultDateTimeFormat.ToString()), true);

            SQLiteDateFormats dateFormat = (enumValue is SQLiteDateFormats) ?
                (SQLiteDateFormats)enumValue : DefaultDateTimeFormat;

          bool bUTF16 = (SQLiteConvert.ToBoolean(FindKey(opts, "UseUTF16Encoding", Boolean.FalseString)) == true);
          SQLiteDateFormats dateFormat = (SQLiteDateFormats)Enum.Parse(typeof(SQLiteDateFormats),
                                                                       FindKey(opts, "DateTimeFormat", "ISO8601"),
                                                                       true);
            enumValue = TryParseEnum(typeof(DateTimeKind), FindKey(opts,
                "DateTimeKind", DefaultDateTimeKind.ToString()), true);

            DateTimeKind kind = (enumValue is DateTimeKind) ?
                (DateTimeKind)enumValue : DefaultDateTimeKind;
          DateTimeKind kind = (DateTimeKind)Enum.Parse(typeof(DateTimeKind),
              FindKey(opts, "DateTimeKind", "Unspecified"), true);

            //
            // NOTE: SQLite automatically sets the encoding of the database to
          if (bUTF16) // SQLite automatically sets the encoding of the database to UTF16 if called from sqlite3_open16()
            //       UTF16 if called from sqlite3_open16().
            //
            if (SQLiteConvert.ToBoolean(FindKey(opts, "UseUTF16Encoding",
                      DefaultUseUTF16Encoding.ToString())))
            {
                _sql = new SQLite3_UTF16(dateFormat, kind);
            _sql = new SQLite3_UTF16(dateFormat, kind);
            }
            else
          else
            {
                _sql = new SQLite3(dateFormat, kind);
            }
        }
            _sql = new SQLite3(dateFormat, kind);
        }


        SQLiteOpenFlagsEnum flags = SQLiteOpenFlagsEnum.None;

        if (!SQLiteConvert.ToBoolean(FindKey(opts, "FailIfMissing", DefaultFailIfMissing.ToString())))
        if (SQLiteConvert.ToBoolean(FindKey(opts, "FailIfMissing", Boolean.FalseString)) == false)
          flags |= SQLiteOpenFlagsEnum.Create;

        if (SQLiteConvert.ToBoolean(FindKey(opts, "Read Only", DefaultReadOnly.ToString())))
        if (SQLiteConvert.ToBoolean(FindKey(opts, "Read Only", Boolean.FalseString)) == true)
        {
          flags |= SQLiteOpenFlagsEnum.ReadOnly;
          // SQLite will return SQLITE_MISUSE on ReadOnly and Create
          flags &= ~SQLiteOpenFlagsEnum.Create;
        }
        else
        {
          flags |= SQLiteOpenFlagsEnum.ReadWrite;
        }

        if (fullUri)
            flags |= SQLiteOpenFlagsEnum.Uri;

        _sql.Open(fileName, _flags, flags, maxPoolSize, usePooling);

        _binaryGuid = SQLiteConvert.ToBoolean(FindKey(opts, "BinaryGUID", DefaultBinaryGUID.ToString()));
        _binaryGuid = (SQLiteConvert.ToBoolean(FindKey(opts, "BinaryGUID", Boolean.TrueString)) == true);

#if INTEROP_CODEC
        string password = FindKey(opts, "Password", DefaultPassword);
        string password = FindKey(opts, "Password", null);

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

        _password = null;
#endif

        if (!fullUri)
          _dataSource = Path.GetFileNameWithoutExtension(fileName);
        _dataSource = Path.GetFileNameWithoutExtension(fileName);
        else
          _dataSource = fileName;

        _version++;

        ConnectionState oldstate = _connectionState;
        _connectionState = ConnectionState.Open;

        try
        {
          string strValue;
          bool boolValue;

          strValue = FindKey(opts, "SetDefaults", DefaultSetDefaults.ToString());
          boolValue = SQLiteConvert.ToBoolean(strValue);

          if (boolValue)
          {
              using (SQLiteCommand cmd = CreateCommand())
              {
                  int intValue;
          using (SQLiteCommand cmd = CreateCommand())
          {
            string defValue;

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

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

                  strValue = FindKey(opts, "Legacy Format", DefaultLegacyFormat.ToString());
            defValue = FindKey(opts, "Legacy Format", Boolean.FalseString);
                  boolValue = SQLiteConvert.ToBoolean(strValue);
                  if (boolValue != DefaultLegacyFormat)
                  {
                      cmd.CommandText = String.Format(CultureInfo.InvariantCulture, "PRAGMA legacy_file_format={0}", boolValue ? "ON" : "OFF");
                      cmd.ExecuteNonQuery();
                  }
            cmd.CommandText = String.Format(CultureInfo.InvariantCulture, "PRAGMA legacy_file_format={0}", SQLiteConvert.ToBoolean(defValue) == true ? "ON" : "OFF");
            cmd.ExecuteNonQuery();


                  strValue = FindKey(opts, "Synchronous", DefaultSynchronous.ToString());
            defValue = FindKey(opts, "Synchronous", "Normal");
                  enumValue = TryParseEnum(typeof(SQLiteSynchronousEnum), strValue, true);
                  if (!(enumValue is SQLiteSynchronousEnum) || ((SQLiteSynchronousEnum)enumValue != DefaultSynchronous))
                  {
                      cmd.CommandText = String.Format(CultureInfo.InvariantCulture, "PRAGMA synchronous={0}", strValue);
                      cmd.ExecuteNonQuery();
                  }
            if (String.Compare(defValue, "Full", StringComparison.OrdinalIgnoreCase) != 0)
            {
              cmd.CommandText = String.Format(CultureInfo.InvariantCulture, "PRAGMA synchronous={0}", defValue);
              cmd.ExecuteNonQuery();
            }

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

                  strValue = FindKey(opts, "Journal Mode", DefaultJournalMode.ToString());
            defValue = FindKey(opts, "Journal Mode", "Default");
                  enumValue = TryParseEnum(typeof(SQLiteJournalModeEnum), strValue, true);
                  if (!(enumValue is SQLiteJournalModeEnum) || ((SQLiteJournalModeEnum)enumValue != DefaultJournalMode))
                  {
                      cmd.CommandText = String.Format(CultureInfo.InvariantCulture, "PRAGMA journal_mode={0}", strValue);
                      cmd.ExecuteNonQuery();
                  }
            if (String.Compare(defValue, "Default", StringComparison.OrdinalIgnoreCase) != 0)
            {
              cmd.CommandText = String.Format(CultureInfo.InvariantCulture, "PRAGMA journal_mode={0}", defValue);
              cmd.ExecuteNonQuery();
            }

                  strValue = FindKey(opts, "Foreign Keys", DefaultForeignKeys.ToString());
            defValue = FindKey(opts, "Foreign Keys", Boolean.FalseString);
                  boolValue = Convert.ToBoolean(strValue, CultureInfo.InvariantCulture);
                  if (boolValue != DefaultForeignKeys)
                  {
                      cmd.CommandText = String.Format(CultureInfo.InvariantCulture, "PRAGMA foreign_keys={0}", boolValue ? "ON" : "OFF");
                      cmd.ExecuteNonQuery();
            cmd.CommandText = String.Format(CultureInfo.InvariantCulture, "PRAGMA foreign_keys={0}", SQLiteConvert.ToBoolean(defValue) == true ? "ON" : "OFF");
            cmd.ExecuteNonQuery();
                  }
              }
          }

          if (_commitHandler != null)
            _sql.SetCommitHook(_commitCallback);

          if (_updateHandler != null)
            _sql.SetUpdateHook(_updateCallback);

          if (_rollbackHandler != null)
            _sql.SetRollbackHook(_rollbackCallback);

#if !PLATFORM_COMPACTFRAMEWORK
          System.Transactions.Transaction transaction = Transactions.Transaction.Current;

          if (transaction != null &&
              SQLiteConvert.ToBoolean(FindKey(opts, "Enlist", DefaultEnlist.ToString())))
          if (Transactions.Transaction.Current != null && SQLiteConvert.ToBoolean(FindKey(opts, "Enlist", Boolean.TrueString)) == true)
          {
              EnlistTransaction(transaction);
            EnlistTransaction(Transactions.Transaction.Current);
          }
#endif

          _connectionState = oldstate;
          OnStateChange(ConnectionState.Open);
        }
        catch
        {
1412
1413
1414
1415
1416
1417
1418
1419

1420
1421
1422
1423
1424
1425
1426
1190
1191
1192
1193
1194
1195
1196

1197
1198
1199
1200
1201
1202
1203
1204







-
+







    /// <returns>The current connection object.</returns>
    public SQLiteConnection OpenAndReturn()
    {
        CheckDisposed(); Open(); return this;
    }

    /// <summary>
    /// Gets/sets the default command timeout for newly-created commands.  This is especially useful for
    /// Gets/sets the default command timeout for newly-created commands.  This is especially useful for 
    /// commands used internally such as inside a SQLiteTransaction, where setting the timeout is not possible.
    /// This can also be set in the ConnectionString with "Default Timeout"
    /// </summary>
    public int DefaultTimeout
    {
      get { CheckDisposed(); return _defaultTimeout; }
      set { CheckDisposed(); _defaultTimeout = value; }
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1306
1307
1308
1309
1310
1311
1312






















1313
1314
1315
1316
1317
1318
1319







-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-







        if (_sql == null)
          throw new InvalidOperationException("Database connection not valid for getting maximum memory used.");

          return _sql.MemoryHighwater;
      }
    }

    /// <summary>
    /// Sets the status of the memory usage tracking subsystem in the SQLite core library.  By default, this is enabled.
    /// If this is disabled, memory usage tracking will not be performed.  This is not really a per-connection value, it is
    /// global to the process.
    /// </summary>
    /// <param name="value">Non-zero to enable memory usage tracking, zero otherwise.</param>
    /// <returns>A standard SQLite return code (i.e. zero for success and non-zero for failure).</returns>
    public static SQLiteErrorCode SetMemoryStatus(bool value)
    {
        return SQLite3.StaticSetMemoryStatus(value);
    }

    /// <summary>
    /// Returns a string containing the define constants (i.e. compile-time
    /// options) used to compile the core managed assembly, delimited with
    /// spaces.
    /// </summary>
    public static string DefineConstants
    {
        get { return SQLite3.DefineConstants; }
    }

    /// <summary>
    /// Returns the version of the underlying SQLite database engine
    /// </summary>
    public static string SQLiteVersion
    {
      get { return SQLite3.SQLiteVersion; }
    }
1584
1585
1586
1587
1588
1589
1590
1591

1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606




1607
1608
1609
1610
1611


1612
1613
1614

1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639

1640
1641
1642
1643

1644
1645
1646
1647
1648

1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1340
1341
1342
1343
1344
1345
1346

1347
1348
1349
1350
1351
1352
1353
1354

1355






1356
1357
1358
1359


1360


1361
1362
1363


1364





1365

1366

1367

1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380

1381
1382
1383
1384

1385
1386
1387
1388
1389

1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409

1410
1411
1412
1413
1414
1415
1416







-
+







-

-
-
-
-
-
-
+
+
+
+
-
-

-
-
+
+

-
-
+
-
-
-
-
-

-

-

-













-
+



-
+




-
+



















-







      {
        CheckDisposed();
        return _connectionState;
      }
    }

    /// Passes a shutdown request off to SQLite.
    public SQLiteErrorCode Shutdown()
    public int Shutdown()
    {
        CheckDisposed();

        // make sure we have an instance of the base class
        if (_sql == null)
        {
            SortedList<string, string> opts = ParseConnectionString(_connectionString);
            object enumValue;

            enumValue = TryParseEnum(typeof(SQLiteDateFormats), FindKey(opts,
                "DateTimeFormat", DefaultDateTimeFormat.ToString()), true);

            SQLiteDateFormats dateFormat = (enumValue is SQLiteDateFormats) ?
                (SQLiteDateFormats)enumValue : DefaultDateTimeFormat;

            bool bUTF16 = (SQLiteConvert.ToBoolean(FindKey(opts, "UseUTF16Encoding", Boolean.FalseString)) == true);
            SQLiteDateFormats dateFormat = (SQLiteDateFormats)Enum.Parse(typeof(SQLiteDateFormats),
                                                                         FindKey(opts, "DateTimeFormat", "ISO8601"),
                                                                         true);
            enumValue = TryParseEnum(typeof(DateTimeKind), FindKey(opts,
                "DateTimeKind", DefaultDateTimeKind.ToString()), true);

            DateTimeKind kind = (enumValue is DateTimeKind) ?
                (DateTimeKind)enumValue : DefaultDateTimeKind;
            DateTimeKind kind = (DateTimeKind)Enum.Parse(typeof(DateTimeKind),
                FindKey(opts, "DateTimeKind", "Unspecified"), true);

            //
            // NOTE: SQLite automatically sets the encoding of the database to
            if (bUTF16) // SQLite automatically sets the encoding of the database to UTF16 if called from sqlite3_open16()
            //       UTF16 if called from sqlite3_open16().
            //
            if (SQLiteConvert.ToBoolean(FindKey(opts,
                    "UseUTF16Encoding", DefaultUseUTF16Encoding.ToString())))
            {
                _sql = new SQLite3_UTF16(dateFormat, kind);
            }
            else
            {
                _sql = new SQLite3(dateFormat, kind);
            }
        }
        if (_sql != null) return _sql.Shutdown();
        throw new InvalidOperationException("Database connection not active.");
    }

    /// Enables or disabled extended result codes returned by SQLite
    public void SetExtendedResultCodes(bool bOnOff)
    {
      CheckDisposed();

      if (_sql != null) _sql.SetExtendedResultCodes(bOnOff);
    }
    /// Enables or disabled extended result codes returned by SQLite
    public SQLiteErrorCode ResultCode()
    public int ResultCode()
    {
      CheckDisposed();

      if (_sql == null)
      if (_sql == null) 
        throw new InvalidOperationException("Database connection not valid for getting result code.");
      return _sql.ResultCode();
    }
    /// Enables or disabled extended result codes returned by SQLite
    public SQLiteErrorCode ExtendedResultCode()
    public int ExtendedResultCode()
    {
      CheckDisposed();

      if (_sql == null)
        throw new InvalidOperationException("Database connection not valid for getting extended result code.");
      return _sql.ExtendedResultCode();
    }

    /// Add a log message via the SQLite sqlite3_log interface.
    public void LogMessage(int iErrCode, string zMessage)
    {
      CheckDisposed();

      if (_sql == null)
          throw new InvalidOperationException("Database connection not valid for logging message.");

      _sql.LogMessage(iErrCode, zMessage);
    }

#if INTEROP_CODEC
    /// <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>
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744

1745
1746
1747
1748
1749
1750
1751
1752

1753
1754
1755
1756
1757
1758
1759
1465
1466
1467
1468
1469
1470
1471

1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483

1484
1485
1486
1487
1488
1489
1490
1491

1492
1493
1494
1495
1496
1497
1498
1499







-












-
+







-
+







        throw new InvalidOperationException("Password can only be set before the database is opened.");

      if (databasePassword != null)
        if (databasePassword.Length == 0) databasePassword = null;

      _password = databasePassword;
    }
#endif

    /// <summary>
    /// Queries or modifies the number of retries or the retry interval (in milliseconds) for
    /// certain I/O operations that may fail due to anti-virus software.
    /// </summary>
    /// <param name="count">The number of times to retry the I/O operation.  A negative value
    /// will cause the current count to be queried and replace that negative value.</param>
    /// <param name="interval">The number of milliseconds to wait before retrying the I/O
    /// operation.  This number is multiplied by the number of retry attempts so far to come
    /// up with the final number of milliseconds to wait.  A negative value will cause the
    /// current interval to be queried and replace that negative value.</param>
    /// <returns>Zero for success, non-zero for error.</returns>
    public SQLiteErrorCode SetAvRetry(ref int count, ref int interval)
    public int SetAvRetry(ref int count, ref int interval)
    {
        CheckDisposed();

        if (_connectionState != ConnectionState.Open)
            throw new InvalidOperationException(
                "Database must be opened before changing the AV retry parameters.");

        SQLiteErrorCode rc;
        int rc;
        IntPtr pArg = IntPtr.Zero;

        try
        {
            pArg = Marshal.AllocHGlobal(sizeof(int) * 2);

            Marshal.WriteInt32(pArg, 0, count);
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815

1816
1817
1818
1819
1820
1821
1822
1823
1824

1825
1826
1827
1828
1829
1830
1831
1513
1514
1515
1516
1517
1518
1519




































1520

1521
1522




1523

1524
1525
1526
1527
1528
1529
1530
1531







-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-


-
-
-
-

-
+







                Marshal.FreeHGlobal(pArg);
        }

        return rc;
    }

    /// <summary>
    /// Removes one set of surrounding single -OR- double quotes from the file
    /// name and returns the resulting file name.  If the string is null, empty,
    /// or contains quotes that are not balanced, nothing is done and the original
    /// string will be returned.
    /// </summary>
    /// <param name="sourceFile">The database file name to process.</param>
    /// <returns>The modified database file name.</returns>
    private string UnwrapFileName(string sourceFile)
    {
        if (String.IsNullOrEmpty(sourceFile))
        {
            //
            // NOTE: The string is null or empty, return it verbatim.
            //
            return sourceFile;
        }

        int length = sourceFile.Length;

        if (((sourceFile[0] == '\'') && (sourceFile[length - 1] == '\'')) ||
            ((sourceFile[0] == '"') && (sourceFile[length - 1] == '"')))
        {
            //
            // NOTE: Remove the first and last character.
            //
            return sourceFile.Substring(1, length - 2);
        }

        //
        // NOTE: No match, return the input string verbatim.
        //
        return sourceFile;
    }

    /// <summary>
    /// Expand the filename of the data source, resolving the |DataDirectory|
    /// Expand the filename of the data source, resolving the |DataDirectory| macro as appropriate.
    /// macro as appropriate.
    /// </summary>
    /// <param name="sourceFile">The database filename to expand</param>
    /// <param name="toFullPath">
    /// Non-zero if the returned file name should be converted to a full path
    /// (except when using the .NET Compact Framework).
    /// </param>
    /// <returns>The expanded path and filename of the filename</returns>
    private string ExpandFileName(string sourceFile, bool toFullPath)
    private string ExpandFileName(string sourceFile)
    {
      if (String.IsNullOrEmpty(sourceFile)) return sourceFile;

      if (sourceFile.StartsWith(_dataDirectory, StringComparison.OrdinalIgnoreCase))
      {
        string dataDirectory;

1843
1844
1845
1846
1847
1848
1849
1850
1851

1852
1853
1854
1855
1856
1857
1858
1543
1544
1545
1546
1547
1548
1549


1550
1551
1552
1553
1554
1555
1556
1557







-
-
+







              sourceFile[_dataDirectory.Length] == Path.AltDirectorySeparatorChar)
            sourceFile = sourceFile.Remove(_dataDirectory.Length, 1);
        }
        sourceFile = Path.Combine(dataDirectory, sourceFile.Substring(_dataDirectory.Length));
      }

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

      return sourceFile;
    }

    ///<overloads>
    /// The following commands are used to extract schema information out of the database.  Valid schema types are:
2217
2218
2219
2220
2221
2222
2223
2224

2225
2226
2227
2228
2229
2230
2231
1916
1917
1918
1919
1920
1921
1922

1923
1924
1925
1926
1927
1928
1929
1930







-
+







      tbl.Columns.Add("INDEX_DEFINITION", typeof(string));

      tbl.BeginLoadData();

      if (String.IsNullOrEmpty(strCatalog)) strCatalog = "main";

      string master = (String.Compare(strCatalog, "temp", StringComparison.OrdinalIgnoreCase) == 0) ? _tempmasterdb : _masterdb;

      
      using (SQLiteCommand cmdTables = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'table'", strCatalog, master), this))
      using (SQLiteDataReader rdTables = cmdTables.ExecuteReader())
      {
        while (rdTables.Read())
        {
          maybeRowId = false;
          primaryKeys.Clear();
2789
2790
2791
2792
2793
2794
2795
2796

2797
2798
2799
2800
2801
2802
2803
2488
2489
2490
2491
2492
2493
2494

2495
2496
2497
2498
2499
2500
2501
2502







-
+







      tbl.Columns.Add("EDM_TYPE", typeof(string));
      tbl.Columns.Add("AUTOINCREMENT", typeof(bool));
      tbl.Columns.Add("UNIQUE", typeof(bool));

      if (String.IsNullOrEmpty(strCatalog)) strCatalog = "main";

      string master = (String.Compare(strCatalog, "temp", StringComparison.OrdinalIgnoreCase) == 0) ? _tempmasterdb : _masterdb;

      
      tbl.BeginLoadData();

      using (SQLiteCommand cmdViews = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'view'", strCatalog, master), this))
      using (SQLiteDataReader rdViews = cmdViews.ExecuteReader())
      {
        while (rdViews.Read())
        {
2907
2908
2909
2910
2911
2912
2913


2914
2915
2916
2917
2918
2919
2920
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621







+
+







        while (rdTables.Read())
        {
          if (String.IsNullOrEmpty(strTable) || String.Compare(strTable, rdTables.GetString(2), StringComparison.OrdinalIgnoreCase) == 0)
          {
            try
            {
              using (SQLiteCommandBuilder builder = new SQLiteCommandBuilder())
              //using (SQLiteCommand cmdTable = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}]", strCatalog, rdTables.GetString(2)), this))
              //using (SQLiteDataReader rdTable = cmdTable.ExecuteReader(CommandBehavior.SchemaOnly))
              using (SQLiteCommand cmdKey = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "PRAGMA [{0}].foreign_key_list([{1}])", strCatalog, rdTables.GetString(2)), this))
              using (SQLiteDataReader rdKey = cmdKey.ExecuteReader())
              {
                while (rdKey.Read())
                {
                  row = tbl.NewRow();
                  row["CONSTRAINT_CATALOG"] = strCatalog;
3138
3139
3140
3141
3142
3143
3144
3145

3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
2839
2840
2841
2842
2843
2844
2845

2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866

















































2867
2868
2869
2870
2871
2872
2873







-
+




















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-








#if !PLATFORM_COMPACTFRAMEWORK
  [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif
  internal delegate void SQLiteRollbackCallback(IntPtr puser);

  /// <summary>
  /// Raised when a transaction is about to be committed.  To roll back a transaction, set the
  /// Raised when a transaction is about to be committed.  To roll back a transaction, set the 
  /// rollbackTrans boolean value to true.
  /// </summary>
  /// <param name="sender">The connection committing the transaction</param>
  /// <param name="e">Event arguments on the transaction</param>
  public delegate void SQLiteCommitHandler(object sender, CommitEventArgs e);

  /// <summary>
  /// Raised when data is inserted, updated and deleted on a given connection
  /// </summary>
  /// <param name="sender">The connection committing the transaction</param>
  /// <param name="e">The event parameters which triggered the event</param>
  public delegate void SQLiteUpdateEventHandler(object sender, UpdateEventArgs e);

  /// <summary>
  /// Raised when a statement first begins executing on a given connection
  /// </summary>
  /// <param name="sender">The connection executing the statement</param>
  /// <param name="e">Event arguments of the trace</param>
  public delegate void SQLiteTraceEventHandler(object sender, TraceEventArgs e);

  ///////////////////////////////////////////////////////////////////////////////////////////////

  #region Backup API Members
  /// <summary>
  /// Raised between each backup step.
  /// </summary>
  /// <param name="source">
  /// The source database connection.
  /// </param>
  /// <param name="sourceName">
  /// The source database name.
  /// </param>
  /// <param name="destination">
  /// The destination database connection.
  /// </param>
  /// <param name="destinationName">
  /// The destination database name.
  /// </param>
  /// <param name="pages">
  /// The number of pages copied with each step.
  /// </param>
  /// <param name="remainingPages">
  /// The number of pages remaining to be copied.
  /// </param>
  /// <param name="totalPages">
  /// The total number of pages in the source database.
  /// </param>
  /// <param name="retry">
  /// Set to true if the operation needs to be retried due to database
  /// locking issues; otherwise, set to false.
  /// </param>
  /// <returns>
  /// True to continue with the backup process or false to halt the backup
  /// process, rolling back any changes that have been made so far.
  /// </returns>
  public delegate bool SQLiteBackupCallback(
    SQLiteConnection source,
    string sourceName,
    SQLiteConnection destination,
    string destinationName,
    int pages,
    int remainingPages,
    int totalPages,
    bool retry
  );
  #endregion

  ///////////////////////////////////////////////////////////////////////////////////////////////

  /// <summary>
  /// Whenever an update event is triggered on a connection, this enum will indicate
  /// exactly what type of operation is being performed.
  /// </summary>
  public enum UpdateEventType
  {
    /// <summary>
Changes to System.Data.SQLite/SQLiteConnectionPool.cs.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
1
2
3
4
5
6
7
8
9
10
11

12
13
14
15
16
17
18











-







/********************************************************
 * 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;
  using System.Threading;

  internal static class SQLiteConnectionPool
  {
    /// <summary>
    /// Keeps track of connections made on a specified file.  The PoolVersion dictates whether old objects get
    /// returned to the pool or discarded when no longer in use.
    /// </summary>
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
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







-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-









-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+

-
-
+
+

-
-
-
-
-
-
-
+
+
+
+
+
+
+

-
-
+
+

-
-
-
+
+
+

-
+

-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
-
-
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-












-
-
-
-
-
-
+

-
+
-





-







    private static SortedList<string, Pool> _connections = new SortedList<string, Pool>(StringComparer.OrdinalIgnoreCase);

    /// <summary>
    /// The default version number new pools will get
    /// </summary>
    private static int _poolVersion = 1;

    /// <summary>
    /// The number of connections successfully opened from any pool.
    /// This value is incremented by the Remove method.
    /// </summary>
    private static int _poolOpened = 0;

    /// <summary>
    /// The number of connections successfully closed from any pool.
    /// This value is incremented by the Add method.
    /// </summary>
    private static int _poolClosed = 0;

    /// <summary>
    /// Counts the number of pool entries matching the specified file name.
    /// </summary>
    /// <param name="fileName">The file name to match or null to match all files.</param>
    /// <param name="counts">The pool entry counts for each matching file.</param>
    /// <param name="openCount">The total number of connections successfully opened from any pool.</param>
    /// <param name="closeCount">The total number of connections successfully closed from any pool.</param>
    /// <param name="totalCount">The total number of pool entries for all matching files.</param>
    internal static void GetCounts(
        string fileName,
        ref Dictionary<string, int> counts,
        ref int openCount,
        ref int closeCount,
        ref int totalCount
        )
    {
        lock (_connections)
        {
            openCount = _poolOpened;
            closeCount = _poolClosed;

            if (counts == null)
            {
                counts = new Dictionary<string, int>(
                    StringComparer.OrdinalIgnoreCase);
            }

            if (fileName != null)
            {
                Pool queue;

                if (_connections.TryGetValue(fileName, out queue))
                {
                    Queue<WeakReference> poolQueue = queue.Queue;
                    int count = (poolQueue != null) ? poolQueue.Count : 0;

                    counts.Add(fileName, count);
                    totalCount += count;
                }
            }
            else
            {
                foreach (KeyValuePair<string, Pool> pair in _connections)
                {
                    if (pair.Value == null)
                        continue;

                    Queue<WeakReference> poolQueue = pair.Value.Queue;
                    int count = (poolQueue != null) ? poolQueue.Count : 0;

                    counts.Add(pair.Key, count);
                    totalCount += count;
                }
            }
        }
    }

    /// <summary>
    /// Attempt to pull a pooled connection out of the queue for active duty
    /// </summary>
    /// <param name="fileName">The filename for a desired connection</param>
    /// <param name="maxPoolSize">The maximum size the connection pool for the filename can be</param>
    /// <param name="version">The pool version the returned connection will belong to</param>
    /// <returns>Returns NULL if no connections were available.  Even if none are, the poolversion will still be a valid pool version</returns>
    internal static SQLiteConnectionHandle Remove(string fileName, int maxPoolSize, out int version)
    {
        int localVersion;
        Queue<WeakReference> poolQueue;

        //
        // NOTE: This lock cannot be held while checking the queue for available
        //       connections because other methods of this class are called from
        //       the GC finalizer thread and we use the WaitForPendingFinalizers
        //       method (below).  Holding this lock while calling that method
        //       would therefore result in a deadlock.  Instead, this lock is
        //       held only while a temporary copy of the queue is created, and
        //       if necessary, when committing changes back to that original
        //       queue prior to returning from this method.
        //
        lock (_connections)
        {
            Pool queue;
      lock (_connections)
      {
        Pool queue;

            // Default to the highest pool version
            version = _poolVersion;
        // Default to the highest pool version
        version = _poolVersion;

            // If we didn't find a pool for this file, create one even though it will be empty.
            // We have to do this here because otherwise calling ClearPool() on the file will not work for active connections
            // that have never seen the pool yet.
            if (_connections.TryGetValue(fileName, out queue) == false)
            {
                queue = new Pool(_poolVersion, maxPoolSize);
                _connections.Add(fileName, queue);
        // If we didn't find a pool for this file, create one even though it will be empty.
        // We have to do this here because otherwise calling ClearPool() on the file will not work for active connections
        // that have never seen the pool yet.
        if (_connections.TryGetValue(fileName, out queue) == false)
        {
          queue = new Pool(_poolVersion, maxPoolSize);
          _connections.Add(fileName, queue);

                return null;
            }
          return null;
        }

            // We found a pool for this file, so use its version number
            version = localVersion = queue.PoolVersion;
            queue.MaxPoolSize = maxPoolSize;
        // We found a pool for this file, so use its version number
        version = queue.PoolVersion;
        queue.MaxPoolSize = maxPoolSize;

            ResizePool(queue, false);
        ResizePool(queue, false);

            // Try and get a pooled connection from the queue
        // Try and get a pooled connection from the queue
            poolQueue = queue.Queue;
            if (poolQueue == null) return null;

            //
            // NOTE: Temporarily tranfer the queue for this file into a local
            //       variable.  The queue for this file will be modified and
            //       then committed back to the real pool list (below) prior
            //       to returning from this method.
            //
            _connections.Remove(fileName);
            poolQueue = new Queue<WeakReference>(poolQueue);
        }

        try
        {
            while (poolQueue.Count > 0)
            {
                WeakReference cnn = poolQueue.Dequeue();
        while (queue.Queue.Count > 0)
        {
          WeakReference cnn = queue.Queue.Dequeue();
                if (cnn == null) continue;

                SQLiteConnectionHandle hdl = cnn.Target as SQLiteConnectionHandle;
                if (hdl == null) continue;

          SQLiteConnectionHandle hdl = cnn.Target as SQLiteConnectionHandle;
          if (hdl != null)
          {
                //
                // BUGFIX: For ticket [996d13cd87], step #1.  After this point,
                //         make sure that the finalizer for the connection
                //         handle just obtained from the queue cannot START
                //         running (i.e. it may still be pending but it will no
                //         longer start after this point).
                //
                GC.SuppressFinalize(hdl);

                try
                {
                    //
                    // BUGFIX: For ticket [996d13cd87], step #2.  Now, we must wait
                    //         for all pending finalizers which have STARTED running
                    //         and have not yet COMPLETED.  This must be done just
                    //         in case the finalizer for the connection handle just
                    //         obtained from the queue has STARTED running at some
                    //         point before SuppressFinalize was called on it.
                    //
                    //         After this point, checking properties of the
                    //         connection handle (e.g. IsClosed) should work
                    //         reliably without having to worry that they will
                    //         (due to the finalizer) change out from under us.
                    //
                    GC.WaitForPendingFinalizers();

                    //
                    // BUGFIX: For ticket [996d13cd87], step #3.  Next, verify that
                    //         the connection handle is actually valid and [still?]
                    //         not closed prior to actually returning it to our
                    //         caller.
                    //
                    if (!hdl.IsClosed && !hdl.IsInvalid)
                    {
                        Interlocked.Increment(ref _poolOpened);
                        return hdl;
                    }
                }
            return hdl;
          }
        }
                finally
                {
                    //
                    // BUGFIX: For ticket [996d13cd87], step #4.  Next, we must
                    //         re-register the connection handle for finalization
                    //         now that we have a strong reference to it (i.e. the
                    //         finalizer will not run at least until the connection
                    //         is subsequently closed).
                    //
                    GC.ReRegisterForFinalize(hdl);
                }

        return null;
                GC.KeepAlive(hdl);
            }
      }
        }
        finally
        {
            //
            // BUGFIX: For ticket [996d13cd87], step #5.  Finally, commit any
            //         changes to the pool/queue for this database file.
            //
            lock (_connections)
            {
                //
                // NOTE: We must check [again] if a pool exists for this file
                //       because one may have been added while the search for
                //       an available connection was in progress (above).
                //
                Pool queue;
                Queue<WeakReference> newPoolQueue;
                bool addPool;

                if (_connections.TryGetValue(fileName, out queue))
                {
                    addPool = false;
                }
                else
                {
                    addPool = true;
                    queue = new Pool(localVersion, maxPoolSize);
                }

                newPoolQueue = queue.Queue;

                while (poolQueue.Count > 0)
                    newPoolQueue.Enqueue(poolQueue.Dequeue());

                ResizePool(queue, false);

                if (addPool)
                    _connections.Add(fileName, queue);
            }
        }

        return null;
    }

    /// <summary>
    /// Clears out all pooled connections and rev's up the default pool version to force all old active objects
    /// not in the pool to get discarded rather than returned to their pools.
    /// </summary>
    internal static void ClearAllPools()
    {
      lock (_connections)
      {
        foreach (KeyValuePair<string, Pool> pair in _connections)
        {
          if (pair.Value == null)
            continue;

          Queue<WeakReference> poolQueue = pair.Value.Queue;

          while (poolQueue.Count > 0)
          while (pair.Value.Queue.Count > 0)
          {
            WeakReference cnn = poolQueue.Dequeue();
            WeakReference cnn = pair.Value.Queue.Dequeue();
            if (cnn == null) continue;
            SQLiteConnectionHandle hdl = cnn.Target as SQLiteConnectionHandle;
            if (hdl != null)
            {
              hdl.Dispose();
            }
            GC.KeepAlive(hdl);
          }
          
          // Keep track of the highest revision so we can go one higher when we're finished
          if (_poolVersion <= pair.Value.PoolVersion)
            _poolVersion = pair.Value.PoolVersion + 1;
        }
        // All pools are cleared and we have a new highest version number to force all old version active items to get discarded
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
127
128
129
130
131
132
133





134
135

136

137
138
139
140
141

142
143
144
145
146
147
148







-
-
-
-
-
+

-
+
-





-







    {
      lock (_connections)
      {
        Pool queue;
        if (_connections.TryGetValue(fileName, out queue) == true)
        {
          queue.PoolVersion++;

          Queue<WeakReference> poolQueue = queue.Queue;
          if (poolQueue == null) return;

          while (poolQueue.Count > 0)
          while (queue.Queue.Count > 0)
          {
            WeakReference cnn = poolQueue.Dequeue();
            WeakReference cnn = queue.Queue.Dequeue();
            if (cnn == null) continue;
            SQLiteConnectionHandle hdl = cnn.Target as SQLiteConnectionHandle;
            if (hdl != null)
            {
              hdl.Dispose();
            }
            GC.KeepAlive(hdl);
          }
        }
      }
    }

    /// <summary>
    /// Return a connection to the pool for someone else to use.
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
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







-
-
-
-
-
+
-
+





-
















-
-
-
-
+

-
+
-





-




      lock (_connections)
      {
        // If the queue doesn't exist in the pool, then it must've been cleared sometime after the connection was created.
        Pool queue;
        if (_connections.TryGetValue(fileName, out queue) == true && version == queue.PoolVersion)
        {
          ResizePool(queue, true);

          Queue<WeakReference> poolQueue = queue.Queue;
          if (poolQueue == null) return;

          poolQueue.Enqueue(new WeakReference(hdl, false));
          queue.Queue.Enqueue(new WeakReference(hdl, false));
          Interlocked.Increment(ref _poolClosed);
          GC.KeepAlive(hdl);
        }
        else
        {
          hdl.Close();
        }
        GC.KeepAlive(hdl);
      }
    }

    /// <summary>
    /// We don't have to thread-lock anything in this function, because it's only called by other functions above
    /// which already have a thread-safe lock.
    /// </summary>
    /// <param name="queue">The queue to resize</param>
    /// <param name="forAdding">If a function intends to add to the pool, this is true, which forces the resize
    /// to take one more than it needs from the pool</param>
    private static void ResizePool(Pool queue, bool forAdding)
    {
      int target = queue.MaxPoolSize;

      if (forAdding && target > 0) target--;

      Queue<WeakReference> poolQueue = queue.Queue;
      if (poolQueue == null) return;

      while (poolQueue.Count > target)
      while (queue.Queue.Count > target)
      {
        WeakReference cnn = poolQueue.Dequeue();
        WeakReference cnn = queue.Queue.Dequeue();
        if (cnn == null) continue;
        SQLiteConnectionHandle hdl = cnn.Target as SQLiteConnectionHandle;
        if (hdl != null)
        {
          hdl.Dispose();
        }
        GC.KeepAlive(hdl);
      }
    }
  }
}
Changes to System.Data.SQLite/SQLiteConnectionStringBuilder.cs.
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
203
204
205
206
207
208
209


















210
211
212
213
214
215
216







-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-







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

    /// <summary>
    /// An alternate to the data source property that uses the SQLite URI syntax.
    /// </summary>
    [Browsable(false)]
    public string FullUri
    {
      get
      {
        object value;
        TryGetValue("fulluri", out value);
        return value.ToString();
      }
      set
      {
        this["fulluri"] = value;
      }
    }

    /// <summary>
    /// Gets/sets the default command timeout for newly-created commands.  This is especially useful for 
    /// commands used internally such as inside a SQLiteTransaction, where setting the timeout is not possible.
    /// </summary>
    [DisplayName("Default Timeout")]
    [Browsable(true)]
    [DefaultValue(30)]
491
492
493
494
495
496
497
498

499
500
501
502
503
504
505
473
474
475
476
477
478
479

480
481
482
483
484
485
486
487







-
+







        }
    }

    /// <summary>
    /// Determines how SQLite handles the transaction journal file.
    /// </summary>
    [Browsable(true)]
    [DefaultValue(SQLiteJournalModeEnum.Default)]
    [DefaultValue(SQLiteJournalModeEnum.Delete)]
    [DisplayName("Journal Mode")]
    public SQLiteJournalModeEnum JournalMode
    {
      get
      {
        object value;
        TryGetValue("journal mode", out value);
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
626
627
628
629
630
631
632
633
634
635
563
564
565
566
567
568
569









































570
571
572
573
574
575
576







-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-







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

    /// <summary>
    /// If enabled, apply the default connection settings to opened databases.
    /// </summary>
    [DisplayName("SetDefaults")]
    [Browsable(true)]
    [DefaultValue(true)]
    public bool SetDefaults
    {
        get
        {
            object value;
            TryGetValue("setdefaults", out value);
            return SQLiteConvert.ToBoolean(value);
        }
        set
        {
            this["setdefaults"] = value;
        }
    }

    /// <summary>
    /// If enabled, attempt to resolve the provided data source file name to a
    /// full path before opening.
    /// </summary>
    [DisplayName("ToFullPath")]
    [Browsable(true)]
    [DefaultValue(true)]
    public bool ToFullPath
    {
        get
        {
            object value;
            TryGetValue("tofullpath", out value);
            return SQLiteConvert.ToBoolean(value);
        }
        set
        {
            this["tofullpath"] = value;
        }
    }

    /// <summary>
    /// Helper function for retrieving values from the connectionstring
    /// </summary>
    /// <param name="keyword">The keyword to retrieve settings for</param>
    /// <param name="value">The resulting parameter value</param>
    /// <returns>Returns true if the value was found and returned</returns>
    public override bool TryGetValue(string keyword, out object value)
Changes to System.Data.SQLite/SQLiteConvert.cs.
1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
1
2
3
4
5
6
7
8
9
10
11

12
13
14
15
16
17
18
19











-
+







/********************************************************
 * 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;

#if !NET_COMPACT_20 && TRACE_WARNING
#if DEBUG
  using System.Diagnostics;
#endif

  using System.Runtime.InteropServices;
  using System.Collections.Generic;
  using System.Globalization;
  using System.Text;
734
735
736
737
738
739
740
741

742
743
744
745
746
747
748
734
735
736
737
738
739
740

741
742
743
744
745
746
747
748







-
+







      {
        if (_dbtypeNames[n].dataType == typ)
          return _dbtypeNames[n].typeName;
      }

      string defaultTypeName = String.Empty;

#if !NET_COMPACT_20 && TRACE_WARNING
#if DEBUG && !NET_COMPACT_20
      Trace.WriteLine(String.Format(
          "WARNING: Type mapping failed, returning default name \"{0}\" for type {1}.",
          defaultTypeName, typ));
#endif

      return defaultTypeName;
    }
846
847
848
849
850
851
852


853
854
855
856
857
858
859
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861







+
+







    /// <summary>
    /// For a given type name, return a closest-match .NET type
    /// </summary>
    /// <param name="Name">The name of the type to match</param>
    /// <returns>The .NET DBType the text evaluates to.</returns>
    internal static DbType TypeNameToDbType(string Name)
    {
      if (String.IsNullOrEmpty(Name)) return DbType.Object;

      lock (_syncRoot)
      {
        if (_typeNames == null)
        {
          _typeNames = new Dictionary<string, SQLiteTypeNames>(
              new TypeNameStringComparer());

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
940
941
942
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
940
941
942







-
-











-
+







-
+







            })
          {
            _typeNames.Add(typeName.typeName, typeName);
          }
        }
      }

      if (String.IsNullOrEmpty(Name)) return DbType.Object;

      SQLiteTypeNames value;

      if (_typeNames.TryGetValue(Name, out value))
      {
        return value.dataType;
      }
      else
      {
        int index = Name.IndexOf('(');

        if ((index > 0) &&
            _typeNames.TryGetValue(Name.Substring(0, index).TrimEnd(), out value))
            _typeNames.TryGetValue(Name.Substring(0, index), out value))
        {
          return value.dataType;
        }
      }

      DbType defaultDbType = DbType.Object;

#if !NET_COMPACT_20 && TRACE_WARNING
#if DEBUG && !NET_COMPACT_20
      Trace.WriteLine(String.Format(
          "WARNING: Type mapping failed, returning default type {0} for name \"{1}\".",
          defaultDbType, Name));
#endif

      return defaultDbType;
    }
998
999
1000
1001
1002
1003
1004
1005

1006
1007
1008
1009

1010
1011
1012
1013
1014

1015
1016
1017
1018
1019
1020
1021
998
999
1000
1001
1002
1003
1004

1005
1006
1007
1008

1009

1010
1011
1012

1013
1014
1015
1016
1017
1018
1019
1020







-
+



-
+
-



-
+







  /// 
  /// The preferred order of choosing a datetime format is JulianDay, ISO8601, and then Ticks.  Ticks is mainly present for legacy 
  /// code support.
  /// </remarks>
  public enum SQLiteDateFormats
  {
    /// <summary>
    /// Use the value of DateTime.Ticks.  This value is not recommended and is not well supported with LINQ.
    /// Using ticks is not recommended and is not well supported with LINQ.
    /// </summary>
    Ticks = 0,
    /// <summary>
    /// Use the ISO-8601 format.  Uses the "yyyy-MM-dd HH:mm:ss.FFFFFFFK" format for UTC DateTime values and
    /// The ISO8601 format
    /// "yyyy-MM-dd HH:mm:ss.FFFFFFF" format for local DateTime values).
    /// </summary>
    ISO8601 = 1,
    /// <summary>
    /// The interval of time in days and fractions of a day since January 1, 4713 BC.
    /// JulianDay format, which is what SQLite uses internally
    /// </summary>
    JulianDay = 2,
    /// <summary>
    /// The whole number of seconds since the Unix epoch (January 1, 1970).
    /// </summary>
    UnixEpoch = 3,
    /// <summary>
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1076
1077
1078
1079
1080
1081
1082







































1083
1084
1085
1086
1087
1088
1089







-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-







    /// SQLite uses a write-ahead log instead of a rollback journal to implement transactions.  The WAL journaling mode is persistent;
    /// after being set it stays in effect across multiple database connections and after closing and reopening the database. A database
    /// in WAL journaling mode can only be accessed by SQLite version 3.7.0 or later.
    /// </summary>
    Wal = 5
  }

  /// <summary>
  /// Possible values for the "synchronous" database setting.  This setting determines
  /// how often the database engine calls the xSync method of the VFS.
  /// </summary>
  internal enum SQLiteSynchronousEnum
  {
      /// <summary>
      /// Use the default "synchronous" database setting.  Currently, this should be
      /// the same as using the FULL mode.
      /// </summary>
      Default = -1,

      /// <summary>
      /// The database engine continues without syncing as soon as it has handed
      /// data off to the operating system.  If the application running SQLite
      /// crashes, the data will be safe, but the database might become corrupted
      /// if the operating system crashes or the computer loses power before that
      /// data has been written to the disk surface.
      /// </summary>
      Off = 0,

      /// <summary>
      /// The database engine will still sync at the most critical moments, but
      /// less often than in FULL mode.  There is a very small (though non-zero)
      /// chance that a power failure at just the wrong time could corrupt the
      /// database in NORMAL mode.
      /// </summary>
      Normal = 1,

      /// <summary>
      /// The database engine will use the xSync method of the VFS to ensure that
      /// all content is safely written to the disk surface prior to continuing.
      /// This ensures that an operating system crash or power failure will not
      /// corrupt the database.  FULL synchronous is very safe, but it is also
      /// slower.
      /// </summary>
      Full = 2
  }

  /// <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
Changes to System.Data.SQLite/SQLiteDataAdapter.cs.
Changes to System.Data.SQLite/SQLiteDataReader.cs.
227
228
229
230
231
232
233
234

235
236
237
238
239
240
241
227
228
229
230
231
232
233

234
235
236
237
238
239
240
241







-
+







      if (!_throwOnDisposed)
        return;

      if (_command == null)
        throw new InvalidOperationException("DataReader has been closed");

      if (_version == 0)
        throw new SQLiteException(SQLiteErrorCode.Abort, "Execution was aborted by the user");
        throw new SQLiteException((int)SQLiteErrorCode.Abort, "Execution was aborted by the user");

      if (_command.Connection.State != ConnectionState.Open || _command.Connection._version != _version)
        throw new InvalidOperationException("Connection was closed, statement was terminated");
    }

    /// <summary>
    /// Throw an error if a row is not loaded
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
637
638
639
640
641
642
643

644
645
646
647
648
649
650







-







    /// </summary>
    /// <param name="name">The name of the column to retrieve</param>
    /// <returns>The int i of the column</returns>
    public override int GetOrdinal(string name)
    {
      CheckDisposed();
      CheckClosed();
      SQLiteCommand.Check(_command);

      int r = _activeStatement._sql.ColumnIndex(_activeStatement, name);
      if (r == -1 && _keyInfo != null)
      {
        r = _keyInfo.GetOrdinal(name);
        if (r > -1) r += VisibleFieldCount;
      }
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
771
772
773
774
775
776
777

778
779
780
781
782
783
784







-







            columnToParent.Add(n, value);
        }
    }

    internal DataTable GetSchemaTable(bool wantUniqueInfo, bool wantDefaultValue)
    {
      CheckClosed();
      SQLiteCommand.Check(_command);

     //
     // BUGFIX: We need to quickly scan all the fields in the current
     //         "result set" to see how many distinct tables are actually
     //         involved.  This information is necessary so that some
     //         intelligent decisions can be made when constructing the
     //         metadata below.  For example, we need to be very careful
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1137
1138
1139
1140
1141
1142
1143

1144
1145
1146
1147
1148
1149
1150







-







    /// Moves to the next resultset in multiple row-returning SQL command.
    /// </summary>
    /// <returns>True if the command was successful and a new resultset is available, False otherwise.</returns>
    public override bool NextResult()
    {
      CheckDisposed();
      CheckClosed();
      SQLiteCommand.Check(_command);

      SQLiteStatement stmt = null;
      int fieldCount;

      while (true)
      {
        if (stmt == null && _activeStatement != null && _activeStatement._sql != null && _activeStatement._sql.IsOpen())
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1253
1254
1255
1256
1257
1258
1259

1260
1261
1262
1263
1264
1265
1266







-







    /// 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()
    {
      CheckDisposed();
      CheckClosed();
      SQLiteCommand.Check(_command);

      if (_readingState == -1) // First step was already done at the NextResult() level, so don't step again, just return true.
      {
        _readingState = 0;
        return true;
      }
      else if (_readingState == 0) // Actively reading rows
1313
1314
1315
1316
1317
1318
1319
1320

1321
1322

1323
1324

1325
1326

1327
1328
1329
1309
1310
1311
1312
1313
1314
1315

1316


1317


1318


1319
1320
1321
1322







-
+
-
-
+
-
-
+
-
-
+



    public override object this[int i]
    {
      get { CheckDisposed(); return GetValue(i); }
    }

    private void LoadKeyInfo()
    {
        if (_keyInfo != null)
      if (_keyInfo != null)
        {
            _keyInfo.Dispose();
        _keyInfo.Dispose();
            _keyInfo = null;
        }


        _keyInfo = new SQLiteKeyReader(_command.Connection, this, _activeStatement);
      _keyInfo = new SQLiteKeyReader(_command.Connection, this, _activeStatement);
    }
  }
}
Deleted System.Data.SQLite/SQLiteDefineConstants.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
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


























































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
/********************************************************
 * 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!
 ********************************************************/

using System.Collections.Generic;

namespace System.Data.SQLite
{
    internal static class SQLiteDefineConstants
    {
        public static readonly IList<string> OptionList = new List<string>(new string[] {
#if CHECK_STATE
            "CHECK_STATE",
#endif

#if DEBUG
            "DEBUG",
#endif

#if INTEROP_CODEC
            "INTEROP_CODEC",
#endif

#if INTEROP_EXTENSION_FUNCTIONS
            "INTEROP_EXTENSION_FUNCTIONS",
#endif

#if NET_20
            "NET_20",
#endif

#if NET_COMPACT_20
            "NET_COMPACT_20",
#endif

#if PLATFORM_COMPACTFRAMEWORK
            "PLATFORM_COMPACTFRAMEWORK",
#endif

#if PRELOAD_NATIVE_LIBRARY
            "PRELOAD_NATIVE_LIBRARY",
#endif

#if RETARGETABLE
            "RETARGETABLE",
#endif

#if SQLITE_STANDARD
            "SQLITE_STANDARD",
#endif

#if THROW_ON_DISPOSED
            "THROW_ON_DISPOSED",
#endif

#if TRACE
            "TRACE",
#endif

#if TRACE_CONNECTION
            "TRACE_CONNECTION",
#endif

#if TRACE_HANDLE
            "TRACE_HANDLE",
#endif

#if TRACE_PRELOAD
            "TRACE_PRELOAD",
#endif

#if TRACE_STATEMENT
            "TRACE_STATEMENT",
#endif

#if TRACE_WARNING
            "TRACE_WARNING",
#endif

#if USE_INTEROP_DLL
            "USE_INTEROP_DLL",
#endif

            null
        });
    }
}
Changes to System.Data.SQLite/SQLiteException.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
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
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













-

-






-
-
+
+







-
-
-
-
-
-
-
-
-



-




-
+
-

-
+
-
-
-
+
-
-
-
-
+
+

-
+



-
+
-

-
+






-
+






-
-
+
+
+

-
-





-

-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+











-
+

-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
-
-
+
+
+



-
+
-
-
-




-
+

-
+



-
+



-
+



-
+



-
+



-
+



-
+

-
+

-
+

-
+

-
+



-
+



-
+



-
+

-
+

-
+



-
+



-
+



-
+



-
+



-
+

-
+

-
+



-
+



-
+



-
+



-
+



-
+



-
+



-
+



-
+







-
+


/********************************************************
 * 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.Data.Common;

#if !PLATFORM_COMPACTFRAMEWORK
  using System.Reflection;
  using System.Runtime.Serialization;
  using System.Security.Permissions;
#endif

  /// <summary>
  /// SQLite exception class.
  /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
  [Serializable()]
  public sealed class SQLiteException : DbException, ISerializable
  [Serializable]
  public sealed class SQLiteException : DbException
#else
  public sealed class SQLiteException : Exception
#endif
  {
    private SQLiteErrorCode _errorCode;

#if !PLATFORM_COMPACTFRAMEWORK
    /// <summary>
    /// Private constructor for use with serialization.
    /// </summary>
    /// <param name="info">
    /// Holds the serialized object data about the exception being thrown.
    /// </param>
    /// <param name="context">
    /// Contains contextual information about the source or destination.
    /// </param>
    private SQLiteException(SerializationInfo info, StreamingContext context)
      : base(info, context)
    {
      _errorCode = (SQLiteErrorCode)info.GetInt32("errorCode");
    }
#endif

    /// <summary>
    /// Public constructor for generating a SQLite exception given the error
    /// Public constructor for generating a SQLite error given the base error code
    /// code and message.
    /// </summary>
    /// <param name="errorCode">
    /// <param name="errorCode">The SQLite error code to report</param>
    /// The SQLite return code to report.
    /// </param>
    /// <param name="message">
    /// <param name="extendedInformation">Extra text to go along with the error message text</param>
    /// Message text to go along with the return code message text.
    /// </param>
    public SQLiteException(SQLiteErrorCode errorCode, string message)
      : base(GetStockErrorMessage(errorCode, message))
    public SQLiteException(int errorCode, string extendedInformation)
      : base(GetStockErrorMessage(errorCode, extendedInformation))
    {
      _errorCode = errorCode;
      _errorCode = (SQLiteErrorCode)errorCode;
    }

    /// <summary>
    /// Public constructor that uses the base class constructor for the error
    /// Various public constructors that just pass along to the base Exception
    /// message.
    /// </summary>
    /// <param name="message">Error message text.</param>
    /// <param name="message">Passed verbatim to Exception</param>
    public SQLiteException(string message)
      : base(message)
    {
    }

    /// <summary>
    /// Public constructor that uses the default base class constructor.
    /// Various public constructors that just pass along to the base Exception
    /// </summary>
    public SQLiteException()
    {
    }

    /// <summary>
    /// Public constructor that uses the base class constructor for the error
    /// message and inner exception.
    /// Various public constructors that just pass along to the base Exception
    /// <param name="message">Passed to Exception</param>
    /// <param name="innerException">Passed to Exception</param>
    /// </summary>
    /// <param name="message">Error message text.</param>
    /// <param name="innerException">The original (inner) exception.</param>
    public SQLiteException(string message, Exception innerException)
      : base(message, innerException)
    {
    }

#if !PLATFORM_COMPACTFRAMEWORK
    /// <summary>
    /// Adds extra information to the serialized object data specific to this
    /// class type.  This is only used for serialization.
    /// </summary>
    /// <param name="info">
    /// Holds the serialized object data about the exception being thrown.
    /// </param>
    /// <param name="context">
    /// Contains contextual information about the source or destination.
    /// </param>
    [SecurityPermission(
      SecurityAction.LinkDemand,
      Flags = SecurityPermissionFlag.SerializationFormatter)]
    public override void GetObjectData(
      SerializationInfo info,
      StreamingContext context)
    {
      if (info != null)
        info.AddValue("errorCode", _errorCode);

      base.GetObjectData(info, context);
    }
#endif

    /// <summary>
    /// Gets the underlying SQLite return code for this exception.
    /// Retrieves the underlying SQLite error code for this exception
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    public new SQLiteErrorCode ErrorCode
#else
    public SQLiteErrorCode ErrorCode
#endif
    {
      get { return _errorCode; }
    }

    /// <summary>
    /// Returns the error message for the specified SQLite return code.
    /// Initializes the exception class with the SQLite error code.
    /// </summary>
    /// <param name="errorCode">The SQLite return code.</param>
    /// <returns>The error message or null if it cannot be found.</returns>
    private static string GetErrorString(
        SQLiteErrorCode errorCode
        )
    {
    /// <param name="errorCode">The SQLite error code</param>
    /// <param name="errorMessage">A detailed error message</param>
    /// <returns>An error message string</returns>
    private static string GetStockErrorMessage(int errorCode, string errorMessage)
    {
      if (errorMessage == null) errorMessage = "";

      if (errorMessage.Length > 0)
        errorMessage = "\r\n" + errorMessage;

#if !PLATFORM_COMPACTFRAMEWORK
        //
        // HACK: This must be done via reflection in order to prevent
        //       the RuntimeHelpers.PrepareDelegate method from over-
        //       eagerly attempting to locate the new (and optional)
        //       sqlite3_errstr() function in the SQLite core library
        //       because it happens to be in the static call graph for
        //       the AppDomain.DomainUnload event handler registered
      if (errorCode < 0 || errorCode >= _errorMessages.Length)
        errorCode = 1;

      return _errorMessages[errorCode] + errorMessage;
        //       by the SQLiteLog class.
        //
        BindingFlags flags = BindingFlags.Static |
            BindingFlags.NonPublic | BindingFlags.InvokeMethod;

    }
        return typeof(SQLiteBase).InvokeMember("GetErrorString",
            flags, null, null, new object[] { errorCode }) as string;
#else
        return SQLiteBase.GetErrorString(errorCode);
#endif
    }

    /// <summary>
    /// Returns the composite error message based on the SQLite return code
    /// and the optional detailed error message.
    /// </summary>
    /// <param name="errorCode">The SQLite return code.</param>
    /// <param name="message">Optional detailed error message.</param>
    /// <returns>Error message text for the return code.</returns>
    private static string GetStockErrorMessage(
        SQLiteErrorCode errorCode,
        string message

    private static string[] _errorMessages = {
      "SQLite OK",
      "SQLite error",
      "An internal logic error in SQLite",
      "Access permission denied",
      "Callback routine requested an abort",
      "The database file is locked",
      "A table in the database is locked",
      "malloc() failed",
      "Attempt to write a read-only database",
      "Operation terminated by sqlite3_interrupt()",
      "Some kind of disk I/O error occurred",
      "The database disk image is malformed",
      "Table or record not found",
      "Insertion failed because the database is full",
      "Unable to open the database file",
      "Database lock protocol error",
      "Database is empty",
      "The database schema changed",
      "Too much data for one row of a table",
      "Abort due to constraint violation",
        )
    {
        return String.Format("{0}{1}{2}",
            GetErrorString(errorCode),
      "Data type mismatch",
      "Library used incorrectly",
      "Uses OS features not supported on host",
      "Authorization denied",
      "Auxiliary database format error",
            Environment.NewLine, message).Trim();
    }
      "2nd parameter to sqlite3_bind() out of range",
      "File opened that is not a database file",
    };
  }

  /// <summary>
  /// SQLite error codes.  Actually, this enumeration represents a return code,
  /// SQLite error codes
  /// which may also indicate success in one of several ways (e.g. SQLITE_OK,
  /// SQLITE_ROW, and SQLITE_DONE).  Therefore, the name of this enumeration is
  /// something of a misnomer.
  /// </summary>
  public enum SQLiteErrorCode
  {
    /// <summary>
    /// Successful result
    /// Success
    /// </summary>
    Ok /* 0 */,
    Ok = 0,
    /// <summary>
    /// SQL error or missing database
    /// </summary>
    Error /* 1 */,
    Error,
    /// <summary>
    /// Internal logic error in SQLite
    /// </summary>
    Internal /* 2 */,
    Internal,
    /// <summary>
    /// Access permission denied
    /// </summary>
    Perm /* 3 */,
    Perm,
    /// <summary>
    /// Callback routine requested an abort
    /// </summary>
    Abort /* 4 */,
    Abort,
    /// <summary>
    /// The database file is locked
    /// </summary>
    Busy /* 5 */,
    Busy,
    /// <summary>
    /// A table in the database is locked
    /// </summary>
    Locked /* 6 */,
    Locked,
    /// <summary>
    /// A malloc() failed
    /// malloc() failed
    /// </summary>
    NoMem /* 7 */,
    NoMem,
    /// <summary>
    /// Attempt to write a readonly database
    /// Attempt to write a read-only database
    /// </summary>
    ReadOnly /* 8 */,
    ReadOnly,
    /// <summary>
    /// Operation terminated by sqlite3_interrupt()
    /// </summary>
    Interrupt /* 9 */,
    Interrupt,
    /// <summary>
    /// Some kind of disk I/O error occurred
    /// </summary>
    IoErr /* 10 */,
    IOErr,
    /// <summary>
    /// The database disk image is malformed
    /// </summary>
    Corrupt /* 11 */,
    Corrupt,
    /// <summary>
    /// Unknown opcode in sqlite3_file_control()
    /// Table or record not found
    /// </summary>
    NotFound /* 12 */,
    NotFound,
    /// <summary>
    /// Insertion failed because database is full
    /// </summary>
    Full /* 13 */,
    Full,
    /// <summary>
    /// Unable to open the database file
    /// </summary>
    CantOpen /* 14 */,
    CantOpen,
    /// <summary>
    /// Database lock protocol error
    /// </summary>
    Protocol /* 15 */,
    Protocol,
    /// <summary>
    /// Database is empty
    /// </summary>
    Empty /* 16 */,
    Empty,
    /// <summary>
    /// The database schema changed
    /// </summary>
    Schema /* 17 */,
    Schema,
    /// <summary>
    /// String or BLOB exceeds size limit
    /// Too much data for one row of a table
    /// </summary>
    TooBig /* 18 */,
    TooBig,
    /// <summary>
    /// Abort due to constraint violation
    /// </summary>
    Constraint /* 19 */,
    Constraint,
    /// <summary>
    /// Data type mismatch
    /// </summary>
    Mismatch /* 20 */,
    Mismatch,
    /// <summary>
    /// Library used incorrectly
    /// </summary>
    Misuse /* 21 */,
    Misuse,
    /// <summary>
    /// Uses OS features not supported on host
    /// </summary>
    NoLfs /* 22 */,
    NOLFS,
    /// <summary>
    /// Authorization denied
    /// </summary>
    Auth /* 23 */,
    Auth,
    /// <summary>
    /// Auxiliary database format error
    /// </summary>
    Format /* 24 */,
    Format,
    /// <summary>
    /// 2nd parameter to sqlite3_bind out of range
    /// </summary>
    Range /* 25 */,
    Range,
    /// <summary>
    /// File opened that is not a database file
    /// </summary>
    NotADb /* 26 */,
    NotADatabase,
    /// <summary>
    /// sqlite3_step() has another row ready
    /// </summary>
    Row = 100,
    /// <summary>
    /// sqlite3_step() has finished executing
    /// </summary>
    Done /* 101 */
    Done = 101,
  }
}
Changes to System.Data.SQLite/SQLiteFactory.cs.
Changes to System.Data.SQLite/SQLiteFunction.cs.
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
388
389
390
391
392
393
394

395
396
397
398
399
400
401







-







        {
            try
            {
                if ((_flags & SQLiteConnectionFlags.LogCallbackException) ==
                        SQLiteConnectionFlags.LogCallbackException)
                {
                    SQLiteLog.LogMessage(COR_E_EXCEPTION, String.Format(
                        CultureInfo.CurrentCulture,
                        "Caught exception in \"Invoke\" method: {0}",
                        e)); /* throw */
                }
            }
            catch
            {
                // do nothing.
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
432
433
434
435
436
437
438

439
440
441
442
443
444
445







-







        {
            try
            {
                if ((_flags & SQLiteConnectionFlags.LogCallbackException) ==
                        SQLiteConnectionFlags.LogCallbackException)
                {
                    SQLiteLog.LogMessage(COR_E_EXCEPTION, String.Format(
                        CultureInfo.CurrentCulture,
                        "Caught exception in \"Compare\" (UTF8) method: {0}",
                        e)); /* throw */
                }
            }
            catch
            {
                // do nothing.
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
485
486
487
488
489
490
491

492
493
494
495
496
497
498







-







        {
            try
            {
                if ((_flags & SQLiteConnectionFlags.LogCallbackException) ==
                        SQLiteConnectionFlags.LogCallbackException)
                {
                    SQLiteLog.LogMessage(COR_E_EXCEPTION, String.Format(
                        CultureInfo.CurrentCulture,
                        "Caught exception in \"Compare\" (UTF16) method: {0}",
                        e)); /* throw */
                }
            }
            catch
            {
                // do nothing.
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
564
565
566
567
568
569
570

571
572
573
574
575
576
577







-







        {
            try
            {
                if ((_flags & SQLiteConnectionFlags.LogCallbackException) ==
                        SQLiteConnectionFlags.LogCallbackException)
                {
                    SQLiteLog.LogMessage(COR_E_EXCEPTION, String.Format(
                        CultureInfo.CurrentCulture,
                        "Caught exception in \"Step\" method: {1}",
                        e)); /* throw */
                }
            }
            catch
            {
                // do nothing.
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
625
626
627
628
629
630
631

632
633
634
635
636
637
638







-







        {
            try
            {
                if ((_flags & SQLiteConnectionFlags.LogCallbackException) ==
                        SQLiteConnectionFlags.LogCallbackException)
                {
                    SQLiteLog.LogMessage(COR_E_EXCEPTION, String.Format(
                        CultureInfo.CurrentCulture,
                        "Caught exception in \"Final\" method: {1}",
                        e)); /* throw */
                }
            }
            catch
            {
                // do nothing.
Changes to System.Data.SQLite/SQLiteFunctionAttribute.cs.
Changes to System.Data.SQLite/SQLiteKeyReader.cs.
341
342
343
344
345
346
347
348
349
350
351
352
353
354







355
356

357
358
359
360
361
362
363
364
341
342
343
344
345
346
347







348
349
350
351
352
353
354
355

356

357
358
359
360
361
362
363







-
-
-
-
-
-
-
+
+
+
+
+
+
+

-
+
-







            {
                ////////////////////////////////////
                // dispose managed resources here...
                ////////////////////////////////////

                _stmt = null;

                if (_keyInfo != null)
                {
                    for (int n = 0; n < _keyInfo.Length; n++)
                    {
                        if (_keyInfo[n].query != null)
                            _keyInfo[n].query.Dispose();
                    }
                if (_keyInfo == null) return;

                for (int n = 0; n < _keyInfo.Length; n++)
                {
                    if (_keyInfo[n].query != null)
                        _keyInfo[n].query.Dispose();
                }

                    _keyInfo = null;
                _keyInfo = null;
                }
            }

            //////////////////////////////////////
            // release unmanaged resources here...
            //////////////////////////////////////

            disposed = true;
Changes to System.Data.SQLite/SQLiteLog.cs.
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
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







-
+




-
+
-

-
+















-
+
-
-
-




-
+







namespace System.Data.SQLite
{
    using System;
    using System.Data.Common;
    using System.Diagnostics;

    /// <summary>
    /// Event data for logging event handlers.
    /// Passed during an Log callback
    /// </summary>
    public class LogEventArgs : EventArgs
    {
        /// <summary>
        /// The error code.  The type of this object value should be
        /// The error code.
        /// System.Int32 or SQLiteErrorCode.
        /// </summary>
        public readonly object ErrorCode;
        public readonly int ErrorCode;

        /// <summary>
        /// SQL statement text as the statement first begins executing
        /// </summary>
        public readonly string Message;

        /// <summary>
        /// Extra data associated with this event, if any.
        /// </summary>
        public readonly object Data;

        /// <summary>
        /// Constructs the LogEventArgs object.
        /// </summary>
        /// <param name="pUserData">Should be null.</param>
        /// <param name="errorCode">
        /// <param name="errorCode">The SQLite error code.</param>
        /// The error code.  The type of this object value should be
        /// System.Int32 or SQLiteErrorCode.
        /// </param>
        /// <param name="message">The error message, if any.</param>
        /// <param name="data">The extra data, if any.</param>
        internal LogEventArgs(
            IntPtr pUserData,
            object errorCode,
            int errorCode,
            string message,
            object data
            )
        {
            ErrorCode = errorCode;
            Message = message;
            Data = data;
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
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







-
+

-
+



















-
-
+
+







                //       event on to any registered handler.  We only want to
                //       do this once.
                //
                if (_callback == null)
                {
                    _callback = new SQLiteLogCallback(LogCallback);

                    SQLiteErrorCode rc = _sql.SetLogCallback(_callback);
                    int rc = _sql.SetLogCallback(_callback);

                    if (rc != SQLiteErrorCode.Ok)
                    if (rc != 0)
                        throw new SQLiteException(rc,
                            "Failed to initialize logging.");
                }

                //
                // NOTE: Logging is enabled by default.
                //
                _enabled = true;

                //
                // NOTE: For now, always setup the default log event handler.
                //
                AddDefaultHandler();
            }
        }

        /// <summary>
        /// Handles the AppDomain being unloaded.
        /// </summary>
        /// <param name="sender">Should be null.</param>
        /// <param name="e">The data associated with this event.</param>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private static void DomainUnload(
            object sender,
            EventArgs e
            )
        {
            lock (syncRoot)
            {
218
219
220
221
222
223
224
225

226
227

228
229
230
231
232
233

234
235
236
237
238
239
240
214
215
216
217
218
219
220

221
222

223
224
225
226
227
228

229
230
231
232
233
234
235
236







-
+

-
+





-
+







                //
                // BUGBUG: This will cause serious problems if other AppDomains
                //         have any open SQLite connections; however, there is
                //         currently no way around this limitation.
                //
                if (_sql != null)
                {
                    SQLiteErrorCode rc = _sql.Shutdown();
                    int rc = _sql.Shutdown();

                    if (rc != SQLiteErrorCode.Ok)
                    if (rc != 0)
                        throw new SQLiteException(rc,
                            "Failed to shutdown interface.");

                    rc = _sql.SetLogCallback(null);

                    if (rc != SQLiteErrorCode.Ok)
                    if (rc != 0)
                        throw new SQLiteException(rc,
                            "Failed to shutdown logging.");
                }

                //
                // BUGFIX: Make sure to reset the callback for next time.  This
                //         must be done after it has been succesfully removed
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
294
295
296
297
298
299
300













301














302
303
304
305
306
307

















308
309
310
311
312
313
314







-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-






-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-







            set { lock (syncRoot) { _enabled = value; } }
        }

        /// <summary>
        /// Log a message to all the registered log event handlers without going
        /// through the SQLite library.
        /// </summary>
        /// <param name="message">The message to be logged.</param>
        public static void LogMessage(
            string message
            )
        {
            LogMessage(null, message);
        }

        /// <summary>
        /// Log a message to all the registered log event handlers without going
        /// through the SQLite library.
        /// </summary>
        /// <param name="errorCode">The SQLite error code.</param>
        /// <param name="errorCode">The error code or zero for success.</param>
        /// <param name="message">The message to be logged.</param>
        public static void LogMessage(
            SQLiteErrorCode errorCode,
            string message
            )
        {
            LogMessage((object)errorCode, message);
        }

        /// <summary>
        /// Log a message to all the registered log event handlers without going
        /// through the SQLite library.
        /// </summary>
        /// <param name="errorCode">The integer error code.</param>
        /// <param name="message">The message to be logged.</param>
        public static void LogMessage(
            int errorCode,
            string message
            )
        {
            LogMessage((object)errorCode, message);
        }

        /// <summary>
        /// Log a message to all the registered log event handlers without going
        /// through the SQLite library.
        /// </summary>
        /// <param name="errorCode">
        /// The error code.  The type of this object value should be
        /// System.Int32 or SQLiteErrorCode.
        /// </param>
        /// <param name="message">The message to be logged.</param>
        private static void LogMessage(
            object errorCode,
            string message
            )
        {
            bool enabled;
            SQLiteLogEventHandler handlers;

            lock (syncRoot)
            {
                enabled = _enabled;
                handlers = _handlers;
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
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







-
-
-

-
-
-
-
-
-
-
-
-












-
-
-
-
-
+







            InitializeDefaultHandler();
            Log -= _defaultHandler;
        }

        /// <summary>
        /// Internal proxy function that calls any registered application log
        /// event handlers.
        ///
        /// WARNING: This method is used more-or-less directly by native code,
        ///          do not modify its type signature.
        /// </summary>
        /// <param name="pUserData">
        /// The extra data associated with this message, if any.
        /// </param>
        /// <param name="errorCode">
        /// The error code associated with this message.
        /// </param>
        /// <param name="pMessage">
        /// The message string to be logged.
        /// </param>
        private static void LogCallback(
            IntPtr pUserData,
            int errorCode,
            IntPtr pMessage
            )
        {
            bool enabled;
            SQLiteLogEventHandler handlers;

            lock (syncRoot)
            {
                enabled = _enabled;

                if (_handlers != null)
                    handlers = _handlers.Clone() as SQLiteLogEventHandler;
                else
                    handlers = null;
                handlers = _handlers;
            }

            if (enabled && (handlers != null))
                handlers(null, new LogEventArgs(pUserData, errorCode,
                    SQLiteBase.UTF8ToString(pMessage, -1), null));
        }

460
461
462
463
464
465
466
467

468
469
470
471
472
473
474
475
476



477
478
479
480
397
398
399
400
401
402
403

404

405







406
407
408
409
410
411
412







-
+
-

-
-
-
-
-
-
-
+
+
+




            {
                message = message.Trim();

                if (message.Length == 0)
                    message = "<empty>";
            }

            object errorCode = e.ErrorCode;
            int errorCode = e.ErrorCode;
            bool success = false;

            if (errorCode is SQLiteErrorCode)
                success = ((SQLiteErrorCode)errorCode == SQLiteErrorCode.Ok);
            else if (errorCode is int)
                success = ((int)errorCode == 0);

            Trace.WriteLine(String.Format("SQLite {0} ({1}): {2}",
                success ? "message" : "error", errorCode, message));
            Trace.WriteLine(String.Format(
                "SQLite {0} ({1}): {2}", errorCode == 0 ?
                "message" : "error", errorCode, message));
        }
    }
#endif
}
Changes to System.Data.SQLite/SQLiteParameter.cs.
Changes to System.Data.SQLite/SQLiteParameterCollection.cs.
Changes to System.Data.SQLite/SQLiteStatement.cs.
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
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







-
+
-
-
+
+











-
+












-
+







            case TypeCode.Double:
                return ((double)obj) != (double)0.0 ? true : false;
            case TypeCode.Decimal:
                return ((decimal)obj) != Decimal.Zero ? true : false;
            case TypeCode.String:
                return Convert.ToBoolean(obj, provider);
            default:
                throw new SQLiteException(SQLiteErrorCode.Error,
                throw new SQLiteException((int)SQLiteErrorCode.Error,
                    String.Format(CultureInfo.CurrentCulture,
                    "Cannot convert type {0} to boolean", typeCode));
                    String.Format("Cannot convert type {0} to boolean",
                    typeCode));
        }
    }

    /// <summary>
    /// Perform the bind operation for an individual parameter
    /// </summary>
    /// <param name="index">The index of the parameter to bind</param>
    /// <param name="param">The parameter we're binding</param>
    private void BindParameter(int index, SQLiteParameter param)
    {
      if (param == null)
        throw new SQLiteException(SQLiteErrorCode.Error, "Insufficient parameters supplied to the command");
        throw new SQLiteException((int)SQLiteErrorCode.Error, "Insufficient parameters supplied to the command");

      object obj = param.Value;
      DbType objType = param.DbType;

      if ((obj != null) && (objType == DbType.Object))
          objType = SQLiteConvert.TypeToDbType(obj.GetType());

#if !PLATFORM_COMPACTFRAMEWORK
      if ((_flags & SQLiteConnectionFlags.LogPreBind) == SQLiteConnectionFlags.LogPreBind)
      {
          IntPtr handle = _sqlite_stmt;

          SQLiteLog.LogMessage(String.Format(
          SQLiteLog.LogMessage(0, String.Format(
              "Binding statement {0} paramter #{1} with database type {2} and raw value {{{3}}}...",
              handle, index, objType, obj));
      }
#endif

      if ((obj == null) || Convert.IsDBNull(obj))
      {
Changes to System.Data.SQLite/SQLiteTransaction.cs.
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
112
113
114
115
116
117
118

119
120
121
122
123
124
125







-








    /// <summary>
    /// Commits the current transaction.
    /// </summary>
    public override void Commit()
    {
      CheckDisposed();
      SQLiteConnection.Check(_cnn);
      IsValid(true);

      if (_cnn._transactionLevel - 1 == 0)
      {
        using (SQLiteCommand cmd = _cnn.CreateCommand())
        {
          cmd.CommandText = "COMMIT";
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
156
157
158
159
160
161
162

163
164
165
166
167
168
169







-








    /// <summary>
    /// Rolls back the active transaction.
    /// </summary>
    public override void Rollback()
    {
      CheckDisposed();
      SQLiteConnection.Check(_cnn);
      IsValid(true);
      IssueRollback(true);
    }

    internal void IssueRollback(bool throwError)
    {
      SQLiteConnection cnn = Interlocked.Exchange(ref _cnn, null);
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
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







-
+




-
+






-
+







      {
        if (throwError == true) throw new ArgumentNullException("No connection associated with this transaction");
        else return false;
      }

      if (_cnn._version != _version)
      {
        if (throwError == true) throw new SQLiteException(SQLiteErrorCode.Misuse, "The connection was closed and re-opened, changes were already rolled back");
        if (throwError == true) throw new SQLiteException((int)SQLiteErrorCode.Misuse, "The connection was closed and re-opened, changes were already rolled back");
        else return false;
      }
      if (_cnn.State != ConnectionState.Open)
      {
        if (throwError == true) throw new SQLiteException(SQLiteErrorCode.Misuse, "Connection was closed");
        if (throwError == true) throw new SQLiteException((int)SQLiteErrorCode.Misuse, "Connection was closed");
        else return false;
      }

      if (_cnn._transactionLevel == 0 || _cnn._sql.AutoCommit == true)
      {
        _cnn._transactionLevel = 0; // Make sure the transaction level is reset before returning
        if (throwError == true) throw new SQLiteException(SQLiteErrorCode.Misuse, "No transaction is active on this connection");
        if (throwError == true) throw new SQLiteException((int)SQLiteErrorCode.Misuse, "No transaction is active on this connection");
        else return false;
      }

      return true;
    }
  }
}
Changes to System.Data.SQLite/SR.Designer.cs.
Changes to System.Data.SQLite/SR.resx.
Changes to System.Data.SQLite/System.Data.SQLite.Files.targets.
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
31
32
33
34
35
36
37

38
39
40
41
42
43
44







-







    <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="SQLiteDefineConstants.cs" />
    <Compile Include="SQLiteException.cs" />
    <Compile Include="SQLiteFactory.cs" />
    <Compile Include="SQLiteFunction.cs" />
    <Compile Include="SQLiteFunctionAttribute.cs" />
    <Compile Include="SQLiteKeyReader.cs" />
    <Compile Include="SQLiteLog.cs" />
    <Compile Include="SQLiteMetaDataCollectionNames.cs" />
Changes to System.Data.SQLite/System.Data.SQLite.Properties.targets.
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
28
29
30
31
32
33
34







35
36
37
38
39
40
41







-
-
-
-
-
-
-







            within the project file itself).
  -->
  <PropertyGroup Condition="'$(IsCompactFramework)' != 'false' And
                            '$(TargetFrameworkVersion)' == 'v2.0'">
    <DefineConstants>$(DefineConstants);NET_COMPACT_20</DefineConstants>
  </PropertyGroup>

  <!--
      NOTE: Enable extra internal state checking?
  -->
  <PropertyGroup Condition="'$(CheckState)' != 'false'">
    <DefineConstants>$(DefineConstants);CHECK_STATE</DefineConstants>
  </PropertyGroup>

  <!--
      NOTE: For interaction with the native SQLite implementation, use the
            custom build interop DLL (i.e. "SQLite.Interop.DLL")?
  -->
  <PropertyGroup Condition="'$(UseInteropDll)' != 'false'">
    <DefineConstants>$(DefineConstants);USE_INTEROP_DLL</DefineConstants>
  </PropertyGroup>
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
72
73
74
75
76
77
78









































79







-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-


  <!--
      NOTE: Attempt to pre-load the native SQLite library?
  -->
  <PropertyGroup Condition="'$(PreLoadNativeLibrary)' != 'false'">
    <DefineConstants>$(DefineConstants);PRELOAD_NATIVE_LIBRARY</DefineConstants>
  </PropertyGroup>

  <!--
      NOTE: Enable support (in the managed assemblies) for the custom extension
            functions?
  -->
  <PropertyGroup Condition="'$(InteropExtensionFunctions)' != 'false'">
    <DefineConstants>$(DefineConstants);INTEROP_EXTENSION_FUNCTIONS</DefineConstants>
  </PropertyGroup>

  <!--
      NOTE: Enable support (in the managed assemblies) for encrypted databases
            using the CryptoAPI based codec?
  -->
  <PropertyGroup Condition="'$(InteropCodec)' != 'false'">
    <DefineConstants>$(DefineConstants);INTEROP_CODEC</DefineConstants>
  </PropertyGroup>

  <!--
      NOTE: Enable various Trace.WriteLine statements included in the code,
            based on several criteria (see the "SQLite.NET.Settings.targets"
            file for more information).
  -->
  <PropertyGroup Condition="'$(TraceConnection)' != 'false'">
    <DefineConstants>$(DefineConstants);TRACE_CONNECTION</DefineConstants>
  </PropertyGroup>

  <PropertyGroup Condition="'$(TraceHandle)' != 'false'">
    <DefineConstants>$(DefineConstants);TRACE_HANDLE</DefineConstants>
  </PropertyGroup>

  <PropertyGroup Condition="'$(TracePreLoad)' != 'false'">
    <DefineConstants>$(DefineConstants);TRACE_PRELOAD</DefineConstants>
  </PropertyGroup>

  <PropertyGroup Condition="'$(TraceStatement)' != 'false'">
    <DefineConstants>$(DefineConstants);TRACE_STATEMENT</DefineConstants>
  </PropertyGroup>

  <PropertyGroup Condition="'$(TraceWarning)' != 'false'">
    <DefineConstants>$(DefineConstants);TRACE_WARNING</DefineConstants>
  </PropertyGroup>
</Project>
Changes to System.Data.SQLite/UnsafeNativeMethods.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
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










-
-
+
-















-
-
-
-







/********************************************************
 * 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.Globalization;

#if PRELOAD_NATIVE_LIBRARY || DEBUG
#if !NET_COMPACT_20 && (TRACE_PRELOAD || TRACE_HANDLE)
  using System.Diagnostics;
#endif

#if PRELOAD_NATIVE_LIBRARY
  using System.Collections.Generic;
  using System.IO;
  using System.Reflection;
#endif

#if !PLATFORM_COMPACTFRAMEWORK && !DEBUG
  using System.Security;
#endif

  using System.Runtime.InteropServices;

#if !PLATFORM_COMPACTFRAMEWORK
  using System.Threading;
#endif

#if !PLATFORM_COMPACTFRAMEWORK && !DEBUG
  [SuppressUnmanagedCodeSecurity]
#endif
  internal static class UnsafeNativeMethods
  {
      #region Optional Native SQLite Library Pre-Loading Code
      //
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
128
129
130
131
132
133
134





135

136

137





138
139
140
141
142
143
144
145







-
-
-
-
-

-
+
-

-
-
-
-
-
+







              //
              // TODO: Make sure this list is updated if the supported
              //       processor architecture names and/or platform names
              //       changes.
              //
              if (processorArchitecturePlatforms == null)
              {
                  //
                  // NOTE: Create the map of processor architecture names
                  //       to platform names using a case-insensitive string
                  //       comparer.
                  //
                  processorArchitecturePlatforms =
                      new Dictionary<string, string>(
                      new Dictionary<string, string>();
                          StringComparer.OrdinalIgnoreCase);

                  //
                  // NOTE: Setup the list of platform names associated with
                  //       the supported processor architectures.
                  //
                  processorArchitecturePlatforms.Add("x86", "Win32");
                  processorArchitecturePlatforms.Add("X86", "Win32");
                  processorArchitecturePlatforms.Add("AMD64", "x64");
                  processorArchitecturePlatforms.Add("IA64", "Itanium");
              }

              //
              // BUGBUG: What about other application domains?
              //
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
244
245
246
247
248
249
250











251
252
253
254
255
256
257







-
-
-
-
-
-
-
-
-
-
-







      /// The processor architecture of the current process -OR- null if it
      /// cannot be determined.  Always returns an empty string when running on
      /// the .NET Compact Framework.
      /// </returns>
      private static string GetProcessorArchitecture()
      {
#if !PLATFORM_COMPACTFRAMEWORK
          //
          // NOTE: If the "PreLoadSQLite_ProcessorArchitecture" environment
          //       variable is set, use it verbatim for the current processor
          //       architecture.
          //
          string processorArchitecture = Environment.GetEnvironmentVariable(
              "PreLoadSQLite_ProcessorArchitecture");

          if (processorArchitecture != null)
              return processorArchitecture;

          //
          // BUGBUG: Will this always be reliable?
          //
          return Environment.GetEnvironmentVariable(PROCESSOR_ARCHITECTURE);
#else
          //
          // BUGBUG: No way to determine this value on the .NET Compact
312
313
314
315
316
317
318











319
320
321
322
323
324
325
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







+
+
+
+
+
+
+
+
+
+
+







                  return null;

              string platformName;

              if (processorArchitecturePlatforms.TryGetValue(
                      processorArchitecture, out platformName))
              {
                  return platformName;
              }

              if (processorArchitecturePlatforms.TryGetValue(
#if !PLATFORM_COMPACTFRAMEWORK
                      processorArchitecture.ToUpperInvariant(),
#else
                      processorArchitecture.ToUpper(),
#endif
                      out platformName))
              {
                  return platformName;
              }
          }

          return null;
      }

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
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







-

-


-








-

-
-
-

-













-








-

















-
+








          try
          {
              //
              // NOTE: Show exactly where we are trying to load the native
              //       SQLite library from.
              //
#if !NET_COMPACT_20 && TRACE_PRELOAD
              Trace.WriteLine(String.Format(
                  CultureInfo.CurrentCulture,
                  "Trying to load native SQLite library \"{0}\"...",
                  fileName));
#endif

              //
              // NOTE: Attempt to load the native library.  This will either
              //       return a valid native module handle, return IntPtr.Zero,
              //       or throw an exception.
              //
              return LoadLibrary(fileName);
          }
#if !NET_COMPACT_20 && TRACE_PRELOAD
          catch (Exception e)
#else
          catch (Exception)
#endif
          {
#if !NET_COMPACT_20 && TRACE_PRELOAD
              try
              {
                  //
                  // NOTE: First, grab the last Win32 error number.
                  //
                  int lastError = Marshal.GetLastWin32Error();

                  //
                  // NOTE: Show where we failed to load the native SQLite
                  //       library from along with the Win32 error code and
                  //       exception information.
                  //
                  Trace.WriteLine(String.Format(
                      CultureInfo.CurrentCulture,
                      "Failed to load native SQLite library \"{0}\" " +
                      "(getLastError = {1}): {2}",
                      fileName, lastError, e)); /* throw */
              }
              catch
              {
                  // do nothing.
              }
#endif
          }

          return IntPtr.Zero;
      }
#endif
#endif
      #endregion

      /////////////////////////////////////////////////////////////////////////

#if !SQLITE_STANDARD

#if !USE_INTEROP_DLL

#if !PLATFORM_COMPACTFRAMEWORK
    private const string SQLITE_DLL = "System.Data.SQLite.dll";
#else
    internal const string SQLITE_DLL = "SQLite.Interop.083.dll";
    internal const string SQLITE_DLL = "SQLite.Interop.080.dll";
#endif // PLATFORM_COMPACTFRAMEWORK

#else
    private const string SQLITE_DLL = "SQLite.Interop.dll";
#endif // USE_INTEROP_DLL

#else
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
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
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







-
+


-
+



















-
+


-
+


-
+


-
+


-
+


-
+
















-
+






-
+






-
+






-
-
-
-
-
-
-
-
+






-
+






-
+







    [DllImport(SQLITE_DLL)]
    internal static extern IntPtr sqlite3_column_text16_interop(IntPtr stmt, int index, out int len);

    [DllImport(SQLITE_DLL)]
    internal static extern IntPtr sqlite3_errmsg_interop(IntPtr db, out int len);

    [DllImport(SQLITE_DLL)]
    internal static extern SQLiteErrorCode sqlite3_prepare_interop(IntPtr db, IntPtr pSql, int nBytes, out IntPtr stmt, out IntPtr ptrRemain, out int nRemain);
    internal static extern int sqlite3_prepare_interop(IntPtr db, IntPtr pSql, int nBytes, out IntPtr stmt, out IntPtr ptrRemain, out int nRemain);

    [DllImport(SQLITE_DLL)]
    internal static extern SQLiteErrorCode sqlite3_table_column_metadata_interop(IntPtr db, byte[] dbName, byte[] tblName, byte[] colName, out IntPtr ptrDataType, out IntPtr ptrCollSeq, out int notNull, out int primaryKey, out int autoInc, out int dtLen, out int csLen);
    internal static extern int sqlite3_table_column_metadata_interop(IntPtr db, byte[] dbName, byte[] tblName, byte[] colName, out IntPtr ptrDataType, out IntPtr ptrCollSeq, out int notNull, out int primaryKey, out int autoInc, out int dtLen, out int csLen);

    [DllImport(SQLITE_DLL)]
    internal static extern IntPtr sqlite3_value_text_interop(IntPtr p, out int len);

    [DllImport(SQLITE_DLL)]
    internal static extern IntPtr sqlite3_value_text16_interop(IntPtr p, out int len);

#endif
// !SQLITE_STANDARD

    #endregion

    // These functions add existing functionality on top of SQLite and require a little effort to
    // get working when using the standard SQLite library.
    #region interop added functionality

#if !SQLITE_STANDARD

    [DllImport(SQLITE_DLL)]
    internal static extern SQLiteErrorCode sqlite3_close_interop(IntPtr db);
    internal static extern int sqlite3_close_interop(IntPtr db);

    [DllImport(SQLITE_DLL)]
    internal static extern SQLiteErrorCode sqlite3_create_function_interop(IntPtr db, byte[] strName, int nArgs, int nType, IntPtr pvUser, SQLiteCallback func, SQLiteCallback fstep, SQLiteFinalCallback ffinal, int needCollSeq);
    internal static extern int sqlite3_create_function_interop(IntPtr db, byte[] strName, int nArgs, int nType, IntPtr pvUser, SQLiteCallback func, SQLiteCallback fstep, SQLiteFinalCallback ffinal, int needCollSeq);

    [DllImport(SQLITE_DLL)]
    internal static extern SQLiteErrorCode sqlite3_finalize_interop(IntPtr stmt);
    internal static extern int sqlite3_finalize_interop(IntPtr stmt);

    [DllImport(SQLITE_DLL)]
    internal static extern SQLiteErrorCode sqlite3_open_interop(byte[] utf8Filename, int flags, out IntPtr db);
    internal static extern int sqlite3_open_interop(byte[] utf8Filename, int flags, out IntPtr db);

    [DllImport(SQLITE_DLL)]
    internal static extern SQLiteErrorCode sqlite3_open16_interop(byte[] utf8Filename, int flags, out IntPtr db);
    internal static extern int sqlite3_open16_interop(byte[] utf8Filename, int flags, out IntPtr db);

    [DllImport(SQLITE_DLL)]
    internal static extern SQLiteErrorCode sqlite3_reset_interop(IntPtr stmt);
    internal static extern int sqlite3_reset_interop(IntPtr stmt);

#endif
// !SQLITE_STANDARD

    #endregion

    // The standard api call equivalents of the above interop calls
    #region standard versions of interop functions

#if SQLITE_STANDARD

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_close(IntPtr db);
    internal static extern int sqlite3_close(IntPtr db);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_close_v2(IntPtr db); /* 3.7.14+ */
    internal static extern int sqlite3_create_function(IntPtr db, byte[] strName, int nArgs, int nType, IntPtr pvUser, SQLiteCallback func, SQLiteCallback fstep, SQLiteFinalCallback ffinal);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_create_function(IntPtr db, byte[] strName, int nArgs, int nType, IntPtr pvUser, SQLiteCallback func, SQLiteCallback fstep, SQLiteFinalCallback ffinal);
    internal static extern int sqlite3_finalize(IntPtr stmt);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_finalize(IntPtr stmt);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_open_v2(byte[] utf8Filename, out IntPtr db, int flags, IntPtr vfs);
    internal static extern int sqlite3_open_v2(byte[] utf8Filename, out IntPtr db, int flags, IntPtr vfs);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
#else
    [DllImport(SQLITE_DLL, CharSet = CharSet.Unicode)]
#endif
    internal static extern SQLiteErrorCode sqlite3_open16(string fileName, out IntPtr db);
    internal static extern int sqlite3_open16(string fileName, out IntPtr db);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_reset(IntPtr stmt);
    internal static extern int sqlite3_reset(IntPtr stmt);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern IntPtr sqlite3_bind_parameter_name(IntPtr stmt, int index);
747
748
749
750
751
752
753
754

755
756
757
758
759
760
761

762
763
764
765
766
767
768
714
715
716
717
718
719
720

721
722
723
724
725
726
727

728
729
730
731
732
733
734
735







-
+






-
+







    internal static extern IntPtr sqlite3_errmsg(IntPtr db);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_prepare(IntPtr db, IntPtr pSql, int nBytes, out IntPtr stmt, out IntPtr ptrRemain);
    internal static extern int sqlite3_prepare(IntPtr db, IntPtr pSql, int nBytes, out IntPtr stmt, out IntPtr ptrRemain);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_table_column_metadata(IntPtr db, byte[] dbName, byte[] tblName, byte[] colName, out IntPtr ptrDataType, out IntPtr ptrCollSeq, out int notNull, out int primaryKey, out int autoInc);
    internal static extern int sqlite3_table_column_metadata(IntPtr db, byte[] dbName, byte[] tblName, byte[] colName, out IntPtr ptrDataType, out IntPtr ptrCollSeq, out int notNull, out int primaryKey, out int autoInc);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern IntPtr sqlite3_value_text(IntPtr p);
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
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







-
+


-
+















-
-
-
-
-
-















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-







    [DllImport(SQLITE_DLL)]
    internal static extern IntPtr sqlite3_context_collseq(IntPtr context, out int type, out int enc, out int len);

    [DllImport(SQLITE_DLL)]
    internal static extern int sqlite3_context_collcompare(IntPtr context, byte[] p1, int p1len, byte[] p2, int p2len);

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

    [DllImport(SQLITE_DLL)]
    internal static extern SQLiteErrorCode sqlite3_index_column_info_interop(IntPtr db, byte[] catalog, byte[] IndexName, byte[] ColumnName, out int sortOrder, out int onError, out IntPtr Collation, out int colllen);
    internal static extern int sqlite3_index_column_info_interop(IntPtr db, byte[] catalog, byte[] IndexName, byte[] ColumnName, out int sortOrder, out int onError, out IntPtr Collation, out int colllen);

    [DllImport(SQLITE_DLL)]
    internal static extern void sqlite3_resetall_interop(IntPtr db);

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

#endif
// !SQLITE_STANDARD

    #endregion

    // Standard API calls global across versions.  There are a few instances of interop calls
    // scattered in here, but they are only active when PLATFORM_COMPACTFRAMEWORK is declared.
    #region standard sqlite api calls
#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
#else
    [DllImport(SQLITE_DLL, CharSet = CharSet.Unicode)]
#endif
    internal static extern SQLiteErrorCode sqlite3_win32_set_directory(uint type, string value);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern IntPtr sqlite3_libversion();

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern IntPtr sqlite3_sourceid();

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern IntPtr sqlite3_malloc(int n);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern IntPtr sqlite3_realloc(IntPtr p, int n);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern void sqlite3_free(IntPtr p);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern void sqlite3_interrupt(IntPtr db);

889
890
891
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
940

941
942
943

944
945
946
947
948
949
950
951
952

953
954
955

956
957
958
959
960
961
962
963

964
965
966
967
968
969
970

971
972
973
974
975
976
977
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
900
901
902

903
904
905
906
907
908
909

910
911
912
913
914
915
916
917







-
+






-
+






-
+



-
+


-
+







-
+










-
+



-
+


-
+








-
+


-
+







-
+






-
+







    internal static extern long sqlite3_memory_highwater(int resetFlag);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_shutdown();
    internal static extern int sqlite3_shutdown();

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_busy_timeout(IntPtr db, int ms);
    internal static extern int sqlite3_busy_timeout(IntPtr db, int ms);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_bind_blob(IntPtr stmt, int index, Byte[] value, int nSize, IntPtr nTransient);
    internal static extern int sqlite3_bind_blob(IntPtr stmt, int index, Byte[] value, int nSize, IntPtr nTransient);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
    internal static extern SQLiteErrorCode sqlite3_bind_double(IntPtr stmt, int index, double value);
    internal static extern int sqlite3_bind_double(IntPtr stmt, int index, double value);
#else
    [DllImport(SQLITE_DLL)]
    internal static extern SQLiteErrorCode sqlite3_bind_double_interop(IntPtr stmt, int index, ref double value);
    internal static extern int sqlite3_bind_double_interop(IntPtr stmt, int index, ref double value);
#endif

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_bind_int(IntPtr stmt, int index, int value);
    internal static extern int sqlite3_bind_int(IntPtr stmt, int index, int value);

    //
    // NOTE: This really just calls "sqlite3_bind_int"; however, it has the
    //       correct type signature for an unsigned (32-bit) integer.
    //
#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, EntryPoint = "sqlite3_bind_int", CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL, EntryPoint = "sqlite3_bind_int")]
#endif
    internal static extern SQLiteErrorCode sqlite3_bind_uint(IntPtr stmt, int index, uint value);
    internal static extern int sqlite3_bind_uint(IntPtr stmt, int index, uint value);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
    internal static extern SQLiteErrorCode sqlite3_bind_int64(IntPtr stmt, int index, long value);
    internal static extern int sqlite3_bind_int64(IntPtr stmt, int index, long value);
#else
    [DllImport(SQLITE_DLL)]
    internal static extern SQLiteErrorCode sqlite3_bind_int64_interop(IntPtr stmt, int index, ref long value);
    internal static extern int sqlite3_bind_int64_interop(IntPtr stmt, int index, ref long value);
#endif

    //
    // NOTE: This really just calls "sqlite3_bind_int64"; however, it has the
    //       correct type signature for an unsigned long (64-bit) integer.
    //
#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, EntryPoint = "sqlite3_bind_int64", CallingConvention = CallingConvention.Cdecl)]
    internal static extern SQLiteErrorCode sqlite3_bind_uint64(IntPtr stmt, int index, ulong value);
    internal static extern int sqlite3_bind_uint64(IntPtr stmt, int index, ulong value);
#else
    [DllImport(SQLITE_DLL, EntryPoint = "sqlite3_bind_int64_interop")]
    internal static extern SQLiteErrorCode sqlite3_bind_uint64_interop(IntPtr stmt, int index, ref ulong value);
    internal static extern int sqlite3_bind_uint64_interop(IntPtr stmt, int index, ref ulong value);
#endif

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_bind_null(IntPtr stmt, int index);
    internal static extern int sqlite3_bind_null(IntPtr stmt, int index);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_bind_text(IntPtr stmt, int index, byte[] value, int nlen, IntPtr pvReserved);
    internal static extern int sqlite3_bind_text(IntPtr stmt, int index, byte[] value, int nlen, IntPtr pvReserved);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern int sqlite3_bind_parameter_count(IntPtr stmt);
991
992
993
994
995
996
997
998

999
1000
1001
1002
1003
1004
1005
931
932
933
934
935
936
937

938
939
940
941
942
943
944
945







-
+







    internal static extern int sqlite3_column_count(IntPtr stmt);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_step(IntPtr stmt);
    internal static extern int sqlite3_step(IntPtr stmt);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
    internal static extern double sqlite3_column_double(IntPtr stmt, int index);
#else
    [DllImport(SQLITE_DLL)]
    internal static extern void sqlite3_column_double_interop(IntPtr stmt, int index, out double value);
1042
1043
1044
1045
1046
1047
1048
1049

1050
1051
1052
1053
1054
1055
1056
982
983
984
985
986
987
988

989
990
991
992
993
994
995
996







-
+







    internal static extern TypeAffinity sqlite3_column_type(IntPtr stmt, int index);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_create_collation(IntPtr db, byte[] strName, int nType, IntPtr pvUser, SQLiteCollation func);
    internal static extern int sqlite3_create_collation(IntPtr db, byte[] strName, int nType, IntPtr pvUser, SQLiteCollation func);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern int sqlite3_aggregate_count(IntPtr context);
1158
1159
1160
1161
1162
1163
1164
1165

1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187

1188
1189
1190
1191
1192
1193
1194

1195
1196
1197
1198
1199
1200
1201
1202
1098
1099
1100
1101
1102
1103
1104

1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120

1121
1122
1123
1124
1125

1126
1127
1128
1129
1130
1131
1132

1133

1134
1135
1136
1137
1138
1139
1140







-
+















-





-
+






-
+
-







    internal static extern IntPtr sqlite3_aggregate_context(IntPtr context, int nBytes);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
#else
    [DllImport(SQLITE_DLL, CharSet = CharSet.Unicode)]
#endif
    internal static extern SQLiteErrorCode sqlite3_bind_text16(IntPtr stmt, int index, string value, int nlen, IntPtr pvReserved);
    internal static extern int sqlite3_bind_text16(IntPtr stmt, int index, string value, int nlen, IntPtr pvReserved);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
#else
    [DllImport(SQLITE_DLL, CharSet = CharSet.Unicode)]
#endif
    internal static extern void sqlite3_result_error16(IntPtr context, string strName, int nLen);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
#else
    [DllImport(SQLITE_DLL, CharSet = CharSet.Unicode)]
#endif
    internal static extern void sqlite3_result_text16(IntPtr context, string strName, int nLen, IntPtr pvReserved);

#if INTEROP_CODEC
#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_key(IntPtr db, byte[] key, int keylen);
    internal static extern int sqlite3_key(IntPtr db, byte[] key, int keylen);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_rekey(IntPtr db, byte[] key, int keylen);
    internal static extern int sqlite3_rekey(IntPtr db, byte[] key, int keylen);
#endif

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern IntPtr sqlite3_update_hook(IntPtr db, SQLiteUpdateCallback func, IntPtr pvUser);
1212
1213
1214
1215
1216
1217
1218
1219

1220
1221

1222
1223

1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239

1240
1241
1242
1243
1244
1245
1246
1150
1151
1152
1153
1154
1155
1156

1157
1158

1159
1160

1161
1162















1163
1164
1165
1166
1167
1168
1169
1170







-
+

-
+

-
+

-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+







    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern IntPtr sqlite3_trace(IntPtr db, SQLiteTraceCallback func, IntPtr pvUser);

    // Since sqlite3_config() takes a variable argument list, we have to overload declarations
    // for all possible calls that we want to use.
    // for all possible calls.  For now, we are only exposing the SQLITE_CONFIG_LOG call.
#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, EntryPoint = "sqlite3_config", CallingConvention = CallingConvention.Cdecl)]
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL, EntryPoint = "sqlite3_config")]
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_config_none(SQLiteConfigOpsEnum op);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, EntryPoint = "sqlite3_config", CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL, EntryPoint = "sqlite3_config")]
#endif
    internal static extern SQLiteErrorCode sqlite3_config_int(SQLiteConfigOpsEnum op, int value);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, EntryPoint = "sqlite3_config", CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL, EntryPoint = "sqlite3_config")]
#endif
    internal static extern SQLiteErrorCode sqlite3_config_log(SQLiteConfigOpsEnum op, SQLiteLogCallback func, IntPtr pvUser);
    internal static extern int sqlite3_config(int op, SQLiteLogCallback func, IntPtr pvUser);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern IntPtr sqlite3_rollback_hook(IntPtr db, SQLiteRollbackCallback func, IntPtr pvUser);
1260
1261
1262
1263
1264
1265
1266
1267

1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281

1282
1283
1284
1285
1286
1287
1288

1289
1290
1291
1292
1293
1294
1295

1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319

1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333

1334
1335
1336
1337
1338
1339
1340

1341
1342
1343
1344
1345
1346
1347
1184
1185
1186
1187
1188
1189
1190

1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204

1205
1206
1207
1208
1209
1210
1211

1212
1213
1214
1215
1216
1217
1218

1219







1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235

1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249

1250
1251
1252
1253
1254
1255
1256

1257
1258
1259
1260
1261
1262
1263
1264







-
+













-
+






-
+






-
+
-
-
-
-
-
-
-
















-
+













-
+






-
+







    internal static extern IntPtr sqlite3_next_stmt(IntPtr db, IntPtr stmt);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_exec(IntPtr db, byte[] strSql, IntPtr pvCallback, IntPtr pvParam, out IntPtr errMsg);
    internal static extern int sqlite3_exec(IntPtr db, byte[] strSql, IntPtr pvCallback, IntPtr pvParam, out IntPtr errMsg);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern int sqlite3_get_autocommit(IntPtr db);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_extended_result_codes(IntPtr db, int onoff);
    internal static extern int sqlite3_extended_result_codes(IntPtr db, int onoff);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_errcode(IntPtr db);
    internal static extern int sqlite3_errcode(IntPtr db);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_extended_errcode(IntPtr db);
    internal static extern int sqlite3_extended_errcode(IntPtr db);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern IntPtr sqlite3_errstr(SQLiteErrorCode rc); /* 3.7.15+ */

    // Since sqlite3_log() takes a variable argument list, we have to overload declarations
    // for all possible calls.  For now, we are only exposing a single string, and 
    // depend on the caller to format the string.
#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern void sqlite3_log(int iErrCode, byte[] zFormat);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_file_control(IntPtr db, byte[] zDbName, int op, IntPtr pArg);
    internal static extern int sqlite3_file_control(IntPtr db, byte[] zDbName, int op, IntPtr pArg);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern IntPtr sqlite3_backup_init(IntPtr destDb, byte[] zDestName, IntPtr sourceDb, byte[] zSourceName);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_backup_step(IntPtr backup, int nPage);
    internal static extern int sqlite3_backup_step(IntPtr backup, int nPage);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_backup_finish(IntPtr backup);
    internal static extern int sqlite3_backup_finish(IntPtr backup);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern int sqlite3_backup_remaining(IntPtr backup);
1431
1432
1433
1434
1435
1436
1437





1438

1439
1440
1441
1442
1443
1444

1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458

1459
1460

1461
1462
1463
1464

1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482

1483
1484
1485
1486
1487
1488

1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533





1534

1535
1536
1537
1538
1539
1540
1541

1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555

1556
1557

1558
1559
1560
1561

1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579

1580
1581
1582
1583
1584
1585

1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630





1631

1632
1633
1634
1635
1636
1637
1638

1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652

1653
1654

1655
1656
1657
1658

1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
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
1709

1710
1711
1712
1713
1714

1715
1716
1717
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359

1360
1361
1362
1363
1364
1365

1366
1367
1368
1369
1370
1371
1372
1373
1374






1375
1376

1377
1378
1379
1380

1381
1382
1383
1384
1385
1386







1387
1388
1389
1390
1391

1392
1393
1394
1395
1396
1397

1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409




1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420







1421
1422
1423
1424
1425


1426
1427
1428
1429
1430
1431
1432
1433
1434
1435

1436
1437
1438

1439
1440
1441

1442
1443
1444
1445
1446
1447
1448
1449
1450






1451
1452

1453
1454
1455
1456

1457
1458
1459
1460
1461
1462







1463
1464
1465
1466
1467

1468
1469
1470
1471
1472
1473

1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485




1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496







1497
1498
1499
1500
1501


1502
1503
1504
1505
1506
1507
1508
1509
1510
1511

1512
1513
1514

1515
1516
1517

1518
1519
1520
1521
1522
1523
1524
1525
1526






1527
1528

1529
1530
1531
1532

1533
1534
1535
1536
1537
1538







1539
1540
1541
1542
1543

1544
1545
1546
1547
1548
1549

1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561




1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572

1573





1574










+
+
+
+
+
-
+





-
+








-
-
-
-
-
-
+

-
+



-
+





-
-
-
-
-
-
-





-
+





-
+











-
-
-
-











-
-
-
-
-
-
-





-
-





+
+
+
+
+
-
+


-



-
+








-
-
-
-
-
-
+

-
+



-
+





-
-
-
-
-
-
-





-
+





-
+











-
-
-
-











-
-
-
-
-
-
-





-
-





+
+
+
+
+
-
+


-



-
+








-
-
-
-
-
-
+

-
+



-
+





-
-
-
-
-
-
-





-
+





-
+











-
-
-
-











-
+
-
-
-
-
-
+
-
-
-
  internal class SQLiteConnectionHandle : CriticalHandle
  {
    public static implicit operator IntPtr(SQLiteConnectionHandle db)
    {
      return (db != null) ? db.handle : IntPtr.Zero;
    }

    public static implicit operator SQLiteConnectionHandle(IntPtr db)
    {
      return new SQLiteConnectionHandle(db);
    }

    internal SQLiteConnectionHandle(IntPtr db)
    private SQLiteConnectionHandle(IntPtr db)
      : this()
    {
      SetHandle(db);
    }

    private SQLiteConnectionHandle()
    internal SQLiteConnectionHandle()
      : base(IntPtr.Zero)
    {
    }

    protected override bool ReleaseHandle()
    {
      try
      {
#if !PLATFORM_COMPACTFRAMEWORK
        IntPtr localHandle = Interlocked.Exchange(
          ref handle, IntPtr.Zero);

        if (localHandle != IntPtr.Zero)
          SQLiteBase.CloseConnection(this, localHandle);
        SQLiteBase.CloseConnection(this);

#if !NET_COMPACT_20 && TRACE_HANDLE
#if DEBUG && !NET_COMPACT_20
        try
        {
          Trace.WriteLine(String.Format(
              "CloseConnection: {0}", localHandle));
              "CloseConnection: {0}", handle));
        }
        catch
        {
        }
#endif
#else
        if (handle != IntPtr.Zero)
        {
          SQLiteBase.CloseConnection(this, handle);
          SetHandle(IntPtr.Zero);
        }
#endif

#if DEBUG
        return true;
#endif
      }
#if !NET_COMPACT_20 && TRACE_HANDLE
#if DEBUG && !NET_COMPACT_20
      catch (SQLiteException e)
#else
      catch (SQLiteException)
#endif
      {
#if !NET_COMPACT_20 && TRACE_HANDLE
#if DEBUG && !NET_COMPACT_20
        try
        {
          Trace.WriteLine(String.Format(
              "CloseConnection: {0}, exception: {1}",
              handle, e));
        }
        catch
        {
        }
#endif
      }
      finally
      {
        SetHandleAsInvalid();
      }
#if DEBUG
      return false;
#else
      return true;
#endif
    }

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

#if DEBUG
    public override string ToString()
    {
        return handle.ToString();
    }
#endif
  }

  // Provides finalization support for unmanaged SQLite statements.
  internal class SQLiteStatementHandle : CriticalHandle
  {
    private SQLiteConnectionHandle cnn;

    public static implicit operator IntPtr(SQLiteStatementHandle stmt)
    {
      return (stmt != null) ? stmt.handle : IntPtr.Zero;
    }

    public static implicit operator SQLiteStatementHandle(IntPtr stmt)
    {
      return new SQLiteStatementHandle(stmt);
    }

    internal SQLiteStatementHandle(SQLiteConnectionHandle cnn, IntPtr stmt)
    private SQLiteStatementHandle(IntPtr stmt)
      : this()
    {
      this.cnn = cnn;
      SetHandle(stmt);
    }

    private SQLiteStatementHandle()
    internal SQLiteStatementHandle()
      : base(IntPtr.Zero)
    {
    }

    protected override bool ReleaseHandle()
    {
      try
      {
#if !PLATFORM_COMPACTFRAMEWORK
        IntPtr localHandle = Interlocked.Exchange(
          ref handle, IntPtr.Zero);

        if (localHandle != IntPtr.Zero)
          SQLiteBase.FinalizeStatement(cnn, localHandle);
        SQLiteBase.FinalizeStatement(this);

#if !NET_COMPACT_20 && TRACE_HANDLE
#if DEBUG && !NET_COMPACT_20
        try
        {
          Trace.WriteLine(String.Format(
              "FinalizeStatement: {0}", localHandle));
              "FinalizeStatement: {0}", handle));
        }
        catch
        {
        }
#endif
#else
        if (handle != IntPtr.Zero)
        {
          SQLiteBase.FinalizeStatement(cnn, handle);
          SetHandle(IntPtr.Zero);
        }
#endif

#if DEBUG
        return true;
#endif
      }
#if !NET_COMPACT_20 && TRACE_HANDLE
#if DEBUG && !NET_COMPACT_20
      catch (SQLiteException e)
#else
      catch (SQLiteException)
#endif
      {
#if !NET_COMPACT_20 && TRACE_HANDLE
#if DEBUG && !NET_COMPACT_20
        try
        {
          Trace.WriteLine(String.Format(
              "FinalizeStatement: {0}, exception: {1}",
              handle, e));
        }
        catch
        {
        }
#endif
      }
      finally
      {
        SetHandleAsInvalid();
      }
#if DEBUG
      return false;
#else
      return true;
#endif
    }

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

#if DEBUG
    public override string ToString()
    {
        return handle.ToString();
    }
#endif
  }

  // Provides finalization support for unmanaged SQLite backup objects.
  internal class SQLiteBackupHandle : CriticalHandle
  {
      private SQLiteConnectionHandle cnn;

      public static implicit operator IntPtr(SQLiteBackupHandle backup)
      {
          return (backup != null) ? backup.handle : IntPtr.Zero;
      }

      public static implicit operator SQLiteBackupHandle(IntPtr backup)
      {
          return new SQLiteBackupHandle(backup);
      }

      internal SQLiteBackupHandle(SQLiteConnectionHandle cnn, IntPtr backup)
      private SQLiteBackupHandle(IntPtr backup)
          : this()
      {
          this.cnn = cnn;
          SetHandle(backup);
      }

      private SQLiteBackupHandle()
      internal SQLiteBackupHandle()
          : base(IntPtr.Zero)
      {
      }

      protected override bool ReleaseHandle()
      {
          try
          {
#if !PLATFORM_COMPACTFRAMEWORK
              IntPtr localHandle = Interlocked.Exchange(
                  ref handle, IntPtr.Zero);

              if (localHandle != IntPtr.Zero)
                  SQLiteBase.FinishBackup(cnn, localHandle);
              SQLiteBase.FinishBackup(this);

#if !NET_COMPACT_20 && TRACE_HANDLE
#if DEBUG && !NET_COMPACT_20
              try
              {
                  Trace.WriteLine(String.Format(
                      "FinishBackup: {0}", localHandle));
                      "FinishBackup: {0}", handle));
              }
              catch
              {
              }
#endif
#else
              if (handle != IntPtr.Zero)
              {
                SQLiteBase.FinishBackup(cnn, handle);
                SetHandle(IntPtr.Zero);
              }
#endif

#if DEBUG
              return true;
#endif
          }
#if !NET_COMPACT_20 && TRACE_HANDLE
#if DEBUG && !NET_COMPACT_20
          catch (SQLiteException e)
#else
          catch (SQLiteException)
#endif
          {
#if !NET_COMPACT_20 && TRACE_HANDLE
#if DEBUG && !NET_COMPACT_20
              try
              {
                  Trace.WriteLine(String.Format(
                      "FinishBackup: {0}, exception: {1}",
                      handle, e));
              }
              catch
              {
              }
#endif
          }
          finally
          {
              SetHandleAsInvalid();
          }
#if DEBUG
          return false;
#else
          return true;
#endif
      }

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

  }
#if DEBUG
      public override string ToString()
      {
          return handle.ToString();
      }
}
#endif
  }
}
Changes to Tests/backup.eagle.
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
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







-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+

-
-
-
+
+
+

-
-
-
-
-
+
+
+
+
+

-
-
+
+

-
+

-
+
-
-
-
+
+
-

-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
+
-

-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
-
-
+
+

-
-
+
+

-
-
-
-
-
-
+
+
+
+
+
+

-
-
-
-
-
-
+
+
+
+
+
+

-
+

-
-
-
-
-
-
-
+
+
+
+
+
+
+

-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+

-
-
-
+
+
+

-
-
+
-
-
-
+
-
-
+
-





###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

set params(pages) [list -1 -1 0 0 1 1 2 2 1000 1000]

runTest {test backup-1.1 {BackupDatabase method, memory to disk} -setup {
set params(callbacks) [list null "new SQLiteBackupCallback(BackupCallback)" \
                            null "new SQLiteBackupCallback(BackupCallback)" \
                            null "new SQLiteBackupCallback(BackupCallback)" \
                            null "new SQLiteBackupCallback(BackupCallback)" \
                            null "new SQLiteBackupCallback(BackupCallback)"]

set params(results) [list \
    "0 \\{1 1048576 1048576 1048576 1048576 1048576 1048576 1048576 1048576\
    1048576 1048576 10\\} 0\$" \
    "0 \\{1 1048576 1048576 1048576 1048576 1048576 1048576 1048576 1048576\
    1048576 1048576 10\\} 0\$" \
    "1 \\{System\\.Reflection\\.TargetInvocationException: Exception has been\
    thrown by the target of an invocation\\. --->\
    System\\.Data\\.SQLite\\.SQLiteException: SQL logic error or missing\
    database\\r\\nno such table: t1\\r\\n.*?" \
    "1 \\{System\\.Reflection\\.TargetInvocationException: Exception has been\
    thrown by the target of an invocation\\. --->\
    System\\.Data\\.SQLite\\.SQLiteException: SQL logic error or missing\
    database\\r\\nno such table: t1\\r\\n.*?" \
    "0 \\{1 1048576 1048576 1048576 1048576 1048576 1048576 1048576 1048576\
    1048576 1048576 10\\} 0\$" \
    "0 \\{1 1048576 1048576 1048576 1048576 1048576 1048576 1048576 1048576\
    1048576 1048576 10\\} 10283\$" \
    "0 \\{1 1048576 1048576 1048576 1048576 1048576 1048576 1048576 1048576\
    1048576 1048576 10\\} 0\$" \
    "1 \\{System\\.Reflection\\.TargetInvocationException: Exception has been\
    thrown by the target of an invocation\\. --->\
    System\\.Data\\.SQLite\\.SQLiteException: SQL logic error or missing\
    database\\r\\nno such table: t1\\r\\n.*?" \
    "0 \\{1 1048576 1048576 1048576 1048576 1048576 1048576 1048576 1048576\
    1048576 1048576 10\\} \\{\\}\$" \
    "0 \\{1 1048576 1048576 1048576 1048576 1048576 1048576 1048576 1048576\
    1048576 1048576 10\\} \\{System\\.Data\\.SQLite\\.SQLiteConnection main\
    System\\.Data\\.SQLite\\.SQLiteConnection main 1000 9284 10284 False\
    System\\.Data\\.SQLite\\.SQLiteConnection main\
    System\\.Data\\.SQLite\\.SQLiteConnection main 1000 8284 10284 False\
    System\\.Data\\.SQLite\\.SQLiteConnection main\
    System\\.Data\\.SQLite\\.SQLiteConnection main 1000 7284 10284 False\
    System\\.Data\\.SQLite\\.SQLiteConnection main\
    System\\.Data\\.SQLite\\.SQLiteConnection main 1000 6284 10284 False\
    System\\.Data\\.SQLite\\.SQLiteConnection main\
    System\\.Data\\.SQLite\\.SQLiteConnection main 1000 5284 10284 False\
    System\\.Data\\.SQLite\\.SQLiteConnection main\
    System\\.Data\\.SQLite\\.SQLiteConnection main 1000 4284 10284 False\
    System\\.Data\\.SQLite\\.SQLiteConnection main\
    System\\.Data\\.SQLite\\.SQLiteConnection main 1000 3284 10284 False\
    System\\.Data\\.SQLite\\.SQLiteConnection main\
    System\\.Data\\.SQLite\\.SQLiteConnection main 1000 2284 10284 False\
    System\\.Data\\.SQLite\\.SQLiteConnection main\
    System\\.Data\\.SQLite\\.SQLiteConnection main 1000 1284 10284 False\
    System\\.Data\\.SQLite\\.SQLiteConnection main\
    System\\.Data\\.SQLite\\.SQLiteConnection main 1000 284 10284 False\\}\$"]

###############################################################################

for {set i 0} {$i < [llength $params(pages)]} {incr i} {
  set pages [lindex $params(pages) $i]
  set callback [lindex $params(callbacks) $i]

  runTest {test [appendArgs backup-1. $i] {BackupDatabase method} -setup {
    setupDb [set fileName(1) :memory:] "" "" "" "" "" false false false memDb
    setupDb [set fileName(2) [appendArgs backup-1. $i .db]]
  } -body {
    set id [object invoke Interpreter.GetActive NextId]
    set dataSource [file join [getDatabaseDirectory] $fileName(2)]
  setupDb [set fileName(1) :memory:] "" "" "" "" "" false memDb
  setupDb [set fileName(2) backup-1.1.db]
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName(2)]

    sql execute $memDb {
      CREATE TABLE t1(x TEXT);
    }
  sql execute $memDb {
    CREATE TABLE t1(x TEXT);
  }

    for {set index 0} {$index < 10} {incr index} {
      sql execute $memDb [subst {
        INSERT INTO t1 (x) VALUES('[string repeat ! 1048576]');
      }]
    }
  for {set index 0} {$index < 10} {incr index} {
    sql execute $memDb [subst {
      INSERT INTO t1 (x) VALUES('[string repeat ! 1048576]');
    }]
  }

    set memSource [object invoke -flags +NonPublic -objectflags +NoDispose \
        Interpreter.GetActive.connections get_Item $memDb]
  set memSource [object invoke -flags +NonPublic -objectflags +NoDispose \
      Interpreter.GetActive.connections get_Item $memDb]

    unset -nocomplain results errors
  unset -nocomplain results errors

    set code [compileCSharpWith [subst {
  set code [compileCSharpWith [subst {
      using System;
      using System.Data.SQLite;
      using System.Text;
    using System.Data.SQLite;
    using System.Text;
      using Eagle._Components.Public;

      namespace _Dynamic${id}
      {
        public static class Test${id}
        {
    namespace _Dynamic${id}
    {
      public class Test${id}
      {
          public static int count = 0;
          public static readonly StringBuilder results = new StringBuilder();

          /////////////////////////////////////////////////////////////////////

          public static bool BackupCallback(
            SQLiteConnection source,
            string sourceName,
            SQLiteConnection destination,
            string destinationName,
            int pages,
            int remainingPages,
            int totalPages,
            bool retry
            )
          {
            results.AppendFormat("{0} {1} {2} {3} {4} {5} {6} {7} ", source,
              sourceName, destination, destinationName, pages, remainingPages,
              totalPages, retry);

            count++;

            return (pages != 2);
          }

          /////////////////////////////////////////////////////////////////////

          public static string BackupAndGetData(
        public static string GetRows(
            Interpreter interpreter,
            SQLiteConnection source
            )
          {
            using (SQLiteConnection destination = new SQLiteConnection(
                "Data Source=${dataSource};"))
            {
              destination.Open();
          SQLiteConnection source
          )
        {
          using (SQLiteConnection destination = new SQLiteConnection(
              "Data Source=${dataSource};"))
          {
            destination.Open();

              int pages = ${pages};

              source.BackupDatabase(destination, "main", "main", pages,
            source.BackupDatabase(destination, "main", "main", -1, null, 0);
                ${callback}, 0);

              ReturnCode code;
              Result error = null;

              code = interpreter.SetVariableValue(
                VariableFlags.GlobalOnly, "callbackResults", (pages > 2) ?
                    results.ToString().Trim() : count.ToString(), null,
                ref error);

              if (code != ReturnCode.Ok)
                Utility.Complain(interpreter, code, error);

              using (SQLiteCommand command = new SQLiteCommand(
                  "SELECT length(x) FROM t1;", destination))
              {
                using (SQLiteDataReader dataReader = command.ExecuteReader())
                {
            using (SQLiteCommand command = new SQLiteCommand(
                "SELECT length(x) FROM t1;", destination))
            {
              using (SQLiteDataReader dataReader = command.ExecuteReader())
              {
                  StringBuilder builder = new StringBuilder();
                  int rowCount = 0;
                int rowCount = 0;
                StringBuilder builder = new StringBuilder();

                  builder.Append(dataReader.FieldCount);
                  builder.Append(' ');
                builder.Append(dataReader.FieldCount);
                builder.Append(' ');

                  while (dataReader.Read())
                  {
                    builder.Append(dataReader.GetInt64(0));
                    builder.Append(' ');
                    rowCount++;
                  }
                while (dataReader.Read())
                {
                  builder.Append(dataReader.GetInt64(0));
                  builder.Append(' ');
                  rowCount++;
                }

                  builder.Append(rowCount);
                  return builder.ToString();
                }
              }
            }
          }
                builder.Append(rowCount);
                return builder.ToString();
              }
            }
          }
        }

          /////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////

          public static void Main()
          {
            // do nothing.
          }
        }
      }
    }] true true true results errors [list System.Data.SQLite.dll Eagle.dll]]
        public static void Main()
        {
          // do nothing.
        }
      }
    }
  }] true true true results errors System.Data.SQLite.dll]

    set callbackResults [list]

    list $code $results \
        [expr {[info exists errors] ? $errors : ""}] \
        [expr {$code eq "Ok" ? [catch {
          object invoke _Dynamic${id}.Test${id} BackupAndGetData "" $memSource
        } result] : [set result ""]}] $result $callbackResults
  } -cleanup {
    cleanupDb $fileName(2)
    cleanupDb $fileName(1) memDb
  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catch {
        object invoke _Dynamic${id}.Test${id} GetRows $memSource
      } result] : [set result ""]}] $result
} -cleanup {
  cleanupDb $fileName(2)
  cleanupDb $fileName(1) memDb

    unset -nocomplain result results errors code index memSource dataSource \
        id memDb db fileName callbackResults
  } -constraints \
  unset -nocomplain result results errors code index memSource dataSource id \
      memDb db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} \
-match regexp -result [appendArgs \
"^Ok System#CodeDom#Compiler#CompilerResults#\\d+ \\{\\} " \
-match regexp -result {^Ok System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0\
[lindex $params(results) $i]]}
}

\{1 1048576 1048576 1048576 1048576 1048576 1048576 1048576 1048576 1048576\
###############################################################################

1048576 10\}$}}
unset -nocomplain i params pages callback

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue
Changes to Tests/basic.eagle.
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
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







-
-









-
-
-
-
-
-
-
-
-
-




















+

+



















-
+


-
-
+








###############################################################################

#
# NOTE: Setup the variables that refer to the various files required by the
#       tests in this file.
#
set systemDataSQLiteDllFile [getBuildFileName System.Data.SQLite.dll]
set systemDataSQLiteLinqDllFile [getBuildFileName System.Data.SQLite.Linq.dll]
set testExeFile [getBuildFileName test.exe]
set testLinqExeFile [getBuildFileName testlinq.exe]
set testLinqOutFile [file nativename [file join $path testlinq.out]]
set northwindEfDbFile [file nativename [file join [file dirname $path] \
    testlinq northwindEF.db]]

#
# NOTE: Setup the test constraints specific to the tests in this file.
#
if {![haveConstraint [appendArgs file_ \
    [file tail $systemDataSQLiteDllFile]]]} then {
  checkForFile $test_channel $systemDataSQLiteDllFile
}

if {![haveConstraint [appendArgs file_ \
    [file tail $systemDataSQLiteLinqDllFile]]]} then {
  checkForFile $test_channel $systemDataSQLiteLinqDllFile
}

if {![haveConstraint [appendArgs file_ [file tail $testExeFile]]]} then {
  checkForFile $test_channel $testExeFile
}

if {![haveConstraint [appendArgs file_ [file tail $testLinqExeFile]]]} then {
  checkForFile $test_channel $testLinqExeFile
}

if {![haveConstraint [appendArgs file_ [file tail $northwindEfDbFile]]]} then {
  checkForFile $test_channel $northwindEfDbFile
}

if {![haveConstraint [appendArgs file_ [file tail $testLinqOutFile]]]} then {
  checkForFile $test_channel $testLinqOutFile
}

###############################################################################

runTest {test data-1.1 {unit tests from the 'test' project} -setup {
  cleanupFile [file join [file dirname $testExeFile] Test.db3]

  set fileName [file join [getDatabaseDirectory] data-1.1.db]
  cleanupDb $fileName
} -body {
  set output ""

  set code [catch {
    #
    # NOTE: For the sake of backward compatibility, the "-autoRun" argument
    #       must be first.
    #
    testClrExec $testExeFile [list -eventflags Wait -directory \
        [file dirname $testExeFile] -stdout output -success 0] -autoRun \
        -fileName [appendArgs \" [file nativename $fileName] \"]
  } error]

  tlog "---- BEGIN STDOUT OUTPUT\n"
  tlog $output
  tlog "\n---- END STDOUT OUTPUT\n"

  list $code [expr {$code == 0 ? "" : $error}]
} -cleanup {
  cleanupFile $fileName
  cleanupDb $fileName

  unset -nocomplain code output error fileName
} -constraints {eagle SQLite file_System.Data.SQLite.dll file_test.exe} \
-result {0 {}}}
} -constraints {eagle file_test.exe} -result {0 {}}}

###############################################################################

runTest {test data-1.2 {unit tests from the 'testlinq' project} -setup {
  #
  # NOTE: Re-copy the reference database file used for this unit test to the
  #       build directory in case it has been changed by a previous test run.
124
125
126
127
128
129
130
131
132
133


134
135
136
137
138
139
140
113
114
115
116
117
118
119



120
121
122
123
124
125
126
127
128







-
-
-
+
+







  list $code [string equal $output [readFile $testLinqOutFile]] \
      [expr {$code == 0 ? "" : $error}]
} -cleanup {
  catch {object invoke Console OutputEncoding $savedEncoding}

  unset -nocomplain code output error savedEncoding encoding
} -constraints \
{eagle monoToDo SQLite file_System.Data.SQLite.dll\
file_System.Data.SQLite.Linq.dll file_testlinq.exe file_northwindEF.db\
file_testlinq.out} -result {0 True {}}}
{eagle monoToDo file_testlinq.exe file_northwindEF.db file_testlinq.out} \
-result {0 True {}}}

###############################################################################

runTest {test data-1.3 {SELECT scalar/reader, CREATE, INSERT} -setup {
  setupDb [set fileName data-1.3.db]
} -body {
  set result [list]
173
174
175
176
177
178
179
180

181
182
183
184
185
186
187
161
162
163
164
165
166
167

168
169
170
171
172
173
174
175







-
+








  set code [compileCSharpWith [subst {
    using System.Data;
    using System.Data.SQLite;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      public class Test${id}
      {
        public static DataTable GetReservedWords()
        {
          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};"))
          {
            connection.Open();
236
237
238
239
240
241
242
243

244
245
246
247
248
249
250
224
225
226
227
228
229
230

231
232
233
234
235
236
237
238







-
+








  set code [compileCSharpWith [subst {
    using System.Data;
    using System.Data.SQLite;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      public class Test${id}
      {
        public static DataRowCollection GetForeignKeys()
        {
          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};"))
          {
            connection.Open();
315
316
317
318
319
320
321
322

323
324
325
326
327
328
329
303
304
305
306
307
308
309

310
311
312
313
314
315
316
317







-
+








  set code [compileCSharpWith [subst {
    using System.Data;
    using System.Data.SQLite;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      public class Test${id}
      {
        public static bool TestSetAvRetry(
          ref int count,
          ref int interval
          )
        {
          using (SQLiteConnection connection = new SQLiteConnection(
424
425
426
427
428
429
430
431

432
433
434
435
436
437
438
412
413
414
415
416
417
418

419
420
421
422
423
424
425
426







-
+








  set code [compileCSharpWith [subst {
    using System.Data;
    using System.Data.SQLite;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      public class Test${id}
      {
        public static void Main()
        {
          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};"))
          {
            connection.Open();
482
483
484
485
486
487
488
489

490
491
492
493
494
495
496
470
471
472
473
474
475
476

477
478
479
480
481
482
483
484







-
+








  set code [compileCSharpWith [subst {
    using System.Data;
    using System.Data.SQLite;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      public class Test${id}
      {
        public static void Main()
        {
          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};"))
          {
            connection.Open();
543
544
545
546
547
548
549
550

551
552
553
554
555
556
557
531
532
533
534
535
536
537

538
539
540
541
542
543
544
545







-
+








  set code [compileCSharpWith [subst {
    using System.Data;
    using System.Data.SQLite;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      public class Test${id}
      {
        public static void Main()
        {
          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};"))
          {
            connection.Open();
866
867
868
869
870
871
872
873

874
875
876
877
878
879
880
854
855
856
857
858
859
860

861
862
863
864
865
866
867
868







-
+







  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System.Data.SQLite;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      public class Test${id}
      {
        public static string GetConnectionString(
          string format,
          string kind
          )
        {
          SQLiteConnectionStringBuilder builder =
916
917
918
919
920
921
922
923
924
925



926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941

942
943
944
945
946
947
948
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







-
-
-
+
+
+















-
+







            ISO8601 Utc
      } result] : [set result ""]}] $result
} -cleanup {
  unset -nocomplain result results errors code id
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -match \
regexp -result {^Ok System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{Date\
Source=test\.db\} 0 \{Date Source=test\.db;DateTimeFormat=(?:Default|ISO8601)\}\
0 \{Date Source=test\.db;DateTimeKind=Unspecified\} 0 \{Date\
Source=test\.db;DateTimeFormat=(?:Default|ISO8601);DateTimeKind=Utc\}$}}
Source=test\.db\} 0 \{Date Source=test\.db;DateTimeFormat=ISO8601\} 0 \{Date\
Source=test\.db;DateTimeKind=Unspecified\} 0 \{Date\
Source=test\.db;DateTimeFormat=ISO8601;DateTimeKind=Utc\}$}}

###############################################################################

runTest {test data-1.16 {SQLiteConnectionStringBuilder properties} -body {
  set id [object invoke Interpreter.GetActive NextId]

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System;
    using System.Data.SQLite;
    using System.Reflection;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      public class Test${id}
      {
        public static string GetConnectionString(
          string key,
          string value,
          string propertyName
          )
        {
974
975
976
977
978
979
980
981

982
983
984
985
986

987
988
989


990
991
992
993
994

995
996
997

998
999
1000
1001
1002

1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023



1024
1025
1026
1027
1028
1029
1030
1031
1032








1033
1034
1035
1036
1037
1038
1039
1040
962
963
964
965
966
967
968

969
970
971
972
973

974
975


976
977
978
979
980
981

982
983
984

985
986
987
988
989

990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008



1009
1010
1011









1012
1013
1014
1015
1016
1017
1018
1019

1020
1021
1022
1023
1024
1025
1026







-
+




-
+

-
-
+
+




-
+


-
+




-
+


















-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-







    }
  }] true true true results errors System.Data.SQLite.dll]

  lappend results $code [expr {[info exists errors] ? $errors : ""}]

  if {$code eq "Ok"} then {
    set keys [list null Version Synchronous UseUTF16Encoding Pooling \
                   BinaryGUID "Data Source" Uri FullUri "Default Timeout" \
                   BinaryGUID "Data Source" Uri "Default Timeout" \
                   Enlist FailIfMissing "Legacy Format" "Read Only" \
                   Password "Page Size" "Max Page Count" "Cache Size" \
                   DateTimeFormat DateTimeKind BaseSchemaName \
                   "Journal Mode" "Default IsolationLevel" "Foreign Keys" \
                   Flags SetDefaults ToFullPath]
                   Flags]

    set values [list null 3 Normal True False \
                     True test.db test.db file:test.db 60 \
    set values [list null 3 Full True False \
                     True test.db test.db 60 \
                     False True False True \
                     secret 4096 1024 8192 \
                     UnixEpoch Utc sqlite_schema \
                     Memory Serializable False \
                     Default False False]
                     Default]

    set propertyNames [list null Version SyncMode UseUTF16Encoding Pooling \
                            BinaryGUID DataSource Uri FullUri DefaultTimeout \
                            BinaryGUID DataSource Uri DefaultTimeout \
                            Enlist FailIfMissing LegacyFormat ReadOnly \
                            Password PageSize MaxPageCount CacheSize \
                            DateTimeFormat DateTimeKind BaseSchemaName \
                            JournalMode DefaultIsolationLevel ForeignKeys \
                            Flags SetDefaults ToFullPath]
                            Flags]

    foreach key $keys value $values propertyName $propertyNames {
      set code [catch {
        object invoke _Dynamic${id}.Test${id} GetConnectionString \
            $key $value $propertyName
      } result]

      lappend results $code $result
    }
  }

  set results
} -cleanup {
  unset -nocomplain propertyName propertyNames value key values keys result \
      results errors code id
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -match \
regexp -result {^System#CodeDom#Compiler#CompilerResults#\d+ Ok \{\} 0 \{, \} 0\
\{3, Version=3\} 0 \{Normal, Synchronous=Normal\} 0 \{True,\
UseUTF16Encoding=True\} 0 \{False, Pooling=False\} 0 \{True, BinaryGUID=True\}\
0 \{test\.db, Data Source=test\.db\} 0 \{test\.db, Uri=test\.db\} 0\
\{3, Version=3\} 0 \{Full, Synchronous=Full\} 0 \{True, UseUTF16Encoding=True\}\
0 \{False, Pooling=False\} 0 \{True, BinaryGUID=True\} 0 \{test\.db, Data\
Source=test\.db\} 0 \{test\.db, Uri=test\.db\} 0 \{60, Default Timeout=60\} 0\
\{file:test.db, FullUri=file:test\.db\} 0 \{60, Default Timeout=60\} 0 \{False,\
Enlist=False\} 0 \{True, FailIfMissing=True\} 0 \{False, Legacy Format=False\}\
0 \{True, Read Only=True\} 0 \{secret, Password=secret\} 0 \{4096, Page\
Size=4096\} 0 \{1024, Max Page Count=1024\} 0 \{8192, Cache Size=8192\} 0\
\{UnixEpoch, DateTimeFormat=UnixEpoch\} 0 \{Utc, DateTimeKind=Utc\} 0\
\{sqlite_schema, BaseSchemaName=sqlite_schema\} 0 \{Memory, Journal\
Mode=Memory\} 0 \{Serializable, Default IsolationLevel=Serializable\} 0\
\{False, Foreign Keys=False\} 0 \{LogCallbackException,\
Flags=(?:Default|LogCallbackException)\} 0 \{False, SetDefaults=False\} 0\
\{False, Enlist=False\} 0 \{True, FailIfMissing=True\} 0 \{False, Legacy\
Format=False\} 0 \{True, Read Only=True\} 0 \{secret, Password=secret\} 0\
\{4096, Page Size=4096\} 0 \{1024, Max Page Count=1024\} 0 \{8192, Cache\
Size=8192\} 0 \{UnixEpoch, DateTimeFormat=UnixEpoch\} 0 \{Utc,\
DateTimeKind=Utc\} 0 \{sqlite_schema, BaseSchemaName=sqlite_schema\} 0\
\{Memory, Journal Mode=Memory\} 0 \{Serializable, Default\
IsolationLevel=Serializable\} 0 \{False, Foreign Keys=False\} 0\
\{LogCallbackException, Flags=LogCallbackException\}$}}
\{False, ToFullPath=False\}$}}

###############################################################################

runTest {test data-1.17 {SQLiteConvert ToDateTime (Julian Day)} -body {
  set dateTime [object invoke System.Data.SQLite.SQLiteConvert ToDateTime \
      2455928.0 Utc]

1257
1258
1259
1260
1261
1262
1263
1264

1265
1266
1267
1268
1269
1270
1271
1243
1244
1245
1246
1247
1248
1249

1250
1251
1252
1253
1254
1255
1256
1257







-
+








  unset -nocomplain result results errors code sql dataSource id db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -match \
regexp -result {^Ok System#CodeDom#Compiler#CompilerResults#\d+ \{\} 1\
\{System\.Reflection\.TargetInvocationException: Exception has been thrown by\
the target of an invocation\. ---> System\.Data\.SQLite\.SQLiteException:\
interrupted.*$}}
Operation terminated by sqlite3_interrupt\(\).*$}}

###############################################################################

runTest {test data-1.23 {LINQ SQL_CONSTRAINTCOLUMNS resource} -body {
  object invoke -flags +NonPublic System.Data.SQLite.Properties.Resources \
      SQL_CONSTRAINTCOLUMNS
} -constraints {eagle System.Data.SQLite System.Data.SQLite.Linq} -result {
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391

1392
1393


1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
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
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795

1796
1797
1798
1799
1800
1368
1369
1370
1371
1372
1373
1374



1375
1376

1377
1378
1379
1380
1381
1382
1383
1384












































































































































































































































































































































































































1385
1386
1387
1388
1389
1390







-
-
-
+

-
+
+






-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+






  object foreach -alias item $collection {
    lappend result [$collection GetValues $item]
  }

  set result
} -cleanup {
  unset -nocomplain result item collection reader command connection

  cleanupDb $fileName; # NOTE: After object disposal.
  cleanupDb $fileName

  unset -nocomplain db fileName
  unset -nocomplain result item collection reader command connection db \
      fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
{{26 26} {zebra zebra}}}

###############################################################################

runTest {test data-1.26 {LINQ ISQLiteSchemaExtensions.BuildTempSchema} -setup {
  setupDb [set fileName data-1.26.db]
} -body {
  set connection [object invoke -flags +NonPublic -objectflags +NoDispose \
      Interpreter.GetActive.connections Item $db]

  set providerServices [object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteProviderServices Instance]

  object invoke -flags +NonPublic -type \
      System.Data.SQLite.ISQLiteSchemaExtensions $providerServices \
      BuildTempSchema $connection
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain providerServices connection db fileName
} -constraints {eagle SQLite System.Data.SQLite System.Data.SQLite.Linq} \
-result {}}

###############################################################################

runTest {test data-1.27 {VARCHAR / NVARCHAR types with spaces} -body {
  list [object invoke -flags +NonPublic System.Data.SQLite.SQLiteConvert \
      TypeNameToDbType "VARCHAR"] \
      [object invoke -flags +NonPublic System.Data.SQLite.SQLiteConvert \
      TypeNameToDbType "NVARCHAR"] \
      [object invoke -flags +NonPublic System.Data.SQLite.SQLiteConvert \
      TypeNameToDbType "VARCHAR(1)"] \
      [object invoke -flags +NonPublic System.Data.SQLite.SQLiteConvert \
      TypeNameToDbType "NVARCHAR(1)"] \
      [object invoke -flags +NonPublic System.Data.SQLite.SQLiteConvert \
      TypeNameToDbType "VARCHAR (1)"] \
      [object invoke -flags +NonPublic System.Data.SQLite.SQLiteConvert \
      TypeNameToDbType "NVARCHAR (1)"] \
} -constraints {eagle System.Data.SQLite} -result \
{String String String String String String}}

###############################################################################

runTest {test data-1.28 {SetMemoryStatus method} -setup {
  #
  # NOTE: Make sure that SQLite core library is completely shutdown prior to
  #       starting this test.
  #
  object invoke -flags +NonPublic System.Data.SQLite.UnsafeNativeMethods \
      sqlite3_shutdown

  #
  # NOTE: Create an instance of the core SQLite library interop wrapper class.
  #
  set sqlite3 [object create -flags +NonPublic System.Data.SQLite.SQLite3 \
      Default Unspecified]
} -body {
  set result(rc1) [object invoke -flags +NonPublic $sqlite3 SetMemoryStatus \
      false]

  set result(before) [object invoke -flags +NonPublic $sqlite3 MemoryUsed]

  set result(ptr1) [object invoke -create -flags +NonPublic \
      System.Data.SQLite.UnsafeNativeMethods sqlite3_malloc 100]

  set result(after1) [object invoke -flags +NonPublic $sqlite3 MemoryUsed]

  object invoke -flags +NonPublic System.Data.SQLite.UnsafeNativeMethods \
      sqlite3_free $result(ptr1)

  set result(after2) [object invoke -flags +NonPublic $sqlite3 MemoryUsed]

  set result(rc2) [object invoke -flags +NonPublic $sqlite3 SetMemoryStatus \
      true]

  set result(rc3) [object invoke -flags +NonPublic \
      System.Data.SQLite.UnsafeNativeMethods sqlite3_shutdown]

  set result(rc4) [object invoke -flags +NonPublic $sqlite3 SetMemoryStatus \
      true]

  set result(ptr2) [object invoke -create -flags +NonPublic \
      System.Data.SQLite.UnsafeNativeMethods sqlite3_malloc 100]

  set result(after3) [object invoke -flags +NonPublic $sqlite3 MemoryUsed]

  object invoke -flags +NonPublic System.Data.SQLite.UnsafeNativeMethods \
      sqlite3_free $result(ptr2)

  set result(after4) [object invoke -flags +NonPublic $sqlite3 MemoryUsed]

  list $result(rc1) $result(rc2) $result(rc3) $result(rc4) $result(ptr1) \
      $result(ptr2) $result(before) $result(after1) $result(after2) \
      $result(after3) $result(after4) \
      [expr {$result(before) == $result(after1)}] \
      [expr {$result(before) == $result(after2)}] \
      [expr {$result(after3) > 0}] \
      [expr {$result(before) < $result(after3)}] \
      [expr {$result(after1) < $result(after3)}] \
      [expr {$result(after4) < $result(after3)}]
} -cleanup {
  catch {
    #
    # NOTE: Make sure that SQLite core library is completely shutdown prior
    #       to attempting to reconfigure the memory status setting.
    #
    object invoke -flags +NonPublic System.Data.SQLite.UnsafeNativeMethods \
        sqlite3_shutdown

    #
    # NOTE: Attempt to make sure the default value for the process-wide
    #       memory usage tracking setting is restored.  This is not 100%
    #       reliable because we have no idea what the original value was
    #       upon entry into this test (i.e. because the underlying core
    #       library property is currently write-only).
    #
    object invoke -flags +NonPublic System.Data.SQLite.UnsafeNativeMethods \
        sqlite3_config_int SQLITE_CONFIG_MEMSTATUS 1
  }

  unset -nocomplain result sqlite3
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -match \
regexp -result {^Ok Misuse Ok Ok System#IntPtr#\d+ System#IntPtr#\d+ \d+ \d+ \d+\
\d+ \d+ True True True True True True$}}

###############################################################################

runTest {test data-1.29 {SQLiteConnection.Open with SetDefaults=False} -setup {
  setupDb [set fileName data-1.29.db] "" "" "" "" SetDefaults=False
} -body {
  set result [list]

  lappend result [sql execute -execute scalar $db "PRAGMA page_size;"]
  lappend result [sql execute -execute scalar $db "PRAGMA max_page_count;"]
  lappend result [sql execute -execute scalar $db "PRAGMA legacy_file_format;"]
  lappend result [sql execute -execute scalar $db "PRAGMA synchronous;"]
  lappend result [sql execute -execute scalar $db "PRAGMA cache_size;"]
  lappend result [sql execute -execute scalar $db "PRAGMA journal_mode;"]
  lappend result [sql execute -execute scalar $db "PRAGMA foreign_keys;"]

  set result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
{1024 1073741823 0 2 2000 delete 0}}

###############################################################################

runTest {test data-1.30 {SQLiteConnection.Open with SetDefaults=True} -setup {
  setupDb [set fileName data-1.30.db] "" "" "" "" SetDefaults=True
} -body {
  set result [list]

  lappend result [sql execute -execute scalar $db "PRAGMA page_size;"]
  lappend result [sql execute -execute scalar $db "PRAGMA max_page_count;"]
  lappend result [sql execute -execute scalar $db "PRAGMA legacy_file_format;"]
  lappend result [sql execute -execute scalar $db "PRAGMA synchronous;"]
  lappend result [sql execute -execute scalar $db "PRAGMA cache_size;"]
  lappend result [sql execute -execute scalar $db "PRAGMA journal_mode;"]
  lappend result [sql execute -execute scalar $db "PRAGMA foreign_keys;"]

  set result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
{1024 1073741823 0 2 2000 delete 0}}

###############################################################################

runTest {test data-1.31 {SQLiteConnection.Open without SetDefaults} -setup {
  setupDb [set fileName data-1.31.db]
} -body {
  set result [list]

  lappend result [sql execute -execute scalar $db "PRAGMA page_size;"]
  lappend result [sql execute -execute scalar $db "PRAGMA max_page_count;"]
  lappend result [sql execute -execute scalar $db "PRAGMA legacy_file_format;"]
  lappend result [sql execute -execute scalar $db "PRAGMA synchronous;"]
  lappend result [sql execute -execute scalar $db "PRAGMA cache_size;"]
  lappend result [sql execute -execute scalar $db "PRAGMA journal_mode;"]
  lappend result [sql execute -execute scalar $db "PRAGMA foreign_keys;"]

  set result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
{1024 1073741823 0 2 2000 delete 0}}

###############################################################################

runTest {test data-1.32 {SQLiteConnection.Open with PRAGMA overrides} -setup {
  #
  # NOTE: Attempt to open a connection with all available PRAGMA settings
  #       set to non-default values in the connection string.
  #
  setupDb [set fileName data-1.32.db] "" "" "" "" [join [list \
      "Page Size=4096" "Max Page Count=2048" "Legacy Format=True" \
      Synchronous=Normal "Cache Size=4096" "Journal Mode=Wal" \
      "Foreign Keys=True"] \;]
} -body {
  set result [list]

  lappend result [sql execute -execute scalar $db "PRAGMA page_size;"]
  lappend result [sql execute -execute scalar $db "PRAGMA max_page_count;"]
  lappend result [sql execute -execute scalar $db "PRAGMA legacy_file_format;"]
  lappend result [sql execute -execute scalar $db "PRAGMA synchronous;"]
  lappend result [sql execute -execute scalar $db "PRAGMA cache_size;"]
  lappend result [sql execute -execute scalar $db "PRAGMA journal_mode;"]
  lappend result [sql execute -execute scalar $db "PRAGMA foreign_keys;"]

  set result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
{4096 2048 1 1 4096 wal 1}}

###############################################################################

runTest {test data-1.33 {sqlite3_win32_set_directory function} -setup {
  set directory(base) [getDatabaseDirectory]

  if {[string length $directory(base)] == 0 || \
      ![file exists $directory(base)] || \
      ![file isdirectory $directory(base)]} then {
    error [appendArgs "base directory \"" $directory(base) "\" is invalid"]
  }

  set directory(data) [file join $directory(base) \
      [appendArgs sqlite .data. [pid]]]

  file mkdir $directory(data)

  tputs $test_channel [appendArgs "---- created data directory \"" \
      $directory(data) \"\n]

  set directory(temp) [file join $directory(base) \
      [appendArgs sqlite .temp. [pid]]]

  file mkdir $directory(temp)

  tputs $test_channel [appendArgs "---- created temporary directory \"" \
      $directory(temp) \"\n]

  proc threadStart {} {
    while {$::i < 100} {
      set ::found(temp) [expr \
          {[llength [file list $::directory(temp) etilqs_*]] > 0}]

      if {$::found(temp)} then {
        return
      }
    }
  }

  object import System.Threading
} -body {
  set result [list]

  #
  # NOTE: Attempt to modify the process-wide data and temporary directory
  #       settings for the SQLite core library.
  #
  lappend result [object invoke -flags +NonPublic \
      System.Data.SQLite.UnsafeNativeMethods sqlite3_win32_set_directory 1 \
      $directory(data)]

  lappend result [object invoke -flags +NonPublic \
      System.Data.SQLite.UnsafeNativeMethods sqlite3_win32_set_directory 2 \
      $directory(temp)]

  setupDb [set fileName data-1.33.db] "" "" "" "" "" false false

  sql execute $db "CREATE TABLE t1(x NOT NULL);"

  for {set i 1} {$i < 100} {incr i} {
    sql execute $db "INSERT INTO t1 (x) VALUES(?);" [list param1 String $i]
  }

  set found(data) [expr \
      {[llength [file list $directory(data) $fileName]] == 1}]

  set t [object create -alias Thread threadStart]
  sql execute $db "BEGIN TRANSACTION;"; $t Start

  for {set i 1} {$i < 100} {incr i} {
    #
    # NOTE: Execute a query that should force the creation of a temporary file
    #       for its statement journal.
    #
    sql execute $db "UPDATE t1 SET x = ?;" [list param1 String $i]

    #
    # NOTE: Give the other thread some time to notice the temporary file.
    #
    after 1000

    #
    # NOTE: Stop when the other thread confirms that the temporary file was
    #       created in the correct directory.
    #
    if {[info exists found(temp)] && $found(temp)} then {
      break
    }
  }

  $t Join; sql execute $db "COMMIT TRANSACTION;"
  lappend result $found(data) $found(temp); set result
} -cleanup {
  #
  # NOTE: Close the database; however, do not attempt to delete the file as
  #       it is not located in the database directory known to the cleanupDb
  #       procedure (i.e. the one returned by getDatabaseDirectory).
  #
  cleanupDb $fileName db true false false

  #
  # NOTE: Attempt to restore the process-wide data and temporary directory
  #       settings for the SQLite core library.
  #
  catch {
    object invoke -flags +NonPublic System.Data.SQLite.UnsafeNativeMethods \
        sqlite3_win32_set_directory 1 null
  }

  catch {
    object invoke -flags +NonPublic System.Data.SQLite.UnsafeNativeMethods \
        sqlite3_win32_set_directory 2 null
  }

  if {[info exists directory(data)] && \
      [file exists $directory(data)] && \
      [file isdirectory $directory(data)]} then {
    file delete -recursive -force $directory(data)
  }

  if {[info exists directory(temp)] && \
      [file exists $directory(temp)] && \
      [file isdirectory $directory(temp)]} then {
    file delete -recursive -force $directory(temp)
  }

  object unimport -importpattern System.Threading

  if {[info exists t] && [cleanupThread $t]} then {
    unset t
  }

  catch {object removecallback threadStart}

  unset -nocomplain t found i db fileName result directory

  rename threadStart ""
} -constraints {eagle windows monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite sqlite3_win32_set_directory} -result {Ok Ok True True}}

###############################################################################

runTest {test data-1.34 {serialization of SQLiteException} -body {
  set serializer [object create -alias \
      System.Runtime.Serialization.Formatters.Binary.BinaryFormatter]

  set stream [object create -alias System.IO.MemoryStream]

  set exception(1) [object create -alias \
      System.Data.SQLite.SQLiteException 14 "this is a test"]; # CantOpen

  $serializer Serialize $stream $exception(1)

  $stream Seek 0 Begin

  set exception(2) [$serializer -alias Deserialize $stream]

  list [$exception(1) ErrorCode] [$exception(1) Message] \
      [$exception(2) ErrorCode] [$exception(2) Message] \
      [expr {[$exception(1) ErrorCode] eq [$exception(2) ErrorCode]}] \
      [expr {[$exception(1) Message] eq [$exception(2) Message]}]
} -cleanup {
  unset -nocomplain exception stream serializer
} -constraints {eagle System.Data.SQLite} -result \
[string map [list \n \r\n] {CantOpen {unable to open database file
this is a test} CantOpen {unable to open database file
this is a test} True True}]}

###############################################################################

unset -nocomplain systemDataSQLiteDllFile systemDataSQLiteLinqDllFile \
    testExeFile testLinqExeFile northwindEfDbFile testLinqOutFile
unset -nocomplain testExeFile testLinqExeFile northwindEfDbFile testLinqOutFile

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue
Changes to Tests/common.eagle.
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
362
363
364
365
366
367
368























369
370
371
372
373
374
375







-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-








        tputs $channel [appendArgs "yes (" $version " " $sourceId ")\n"]
      } else {
        tputs $channel no\n
      }
    }

    proc checkForSQLiteDefineConstant { channel name } {
      tputs $channel [appendArgs \
          "---- checking for System.Data.SQLite define constant \"" $name \
          "\"... "]

      if {[catch {object invoke -flags +NonPublic System.Data.SQLite.SQLite3 \
              DefineConstants} defineConstants] == 0} then {
        if {[lsearch -exact -nocase $defineConstants $name] != -1} then {
          #
          # NOTE: Yes, this define constant was enabled when the managed
          #       assembly was compiled.
          #
          addConstraint [appendArgs defineConstant.System.Data.SQLite. $name]

          tputs $channel yes\n
        } else {
          tputs $channel no\n
        }
      } else {
        tputs $channel error\n
      }
    }

    proc getDateTimeFormat {} {
      #
      # NOTE: This procedure simply returns the "default" DateTime format used
      #       by the test suite.
      #
      if {[info exists ::datetime_format] && \
          [string length $::datetime_format] > 0} then {
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
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







-
+
-




-
+










-
+







      eval $command
    }

    proc isMemoryDb { fileName } {
      #
      # NOTE: Is the specified database file name really an in-memory database?
      #
      return [expr {$fileName eq ":memory:" || \
      return [expr {$fileName eq ":memory:"}]
          [string range $fileName 0 12] eq "file::memory:"}]
    }

    proc setupDb {
            fileName {mode ""} {dateTimeFormat ""} {dateTimeKind ""} {flags ""}
            {extra ""} {qualify true} {delete true} {uri false} {varName db} } {
            {extra ""} {delete true} {varName db} } {
      #
      # NOTE: First, see if the caller has requested an in-memory database.
      #
      set isMemory [isMemoryDb $fileName]

      #
      # NOTE: For now, all test databases used by the test suite are placed into
      #       the temporary directory.  Each database used by a test should be
      #       cleaned up by that test using the "cleanupDb" procedure, below.
      #
      if {!$isMemory && $qualify} then {
      if {!$isMemory} then {
        set fileName [file join [getDatabaseDirectory] [file tail $fileName]]
      }

      #
      # NOTE: By default, delete any pre-existing database with the same file
      #       name if it currently exists.
      #
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
494
495
496
497
498
499
500

501



502




503








504
505
506
507
508
509
510







-
+
-
-
-

-
-
-
-
+
-
-
-
-
-
-
-
-







      # NOTE: Refer to the specified variable (e.g. "db") in the context of the
      #       caller.  The handle to the opened database will be stored there.
      #
      upvar 1 $varName db

      #
      # NOTE: Start building the connection string.  The only required portion
      #       of the connection string is the data source, which contains the
      #       of the connection string is the database file name itself.
      #       database file name itself.  If the caller wants to use a URI as
      #       the data source, use the FullUri connection string property to
      #       prevent the data source string from being mangled.
      #
      if {$uri} then {
        set connection {FullUri=${fileName}}
      } else {
        set connection {Data Source=${fileName}}
      set connection {Data Source=${fileName}}
      }

      #
      # NOTE: Since this procedure has no special knowledge of what the default
      #       setting is for the ToFullPath connection string propery, always
      #       add the value we know about to the connection string.
      #
      append connection {;ToFullPath=${qualify}}

      #
      # NOTE: If the caller specified a journal mode, add the necessary portion
      #       of the connection string now.
      #
      if {[string length $mode] > 0} then {
        append connection {;Journal Mode=${mode}}
606
607
608
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
568
569
570
571
572
573
574

575













576
577
578
579
580
581
582







-
+
-
-
-
-
-
-
-
-
-
-
-
-
-







      #
      # NOTE: Open the database connection now, placing the opaque handle value
      #       into the variable specified by the caller.
      #
      set db [sql open -type SQLite [subst $connection]]
    }

    proc cleanupDb { fileName {varName db} {collect true} {qualify true}
    proc cleanupDb { fileName {varName db} } {
                     {delete true} } {
      #
      # NOTE: Attempt to force all pending "garbage" objects to be collected,
      #       including SQLite statements and backup objects; this should allow
      #       the underlying database file to be deleted.
      #
      if {$collect && \
          [catch {object invoke GC GetTotalMemory true} error]} then {
        tputs $channel [appendArgs \
            "==== WARNING: failed full garbage collection, error: " \
            \n\t $error \n]
      }

      #
      # NOTE: Refer to the specified variable (e.g. "db") in the context of the
      #       caller.  The handle to the opened database is stored there.
      #
      upvar 1 $varName db

      #
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
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







-
+






-
+




-
+







      #
      set isMemory [isMemoryDb $fileName]

      #
      # NOTE: Build the full path to the database file name.  For now, all test
      #       database files are stored in the temporary directory.
      #
      if {!$isMemory && $qualify} then {
      if {!$isMemory} then {
        set fileName [file join [getDatabaseDirectory] [file tail $fileName]]
      }

      #
      # NOTE: Check if the file still exists.
      #
      if {!$isMemory && $delete && [file exists $fileName]} then {
      if {!$isMemory && [file exists $fileName]} then {
        #
        # NOTE: Skip deleting database files if somebody sets the global
        #       variable to prevent it.
        #
        if {![info exists ::no(cleanupDbFile)]} then {
        if {![info exists ::no(cleanupDb)]} then {
          #
          # NOTE: Attempt to delete the test database file now.
          #
          if {[set code [catch {file delete $fileName} error]]} then {
            #
            # NOTE: We somehow failed to delete the file, report why.
            #
692
693
694
695
696
697
698
699

700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
641
642
643
644
645
646
647

648












649
650
651
652
653
654
655







-
+
-
-
-
-
-
-
-
-
-
-
-
-







        #
        set code 0
      }

      return $code
    }

    proc cleanupFile { fileName {collect true} {force false} } {
    proc cleanupFile { fileName {force false} } {
      #
      # NOTE: Attempt to force all pending "garbage" objects to be collected,
      #       including SQLite statements and backup objects; this should allow
      #       the underlying database file to be deleted.
      #
      if {$collect && \
          [catch {object invoke GC GetTotalMemory true} error]} then {
        tputs $channel [appendArgs \
            "==== WARNING: failed full garbage collection, error: " \
            \n\t $error \n]
      }

      #
      # NOTE: Check if the file still exists.
      #
      if {[file exists $fileName]} then {
        #
        # NOTE: Skip deleting test files if somebody sets the global variable
        #       to prevent it.
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
780
781
782
783
784
785
786


787


788


789

790
791
792
793
794
795
796







-
-

-
-

-
-

-







        #
        if {![info exists ::no(sqliteFiles)]} then {
          #
          # NOTE: Skip trying to delete any files if we are so instructed.
          #
          if {![info exists ::no(deleteSqliteFiles)]} then {
            tryDeleteAssembly sqlite3.dll
            removeConstraint file_sqlite3.dll

            tryDeleteAssembly SQLite.Interop.dll
            removeConstraint file_SQLite.Interop.dll

            tryDeleteAssembly System.Data.SQLite.dll
            removeConstraint file_System.Data.SQLite.dll

            tryDeleteAssembly System.Data.SQLite.Linq.dll
            removeConstraint file_System.Data.SQLite.Linq.dll
          }

          #
          # NOTE: Skip trying to copy any files if we are so instructed.
          #
          if {![info exists ::no(copySqliteFiles)]} then {
            tryCopyAssembly sqlite3.dll
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
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014

1015
1016
1017
1018
1019
1020
1021
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







-
-
-
-
-
-
-
-
-
-
-
-
-
-









-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-










-
-
-
-
-
-
-








-
-
-
-
-
-
-















-
-
+
-






        object foreach assembly $assemblies {
          if {[string match \{System.Data.SQLite* $assembly]} then {
            tputs $::test_channel [appendArgs \
                "---- found assembly: " $assembly \n]
          }
        }

        catch {
          tputs $::test_channel \
              "---- define constants for \"System.Data.SQLite\"... "

          if {[catch {object invoke -flags +NonPublic \
                  System.Data.SQLite.SQLite3 DefineConstants} \
                  defineConstants] == 0} then {
            tputs $::test_channel [appendArgs [formatList [lsort \
                $defineConstants]] \n]
          } else {
            tputs $::test_channel unknown\n
          }
        }

        #
        # NOTE: Now, we need to know if the SQLite core library is available
        #       (i.e. because the managed-only System.Data.SQLite assembly can
        #       load without it; however, it cannot do anything useful without
        #       it).  If we are using the mixed-mode assembly and we already
        #       found it (above), this should always succeed.
        #
        checkForSQLite $::test_channel

        #
        # NOTE: Check if the sqlite3_win32_set_directory function is available.
        #
        tputs $::test_channel \
            "---- checking for function sqlite3_win32_set_directory... "

        if {[catch {object invoke -flags +NonPublic \
                System.Data.SQLite.UnsafeNativeMethods \
                sqlite3_win32_set_directory 0 null}] == 0} then {
          #
          # NOTE: Calling the sqlite3_win32_set_directory function does not
          #       cause an exception; therefore, it must be available (i.e.
          #       even though it should return a failure return code in this
          #       case).
          #
          addConstraint sqlite3_win32_set_directory

          tputs $::test_channel yes\n
        } else {
          tputs $::test_channel no\n
        }

        #
        # NOTE: Attempt to determine if the custom extension functions were
        #       compiled into the SQLite interop assembly.
        #
        checkForSQLiteDefineConstant $::test_channel \
            CHECK_STATE

        checkForSQLiteDefineConstant $::test_channel \
            USE_INTEROP_DLL

        checkForSQLiteDefineConstant $::test_channel \
            INTEROP_EXTENSION_FUNCTIONS

        #
        # NOTE: Report the resource usage prior to running any tests.
        #
        reportSQLiteResources $::test_channel

        #
        # NOTE: Show the active test constraints.
        #
        tputs $::test_channel [appendArgs "---- constraints: " \
            [formatList [lsort [getConstraints]]] \n]

        #
        # NOTE: Show when our tests actually began (now).
        #
        tputs $::test_channel [appendArgs \
            "---- System.Data.SQLite tests began at " \
            [clock format [clock seconds]] \n]
      }
    }

    proc runSQLiteTestEpilogue {} {
      #
      # NOTE: Skip running our custom epilogue if the main one has been skipped.
      #
      if {![info exists ::no(epilogue.eagle)]} then {
        #
        # NOTE: Show when our tests actually ended (now).
        #
        tputs $::test_channel [appendArgs \
            "---- System.Data.SQLite tests ended at " \
            [clock format [clock seconds]] \n]

        #
        # NOTE: Also report the resource usage after running the tests.
        #
        reportSQLiteResources $::test_channel
      }
    }

    ###########################################################################
    ############################# END Eagle ONLY ##############################
    ###########################################################################
  }

  #
  # NOTE: Save the name of the directory containing this file.
  #
  if {![info exists ::common_directory]} then {
    set ::common_directory [file dirname [info script]]
  set ::common_directory [file dirname [info script]]
  }

  #
  # NOTE: Provide the System.Data.SQLite test package to the interpreter.
  #
  package provide System.Data.SQLite.Test 1.0
}
Changes to Tests/installer.eagle.
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
21
22
23
24
25
26
27

28
29
30
31
32
33
34







-







###############################################################################

#
# NOTE: Setup the variables that refer to the various files required by the
#       tests in this file.
#
set systemDataSQLiteDllFile [getBuildFileName System.Data.SQLite.dll]
set systemDataSQLiteLinqDllFile [getBuildFileName System.Data.SQLite.Linq.dll]
set installerExeFile [getBuildFileName Installer.exe]

#
# NOTE: The various install/uninstall log files used to test the design-time
#       component installer.
#
set testInstallVs2005LogFile [file nativename [file join $path \
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
48
49
50
51
52
53
54










55
56
57
58
59
60
61







-
-
-
-
-
-
-
-
-
-








set testUninstallVs2010LogFile [file nativename [file join $path \
    Uninstaller_Test_Vs2010.log]]

#
# NOTE: Setup the test constraints specific to the tests in this file.
#
if {![haveConstraint [appendArgs file_ \
    [file tail $systemDataSQLiteDllFile]]]} then {
  checkForFile $test_channel $systemDataSQLiteDllFile
}

if {![haveConstraint [appendArgs file_ \
    [file tail $systemDataSQLiteLinqDllFile]]]} then {
  checkForFile $test_channel $systemDataSQLiteLinqDllFile
}

if {![haveConstraint [appendArgs file_ \
    [file tail $installerExeFile]]]} then {
  checkForFile $test_channel $installerExeFile
}

if {![haveConstraint [appendArgs file_ \
    [file tail $testInstallVs2005LogFile]]]} then {
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
116
117
118
119
120
121
122

123
124
125
126
127
128
129







-







      [subst -nobackslashes [readFile $testInstallVs2005LogFile]]] : $error}]
} -cleanup {
  cleanupFile $fileName

  unset -nocomplain wow64 code output error fileName
} -constraints {eagle administrator visualStudio2005\
System.Data.SQLite.dll_v2.0.50727 file_Installer.exe\
file_System.Data.SQLite.dll file_System.Data.SQLite.Linq.dll\
file_Installer_Test_Vs2005.log} -result {0 True}}

###############################################################################

runTest {test installer-1.2 {uninstaller tool / Visual Studio 2005} -setup {
  set fileName [file join [getTemporaryPath] [file tail [string map [list \
      .log [appendArgs _ [pid] .log]] $testUninstallVs2005LogFile]]]
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
151
152
153
154
155
156
157

158
159
160
161
162
163
164







-







      [subst -nobackslashes [readFile $testUninstallVs2005LogFile]]] : $error}]
} -cleanup {
  cleanupFile $fileName

  unset -nocomplain wow64 code output error fileName
} -constraints {eagle administrator visualStudio2005\
System.Data.SQLite.dll_v2.0.50727 file_Installer.exe\
file_System.Data.SQLite.dll file_System.Data.SQLite.Linq.dll\
file_Uninstaller_Test_Vs2005.log} -result {0 True}}

###############################################################################

runTest {test installer-1.3 {installer tool / Visual Studio 2008} -setup {
  set fileName [file join [getTemporaryPath] [file tail [string map [list \
      .log [appendArgs _ [pid] .log]] $testInstallVs2008LogFile]]]
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
186
187
188
189
190
191
192

193
194
195
196
197
198
199







-







      [subst -nobackslashes [readFile $testInstallVs2008LogFile]]] : $error}]
} -cleanup {
  cleanupFile $fileName

  unset -nocomplain wow64 code output error fileName
} -constraints {eagle administrator visualStudio2008\
System.Data.SQLite.dll_v2.0.50727 file_Installer.exe\
file_System.Data.SQLite.dll file_System.Data.SQLite.Linq.dll\
file_Installer_Test_Vs2008.log} -result {0 True}}

###############################################################################

runTest {test installer-1.4 {uninstaller tool / Visual Studio 2008} -setup {
  set fileName [file join [getTemporaryPath] [file tail [string map [list \
      .log [appendArgs _ [pid] .log]] $testUninstallVs2008LogFile]]]
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
221
222
223
224
225
226
227

228
229
230
231
232
233
234







-







      [subst -nobackslashes [readFile $testUninstallVs2008LogFile]]] : $error}]
} -cleanup {
  cleanupFile $fileName

  unset -nocomplain wow64 code output error fileName
} -constraints {eagle administrator visualStudio2008\
System.Data.SQLite.dll_v2.0.50727 file_Installer.exe\
file_System.Data.SQLite.dll file_System.Data.SQLite.Linq.dll\
file_Uninstaller_Test_Vs2008.log} -result {0 True}}

###############################################################################

runTest {test installer-1.5 {installer tool / Visual Studio 2010} -setup {
  set fileName [file join [getTemporaryPath] [file tail [string map [list \
      .log [appendArgs _ [pid] .log]] $testInstallVs2010LogFile]]]
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
256
257
258
259
260
261
262

263
264
265
266
267
268
269







-







      [subst -nobackslashes [readFile $testInstallVs2010LogFile]]] : $error}]
} -cleanup {
  cleanupFile $fileName

  unset -nocomplain wow64 code output error fileName
} -constraints {eagle administrator visualStudio2010\
System.Data.SQLite.dll_v4.0.30319 file_Installer.exe\
file_System.Data.SQLite.dll file_System.Data.SQLite.Linq.dll\
file_Installer_Test_Vs2010.log} -result {0 True}}

###############################################################################

runTest {test installer-1.6 {uninstaller tool / Visual Studio 2010} -setup {
  set fileName [file join [getTemporaryPath] [file tail [string map [list \
      .log [appendArgs _ [pid] .log]] $testUninstallVs2010LogFile]]]
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322

323
324
325
326
327
291
292
293
294
295
296
297

298
299
300
301
302
303
304

305
306
307
308
309
310







-







-
+





      [subst -nobackslashes [readFile $testUninstallVs2010LogFile]]] : $error}]
} -cleanup {
  cleanupFile $fileName

  unset -nocomplain wow64 code output error fileName
} -constraints {eagle administrator visualStudio2010\
System.Data.SQLite.dll_v4.0.30319 file_Installer.exe\
file_System.Data.SQLite.dll file_System.Data.SQLite.Linq.dll\
file_Uninstaller_Test_Vs2010.log} -result {0 True}}

###############################################################################

unset -nocomplain testUninstallVs2010LogFile testUninstallVs2008LogFile \
    testUninstallVs2005LogFile testInstallVs2010LogFile \
    testInstallVs2008LogFile testInstallVs2005LogFile installerExeFile \
    systemDataSQLiteLinqDllFile systemDataSQLiteDllFile
    systemDataSQLiteDllFile

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue
Deleted Tests/stress.eagle.
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





































































































































































































































































































































































































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
###############################################################################
#
# stress.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test stress-1.1 {multithreaded stress testing} -setup {
  unset -nocomplain thread index workload srcDb db fileName compiled options \
      count

  #############################################################################

  proc expectedError { error } {
    return [expr {[regexp -- {\sno such table: t1\s} $error] || \
        [regexp -- {\sdatabase is locked\s} $error]}]
  }

  #############################################################################

  proc showTest { indicator } {
    tputs $::test_channel $indicator
    after [expr {int(rand() * 1000)}]
  }

  #############################################################################

  proc failTest { error } {
    set level [expr {[info level] - 1}]

    tputs $::test_channel [appendArgs \
        \n [info level $level] ": " $error \n]

    exit Failure; # halt all testing now.
  }

  #############################################################################

  set count(0) 1
  set count(1) 5

  if {[info exists argv] && [llength $argv] > 0} then {
    parse options [list \
        [list null MustHaveIntegerValue -1 -1 -count0 $count(0)] \
        [list null MustHaveIntegerValue -1 -1 -count1 $count(1)]] $argv

    set count(0) $options(-count0,value)
    set count(1) $options(-count1,value)
  }

  #############################################################################

  tputs $test_channel [appendArgs \
      "---- workloads will repeat " $count(0) " time(s)...\n"]

  tputs $test_channel [appendArgs \
      "---- workloads will have " $count(1) " iteration(s)...\n"]

  #############################################################################

  set compiled(12) ""
  set compiled(13) ""

  #############################################################################

  set fileName(1) "file::memory:?cache=shared"
  set fileName(2) [file join [getDatabaseDirectory] stress.db]

  #############################################################################

  #
  # NOTE: Make sure to remove any stale database from previous test runs.
  #
  cleanupFile $fileName(2)

  #############################################################################

  setupDb $fileName(1) "" "" "" "" "" false false true srcDb
  setupDb $fileName(2)

  #############################################################################

  set workload(1) [list [list srcFileName dstFileName table count] {
    #
    # NOTE: Workload #1, CREATE TABLE statements.
    #
    lappend ::times(1) [lindex [time {
      setupDb $dstFileName "" "" "" "" "" true false
      if {[catch {
        for {set index 2} {$index <= $count} {incr index} {
          sql execute $db [appendArgs \
              "CREATE TABLE IF NOT EXISTS t" $index "(x PRIMARY KEY, y, z);"]
          showTest 1
        }
      } error]} then {
        if {[expectedError $error]} then {
          showTest *
        } else {
          failTest $error
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]

  #############################################################################

  set workload(2) [list [list srcFileName dstFileName table count] {
    #
    # NOTE: Workload #2, DROP TABLE statements.
    #
    lappend ::times(2) [lindex [time {
      setupDb $dstFileName "" "" "" "" "" true false
      if {[catch {
        for {set index 2} {$index <= $count} {incr index} {
          sql execute $db [appendArgs \
              "DROP TABLE IF EXISTS t" $index \;]
          showTest 2
        }
      } error]} then {
        if {[expectedError $error]} then {
          showTest *
        } else {
          failTest $error
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]

  #############################################################################

  set workload(3) [list [list srcFileName dstFileName table count] {
    #
    # NOTE: Workload #3, "small" SELECT statements.
    #
    lappend ::times(3) [lindex [time {
      setupDb $dstFileName "" "" "" "" "" true false
      if {[catch {
        for {set index 1} {$index <= $count} {incr index} {
          sql execute -execute reader $db [appendArgs \
              "SELECT x, y FROM " $table " WHERE z = 'small';"]
          showTest 3
        }
      } error]} then {
        if {[expectedError $error]} then {
          showTest *
        } else {
          failTest $error
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]

  #############################################################################

  set workload(4) [list [list srcFileName dstFileName table count] {
    #
    # NOTE: Workload #4, "big" SELECT statements.
    #
    lappend ::times(4) [lindex [time {
      setupDb $dstFileName "" "" "" "" "" true false
      if {[catch {
        for {set index 1} {$index <= $count} {incr index} {
          sql execute -execute reader $db [appendArgs \
              "SELECT x, y FROM " $table " WHERE z = 'big';"]
          showTest 4
        }
      } error]} then {
        if {[expectedError $error]} then {
          showTest *
        } else {
          failTest $error
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]

  #############################################################################

  set workload(5) [list [list srcFileName dstFileName table count] {
    #
    # NOTE: Workload #5, "small" INSERT statements.
    #
    lappend ::times(5) [lindex [time {
      setupDb $dstFileName "" "" "" "" "" true false
      if {[catch {
        for {set index 1} {$index <= $count} {incr index} {
          sql execute $db [appendArgs \
              "INSERT INTO " $table "(x, y, z) VALUES('" \
              [format %lX [expr {random()}]] "', '" \
              [base64 encode -- [expr {randstr(10000)}]] \
              "', 'small');"]
          showTest 5
        }
      } error]} then {
        if {[expectedError $error]} then {
          showTest *
        } else {
          failTest $error
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]

  #############################################################################

  set workload(6) [list [list srcFileName dstFileName table count] {
    #
    # NOTE: Workload #6, "big" INSERT statements.
    #
    lappend ::times(6) [lindex [time {
      setupDb $dstFileName "" "" "" "" "" true false
      if {[catch {
        for {set index 1} {$index <= $count} {incr index} {
          sql execute $db [appendArgs \
              "INSERT INTO " $table "(x, y, z) VALUES('" \
              [format %lX [expr {random()}]] \
              "', RANDOMBLOB(10000000), 'big');"]
          showTest 6
        }
      } error]} then {
        if {[expectedError $error]} then {
          showTest *
        } else {
          failTest $error
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]

  #############################################################################

  set workload(7) [list [list srcFileName dstFileName table count] {
    #
    # NOTE: Workload #7, "small" UPDATE statements.
    #
    lappend ::times(7) [lindex [time {
      setupDb $dstFileName "" "" "" "" "" true false
      if {[catch {
        for {set index 1} {$index <= $count} {incr index} {
          sql execute $db [appendArgs "UPDATE " $table \
              " SET y = '" [base64 encode -- [expr {randstr(10000)}]] \
              "' WHERE x LIKE '" [format %X $index] "%' AND z = 'small';"]
          showTest 7
        }
      } error]} then {
        if {[expectedError $error]} then {
          showTest *
        } else {
          failTest $error
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]

  #############################################################################

  set workload(8) [list [list srcFileName dstFileName table count] {
    #
    # NOTE: Workload #8, "big" UPDATE statements.
    #
    lappend ::times(8) [lindex [time {
      setupDb $dstFileName "" "" "" "" "" true false
      if {[catch {
        for {set index 1} {$index <= $count} {incr index} {
          sql execute $db [appendArgs "UPDATE " $table \
              " SET y = RANDOMBLOB(10000000) WHERE x LIKE '" \
              [format %X $index] "%' AND z = 'big';"]
          showTest 8
        }
      } error]} then {
        if {[expectedError $error]} then {
          showTest *
        } else {
          failTest $error
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]

  #############################################################################

  set workload(9) [list [list srcFileName dstFileName table count] {
    #
    # NOTE: Workload #9, "small" DELETE statements.
    #
    lappend ::times(9) [lindex [time {
      setupDb $dstFileName "" "" "" "" "" true false
      if {[catch {
        for {set index 1} {$index <= $count} {incr index} {
          sql execute $db [appendArgs "DELETE FROM " $table \
              " WHERE x LIKE '" [format %X $index] "%' AND z = 'small';"]
          showTest 9
        }
      } error]} then {
        if {[expectedError $error]} then {
          showTest *
        } else {
          failTest $error
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]

  #############################################################################

  set workload(10) [list [list srcFileName dstFileName table count] {
    #
    # NOTE: Workload #10, "big" DELETE statements.
    #
    lappend ::times(10) [lindex [time {
      setupDb $dstFileName "" "" "" "" "" true false
      if {[catch {
        for {set index 1} {$index <= $count} {incr index} {
          sql execute $db [appendArgs "DELETE FROM " $table \
              " WHERE x LIKE '" [format %X $index] "%' AND z = 'big';"]
          showTest A
        }
      } error]} then {
        if {[expectedError $error]} then {
          showTest *
        } else {
          failTest $error
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]

  #############################################################################

  set workload(11) [list [list srcFileName dstFileName table count] {
    #
    # NOTE: Workload #11, VACUUM statement.
    #
    lappend ::times(11) [lindex [time {
      setupDb $dstFileName "" "" "" "" "" true false
      if {[catch {
        sql execute $db "VACUUM;"
        showTest B
      } error]} then {
        if {[expectedError $error]} then {
          showTest *
        } else {
          failTest $error
        }
      }
      cleanupDb $dstFileName db false true false
    }] 0]
  }]

  #############################################################################

  set workload(12) [list [list srcFileName dstFileName table count] {
    #
    # NOTE: Workload #12, backup to in-memory database.
    #
    lappend ::times(12) [lindex [time {
      if {[string is integer -strict $::compiled(12)]} then {
        set id $::compiled(12); # NOTE: Already compiled.
        object invoke _Dynamic${id}.Test${id} BackupAndGetData
      } else {
        set id [object invoke Interpreter.GetActive NextId]
        set code [compileCSharpWith [subst {
          using System;
          using System.Data.SQLite;
          using System.Text;

          namespace _Dynamic${id}
          {
            public static class Test${id}
            {
              public static void BackupAndGetData()
              {
                using (SQLiteConnection source = new SQLiteConnection(
                    "FullUri=${dstFileName};"))
                {
                  source.Open();
                  using (SQLiteConnection destination = new SQLiteConnection(
                      "FullUri=${srcFileName};"))
                  {
                    destination.Open();

                    source.BackupDatabase(
                        destination, "main", "main", -1, null, 0);
                  }
                }
              }

              /////////////////////////////////////////////////////////////////

              public static void Main()
              {
                // do nothing.
              }
            }
          }
        }] true true true results errors System.Data.SQLite.dll]
        if {$code eq "Ok"} then {
          set ::compiled(12) $id; # NOTE: Compiled OK.
          object invoke _Dynamic${id}.Test${id} BackupAndGetData
        } else {
          error $errors
        }
      }
      showTest C
    }] 0]
  }]

  #############################################################################

  set workload(13) [list [list srcFileName dstFileName table count] {
    #
    # NOTE: Workload #13, backup from an in-memory database.
    #
    lappend ::times(13) [lindex [time {
      if {[string is integer -strict $::compiled(13)]} then {
        set id $::compiled(13); # NOTE: Already compiled.
        object invoke _Dynamic${id}.Test${id} BackupAndGetData
      } else {
        set id [object invoke Interpreter.GetActive NextId]
        set code [compileCSharpWith [subst {
          using System;
          using System.Data.SQLite;
          using System.Text;

          namespace _Dynamic${id}
          {
            public static class Test${id}
            {
              public static void BackupAndGetData()
              {
                using (SQLiteConnection source = new SQLiteConnection(
                    "FullUri=${srcFileName};"))
                {
                  source.Open();
                  using (SQLiteConnection destination = new SQLiteConnection(
                      "FullUri=${dstFileName};"))
                  {
                    destination.Open();

                    source.BackupDatabase(
                        destination, "main", "main", -1, null, 0);
                  }
                }
              }

              /////////////////////////////////////////////////////////////////

              public static void Main()
              {
                // do nothing.
              }
            }
          }
        }] true true true results errors System.Data.SQLite.dll]
        if {$code eq "Ok"} then {
          set ::compiled(13) $id; # NOTE: Compiled OK.
          object invoke _Dynamic${id}.Test${id} BackupAndGetData
        } else {
          error $errors
        }
      }
      showTest D
    }] 0]
  }]
} -body {
  for {set index(0) 0} {$index(0) < $count(0)} {incr index(0)} {
    sql execute $db "CREATE TABLE IF NOT EXISTS t1(x PRIMARY KEY, y, z);"

    unset -nocomplain thread

    foreach index(1) [lsort -integer [array names workload]] {
      set thread($index(1)) [object create -alias System.Threading.Thread \
          [list apply $workload($index(1)) $fileName(1) $fileName(2) t1 \
          $count(1)]]
    }

    foreach index(1) [list Start Join] {
      foreach index(2) [array names thread] {
        $thread($index(2)) $index(1)
      }
    }

    unset -nocomplain thread
  }

  tputs $test_channel \n

  foreach index(0) [lsort -integer [array names times]] {
    set times(length) [llength $times($index(0))]

    if {$times(length) > 0} then {
      tputs $test_channel [appendArgs \
          "---- average time for workload (" $index(0) ") is about " \
          [expr int(([join $times($index(0)) +])/$times(length)/1000.0)] \
          " milliseconds\n"]
    } else {
      tputs $test_channel [appendArgs \
          "---- no times for workload (" $index(0) ")\n"]
    }
  }
} -cleanup {
  rename failTest ""
  rename showTest ""
  rename expectedError ""

  cleanupDb $fileName(2)
  cleanupDb $fileName(1) srcDb

  foreach index(0) [array names workload] {
    catch {
      object removecallback [list apply $workload($index(0)) $fileName(1) \
          $fileName(2) t1 $count(1)]
    }
  }

  unset -nocomplain thread index workload srcDb db fileName compiled options \
      count times
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result {}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue
Changes to Tests/tkt-00f86f9739.eagle.
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
20
21
22
23
24
25
26


27
28
29
30
31
32
33










34
35
36
37
38
39
40







-
-







-
-
-
-
-
-
-
-
-
-








###############################################################################

#
# NOTE: Setup the variables that refer to the various files required by the
#       tests in this file.
#
set systemDataSQLiteDllFile [getBuildFileName System.Data.SQLite.dll]
set systemDataSQLiteLinqDllFile [getBuildFileName System.Data.SQLite.Linq.dll]
set testLinqExeFile [getBuildFileName testlinq.exe]
set northwindEfDbFile [file nativename [file join [file dirname $path] \
    testlinq northwindEF.db]]

#
# NOTE: Setup the test constraints specific to the tests in this file.
#
if {![haveConstraint [appendArgs file_ \
    [file tail $systemDataSQLiteDllFile]]]} then {
  checkForFile $test_channel $systemDataSQLiteDllFile
}

if {![haveConstraint [appendArgs file_ \
    [file tail $systemDataSQLiteLinqDllFile]]]} then {
  checkForFile $test_channel $systemDataSQLiteLinqDllFile
}

if {![haveConstraint [appendArgs file_ [file tail $testLinqExeFile]]]} then {
  checkForFile $test_channel $testLinqExeFile
}

if {![haveConstraint [appendArgs file_ [file tail $northwindEfDbFile]]]} then {
  checkForFile $test_channel $northwindEfDbFile
}
77
78
79
80
81
82
83
84

85
86
87
88
89


90
91
92
93
94
95

96
97
98
99
100
65
66
67
68
69
70
71

72





73
74

75
76
77


78
79
80
81
82
83







-
+
-
-
-
-
-
+
+
-



-
-
+





      lappend result [string trim $error]
    }
  }

  set result
} -cleanup {
  unset -nocomplain code output error result value
} -constraints \
} -constraints {eagle monoToDo file_testlinq.exe file_northwindEF.db} -result \
{eagle monoToDo defineConstant.System.Data.SQLite.USE_INTEROP_DLL\
defineConstant.System.Data.SQLite.INTEROP_EXTENSION_FUNCTIONS SQLite\
file_System.Data.SQLite.dll file_System.Data.SQLite.Linq.dll file_testlinq.exe\
file_northwindEF.db} -result {0 {} 0 {DRACD OLDWO RATTC} 0 {ALFKI CACTU CHOPS\
FOLKO GALED KOENE LILAS MAGAA MAISD OCEAN RANCH SAVEA THECR} 0 {} 0 {} 0 {} 0\
{0 {} 0 {DRACD OLDWO RATTC} 0 {ALFKI CACTU CHOPS FOLKO GALED KOENE LILAS MAGAA\
MAISD OCEAN RANCH SAVEA THECR} 0 {} 0 {} 0 {} 0 {}}}
{}}}

###############################################################################

unset -nocomplain systemDataSQLiteDllFile systemDataSQLiteLinqDllFile \
    testLinqExeFile northwindEfDbFile
unset -nocomplain testLinqExeFile northwindEfDbFile

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue
Changes to Tests/tkt-343d392b51.eagle.
116
117
118
119
120
121
122
123

124
125
126
127
128
129
130
116
117
118
119
120
121
122

123
124
125
126
127
128
129
130







-
+







  set code [compileCSharpWith [subst {
    using System;
    using System.Data;
    using System.Data.SQLite;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      public class Test${id}
      {
        public static void Main()
        {
          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};"))
          {
            connection.Open();
177
178
179
180
181
182
183
184
185


186
187
188

189
190
191
192
193
194
195
177
178
179
180
181
182
183


184
185
186
187

188
189
190
191
192
193
194
195







-
-
+
+


-
+








  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catch {
        object invoke _Dynamic${id}.Test${id} Main
      } result] : [set result ""]}] $result
} -cleanup {
  cleanupDb $fileName; unset -nocomplain db fileName
  cleanupDb $otherFileName
  cleanupDb $otherFileName
  cleanupDb $fileName

  unset -nocomplain result code results errors i sql otherTable otherDbName \
      otherDataSource dataSource id otherFileName
      otherDataSource dataSource id db otherFileName fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -match \
glob -result {* System.Data.DBConcurrencyException: *}}

###############################################################################

runTest {test tkt-343d392b51-2.2 {SQLiteDataAdapter update success} -setup {
222
223
224
225
226
227
228
229

230
231
232
233
234
235
236
222
223
224
225
226
227
228

229
230
231
232
233
234
235
236







-
+







  set code [compileCSharpWith [subst {
    using System;
    using System.Data;
    using System.Data.SQLite;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      public class Test${id}
      {
        public static void Main()
        {
          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};DateTimeFormat=JulianDay;"))
          {
            connection.Open();
283
284
285
286
287
288
289
290
291


292
293
294

295
296
297
298
299
300
301
283
284
285
286
287
288
289


290
291
292
293

294
295
296
297
298
299
300
301







-
-
+
+


-
+








  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catch {
        object invoke _Dynamic${id}.Test${id} Main
      } result] : [set result ""]}] $result
} -cleanup {
  cleanupDb $fileName; unset -nocomplain db fileName
  cleanupDb $otherFileName
  cleanupDb $otherFileName
  cleanupDb $fileName

  unset -nocomplain result code results errors i sql otherTable otherDbName \
      otherDataSource dataSource id otherFileName
      otherDataSource dataSource id db otherFileName fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -match \
regexp -result {^Ok System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\}$}}

###############################################################################

runTest {test tkt-343d392b51-3.1 {attached database, same table name} -setup {
322
323
324
325
326
327
328
329
330


331
332


333
334
335
336
337
338
339
322
323
324
325
326
327
328


329
330
331

332
333
334
335
336
337
338
339
340







-
-
+
+

-
+
+








  sql execute $db $sql(1)

  list [sql execute -execute reader -format list $db "SELECT x FROM t1;"] \
      [sql execute -execute reader -format list $db [appendArgs \
      "SELECT x FROM " ${otherTable} ";"]]
} -cleanup {
  cleanupDb $fileName; unset -nocomplain db fileName
  cleanupDb $otherFileName
  cleanupDb $otherFileName
  cleanupDb $fileName

  unset -nocomplain i sql otherTable otherDbName otherDataSource otherFileName
  unset -nocomplain i sql otherTable otherDbName otherDataSource db \
      otherFileName fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
{{1 2} {2 4}}}

###############################################################################

runTest {test tkt-343d392b51-3.2 {adapter, attached db, table names} -setup {
368
369
370
371
372
373
374
375

376
377
378
379
380
381
382
369
370
371
372
373
374
375

376
377
378
379
380
381
382
383







-
+







  set code [compileCSharpWith [subst {
    using System;
    using System.Data;
    using System.Data.SQLite;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      public class Test${id}
      {
        public static void Main()
        {
          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};"))
          {
            connection.Open();
420
421
422
423
424
425
426
427
428


429
430
431

432
433
434
435
436
437
438
439
421
422
423
424
425
426
427


428
429
430
431

432
433
434
435
436
437
438
439
440







-
-
+
+


-
+









  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catch {
        object invoke _Dynamic${id}.Test${id} Main
      } result] : [set result ""]}] $result
} -cleanup {
  cleanupDb $fileName; unset -nocomplain db fileName
  cleanupDb $otherFileName
  cleanupDb $otherFileName
  cleanupDb $fileName

  unset -nocomplain result code results errors i sql otherTable otherDbName \
      otherDataSource dataSource id otherFileName
      otherDataSource dataSource id db otherFileName fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -match \
regexp -result {^Ok System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\}$}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue
Deleted Tests/tkt-3aa50d8413.eagle.
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























































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
###############################################################################
#
# tkt-3aa50d8413.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-3aa50d8413-1.1 {FillSchema with multiple result sets} -setup {
  setupDb [set fileName tkt-3aa50d8413-1.1.db]
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  sql execute $db {
    CREATE TABLE t1(x);
    CREATE TABLE t2(x);
  }

  set sql { \
    SELECT * FROM t1; \
    SELECT * FROM t2; \
  }

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System;
    using System.Data;
    using System.Data.SQLite;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        public static void Main()
        {
          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};"))
          {
            connection.Open();

            using (SQLiteDataAdapter dataAdapter = new SQLiteDataAdapter(
                "${sql}", connection))
            {
              using (DataSet dataSet = new DataSet())
              {
                dataAdapter.FillSchema(dataSet, SchemaType.Source);
              }
            }
          }
        }
      }
    }
  }] true true true results errors System.Data.SQLite.dll]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catch {
        object invoke _Dynamic${id}.Test${id} Main
      } result] : [set result ""]}] $result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result code results errors sql dataSource id db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -match \
regexp -result {^Ok System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\}$}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue
Changes to Tests/tkt-448d663d11.eagle.
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
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







-
+















-
+








###############################################################################

runTest {test tkt-448d663d11-1.2 {missing journal mode, WAL db} -body {
  set fileName tkt-448d663d11-1.2.db
  file copy -force [file join $path wal.db] \
      [file join [getDatabaseDirectory] $fileName]
  setupDb $fileName "" "" "" "" "" true false
  setupDb $fileName "" "" "" "" "" false
  sql execute -execute scalar $db "PRAGMA journal_mode;"
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
{wal}}

###############################################################################

runTest {test tkt-448d663d11-1.3 {missing journal mode, non-WAL db} -body {
  set fileName tkt-448d663d11-1.3.db
  file copy -force [file join $path nonWal.db] \
      [file join [getDatabaseDirectory] $fileName]
  setupDb $fileName "" "" "" "" "" true false
  setupDb $fileName "" "" "" "" "" false
  sql execute -execute scalar $db "PRAGMA journal_mode;"
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
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
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







-
+















-
+








###############################################################################

runTest {test tkt-448d663d11-1.5 {'Default' journal mode, WAL db} -body {
  set fileName tkt-448d663d11-1.5.db
  file copy -force [file join $path wal.db] \
      [file join [getDatabaseDirectory] $fileName]
  setupDb $fileName Default "" "" "" "" true false
  setupDb $fileName Default "" "" "" "" false
  sql execute -execute scalar $db "PRAGMA journal_mode;"
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
{wal}}

###############################################################################

runTest {test tkt-448d663d11-1.6 {'Default' journal mode, non-WAL db} -body {
  set fileName tkt-448d663d11-1.6.db
  file copy -force [file join $path nonWal.db] \
      [file join [getDatabaseDirectory] $fileName]
  setupDb $fileName Default "" "" "" "" true false
  setupDb $fileName Default "" "" "" "" false
  sql execute -execute scalar $db "PRAGMA journal_mode;"
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
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
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







-
+















-
+








###############################################################################

runTest {test tkt-448d663d11-1.8 {'Delete' journal mode, WAL db} -body {
  set fileName tkt-448d663d11-1.8.db
  file copy -force [file join $path wal.db] \
      [file join [getDatabaseDirectory] $fileName]
  setupDb $fileName Delete "" "" "" "" true false
  setupDb $fileName Delete "" "" "" "" false
  sql execute -execute scalar $db "PRAGMA journal_mode;"
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
{delete}}

###############################################################################

runTest {test tkt-448d663d11-1.9 {'Delete' journal mode, non-WAL db} -body {
  set fileName tkt-448d663d11-1.9.db
  file copy -force [file join $path nonWal.db] \
      [file join [getDatabaseDirectory] $fileName]
  setupDb $fileName Delete "" "" "" "" true false
  setupDb $fileName Delete "" "" "" "" false
  sql execute -execute scalar $db "PRAGMA journal_mode;"
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
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
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







-
+















-
+








###############################################################################

runTest {test tkt-448d663d11-1.15 {'Wal' journal mode, non-WAL db} -body {
  set fileName tkt-448d663d11-1.15.db
  file copy -force [file join $path nonWal.db] \
      [file join [getDatabaseDirectory] $fileName]
  setupDb $fileName Wal "" "" "" "" true false
  setupDb $fileName Wal "" "" "" "" false
  sql execute -execute scalar $db "PRAGMA journal_mode;"
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
{wal}}

###############################################################################

runTest {test tkt-448d663d11-1.16 {'Wal' journal mode, WAL db} -body {
  set fileName tkt-448d663d11-1.16.db
  file copy -force [file join $path wal.db] \
      [file join [getDatabaseDirectory] $fileName]
  setupDb $fileName Wal "" "" "" "" true false
  setupDb $fileName Wal "" "" "" "" false
  sql execute -execute scalar $db "PRAGMA journal_mode;"
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
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
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







-
+















-
+














###############################################################################

runTest {test tkt-448d663d11-1.18 {'Bad' journal mode, non-WAL db} -body {
  set fileName tkt-448d663d11-1.18.db
  file copy -force [file join $path nonWal.db] \
      [file join [getDatabaseDirectory] $fileName]
  setupDb $fileName Bad "" "" "" "" true false
  setupDb $fileName Bad "" "" "" "" false
  sql execute -execute scalar $db "PRAGMA journal_mode;"
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
{delete}}

###############################################################################

runTest {test tkt-448d663d11-1.19 {'Bad' journal mode, WAL db} -body {
  set fileName tkt-448d663d11-1.19.db
  file copy -force [file join $path wal.db] \
      [file join [getDatabaseDirectory] $fileName]
  setupDb $fileName Bad "" "" "" "" true false
  setupDb $fileName Bad "" "" "" "" false
  sql execute -execute scalar $db "PRAGMA journal_mode;"
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
{wal}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue
Changes to Tests/tkt-59edc1018b.eagle.
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
20
21
22
23
24
25
26


27
28
29
30
31
32
33










34
35
36
37
38
39
40







-
-







-
-
-
-
-
-
-
-
-
-








###############################################################################

#
# NOTE: Setup the variables that refer to the various files required by the
#       tests in this file.
#
set systemDataSQLiteDllFile [getBuildFileName System.Data.SQLite.dll]
set systemDataSQLiteLinqDllFile [getBuildFileName System.Data.SQLite.Linq.dll]
set testLinqExeFile [getBuildFileName testlinq.exe]
set northwindEfDbFile [file nativename [file join [file dirname $path] \
    testlinq northwindEF.db]]

#
# NOTE: Setup the test constraints specific to the tests in this file.
#
if {![haveConstraint [appendArgs file_ \
    [file tail $systemDataSQLiteDllFile]]]} then {
  checkForFile $test_channel $systemDataSQLiteDllFile
}

if {![haveConstraint [appendArgs file_ \
    [file tail $systemDataSQLiteLinqDllFile]]]} then {
  checkForFile $test_channel $systemDataSQLiteLinqDllFile
}

if {![haveConstraint [appendArgs file_ [file tail $testLinqExeFile]]]} then {
  checkForFile $test_channel $testLinqExeFile
}

if {![haveConstraint [appendArgs file_ [file tail $northwindEfDbFile]]]} then {
  checkForFile $test_channel $northwindEfDbFile
}
77
78
79
80
81
82
83
84

85
86
87
88
89


90
91
92
93
94

95
96
97
98
99
65
66
67
68
69
70
71

72





73
74
75
76
77


78
79
80
81
82
83







-
+
-
-
-
-
-
+
+



-
-
+





      lappend result [string trim $error]
    }
  }

  set result
} -cleanup {
  unset -nocomplain code output error result value
} -constraints \
} -constraints {eagle monoToDo file_testlinq.exe file_northwindEF.db} -result \
{eagle monoToDo defineConstant.System.Data.SQLite.USE_INTEROP_DLL\
defineConstant.System.Data.SQLite.INTEROP_EXTENSION_FUNCTIONS SQLite\
file_System.Data.SQLite.dll file_System.Data.SQLite.Linq.dll file_testlinq.exe\
file_northwindEF.db} -result {0 {} 0 {FURIB GALED GODOS LAZYK LINOD PRINI REGGC\
WOLZA} 0 {} 0 ERNSH 0 {} 0 {AROUT BSBEV CONSH EASTC NORTS SEVES} 0 {}}}
{0 {} 0 {FURIB GALED GODOS LAZYK LINOD PRINI REGGC WOLZA} 0 {} 0 ERNSH 0 {} 0\
{AROUT BSBEV CONSH EASTC NORTS SEVES} 0 {}}}

###############################################################################

unset -nocomplain systemDataSQLiteDllFile systemDataSQLiteLinqDllFile \
    testLinqExeFile northwindEfDbFile
unset -nocomplain testLinqExeFile northwindEfDbFile

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue
Changes to Tests/tkt-72905c9a77.eagle.
51
52
53
54
55
56
57
58

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

58
59
60
61
62
63
64
65







-
+







    using System.IO;
    using System.Reflection;
    using System.Text;
    using System.Threading;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      public class Test${id}
      {
        public static string GetTraceOutput()
        {
          //
          // NOTE: Create a memory stream to capture all the trace output for
          //       this test.
          //
Changes to Tests/tkt-7e3fa93744.eagle.
88
89
90
91
92
93
94
95

96
97
98
99
100
101
102
88
89
90
91
92
93
94

95
96
97
98
99
100
101
102







-
+








  set code [compileCSharpWith [subst {
    using System.Data;
    using System.Data.SQLite;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      public class Test${id}
      {
        public static int Main()
        {
          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};"))
          {
            connection.Open();
Changes to Tests/tkt-8b7d179c3c.eagle.
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
20
21
22
23
24
25
26


27
28
29
30
31
32
33










34
35
36
37
38
39
40







-
-







-
-
-
-
-
-
-
-
-
-








###############################################################################

#
# NOTE: Setup the variables that refer to the various files required by the
#       tests in this file.
#
set systemDataSQLiteDllFile [getBuildFileName System.Data.SQLite.dll]
set systemDataSQLiteLinqDllFile [getBuildFileName System.Data.SQLite.Linq.dll]
set testLinqExeFile [getBuildFileName testlinq.exe]
set northwindEfDbFile [file nativename [file join [file dirname $path] \
    testlinq northwindEF.db]]

#
# NOTE: Setup the test constraints specific to the tests in this file.
#
if {![haveConstraint [appendArgs file_ \
    [file tail $systemDataSQLiteDllFile]]]} then {
  checkForFile $test_channel $systemDataSQLiteDllFile
}

if {![haveConstraint [appendArgs file_ \
    [file tail $systemDataSQLiteLinqDllFile]]]} then {
  checkForFile $test_channel $systemDataSQLiteLinqDllFile
}

if {![haveConstraint [appendArgs file_ [file tail $testLinqExeFile]]]} then {
  checkForFile $test_channel $testLinqExeFile
}

if {![haveConstraint [appendArgs file_ [file tail $northwindEfDbFile]]]} then {
  checkForFile $test_channel $northwindEfDbFile
}
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
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







-
-
-
+
+
+
+
+
+
+
+
+






-
-
-
-
-
-
-
-
+



-
-
+





      lappend result [string trim $error]
    }
  }

  set result
} -cleanup {
  unset -nocomplain code output error result pageSize
} -constraints {eagle monoToDo SQLite file_System.Data.SQLite.dll\
file_System.Data.SQLite.Linq.dll file_testlinq.exe file_northwindEF.db} \
-result {0 {} 0 {DRACD RATTC OLDWO GALED LILAS MAGAA ALFKI CHOPS SAVEA KOENE\
} -constraints {eagle monoToDo file_testlinq.exe file_northwindEF.db} -result \
{0 {} 0 {DRACD RATTC OLDWO GALED LILAS MAGAA ALFKI CHOPS SAVEA KOENE MAISD\
FOLKO CACTU OCEAN RANCH THECR GOURL GROSR SUPRD HUNGO ISLAT QUICK HUNGC GREAL\
LEHMS RICSU ERNSH WILMK LINOD TRAIH SIMOB OTTIK SPLIR MORGK FOLIG FURIB PRINI\
AROUT BSBEV CONSH EASTC NORTS SEVES BERGS VICTE BOLID FISSA ROMEY BLAUS BONAP\
MEREP ANATR ANTON CENTC PERIC TORTU FRANK TOMSP DUMON FRANR WARTH PARIS SPECD\
LONEP THEBI REGGC VINET WELLI HANAR QUEDE RICAR PICCO HILAA LETSS COMMI FAMIA\
QUEEN TRADH WHITC GODOS SANTG BLONP WANDK FRANS LAMAI BOTTM LAUGB LACOR LAZYK\
WOLZA VAFFE} 0 {DRACD RATTC OLDWO GALED LILAS MAGAA ALFKI CHOPS SAVEA KOENE\
MAISD FOLKO CACTU OCEAN RANCH THECR GOURL GROSR SUPRD HUNGO ISLAT QUICK HUNGC\
GREAL LEHMS RICSU ERNSH WILMK LINOD TRAIH SIMOB OTTIK SPLIR MORGK FOLIG FURIB\
PRINI AROUT BSBEV CONSH EASTC NORTS SEVES BERGS VICTE BOLID FISSA ROMEY BLAUS\
BONAP MEREP ANATR ANTON CENTC PERIC TORTU FRANK TOMSP DUMON FRANR WARTH PARIS\
SPECD LONEP THEBI REGGC VINET WELLI HANAR QUEDE RICAR PICCO HILAA LETSS COMMI\
FAMIA QUEEN TRADH WHITC GODOS SANTG BLONP WANDK FRANS LAMAI BOTTM LAUGB LACOR\
LAZYK WOLZA VAFFE} 0 {DRACD RATTC OLDWO GALED LILAS MAGAA ALFKI CHOPS SAVEA\
KOENE MAISD FOLKO CACTU OCEAN RANCH THECR GOURL GROSR SUPRD HUNGO ISLAT QUICK\
HUNGC GREAL LEHMS RICSU ERNSH WILMK LINOD TRAIH SIMOB OTTIK SPLIR MORGK FOLIG\
FURIB PRINI AROUT BSBEV CONSH EASTC NORTS SEVES BERGS VICTE BOLID FISSA ROMEY\
BLAUS BONAP MEREP ANATR ANTON CENTC PERIC TORTU FRANK TOMSP DUMON FRANR WARTH\
PARIS SPECD LONEP THEBI REGGC VINET WELLI HANAR QUEDE RICAR PICCO HILAA LETSS\
COMMI FAMIA QUEEN TRADH WHITC GODOS SANTG BLONP WANDK FRANS LAMAI BOTTM LAUGB\
LACOR LAZYK WOLZA VAFFE}}}
LAZYK WOLZA VAFFE}}}

###############################################################################

unset -nocomplain systemDataSQLiteDllFile systemDataSQLiteLinqDllFile \
    testLinqExeFile northwindEfDbFile
unset -nocomplain testLinqExeFile northwindEfDbFile

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue
Deleted Tests/tkt-8c3bee31c8.eagle.
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



























































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
###############################################################################
#
# tkt-8c3bee31c8.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-8c3bee31c8-1.1 {built connection string quoting} -setup {
  unset -nocomplain dataSource o result
} -body {
  set o [object create -alias System.Data.SQLite.SQLiteConnectionStringBuilder]

  foreach dataSource [list \
        "C:\\test_path\\test.db" \
        "/test_path/test.db" \
        "C:\\test path\\test.db" \
        "/test path/test.db" \
        "C:\\test'path\\test.db" \
        "/test'path/test.db"] {
    $o DataSource $dataSource
    lappend result [list $dataSource [$o ToString]]
  }

  set result
} -cleanup {
  unset -nocomplain dataSource o result
} -constraints {eagle monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {{{C:\test_path\test.db}\
{data source=C:\test_path\test.db}} {/test_path/test.db\
{data source=/test_path/test.db}} {{C:\test path\test.db} {data source="C:\test\
path\test.db"}} {{/test path/test.db} {data source="/test path/test.db"}}\
{{C:\test'path\test.db} {data source="C:\test'path\test.db"}}\
{/test'path/test.db {data source="/test'path/test.db"}}}}

###############################################################################

runTest {test tkt-8c3bee31c8-1.2 {open single quoted file name} -setup {
  unset -nocomplain fileName o
} -body {
  set fileName [appendArgs ' [file join [getDatabaseDirectory] \
      tkt-8c3bee31c8-1.2.db] ']

  set o [object create -alias System.Data.SQLite.SQLiteConnection]
  $o ConnectionString [appendArgs "Data Source=" $fileName \;]
  $o Open; # NOTE: This command may throw an exception, failing the test.
  $o Close
} -cleanup {
  cleanupFile [string trim $fileName ']

  unset -nocomplain fileName o
} -constraints {eagle monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {}}

###############################################################################

runTest {test tkt-8c3bee31c8-1.3 {open double quoted file name} -setup {
  unset -nocomplain fileName o
} -body {
  set fileName [appendArgs \" [file join [getDatabaseDirectory] \
      tkt-8c3bee31c8-1.3.db] \"]

  set o [object create -alias System.Data.SQLite.SQLiteConnection]
  $o ConnectionString [appendArgs "Data Source=" $fileName \;]
  $o Open; # NOTE: This command may throw an exception, failing the test.
  $o Close
} -cleanup {
  cleanupFile [string trim $fileName \"]

  unset -nocomplain fileName o
} -constraints {eagle monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue
Deleted Tests/tkt-996d13cd87.eagle.
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











































































































































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
###############################################################################
#
# tkt-996d13cd87.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

for {set i 1} {$i < 11} {incr i} {
  set pooling [expr {$i % 2 == 0 ? True : False}]
  set count [expr {$i <= 2 ? 100 : int(rand() * 100 + 1)}]

  runTest {test [appendArgs tkt-996d13cd87-1. $i] {SQLiteConnection stress} \
      -setup {
    set fileName [appendArgs tkt-996d13cd87-1. $i .db]

    tputs $test_channel [appendArgs \
        "---- using a total of " $count " threads...\n"]

    if {[catch {
        object invoke -flags +NonPublic \
            System.Data.SQLite.SQLiteConnectionPool _poolOpened 0

        object invoke -flags +NonPublic \
            System.Data.SQLite.SQLiteConnectionPool _poolClosed 0
    }] == 0} then {
      set havePoolCounts true
    } else {
      set havePoolCounts false

      tputs $test_channel \
          "==== WARNING: connection pool counts are not available\n"
    }

    proc getPoolCounts {} {
      #
      # NOTE: If we have the ability to determine the opened/closed pool
      #       counts, fetch them now; otherwise, just set them to zero.
      #
      if {$::havePoolCounts} then {
        set ::poolCounts(opened) [object invoke -flags +NonPublic \
            System.Data.SQLite.SQLiteConnectionPool _poolOpened]

        set ::poolCounts(closed) [object invoke -flags +NonPublic \
            System.Data.SQLite.SQLiteConnectionPool _poolClosed]

        tputs $::test_channel [appendArgs \
            "---- opened " $::poolCounts(opened) " connections from the pool\n"]

        tputs $::test_channel [appendArgs \
            "---- closed " $::poolCounts(closed) " connections to the pool\n"]
      } else {
        set ::poolCounts(opened) 0
        set ::poolCounts(closed) 0
      }

      return ""
    }
  } -body {
    set id [object invoke Interpreter.GetActive NextId]
    set dataSource [file join [getDatabaseDirectory] $fileName]

    set sql { \
      CREATE TABLE t1(x TEXT); \
      INSERT INTO t1 (x) VALUES(RANDOMBLOB(1000)); \
    }

    unset -nocomplain results errors

    set code [compileCSharpWith [subst {
      using System;
      using System.Data.SQLite;
      using System.Diagnostics;
      using System.Threading;

      namespace _Dynamic${id}
      {
        public static class Test${id}
        {
          public static int Main()
          {
            //
            // NOTE: This is the total number of exceptions caught by all the
            //       test threads.
            //
            int errors = 0;

            //
            // NOTE: This is the total number of test threads to create.
            //
            int count = ${count};

            //
            // NOTE: This is the total number of times we should force a full
            //       garbage collection.
            //
            int gcCount = 2;

            //
            // NOTE: Create a random number generator suitable for waiting a
            //       random number of milliseconds between each attempt to
            //       cause the race condition on a given thread.
            //
            Random random = new Random();

            //
            // NOTE: Create the event that will be used to synchronize all the
            //       created threads so that they start doing their actual test
            //       "work" at approximately the same time.
            //
            using (ManualResetEvent goEvent = new ManualResetEvent(false))
            {
              //
              // NOTE: Create a (reusable) delegate that will contain the code
              //       that half the created threads are to execute.  This code
              //       will repeatedly create, open, and close a single database
              //       connection with (or without) pooling enabled.
              //
              ThreadStart threadStart1 = delegate()
              {
                try
                {
                  //
                  // NOTE: Wait forever for the "GO" signal so that all threads
                  //       can start working at approximately the same time.
                  //
                  goEvent.WaitOne();

                  //
                  // NOTE: Repeatedly try to create, open, and close a pooled
                  //       database connection and then wait a random number of
                  //       milliseconds before doing it again.
                  //
                  Thread.Sleep(random.Next(0, 500));

                  SQLiteConnection connection = new SQLiteConnection(
                      "Data Source=${dataSource};Pooling=${pooling};");

                  connection.Open();

                  using (SQLiteCommand command = new SQLiteCommand("${sql}",
                      connection))
                  {
                    command.ExecuteNonQuery();
                  }

                  connection.Close();
                  connection = null;
                }
                catch (Exception e)
                {
                  Interlocked.Increment(ref errors);
                  Trace.WriteLine(e);
                }
              };

              //
              // NOTE: Create a (reusable) delegate that will contain the code
              //       that half the created threads are to execute.  This code
              //       will repeatedly force a full garbage collection.
              //
              ThreadStart threadStart2 = delegate()
              {
                try
                {
                  //
                  // NOTE: Wait forever for the "GO" signal so that all threads
                  //       can start working at approximately the same time.
                  //
                  goEvent.WaitOne();

                  //
                  // NOTE: Wait a random number of milliseconds before forcing
                  //       a full garbage collection.
                  //
                  for (int index = 0; index < gcCount; index++)
                  {
                    Thread.Sleep(random.Next(0, 1000));
                    GC.GetTotalMemory(true);
                  }
                }
                catch (Exception e)
                {
                  Interlocked.Increment(ref errors);
                  Trace.WriteLine(e);
                }
              };

              //
              // NOTE: Create the array of thread objects.
              //
              Thread\[\] thread = new Thread\[count\];

              //
              // NOTE: Create each of the test threads with a suitable stack
              //       size.  We must specify a stack size here because the
              //       default one for the process would be the same as the
              //       parent executable (the Eagle shell), which is 16MB,
              //       too large to be useful.
              //
              for (int index = 0; index < count; index++)
              {
                //
                // NOTE: Figure out what kind of thread to create (i.e. one
                //       that uses a connection or one that calls the GC).
                //
                ThreadStart threadStart;

                if (index == 0)
                  threadStart = threadStart2;
                else
                  threadStart = threadStart1;

                thread\[index\] = new Thread(threadStart, 1048576);

                //
                // NOTE: Name each thread for a better debugging experience.
                //
                thread\[index\].Name = String.Format(
                    "[file rootname ${fileName}] #{0}", index);
              }

              //
              // NOTE: Start all the threads now.  They should not actually do
              //       any of the test "work" until we signal the event.
              //
              for (int index = 0; index < count; index++)
                thread\[index\].Start();

              //
              // NOTE: Send the signal that all threads should start doing
              //       their test "work" now.
              //
              goEvent.Set(); /* GO */

              //
              // NOTE: Wait forever for each thread to finish its test "work"
              //       and then die.
              //
              for (int index = 0; index < count; index++)
                thread\[index\].Join();
            }

            //
            // NOTE: Return the total number of exceptions caught by the test
            //       threads.
            //
            return errors;
          }
        }
      }
    }] true true true results errors System.Data.SQLite.dll]

    list $code $results \
        [expr {[info exists errors] ? $errors : ""}] \
        [expr {$code eq "Ok" ? [catch {
          object invoke _Dynamic${id}.Test${id} Main
        } result] : [set result ""]}] $result [getPoolCounts] \
        [expr {$havePoolCounts ? $pooling ? $poolCounts(opened) > 0 : \
            $poolCounts(opened) == 0} : True] \
        [expr {$havePoolCounts ? $pooling ? $poolCounts(closed) > 0 : \
            $poolCounts(closed) == 0} : True]
  } -cleanup {
    object invoke System.Data.SQLite.SQLiteConnection ClearAllPools
    object invoke GC GetTotalMemory true

    cleanupDb $fileName

    unset -nocomplain result results errors code sql dataSource id db \
        poolCounts havePoolCounts fileName

    rename getPoolCounts ""
  } -constraints {eagle monoBug28 command.sql compile.DATA\
SQLite System.Data.SQLite} -match regexp -result {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \d+ \{\} True True$}}
}

###############################################################################

unset -nocomplain count pooling i

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue
Changes to Tests/tkt-ccfa69fc32.eagle.
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
20
21
22
23
24
25
26


27
28
29
30
31
32
33










34
35
36
37
38
39
40







-
-







-
-
-
-
-
-
-
-
-
-








###############################################################################

#
# NOTE: Setup the variables that refer to the various files required by the
#       tests in this file.
#
set systemDataSQLiteDllFile [getBuildFileName System.Data.SQLite.dll]
set systemDataSQLiteLinqDllFile [getBuildFileName System.Data.SQLite.Linq.dll]
set testLinqExeFile [getBuildFileName testlinq.exe]
set northwindEfDbFile [file nativename [file join [file dirname $path] \
    testlinq northwindEF.db]]

#
# NOTE: Setup the test constraints specific to the tests in this file.
#
if {![haveConstraint [appendArgs file_ \
    [file tail $systemDataSQLiteDllFile]]]} then {
  checkForFile $test_channel $systemDataSQLiteDllFile
}

if {![haveConstraint [appendArgs file_ \
    [file tail $systemDataSQLiteLinqDllFile]]]} then {
  checkForFile $test_channel $systemDataSQLiteLinqDllFile
}

if {![haveConstraint [appendArgs file_ [file tail $testLinqExeFile]]]} then {
  checkForFile $test_channel $testLinqExeFile
}

if {![haveConstraint [appendArgs file_ [file tail $northwindEfDbFile]]]} then {
  checkForFile $test_channel $northwindEfDbFile
}
77
78
79
80
81
82
83
84
85

86
87

88
89
90
91
92
93
94

95
96
97
98
99
65
66
67
68
69
70
71


72
73

74
75
76
77
78
79


80
81
82
83
84
85







-
-
+

-
+





-
-
+





      lappend result [string trim $error]
    }
  }

  set result
} -cleanup {
  unset -nocomplain code output error result add
} -constraints {eagle monoToDo SQLite file_System.Data.SQLite.dll\
file_System.Data.SQLite.Linq.dll file_testlinq.exe file_northwindEF.db} -match \
} -constraints {eagle monoToDo file_testlinq.exe file_northwindEF.db} -match \
glob -result {0 {1581 1730 1833 2116 2139} 0 {System.Data.UpdateException: *\
---> System.Data.SQLite.SQLiteException: constraint failed
---> System.Data.SQLite.SQLiteException: Abort due to constraint violation
PRIMARY KEY must be unique
*} 0 {1 2 3 4 5 6 7 8 9 10 1576 1577 1578 1579 1580 1581 1730 1833 2116 2139}}}

###############################################################################

unset -nocomplain systemDataSQLiteDllFile systemDataSQLiteLinqDllFile \
    testLinqExeFile northwindEfDbFile
unset -nocomplain testLinqExeFile northwindEfDbFile

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue
Changes to Tests/tkt-e1b2e0f769.eagle.
41
42
43
44
45
46
47
48

49
50

51
52
53
54
55
56
57
58
59
41
42
43
44
45
46
47

48
49

50


51
52
53
54
55
56
57







-
+

-
+
-
-








    set code [compileCSharpWith [subst {
      using System.Collections.Generic;
      using System.Data.SQLite;

      namespace _Dynamic${id}
      {
        public static class Test${id}
        public class Test${id}
        {
          public static List<long?> Tkt_e1b2e0f769(
          public static List<long?> Tkt_e1b2e0f769(SQLiteConnection connection)
            SQLiteConnection connection
            )
          {
            List<long?> result = new List<long?>();

            using (SQLiteTransaction transaction =
                connection.BeginTransaction())
            {
              using (SQLiteCommand command = connection.CreateCommand())
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
88
89
90
91
92
93
94


95
96
97
98
99
100
101







-
-







              }
            }

            connection.Close();
            return result;
          }

          /////////////////////////////////////////////////////////////////////

          public static int Main()
          {
            using (SQLiteConnection connection = new SQLiteConnection(
                "Data Source=${dataSource};"))
            {
              connection.Open();

120
121
122
123
124
125
126
127
128
129


130
131
132
133
134
135
116
117
118
119
120
121
122



123
124
125
126
127
128
129
130







-
-
-
+
+






  set result1
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result2 result1 code results errors sql table dataSource \
      id x db fileName
} -constraints \
{eagle monoBug28 !defineConstant.System.Data.SQLite.CHECK_STATE command.sql\
compile.DATA SQLite System.Data.SQLite} -match regexp -result {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 3 Ok\
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -match \
regexp -result {^Ok System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 3 Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 0$}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue
Changes to Tests/tkt-e30b820248.eagle.
46
47
48
49
50
51
52
53

54
55
56
57
58
59
60
46
47
48
49
50
51
52

53
54
55
56
57
58
59
60







-
+







  set code [compileCSharpWith [subst {
    using System.Data.SQLite;
    using System.Diagnostics;
    using System.IO;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      public class Test${id}
      {
        public static void Main()
        {
          using (TraceListener listener = new TextWriterTraceListener(
              new FileStream("${test_log}", FileMode.Append,
                  FileAccess.Write, FileShare.ReadWrite), "${name}"))
          {
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
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







-
+

















-
+
-
-









-
+
-
-








-
+
-
-







      using System;
      using System.Data.SQLite;
      using System.Diagnostics;
      using System.IO;

      namespace _Dynamic${id}
      {
        public static class Test${id}
        public class Test${id}
        {
          #region Private Static Data
          private static SQLiteConnection connection;
          #endregion

          /////////////////////////////////////////////////////////////////////

          #region Public Static Methods
          public static void OpenConnection()
          {
            connection = new SQLiteConnection("Data Source=${dataSource};");
            connection.Open();
            connection.LogMessage(0, "Connection opened.");
          }

          /////////////////////////////////////////////////////////////////////

          public static SQLiteCommand CreateCommand(
          public static SQLiteCommand CreateCommand(string sql)
            string sql
            )
          {
            SQLiteCommand command = connection.CreateCommand();
            command.CommandText = sql;
            connection.LogMessage(0, "Command created.");
            return command;
          }

          /////////////////////////////////////////////////////////////////////

          public static SQLiteDataReader ExecuteReader(
          public static SQLiteDataReader ExecuteReader(SQLiteCommand command)
            SQLiteCommand command
            )
          {
            SQLiteDataReader dataReader = command.ExecuteReader();
            connection.LogMessage(0, "Command executed.");
            return dataReader;
          }

          /////////////////////////////////////////////////////////////////////

          public static SQLiteDataReader ExecuteReader(
          public static SQLiteDataReader ExecuteReader(string sql)
            string sql
            )
          {
            SQLiteCommand command = CreateCommand(sql);
            SQLiteDataReader dataReader = command.ExecuteReader();
            connection.LogMessage(0, "Command executed.");
            return dataReader;
          }

Changes to Tests/version.eagle.
25
26
27
28
29
30
31
32

33
34
35
36
37
38
39
25
26
27
28
29
30
31

32
33
34
35
36
37
38
39







-
+







#
# NOTE: For these unit tests to be useful and accurate, the following version
#       numbers must be manually kept synchronized with the version numbers for
#       the source code files, the built binaries, and the release packages.
#
set version(major)             1
set version(minor)             0
set version(build)            83; # NOTE: Incremented with each release.
set version(build)            80; # NOTE: Incremented with each release.
set version(revision)          0

###############################################################################
# ********************* END VOLATILE VERSION INFORMATION **********************
###############################################################################

#
Changes to exclude_src.txt.
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
31
32
33
34
35
36
37

38
39
40
41
42
43
44







-







Externals/MSVCPP/*
Externals/NDoc3/*
Membership/*
Membership/obj/*
Membership/Profile/*
Membership/SiteMap/*
obj/*
Setup/set_user_*.bat
Setup/Output/*
SQLite.Designer/obj/*
SQLite.Designer/Properties/*
SQLite.Designer/VSDesign/*
System.Data.SQLite.Linq/obj/*
System.Data.SQLite/obj/*
System.Data.SQLite/Properties/*
Deleted install.ps1.
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




































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
###############################################################################
#
# install.ps1 --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

param($installPath, $toolsPath, $package, $project)

$platformNames = "x86", "x64"
$fileName = "SQLite.Interop.dll"
$propertyName = "CopyToOutputDirectory"

foreach($platformName in $platformNames) {
  $folder = $project.ProjectItems.Item($platformName)

  if ($folder -eq $null) {
    continue
  }

  $item = $folder.ProjectItems.Item($fileName)

  if ($item -eq $null) {
    continue
  }

  $property = $item.Properties.Item($propertyName)

  if ($property -eq $null) {
    continue
  }

  $property.Value = 1
}
Changes to readme.htm.
1
2
3
4
5
6
7
8
9


10
11
12
13
14
15
16
1
2
3
4
5
6
7


8
9
10
11
12
13
14
15
16







-
-
+
+







<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
</head>
<body>
ADO.NET SQLite Data Provider<br />
Version 1.0.83.0 November XX, 2012 <font color="red">(release scheduled)</font><br />
Using <a href="http://www.sqlite.org/src/info/trunk">SQLite 3.7.15</a><br />
Version 1.0.80.0 April XX, 2012 <font color="red">(release scheduled)</font><br />
Using <a href="http://www.sqlite.org/releaselog/3_7_10.html">SQLite 3.7.10</a><br />
Originally written by Robert Simpson<br />
Released to the public domain, use at your own risk!<br />
Official provider website:&nbsp;<a href="http://system.data.sqlite.org/">http://system.data.sqlite.org/</a><br />
Legacy versions:&nbsp;<a href="http://sqlite.phxsoftware.com/">http://sqlite.phxsoftware.com/</a><br />
<br />
The current development version can be downloaded from <a href="http://system.data.sqlite.org/index.html/timeline?y=ci">
http://system.data.sqlite.org/index.html/timeline?y=ci</a>
142
143
144
145
146
147
148
149

150
151
152
153
154
155
156
142
143
144
145
146
147
148

149
150
151
152
153
154
155
156







-
+







app.config file:<br />
<pre>
&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.83.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139" /&gt;
                 type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite, Version=1.0.80.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139" /&gt;
        &lt;/DbProviderFactories&gt;
    &lt;/system.data&gt;
&lt;/configuration&gt;
</pre>
<p>
See the help documentation for further details on implementing both version-specific
(GAC enabled) and version independent DBProviderFactories support.
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
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







-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+


-











-
+







it to extend its functionality, but the core engine's source is not changed.</p>
<p>
</p>

<h2><b>Version History</b></h2>

<p>
    <b>1.0.83.0 - November XX, 2012</b>
</p>
<ul>
    <li>Updated to <a href="http://www.sqlite.org/src/info/trunk">SQLite 3.7.15</a>.</li>
    <li>Add an overload of the SQLiteLog.LogMessage method that takes a single string argument.</li>
    <li>All applicable calls into the SQLite core library now return a SQLiteErrorCode instead of an integer error code.</li>
    <li>Make sure the error code of the SQLiteException class gets serialized.</li>
    <li>Make the test project for the .NET Compact Framework more flexible.</li>
    <li>When available, the new sqlite3_errstr function from the core library is used to get the error message for a specific return code.</li>
    <li>The SetMemoryStatus, Shutdown, ResultCode, ExtendedResultCode, and SetAvRetry methods of the SQLiteConnection class now return a SQLiteErrorCode instead of an integer error code.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>The public constructor for the SQLiteException now takes a SQLiteErrorCode instead of an integer error code.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>The ErrorCode field of the LogEventArgs is now an object instead of an integer.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>The names and messages associated with the SQLiteErrorCode enumeration values have been normalized to match those in the SQLite core library.&nbsp;<b>** Potentially Incompatible Change **</b></li>
</ul>
<p>
    <b>1.0.82.0 - September 3, 2012</b>
</p>
<ul>
    <li>Updated to <a href="http://www.sqlite.org/releaselog/3_7_14.html">SQLite 3.7.14</a>.</li>
    <li>Properly handle quoted data source values in the connection string. Fix for [8c3bee31c8].</li>
    <li>The <a href="http://nuget.org/packages/System.Data.SQLite">primary NuGet package</a> now supports x86 / x64 and the .NET Framework 2.0 / 4.0 (i.e. in a single package).</li>
    <li>Change the default value for the Synchronous connection string property to Full to match the default used by the SQLite core library itself.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Add the ability to skip applying default connection settings to opened databases via the new SetDefaults connection string property.</li>
    <li>Add the ability to skip expanding data source file names to their fully qualified paths via the new ToFullPath connection string property.</li>
    <li>Fix the database cleanup ordering in the tests for ticket [343d392b51].</li>
    <li>Add support for the sqlite3_close_v2 function from the SQLite core library.</li>
    <li>Add support for <a href="http://www.sqlite.org/uri.html">URI file names</a> via the new FullUri connection string property.</li>
    <li>Improve support for the standard SQLite core library in the LINQ assembly and the test suite.</li>
    <li>Add SetMemoryStatus static method to the SQLiteConnection class.</li>
    <li>Improve threaded handling of the delegate used by the SQLiteLog class.</li>
    <li>Add define constants to support enabling or disabling individual groups of trace statements.</li>
</ul>
<p>
    <b>1.0.81.0 - May 27, 2012</b>
</p>
<ul>
    <li>Updated to <a href="http://www.sqlite.org/releaselog/3_7_12_1.html">SQLite 3.7.12.1</a>.</li>
    <li>Support compiling the interop assembly without support for the custom extension functions and the CryptoAPI based codec.</li>
    <li>Add DefineConstants property to the SQLiteConnection class to return the list of define constants used when compiling the core managed assembly.</li>
    <li>Add release archive verification tool to the release automation.</li>
    <li>Fix NullReferenceException when calling the SQLiteDataAdapter.FillSchema method on a query that returns multiple result sets. Fix for [3aa50d8413].</li>
    <li>Fix subtle race condition between threads fetching connection handles from the connection pool and any garbage collection (GC) threads that may be running. Fix for [996d13cd87].</li>
    <li>Add missing call to SetTimeout in the SQLite3_UTF16.Open method.</li>
    <li>Add checks to prevent the SQLiteConnectionPool.Remove method from returning any connection handles that are closed or invalid.</li>
    <li>Modify static SQLiteBase helper methods to prevent them from passing IntPtr.Zero to the SQLite native library.</li>
    <li>Remove static locks from the static helper methods in the SQLiteBase class, replacing them with a lock on the connection handle instance being operated upon.</li>
    <li>Revise CriticalHandle derived classes to make them more thread-safe.</li>
    <li>Add connection pool related diagnostic messages when compiled with the DEBUG define constant.</li>
    <li>Add PoolCount property to the SQLiteConnection class to return the number of pool entries for the file name associated with the connection.</li>
    <li>Rename internal SQLiteLastError methods to GetLastError.</li>
    <li>Add assembly file test constraints to all tests that execute the &quot;test.exe&quot; or &quot;testlinq.exe&quot; files.</li>
</ul>
<p>
    <b>1.0.80.0 - April 1, 2012</b>
    <b>1.0.80.0 - April XX, 2012</b>
</p>
<ul>
    <li>Updated to <a href="http://www.sqlite.org/releaselog/3_7_11.html">SQLite 3.7.11</a>.</li>
    <li>In the SQLiteFunction class, when calling user-provided methods from a delegate called by native code, avoid throwing exceptions, optionally tracing the caught exceptions. Fix for [8a426d12eb].</li>
    <li>Add Visual Studio 2005 support to all the applicable solution/project files, their associated supporting files, and the test suite.</li>
    <li>Add Visual Studio 2005 support to the redesigned designer support installer.</li>
    <li>Add experimental support for &quot;pre-loading&quot; the native SQLite library based on the processor architecture of the current process.  This feature is now enabled by default at compile-time.</li>
    <li>Add support for the native <a href="http://www.sqlite.org/backup.html">SQLite Online Backup API</a>. Fix for [c71846ed57].</li>
    <li>Acquire and hold a static data lock while checking if the native SQLite library has been initialized to prevent a subtle race condition that can result in superfluous error messages. Fix for [72905c9a77].</li>
    <li>Support tracing of all parameter binding activity and use the connection flags to control what is traced.</li>
    <li>When converting a DateTime instance of an &quot;Unspecified&quot; kind to a string, use the same kind as the connection, if available.</li>
    <li>Add overload of the SQLiteDataReader.GetValues method that returns a NameValueCollection.</li>
    <li>Add static ToUnixEpoch method to the SQLiteConvert class to convert a DateTime value to the number of whole seconds since the Unix epoch.</li>
    <li>In the implicit conversion operators (to IntPtr) for both the SQLiteConnectionHandle and SQLiteStatementHandle classes, return IntPtr.Zero if the instance being converted is null.</li>
    <li>Write warning message to the active trace listeners (for the Debug build configuration only) if a column type or type name cannot be mapped properly. See [4bbf851fa5].</li>
    <li>Write warning message to the active trace listners (for the Debug build configuration only) if a column type or type name cannot be mapped properly. See [4bbf851fa5].</li>
    <li>When tracing SQL statements to be prepared, bypass the internal length limit of the sqlite3_log function by using the SQLiteLog class directly instead. Also, detect null and/or empty strings and emit a special message in that case.</li>
    <li>For the setup, the Visual Studio task should only be initially checked if the GAC task is available and vice-versa.</li>
    <li>Improve compatibility with custom command processors by using __ECHO instead of _ECHO in batch tools.</li>
    <li>Add OpenAndReturn method to the SQLiteConnection class to open a connection and return it.</li>
    <li>Add missing CheckDisposed calls to the SQLiteConnection class.</li>
    <li>Add missing throw statement to the SQLiteConnection class.</li>
    <li>Make sure the interop project uses /fp:precise for Windows CE.</li>
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
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







-
+
















-
+
+






-
+
+






-
-
-
-
-
+
+
+
+
+





-
-
+
+





-
-
+
+







    <li>Add release automation to build the source, setup, and binary packages in all supported build variants.</li>
    <li>Add the testlinq project to the new build system and make it work properly with Visual Studio 2008 and 2010.</li>
</ul>
<p>
  <b>1.0.73.0 - June 2, 2011</b>
</p>
<ul>
  <li>Updated to <a href="http://www.sqlite.org/releaselog/3_7_6_3.html">SQLite 3.7.6.3</a>.</li>
  <li>Updated to <a href="http://www.sqlite.org/releaselog/3_7_6_3.html">SQLite 3.7.6.3</a>.
  <li>Minor optimization to GetBytes(). Fix for [8c1650482e].</li>
  <li>Update various assembly information settings.</li>
  <li>Correct System.Data.SQLite.Linq version and resource information. Fix for [6489c5a396] and [133daf50d6].</li>
  <li>Moved log handler from SQLiteConnection object to SQLiteFactory object to prevent if from being prematurely GCed.</li>
  <li>We should block x64 installs on x86 and we should install native only if the setup package itself is native. Fix for [e058ce156e].</li>
</ul>
<p>
  <b>1.0.72.0 - May 1, 2011</b>
</p>
<ul>
  <li>Add the correct directory to the path. Fix for [50515a0c8e].</li>
</ul>
<p>
  <b>1.0.71.0 - April 27, 2011</b>
</p>
<ul>
  <li>Updated to SQLite 3.7.6+ <a href="http://www.sqlite.org/src/info/1bd1484cd7">[1bd1484cd7]</a> to get additional Windows error logging.</li>
  <li>Updated to SQLite 3.7.6+ <a href="http://www.sqlite.org/src/info/1bd1484cd7">[1bd1484cd7]</a>
   to get additional Windows error logging.</li>
  <li>Updated setup to optionally add install directory to PATH if GAC option selected.</li>
</ul>
<p>
  <b>1.0.70.0 - April 22, 2011</b>
</p>
<ul>
  <li>Added support for sqlite3_extended_result_codes(), sqlite3_errcode(), and sqlite3_extended_errcode() via SetExtendedResultCodes(), ResultCode(), and ExtendedResultCode().</li>
  <li>Added support for sqlite3_extended_result_codes(), sqlite3_errcode(), and sqlite3_extended_errcode()
        via SetExtendedResultCodes(), ResultCode(), and ExtendedResultCode().</li>
  <li>Added support for SQLITE_CONFIG_LOG via SQLiteLogEventHandler().</li>
</ul>
<p>
  <b>1.0.69.0 - April 12, 2011</b>
</p>
<ul>
  <li>Code merge with <a href="http://www.sqlite.org/releaselog/3_7_6.html">SQLite 3.7.6</a>.</li>
  <li>New VS2008 and VS2010 solution files.</li>
  <li>Build and packaging automation.</li>
  <li>New Inno Setup files.</li>
  <li>Designer support currently not ready for release.</li>
  <li>Code merge with <a href="http://www.sqlite.org/releaselog/3_7_6.html">SQLite 3.7.6</a></li>
  <li>New VS2008 and VS2010 solution files</li>
  <li>Build and packaging automation</li>
  <li>New Inno Setup files</li>
  <li>Designer support currently not ready for release</li>
</ul>
<p>
  <b>1.0.68.0 - February 2011</b>
</p>
<ul>
  <li>Code merge with <a href="http://www.sqlite.org/releaselog/3_7_5.html">SQLite 3.7.5</a>.</li>
  <li>Continuing work on supporting Visual Studio 2010.</li>
  <li>Code merge with <a href="http://www.sqlite.org/releaselog/3_7_5.html">SQLite 3.7.5</a></li>
  <li>Continuing work on supporting Visual Studio 2010</li>
</ul>

<p>
<b>1.0.67.0 - January 3, 2011</b></p>
<ul>
<li>Code merge with <a href="http://www.sqlite.org/releaselog/3_7_4.html">SQLite 3.7.4</a>.</li>
<li>Continuing work on supporting Visual Studio 2010.</li>
<li>Code merge with <a href="http://www.sqlite.org/releaselog/3_7_4.html">SQLite 3.7.4</a></li>
<li>Continuing work on supporting Visual Studio 2010</li>
</ul>
<p>
<b>1.0.66.1 - August 1, 2010</b></p>
<ul>
<li>Code merge with SQLite 3.7.0.1</li>
<li>Re-enabled VS2005 designer support, broken in previous versions during the 2008
transition</li>
Changes to test/AssemblyInfo.cs.
34
35
36
37
38
39
40
41
42


34
35
36
37
38
39
40


41
42







-
-
+
+
// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version 
//      Build Number
//      Revision
//
[assembly: AssemblyVersion("1.0.83.0")]
[assembly: AssemblyFileVersion("1.0.83.0")]
[assembly: AssemblyVersion("1.0.80.0")]
[assembly: AssemblyFileVersion("1.0.80.0")]
Changes to test/Program.cs.
Changes to test/Properties/Resources.Designer.cs.
Changes to test/Properties/Resources.resx.
Changes to test/TestCases.cs.
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
75
76
77
78
79
80
81

82
83
84
85
86
87
88







-








    internal void CheckSQLite()
    {
      if (_fact.GetType().Name.IndexOf("SQLite", StringComparison.OrdinalIgnoreCase) == -1)
        throw new InconclusiveException("Not a SQLite database");
    }

#if INTEROP_CODEC
    /// <summary>
    /// Tests changing password on an encrypted database.
    /// </summary>
    [Test]
    internal void ChangePasswordTest()
    {
        if (_fact.GetType().Name.IndexOf("SQLite", StringComparison.OrdinalIgnoreCase) > -1)
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
143
144
145
146
147
148
149

150
151
152
153
154
155
156







-








            // Try opening now without password
            cnn.Open();
            cnn.Close();

        }
    }
#endif

    [Test(Sequence=1)]
    internal string VersionTest()
    {
      CheckSQLite();
      string[] version = _cnn.ServerVersion.Split('.');
      if (Convert.ToInt32(version[0]) < 3
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
215
216
217
218
219
220
221

222
223
224
225
226
227
228







-







        using (DbDataReader reader = cmd.ExecuteReader())
        {
          reader.Read();
        }
      }
    }

#if USE_INTEROP_DLL && INTEROP_EXTENSION_FUNCTIONS
    [Test(Sequence = 8)]
    internal void FunctionWithCollation()
    {
      CheckSQLite();
      using (DbCommand cmd = _cnn.CreateCommand())
      {
        cmd.CommandText = "SELECT CHARINDEX('pat', 'thepat'), CHARINDEX('pat', 'THEPAT'), CHARINDEX('pat' COLLATE NOCASE, 'THEPAT' COLLATE NOCASE)";
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
246
247
248
249
250
251
252

253
254
255
256
257
258
259







-







        {
          reader.Read();
          if (reader.GetInt64(0) != reader.GetInt64(2) || reader.GetInt64(1) != 1 || reader.GetInt64(0) != 0)
            throw new Exception("CharIndex returned wrong results!");
        }
      }
    }
#endif

    [Test]
    internal void DataTypesSchema()
    {
      using (DataTable tbl = _cnn.GetSchema("DataTypes"))
      {
      }
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1196
1197
1198
1199
1200
1201
1202




1203
1204
1205
1206
1207
1208
1209







-
-
-
-







          using (DbDataAdapter adp = _fact.CreateDataAdapter())
          using (DbCommandBuilder builder = _fact.CreateCommandBuilder())
          {
            adp.SelectCommand = cmd;
            builder.DataAdapter = adp;
            builder.ConflictOption = ConflictOption.OverwriteChanges;

            //
            // NOTE: *MONO* This test fails on all recent versions of Mono (e.g.
            //       2.10, 2.11) for reasons that are presently unknown.
            //
            using (DbCommand updatecmd = builder.GetUpdateCommand())
            {
              if (updatecmd.Parameters.Count != 4)
                throw new Exception("Wrong number of parameters in update command!");
            }
          }
        }
1618
1619
1620
1621
1622
1623
1624
1625
1626


1627
1628
1629
1630
1631
1632
1633
1634
1635

1636
1637
1638
1639
1640
1641
1642
1610
1611
1612
1613
1614
1615
1616


1617
1618
1619
1620
1621
1622
1623
1624
1625
1626

1627
1628
1629
1630
1631
1632
1633
1634







-
-
+
+








-
+







        SQLiteConnection cnn = new SQLiteConnection(_cnnstring.ConnectionString);

        cnn.Open();

        // Turn on extended result codes
        cnn.SetExtendedResultCodes(true);

        SQLiteErrorCode rc = cnn.ResultCode();
        SQLiteErrorCode xrc = cnn.ExtendedResultCode();
        int rc = cnn.ResultCode();
        int xrc = cnn.ExtendedResultCode();

        cnn.Close();
      }
    }

    //Logging EventHandler
    public void OnLogEvent(object sender, LogEventArgs logEvent)
    {
        object errorCode = logEvent.ErrorCode;
        int err_code = logEvent.ErrorCode;
        string err_msg = logEvent.Message;
        logevents++;
    }

    /// <summary>
    /// Tests SQLITE_CONFIG_LOG support.
    /// </summary>
Changes to test/TestCasesDialog.Designer.cs.
Changes to test/TestCasesDialog.cs.
Changes to test/app.config.
1
2
3
4
5

6
7
8
1
2
3
4

5
6
7
8




-
+



<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.83.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139" />
      <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.80.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139" />
    </DbProviderFactories>
  </system.data>
</configuration>
Changes to testce/AssemblyInfo.cs.
34
35
36
37
38
39
40
41
42


43
34
35
36
37
38
39
40


41
42
43







-
-
+
+

// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version 
//      Build Number
//      Revision
//
[assembly: AssemblyVersion("1.0.83.0")]
// [assembly: AssemblyFileVersion("1.0.83.0")]
[assembly: AssemblyVersion("1.0.80.0")]
// [assembly: AssemblyFileVersion("1.0.80.0")]

Changes to testce/Program.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
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







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
-
-
-
-
-
-
-



-
-
-





-
-
-



-
-
-
-
+
-





-
+

-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
+
+

-
+
-
-
-
+
-
-
-
-
+
+
+
-
-
-
+
-
-

-
+
-
-
-
+
+

+
+
-
+

-
+
-




/********************************************************
 * 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!
 ********************************************************/

using System;
using System.Data.Common;
using System.Data.SQLite;
using System.IO;
using System.Reflection;
using System.Windows.Forms;

namespace test
{
  class Program
  {
    private static readonly string DefaultConnectionString =
        "Data Source={DataDirectory}\\test.db;Password=yVXL39etehPX;";

    [MTAThread]
    static void Main()
    {
      Assembly assembly = Assembly.GetExecutingAssembly();
      AssemblyName assemblyName = assembly.GetName();
      string directory = Path.GetDirectoryName(assemblyName.CodeBase);

      DbConnection cnn;
      try { File.Delete(directory + "\\test.db"); } catch { }

      SQLiteFunction.RegisterFunction(typeof(TestFunc));
      SQLiteFunction.RegisterFunction(typeof(MyCount));
      SQLiteFunction.RegisterFunction(typeof(MySequence));

      using (DbConnection cnn = new SQLiteConnection())
      try
      {
        string connectionString = DefaultConnectionString;

        try
        {
        System.IO.File.Delete("test.db3");
      }
      catch
      {
          //
          // NOTE: Attempt to open the configuration file associated with
          //       this test executable.  It should contain *EXACTLY* one
          //       line, which will be the connection string to use for
          //       this test run.
          //
          using (StreamReader streamReader = File.OpenText(
              directory + "\\test.cfg"))
          {
            connectionString = streamReader.ReadToEnd().Trim();
          }
        }
        catch
        {
      }

      //SQLiteConnection sqlite_con = new SQLiteConnection(@"data source=""|DataDirectory|donnees.db""");

      //SQLiteDataAdapter sqlite_da = new SQLiteDataAdapter();
      //DataSet dataSet = new DataSet();

          // do nothing.
        }
      //sqlite_da.SelectCommand = new SQLiteCommand("select * from donnees", sqlite_con);


        //

        // NOTE: If we are unable to obtain a valid connection string
        //       bail out now.
        //
      //sqlite_con.Open();
        if (connectionString != null)
        {
          //
          // NOTE: Replace the "{DataDirectory}" token, if any, in the

      //sqlite_da.Fill(dataSet);

          //       connection string with the actual directory this test
          //       assembly is executing from.
          //
      //sqlite_con.Close();
          connectionString = connectionString.Replace(
            "{DataDirectory}", directory);

          cnn.ConnectionString = connectionString;
      using (cnn = new SQLiteConnection())
          cnn.Open();

          TestCases tests = new TestCases();
      {
        TestCases tests = new TestCases();

        cnn.ConnectionString = "Data Source=test.db3;Password=yVXL39etehPX";
        cnn.Open();
          tests.Run(cnn);
        tests.Run(cnn);

          Application.Run(tests.frm);
        System.Windows.Forms.Application.Run(tests.frm);
        }
      }
    }
  }
}
Changes to testce/TestCases.cs.
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
75
76
77
78
79
80
81


82









83
84
85
86
87
88
89







-
-
+
-
-
-
-
-
-
-
-
-








    internal void Run(DbConnection cnn)
    {
      frm = new Form1();

      frm.Show();

      Type type = cnn.GetType();
      frm.WriteLine("\r\nBeginning Test on " + type.ToString());
      frm.WriteLine("\r\nBeginning Test on " + cnn.GetType().ToString());

      SQLiteConnection cnn2 = cnn as SQLiteConnection;
      if (cnn2 != null)
      {
          cnn2 = null;
          frm.WriteLine("SQLite v" + SQLiteConnection.SQLiteVersion +
              " [" + SQLiteConnection.SQLiteSourceId + "]");
      }

      try { CreateTable(cnn); frm.WriteLine("SUCCESS - CreateTable"); }
      catch (Exception) { frm.WriteLine("FAIL - CreateTable"); }

      try { DataTypeTest(cnn); frm.WriteLine("SUCCESS - DataType Test"); }
      catch (Exception) { frm.WriteLine("FAIL - DataType Test"); }

      try { FullTextTest(cnn); frm.WriteLine("SUCCESS - Full Text Search"); }
Deleted testce/test.cfg.
1

-
Data Source={DataDirectory}\test.db;
Changes to testce/testce.2005.csproj.
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
86
87
88
89
90
91
92





93
94
95
96
97
98
99







-
-
-
-
-







    </Compile>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="Form1.resx">
      <DependentUpon>Form1.cs</DependentUpon>
      <SubType>Designer</SubType>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <Content Include="test.cfg">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </Content>
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\System.Data.SQLite\System.Data.SQLite.Compact.2005.csproj">
      <Project>{AC139951-261A-4463-B6FA-AEBC25283A66}</Project>
      <Name>System.Data.SQLite.Compact.2005</Name>
    </ProjectReference>
  </ItemGroup>
Changes to testce/testce.2008.csproj.
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
87
88
89
90
91
92
93





94
95
96
97
98
99
100







-
-
-
-
-







    </Compile>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="Form1.resx">
      <DependentUpon>Form1.cs</DependentUpon>
      <SubType>Designer</SubType>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <Content Include="test.cfg">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </Content>
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\System.Data.SQLite\System.Data.SQLite.Compact.2008.csproj">
      <Project>{AC139951-261A-4463-B6FA-AEBC25283A66}</Project>
      <Name>System.Data.SQLite.Compact.2008</Name>
    </ProjectReference>
  </ItemGroup>
Changes to testlinq/2008/App.config.
1
2
3
4
5
6

7
8
9
10
11
12
1
2
3
4
5

6
7
8
9
10
11
12





-
+






<?xml version="1.0"?>
<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.83.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139" />
      <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.80.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139" />
    </DbProviderFactories>
  </system.data>
  <connectionStrings>
    <add name="northwindEFEntities" connectionString="metadata=res://*/NorthwindModel2008.csdl|res://*/NorthwindModel2008.ssdl|res://*/NorthwindModel2008.msl;provider=System.Data.SQLite;provider connection string=&quot;data source=.\northwindEF.db&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>
</configuration>
Changes to testlinq/2010/App.config.
1
2
3
4
5
6

7
8
9
10
11
12
1
2
3
4
5

6
7
8
9
10
11
12





-
+






<?xml version="1.0"?>
<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.83.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139" />
      <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.80.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139" />
    </DbProviderFactories>
  </system.data>
  <connectionStrings>
    <add name="northwindEFEntities" connectionString="metadata=res://*/NorthwindModel2010.csdl|res://*/NorthwindModel2010.ssdl|res://*/NorthwindModel2010.msl;provider=System.Data.SQLite;provider connection string=&quot;data source=.\northwindEF.db&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>
</configuration>
Changes to testlinq/NorthwindModel2008.Designer.cs.
Changes to testlinq/NorthwindModel2008.edmx.
Changes to testlinq/NorthwindModel2010.Designer.cs.
Changes to testlinq/NorthwindModel2010.edmx.
Changes to testlinq/Program.cs.
Changes to testlinq/Properties/AssemblyInfo.cs.
37
38
39
40
41
42
43
44
45


37
38
39
40
41
42
43


44
45







-
-
+
+
//      Minor Version 
//      Build Number
//      Revision
//
// You can specify all the values or you can default the Build and Revision Numbers 
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.83.0")]
[assembly: AssemblyFileVersion("1.0.83.0")]
[assembly: AssemblyVersion("1.0.80.0")]
[assembly: AssemblyFileVersion("1.0.80.0")]
Changes to tools/install/Properties/AssemblyInfo.cs.
24
25
26
27
28
29
30
31
32


24
25
26
27
28
29
30


31
32







-
-
+
+
// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version 
//      Build Number
//      Revision
//
[assembly: AssemblyVersion("1.0.83.0")]
[assembly: AssemblyFileVersion("1.0.83.0")]
[assembly: AssemblyVersion("1.0.80.0")]
[assembly: AssemblyFileVersion("1.0.80.0")]
Changes to www/downloads.wiki.
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
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
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







-
+

-
+




-
+

-
+












-
+

-
+





-
+


-
-
-
-
+






-
+

-
+




-
-
+
+


-
+












-
+

-
+





-
+


-
+






-
+

-
+




-
-
+
+


-
+












-
+

-
+





-
+


-
-
-
-
+






-
+

-
+




-
-
+
+


-
+












-
+

-
+





-
+


-
+






-
+

-
+




-
-
+
+


-
+












-
+

-
+




-
+



-
+






-
+

-
+




-
+


-
+












-
+

-
+




-
+



-
+






-
+

-
+




-
+


-
+












-
+

-
+




-
+



-
+






-
+

-
+




-
+


-
+












-
+

-
+




-
+



-
+






-
+

-
+




-
+


-
+












-
+

-
+




-
+



-
+






-
+

-
+




-
+



-
+












-
+

-
+




-
+



-
+






-
+

-
+




-
+



-
+












-
+

-
+




-
+



-
+






-
+

-
+




-
+


-
+












-
+

-
+




-
+



-
+






-
+

-
+




-
+


-
+












-
+

-
+




-
+


-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-



















-
-
+
+







      <b>Source Code</b>
    </td>
  </tr>

  <tr>
    <td width="10">&nbsp;</td>
    <td width="30%" valign="top" align="right">
      <a href="/downloads/1.0.82.0/sqlite-netFx-source-1.0.82.0.zip">sqlite-netFx-source-1.0.82.0.zip</a>
      <a href="/downloads/1.0.79.0/sqlite-netFx-source-1.0.79.0.zip">sqlite-netFx-source-1.0.79.0.zip</a>
      <br />
      (2.74 MiB)
      (2.62 MiB)
    </td>
    <td width="5"></td>
    <td valign="top">
      This ZIP archive contains all current source code for System.Data.SQLite
      1.0.82.0 (3.7.14) combined into a single archive file.
      1.0.79.0 (3.7.10) combined into a single archive file.
      <br />
      (sha1: accec84da4a59815078e494afd398eb1b3c64898)
      (sha1: 634b93112cd3bd093933760944aa3bf8740a455a)
    </td>
  </tr>

  <tr>
    <td colspan="4">
      <b>Setups for 32-bit Windows (.NET Framework 3.5 SP1)</b>
    </td>
  </tr>

  <tr>
    <td width="10">&nbsp;</td>
    <td width="30%" valign="top" align="right">
      <a href="/downloads/1.0.82.0/sqlite-netFx35-setup-bundle-x86-2008-1.0.82.0.exe">sqlite-netFx35-setup-bundle-x86-2008-1.0.82.0.exe</a>
      <a href="/downloads/1.0.79.0/sqlite-netFx35-setup-bundle-x86-2008-1.0.79.0.exe">sqlite-netFx35-setup-bundle-x86-2008-1.0.79.0.exe</a>
      <br />
      (6.07 MiB)
      (6.02 MiB)
    </td>
    <td width="5"></td>
    <td valign="top">
      This setup package features the mixed-mode assembly and will install all
      the necessary runtime components and dependencies for the x86 version of
      the System.Data.SQLite 1.0.82.0 (3.7.14) package.  The Visual C++ 2008
      the System.Data.SQLite 1.0.79.0 (3.7.10) package.  The Visual C++ 2008
      SP1 runtime for x86 is included.  The .NET Framework 3.5 SP1 is required.
      <br />
      <big><b>This setup package is capable of installing the design-time
      components for Visual Studio 2005 and/or Visual Studio 2008.</b></big>
      <br />
      (sha1: e38165e4f45e4338d81f2da10050826406aa09b8)
      (sha1: 5a6de51b4d2c06629b7070c2c147f6a6eb8ce043)
    </td>
  </tr>

  <tr>
    <td width="10">&nbsp;</td>
    <td width="30%" valign="top" align="right">
      <a href="/downloads/1.0.82.0/sqlite-netFx35-setup-x86-2008-1.0.82.0.exe">sqlite-netFx35-setup-x86-2008-1.0.82.0.exe</a>
      <a href="/downloads/1.0.79.0/sqlite-netFx35-setup-x86-2008-1.0.79.0.exe">sqlite-netFx35-setup-x86-2008-1.0.79.0.exe</a>
      <br />
      (6.06 MiB)
      (6.02 MiB)
    </td>
    <td width="5"></td>
    <td valign="top">
      This setup package will install all the necessary runtime components and
      dependencies for the x86 version of the System.Data.SQLite 1.0.82.0
      (3.7.14) package.  The Visual C++ 2008 SP1 runtime for x86 is included.
      dependencies for the x86 version of the System.Data.SQLite 1.0.79.0
      (3.7.10) package.  The Visual C++ 2008 SP1 runtime for x86 is included.
      The .NET Framework 3.5 SP1 is required.
      <br />
      (sha1: aed2059188e2ab66a341ce5167b2316c751fdbb1)
      (sha1: 2208f5903ed522aa6b5718fcce5f22b528c62640)
    </td>
  </tr>

  <tr>
    <td colspan="4">
      <b>Setups for 64-bit Windows (.NET Framework 3.5 SP1)</b>
    </td>
  </tr>

  <tr>
    <td width="10">&nbsp;</td>
    <td width="30%" valign="top" align="right">
      <a href="/downloads/1.0.82.0/sqlite-netFx35-setup-bundle-x64-2008-1.0.82.0.exe">sqlite-netFx35-setup-bundle-x64-2008-1.0.82.0.exe</a>
      <a href="/downloads/1.0.79.0/sqlite-netFx35-setup-bundle-x64-2008-1.0.79.0.exe">sqlite-netFx35-setup-bundle-x64-2008-1.0.79.0.exe</a>
      <br />
      (6.81 MiB)
      (6.76 MiB)
    </td>
    <td width="5"></td>
    <td valign="top">
      This setup package features the mixed-mode assembly and will install all
      the necessary runtime components and dependencies for the x64 version of
      the System.Data.SQLite 1.0.82.0 (3.7.14) package.  The Visual C++ 2008
      the System.Data.SQLite 1.0.79.0 (3.7.10) package.  The Visual C++ 2008
      SP1 runtime for x64 is included.  The .NET Framework 3.5 SP1 is required.
      <br />
      (sha1: aa0f1f958f9febf466807d79f03fae31508993dd)
      (sha1: 3b5febbc8915fd353ce9cbf28228635edf78d8c4)
    </td>
  </tr>

  <tr>
    <td width="10">&nbsp;</td>
    <td width="30%" valign="top" align="right">
      <a href="/downloads/1.0.82.0/sqlite-netFx35-setup-x64-2008-1.0.82.0.exe">sqlite-netFx35-setup-x64-2008-1.0.82.0.exe</a>
      <a href="/downloads/1.0.79.0/sqlite-netFx35-setup-x64-2008-1.0.79.0.exe">sqlite-netFx35-setup-x64-2008-1.0.79.0.exe</a>
      <br />
      (6.80 MiB)
      (6.75 MiB)
    </td>
    <td width="5"></td>
    <td valign="top">
      This setup package will install all the necessary runtime components and
      dependencies for the x64 version of the System.Data.SQLite 1.0.82.0
      (3.7.14) package.  The Visual C++ 2008 SP1 runtime for x64 is included.
      dependencies for the x64 version of the System.Data.SQLite 1.0.79.0
      (3.7.10) package.  The Visual C++ 2008 SP1 runtime for x64 is included.
      The .NET Framework 3.5 SP1 is required.
      <br />
      (sha1: b5fa5e9c3477a44724356816488ca3fa15a11d4b)
      (sha1: e0845f081c19edb6c27878e33bc9e4c2f166220e)
    </td>
  </tr>

  <tr>
    <td colspan="4">
      <b>Setups for 32-bit Windows (.NET Framework 4.0)</b>
    </td>
  </tr>

  <tr>
    <td width="10">&nbsp;</td>
    <td width="30%" valign="top" align="right">
      <a href="/downloads/1.0.82.0/sqlite-netFx40-setup-bundle-x86-2010-1.0.82.0.exe">sqlite-netFx40-setup-bundle-x86-2010-1.0.82.0.exe</a>
      <a href="/downloads/1.0.79.0/sqlite-netFx40-setup-bundle-x86-2010-1.0.79.0.exe">sqlite-netFx40-setup-bundle-x86-2010-1.0.79.0.exe</a>
      <br />
      (10.40 MiB)
      (10.35 MiB)
    </td>
    <td width="5"></td>
    <td valign="top">
      This setup package features the mixed-mode assembly and will install all
      the necessary runtime components and dependencies for the x86 version of
      the System.Data.SQLite 1.0.82.0 (3.7.14) package.  The Visual C++ 2010
      the System.Data.SQLite 1.0.79.0 (3.7.10) package.  The Visual C++ 2010
      SP1 runtime for x86 is included.  The .NET Framework 4.0 is required.
      <br />
      <big><b>This setup package is capable of installing the design-time
      components for Visual Studio 2010.</b></big>
      <br />
      (sha1: bf3defd3b4250e1aa94ea06e10c4b369416d0e2a)
      (sha1: 2f6f2b9d507a7c751b638f76a1e3b25bc2322b76)
    </td>
  </tr>

  <tr>
    <td width="10">&nbsp;</td>
    <td width="30%" valign="top" align="right">
      <a href="/downloads/1.0.82.0/sqlite-netFx40-setup-x86-2010-1.0.82.0.exe">sqlite-netFx40-setup-x86-2010-1.0.82.0.exe</a>
      <a href="/downloads/1.0.79.0/sqlite-netFx40-setup-x86-2010-1.0.79.0.exe">sqlite-netFx40-setup-x86-2010-1.0.79.0.exe</a>
      <br />
      (10.39 MiB)
      (10.34 MiB)
    </td>
    <td width="5"></td>
    <td valign="top">
      This setup package will install all the necessary runtime components and
      dependencies for the x86 version of the System.Data.SQLite 1.0.82.0
      (3.7.14) package.  The Visual C++ 2010 SP1 runtime for x86 is included.
      dependencies for the x86 version of the System.Data.SQLite 1.0.79.0
      (3.7.10) package.  The Visual C++ 2010 SP1 runtime for x86 is included.
      The .NET Framework 4.0 is required.
      <br />
      (sha1: 8435fe9fd02655d3df95991e68391d487f6a8776)
      (sha1: b60fb8a586118182a3bee8dcbf77433ca651feec)
    </td>
  </tr>

  <tr>
    <td colspan="4">
      <b>Setups for 64-bit Windows (.NET Framework 4.0)</b>
    </td>
  </tr>

  <tr>
    <td width="10">&nbsp;</td>
    <td width="30%" valign="top" align="right">
      <a href="/downloads/1.0.82.0/sqlite-netFx40-setup-bundle-x64-2010-1.0.82.0.exe">sqlite-netFx40-setup-bundle-x64-2010-1.0.82.0.exe</a>
      <a href="/downloads/1.0.79.0/sqlite-netFx40-setup-bundle-x64-2010-1.0.79.0.exe">sqlite-netFx40-setup-bundle-x64-2010-1.0.79.0.exe</a>
      <br />
      (11.65 MiB)
      (11.60 MiB)
    </td>
    <td width="5"></td>
    <td valign="top">
      This setup package features the mixed-mode assembly and will install all
      the necessary runtime components and dependencies for the x64 version of
      the System.Data.SQLite 1.0.82.0 (3.7.14) package.  The Visual C++ 2010
      the System.Data.SQLite 1.0.79.0 (3.7.10) package.  The Visual C++ 2010
      SP1 runtime for x64 is included.  The .NET Framework 4.0 is required.
      <br />
      (sha1: a7fcc7d410df97817eabbbc6f01e1e448f898aab)
      (sha1: 48ad9c2d7413cbdd80ff53597601e65e572d3369)
    </td>
  </tr>

  <tr>
    <td width="10">&nbsp;</td>
    <td width="30%" valign="top" align="right">
      <a href="/downloads/1.0.82.0/sqlite-netFx40-setup-x64-2010-1.0.82.0.exe">sqlite-netFx40-setup-x64-2010-1.0.82.0.exe</a>
      <a href="/downloads/1.0.79.0/sqlite-netFx40-setup-x64-2010-1.0.79.0.exe">sqlite-netFx40-setup-x64-2010-1.0.79.0.exe</a>
      <br />
      (11.64 MiB)
      (11.59 MiB)
    </td>
    <td width="5"></td>
    <td valign="top">
      This setup package will install all the necessary runtime components and
      dependencies for the x64 version of the System.Data.SQLite 1.0.82.0
      (3.7.14) package.  The Visual C++ 2010 SP1 runtime for x64 is included.
      dependencies for the x64 version of the System.Data.SQLite 1.0.79.0
      (3.7.10) package.  The Visual C++ 2010 SP1 runtime for x64 is included.
      The .NET Framework 4.0 is required.
      <br />
      (sha1: 0c3d227a1b3c0f3aae1a0b687f17dba18bed6eeb)
      (sha1: 4a8abad785ff31495e8fb137ec7fa4d9dca14062)
    </td>
  </tr>

  <tr>
    <td colspan="4">
      <b>Precompiled Binaries for 32-bit Windows (.NET Framework 3.5 SP1)</b>
    </td>
  </tr>

  <tr>
    <td width="10">&nbsp;</td>
    <td width="30%" valign="top" align="right">
      <a href="/downloads/1.0.82.0/sqlite-netFx35-binary-bundle-Win32-2008-1.0.82.0.zip">sqlite-netFx35-binary-bundle-Win32-2008-1.0.82.0.zip</a>
      <a href="/downloads/1.0.79.0/sqlite-netFx35-binary-bundle-Win32-2008-1.0.79.0.zip">sqlite-netFx35-binary-bundle-Win32-2008-1.0.79.0.zip</a>
      <br />
      (1.66 MiB)
      (1.61 MiB)
    </td>
    <td width="5"></td>
    <td valign="top">
      This binary package features the mixed-mode assembly and contains all the
      binaries for the x86 version of the System.Data.SQLite 1.0.82.0 (3.7.14)
      binaries for the x86 version of the System.Data.SQLite 1.0.79.0 (3.7.10)
      package.  The Visual C++ 2008 SP1 runtime for x86 and the .NET Framework
      3.5 SP1 are required.
      <br />
      (sha1: cf6ec0622af7a16c5cf32c02d41a29060b91ec79)
      (sha1: 28bb5a9d453571060c608ccc158819d6c51e52af)
    </td>
  </tr>

  <tr>
    <td width="10">&nbsp;</td>
    <td width="30%" valign="top" align="right">
      <a href="/downloads/1.0.82.0/sqlite-netFx35-binary-Win32-2008-1.0.82.0.zip">sqlite-netFx35-binary-Win32-2008-1.0.82.0.zip</a>
      <a href="/downloads/1.0.79.0/sqlite-netFx35-binary-Win32-2008-1.0.79.0.zip">sqlite-netFx35-binary-Win32-2008-1.0.79.0.zip</a>
      <br />
      (1.65 MiB)
      (1.60 MiB)
    </td>
    <td width="5"></td>
    <td valign="top">
      This binary package contains all the binaries for the x86 version of the
      System.Data.SQLite 1.0.82.0 (3.7.14) package.  The Visual C++ 2008 SP1
      System.Data.SQLite 1.0.79.0 (3.7.10) package.  The Visual C++ 2008 SP1
      runtime for x86 and the .NET Framework 3.5 SP1 are required.
      <br />
      (sha1: 5e4724570d0a9e49450d2c0aac0601db4bebed11)
      (sha1: ba5309ecd3d68de8e1c6d64c0c5e1ee8521c5892)
    </td>
  </tr>

  <tr>
    <td colspan="4">
      <b>Precompiled Binaries for 64-bit Windows (.NET Framework 3.5 SP1)</b>
    </td>
  </tr>

  <tr>
    <td width="10">&nbsp;</td>
    <td width="30%" valign="top" align="right">
      <a href="/downloads/1.0.82.0/sqlite-netFx35-binary-bundle-x64-2008-1.0.82.0.zip">sqlite-netFx35-binary-bundle-x64-2008-1.0.82.0.zip</a>
      <a href="/downloads/1.0.79.0/sqlite-netFx35-binary-bundle-x64-2008-1.0.79.0.zip">sqlite-netFx35-binary-bundle-x64-2008-1.0.79.0.zip</a>
      <br />
      (1.73 MiB)
      (1.67 MiB)
    </td>
    <td width="5"></td>
    <td valign="top">
      This binary package features the mixed-mode assembly and contains all the
      binaries for the x64 version of the System.Data.SQLite 1.0.82.0 (3.7.14)
      binaries for the x64 version of the System.Data.SQLite 1.0.79.0 (3.7.10)
      package.  The Visual C++ 2008 SP1 runtime for x64 and the .NET Framework
      3.5 SP1 are required.
      <br />
      (sha1: 15b5625a7f5fa1a4a74c61c0c46e3969d2c6adc2)
      (sha1: e5d595ca4d0af4a8a79866cd0899d783d3c2955f)
    </td>
  </tr>

  <tr>
    <td width="10">&nbsp;</td>
    <td width="30%" valign="top" align="right">
      <a href="/downloads/1.0.82.0/sqlite-netFx35-binary-x64-2008-1.0.82.0.zip">sqlite-netFx35-binary-x64-2008-1.0.82.0.zip</a>
      <a href="/downloads/1.0.79.0/sqlite-netFx35-binary-x64-2008-1.0.79.0.zip">sqlite-netFx35-binary-x64-2008-1.0.79.0.zip</a>
      <br />
      (1.72 MiB)
      (1.67 MiB)
    </td>
    <td width="5"></td>
    <td valign="top">
      This binary package contains all the binaries for the x64 version of the
      System.Data.SQLite 1.0.82.0 (3.7.14) package.  The Visual C++ 2008 SP1
      System.Data.SQLite 1.0.79.0 (3.7.10) package.  The Visual C++ 2008 SP1
      runtime for x64 and the .NET Framework 3.5 SP1 are required.
      <br />
      (sha1: 25abc0ea78f8f45b93c9c2fc1381c2acd863638d)
      (sha1: da7a355d19b7649cd8804fff1b83397f29cef15a)
    </td>
  </tr>

  <tr>
    <td colspan="4">
      <b>Precompiled Binaries for 32-bit Windows (.NET Framework 4.0)</b>
    </td>
  </tr>

  <tr>
    <td width="10">&nbsp;</td>
    <td width="30%" valign="top" align="right">
      <a href="/downloads/1.0.82.0/sqlite-netFx40-binary-bundle-Win32-2010-1.0.82.0.zip">sqlite-netFx40-binary-bundle-Win32-2010-1.0.82.0.zip</a>
      <a href="/downloads/1.0.79.0/sqlite-netFx40-binary-bundle-Win32-2010-1.0.79.0.zip">sqlite-netFx40-binary-bundle-Win32-2010-1.0.79.0.zip</a>
      <br />
      (1.71 MiB)
      (1.65 MiB)
    </td>
    <td width="5"></td>
    <td valign="top">
      This binary package features the mixed-mode assembly and contains all the
      binaries for the x86 version of the System.Data.SQLite 1.0.82.0 (3.7.14)
      binaries for the x86 version of the System.Data.SQLite 1.0.79.0 (3.7.10)
      package.  The Visual C++ 2010 SP1 runtime for x86 and the .NET Framework
      4.0 are required.
      <br />
      (sha1: 6f6cdfddb08f254b744e7088b4825db02bec73da)
      (sha1: c6076691c1ab4f98f363afe980e3c19b3e143557)
    </td>
  </tr>

  <tr>
    <td width="10">&nbsp;</td>
    <td width="30%" valign="top" align="right">
      <a href="/downloads/1.0.82.0/sqlite-netFx40-binary-Win32-2010-1.0.82.0.zip">sqlite-netFx40-binary-Win32-2010-1.0.82.0.zip</a>
      <a href="/downloads/1.0.79.0/sqlite-netFx40-binary-Win32-2010-1.0.79.0.zip">sqlite-netFx40-binary-Win32-2010-1.0.79.0.zip</a>
      <br />
      (1.70 MiB)
      (1.64 MiB)
    </td>
    <td width="5"></td>
    <td valign="top">
      This binary package contains all the binaries for the x86 version of the
      System.Data.SQLite 1.0.82.0 (3.7.14) package.  The Visual C++ 2010 SP1
      System.Data.SQLite 1.0.79.0 (3.7.10) package.  The Visual C++ 2010 SP1
      runtime for x86 and the .NET Framework 4.0 are required.
      <br />
      (sha1: 12ffe8323fcf5af25ef6e6effb4f52300df819ee)
      (sha1: 779f3857ec43f6d67f0744363d090114236aa4aa)
    </td>
  </tr>

  <tr>
    <td colspan="4">
      <b>Precompiled Binaries for 64-bit Windows (.NET Framework 4.0)</b>
    </td>
  </tr>

  <tr>
    <td width="10">&nbsp;</td>
    <td width="30%" valign="top" align="right">
      <a href="/downloads/1.0.82.0/sqlite-netFx40-binary-bundle-x64-2010-1.0.82.0.zip">sqlite-netFx40-binary-bundle-x64-2010-1.0.82.0.zip</a>
      <a href="/downloads/1.0.79.0/sqlite-netFx40-binary-bundle-x64-2010-1.0.79.0.zip">sqlite-netFx40-binary-bundle-x64-2010-1.0.79.0.zip</a>
      <br />
      (1.73 MiB)
      (1.68 MiB)
    </td>
    <td width="5"></td>
    <td valign="top">
      This binary package features the mixed-mode assembly and contains all the
      binaries for the x64 version of the System.Data.SQLite 1.0.82.0 (3.7.14)
      binaries for the x64 version of the System.Data.SQLite 1.0.79.0 (3.7.10)
      package.  The Visual C++ 2010 SP1 runtime for x64 and the .NET Framework
      4.0 are required.
      <br />
      (sha1: e1b79aa7763853a68068f43c9edb6382a2c67550)
      (sha1: da37bb787291e6b9d14f2f80bfe85539d9ff2864)
    </td>
  </tr>

  <tr>
    <td width="10">&nbsp;</td>
    <td width="30%" valign="top" align="right">
      <a href="/downloads/1.0.82.0/sqlite-netFx40-binary-x64-2010-1.0.82.0.zip">sqlite-netFx40-binary-x64-2010-1.0.82.0.zip</a>
      <a href="/downloads/1.0.79.0/sqlite-netFx40-binary-x64-2010-1.0.79.0.zip">sqlite-netFx40-binary-x64-2010-1.0.79.0.zip</a>
      <br />
      (1.72 MiB)
      (1.67 MiB)
    </td>
    <td width="5"></td>
    <td valign="top">
      This binary package contains all the binaries for the x64 version of the
      System.Data.SQLite 1.0.82.0 (3.7.14) package.  The Visual C++ 2010 SP1
      System.Data.SQLite 1.0.79.0 (3.7.10) package.  The Visual C++ 2010 SP1
      runtime for x64 and the .NET Framework 4.0 are required.
      <br />
      (sha1: a91739243166b9ae27be244722acd480d1ce4537)
      (sha1: e24444efe5ff214bf9a82a1ce0056193cea2d1c0)
    </td>
  </tr>

  <tr>
    <td colspan="4">
      <b>Precompiled Statically-Linked Binaries for 32-bit Windows (.NET Framework 3.5 SP1)</b>
    </td>
  </tr>

  <tr>
    <td width="10">&nbsp;</td>
    <td width="30%" valign="top" align="right">
      <a href="/downloads/1.0.82.0/sqlite-netFx35-static-binary-bundle-Win32-2008-1.0.82.0.zip">sqlite-netFx35-static-binary-bundle-Win32-2008-1.0.82.0.zip</a>
      <a href="/downloads/1.0.79.0/sqlite-netFx35-static-binary-bundle-Win32-2008-1.0.79.0.zip">sqlite-netFx35-static-binary-bundle-Win32-2008-1.0.79.0.zip</a>
      <br />
      (1.87 MiB)
      (1.82 MiB)
    </td>
    <td width="5"></td>
    <td valign="top">
      This binary package features the mixed-mode assembly and contains all the
      binaries for the x86 version of the System.Data.SQLite 1.0.82.0 (3.7.14)
      binaries for the x86 version of the System.Data.SQLite 1.0.79.0 (3.7.10)
      package.  The Visual C++ 2008 SP1 runtime for x86 is statically linked.
      The .NET Framework 3.5 SP1 is required.
      <br />
      (sha1: 43076280a7ee02b1574bb666d3a14c185d6fe84a)
      (sha1: 3b86995edf96216f496ee9800cb7c6a9ae435f8f)
    </td>
  </tr>

  <tr>
    <td width="10">&nbsp;</td>
    <td width="30%" valign="top" align="right">
      <a href="/downloads/1.0.82.0/sqlite-netFx35-static-binary-Win32-2008-1.0.82.0.zip">sqlite-netFx35-static-binary-Win32-2008-1.0.82.0.zip</a>
      <a href="/downloads/1.0.79.0/sqlite-netFx35-static-binary-Win32-2008-1.0.79.0.zip">sqlite-netFx35-static-binary-Win32-2008-1.0.79.0.zip</a>
      <br />
      (1.86 MiB)
      (1.82 MiB)
    </td>
    <td width="5"></td>
    <td valign="top">
      This binary package contains all the binaries for the x86 version of the
      System.Data.SQLite 1.0.82.0 (3.7.14) package.  The Visual C++ 2008 SP1
      System.Data.SQLite 1.0.79.0 (3.7.10) package.  The Visual C++ 2008 SP1
      runtime for x86 is statically linked.  The .NET Framework 3.5 SP1 is
      required.
      <br />
      (sha1: 44f8225d4025d2014ded056b31a2b1a5a8de07cc)
      (sha1: b450fdfe98591c2ba590207cdb802a552c57f4a6)
    </td>
  </tr>

  <tr>
    <td colspan="4">
      <b>Precompiled Statically-Linked Binaries for 64-bit Windows (.NET Framework 3.5 SP1)</b>
    </td>
  </tr>

  <tr>
    <td width="10">&nbsp;</td>
    <td width="30%" valign="top" align="right">
      <a href="/downloads/1.0.82.0/sqlite-netFx35-static-binary-bundle-x64-2008-1.0.82.0.zip">sqlite-netFx35-static-binary-bundle-x64-2008-1.0.82.0.zip</a>
      <a href="/downloads/1.0.79.0/sqlite-netFx35-static-binary-bundle-x64-2008-1.0.79.0.zip">sqlite-netFx35-static-binary-bundle-x64-2008-1.0.79.0.zip</a>
      <br />
      (1.90 MiB)
      (1.85 MiB)
    </td>
    <td width="5"></td>
    <td valign="top">
      This binary package features the mixed-mode assembly and contains all the
      binaries for the x64 version of the System.Data.SQLite 1.0.82.0 (3.7.14)
      binaries for the x64 version of the System.Data.SQLite 1.0.79.0 (3.7.10)
      package.  The Visual C++ 2008 SP1 runtime for x64 is statically linked.
      The .NET Framework 3.5 SP1 is required.
      <br />
      (sha1: 1e29c539c75e106ddbdd18c83563fc0b9df7c1bf)
      (sha1: e0d696f9f18a1993b796d3572372c84fee543300)
    </td>
  </tr>

  <tr>
    <td width="10">&nbsp;</td>
    <td width="30%" valign="top" align="right">
      <a href="/downloads/1.0.82.0/sqlite-netFx35-static-binary-x64-2008-1.0.82.0.zip">sqlite-netFx35-static-binary-x64-2008-1.0.82.0.zip</a>
      <a href="/downloads/1.0.79.0/sqlite-netFx35-static-binary-x64-2008-1.0.79.0.zip">sqlite-netFx35-static-binary-x64-2008-1.0.79.0.zip</a>
      <br />
      (1.90 MiB)
      (1.84 MiB)
    </td>
    <td width="5"></td>
    <td valign="top">
      This binary package contains all the binaries for the x64 version of the
      System.Data.SQLite 1.0.82.0 (3.7.14) package.  The Visual C++ 2008 SP1
      System.Data.SQLite 1.0.79.0 (3.7.10) package.  The Visual C++ 2008 SP1
      runtime for x64 is statically linked.  The .NET Framework 3.5 SP1 is
      required.
      <br />
      (sha1: f10532c9c858465852d179dc88ea6c519212234f)
      (sha1: 032185157560dc169036f58d9f2975471548cfd9)
    </td>
  </tr>

  <tr>
    <td colspan="4">
      <b>Precompiled Statically-Linked Binaries for 32-bit Windows (.NET Framework 4.0)</b>
    </td>
  </tr>

  <tr>
    <td width="10">&nbsp;</td>
    <td width="30%" valign="top" align="right">
      <a href="/downloads/1.0.82.0/sqlite-netFx40-static-binary-bundle-Win32-2010-1.0.82.0.zip">sqlite-netFx40-static-binary-bundle-Win32-2010-1.0.82.0.zip</a>
      <a href="/downloads/1.0.79.0/sqlite-netFx40-static-binary-bundle-Win32-2010-1.0.79.0.zip">sqlite-netFx40-static-binary-bundle-Win32-2010-1.0.79.0.zip</a>
      <br />
      (1.92 MiB)
      (1.87 MiB)
    </td>
    <td width="5"></td>
    <td valign="top">
      This binary package features the mixed-mode assembly and contains all the
      binaries for the x86 version of the System.Data.SQLite 1.0.82.0 (3.7.14)
      binaries for the x86 version of the System.Data.SQLite 1.0.79.0 (3.7.10)
      package.  The Visual C++ 2010 SP1 runtime for x86 is statically linked.
      The .NET Framework 4.0 is required.
      <br />
      (sha1: 335da5c15d56b868f948dbf842ad97c94c5c148c)
      (sha1: 04e6b299f802de1520ccbfafc4a67ce1862e2fc3)
    </td>
  </tr>

  <tr>
    <td width="10">&nbsp;</td>
    <td width="30%" valign="top" align="right">
      <a href="/downloads/1.0.82.0/sqlite-netFx40-static-binary-Win32-2010-1.0.82.0.zip">sqlite-netFx40-static-binary-Win32-2010-1.0.82.0.zip</a>
      <a href="/downloads/1.0.79.0/sqlite-netFx40-static-binary-Win32-2010-1.0.79.0.zip">sqlite-netFx40-static-binary-Win32-2010-1.0.79.0.zip</a>
      <br />
      (1.91 MiB)
      (1.86 MiB)
    </td>
    <td width="5"></td>
    <td valign="top">
      This binary package contains all the binaries for the x86 version of the
      System.Data.SQLite 1.0.82.0 (3.7.14) package.  The Visual C++ 2010 SP1
      System.Data.SQLite 1.0.79.0 (3.7.10) package.  The Visual C++ 2010 SP1
      runtime for x86 is statically linked.  The .NET Framework 4.0 is required.
      <br />
      (sha1: 22d21e6b97b9b79cd51528fda938e3d601eb1ae4)
      (sha1: 2b76be35643b92128f67b2b02c8b4d0ef78aa7da)
    </td>
  </tr>

  <tr>
    <td colspan="4">
      <b>Precompiled Statically-Linked Binaries for 64-bit Windows (.NET Framework 4.0)</b>
    </td>
  </tr>

  <tr>
    <td width="10">&nbsp;</td>
    <td width="30%" valign="top" align="right">
      <a href="/downloads/1.0.82.0/sqlite-netFx40-static-binary-bundle-x64-2010-1.0.82.0.zip">sqlite-netFx40-static-binary-bundle-x64-2010-1.0.82.0.zip</a>
      <a href="/downloads/1.0.79.0/sqlite-netFx40-static-binary-bundle-x64-2010-1.0.79.0.zip">sqlite-netFx40-static-binary-bundle-x64-2010-1.0.79.0.zip</a>
      <br />
      (1.92 MiB)
      (1.87 MiB)
    </td>
    <td width="5"></td>
    <td valign="top">
      This binary package features the mixed-mode assembly and contains all the
      binaries for the x64 version of the System.Data.SQLite 1.0.82.0 (3.7.14)
      binaries for the x64 version of the System.Data.SQLite 1.0.79.0 (3.7.10)
      package.  The Visual C++ 2010 SP1 runtime for x64 is statically linked.
      The .NET Framework 4.0 is required.
      <br />
      (sha1: 929f1d2a0eb9bb697c4e8725bedef1f4042c076b)
      (sha1: f4d904accd7412f0980b2bcac9576a3af4c63930)
    </td>
  </tr>

  <tr>
    <td width="10">&nbsp;</td>
    <td width="30%" valign="top" align="right">
      <a href="/downloads/1.0.82.0/sqlite-netFx40-static-binary-x64-2010-1.0.82.0.zip">sqlite-netFx40-static-binary-x64-2010-1.0.82.0.zip</a>
      <a href="/downloads/1.0.79.0/sqlite-netFx40-static-binary-x64-2010-1.0.79.0.zip">sqlite-netFx40-static-binary-x64-2010-1.0.79.0.zip</a>
      <br />
      (1.92 MiB)
      (1.86 MiB)
    </td>
    <td width="5"></td>
    <td valign="top">
      This binary package contains all the binaries for the x64 version of the
      System.Data.SQLite 1.0.82.0 (3.7.14) package.  The Visual C++ 2010 SP1
      System.Data.SQLite 1.0.79.0 (3.7.10) package.  The Visual C++ 2010 SP1
      runtime for x64 is statically linked.  The .NET Framework 4.0 is required.
      <br />
      (sha1: 4c12b0ad3aae3510bd573e49a6159f6a3405d312)
      (sha1: a04f7718eb947d40f1201ac8bee3433a38dd6d08)
    </td>
  </tr>

  <tr>
    <td colspan="4">
      <b>Precompiled Binaries for Windows CE (.NET Compact Framework 3.5)</b>
    </td>
  </tr>

  <tr>
    <td width="10">&nbsp;</td>
    <td width="30%" valign="top" align="right">
      <a href="/downloads/1.0.82.0/sqlite-netFx35-binary-PocketPC-2008-1.0.82.0.zip">sqlite-netFx35-binary-PocketPC-2008-1.0.82.0.zip</a>
      <a href="/downloads/1.0.79.0/sqlite-netFx35-binary-PocketPC-2008-1.0.79.0.zip">sqlite-netFx35-binary-PocketPC-2008-1.0.79.0.zip</a>
      <br />
      (0.85 MiB)
      (0.81 MiB)
    </td>
    <td width="5"></td>
    <td valign="top">
      This binary package contains all the binaries for the PocketPC version of
      the System.Data.SQLite 1.0.82.0 (3.7.14) package.  The .NET Compact
      the System.Data.SQLite 1.0.79.0 (3.7.10) package.  The .NET Compact
      Framework 3.5 is required.
      <br />
      (sha1: f9b2393dde3ad5d2f507ebad26d2b81ea7544b70)
    </td>
  </tr>

      (sha1: 8b0517a3468099bcdeb8bdb6de1395c4b5dfae43)
  <tr>
    <td colspan="4">
      <b>Official NuGet Packages</b>
    </td>
  </tr>

  <tr>
    <td width="10">&nbsp;</td>
    <td width="30%" valign="top" align="right">
      <a href="http://nuget.org/api/v2/package/System.Data.SQLite/1.0.82.0">System.Data.SQLite.1.0.82.0.nupkg</a>
      <br />
      (2.85 MiB)
    </td>
    <td width="5"></td>
    <td valign="top">
      This NuGet package contains all the binaries for both the x86 and x64
      versions of System.Data.SQLite 1.0.82.0 (3.7.14).  The .NET Framework
      3.5 SP1 or 4.0 is required.  For the included native binaries, the version
      of the Visual C++ runtime corresponding to the .NET Framework used by the
      associated managed assembly is statically linked.
      <br />
      (sha1: 00192e51c6dda124d809c517125c99e46f7de620)
    </td>
  </tr>

  <tr>
    <td width="10">&nbsp;</td>
    <td width="30%" valign="top" align="right">
      <a href="http://nuget.org/api/v2/package/System.Data.SQLite.MSIL/1.0.82.0">System.Data.SQLite.MSIL.1.0.82.0.nupkg</a>
      <br />
      (0.26 MiB)
    </td>
    <td width="5"></td>
    <td valign="top">
      This NuGet package contains the managed binaries for System.Data.SQLite
      1.0.82.0.  The .NET Framework 3.5 SP1 or 4.0 is required.
      <br />
      <big><b>This NuGet package does not include any code from the native
      SQLite core library and will not work properly without the native assembly
      &quot;SQLite.Interop.dll&quot; compiled for the processor architecture of
      the host process being present in a directory in the native library search
      path.</b></big>
      <br />
      (sha1: 8d62c9ff2e22fac2ee0040f6fda49b270e7f27a3)
    </td>
  </tr>

  <tr>
    <td width="10">&nbsp;</td>
    <td width="30%" valign="top" align="right">
      <a href="http://nuget.org/api/v2/package/System.Data.SQLite.x86/1.0.82.0">System.Data.SQLite.x86.1.0.82.0.nupkg</a>
      <br />
      (1.47 MiB)
    </td>
    <td width="5"></td>
    <td valign="top">
      This NuGet package contains all the binaries for the x86 version of
      System.Data.SQLite 1.0.82.0 (3.7.14).  The .NET Framework 3.5 SP1 or 4.0
      is required.  For the included native binaries, the version of the Visual
      C++ runtime corresponding to the .NET Framework used by the associated
      managed assembly is statically linked.
      <br />
      (sha1: 598242655955a8827cdab065d4224db8341782fc)
    </td>
  </tr>

  <tr>
    <td width="10">&nbsp;</td>
    <td width="30%" valign="top" align="right">
      <a href="http://nuget.org/api/v2/package/System.Data.SQLite.x64/1.0.82.0">System.Data.SQLite.x64.1.0.82.0.nupkg</a>
      <br />
      (1.67 MiB)
    </td>
    <td width="5"></td>
    <td valign="top">
      This NuGet package contains all the binaries for the x64 version of
      System.Data.SQLite 1.0.82.0 (3.7.14).  The .NET Framework 3.5 SP1 or 4.0
      is required.  For the included native binaries, the version of the Visual
      C++ runtime corresponding to the .NET Framework used by the associated
      managed assembly is statically linked.
      <br />
      (sha1: 1d0a1646f469ea63e74c9ad0778f9911dbde4d30)
    </td>
  </tr>

  <tr>
    <td colspan="4">
      <b>Legacy Versions</b>
    </td>
  </tr>

  <tr>
    <td width="10">&nbsp;</td>
    <td width="30%" valign="top" align="right">
      <a href="http://sqlite.phxsoftware.com/">SQLite-1.0.66.0-setup.exe</a>
      <br />
      (3.2 MiB)
    </td>
    <td width="5"></td>
    <td valign="top">
      Legacy versions, as well as the original support forums, may still be
      found at [http://sqlite.phxsoftware.com/], though there have been no
      updates to this version since April of 2010.
      found at [http://sqlite.phxsoftware.com/], though there have been no updates
      to this version since April of 2010.
    </td>
  </tr>
</table>

<h3>Build Product Names</h3>

<p>
689
690
691
692
693
694
695
696

697
698
699
700
701

702
703
704
705

706
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
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
626
627
628
629
630
631
632
633
634
635
636
637
638


639
640
641







-
+
-



-
+



-
+
-



-
+
-



-
-
+



-
+













-
-
+
+

  binary package statically linked to the Visual C++ runtime.  Template (8) is
  used for the precompiled binary package containing the mixed-mode assembly
  statically linked to the Visual C++ runtime.  Template (9) is used for
  unofficial pre-release &quot;snapshots&quot; of source code.
</p>

<p>
  The <b>framework</b> in templates (3), (4), (5), (6), (7), and (8) will be
  The framework in templates (3), (4), (5), (6), (7), and (8) will be one of netFx35, netFx40.
  one of netFx35, netFx40.
</p>

<p>
  The <b>cpu</b> in templates (3) and (4) will be one of x86, x64, arm, ia64.
  The cpu in templates (3) and (4) will be one of x86, x64, arm, ia64.
</p>

<p>
  The <b>platform</b> in templates (5), (6), (7), and (8) will be one of Win32,
  The platform in templates (5), (6), (7), and (8) will be one of Win32, x64, PocketPC.
  x64, PocketPC.
</p>

<p>
  The <b>year</b> in templates (3), (4), (5), (6), (7), and (8) will be one of
  The year in templates (3), (4), (5), (6), (7), and (8) will be one of 2008, 2010.
  2008, 2010.
</p>

<p>
  The <b>version</b> in templates (1), (2), (3), (4), (5), (6), (7), and (8) is
  the dot-delimited version number of the primary System.Data.SQLite assembly.
  The version in templates (1), (2), (3), (4), (5), (6), (7), and (8) is the dot-delimited version number of the primary System.Data.SQLite assembly.
</p>

<p>
  The <b>date</b> in template (9) is of the form: YYYYMMDDHHMM
  The date in template (9) is of the form: YYYYMMDDHHMM
</p>

<h3>Canonical Source Code</h3>

<p>
  The canonical System.Data.SQLite source code is maintained in a Fossil
  repository that is available for anonymous read-only access. Anyone can view
  the repository contents and download historical versions of individual files
  or ZIP archives of historical check-ins.
</p>

<p>
  The complete source tree for any [/timeline?n=20&y=ci | check-in] may always
  be downloaded using the &quot;Tarball&quot; or &quot;ZIP archive&quot; links
  available from the check-in detail page.
  be downloaded using the &quot;ZIP archive&quot; link available from the
  check-in detail page.
</p>
Changes to www/faq.wiki.
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
92
93
94
95
96
97
98








99
100
101
102
103
104
105







-
-
-
-
-
-
-
-







  </li>
  <br>
  <li>
    <a href="#q19">When the solution is loaded in Visual Studio, why do no files
    show up for several of the projects in the <b>Solution Explorer</b> window?
    </a>
  </li>
  <br>
  <li>
    <a href="#q20">When the System.Data.SQLite project is compiled and run from
    inside Visual Studio, why do I get a <b>DllNotFoundException</b> or a
    <b>BadImageFormatException</b> (for &quot;sqlite3.dll&quot; or
    &quot;SQLite.Interop.dll&quot;) when trying to run or debug the application?
    </a>
  </li>
</ol>

<hr>
<a name="q1"></a>
<p>
  <b>(1) When will the next version of System.Data.SQLite be released?</b>
</p>
202
203
204
205
206
207
208
209
210



211
212
213
214
215
216


217
218
219
220
221
222
223
224
194
195
196
197
198
199
200


201
202
203
204
205
206
207


208
209

210
211
212
213
214
215
216







-
-
+
+
+




-
-
+
+
-








<p>
  Yes, the following official NuGet packages are available:

  <ul>
    <li>
      <a href="http://www.nuget.org/packages/System.Data.SQLite">
      System.Data.SQLite</a>: The SQLite database engine for both x86 and x64
      along with the ADO.NET provider.
      System.Data.SQLite</a>: The SQLite database engine combined with a
      complete ADO.NET provider all rolled into a single mixed-mode assembly for
      x86.
    </li>

    <li>
      <a href="http://www.nuget.org/packages/System.Data.SQLite.x86">
      System.Data.SQLite.x86</a>: The SQLite database engine combined with a
      complete ADO.NET provider all rolled into a single mixed-mode assembly for
      System.Data.SQLite.x86</a>: This currently contains the same content as
      the &quot;System.Data.SQLite&quot; package, above.
      x86.
    </li>

    <li>
      <a href="http://www.nuget.org/packages/System.Data.SQLite.x64">
      System.Data.SQLite.x64</a>: The SQLite database engine combined with a
      complete ADO.NET provider all rolled into a single mixed-mode assembly for
      x64.
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
440
441
442
443
444
445
446





































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
  contains the actual references to the C# source code files.  Unfortunately,
  due to limitations on how Visual Studio reads and interprets MSBuild files at
  design-time, the C# source code files do not show up in the Solution Explorer
  window.  This limitation is largely cosmetic and does <b>not</b> impact the
  correctness of the build process itself, whether in Visual Studio or when
  using MSBuild on the command line.
</p>

<hr>
<a name="q20"></a>
<p>
  <b>(20) When the System.Data.SQLite project is compiled and run from inside
  Visual Studio, why do I get a DllNotFoundException or a BadImageFormatException
  (for &quot;sqlite3.dll&quot; or &quot;SQLite.Interop.dll&quot;) when trying to
  run or debug the application?</b>
</p>

<p>
  When compiling and running a solution from within Visual Studio that uses the
  System.Data.SQLite project (including the test project), it is very important
  to select the correct build configuration and platform.  First, managed
  applications to be debugged inside Visual Studio cannot use the mixed-mode
  assembly (i.e. because it is always compiled to the platform-specific build
  output directory).  This is necessary to properly support building binaries
  for multiple platforms using the same source project files.  Therefore, only
  the &quot;DebugNativeOnly&quot; or &quot;ReleaseNativeOnly&quot; build
  configurations should be selected when running a managed application from
  inside Visual Studio that relies upon the System.Data.SQLite assembly.  These
  build configurations contain a custom post-build step that copies the required
  native assembly to the managed output directory (i.e. to enable running the
  managed binaries in-place).  However, this post-build step will only be
  performed if the selected platform matches that of the operating system (e.g.
  &quot;Win32&quot; for 32-bit Windows and &quot;x64&quot; for 64-bit Windows).
  Therefore, it is good practice to double-check the selected build platform
  against the operating system prior to attempting to run a managed project in
  the solution.
</p>
Changes to www/news.wiki.
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
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





-
+


-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-











-
+







<title>News</title>

<b>Version History</b>

<p>
    <b>1.0.83.0 - November XX, 2012 <font color="red">(release scheduled)</font></b>
    <b>1.0.80.0 - April XX, 2012 <font color="red">(release scheduled)</font></b>
</p>
<ul>
    <li>Updated to [http://www.sqlite.org/src/info/trunk|SQLite 3.7.15].</li>
    <li>Add an overload of the SQLiteLog.LogMessage method that takes a single string argument.</li>
    <li>All applicable calls into the SQLite core library now return a SQLiteErrorCode instead of an integer error code.</li>
    <li>Make sure the error code of the SQLiteException class gets serialized.</li>
    <li>Make the test project for the .NET Compact Framework more flexible.</li>
    <li>When available, the new sqlite3_errstr function from the core library is used to get the error message for a specific return code.</li>
    <li>The SetMemoryStatus, Shutdown, ResultCode, ExtendedResultCode, and SetAvRetry methods of the SQLiteConnection class now return a SQLiteErrorCode instead of an integer error code.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>The public constructor for the SQLiteException now takes a SQLiteErrorCode instead of an integer error code.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>The ErrorCode field of the LogEventArgs is now an object instead of an integer.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>The names and messages associated with the SQLiteErrorCode enumeration values have been normalized to match those in the SQLite core library.&nbsp;<b>** Potentially Incompatible Change **</b></li>
</ul>
<p>
    <b>1.0.82.0 - September 3, 2012</b>
</p>
<ul>
    <li>Updated to [http://www.sqlite.org/releaselog/3_7_14.html|SQLite 3.7.14].</li>
    <li>Properly handle quoted data source values in the connection string. Fix for [8c3bee31c8].</li>
    <li>The [http://nuget.org/packages/System.Data.SQLite|primary NuGet package] now supports x86 / x64 and the .NET Framework 2.0 / 4.0 (i.e. in a single package).</li>
    <li>Change the default value for the Synchronous connection string property to Full to match the default used by the SQLite core library itself.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Add the ability to skip applying default connection settings to opened databases via the new SetDefaults connection string property.</li>
    <li>Add the ability to skip expanding data source file names to their fully qualified paths via the new ToFullPath connection string property.</li>
    <li>Fix the database cleanup ordering in the tests for ticket [343d392b51].</li>
    <li>Add support for the sqlite3_close_v2 function from the SQLite core library.</li>
    <li>Add support for [http://www.sqlite.org/uri.html|URI file names] via the new FullUri connection string property.</li>
    <li>Improve support for the standard SQLite core library in the LINQ assembly and the test suite.</li>
    <li>Add SetMemoryStatus static method to the SQLiteConnection class.</li>
    <li>Improve threaded handling of the delegate used by the SQLiteLog class.</li>
    <li>Add define constants to support enabling or disabling individual groups of trace statements.</li>
</ul>
<p>
    <b>1.0.81.0 - May 27, 2012</b>
</p>
<ul>
    <li>Updated to [http://www.sqlite.org/releaselog/3_7_12_1.html|SQLite 3.7.12.1].</li>
    <li>Support compiling the interop assembly without support for the custom extension functions and the CryptoAPI based codec.</li>
    <li>Add DefineConstants property to the SQLiteConnection class to return the list of define constants used when compiling the core managed assembly.</li>
    <li>Add release archive verification tool to the release automation.</li>
    <li>Fix NullReferenceException when calling the SQLiteDataAdapter.FillSchema method on a query that returns multiple result sets. Fix for [3aa50d8413].</li>
    <li>Fix subtle race condition between threads fetching connection handles from the connection pool and any garbage collection (GC) threads that may be running. Fix for [996d13cd87].</li>
    <li>Add missing call to SetTimeout in the SQLite3_UTF16.Open method.</li>
    <li>Add checks to prevent the SQLiteConnectionPool.Remove method from returning any connection handles that are closed or invalid.</li>
    <li>Modify static SQLiteBase helper methods to prevent them from passing IntPtr.Zero to the SQLite native library.</li>
    <li>Remove static locks from the static helper methods in the SQLiteBase class, replacing them with a lock on the connection handle instance being operated upon.</li>
    <li>Revise CriticalHandle derived classes to make them more thread-safe.</li>
    <li>Add connection pool related diagnostic messages when compiled with the DEBUG define constant.</li>
    <li>Add PoolCount property to the SQLiteConnection class to return the number of pool entries for the file name associated with the connection.</li>
    <li>Rename internal SQLiteLastError methods to GetLastError.</li>
    <li>Add assembly file test constraints to all tests that execute the &quot;test.exe&quot; or &quot;testlinq.exe&quot; files.</li>
</ul>
<p>
    <b>1.0.80.0 - April 1, 2012</b>
</p>
<ul>
    <li>Updated to [http://www.sqlite.org/releaselog/3_7_11.html|SQLite 3.7.11].</li>
    <li>In the SQLiteFunction class, when calling user-provided methods from a delegate called by native code, avoid throwing exceptions, optionally tracing the caught exceptions. Fix for [8a426d12eb].</li>
    <li>Add Visual Studio 2005 support to all the applicable solution/project files, their associated supporting files, and the test suite.</li>
    <li>Add Visual Studio 2005 support to the redesigned designer support installer.</li>
    <li>Add experimental support for &quot;pre-loading&quot; the native SQLite library based on the processor architecture of the current process.  This feature is now enabled by default at compile-time.</li>
    <li>Add support for the native [http://www.sqlite.org/backup.html|SQLite Online Backup API]. Fix for [c71846ed57].</li>
    <li>Acquire and hold a static data lock while checking if the native SQLite library has been initialized to prevent a subtle race condition that can result in superfluous error messages. Fix for [72905c9a77].</li>
    <li>Support tracing of all parameter binding activity and use the connection flags to control what is traced.</li>
    <li>When converting a DateTime instance of an &quot;Unspecified&quot; kind to a string, use the same kind as the connection, if available.</li>
    <li>Add overload of the SQLiteDataReader.GetValues method that returns a NameValueCollection.</li>
    <li>Add static ToUnixEpoch method to the SQLiteConvert class to convert a DateTime value to the number of whole seconds since the Unix epoch.</li>
    <li>In the implicit conversion operators (to IntPtr) for both the SQLiteConnectionHandle and SQLiteStatementHandle classes, return IntPtr.Zero if the instance being converted is null.</li>
    <li>Write warning message to the active trace listeners (for the Debug build configuration only) if a column type or type name cannot be mapped properly. See [4bbf851fa5].</li>
    <li>Write warning message to the active trace listners (for the Debug build configuration only) if a column type or type name cannot be mapped properly. See [4bbf851fa5].</li>
    <li>When tracing SQL statements to be prepared, bypass the internal length limit of the sqlite3_log function by using the SQLiteLog class directly instead. Also, detect null and/or empty strings and emit a special message in that case.</li>
    <li>For the setup, the Visual Studio task should only be initially checked if the GAC task is available and vice-versa.</li>
    <li>Improve compatibility with custom command processors by using __ECHO instead of _ECHO in batch tools.</li>
    <li>Add OpenAndReturn method to the SQLiteConnection class to open a connection and return it.</li>
    <li>Add missing CheckDisposed calls to the SQLiteConnection class.</li>
    <li>Add missing throw statement to the SQLiteConnection class.</li>
    <li>Make sure the interop project uses /fp:precise for Windows CE.</li>
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
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







-
+
















+
-
+
+
+



-
-
-
-
-
-
-



-
-
-
-
-
+
+
+
+
+





-
-
+
+





-
-
+
+

    <li>Add release automation to build the source, setup, and binary packages in all supported build variants.</li>
    <li>Add the testlinq project to the new build system and make it work properly with Visual Studio 2008 and 2010.</li>
</ul>
<p>
    <b>1.0.73.0 - June 2, 2011</b>
</p>
<ul>
    <li>Updated to [http://www.sqlite.org/releaselog/3_7_6_3.html|SQLite 3.7.6.3].</li>
    <li>Updated to [http://www.sqlite.org/releaselog/3_7_6_3.html|SQLite 3.7.6.3]
    <li>Minor optimization to GetBytes(). Fix for [8c1650482e].</li>
    <li>Update various assembly information settings.</li>
    <li>Correct System.Data.SQLite.Linq version and resource information. Fix for [6489c5a396] and [133daf50d6].</li>
    <li>Moved log handler from SQLiteConnection object to SQLiteFactory object to prevent if from being prematurely GCed.</li>
    <li>We should block x64 installs on x86 and we should install native only if the setup package itself is native. Fix for [e058ce156e].</li>
</ul>
<p>
    <b>1.0.72.0 - May 1, 2011</b>
</p>
<ul>
    <li>Add the correct directory to the path. Fix for [50515a0c8e].</li>
</ul>
<p>
    <b>1.0.71.0 - April 27, 2011</b>
</p>
<ul>
    <li>
    <li>Updated to SQLite 3.7.6+ [http://www.sqlite.org/src/info/1bd1484cd7 | &#91;1bd1484cd7&#93;]</a> to get additional Windows error logging.</li>
        Updated to SQLite 3.7.6+ [http://www.sqlite.org/src/info/1bd1484cd7 | &#91;1bd1484cd7&#93;]</a>
        to get additional Windows error logging.
    </li>
    <li>Updated setup to optionally add install directory to PATH if GAC option selected.</li>
</ul>
<p>
    <b>1.0.70.0 - April 22, 2011</b>
</p>
<ul>
    <li>Added support for sqlite3_extended_result_codes(), sqlite3_errcode(), and sqlite3_extended_errcode() via SetExtendedResultCodes(), ResultCode(), and ExtendedResultCode().</li>
    <li>Added support for SQLITE_CONFIG_LOG via SQLiteLogEventHandler().</li>
</ul>
<p>
    <b>1.0.69.0 - April 12, 2011</b>
</p>
<ul>
    <li>Code merge with [http://www.sqlite.org/releaselog/3_7_6.html | SQLite 3.7.6].</li>
    <li>New VS2008 and VS2010 solution files.</li>
    <li>Build and packaging automation.</li>
    <li>New Inno Setup files.</li>
    <li>Designer support currently not ready for release.</li>
    <li>Code merge with [http://www.sqlite.org/releaselog/3_7_6.html | SQLite 3.7.6]</li>
    <li>New VS2008 and VS2010 solution files</li>
    <li>Build and packaging automation</li>
    <li>New Inno Setup files</li>
    <li>Designer support currently not ready for release</li>
</ul>
<p>
    <b>1.0.68.0 - February 2011</b>
</p>
<ul>
    <li>Code merge with [http://www.sqlite.org/releaselog/3_7_5.html | SQLite 3.7.5].</li>
    <li>Continuing work on supporting Visual Studio 2010.</li>
    <li>Code merge with [http://www.sqlite.org/releaselog/3_7_5.html | SQLite 3.7.5]</li>
    <li>Continuing work on supporting Visual Studio 2010</li>
</ul>
<p>
    <b>1.0.67.0 - January 3, 2011</b>
</p>
<ul>
    <li>Code merge with [http://www.sqlite.org/releaselog/3_7_4.html | SQLite 3.7.4].</li>
    <li>Continuing work on supporting Visual Studio 2010.</li>
    <li>Code merge with [http://www.sqlite.org/releaselog/3_7_4.html | SQLite 3.7.4]</li>
    <li>Continuing work on supporting Visual Studio 2010</li>
</ul>
Changes to www/release.wiki.
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
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







-
-
+
+







+
+
+
+
+
+
-
-
+
+
+
-
-
-
+
+
+
+
+








  <li>
    Enter the following command to build all the source release packages:
    &nbsp;<b>archive.bat</b><br />
  </li>
</ol>

<a name="verifyAllPackages"></a>
<h2>Verify All Release Packages</h2>
<a name="updateDownloadsPage"></a>
<h2>Update Downloads Page</h2>

<ol>
  <li>Open a normal command prompt window with &quot;cmd.exe&quot;.</li>

  <li>Change the current directory to &quot;&lt;root&gt;\Setup&quot;.</li>

  <li>
    Replace the version numbers for the previous release in the local working
    copy of the [./downloads.wiki | downloads page] with the new version numbers
    for System.Data.SQLite and the SQLite core.
  </li>

  <li>
    Enter the following command to build all the source release packages:&nbsp;
    <b>..\Externals\Eagle\bin\EagleShell.exe -file verify.eagle Output</b><br />
    Enter the following command to update the sizes and hashes on the downloads
    page based on all the built release packages:&nbsp;<b>tclsh.exe&nbsp;
    updateFileInfo.tcl</b><br /><i>This assumes that
    <i>If errors are generated, the file &quot;&lt;root&gt;\Setup\verify.lst&quot;
    may need to be updated to account for the files that have been added and/or
    removed from the release archives since the previous release.</i>
    [http://www.activestate.com/activetcl | ActiveTcl] version 8.4 or later has
    been installed using the default settings and that the Fossil binary is
    available somewhere along the
    [http://en.wikipedia.org/wiki/PATH_%28variable%29 | PATH] (i.e. for
    calculating the SHA1 hashes).</i>
  </li>
</ol>

<a name="buildNuGetPackages"></a>
<h2>Build NuGet Packages</h2>

<ol>
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
284
285
286
287
288
289
290
































291
292
293
294
295
296
297







-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-







  <li>
    Enter the following command to build the NuGet package for x64:
    &nbsp;<b>nuget.exe&nbsp;pack&nbsp;SQLite.x64.nuspec</b><br /><i>This assumes
    that the NuGet binary is available somewhere along the
    [http://en.wikipedia.org/wiki/PATH_%28variable%29 | PATH].<br />Please refer
    to [http://docs.nuget.org/ | NuGet Documentation] for further details.</i>
  </li>

  <li>
    Enter the following command to move the NuGet packages to the release output
    directory:
    &nbsp;<b>move *.nupkg Setup\Output</b>
  </li>
</ol>

<a name="updateDownloadsPage"></a>
<h2>Update Downloads Page</h2>

<ol>
  <li>Open a normal command prompt window with &quot;cmd.exe&quot;.</li>

  <li>Change the current directory to &quot;&lt;root&gt;\Setup&quot;.</li>

  <li>
    Replace the version numbers for the previous release in the local working
    copy of the [./downloads.wiki | downloads page] with the new version numbers
    for System.Data.SQLite and the SQLite core.
  </li>

  <li>
    Enter the following command to update the sizes and hashes on the downloads
    page based on all the built release packages:&nbsp;<b>tclsh.exe&nbsp;
    updateFileInfo.tcl</b><br /><i>This assumes that
    [http://www.activestate.com/activetcl | ActiveTcl] version 8.4 or later has
    been installed using the default settings and that the Fossil binary is
    available somewhere along the
    [http://en.wikipedia.org/wiki/PATH_%28variable%29 | PATH] (i.e. for
    calculating the SHA1 hashes).</i>
  </li>
</ol>

<a name="publishRelease"></a>
<h2>Publish Release</h2>

<ol>
  <li>
Changes to www/support.wiki.
69
70
71
72
73
74
75
76

77
78
79
80
81
82
83
69
70
71
72
73
74
75

76
77
78
79
80
81
82
83







-
+







  Use the mailing list. Please do <b>not</b> send email directly
  to the authors of SQLite or System.Data.SQLite unless:
</p>

<ul>
  <li>
    You have or intend to acquire a
    <a href="http://www.sqlite.org/support.html">
    <a href="http://www.sqlite.org/draft/support.html">
    professional support contract</a>.
  </li>

  <li>
    You are working on an open source project.
  </li>
</ul>