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

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

Overview
Comment:Merge updates from trunk.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | core312
Files: files | file ages | folders
SHA1: bb297a629db93755714d877aab29699eb44e0a03
User & Date: mistachkin 2016-03-24 00:27:54
Context
2016-03-24
17:56
Merge updates from trunk. check-in: e63fbd3565 user: mistachkin tags: core312
00:27
Merge updates from trunk. check-in: bb297a629d user: mistachkin tags: core312
2016-03-23
23:40
Compilation fix for the RELEASE build configuration. check-in: 024679a92b user: mistachkin tags: trunk
2016-03-22
15:58
Adapt to the new default page and cache sizes. check-in: b1aa416311 user: mistachkin tags: core312
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to Doc/Extra/Provider/environment.html.

   135    135             <td>If this environment variable is set [to anything], it will be
   136    136             used instead of the application base directory by the native
   137    137             library pre-loader.  This environment variable can be especially
   138    138             useful in ASP.NET and other hosted environments where direct control
   139    139             of the location of the managed assemblies is not under the control
   140    140             of the application.</td>
   141    141           </tr>
          142  +        <tr valign="top">
          143  +          <td>PreLoadSQLite_LibraryFileNameOnly</td>
          144  +          <td>If this configuration variable is set [to anything], it will be
          145  +          used as the base file name (without directory information) for the
          146  +          native SQLite library to be pre-loaded (e.g. "sqlite3.dll" or
          147  +          "libsqlite3.so.0").</td>
          148  +        </tr>
   142    149           <tr valign="top">
   143    150             <td>PreLoadSQLite_ProcessorArchitecture</td>
   144    151             <td>If this environment variable is set [to anything], it will be
   145    152             used instead of the processor architecture value contained in the
   146    153             PROCESSOR_ARCHITECTURE environment variable to help build the path
   147    154             of the native library to pre-load.</td>
   148    155           </tr>

Changes to Doc/Extra/Provider/version.html.

    42     42       </div>
    43     43       <div id="mainSection">
    44     44       <div id="mainBody">
    45     45       <h1 class="heading">Version History</h1>
    46     46       <p><b>1.0.100.0 - April XX, 2016 <font color="red">(release scheduled)</font></b></p>
    47     47       <ul>
    48     48         <li>Updated to <a href="https://www.sqlite.org/draft/releaselog/3_12_0.html">SQLite 3.12.0</a>.</li>
           49  +      <li>Support compiling and using the interop assembly on Linux and Mac OS X.</li>
           50  +      <li>Support running the test suite under Mono on Linux and Mac OS X.</li>
    49     51         <li>Properly handle NULL values in the &quot;name&quot; column of the results returned by PRAGMA index_info(). Fix for <a href="https://system.data.sqlite.org/index.html/info/5251bd0878">[5251bd0878]</a>.</li>
    50     52         <li>For column types that resolve to boolean, recognize case-insensitive prefixes of &quot;True&quot; and &quot;False&quot;. Fix for <a href="https://system.data.sqlite.org/index.html/info/dbd65441a5">[dbd65441a5]</a>.</li>
    51     53         <li>Add NoVerifyTextAffinity connection flag to skip type affinity checking when fetching a column value as a string. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/dbd65441a5">[dbd65441a5]</a>.</li>
    52     54         <li>The UnixEpoch DateTime format should use Int64 internally, not Int32.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    53     55         <li>Avoid using Path.Combine with null values in the native library pre-loader. Fix for <a href="https://system.data.sqlite.org/index.html/info/da685c0bac">[da685c0bac]</a>.</li>
    54     56         <li>Fix the (unsupported) legacy CryptoAPI based codec so that it no longer prevents page size changes.</li>
    55     57       </ul>

Changes to Externals/Eagle/lib/Test1.0/constraints.eagle.

    60     60       # NOTE: This job of this procedure is to return the list of "known"
    61     61       #       versions of Mono supported by the test suite infrastructure.
    62     62       #
    63     63       return [list \
    64     64           [list 2 0] [list 2 2] [list 2 4] [list 2 6] [list 2 8] [list 2 10] \
    65     65           [list 2 11] [list 2 12] [list 3 0] [list 3 1] [list 3 2] [list 3 3] \
    66     66           [list 3 4] [list 3 5] [list 3 6] [list 3 8] [list 3 10] [list 3 12] \
    67         -        [list 4 0]]
           67  +        [list 4 0] [list 4 2]]
    68     68     }
    69     69   
    70     70     #
    71     71     # NOTE: This procedure was adapted from the one listed on the Tcl Wiki page
    72     72     #       at "http://wiki.tcl.tk/43".  It is only intended to be used on very
    73     73     #       small lists because of its heavy use of recursion and complexity on
    74     74     #       the order of O(N!).

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

  1413   1413   					>
  1414   1414   					<Tool
  1415   1415   						Name="VCCLCompilerTool"
  1416   1416   					/>
  1417   1417   				</FileConfiguration>
  1418   1418   			</File>
  1419   1419   			<File
  1420         -				RelativePath=".\src\win\interop.c"
         1420  +				RelativePath=".\src\generic\interop.c"
  1421   1421   				>
  1422   1422   			</File>
  1423   1423   			<File
  1424   1424   				RelativePath=".\src\core\sqlite3.c"
  1425   1425   				>
  1426   1426   				<FileConfiguration
  1427   1427   					Name="Debug|Win32"
................................................................................
  1499   1499   				>
  1500   1500   			</File>
  1501   1501   			<File
  1502   1502   				RelativePath=".\src\core\sqlite3ext.h"
  1503   1503   				>
  1504   1504   			</File>
  1505   1505   			<File
  1506         -				RelativePath=".\src\win\interop.h"
         1506  +				RelativePath=".\src\generic\interop.h"
  1507   1507   				>
  1508   1508   			</File>
  1509   1509   		</Filter>
  1510   1510   		<Filter
  1511   1511   			Name="Resource Files"
  1512   1512   			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
  1513   1513   			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"

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

  1413   1413   					>
  1414   1414   					<Tool
  1415   1415   						Name="VCCLCompilerTool"
  1416   1416   					/>
  1417   1417   				</FileConfiguration>
  1418   1418   			</File>
  1419   1419   			<File
  1420         -				RelativePath=".\src\win\interop.c"
         1420  +				RelativePath=".\src\generic\interop.c"
  1421   1421   				>
  1422   1422   			</File>
  1423   1423   			<File
  1424   1424   				RelativePath=".\src\core\sqlite3.c"
  1425   1425   				>
  1426   1426   				<FileConfiguration
  1427   1427   					Name="Debug|Win32"
................................................................................
  1499   1499   				>
  1500   1500   			</File>
  1501   1501   			<File
  1502   1502   				RelativePath=".\src\core\sqlite3ext.h"
  1503   1503   				>
  1504   1504   			</File>
  1505   1505   			<File
  1506         -				RelativePath=".\src\win\interop.h"
         1506  +				RelativePath=".\src\generic\interop.h"
  1507   1507   				>
  1508   1508   			</File>
  1509   1509   		</Filter>
  1510   1510   		<Filter
  1511   1511   			Name="Resource Files"
  1512   1512   			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
  1513   1513   			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"

Changes to SQLite.Interop/SQLite.Interop.2010.vcxproj.

   491    491       </ClCompile>
   492    492       <ClCompile Include="src\ext\totype.c">
   493    493         <ExcludedFromBuild>true</ExcludedFromBuild>
   494    494       </ClCompile>
   495    495       <ClCompile Include="src\ext\vtshim.c">
   496    496         <ExcludedFromBuild>true</ExcludedFromBuild>
   497    497       </ClCompile>
   498         -    <ClCompile Include="src\win\interop.c" />
          498  +    <ClCompile Include="src\generic\interop.c" />
   499    499       <ClCompile Include="src\core\sqlite3.c">
   500    500         <ExcludedFromBuild>true</ExcludedFromBuild>
   501    501       </ClCompile>
   502    502     </ItemGroup>
   503    503     <ItemGroup>
   504    504       <None Include="props\SQLite.Interop.2010.props" />
   505    505       <None Include="props\sqlite3.props" />
   506    506     </ItemGroup>
   507    507     <ItemGroup>
   508    508       <ClInclude Include="src\core\sqlite3.h" />
   509    509       <ClInclude Include="src\core\sqlite3ext.h" />
   510         -    <ClInclude Include="src\win\interop.h" />
          510  +    <ClInclude Include="src\generic\interop.h" />
   511    511     </ItemGroup>
   512    512     <ItemGroup>
   513    513       <ResourceCompile Include="src\win\SQLite.Interop.rc" />
   514    514     </ItemGroup>
   515    515     <ItemGroup>
   516    516       <EmbeddedResource Include="..\System.Data.SQLite\Resources\SR.resx">
   517    517         <LogicalName>System.Data.SQLite.%(Filename).resources</LogicalName>

Changes to SQLite.Interop/SQLite.Interop.2010.vcxproj.filters.

    49     49       </ClCompile>
    50     50       <ClCompile Include="src\ext\totype.c">
    51     51         <Filter>Source Files</Filter>
    52     52       </ClCompile>
    53     53       <ClCompile Include="src\ext\vtshim.c">
    54     54         <Filter>Source Files</Filter>
    55     55       </ClCompile>
    56         -    <ClCompile Include="src\win\interop.c">
           56  +    <ClCompile Include="src\generic\interop.c">
    57     57         <Filter>Source Files</Filter>
    58     58       </ClCompile>
    59     59       <ClCompile Include="src\core\sqlite3.c">
    60     60         <Filter>Source Files</Filter>
    61     61       </ClCompile>
    62     62     </ItemGroup>
    63     63     <ItemGroup>
................................................................................
    71     71     <ItemGroup>
    72     72       <ClInclude Include="src\core\sqlite3.h">
    73     73         <Filter>Header Files</Filter>
    74     74       </ClInclude>
    75     75       <ClInclude Include="src\core\sqlite3ext.h">
    76     76         <Filter>Header Files</Filter>
    77     77       </ClInclude>
    78         -    <ClInclude Include="src\win\interop.h">
           78  +    <ClInclude Include="src\generic\interop.h">
    79     79         <Filter>Header Files</Filter>
    80     80       </ClInclude>
    81     81     </ItemGroup>
    82     82     <ItemGroup>
    83     83       <ResourceCompile Include="src\win\SQLite.Interop.rc">
    84     84         <Filter>Resource Files</Filter>
    85     85       </ResourceCompile>
    86     86       <EmbeddedResource Include="..\System.Data.SQLite\Resources\SR.resx">
    87     87         <Filter>Resource Files</Filter>
    88     88       </EmbeddedResource>
    89     89     </ItemGroup>
    90     90   </Project>

Changes to SQLite.Interop/SQLite.Interop.2012.vcxproj.

   498    498       </ClCompile>
   499    499       <ClCompile Include="src\ext\totype.c">
   500    500         <ExcludedFromBuild>true</ExcludedFromBuild>
   501    501       </ClCompile>
   502    502       <ClCompile Include="src\ext\vtshim.c">
   503    503         <ExcludedFromBuild>true</ExcludedFromBuild>
   504    504       </ClCompile>
   505         -    <ClCompile Include="src\win\interop.c" />
          505  +    <ClCompile Include="src\generic\interop.c" />
   506    506       <ClCompile Include="src\core\sqlite3.c">
   507    507         <ExcludedFromBuild>true</ExcludedFromBuild>
   508    508       </ClCompile>
   509    509     </ItemGroup>
   510    510     <ItemGroup>
   511    511       <None Include="props\SQLite.Interop.2012.props" />
   512    512       <None Include="props\sqlite3.props" />
   513    513     </ItemGroup>
   514    514     <ItemGroup>
   515    515       <ClInclude Include="src\core\sqlite3.h" />
   516    516       <ClInclude Include="src\core\sqlite3ext.h" />
   517         -    <ClInclude Include="src\win\interop.h" />
          517  +    <ClInclude Include="src\generic\interop.h" />
   518    518     </ItemGroup>
   519    519     <ItemGroup>
   520    520       <ResourceCompile Include="src\win\SQLite.Interop.rc" />
   521    521     </ItemGroup>
   522    522     <ItemGroup>
   523    523       <EmbeddedResource Include="..\System.Data.SQLite\Resources\SR.resx">
   524    524         <LogicalName>System.Data.SQLite.%(Filename).resources</LogicalName>

Changes to SQLite.Interop/SQLite.Interop.2012.vcxproj.filters.

    49     49       </ClCompile>
    50     50       <ClCompile Include="src\ext\totype.c">
    51     51         <Filter>Source Files</Filter>
    52     52       </ClCompile>
    53     53       <ClCompile Include="src\ext\vtshim.c">
    54     54         <Filter>Source Files</Filter>
    55     55       </ClCompile>
    56         -    <ClCompile Include="src\win\interop.c">
           56  +    <ClCompile Include="src\generic\interop.c">
    57     57         <Filter>Source Files</Filter>
    58     58       </ClCompile>
    59     59       <ClCompile Include="src\core\sqlite3.c">
    60     60         <Filter>Source Files</Filter>
    61     61       </ClCompile>
    62     62     </ItemGroup>
    63     63     <ItemGroup>
................................................................................
    71     71     <ItemGroup>
    72     72       <ClInclude Include="src\core\sqlite3.h">
    73     73         <Filter>Header Files</Filter>
    74     74       </ClInclude>
    75     75       <ClInclude Include="src\core\sqlite3ext.h">
    76     76         <Filter>Header Files</Filter>
    77     77       </ClInclude>
    78         -    <ClInclude Include="src\win\interop.h">
           78  +    <ClInclude Include="src\generic\interop.h">
    79     79         <Filter>Header Files</Filter>
    80     80       </ClInclude>
    81     81     </ItemGroup>
    82     82     <ItemGroup>
    83     83       <ResourceCompile Include="src\win\SQLite.Interop.rc">
    84     84         <Filter>Resource Files</Filter>
    85     85       </ResourceCompile>
    86     86       <EmbeddedResource Include="..\System.Data.SQLite\Resources\SR.resx">
    87     87         <Filter>Resource Files</Filter>
    88     88       </EmbeddedResource>
    89     89     </ItemGroup>
    90     90   </Project>

Changes to SQLite.Interop/SQLite.Interop.2013.vcxproj.

   498    498       </ClCompile>
   499    499       <ClCompile Include="src\ext\totype.c">
   500    500         <ExcludedFromBuild>true</ExcludedFromBuild>
   501    501       </ClCompile>
   502    502       <ClCompile Include="src\ext\vtshim.c">
   503    503         <ExcludedFromBuild>true</ExcludedFromBuild>
   504    504       </ClCompile>
   505         -    <ClCompile Include="src\win\interop.c" />
          505  +    <ClCompile Include="src\generic\interop.c" />
   506    506       <ClCompile Include="src\core\sqlite3.c">
   507    507         <ExcludedFromBuild>true</ExcludedFromBuild>
   508    508       </ClCompile>
   509    509     </ItemGroup>
   510    510     <ItemGroup>
   511    511       <None Include="props\SQLite.Interop.2013.props" />
   512    512       <None Include="props\sqlite3.props" />
   513    513     </ItemGroup>
   514    514     <ItemGroup>
   515    515       <ClInclude Include="src\core\sqlite3.h" />
   516    516       <ClInclude Include="src\core\sqlite3ext.h" />
   517         -    <ClInclude Include="src\win\interop.h" />
          517  +    <ClInclude Include="src\generic\interop.h" />
   518    518     </ItemGroup>
   519    519     <ItemGroup>
   520    520       <ResourceCompile Include="src\win\SQLite.Interop.rc" />
   521    521     </ItemGroup>
   522    522     <ItemGroup>
   523    523       <EmbeddedResource Include="..\System.Data.SQLite\Resources\SR.resx">
   524    524         <LogicalName>System.Data.SQLite.%(Filename).resources</LogicalName>

Changes to SQLite.Interop/SQLite.Interop.2013.vcxproj.filters.

    49     49       </ClCompile>
    50     50       <ClCompile Include="src\ext\totype.c">
    51     51         <Filter>Source Files</Filter>
    52     52       </ClCompile>
    53     53       <ClCompile Include="src\ext\vtshim.c">
    54     54         <Filter>Source Files</Filter>
    55     55       </ClCompile>
    56         -    <ClCompile Include="src\win\interop.c">
           56  +    <ClCompile Include="src\generic\interop.c">
    57     57         <Filter>Source Files</Filter>
    58     58       </ClCompile>
    59     59       <ClCompile Include="src\core\sqlite3.c">
    60     60         <Filter>Source Files</Filter>
    61     61       </ClCompile>
    62     62     </ItemGroup>
    63     63     <ItemGroup>
................................................................................
    71     71     <ItemGroup>
    72     72       <ClInclude Include="src\core\sqlite3.h">
    73     73         <Filter>Header Files</Filter>
    74     74       </ClInclude>
    75     75       <ClInclude Include="src\core\sqlite3ext.h">
    76     76         <Filter>Header Files</Filter>
    77     77       </ClInclude>
    78         -    <ClInclude Include="src\win\interop.h">
           78  +    <ClInclude Include="src\generic\interop.h">
    79     79         <Filter>Header Files</Filter>
    80     80       </ClInclude>
    81     81     </ItemGroup>
    82     82     <ItemGroup>
    83     83       <ResourceCompile Include="src\win\SQLite.Interop.rc">
    84     84         <Filter>Resource Files</Filter>
    85     85       </ResourceCompile>
    86     86       <EmbeddedResource Include="..\System.Data.SQLite\Resources\SR.resx">
    87     87         <Filter>Resource Files</Filter>
    88     88       </EmbeddedResource>
    89     89     </ItemGroup>
    90     90   </Project>

Changes to SQLite.Interop/SQLite.Interop.2015.vcxproj.

   498    498       </ClCompile>
   499    499       <ClCompile Include="src\ext\totype.c">
   500    500         <ExcludedFromBuild>true</ExcludedFromBuild>
   501    501       </ClCompile>
   502    502       <ClCompile Include="src\ext\vtshim.c">
   503    503         <ExcludedFromBuild>true</ExcludedFromBuild>
   504    504       </ClCompile>
   505         -    <ClCompile Include="src\win\interop.c" />
          505  +    <ClCompile Include="src\generic\interop.c" />
   506    506       <ClCompile Include="src\core\sqlite3.c">
   507    507         <ExcludedFromBuild>true</ExcludedFromBuild>
   508    508       </ClCompile>
   509    509     </ItemGroup>
   510    510     <ItemGroup>
   511    511       <None Include="props\SQLite.Interop.2015.props" />
   512    512       <None Include="props\sqlite3.props" />
   513    513     </ItemGroup>
   514    514     <ItemGroup>
   515    515       <ClInclude Include="src\core\sqlite3.h" />
   516    516       <ClInclude Include="src\core\sqlite3ext.h" />
   517         -    <ClInclude Include="src\win\interop.h" />
          517  +    <ClInclude Include="src\generic\interop.h" />
   518    518     </ItemGroup>
   519    519     <ItemGroup>
   520    520       <ResourceCompile Include="src\win\SQLite.Interop.rc" />
   521    521     </ItemGroup>
   522    522     <ItemGroup>
   523    523       <EmbeddedResource Include="..\System.Data.SQLite\Resources\SR.resx">
   524    524         <LogicalName>System.Data.SQLite.%(Filename).resources</LogicalName>

Changes to SQLite.Interop/SQLite.Interop.2015.vcxproj.filters.

    49     49       </ClCompile>
    50     50       <ClCompile Include="src\ext\totype.c">
    51     51         <Filter>Source Files</Filter>
    52     52       </ClCompile>
    53     53       <ClCompile Include="src\ext\vtshim.c">
    54     54         <Filter>Source Files</Filter>
    55     55       </ClCompile>
    56         -    <ClCompile Include="src\win\interop.c">
           56  +    <ClCompile Include="src\generic\interop.c">
    57     57         <Filter>Source Files</Filter>
    58     58       </ClCompile>
    59     59       <ClCompile Include="src\core\sqlite3.c">
    60     60         <Filter>Source Files</Filter>
    61     61       </ClCompile>
    62     62     </ItemGroup>
    63     63     <ItemGroup>
................................................................................
    71     71     <ItemGroup>
    72     72       <ClInclude Include="src\core\sqlite3.h">
    73     73         <Filter>Header Files</Filter>
    74     74       </ClInclude>
    75     75       <ClInclude Include="src\core\sqlite3ext.h">
    76     76         <Filter>Header Files</Filter>
    77     77       </ClInclude>
    78         -    <ClInclude Include="src\win\interop.h">
           78  +    <ClInclude Include="src\generic\interop.h">
    79     79         <Filter>Header Files</Filter>
    80     80       </ClInclude>
    81     81     </ItemGroup>
    82     82     <ItemGroup>
    83     83       <ResourceCompile Include="src\win\SQLite.Interop.rc">
    84     84         <Filter>Resource Files</Filter>
    85     85       </ResourceCompile>
    86     86       <EmbeddedResource Include="..\System.Data.SQLite\Resources\SR.resx">
    87     87         <Filter>Resource Files</Filter>
    88     88       </EmbeddedResource>
    89     89     </ItemGroup>
    90     90   </Project>

Changes to SQLite.Interop/SQLite.Interop.CE.2005.vcproj.

  1095   1095   					>
  1096   1096   					<Tool
  1097   1097   						Name="VCCLCompilerTool"
  1098   1098   					/>
  1099   1099   				</FileConfiguration>
  1100   1100   			</File>
  1101   1101   			<File
  1102         -				RelativePath=".\src\win\interop.c"
         1102  +				RelativePath=".\src\generic\interop.c"
  1103   1103   				>
  1104   1104   			</File>
  1105   1105   			<File
  1106   1106   				RelativePath=".\src\core\sqlite3.c"
  1107   1107   				>
  1108   1108   				<FileConfiguration
  1109   1109   					Name="Debug|Pocket PC 2003 (ARMV4)"
................................................................................
  1157   1157   		</Filter>
  1158   1158   		<Filter
  1159   1159   			Name="Header Files"
  1160   1160   			Filter="h;hpp;hxx;hm;inl;inc;xsd"
  1161   1161   			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
  1162   1162   			>
  1163   1163   			<File
  1164         -				RelativePath=".\src\win\interop.h"
         1164  +				RelativePath=".\src\generic\interop.h"
  1165   1165   				>
  1166   1166   			</File>
  1167   1167   			<File
  1168   1168   				RelativePath=".\src\core\sqlite3.h"
  1169   1169   				>
  1170   1170   			</File>
  1171   1171   			<File

Changes to SQLite.Interop/SQLite.Interop.CE.2008.vcproj.

  1095   1095   					>
  1096   1096   					<Tool
  1097   1097   						Name="VCCLCompilerTool"
  1098   1098   					/>
  1099   1099   				</FileConfiguration>
  1100   1100   			</File>
  1101   1101   			<File
  1102         -				RelativePath=".\src\win\interop.c"
         1102  +				RelativePath=".\src\generic\interop.c"
  1103   1103   				>
  1104   1104   			</File>
  1105   1105   			<File
  1106   1106   				RelativePath=".\src\core\sqlite3.c"
  1107   1107   				>
  1108   1108   				<FileConfiguration
  1109   1109   					Name="Debug|Pocket PC 2003 (ARMV4)"
................................................................................
  1157   1157   		</Filter>
  1158   1158   		<Filter
  1159   1159   			Name="Header Files"
  1160   1160   			Filter="h;hpp;hxx;hm;inl;inc;xsd"
  1161   1161   			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
  1162   1162   			>
  1163   1163   			<File
  1164         -				RelativePath=".\src\win\interop.h"
         1164  +				RelativePath=".\src\generic\interop.h"
  1165   1165   				>
  1166   1166   			</File>
  1167   1167   			<File
  1168   1168   				RelativePath=".\src\core\sqlite3.h"
  1169   1169   				>
  1170   1170   			</File>
  1171   1171   			<File

Changes to SQLite.Interop/SQLite.Interop.CE.2012.vcxproj.

   197    197       </ClCompile>
   198    198       <ClCompile Include="src\ext\totype.c">
   199    199         <ExcludedFromBuild>true</ExcludedFromBuild>
   200    200       </ClCompile>
   201    201       <ClCompile Include="src\ext\vtshim.c">
   202    202         <ExcludedFromBuild>true</ExcludedFromBuild>
   203    203       </ClCompile>
   204         -    <ClCompile Include="src\win\interop.c" />
          204  +    <ClCompile Include="src\generic\interop.c" />
   205    205       <ClCompile Include="src\core\sqlite3.c">
   206    206         <ExcludedFromBuild>true</ExcludedFromBuild>
   207    207       </ClCompile>
   208    208     </ItemGroup>
   209    209   
   210    210     <ItemGroup>
   211    211       <None Include="props\SQLite.Interop.2012.props" />
   212    212       <None Include="props\sqlite3.props" />
   213    213     </ItemGroup>
   214    214   
   215    215     <ItemGroup>
   216    216       <ClInclude Include="src\core\sqlite3.h" />
   217    217       <ClInclude Include="src\core\sqlite3ext.h" />
   218         -    <ClInclude Include="src\win\interop.h" />
          218  +    <ClInclude Include="src\generic\interop.h" />
   219    219     </ItemGroup>
   220    220   
   221    221     <ItemGroup>
   222    222       <ResourceCompile Include="src\win\SQLite.Interop.rc" />
   223    223     </ItemGroup>
   224    224   
   225    225     <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   226    226   </Project>

Changes to SQLite.Interop/SQLite.Interop.CE.2012.vcxproj.filters.

    49     49       </ClCompile>
    50     50       <ClCompile Include="src\ext\totype.c">
    51     51         <Filter>Source Files</Filter>
    52     52       </ClCompile>
    53     53       <ClCompile Include="src\ext\vtshim.c">
    54     54         <Filter>Source Files</Filter>
    55     55       </ClCompile>
    56         -    <ClCompile Include="src\win\interop.c">
           56  +    <ClCompile Include="src\generic\interop.c">
    57     57         <Filter>Source Files</Filter>
    58     58       </ClCompile>
    59     59       <ClCompile Include="src\core\sqlite3.c">
    60     60         <Filter>Source Files</Filter>
    61     61       </ClCompile>
    62     62     </ItemGroup>
    63     63     <ItemGroup>
................................................................................
    71     71     <ItemGroup>
    72     72       <ClInclude Include="src\core\sqlite3.h">
    73     73         <Filter>Header Files</Filter>
    74     74       </ClInclude>
    75     75       <ClInclude Include="src\core\sqlite3ext.h">
    76     76         <Filter>Header Files</Filter>
    77     77       </ClInclude>
    78         -    <ClInclude Include="src\win\interop.h">
           78  +    <ClInclude Include="src\generic\interop.h">
    79     79         <Filter>Header Files</Filter>
    80     80       </ClInclude>
    81     81     </ItemGroup>
    82     82     <ItemGroup>
    83     83       <ResourceCompile Include="src\win\SQLite.Interop.rc">
    84     84         <Filter>Resource Files</Filter>
    85     85       </ResourceCompile>
    86     86     </ItemGroup>
    87     87   </Project>

Changes to SQLite.Interop/SQLite.Interop.Static.2005.vcproj.

  1413   1413   					>
  1414   1414   					<Tool
  1415   1415   						Name="VCCLCompilerTool"
  1416   1416   					/>
  1417   1417   				</FileConfiguration>
  1418   1418   			</File>
  1419   1419   			<File
  1420         -				RelativePath=".\src\win\interop.c"
         1420  +				RelativePath=".\src\generic\interop.c"
  1421   1421   				>
  1422   1422   			</File>
  1423   1423   			<File
  1424   1424   				RelativePath=".\src\core\sqlite3.c"
  1425   1425   				>
  1426   1426   				<FileConfiguration
  1427   1427   					Name="Debug|Win32"
................................................................................
  1499   1499   				>
  1500   1500   			</File>
  1501   1501   			<File
  1502   1502   				RelativePath=".\src\core\sqlite3ext.h"
  1503   1503   				>
  1504   1504   			</File>
  1505   1505   			<File
  1506         -				RelativePath=".\src\win\interop.h"
         1506  +				RelativePath=".\src\generic\interop.h"
  1507   1507   				>
  1508   1508   			</File>
  1509   1509   		</Filter>
  1510   1510   		<Filter
  1511   1511   			Name="Resource Files"
  1512   1512   			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
  1513   1513   			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"

Changes to SQLite.Interop/SQLite.Interop.Static.2008.vcproj.

  1413   1413   					>
  1414   1414   					<Tool
  1415   1415   						Name="VCCLCompilerTool"
  1416   1416   					/>
  1417   1417   				</FileConfiguration>
  1418   1418   			</File>
  1419   1419   			<File
  1420         -				RelativePath=".\src\win\interop.c"
         1420  +				RelativePath=".\src\generic\interop.c"
  1421   1421   				>
  1422   1422   			</File>
  1423   1423   			<File
  1424   1424   				RelativePath=".\src\core\sqlite3.c"
  1425   1425   				>
  1426   1426   				<FileConfiguration
  1427   1427   					Name="Debug|Win32"
................................................................................
  1499   1499   				>
  1500   1500   			</File>
  1501   1501   			<File
  1502   1502   				RelativePath=".\src\core\sqlite3ext.h"
  1503   1503   				>
  1504   1504   			</File>
  1505   1505   			<File
  1506         -				RelativePath=".\src\win\interop.h"
         1506  +				RelativePath=".\src\generic\interop.h"
  1507   1507   				>
  1508   1508   			</File>
  1509   1509   		</Filter>
  1510   1510   		<Filter
  1511   1511   			Name="Resource Files"
  1512   1512   			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
  1513   1513   			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"

Changes to SQLite.Interop/SQLite.Interop.Static.2010.vcxproj.

   491    491       </ClCompile>
   492    492       <ClCompile Include="src\ext\totype.c">
   493    493         <ExcludedFromBuild>true</ExcludedFromBuild>
   494    494       </ClCompile>
   495    495       <ClCompile Include="src\ext\vtshim.c">
   496    496         <ExcludedFromBuild>true</ExcludedFromBuild>
   497    497       </ClCompile>
   498         -    <ClCompile Include="src\win\interop.c" />
          498  +    <ClCompile Include="src\generic\interop.c" />
   499    499       <ClCompile Include="src\core\sqlite3.c">
   500    500         <ExcludedFromBuild>true</ExcludedFromBuild>
   501    501       </ClCompile>
   502    502     </ItemGroup>
   503    503     <ItemGroup>
   504    504       <None Include="props\SQLite.Interop.2010.props" />
   505    505       <None Include="props\sqlite3.props" />
   506    506     </ItemGroup>
   507    507     <ItemGroup>
   508    508       <ClInclude Include="src\core\sqlite3.h" />
   509    509       <ClInclude Include="src\core\sqlite3ext.h" />
   510         -    <ClInclude Include="src\win\interop.h" />
          510  +    <ClInclude Include="src\generic\interop.h" />
   511    511     </ItemGroup>
   512    512     <ItemGroup>
   513    513       <ResourceCompile Include="src\win\SQLite.Interop.rc" />
   514    514     </ItemGroup>
   515    515     <ItemGroup>
   516    516       <EmbeddedResource Include="..\System.Data.SQLite\Resources\SR.resx">
   517    517         <LogicalName>System.Data.SQLite.%(Filename).resources</LogicalName>

Changes to SQLite.Interop/SQLite.Interop.Static.2010.vcxproj.filters.

    49     49       </ClCompile>
    50     50       <ClCompile Include="src\ext\totype.c">
    51     51         <Filter>Source Files</Filter>
    52     52       </ClCompile>
    53     53       <ClCompile Include="src\ext\vtshim.c">
    54     54         <Filter>Source Files</Filter>
    55     55       </ClCompile>
    56         -    <ClCompile Include="src\win\interop.c">
           56  +    <ClCompile Include="src\generic\interop.c">
    57     57         <Filter>Source Files</Filter>
    58     58       </ClCompile>
    59     59       <ClCompile Include="src\core\sqlite3.c">
    60     60         <Filter>Source Files</Filter>
    61     61       </ClCompile>
    62     62     </ItemGroup>
    63     63     <ItemGroup>
................................................................................
    71     71     <ItemGroup>
    72     72       <ClInclude Include="src\core\sqlite3.h">
    73     73         <Filter>Header Files</Filter>
    74     74       </ClInclude>
    75     75       <ClInclude Include="src\core\sqlite3ext.h">
    76     76         <Filter>Header Files</Filter>
    77     77       </ClInclude>
    78         -    <ClInclude Include="src\win\interop.h">
           78  +    <ClInclude Include="src\generic\interop.h">
    79     79         <Filter>Header Files</Filter>
    80     80       </ClInclude>
    81     81     </ItemGroup>
    82     82     <ItemGroup>
    83     83       <ResourceCompile Include="src\win\SQLite.Interop.rc">
    84     84         <Filter>Resource Files</Filter>
    85     85       </ResourceCompile>
    86     86       <EmbeddedResource Include="..\System.Data.SQLite\Resources\SR.resx">
    87     87         <Filter>Resource Files</Filter>
    88     88       </EmbeddedResource>
    89     89     </ItemGroup>
    90     90   </Project>

Changes to SQLite.Interop/SQLite.Interop.Static.2012.vcxproj.

   498    498       </ClCompile>
   499    499       <ClCompile Include="src\ext\totype.c">
   500    500         <ExcludedFromBuild>true</ExcludedFromBuild>
   501    501       </ClCompile>
   502    502       <ClCompile Include="src\ext\vtshim.c">
   503    503         <ExcludedFromBuild>true</ExcludedFromBuild>
   504    504       </ClCompile>
   505         -    <ClCompile Include="src\win\interop.c" />
          505  +    <ClCompile Include="src\generic\interop.c" />
   506    506       <ClCompile Include="src\core\sqlite3.c">
   507    507         <ExcludedFromBuild>true</ExcludedFromBuild>
   508    508       </ClCompile>
   509    509     </ItemGroup>
   510    510     <ItemGroup>
   511    511       <None Include="props\SQLite.Interop.2012.props" />
   512    512       <None Include="props\sqlite3.props" />
   513    513     </ItemGroup>
   514    514     <ItemGroup>
   515    515       <ClInclude Include="src\core\sqlite3.h" />
   516    516       <ClInclude Include="src\core\sqlite3ext.h" />
   517         -    <ClInclude Include="src\win\interop.h" />
          517  +    <ClInclude Include="src\generic\interop.h" />
   518    518     </ItemGroup>
   519    519     <ItemGroup>
   520    520       <ResourceCompile Include="src\win\SQLite.Interop.rc" />
   521    521     </ItemGroup>
   522    522     <ItemGroup>
   523    523       <EmbeddedResource Include="..\System.Data.SQLite\Resources\SR.resx">
   524    524         <LogicalName>System.Data.SQLite.%(Filename).resources</LogicalName>

Changes to SQLite.Interop/SQLite.Interop.Static.2012.vcxproj.filters.

    49     49       </ClCompile>
    50     50       <ClCompile Include="src\ext\totype.c">
    51     51         <Filter>Source Files</Filter>
    52     52       </ClCompile>
    53     53       <ClCompile Include="src\ext\vtshim.c">
    54     54         <Filter>Source Files</Filter>
    55     55       </ClCompile>
    56         -    <ClCompile Include="src\win\interop.c">
           56  +    <ClCompile Include="src\generic\interop.c">
    57     57         <Filter>Source Files</Filter>
    58     58       </ClCompile>
    59     59       <ClCompile Include="src\core\sqlite3.c">
    60     60         <Filter>Source Files</Filter>
    61     61       </ClCompile>
    62     62     </ItemGroup>
    63     63     <ItemGroup>
................................................................................
    71     71     <ItemGroup>
    72     72       <ClInclude Include="src\core\sqlite3.h">
    73     73         <Filter>Header Files</Filter>
    74     74       </ClInclude>
    75     75       <ClInclude Include="src\core\sqlite3ext.h">
    76     76         <Filter>Header Files</Filter>
    77     77       </ClInclude>
    78         -    <ClInclude Include="src\win\interop.h">
           78  +    <ClInclude Include="src\generic\interop.h">
    79     79         <Filter>Header Files</Filter>
    80     80       </ClInclude>
    81     81     </ItemGroup>
    82     82     <ItemGroup>
    83     83       <ResourceCompile Include="src\win\SQLite.Interop.rc">
    84     84         <Filter>Resource Files</Filter>
    85     85       </ResourceCompile>
    86     86       <EmbeddedResource Include="..\System.Data.SQLite\Resources\SR.resx">
    87     87         <Filter>Resource Files</Filter>
    88     88       </EmbeddedResource>
    89     89     </ItemGroup>
    90     90   </Project>

Changes to SQLite.Interop/SQLite.Interop.Static.2013.vcxproj.

   498    498       </ClCompile>
   499    499       <ClCompile Include="src\ext\totype.c">
   500    500         <ExcludedFromBuild>true</ExcludedFromBuild>
   501    501       </ClCompile>
   502    502       <ClCompile Include="src\ext\vtshim.c">
   503    503         <ExcludedFromBuild>true</ExcludedFromBuild>
   504    504       </ClCompile>
   505         -    <ClCompile Include="src\win\interop.c" />
          505  +    <ClCompile Include="src\generic\interop.c" />
   506    506       <ClCompile Include="src\core\sqlite3.c">
   507    507         <ExcludedFromBuild>true</ExcludedFromBuild>
   508    508       </ClCompile>
   509    509     </ItemGroup>
   510    510     <ItemGroup>
   511    511       <None Include="props\SQLite.Interop.2013.props" />
   512    512       <None Include="props\sqlite3.props" />
   513    513     </ItemGroup>
   514    514     <ItemGroup>
   515    515       <ClInclude Include="src\core\sqlite3.h" />
   516    516       <ClInclude Include="src\core\sqlite3ext.h" />
   517         -    <ClInclude Include="src\win\interop.h" />
          517  +    <ClInclude Include="src\generic\interop.h" />
   518    518     </ItemGroup>
   519    519     <ItemGroup>
   520    520       <ResourceCompile Include="src\win\SQLite.Interop.rc" />
   521    521     </ItemGroup>
   522    522     <ItemGroup>
   523    523       <EmbeddedResource Include="..\System.Data.SQLite\Resources\SR.resx">
   524    524         <LogicalName>System.Data.SQLite.%(Filename).resources</LogicalName>

Changes to SQLite.Interop/SQLite.Interop.Static.2013.vcxproj.filters.

    49     49       </ClCompile>
    50     50       <ClCompile Include="src\ext\totype.c">
    51     51         <Filter>Source Files</Filter>
    52     52       </ClCompile>
    53     53       <ClCompile Include="src\ext\vtshim.c">
    54     54         <Filter>Source Files</Filter>
    55     55       </ClCompile>
    56         -    <ClCompile Include="src\win\interop.c">
           56  +    <ClCompile Include="src\generic\interop.c">
    57     57         <Filter>Source Files</Filter>
    58     58       </ClCompile>
    59     59       <ClCompile Include="src\core\sqlite3.c">
    60     60         <Filter>Source Files</Filter>
    61     61       </ClCompile>
    62     62     </ItemGroup>
    63     63     <ItemGroup>
................................................................................
    71     71     <ItemGroup>
    72     72       <ClInclude Include="src\core\sqlite3.h">
    73     73         <Filter>Header Files</Filter>
    74     74       </ClInclude>
    75     75       <ClInclude Include="src\core\sqlite3ext.h">
    76     76         <Filter>Header Files</Filter>
    77     77       </ClInclude>
    78         -    <ClInclude Include="src\win\interop.h">
           78  +    <ClInclude Include="src\generic\interop.h">
    79     79         <Filter>Header Files</Filter>
    80     80       </ClInclude>
    81     81     </ItemGroup>
    82     82     <ItemGroup>
    83     83       <ResourceCompile Include="src\win\SQLite.Interop.rc">
    84     84         <Filter>Resource Files</Filter>
    85     85       </ResourceCompile>
    86     86       <EmbeddedResource Include="..\System.Data.SQLite\Resources\SR.resx">
    87     87         <Filter>Resource Files</Filter>
    88     88       </EmbeddedResource>
    89     89     </ItemGroup>
    90     90   </Project>

Changes to SQLite.Interop/SQLite.Interop.Static.2015.vcxproj.

   498    498       </ClCompile>
   499    499       <ClCompile Include="src\ext\totype.c">
   500    500         <ExcludedFromBuild>true</ExcludedFromBuild>
   501    501       </ClCompile>
   502    502       <ClCompile Include="src\ext\vtshim.c">
   503    503         <ExcludedFromBuild>true</ExcludedFromBuild>
   504    504       </ClCompile>
   505         -    <ClCompile Include="src\win\interop.c" />
          505  +    <ClCompile Include="src\generic\interop.c" />
   506    506       <ClCompile Include="src\core\sqlite3.c">
   507    507         <ExcludedFromBuild>true</ExcludedFromBuild>
   508    508       </ClCompile>
   509    509     </ItemGroup>
   510    510     <ItemGroup>
   511    511       <None Include="props\SQLite.Interop.2015.props" />
   512    512       <None Include="props\sqlite3.props" />
   513    513     </ItemGroup>
   514    514     <ItemGroup>
   515    515       <ClInclude Include="src\core\sqlite3.h" />
   516    516       <ClInclude Include="src\core\sqlite3ext.h" />
   517         -    <ClInclude Include="src\win\interop.h" />
          517  +    <ClInclude Include="src\generic\interop.h" />
   518    518     </ItemGroup>
   519    519     <ItemGroup>
   520    520       <ResourceCompile Include="src\win\SQLite.Interop.rc" />
   521    521     </ItemGroup>
   522    522     <ItemGroup>
   523    523       <EmbeddedResource Include="..\System.Data.SQLite\Resources\SR.resx">
   524    524         <LogicalName>System.Data.SQLite.%(Filename).resources</LogicalName>

Changes to SQLite.Interop/SQLite.Interop.Static.2015.vcxproj.filters.

    49     49       </ClCompile>
    50     50       <ClCompile Include="src\ext\totype.c">
    51     51         <Filter>Source Files</Filter>
    52     52       </ClCompile>
    53     53       <ClCompile Include="src\ext\vtshim.c">
    54     54         <Filter>Source Files</Filter>
    55     55       </ClCompile>
    56         -    <ClCompile Include="src\win\interop.c">
           56  +    <ClCompile Include="src\generic\interop.c">
    57     57         <Filter>Source Files</Filter>
    58     58       </ClCompile>
    59     59       <ClCompile Include="src\core\sqlite3.c">
    60     60         <Filter>Source Files</Filter>
    61     61       </ClCompile>
    62     62     </ItemGroup>
    63     63     <ItemGroup>
................................................................................
    71     71     <ItemGroup>
    72     72       <ClInclude Include="src\core\sqlite3.h">
    73     73         <Filter>Header Files</Filter>
    74     74       </ClInclude>
    75     75       <ClInclude Include="src\core\sqlite3ext.h">
    76     76         <Filter>Header Files</Filter>
    77     77       </ClInclude>
    78         -    <ClInclude Include="src\win\interop.h">
           78  +    <ClInclude Include="src\generic\interop.h">
    79     79         <Filter>Header Files</Filter>
    80     80       </ClInclude>
    81     81     </ItemGroup>
    82     82     <ItemGroup>
    83     83       <ResourceCompile Include="src\win\SQLite.Interop.rc">
    84     84         <Filter>Resource Files</Filter>
    85     85       </ResourceCompile>
    86     86       <EmbeddedResource Include="..\System.Data.SQLite\Resources\SR.resx">
    87     87         <Filter>Resource Files</Filter>
    88     88       </EmbeddedResource>
    89     89     </ItemGroup>
    90     90   </Project>

Changes to SQLite.Interop/src/contrib/extension-functions.c.

    86     86   power.
    87     87   2007-02-07 posted by Mikey C to sqlite mailing list.
    88     88   Original code 2006 June 05 by relicoder.
    89     89   
    90     90   */
    91     91   
    92     92   /* #include "config.h" */
    93         -#include <windows.h>
           93  +#if defined(_WIN32)
           94  +#  include <windows.h>
           95  +#endif
    94     96   
    95     97   /* #define COMPILE_SQLITE_EXTENSIONS_AS_LOADABLE_MODULE */
    96     98   
    97     99   /* NOTE: More functions are available with MSVC 2013. */
    98         -#if defined(_MSC_VER) && _MSC_VER >= 1800
          100  +#if !defined(_WIN32) || (defined(_MSC_VER) && _MSC_VER >= 1800)
    99    101   #  define HAVE_ACOSH		1
   100    102   #  define HAVE_ASINH		1
   101    103   #  define HAVE_ATANH		1
   102    104   #  define HAVE_ISBLANK		1
   103    105   #endif
   104    106   
   105    107   #define HAVE_SINH		1
................................................................................
   121    123   #include <ctype.h>
   122    124   /* relicoder */
   123    125   #include <math.h>
   124    126   #include <string.h>
   125    127   #include <stdio.h>
   126    128   
   127    129   #if !defined(_WIN32_WCE) || defined(HAVE_ERRNO_H)
   128         -#include <errno.h>		/* LMH 2007-03-25 */
   129         -#else
          130  +#  include <errno.h>		/* LMH 2007-03-25 */
          131  +#elif defined(_WIN32)
   130    132   int errno;
   131         -#define strerror(x)		""
          133  +#  define strerror(x)		""
          134  +#else
          135  +#  include <errno.h>
   132    136   #endif
   133    137   
   134    138   #include <stdlib.h>
   135    139   #include <assert.h>
   136    140   
   137    141   #ifndef _MAP_H_
   138    142   #define _MAP_H_
   139    143   
   140         -/* #include <stdint.h> */
   141         -
          144  +#if defined(_WIN32)
   142    145   typedef signed char int8_t;
   143    146   typedef unsigned char uint8_t;
   144    147   typedef signed int int16_t;
   145    148   typedef unsigned int uint16_t;
   146    149   typedef signed long int int32_t;
   147    150   typedef unsigned long int uint32_t;
   148    151   typedef signed long long int int64_t;
   149    152   typedef unsigned long long int uint64_t;
          153  +#else
          154  +#  include <stdint.h>
          155  +#endif
   150    156   
   151    157   /*
   152    158   ** Simple binary tree implementation to use in median, mode and quartile calculations
   153    159   ** Tree is not necessarily balanced. That would require something like red&black trees of AVL
   154    160   */
   155    161   
   156    162   typedef int(*cmp_func)(const void *, const void *);
................................................................................
   199    205   ** compares 2 doubles
   200    206   ** to use with map_make
   201    207   */
   202    208   int double_cmp(const void *a, const void *b);
   203    209   
   204    210   #endif /* _MAP_H_ */
   205    211   
          212  +#if !defined(SQLITE_CORE)
   206    213   typedef uint8_t         u8;
   207    214   /* typedef uint16_t        u16; */
   208    215   typedef int64_t         i64;
          216  +#endif
   209    217   
   210    218   static char *sqlite3StrDup( const char *z ) {
   211    219       char *res = sqlite3_malloc( strlen(z)+1 );
   212    220       return strcpy( res, z );
   213    221   }
   214    222   
   215    223   /*
................................................................................
  1449   1457     }
  1450   1458   }
  1451   1459   
  1452   1460   /*
  1453   1461   **  Auxiliary function that iterates all elements in a map and finds the mode
  1454   1462   **  (most frequent value)
  1455   1463   */
  1456         -static void modeIterate(void* e, i64 c, void* pp){
  1457         -  i64 ei;
         1464  +static void modeIterate(void* e, int64_t c, void* pp){
         1465  +  int64_t ei;
  1458   1466     double ed;
  1459   1467     ModeCtx *p = (ModeCtx*)pp;
  1460   1468   
  1461   1469     if( 0==p->is_double ){
  1462   1470       ei = *(int*)(e);
  1463   1471   
  1464   1472   	if( p->mcnt==c ){
................................................................................
  1482   1490   }
  1483   1491   
  1484   1492   /*
  1485   1493   **  Auxiliary function that iterates all elements in a map and finds the median
  1486   1494   **  (the value such that the number of elements smaller is equal the the number of
  1487   1495   **  elements larger)
  1488   1496   */
  1489         -static void medianIterate(void* e, i64 c, void* pp){
  1490         -  i64 ei;
         1497  +static void medianIterate(void* e, int64_t c, void* pp){
         1498  +  int64_t ei;
  1491   1499     double ed;
  1492   1500     double iL;
  1493   1501     double iR;
  1494   1502     int il;
  1495   1503     int ir;
  1496   1504     ModeCtx *p = (ModeCtx*)pp;
  1497   1505   
................................................................................
  1933   1941   void map_destroy(map *m){
  1934   1942     node_destroy(m->base);
  1935   1943   }
  1936   1944   
  1937   1945   int int_cmp(const void *a, const void *b){
  1938   1946     int64_t aa = *(int64_t *)(a);
  1939   1947     int64_t bb = *(int64_t *)(b);
  1940         -  /* printf("cmp %d <=> %d\n",aa,bb); */
  1941   1948     if(aa==bb)
  1942   1949       return 0;
  1943   1950     else if(aa<bb)
  1944   1951       return -1;
  1945   1952     else
  1946   1953       return 1;
  1947   1954   }
  1948   1955   
  1949   1956   int double_cmp(const void *a, const void *b){
  1950   1957     double aa = *(double *)(a);
  1951   1958     double bb = *(double *)(b);
  1952         -  /* printf("cmp %d <=> %d\n",aa,bb); */
  1953   1959     if(aa==bb)
  1954   1960       return 0;
  1955   1961     else if(aa<bb)
  1956   1962       return -1;
  1957   1963     else
  1958   1964       return 1;
  1959   1965   }
  1960         -
  1961         -void print_elem(void *e, int64_t c, void* p){
  1962         -  int ee = *(int*)(e);
  1963         -  printf("%d => %lld\n", ee,c);
  1964         -}
  1965         -

Name change from SQLite.Interop/src/win/interop.c to SQLite.Interop/src/generic/interop.c.

     1      1   /********************************************************
     2      2    * ADO.NET 2.0 Data Provider for SQLite Version 3.X
     3      3    * Written by Robert Simpson (robert@blackcastlesoft.com)
     4      4    *
     5      5    * Released to the public domain, use at your own risk!
     6      6    ********************************************************/
     7      7   
            8  +#ifdef _WIN32
     8      9   #define SQLITE_API __declspec(dllexport)
           10  +#else
           11  +#define WINAPI
           12  +#endif
     9     13   
    10     14   #include "../core/sqlite3.c"
           15  +
           16  +#if !SQLITE_OS_WIN
           17  +#include <wchar.h>
           18  +#endif
    11     19   
    12     20   #if defined(INTEROP_INCLUDE_EXTRA)
    13     21   #include "../ext/extra.c"
    14     22   #endif
    15     23   
    16     24   #if defined(INTEROP_INCLUDE_CEROD)
    17     25   #include "../ext/cerod.c"
................................................................................
    28     36   
    29     37   #if defined(INTEROP_EXTENSION_FUNCTIONS)
    30     38   #undef COMPILE_SQLITE_EXTENSIONS_AS_LOADABLE_MODULE
    31     39   #include "../contrib/extension-functions.c"
    32     40   extern int RegisterExtensionFunctions(sqlite3 *db);
    33     41   #endif
    34     42   
    35         -#if defined(SQLITE_OS_WIN)
    36     43   #if defined(INTEROP_CODEC) && !defined(INTEROP_INCLUDE_SEE)
    37     44   #ifdef SQLITE_ENABLE_ZIPVFS
    38     45   #define INTEROP_CODEC_GET_PAGER(a,b,c) sqlite3PagerGet(a,b,c,0)
    39     46   #elif SQLITE_VERSION_NUMBER > 3009002
    40     47   #define INTEROP_CODEC_GET_PAGER(a,b,c) sqlite3PagerGet(a,b,c,0)
    41     48   #else
    42     49   #define INTEROP_CODEC_GET_PAGER(a,b,c) sqlite3PagerGet(a,b,c)
    43     50   #endif
    44         -#include "crypt.c"
           51  +#include "../win/crypt.c"
    45     52   #endif
    46     53   
    47     54   #include "interop.h"
    48     55   
    49     56   #define INTEROP_DEBUG_NONE           (0x0000)
    50     57   #define INTEROP_DEBUG_CLOSE          (0x0001)
    51     58   #define INTEROP_DEBUG_FINALIZE       (0x0002)
................................................................................
   188    195   #endif
   189    196   #if SQLITE_VERSION_NUMBER >= 3011000
   190    197     sqlite3VXPrintf(&acc, zFormat, ap);
   191    198   #else
   192    199     sqlite3VXPrintf(&acc, 0, zFormat, ap);
   193    200   #endif
   194    201     va_end(ap);
   195         -#if SQLITE_VERSION_NUMBER >= 3007013
          202  +#if SQLITE_OS_WIN && SQLITE_VERSION_NUMBER >= 3007013
   196    203     sqlite3_win32_write_debug(sqlite3StrAccumFinish(&acc), -1);
   197         -#elif defined(SQLITE_WIN32_HAS_ANSI)
          204  +#elif SQLITE_OS_WIN && defined(SQLITE_WIN32_HAS_ANSI)
   198    205     OutputDebugStringA(sqlite3StrAccumFinish(&acc));
   199         -#elif defined(SQLITE_WIN32_HAS_WIDE)
          206  +#elif SQLITE_OS_WIN && defined(SQLITE_WIN32_HAS_WIDE)
   200    207     {
   201    208       LPWSTR zWideMsg = utf8ToUnicode(sqlite3StrAccumFinish(&acc));
   202    209       if( zWideMsg ){
   203    210         OutputDebugStringW(zWideMsg);
   204    211         sqlite3_free(zWideMsg);
   205    212       }
   206    213     }
................................................................................
   897    904   SQLITE_API const void * WINAPI sqlite3_column_origin_name16_interop(sqlite3_stmt *stmt, int iCol, int *plen)
   898    905   {
   899    906     const void *pval = sqlite3_column_origin_name16(stmt, iCol);
   900    907     if (plen) *plen = pval ? wcslen((wchar_t *)pval) * sizeof(wchar_t) : 0;
   901    908     return pval;
   902    909   }
   903    910   
   904         -SQLITE_API int WINAPI sqlite3_table_column_metadata_interop(sqlite3 *db, const char *zDbName, const char *zTableName, const char *zColumnName, char **pzDataType, char **pzCollSeq, int *pNotNull, int *pPrimaryKey, int *pAutoinc, int *pdtLen, int *pcsLen)
          911  +SQLITE_API int WINAPI sqlite3_table_column_metadata_interop(sqlite3 *db, const char *zDbName, const char *zTableName, const char *zColumnName, char const **pzDataType, char const **pzCollSeq, int *pNotNull, int *pPrimaryKey, int *pAutoinc, int *pdtLen, int *pcsLen)
   905    912   {
   906    913     int n;
   907    914   
   908    915     n = sqlite3_table_column_metadata(db, zDbName, zTableName, zColumnName, pzDataType, pzCollSeq, pNotNull, pPrimaryKey, pAutoinc);
   909    916   
   910    917     if (pdtLen) *pdtLen = (pzDataType && *pzDataType) ? strlen(*pzDataType) : 0;
   911    918     if (pcsLen) *pcsLen = (pzCollSeq && *pzCollSeq) ? strlen(*pzCollSeq) : 0;
................................................................................
   954    961     int n;
   955    962     int ret = -1; /* NOT FOUND */
   956    963   
   957    964     if (!p || !db) return ret;
   958    965     sqlite3_mutex_enter(db->mutex);
   959    966     for (n = 0; n < p->nCursor && p->apCsr[n] != NULL; n++)
   960    967     {
   961         -    if (p->apCsr[n]->isTable == FALSE) continue;
          968  +    if (p->apCsr[n]->isTable == 0) continue;
   962    969       if (p->apCsr[n]->iDb != iDb) continue;
   963    970   #if SQLITE_VERSION_NUMBER >= 3010000
   964    971       if (p->apCsr[n]->uc.pCursor->pgnoRoot == tableRootPage)
   965    972   #else
   966    973       if (p->apCsr[n]->pCursor->pgnoRoot == tableRootPage)
   967    974   #endif
   968    975       {
................................................................................
  1055   1062       }
  1056   1063       break;
  1057   1064     }
  1058   1065     sqlite3_mutex_leave(db->mutex);
  1059   1066   
  1060   1067     return ret;
  1061   1068   }
  1062         -#endif /* SQLITE_OS_WIN */
  1063   1069   
  1064   1070   /*****************************************************************************/
  1065   1071   
  1066   1072   #if defined(SQLITE_CORE)
  1067   1073   #undef SQLITE_CORE
  1068   1074   #endif
  1069   1075   
................................................................................
  1096   1102   /*
  1097   1103   ** The INTEROP_TEST_EXTENSION block must be at the end of this source file
  1098   1104   ** because it includes the "sqlite3ext.h" file, which defines the sqlite3
  1099   1105   ** public API function names to be macros and that would cause the code
  1100   1106   ** above this point to malfunction.
  1101   1107   */
  1102   1108   #if defined(INTEROP_TEST_EXTENSION)
         1109  +#if !SQLITE_OS_WIN
         1110  +#include <unistd.h>
         1111  +#endif
         1112  +
  1103   1113   #include "../core/sqlite3ext.h"
  1104   1114   SQLITE_EXTENSION_INIT1
  1105   1115   
  1106   1116   /*
  1107   1117   ** The interopTest() SQL function returns its first argument or raises an
  1108   1118   ** error if there are not enough arguments.
  1109   1119   */
................................................................................
  1136   1146   ){
  1137   1147     int m;
  1138   1148     if( argc!=1 ){
  1139   1149       sqlite3_result_error(context, "need exactly one argument", -1);
  1140   1150       return;
  1141   1151     }
  1142   1152     m = sqlite3_value_int(argv[0]);
         1153  +#if SQLITE_OS_WIN
  1143   1154   #if SQLITE_OS_WINCE
  1144   1155     Sleep(m);
  1145   1156     sqlite3_result_int(context, WAIT_OBJECT_0);
  1146   1157   #else
  1147   1158     sqlite3_result_int(context, SleepEx(m, TRUE));
         1159  +#endif
         1160  +#else
         1161  +  if( m>0 ){
         1162  +    sqlite3_result_int64(context, sleep((unsigned)m));
         1163  +  }else{
         1164  +    sqlite3_result_null(context);
         1165  +  }
  1148   1166   #endif
  1149   1167   }
  1150   1168   
  1151   1169   /* SQLite invokes this routine once when it loads the extension.
  1152   1170   ** Create new functions, collating sequences, and virtual table
  1153   1171   ** modules here.  This is usually the only exported symbol in
  1154   1172   ** the shared library.
................................................................................
  1164   1182         interopTestFunc, 0, 0);
  1165   1183     if( rc==SQLITE_OK ){
  1166   1184       rc = sqlite3_create_function(db, "interopSleep", 1, SQLITE_ANY, 0,
  1167   1185           interopSleepFunc, 0, 0);
  1168   1186     }
  1169   1187     return rc;
  1170   1188   }
  1171         -#endif /* defined(SQLITE_OS_WIN) */
         1189  +#endif /* SQLITE_OS_WIN */

Name change from SQLite.Interop/src/win/interop.h to SQLite.Interop/src/generic/interop.h.


Changes to SQLite.Interop/src/win/AssemblyInfo.cpp.

     5      5    * Released to the public domain, use at your own risk!
     6      6    */
     7      7   
     8      8   using namespace System::Reflection;
     9      9   using namespace System::Resources;
    10     10   using namespace System::Runtime::InteropServices;
    11     11   
    12         -#include "interop.h"
           12  +#include "../generic/interop.h"
    13     13   
    14     14   [assembly:AssemblyTitleAttribute("SQLite.Interop")];
    15     15   [assembly:AssemblyCompanyAttribute("https://system.data.sqlite.org/")];
    16     16   [assembly:AssemblyDescriptionAttribute("System.Data.SQLite Interop Assembly")];
    17     17   [assembly:AssemblyProductAttribute("System.Data.SQLite")];
    18     18   [assembly:AssemblyCopyrightAttribute("Public Domain")];
    19     19   [assembly:AssemblyVersionAttribute(INTEROP_VERSION)];

Changes to SQLite.Interop/src/win/SQLite.Interop.rc.

    12     12   #endif /* !defined(_WIN32_WCE) */
    13     13   
    14     14   #if !defined(VS_FF_NONE)
    15     15   #  define VS_FF_NONE            0x00000000L
    16     16   #endif /* !defined(VS_FF_NONE) */
    17     17   
    18     18   #include "..\core\sqlite3.h"
    19         -#include "interop.h"
           19  +#include "..\generic\interop.h"
    20     20   
    21     21   /*
    22     22   ** English (U.S.) resources
    23     23   */
    24     24   
    25     25   #if defined(_WIN32)
    26     26   LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US

Changes to Setup/build.bat.

   366    366     )
   367    367   ) ELSE (
   368    368     ECHO WARNING: Property file modification skipped, disabled via NOPROPS environment variable.
   369    369   )
   370    370   
   371    371   IF NOT DEFINED NOTAG (
   372    372     IF EXIST Externals\Eagle\bin\EagleShell.exe (
   373         -    %__ECHO% Externals\Eagle\bin\EagleShell.exe -file Setup\sourceTag.eagle SourceIdMode SQLite.Interop\src\win\interop.h
          373  +    %__ECHO% Externals\Eagle\bin\EagleShell.exe -file Setup\sourceTag.eagle SourceIdMode SQLite.Interop\src\generic\interop.h
   374    374   
   375    375       IF ERRORLEVEL 1 (
   376         -      ECHO Source tagging of "SQLite.Interop\src\win\interop.h" failed.
          376  +      ECHO Source tagging of "SQLite.Interop\src\generic\interop.h" failed.
   377    377         GOTO errors
   378    378       )
   379    379   
   380    380       %__ECHO% Externals\Eagle\bin\EagleShell.exe -file Setup\sourceTag.eagle SourceIdMode System.Data.SQLite\SQLitePatchLevel.cs
   381    381   
   382    382       IF ERRORLEVEL 1 (
   383    383         ECHO Source tagging of "System.Data.SQLite\SQLitePatchLevel.cs" failed.

Changes to Setup/build_mono.bat.

    30     30   
    31     31   %_VECHO% Tools = '%TOOLS%'
    32     32   
    33     33   SET BUILD_CONFIGURATIONS=DebugManagedOnly ReleaseManagedOnly
    34     34   SET PLATFORMS="Any CPU"
    35     35   SET YEARS=2008 2013
    36     36   SET NOUSER=1
    37         -SET MSBUILD_ARGS=/property:UseInteropDll=false
    38         -SET MSBUILD_ARGS=%MSBUILD_ARGS% /property:UseSqliteStandard=true
           37  +SET MSBUILD_ARGS=/property:UseSqliteStandardLibraryName=true
    39     38   SET MSBUILD_ARGS=%MSBUILD_ARGS% /property:InteropCodec=false
    40         -SET MSBUILD_ARGS=%MSBUILD_ARGS% /property:InteropExtensionFunctions=false
    41         -SET MSBUILD_ARGS=%MSBUILD_ARGS% /property:InteropVirtualTable=false
    42         -SET MSBUILD_ARGS=%MSBUILD_ARGS% /property:InteropTestExtension=false
           39  +SET MSBUILD_ARGS=%MSBUILD_ARGS% /property:InteropLog=false
    43     40   
    44     41   CALL :fn_ResetErrorLevel
    45     42   
    46     43   %__ECHO3% CALL "%TOOLS%\build_all.bat"
    47     44   
    48     45   IF ERRORLEVEL 1 (
    49     46     ECHO Failed to build Mono binaries.

Changes to Setup/data/verify.lst.

   505    505     SQLite.Interop/src/ext/
   506    506     SQLite.Interop/src/ext/fts5.c
   507    507     SQLite.Interop/src/ext/json1.c
   508    508     SQLite.Interop/src/ext/percentile.c
   509    509     SQLite.Interop/src/ext/regexp.c
   510    510     SQLite.Interop/src/ext/totype.c
   511    511     SQLite.Interop/src/ext/vtshim.c
          512  +  SQLite.Interop/src/generic/interop.c
          513  +  SQLite.Interop/src/generic/interop.h
   512    514     SQLite.Interop/src/win/
   513    515     SQLite.Interop/src/win/AssemblyInfo.cpp
   514    516     SQLite.Interop/src/win/crypt.c
   515         -  SQLite.Interop/src/win/interop.c
   516         -  SQLite.Interop/src/win/interop.h
   517    517     SQLite.Interop/src/win/SQLite.Interop.rc
   518    518     SQLite.NET.2005.MSBuild.sln
   519    519     SQLite.NET.2005.sln
   520    520     SQLite.NET.2008.MSBuild.sln
   521    521     SQLite.NET.2008.sln
   522    522     SQLite.NET.2010.MSBuild.sln
   523    523     SQLite.NET.2010.sln

Changes to System.Data.SQLite/Configurations/System.Data.SQLite.dll.config.

    83     83                 useful in ASP.NET and other hosted environments where direct
    84     84                 control of the location of the managed assemblies is not under
    85     85                 the control of the application.
    86     86       -->
    87     87       <!--
    88     88       <add key="PreLoadSQLite_BaseDirectory" value="" />
    89     89       -->
           90  +
           91  +    <!--
           92  +        NOTE: If this configuration variable is set [to anything], it will be
           93  +              used as the base file name (without directory information) for
           94  +              the native SQLite library to be pre-loaded (e.g. "sqlite3.dll"
           95  +              or "libsqlite3.so.0").
           96  +    -->
           97  +    <!--
           98  +    <add key="PreLoadSQLite_LibraryFileNameOnly" value="" />
           99  +    -->
    90    100   
    91    101       <!--
    92    102           NOTE: If this configuration variable is set [to anything], it will be
    93    103                 used instead of the processor architecture value contained in the
    94    104                 PROCESSOR_ARCHITECTURE environment variable to help build the
    95    105                 path of the native library to pre-load.
    96    106       -->

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

    56     56           string version =
    57     57   #if NET_40 || NET_45 || NET_451 || NET_452 || NET_46 || NET_461
    58     58               "4.0.0.0";
    59     59   #else
    60     60               "3.5.0.0";
    61     61   #endif
    62     62   
    63         -        _dbProviderServicesType = Type.GetType(UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "System.Data.Common.DbProviderServices, System.Data.Entity, Version={0}, Culture=neutral, PublicKeyToken=b77a5c561934e089", version), false);
           63  +        _dbProviderServicesType = Type.GetType(HelperMethods.StringFormat(CultureInfo.InvariantCulture, "System.Data.Common.DbProviderServices, System.Data.Entity, Version={0}, Culture=neutral, PublicKeyToken=b77a5c561934e089", version), false);
    64     64       }
    65     65   
    66     66       /// <summary>
    67     67       /// Will provide a <see cref="IServiceProvider" /> object in .NET 3.5.
    68     68       /// </summary>
    69     69       /// <param name="serviceType">The class or interface type to query for.</param>
    70     70       /// <returns></returns>
................................................................................
    86     86               string typeName = UnsafeNativeMethods.GetSettingValue(
    87     87                   "TypeName_SQLiteProviderServices", null);
    88     88   
    89     89               Version version = this.GetType().Assembly.GetName().Version;
    90     90   
    91     91               if (typeName != null)
    92     92               {
    93         -                typeName = UnsafeNativeMethods.StringFormat(
           93  +                typeName = HelperMethods.StringFormat(
    94     94                       CultureInfo.InvariantCulture, typeName, version);
    95     95               }
    96     96               else
    97     97               {
    98         -                typeName = UnsafeNativeMethods.StringFormat(
           98  +                typeName = HelperMethods.StringFormat(
    99     99                       CultureInfo.InvariantCulture, DefaultTypeName, version);
   100    100               }
   101    101   
   102    102               Type type = Type.GetType(typeName, false);
   103    103   
   104    104               if (type != null)
   105    105               {

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

    77     77   
    78     78       /// <summary>
    79     79       /// The user-defined functions registered on this connection
    80     80       /// </summary>
    81     81       protected Dictionary<SQLiteFunctionAttribute, SQLiteFunction> _functions;
    82     82   
    83     83   #if INTEROP_VIRTUAL_TABLE
           84  +    /// <summary>
           85  +    /// This is the name of the native library file that contains the
           86  +    /// "vtshim" extension [wrapper].
           87  +    /// </summary>
           88  +    protected string _shimExtensionFileName = null;
           89  +
           90  +    /// <summary>
           91  +    /// This is the flag indicate whether the native library file that
           92  +    /// contains the "vtshim" extension must be dynamically loaded by
           93  +    /// this class prior to use.
           94  +    /// </summary>
           95  +    protected bool? _shimIsLoadNeeded = null;
           96  +
           97  +    /// <summary>
           98  +    /// This is the name of the native entry point for the "vtshim"
           99  +    /// extension [wrapper].
          100  +    /// </summary>
          101  +    protected string _shimExtensionProcName = "sqlite3_vtshim_init";
          102  +
    84    103       /// <summary>
    85    104       /// The modules created using this connection.
    86    105       /// </summary>
    87    106       protected Dictionary<string, SQLiteModule> _modules;
    88    107   #endif
    89    108   
    90    109       ///////////////////////////////////////////////////////////////////////////////////////////////
................................................................................
   244    263                 if (SQLiteBase.ResetConnection(_sql, _sql, canThrow))
   245    264                 {
   246    265                     if (unbindFunctions)
   247    266                     {
   248    267                         if (SQLiteFunction.UnbindAllFunctions(this, _flags, false))
   249    268                         {
   250    269   #if !NET_COMPACT_20 && TRACE_CONNECTION
   251         -                          Trace.WriteLine(UnsafeNativeMethods.StringFormat(
          270  +                          Trace.WriteLine(HelperMethods.StringFormat(
   252    271                                 CultureInfo.CurrentCulture,
   253    272                                 "UnbindFunctions (Pool) Success: {0}",
   254    273                                 HandleToString()));
   255    274   #endif
   256    275                         }
   257    276                         else
   258    277                         {
   259    278   #if !NET_COMPACT_20 && TRACE_CONNECTION
   260         -                          Trace.WriteLine(UnsafeNativeMethods.StringFormat(
          279  +                          Trace.WriteLine(HelperMethods.StringFormat(
   261    280                                 CultureInfo.CurrentCulture,
   262    281                                 "UnbindFunctions (Pool) Failure: {0}",
   263    282                                 HandleToString()));
   264    283   #endif
   265    284                         }
   266    285                     }
   267    286   
................................................................................
   273    292   
   274    293                     SQLiteConnection.OnChanged(null, new ConnectionEventArgs(
   275    294                         SQLiteConnectionEventType.ClosedToPool, null, null,
   276    295                         null, null, _sql, _fileName, new object[] {
   277    296                         typeof(SQLite3), canThrow, _fileName, _poolVersion }));
   278    297   
   279    298   #if !NET_COMPACT_20 && TRACE_CONNECTION
   280         -                  Trace.WriteLine(UnsafeNativeMethods.StringFormat(
          299  +                  Trace.WriteLine(HelperMethods.StringFormat(
   281    300                         CultureInfo.CurrentCulture,
   282    301                         "Close (Pool) Success: {0}",
   283    302                         HandleToString()));
   284    303   #endif
   285    304                 }
   286    305   #if !NET_COMPACT_20 && TRACE_CONNECTION
   287    306                 else
   288    307                 {
   289         -                  Trace.WriteLine(UnsafeNativeMethods.StringFormat(
          308  +                  Trace.WriteLine(HelperMethods.StringFormat(
   290    309                         CultureInfo.CurrentCulture,
   291    310                         "Close (Pool) Failure: {0}",
   292    311                         HandleToString()));
   293    312                 }
   294    313   #endif
   295    314             }
   296    315             else
   297    316             {
   298    317                 if (unbindFunctions)
   299    318                 {
   300    319                     if (SQLiteFunction.UnbindAllFunctions(this, _flags, false))
   301    320                     {
   302    321   #if !NET_COMPACT_20 && TRACE_CONNECTION
   303         -                      Trace.WriteLine(UnsafeNativeMethods.StringFormat(
          322  +                      Trace.WriteLine(HelperMethods.StringFormat(
   304    323                             CultureInfo.CurrentCulture,
   305    324                             "UnbindFunctions Success: {0}",
   306    325                             HandleToString()));
   307    326   #endif
   308    327                     }
   309    328                     else
   310    329                     {
   311    330   #if !NET_COMPACT_20 && TRACE_CONNECTION
   312         -                      Trace.WriteLine(UnsafeNativeMethods.StringFormat(
          331  +                      Trace.WriteLine(HelperMethods.StringFormat(
   313    332                             CultureInfo.CurrentCulture,
   314    333                             "UnbindFunctions Failure: {0}",
   315    334                             HandleToString()));
   316    335   #endif
   317    336                     }
   318    337                 }
   319    338   
................................................................................
   905    924           SQLiteConnection.OnChanged(null, new ConnectionEventArgs(
   906    925               SQLiteConnectionEventType.OpenedFromPool, null, null,
   907    926               null, null, _sql, strFilename, new object[] {
   908    927               typeof(SQLite3), strFilename, vfsName, connectionFlags,
   909    928               openFlags, maxPoolSize, usePool, _poolVersion }));
   910    929   
   911    930   #if !NET_COMPACT_20 && TRACE_CONNECTION
   912         -        Trace.WriteLine(UnsafeNativeMethods.StringFormat(
          931  +        Trace.WriteLine(HelperMethods.StringFormat(
   913    932               CultureInfo.CurrentCulture,
   914    933               "Open (Pool): {0}", HandleToString()));
   915    934   #endif
   916    935         }
   917    936   
   918    937         if (_sql == null)
   919    938         {
................................................................................
   936    955             else
   937    956   #endif
   938    957             {
   939    958               n = UnsafeNativeMethods.sqlite3_open_v2(ToUTF8(strFilename), ref db, openFlags, ToUTF8(vfsName));
   940    959             }
   941    960   
   942    961   #if !NET_COMPACT_20 && TRACE_CONNECTION
   943         -          Trace.WriteLine(UnsafeNativeMethods.StringFormat(
          962  +          Trace.WriteLine(HelperMethods.StringFormat(
   944    963                 CultureInfo.CurrentCulture,
   945    964                 "Open: {0}", db));
   946    965   #endif
   947    966   
   948    967             if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, null);
   949    968             _sql = new SQLiteConnectionHandle(db, true);
   950    969           }
................................................................................
  1262   1281           //       data classes.
  1263   1282           //
  1264   1283           string baseSchemaName = (cnn != null) ? cnn._baseSchemaName : null;
  1265   1284   
  1266   1285           if (!String.IsNullOrEmpty(baseSchemaName))
  1267   1286           {
  1268   1287             strSql = strSql.Replace(
  1269         -              UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture,
         1288  +              HelperMethods.StringFormat(CultureInfo.InvariantCulture,
  1270   1289                 "[{0}].", baseSchemaName), String.Empty);
  1271   1290   
  1272   1291             strSql = strSql.Replace(
  1273         -              UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture,
         1292  +              HelperMethods.StringFormat(CultureInfo.InvariantCulture,
  1274   1293                 "{0}.", baseSchemaName), String.Empty);
  1275   1294           }
  1276   1295         }
  1277   1296   
  1278   1297         SQLiteConnectionFlags flags =
  1279   1298             (cnn != null) ? cnn.Flags : SQLiteConnectionFlags.Default;
  1280   1299   
................................................................................
  1283   1302             ForceLogPrepare() ||
  1284   1303   #endif
  1285   1304             ((flags & SQLiteConnectionFlags.LogPrepare) == SQLiteConnectionFlags.LogPrepare))
  1286   1305         {
  1287   1306             if ((strSql == null) || (strSql.Length == 0) || (strSql.Trim().Length == 0))
  1288   1307                 SQLiteLog.LogMessage("Preparing {<nothing>}...");
  1289   1308             else
  1290         -              SQLiteLog.LogMessage(UnsafeNativeMethods.StringFormat(
         1309  +              SQLiteLog.LogMessage(HelperMethods.StringFormat(
  1291   1310                     CultureInfo.CurrentCulture, "Preparing {{{0}}}...", strSql));
  1292   1311         }
  1293   1312   
  1294   1313         IntPtr stmt = IntPtr.Zero;
  1295   1314         IntPtr ptr = IntPtr.Zero;
  1296   1315         int len = 0;
  1297   1316         SQLiteErrorCode n = SQLiteErrorCode.Schema;
................................................................................
  1330   1349   #else
  1331   1350               n = UnsafeNativeMethods.sqlite3_prepare(_sql, psql, b.Length - 1, ref stmt, ref ptr);
  1332   1351   #endif
  1333   1352               len = -1;
  1334   1353   #endif
  1335   1354   
  1336   1355   #if !NET_COMPACT_20 && TRACE_STATEMENT
  1337         -            Trace.WriteLine(UnsafeNativeMethods.StringFormat(
         1356  +            Trace.WriteLine(HelperMethods.StringFormat(
  1338   1357                   CultureInfo.CurrentCulture,
  1339   1358                   "Prepare ({0}): {1}", n, stmt));
  1340   1359   #endif
  1341   1360   
  1342   1361               if ((n == SQLiteErrorCode.Ok) && (stmt != IntPtr.Zero))
  1343   1362               {
  1344   1363                 if (statementHandle != null) statementHandle.Dispose();
................................................................................
  1466   1485         }
  1467   1486       }
  1468   1487   
  1469   1488       protected static void LogBind(SQLiteStatementHandle handle, int index)
  1470   1489       {
  1471   1490           IntPtr handleIntPtr = handle;
  1472   1491   
  1473         -        SQLiteLog.LogMessage(UnsafeNativeMethods.StringFormat(
         1492  +        SQLiteLog.LogMessage(HelperMethods.StringFormat(
  1474   1493               CultureInfo.CurrentCulture,
  1475   1494               "Binding statement {0} paramter #{1} as NULL...",
  1476   1495               handleIntPtr, index));
  1477   1496       }
  1478   1497   
  1479   1498       protected static void LogBind(SQLiteStatementHandle handle, int index, ValueType value)
  1480   1499       {
  1481   1500           IntPtr handleIntPtr = handle;
  1482   1501   
  1483         -        SQLiteLog.LogMessage(UnsafeNativeMethods.StringFormat(
         1502  +        SQLiteLog.LogMessage(HelperMethods.StringFormat(
  1484   1503               CultureInfo.CurrentCulture,
  1485   1504               "Binding statement {0} paramter #{1} as type {2} with value {{{3}}}...",
  1486   1505               handleIntPtr, index, value.GetType(), value));
  1487   1506       }
  1488   1507   
  1489   1508       private static string FormatDateTime(DateTime value)
  1490   1509       {
................................................................................
  1499   1518           return result.ToString();
  1500   1519       }
  1501   1520   
  1502   1521       protected static void LogBind(SQLiteStatementHandle handle, int index, DateTime value)
  1503   1522       {
  1504   1523           IntPtr handleIntPtr = handle;
  1505   1524   
  1506         -        SQLiteLog.LogMessage(UnsafeNativeMethods.StringFormat(
         1525  +        SQLiteLog.LogMessage(HelperMethods.StringFormat(
  1507   1526               CultureInfo.CurrentCulture,
  1508   1527               "Binding statement {0} paramter #{1} as type {2} with value {{{3}}}...",
  1509   1528               handleIntPtr, index, typeof(DateTime), FormatDateTime(value)));
  1510   1529       }
  1511   1530   
  1512   1531       protected static void LogBind(SQLiteStatementHandle handle, int index, string value)
  1513   1532       {
  1514   1533           IntPtr handleIntPtr = handle;
  1515   1534   
  1516         -        SQLiteLog.LogMessage(UnsafeNativeMethods.StringFormat(
         1535  +        SQLiteLog.LogMessage(HelperMethods.StringFormat(
  1517   1536               CultureInfo.CurrentCulture,
  1518   1537               "Binding statement {0} paramter #{1} as type {2} with value {{{3}}}...",
  1519   1538               handleIntPtr, index, typeof(String), (value != null) ? value : "<null>"));
  1520   1539       }
  1521   1540   
  1522   1541       private static string ToHexadecimalString(
  1523   1542           byte[] array
................................................................................
  1536   1555           return result.ToString();
  1537   1556       }
  1538   1557   
  1539   1558       protected static void LogBind(SQLiteStatementHandle handle, int index, byte[] value)
  1540   1559       {
  1541   1560           IntPtr handleIntPtr = handle;
  1542   1561   
  1543         -        SQLiteLog.LogMessage(UnsafeNativeMethods.StringFormat(
         1562  +        SQLiteLog.LogMessage(HelperMethods.StringFormat(
  1544   1563               CultureInfo.CurrentCulture,
  1545   1564               "Binding statement {0} paramter #{1} as type {2} with value {{{3}}}...",
  1546   1565               handleIntPtr, index, typeof(Byte[]), (value != null) ? ToHexadecimalString(value) : "<null>"));
  1547   1566       }
  1548   1567   
  1549   1568       internal override void Bind_Double(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, double value)
  1550   1569       {
................................................................................
  1817   1836           SQLiteStatementHandle handle = stmt._sqlite_stmt;
  1818   1837           int value = UnsafeNativeMethods.sqlite3_bind_parameter_count(handle);
  1819   1838   
  1820   1839           if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind)
  1821   1840           {
  1822   1841               IntPtr handleIntPtr = handle;
  1823   1842   
  1824         -            SQLiteLog.LogMessage(UnsafeNativeMethods.StringFormat(
         1843  +            SQLiteLog.LogMessage(HelperMethods.StringFormat(
  1825   1844                   CultureInfo.CurrentCulture,
  1826   1845                   "Statement {0} paramter count is {1}.",
  1827   1846                   handleIntPtr, value));
  1828   1847           }
  1829   1848   
  1830   1849           return value;
  1831   1850       }
................................................................................
  1842   1861           name = UTF8ToString(UnsafeNativeMethods.sqlite3_bind_parameter_name(handle, index), -1);
  1843   1862   #endif
  1844   1863   
  1845   1864           if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind)
  1846   1865           {
  1847   1866               IntPtr handleIntPtr = handle;
  1848   1867   
  1849         -            SQLiteLog.LogMessage(UnsafeNativeMethods.StringFormat(
         1868  +            SQLiteLog.LogMessage(HelperMethods.StringFormat(
  1850   1869                   CultureInfo.CurrentCulture,
  1851   1870                   "Statement {0} paramter #{1} name is {{{2}}}.",
  1852   1871                   handleIntPtr, index, name));
  1853   1872           }
  1854   1873   
  1855   1874           return name;
  1856   1875       }
................................................................................
  1860   1879           SQLiteStatementHandle handle = stmt._sqlite_stmt;
  1861   1880           int index = UnsafeNativeMethods.sqlite3_bind_parameter_index(handle, ToUTF8(paramName));
  1862   1881   
  1863   1882           if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind)
  1864   1883           {
  1865   1884               IntPtr handleIntPtr = handle;
  1866   1885   
  1867         -            SQLiteLog.LogMessage(UnsafeNativeMethods.StringFormat(
         1886  +            SQLiteLog.LogMessage(HelperMethods.StringFormat(
  1868   1887                   CultureInfo.CurrentCulture,
  1869   1888                   "Statement {0} paramter index of name {{{1}}} is #{2}.",
  1870   1889                   handleIntPtr, paramName, index));
  1871   1890           }
  1872   1891   
  1873   1892           return index;
  1874   1893       }
................................................................................
  1898   1917       internal override TypeAffinity ColumnAffinity(SQLiteStatement stmt, int index)
  1899   1918       {
  1900   1919         return UnsafeNativeMethods.sqlite3_column_type(stmt._sqlite_stmt, index);
  1901   1920       }
  1902   1921   
  1903   1922       internal override string ColumnType(SQLiteStatement stmt, int index, ref TypeAffinity nAffinity)
  1904   1923       {
  1905         -      int len;
         1924  +        int len;
  1906   1925   #if !SQLITE_STANDARD
  1907         -      len = 0;
  1908         -      IntPtr p = UnsafeNativeMethods.sqlite3_column_decltype_interop(stmt._sqlite_stmt, index, ref len);
         1926  +        len = 0;
         1927  +        IntPtr p = UnsafeNativeMethods.sqlite3_column_decltype_interop(stmt._sqlite_stmt, index, ref len);
  1909   1928   #else
  1910         -      len = -1;
  1911         -      IntPtr p = UnsafeNativeMethods.sqlite3_column_decltype(stmt._sqlite_stmt, index);
         1929  +        len = -1;
         1930  +        IntPtr p = UnsafeNativeMethods.sqlite3_column_decltype(stmt._sqlite_stmt, index);
  1912   1931   #endif
  1913         -      nAffinity = ColumnAffinity(stmt, index);
         1932  +        nAffinity = ColumnAffinity(stmt, index);
  1914   1933   
  1915         -      if (p != IntPtr.Zero) return UTF8ToString(p, len);
  1916         -      else
  1917         -      {
         1934  +        if ((p != IntPtr.Zero) && ((len > 0) || (len == -1)))
         1935  +        {
         1936  +            string declType = UTF8ToString(p, len);
         1937  +
         1938  +            if (!String.IsNullOrEmpty(declType))
         1939  +                return declType;
         1940  +        }
         1941  +
  1918   1942           string[] ar = stmt.TypeDefinitions;
         1943  +
  1919   1944           if (ar != null)
  1920   1945           {
  1921         -          if (index < ar.Length && ar[index] != null)
  1922         -            return ar[index];
         1946  +            if (index < ar.Length && ar[index] != null)
         1947  +                return ar[index];
  1923   1948           }
         1949  +
  1924   1950           return String.Empty;
  1925         -
  1926         -        //switch (nAffinity)
  1927         -        //{
  1928         -        //  case TypeAffinity.Int64:
  1929         -        //    return "BIGINT";
  1930         -        //  case TypeAffinity.Double:
  1931         -        //    return "DOUBLE";
  1932         -        //  case TypeAffinity.Blob:
  1933         -        //    return "BLOB";
  1934         -        //  default:
  1935         -        //    return "TEXT";
  1936         -        //}
  1937         -      }
  1938   1951       }
  1939   1952   
  1940   1953       internal override int ColumnIndex(SQLiteStatement stmt, string columnName)
  1941   1954       {
  1942   1955         int x = ColumnCount(stmt);
  1943   1956   
  1944   1957         for (int n = 0; n < x; n++)
................................................................................
  2419   2432       internal override void ReturnText(IntPtr context, string value)
  2420   2433       {
  2421   2434         byte[] b = ToUTF8(value);
  2422   2435         UnsafeNativeMethods.sqlite3_result_text(context, ToUTF8(value), b.Length - 1, (IntPtr)(-1));
  2423   2436       }
  2424   2437   
  2425   2438   #if INTEROP_VIRTUAL_TABLE
         2439  +    /// <summary>
         2440  +    /// Determines the file name of the native library containing the native
         2441  +    /// "vtshim" extension -AND- whether it should be dynamically loaded by
         2442  +    /// this class.
         2443  +    /// </summary>
         2444  +    /// <param name="isLoadNeeded">
         2445  +    /// This output parameter will be set to non-zero if the returned native
         2446  +    /// library file name should be dynamically loaded prior to attempting
         2447  +    /// the creation of native disposable extension modules.
         2448  +    /// </param>
         2449  +    /// <returns>
         2450  +    /// The file name of the native library containing the native "vtshim"
         2451  +    /// extension -OR- null if it cannot be determined.
         2452  +    /// </returns>
         2453  +    private string GetShimExtensionFileName(
         2454  +        ref bool isLoadNeeded /* out */
         2455  +        )
         2456  +    {
         2457  +        if (_shimIsLoadNeeded != null)
         2458  +            isLoadNeeded = (bool)_shimIsLoadNeeded;
         2459  +        else
         2460  +            isLoadNeeded = HelperMethods.IsWindows(); /* COMPAT */
         2461  +
         2462  +        string fileName = _shimExtensionFileName;
         2463  +
         2464  +        if (fileName != null)
         2465  +            return fileName;
         2466  +
         2467  +#if (SQLITE_STANDARD || USE_INTEROP_DLL || PLATFORM_COMPACTFRAMEWORK) && PRELOAD_NATIVE_LIBRARY
         2468  +        return UnsafeNativeMethods.GetNativeLibraryFileNameOnly(); /* COMPAT */
         2469  +#else
         2470  +        return null;
         2471  +#endif
         2472  +    }
         2473  +
  2426   2474       /// <summary>
  2427   2475       /// Calls the native SQLite core library in order to create a disposable
  2428   2476       /// module containing the implementation of a virtual table.
  2429   2477       /// </summary>
  2430   2478       /// <param name="module">
  2431   2479       /// The module object to be used when creating the native disposable module.
  2432   2480       /// </param>
................................................................................
  2443   2491               module.LogErrors = ((flags & SQLiteConnectionFlags.LogModuleError) == SQLiteConnectionFlags.LogModuleError);
  2444   2492               module.LogExceptions = ((flags & SQLiteConnectionFlags.LogModuleException) == SQLiteConnectionFlags.LogModuleException);
  2445   2493           }
  2446   2494   
  2447   2495           if (_sql == null)
  2448   2496               throw new SQLiteException("connection has an invalid handle");
  2449   2497   
  2450         -        SetLoadExtension(true);
  2451         -        LoadExtension(UnsafeNativeMethods.SQLITE_DLL, "sqlite3_vtshim_init");
         2498  +        bool isLoadNeeded = false;
         2499  +        string fileName = GetShimExtensionFileName(ref isLoadNeeded);
         2500  +
         2501  +        if (isLoadNeeded)
         2502  +        {
         2503  +            if (fileName == null)
         2504  +                throw new SQLiteException("the file name for the \"vtshim\" extension is unknown");
         2505  +
         2506  +            if (_shimExtensionProcName == null)
         2507  +                throw new SQLiteException("the entry point for the \"vtshim\" extension is unknown");
         2508  +
         2509  +            SetLoadExtension(true);
         2510  +            LoadExtension(fileName, _shimExtensionProcName);
         2511  +        }
  2452   2512   
  2453   2513           if (module.CreateDisposableModule(_sql))
  2454   2514           {
  2455   2515               if (_modules == null)
  2456   2516                   _modules = new Dictionary<string, SQLiteModule>();
  2457   2517   
  2458   2518               _modules.Add(module.Name, module);
  2459   2519   
  2460   2520               if (_usePool)
  2461   2521               {
  2462   2522                   _usePool = false;
  2463   2523   
  2464   2524   #if !NET_COMPACT_20 && TRACE_CONNECTION
  2465         -                Trace.WriteLine(UnsafeNativeMethods.StringFormat(
         2525  +                Trace.WriteLine(HelperMethods.StringFormat(
  2466   2526                       CultureInfo.CurrentCulture,
  2467   2527                       "CreateModule (Pool) Disabled: {0}",
  2468   2528                       HandleToString()));
  2469   2529   #endif
  2470   2530               }
  2471   2531           }
  2472   2532           else
................................................................................
  2711   2771         if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError());
  2712   2772   
  2713   2773         if (_usePool)
  2714   2774         {
  2715   2775           _usePool = false;
  2716   2776   
  2717   2777   #if !NET_COMPACT_20 && TRACE_CONNECTION
  2718         -        Trace.WriteLine(UnsafeNativeMethods.StringFormat(
         2778  +        Trace.WriteLine(HelperMethods.StringFormat(
  2719   2779             CultureInfo.CurrentCulture,
  2720   2780             "SetPassword (Pool) Disabled: {0}",
  2721   2781             HandleToString()));
  2722   2782   #endif
  2723   2783         }
  2724   2784       }
  2725   2785   
................................................................................
  2729   2789         if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError());
  2730   2790   
  2731   2791         if (_usePool)
  2732   2792         {
  2733   2793           _usePool = false;
  2734   2794   
  2735   2795   #if !NET_COMPACT_20 && TRACE_CONNECTION
  2736         -        Trace.WriteLine(UnsafeNativeMethods.StringFormat(
         2796  +        Trace.WriteLine(HelperMethods.StringFormat(
  2737   2797             CultureInfo.CurrentCulture,
  2738   2798             "ChangePassword (Pool) Disabled: {0}",
  2739   2799             HandleToString()));
  2740   2800   #endif
  2741   2801         }
  2742   2802       }
  2743   2803   #endif

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

   159    159               SQLiteConnectionEventType.OpenedFromPool, null, null,
   160    160               null, null, _sql, strFilename, new object[] {
   161    161               typeof(SQLite3_UTF16), strFilename, vfsName,
   162    162               connectionFlags, openFlags, maxPoolSize, usePool,
   163    163               _poolVersion }));
   164    164   
   165    165   #if !NET_COMPACT_20 && TRACE_CONNECTION
   166         -        Trace.WriteLine(UnsafeNativeMethods.StringFormat(
          166  +        Trace.WriteLine(HelperMethods.StringFormat(
   167    167               CultureInfo.CurrentCulture,
   168    168               "Open16 (Pool): {0}",
   169    169               HandleToString()));
   170    170   #endif
   171    171         }
   172    172   
   173    173         if (_sql == null)
................................................................................
   198    198               //       a flags parameter.
   199    199               //
   200    200               if (((openFlags & SQLiteOpenFlagsEnum.Create) != SQLiteOpenFlagsEnum.Create) && !File.Exists(strFilename))
   201    201                 throw new SQLiteException(SQLiteErrorCode.CantOpen, strFilename);
   202    202   
   203    203               if (vfsName != null)
   204    204               {
   205         -              throw new SQLiteException(SQLiteErrorCode.CantOpen, UnsafeNativeMethods.StringFormat(
          205  +              throw new SQLiteException(SQLiteErrorCode.CantOpen, HelperMethods.StringFormat(
   206    206                   CultureInfo.CurrentCulture,
   207    207                   "cannot open using UTF-16 and VFS \"{0}\": need interop assembly", vfsName));
   208    208               }
   209    209   
   210    210               n = UnsafeNativeMethods.sqlite3_open16(strFilename, ref db);
   211    211             }
   212    212   
   213    213   #if !NET_COMPACT_20 && TRACE_CONNECTION
   214         -          Trace.WriteLine(UnsafeNativeMethods.StringFormat(
          214  +          Trace.WriteLine(HelperMethods.StringFormat(
   215    215                 CultureInfo.CurrentCulture,
   216    216                 "Open16: {0}", db));
   217    217   #endif
   218    218   
   219    219             if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, null);
   220    220             _sql = new SQLiteConnectionHandle(db, true);
   221    221           }

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

   104    104       /// <summary>
   105    105       /// Returns a valid named parameter
   106    106       /// </summary>
   107    107       /// <param name="parameterName">The name of the parameter</param>
   108    108       /// <returns>Error</returns>
   109    109       protected override string GetParameterName(string parameterName)
   110    110       {
   111         -      return UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "@{0}", parameterName);
          111  +      return HelperMethods.StringFormat(CultureInfo.InvariantCulture, "@{0}", parameterName);
   112    112       }
   113    113   
   114    114       /// <summary>
   115    115       /// Returns a named parameter for the given ordinal
   116    116       /// </summary>
   117    117       /// <param name="parameterOrdinal">The i of the parameter</param>
   118    118       /// <returns>Error</returns>
   119    119       protected override string GetParameterName(int parameterOrdinal)
   120    120       {
   121         -      return UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "@param{0}", parameterOrdinal);
          121  +      return HelperMethods.StringFormat(CultureInfo.InvariantCulture, "@param{0}", parameterOrdinal);
   122    122       }
   123    123   
   124    124       /// <summary>
   125    125       /// Returns a placeholder character for the specified parameter i.
   126    126       /// </summary>
   127    127       /// <param name="parameterOrdinal">The index of the parameter to provide a placeholder for</param>
   128    128       /// <returns>Returns a named parameter</returns>

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

   934    934             {
   935    935               string str = row[0].ToString();
   936    936               if (String.Compare(str, "main", StringComparison.OrdinalIgnoreCase) != 0
   937    937                 && String.Compare(str, "temp", StringComparison.OrdinalIgnoreCase) != 0)
   938    938               {
   939    939                 using (SQLiteCommand cmd = CreateCommand())
   940    940                 {
   941         -                cmd.CommandText = UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "ATTACH DATABASE '{0}' AS [{1}]", row[1], row[0]);
          941  +                cmd.CommandText = HelperMethods.StringFormat(CultureInfo.InvariantCulture, "ATTACH DATABASE '{0}' AS [{1}]", row[1], row[0]);
   942    942                   cmd.ExecuteNonQuery();
   943    943                 }
   944    944               }
   945    945             }
   946    946           }
   947    947         }
   948    948       }
................................................................................
  1167   1167                       break;
  1168   1168               }
  1169   1169           }
  1170   1170           catch (Exception e)
  1171   1171           {
  1172   1172               if ((_flags & SQLiteConnectionFlags.LogBackup) == SQLiteConnectionFlags.LogBackup)
  1173   1173               {
  1174         -                SQLiteLog.LogMessage(UnsafeNativeMethods.StringFormat(
         1174  +                SQLiteLog.LogMessage(HelperMethods.StringFormat(
  1175   1175                       CultureInfo.CurrentCulture,
  1176   1176                       "Caught exception while backing up database: {0}", e));
  1177   1177               }
  1178   1178   
  1179   1179               throw;
  1180   1180           }
  1181   1181           finally
................................................................................
  1646   1646       protected override void Dispose(bool disposing)
  1647   1647       {
  1648   1648   #if !NET_COMPACT_20 && TRACE_WARNING
  1649   1649           if ((_flags & SQLiteConnectionFlags.TraceWarning) == SQLiteConnectionFlags.TraceWarning)
  1650   1650           {
  1651   1651               if (_noDispose)
  1652   1652               {
  1653         -                System.Diagnostics.Trace.WriteLine(UnsafeNativeMethods.StringFormat(
         1653  +                System.Diagnostics.Trace.WriteLine(HelperMethods.StringFormat(
  1654   1654                       CultureInfo.CurrentCulture,
  1655   1655                       "WARNING: Disposing of connection \"{0}\" with the no-dispose flag set.",
  1656   1656                       _connectionString));
  1657   1657               }
  1658   1658           }
  1659   1659   #endif
  1660   1660   
................................................................................
  2108   2108         if (UnsafeNativeMethods.GetSettingValue("No_SQLiteConnectionNewParser", null) != null)
  2109   2109             arParts = SQLiteConvert.Split(s, ';');
  2110   2110         else
  2111   2111             arParts = SQLiteConvert.NewSplit(s, ';', true, ref error);
  2112   2112   
  2113   2113         if (arParts == null)
  2114   2114         {
  2115         -          throw new ArgumentException(UnsafeNativeMethods.StringFormat(
         2115  +          throw new ArgumentException(HelperMethods.StringFormat(
  2116   2116                 CultureInfo.CurrentCulture,
  2117   2117                 "Invalid ConnectionString format, cannot parse: {0}", (error != null) ?
  2118   2118                 error : "could not split connection string into properties"));
  2119   2119         }
  2120   2120   
  2121   2121         int x = (arParts != null) ? arParts.Length : 0;
  2122   2122         // For each semi-colon piece, split into key and value pairs by the presence of the = sign
................................................................................
  2133   2133           int indexOf = arParts[n].IndexOf('=');
  2134   2134   
  2135   2135           if (indexOf != -1)
  2136   2136             ls.Add(UnwrapString(arParts[n].Substring(0, indexOf).Trim()), UnwrapString(arParts[n].Substring(indexOf + 1).Trim()));
  2137   2137           else if (allowNameOnly)
  2138   2138             ls.Add(UnwrapString(arParts[n].Trim()), String.Empty);
  2139   2139           else
  2140         -          throw new ArgumentException(UnsafeNativeMethods.StringFormat(CultureInfo.CurrentCulture, "Invalid ConnectionString format for part \"{0}\", no equal sign found", arParts[n]));
         2140  +          throw new ArgumentException(HelperMethods.StringFormat(CultureInfo.CurrentCulture, "Invalid ConnectionString format for part \"{0}\", no equal sign found", arParts[n]));
  2141   2141         }
  2142   2142         return ls;
  2143   2143       }
  2144   2144   
  2145   2145       /// <summary>
  2146   2146       /// Parses a connection string using the built-in (i.e. framework provided)
  2147   2147       /// connection string parser class and returns the key/value pairs.  An
................................................................................
  2333   2333       public void EnableExtensions(
  2334   2334           bool enable
  2335   2335           )
  2336   2336       {
  2337   2337           CheckDisposed();
  2338   2338   
  2339   2339           if (_sql == null)
  2340         -            throw new InvalidOperationException(UnsafeNativeMethods.StringFormat(
         2340  +            throw new InvalidOperationException(HelperMethods.StringFormat(
  2341   2341                   CultureInfo.CurrentCulture,
  2342   2342                   "Database connection not valid for {0} extensions.",
  2343   2343                   enable ? "enabling" : "disabling"));
  2344   2344   
  2345   2345           if ((_flags & SQLiteConnectionFlags.NoLoadExtension) == SQLiteConnectionFlags.NoLoadExtension)
  2346   2346               throw new SQLiteException("Loading extensions is disabled for this database connection.");
  2347   2347   
................................................................................
  2456   2456   
  2457   2457           StringBuilder result = new StringBuilder();
  2458   2458   
  2459   2459           int length = array.Length;
  2460   2460   
  2461   2461           for (int index = 0; index < length; index++)
  2462   2462   #if NET_COMPACT_20
  2463         -            result.Append(UnsafeNativeMethods.StringFormat(
         2463  +            result.Append(HelperMethods.StringFormat(
  2464   2464                   CultureInfo.InvariantCulture,
  2465   2465                   "{0:x2}", array[index]));
  2466   2466   #else
  2467   2467               result.AppendFormat("{0:x2}", array[index]);
  2468   2468   #endif
  2469   2469   
  2470   2470           return result.ToString();
................................................................................
  2508   2508           for (int index = 0; index < text.Length; index += 2)
  2509   2509           {
  2510   2510               string value = text.Substring(index, 2);
  2511   2511   
  2512   2512               if (!TryParseByte(value,
  2513   2513                       NumberStyles.HexNumber, out result[index / 2]))
  2514   2514               {
  2515         -                error = UnsafeNativeMethods.StringFormat(
         2515  +                error = HelperMethods.StringFormat(
  2516   2516                       CultureInfo.CurrentCulture,
  2517   2517                       "string contains \"{0}\", which cannot be converted to a byte value",
  2518   2518                       value);
  2519   2519   
  2520   2520                   return null;
  2521   2521               }
  2522   2522           }
................................................................................
  2664   2664   #if !NET_COMPACT_20 && TRACE_WARNING
  2665   2665         bool uri = false;
  2666   2666   #endif
  2667   2667         bool fullUri = false;
  2668   2668         string fileName;
  2669   2669   
  2670   2670         if (Convert.ToInt32(FindKey(opts, "Version", DefaultVersion.ToString()), CultureInfo.InvariantCulture) != DefaultVersion)
  2671         -        throw new NotSupportedException(UnsafeNativeMethods.StringFormat(CultureInfo.CurrentCulture, "Only SQLite Version {0} is supported at this time", DefaultVersion));
         2671  +        throw new NotSupportedException(HelperMethods.StringFormat(CultureInfo.CurrentCulture, "Only SQLite Version {0} is supported at this time", DefaultVersion));
  2672   2672   
  2673   2673   #if INTEROP_INCLUDE_ZIPVFS
  2674   2674         bool useZipVfs = false;
  2675   2675         string zipVfsVersion = FindKey(opts, "ZipVfsVersion", DefaultZipVfsVersion);
  2676   2676   
  2677   2677         if (zipVfsVersion != null)
  2678   2678         {
................................................................................
  2688   2688             else if (String.Compare(zipVfsVersion, ZipVfs_V3) == 0)
  2689   2689             {
  2690   2690                 UnsafeNativeMethods.zipvfsInit_v3(0);
  2691   2691                 useZipVfs = true;
  2692   2692             }
  2693   2693             else
  2694   2694             {
  2695         -              throw new NotSupportedException(UnsafeNativeMethods.StringFormat(
         2695  +              throw new NotSupportedException(HelperMethods.StringFormat(
  2696   2696                     CultureInfo.CurrentCulture, "Only ZipVFS versions {0}, {1}, and {2} are supported at this time",
  2697   2697                     ZipVfs_Automatic, ZipVfs_V2, ZipVfs_V3));
  2698   2698             }
  2699   2699         }
  2700   2700   #endif
  2701   2701   
  2702   2702         fileName = FindKey(opts, "Data Source", DefaultDataSource);
................................................................................
  2704   2704         if (String.IsNullOrEmpty(fileName))
  2705   2705         {
  2706   2706           fileName = FindKey(opts, "Uri", DefaultUri);
  2707   2707           if (String.IsNullOrEmpty(fileName))
  2708   2708           {
  2709   2709             fileName = FindKey(opts, "FullUri", DefaultFullUri);
  2710   2710             if (String.IsNullOrEmpty(fileName))
  2711         -            throw new ArgumentException(UnsafeNativeMethods.StringFormat(CultureInfo.CurrentCulture, "Data Source cannot be empty.  Use {0} to open an in-memory database", MemoryFileName));
         2711  +            throw new ArgumentException(HelperMethods.StringFormat(CultureInfo.CurrentCulture, "Data Source cannot be empty.  Use {0} to open an in-memory database", MemoryFileName));
  2712   2712             else
  2713   2713               fullUri = true;
  2714   2714           }
  2715   2715           else
  2716   2716           {
  2717   2717             fileName = MapUriPath(fileName);
  2718   2718   #if !NET_COMPACT_20 && TRACE_WARNING
................................................................................
  2726   2726   #if !NET_COMPACT_20 && TRACE_WARNING
  2727   2727         if ((_flags & SQLiteConnectionFlags.TraceWarning) == SQLiteConnectionFlags.TraceWarning)
  2728   2728         {
  2729   2729             if (!uri && !fullUri && !isMemory && !String.IsNullOrEmpty(fileName) &&
  2730   2730                 fileName.StartsWith("\\", StringComparison.OrdinalIgnoreCase) &&
  2731   2731                 !fileName.StartsWith("\\\\", StringComparison.OrdinalIgnoreCase))
  2732   2732             {
  2733         -              System.Diagnostics.Trace.WriteLine(UnsafeNativeMethods.StringFormat(
         2733  +              System.Diagnostics.Trace.WriteLine(HelperMethods.StringFormat(
  2734   2734                     CultureInfo.CurrentCulture,
  2735   2735                     "WARNING: Detected a possibly malformed UNC database file name \"{0}\" that " +
  2736   2736                     "may have originally started with two backslashes; however, four leading " +
  2737   2737                     "backslashes may be required, e.g.: \"Data Source=\\\\\\{0};\"",
  2738   2738                     fileName));
  2739   2739             }
  2740   2740         }
................................................................................
  2808   2808           if (hexPassword != null)
  2809   2809           {
  2810   2810               string error = null;
  2811   2811               byte[] hexPasswordBytes = FromHexString(hexPassword, ref error);
  2812   2812   
  2813   2813               if (hexPasswordBytes == null)
  2814   2814               {
  2815         -                throw new FormatException(UnsafeNativeMethods.StringFormat(
         2815  +                throw new FormatException(HelperMethods.StringFormat(
  2816   2816                       CultureInfo.CurrentCulture,
  2817   2817                       "Cannot parse 'HexPassword' property value into byte values: {0}",
  2818   2818                       error));
  2819   2819               }
  2820   2820   
  2821   2821               _sql.SetPassword(hexPasswordBytes);
  2822   2822           }
................................................................................
  2852   2852   
  2853   2853             if (boolValue)
  2854   2854             {
  2855   2855                 using (SQLiteCommand cmd = CreateCommand())
  2856   2856                 {
  2857   2857                     if (_busyTimeout != DefaultBusyTimeout)
  2858   2858                     {
  2859         -                      cmd.CommandText = UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA busy_timeout={0}", _busyTimeout);
         2859  +                      cmd.CommandText = HelperMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA busy_timeout={0}", _busyTimeout);
  2860   2860                         cmd.ExecuteNonQuery();
  2861   2861                     }
  2862   2862   
  2863   2863                     int intValue;
  2864   2864   
  2865   2865                     if (!fullUri && !isMemory)
  2866   2866                     {
  2867   2867                         strValue = FindKey(opts, "Page Size", DefaultPageSize.ToString());
  2868   2868                         intValue = Convert.ToInt32(strValue, CultureInfo.InvariantCulture);
  2869   2869                         if (intValue != DefaultPageSize)
  2870   2870                         {
  2871         -                          cmd.CommandText = UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA page_size={0}", intValue);
         2871  +                          cmd.CommandText = HelperMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA page_size={0}", intValue);
  2872   2872                             cmd.ExecuteNonQuery();
  2873   2873                         }
  2874   2874                     }
  2875   2875   
  2876   2876                     strValue = FindKey(opts, "Max Page Count", DefaultMaxPageCount.ToString());
  2877   2877                     intValue = Convert.ToInt32(strValue, CultureInfo.InvariantCulture);
  2878   2878                     if (intValue != DefaultMaxPageCount)
  2879   2879                     {
  2880         -                      cmd.CommandText = UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA max_page_count={0}", intValue);
         2880  +                      cmd.CommandText = HelperMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA max_page_count={0}", intValue);
  2881   2881                         cmd.ExecuteNonQuery();
  2882   2882                     }
  2883   2883   
  2884   2884                     strValue = FindKey(opts, "Legacy Format", DefaultLegacyFormat.ToString());
  2885   2885                     boolValue = SQLiteConvert.ToBoolean(strValue);
  2886   2886                     if (boolValue != DefaultLegacyFormat)
  2887   2887                     {
  2888         -                      cmd.CommandText = UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA legacy_file_format={0}", boolValue ? "ON" : "OFF");
         2888  +                      cmd.CommandText = HelperMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA legacy_file_format={0}", boolValue ? "ON" : "OFF");
  2889   2889                         cmd.ExecuteNonQuery();
  2890   2890                     }
  2891   2891   
  2892   2892                     strValue = FindKey(opts, "Synchronous", DefaultSynchronous.ToString());
  2893   2893                     enumValue = TryParseEnum(typeof(SQLiteSynchronousEnum), strValue, true);
  2894   2894                     if (!(enumValue is SQLiteSynchronousEnum) || ((SQLiteSynchronousEnum)enumValue != DefaultSynchronous))
  2895   2895                     {
  2896         -                      cmd.CommandText = UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA synchronous={0}", strValue);
         2896  +                      cmd.CommandText = HelperMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA synchronous={0}", strValue);
  2897   2897                         cmd.ExecuteNonQuery();
  2898   2898                     }
  2899   2899   
  2900   2900                     strValue = FindKey(opts, "Cache Size", DefaultCacheSize.ToString());
  2901   2901                     intValue = Convert.ToInt32(strValue, CultureInfo.InvariantCulture);
  2902   2902                     if (intValue != DefaultCacheSize)
  2903   2903                     {
  2904         -                      cmd.CommandText = UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA cache_size={0}", intValue);
         2904  +                      cmd.CommandText = HelperMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA cache_size={0}", intValue);
  2905   2905                         cmd.ExecuteNonQuery();
  2906   2906                     }
  2907   2907   
  2908   2908                     strValue = FindKey(opts, "Journal Mode", DefaultJournalMode.ToString());
  2909   2909                     enumValue = TryParseEnum(typeof(SQLiteJournalModeEnum), strValue, true);
  2910   2910                     if (!(enumValue is SQLiteJournalModeEnum) || ((SQLiteJournalModeEnum)enumValue != DefaultJournalMode))
  2911   2911                     {
................................................................................
  2912   2912                         string pragmaStr = "PRAGMA journal_mode={0}";
  2913   2913   
  2914   2914   #if INTEROP_INCLUDE_ZIPVFS
  2915   2915                         if (useZipVfs)
  2916   2916                             pragmaStr = "PRAGMA zipvfs_journal_mode={0}";
  2917   2917   #endif
  2918   2918   
  2919         -                      cmd.CommandText = UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, pragmaStr, strValue);
         2919  +                      cmd.CommandText = HelperMethods.StringFormat(CultureInfo.InvariantCulture, pragmaStr, strValue);
  2920   2920                         cmd.ExecuteNonQuery();
  2921   2921                     }
  2922   2922   
  2923   2923                     strValue = FindKey(opts, "Foreign Keys", DefaultForeignKeys.ToString());
  2924   2924                     boolValue = SQLiteConvert.ToBoolean(strValue);
  2925   2925                     if (boolValue != DefaultForeignKeys)
  2926   2926                     {
  2927         -                      cmd.CommandText = UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA foreign_keys={0}", boolValue ? "ON" : "OFF");
         2927  +                      cmd.CommandText = HelperMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA foreign_keys={0}", boolValue ? "ON" : "OFF");
  2928   2928                         cmd.ExecuteNonQuery();
  2929   2929                     }
  2930   2930   
  2931   2931                     strValue = FindKey(opts, "Recursive Triggers", DefaultRecursiveTriggers.ToString());
  2932   2932                     boolValue = SQLiteConvert.ToBoolean(strValue);
  2933   2933                     if (boolValue != DefaultRecursiveTriggers)
  2934   2934                     {
  2935         -                      cmd.CommandText = UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA recursive_triggers={0}", boolValue ? "ON" : "OFF");
         2935  +                      cmd.CommandText = HelperMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA recursive_triggers={0}", boolValue ? "ON" : "OFF");
  2936   2936                         cmd.ExecuteNonQuery();
  2937   2937                     }
  2938   2938                 }
  2939   2939             }
  2940   2940   
  2941   2941             if (_progressHandler != null)
  2942   2942                 _sql.SetProgressHook(_progressOps, _progressCallback);
................................................................................
  3465   3465               {
  3466   3466                   if (sourceId == null)
  3467   3467                       sourceId = "0000000000000000000000000000000000000000";
  3468   3468   
  3469   3469                   if (sourceTimeStamp == null)
  3470   3470                       sourceTimeStamp = "0000-00-00 00:00:00 UTC";
  3471   3471   
  3472         -                return UnsafeNativeMethods.StringFormat(
         3472  +                return HelperMethods.StringFormat(
  3473   3473                       CultureInfo.InvariantCulture,
  3474   3474                       "{0} {1}", sourceId, sourceTimeStamp);
  3475   3475               }
  3476   3476               else
  3477   3477               {
  3478   3478                   return null;
  3479   3479               }
................................................................................
  3541   3541               throw new InvalidOperationException("Database connection not valid for shutdown.");
  3542   3542   
  3543   3543           _sql.Close(true); /* NOTE: MUST be closed before shutdown. */
  3544   3544           SQLiteErrorCode rc = _sql.Shutdown();
  3545   3545   
  3546   3546   #if !NET_COMPACT_20 && TRACE_CONNECTION
  3547   3547           if (rc != SQLiteErrorCode.Ok)
  3548         -            System.Diagnostics.Trace.WriteLine(UnsafeNativeMethods.StringFormat(
         3548  +            System.Diagnostics.Trace.WriteLine(HelperMethods.StringFormat(
  3549   3549                   CultureInfo.CurrentCulture,
  3550   3550                   "Shutdown (Instance) Failed: {0}", rc));
  3551   3551   #endif
  3552   3552   
  3553   3553           return rc;
  3554   3554       }
  3555   3555   
................................................................................
  3571   3571           )
  3572   3572       {
  3573   3573           SQLiteErrorCode rc = SQLite3.StaticShutdown(directories);
  3574   3574   
  3575   3575           if (rc != SQLiteErrorCode.Ok)
  3576   3576           {
  3577   3577   #if !NET_COMPACT_20 && TRACE_CONNECTION
  3578         -            System.Diagnostics.Trace.WriteLine(UnsafeNativeMethods.StringFormat(
         3578  +            System.Diagnostics.Trace.WriteLine(HelperMethods.StringFormat(
  3579   3579                   CultureInfo.CurrentCulture,
  3580   3580                   "Shutdown (Static) Failed: {0}", rc));
  3581   3581   #endif
  3582   3582   
  3583   3583               if (!noThrow)
  3584   3584                   throw new SQLiteException(rc, null);
  3585   3585           }
................................................................................
  4171   4171   
  4172   4172         tbl.BeginLoadData();
  4173   4173   
  4174   4174         if (String.IsNullOrEmpty(strCatalog)) strCatalog = "main";
  4175   4175   
  4176   4176         string master = (String.Compare(strCatalog, "temp", StringComparison.OrdinalIgnoreCase) == 0) ? _tempmasterdb : _masterdb;
  4177   4177   
  4178         -      using (SQLiteCommand cmdTables = new SQLiteCommand(UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'table' OR [type] LIKE 'view'", strCatalog, master), this))
         4178  +      using (SQLiteCommand cmdTables = new SQLiteCommand(HelperMethods.StringFormat(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'table' OR [type] LIKE 'view'", strCatalog, master), this))
  4179   4179         using (SQLiteDataReader rdTables = cmdTables.ExecuteReader())
  4180   4180         {
  4181   4181           while (rdTables.Read())
  4182   4182           {
  4183   4183             if (String.IsNullOrEmpty(strTable) || String.Compare(strTable, rdTables.GetString(2), StringComparison.OrdinalIgnoreCase) == 0)
  4184   4184             {
  4185   4185               try
  4186   4186               {
  4187         -              using (SQLiteCommand cmd = new SQLiteCommand(UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}]", strCatalog, rdTables.GetString(2)), this))
         4187  +              using (SQLiteCommand cmd = new SQLiteCommand(HelperMethods.StringFormat(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}]", strCatalog, rdTables.GetString(2)), this))
  4188   4188                 using (SQLiteDataReader rd = (SQLiteDataReader)cmd.ExecuteReader(CommandBehavior.SchemaOnly))
  4189   4189                 using (DataTable tblSchema = rd.GetSchemaTable(true, true))
  4190   4190                 {
  4191   4191                   foreach (DataRow schemaRow in tblSchema.Rows)
  4192   4192                   {
  4193   4193                     if (String.Compare(schemaRow[SchemaTableColumn.ColumnName].ToString(), strColumn, StringComparison.OrdinalIgnoreCase) == 0
  4194   4194                       || strColumn == null)
................................................................................
  4274   4274   
  4275   4275         tbl.BeginLoadData();
  4276   4276   
  4277   4277         if (String.IsNullOrEmpty(strCatalog)) strCatalog = "main";
  4278   4278   
  4279   4279         string master = (String.Compare(strCatalog, "temp", StringComparison.OrdinalIgnoreCase) == 0) ? _tempmasterdb : _masterdb;
  4280   4280   
  4281         -      using (SQLiteCommand cmdTables = new SQLiteCommand(UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'table'", strCatalog, master), this))
         4281  +      using (SQLiteCommand cmdTables = new SQLiteCommand(HelperMethods.StringFormat(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'table'", strCatalog, master), this))
  4282   4282         using (SQLiteDataReader rdTables = cmdTables.ExecuteReader())
  4283   4283         {
  4284   4284           while (rdTables.Read())
  4285   4285           {
  4286   4286             maybeRowId = false;
  4287   4287             primaryKeys.Clear();
  4288   4288             if (String.IsNullOrEmpty(strTable) || String.Compare(rdTables.GetString(2), strTable, StringComparison.OrdinalIgnoreCase) == 0)
  4289   4289             {
  4290   4290               // First, look for any rowid indexes -- which sqlite defines are INTEGER PRIMARY KEY columns.
  4291   4291               // Such indexes are not listed in the indexes list but count as indexes just the same.
  4292   4292               try
  4293   4293               {
  4294         -              using (SQLiteCommand cmdTable = new SQLiteCommand(UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA [{0}].table_info([{1}])", strCatalog, rdTables.GetString(2)), this))
         4294  +              using (SQLiteCommand cmdTable = new SQLiteCommand(HelperMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA [{0}].table_info([{1}])", strCatalog, rdTables.GetString(2)), this))
  4295   4295                 using (SQLiteDataReader rdTable = cmdTable.ExecuteReader())
  4296   4296                 {
  4297   4297                   while (rdTable.Read())
  4298   4298                   {
  4299   4299                     if (rdTable.GetInt32(5) != 0)
  4300   4300                     {
  4301   4301                       primaryKeys.Add(rdTable.GetInt32(0));
................................................................................
  4314   4314               {
  4315   4315                 row = tbl.NewRow();
  4316   4316   
  4317   4317                 row["TABLE_CATALOG"] = strCatalog;
  4318   4318                 row["TABLE_NAME"] = rdTables.GetString(2);
  4319   4319                 row["INDEX_CATALOG"] = strCatalog;
  4320   4320                 row["PRIMARY_KEY"] = true;
  4321         -              row["INDEX_NAME"] = UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "{1}_PK_{0}", rdTables.GetString(2), master);
         4321  +              row["INDEX_NAME"] = HelperMethods.StringFormat(CultureInfo.InvariantCulture, "{1}_PK_{0}", rdTables.GetString(2), master);
  4322   4322                 row["UNIQUE"] = true;
  4323   4323   
  4324   4324                 if (String.Compare((string)row["INDEX_NAME"], strIndex, StringComparison.OrdinalIgnoreCase) == 0
  4325   4325                 || strIndex == null)
  4326   4326                 {
  4327   4327                   tbl.Rows.Add(row);
  4328   4328                 }
................................................................................
  4329   4329   
  4330   4330                 primaryKeys.Clear();
  4331   4331               }
  4332   4332   
  4333   4333               // Now fetch all the rest of the indexes.
  4334   4334               try
  4335   4335               {
  4336         -              using (SQLiteCommand cmd = new SQLiteCommand(UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA [{0}].index_list([{1}])", strCatalog, rdTables.GetString(2)), this))
         4336  +              using (SQLiteCommand cmd = new SQLiteCommand(HelperMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA [{0}].index_list([{1}])", strCatalog, rdTables.GetString(2)), this))
  4337   4337                 using (SQLiteDataReader rd = (SQLiteDataReader)cmd.ExecuteReader())
  4338   4338                 {
  4339   4339                   while (rd.Read())
  4340   4340                   {
  4341   4341                     if (String.Compare(rd.GetString(1), strIndex, StringComparison.OrdinalIgnoreCase) == 0
  4342   4342                     || strIndex == null)
  4343   4343                     {
................................................................................
  4347   4347                       row["TABLE_NAME"] = rdTables.GetString(2);
  4348   4348                       row["INDEX_CATALOG"] = strCatalog;
  4349   4349                       row["INDEX_NAME"] = rd.GetString(1);
  4350   4350                       row["UNIQUE"] = SQLiteConvert.ToBoolean(rd.GetValue(2), CultureInfo.InvariantCulture, false);
  4351   4351                       row["PRIMARY_KEY"] = false;
  4352   4352   
  4353   4353                       // get the index definition
  4354         -                    using (SQLiteCommand cmdIndexes = new SQLiteCommand(UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{2}] WHERE [type] LIKE 'index' AND [name] LIKE '{1}'", strCatalog, rd.GetString(1).Replace("'", "''"), master), this))
         4354  +                    using (SQLiteCommand cmdIndexes = new SQLiteCommand(HelperMethods.StringFormat(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{2}] WHERE [type] LIKE 'index' AND [name] LIKE '{1}'", strCatalog, rd.GetString(1).Replace("'", "''"), master), this))
  4355   4355                       using (SQLiteDataReader rdIndexes = cmdIndexes.ExecuteReader())
  4356   4356                       {
  4357   4357                         while (rdIndexes.Read())
  4358   4358                         {
  4359   4359                           if (rdIndexes.IsDBNull(4) == false)
  4360   4360                             row["INDEX_DEFINITION"] = rdIndexes.GetString(4);
  4361   4361                           break;
................................................................................
  4363   4363                       }
  4364   4364   
  4365   4365                       // Now for the really hard work.  Figure out which index is the primary key index.
  4366   4366                       // The only way to figure it out is to check if the index was an autoindex and if we have a non-rowid
  4367   4367                       // primary key, and all the columns in the given index match the primary key columns
  4368   4368                       if (primaryKeys.Count > 0 && rd.GetString(1).StartsWith("sqlite_autoindex_" + rdTables.GetString(2), StringComparison.InvariantCultureIgnoreCase) == true)
  4369   4369                       {
  4370         -                      using (SQLiteCommand cmdDetails = new SQLiteCommand(UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA [{0}].index_info([{1}])", strCatalog, rd.GetString(1)), this))
         4370  +                      using (SQLiteCommand cmdDetails = new SQLiteCommand(HelperMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA [{0}].index_info([{1}])", strCatalog, rd.GetString(1)), this))
  4371   4371                         using (SQLiteDataReader rdDetails = cmdDetails.ExecuteReader())
  4372   4372                         {
  4373   4373                           int nMatches = 0;
  4374   4374                           while (rdDetails.Read())
  4375   4375                           {
  4376   4376                             if (primaryKeys.Contains(rdDetails.GetInt32(1)) == false)
  4377   4377                             {
................................................................................
  4420   4420   
  4421   4421         tbl.BeginLoadData();
  4422   4422   
  4423   4423         if (String.IsNullOrEmpty(table)) table = null;
  4424   4424         if (String.IsNullOrEmpty(catalog)) catalog = "main";
  4425   4425         string master = (String.Compare(catalog, "temp", StringComparison.OrdinalIgnoreCase) == 0) ? _tempmasterdb : _masterdb;
  4426   4426   
  4427         -      using (SQLiteCommand cmd = new SQLiteCommand(UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "SELECT [type], [name], [tbl_name], [rootpage], [sql], [rowid] FROM [{0}].[{1}] WHERE [type] LIKE 'trigger'", catalog, master), this))
         4427  +      using (SQLiteCommand cmd = new SQLiteCommand(HelperMethods.StringFormat(CultureInfo.InvariantCulture, "SELECT [type], [name], [tbl_name], [rootpage], [sql], [rowid] FROM [{0}].[{1}] WHERE [type] LIKE 'trigger'", catalog, master), this))
  4428   4428         using (SQLiteDataReader rd = (SQLiteDataReader)cmd.ExecuteReader())
  4429   4429         {
  4430   4430           while (rd.Read())
  4431   4431           {
  4432   4432             if (String.Compare(rd.GetString(1), triggerName, StringComparison.OrdinalIgnoreCase) == 0
  4433   4433               || triggerName == null)
  4434   4434             {
................................................................................
  4475   4475         tbl.Columns.Add("TABLE_DEFINITION", typeof(string));
  4476   4476         tbl.BeginLoadData();
  4477   4477   
  4478   4478         if (String.IsNullOrEmpty(strCatalog)) strCatalog = "main";
  4479   4479   
  4480   4480         string master = (String.Compare(strCatalog, "temp", StringComparison.OrdinalIgnoreCase) == 0) ? _tempmasterdb : _masterdb;
  4481   4481   
  4482         -      using (SQLiteCommand cmd = new SQLiteCommand(UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "SELECT [type], [name], [tbl_name], [rootpage], [sql], [rowid] FROM [{0}].[{1}] WHERE [type] LIKE 'table'", strCatalog, master), this))
         4482  +      using (SQLiteCommand cmd = new SQLiteCommand(HelperMethods.StringFormat(CultureInfo.InvariantCulture, "SELECT [type], [name], [tbl_name], [rootpage], [sql], [rowid] FROM [{0}].[{1}] WHERE [type] LIKE 'table'", strCatalog, master), this))
  4483   4483         using (SQLiteDataReader rd = (SQLiteDataReader)cmd.ExecuteReader())
  4484   4484         {
  4485   4485           while (rd.Read())
  4486   4486           {
  4487   4487             strItem = rd.GetString(0);
  4488   4488             if (String.Compare(rd.GetString(2), 0, "SQLITE_", 0, 7, StringComparison.OrdinalIgnoreCase) == 0)
  4489   4489               strItem = "SYSTEM_TABLE";
................................................................................
  4541   4541   
  4542   4542         tbl.BeginLoadData();
  4543   4543   
  4544   4544         if (String.IsNullOrEmpty(strCatalog)) strCatalog = "main";
  4545   4545   
  4546   4546         string master = (String.Compare(strCatalog, "temp", StringComparison.OrdinalIgnoreCase) == 0) ? _tempmasterdb : _masterdb;
  4547   4547   
  4548         -      using (SQLiteCommand cmd = new SQLiteCommand(UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'view'", strCatalog, master), this))
         4548  +      using (SQLiteCommand cmd = new SQLiteCommand(HelperMethods.StringFormat(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'view'", strCatalog, master), this))
  4549   4549         using (SQLiteDataReader rd = (SQLiteDataReader)cmd.ExecuteReader())
  4550   4550         {
  4551   4551           while (rd.Read())
  4552   4552           {
  4553   4553             if (String.Compare(rd.GetString(1), strView, StringComparison.OrdinalIgnoreCase) == 0
  4554   4554               || String.IsNullOrEmpty(strView))
  4555   4555             {
................................................................................
  4690   4690   
  4691   4691         if (String.IsNullOrEmpty(strCatalog)) strCatalog = "main";
  4692   4692   
  4693   4693         string master = (String.Compare(strCatalog, "temp", StringComparison.OrdinalIgnoreCase) == 0) ? _tempmasterdb : _masterdb;
  4694   4694   
  4695   4695         tbl.BeginLoadData();
  4696   4696   
  4697         -      using (SQLiteCommand cmdTables = new SQLiteCommand(UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'table'", strCatalog, master), this))
         4697  +      using (SQLiteCommand cmdTables = new SQLiteCommand(HelperMethods.StringFormat(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'table'", strCatalog, master), this))
  4698   4698         using (SQLiteDataReader rdTables = cmdTables.ExecuteReader())
  4699   4699         {
  4700   4700           while (rdTables.Read())
  4701   4701           {
  4702   4702             maybeRowId = false;
  4703   4703             primaryKeys.Clear();
  4704   4704             if (String.IsNullOrEmpty(strTable) || String.Compare(rdTables.GetString(2), strTable, StringComparison.OrdinalIgnoreCase) == 0)
  4705   4705             {
  4706   4706               try
  4707   4707               {
  4708         -              using (SQLiteCommand cmdTable = new SQLiteCommand(UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA [{0}].table_info([{1}])", strCatalog, rdTables.GetString(2)), this))
         4708  +              using (SQLiteCommand cmdTable = new SQLiteCommand(HelperMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA [{0}].table_info([{1}])", strCatalog, rdTables.GetString(2)), this))
  4709   4709                 using (SQLiteDataReader rdTable = cmdTable.ExecuteReader())
  4710   4710                 {
  4711   4711                   while (rdTable.Read())
  4712   4712                   {
  4713   4713                     if (rdTable.GetInt32(5) == 1) // is a primary key
  4714   4714                     {
  4715   4715                       primaryKeys.Add(new KeyValuePair<int, string>(rdTable.GetInt32(0), rdTable.GetString(1)));
................................................................................
  4724   4724               {
  4725   4725               }
  4726   4726               // This is a rowid row
  4727   4727               if (primaryKeys.Count == 1 && maybeRowId == true)
  4728   4728               {
  4729   4729                 row = tbl.NewRow();
  4730   4730                 row["CONSTRAINT_CATALOG"] = strCatalog;
  4731         -              row["CONSTRAINT_NAME"] = UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "{1}_PK_{0}", rdTables.GetString(2), master);
         4731  +              row["CONSTRAINT_NAME"] = HelperMethods.StringFormat(CultureInfo.InvariantCulture, "{1}_PK_{0}", rdTables.GetString(2), master);
  4732   4732                 row["TABLE_CATALOG"] = strCatalog;
  4733   4733                 row["TABLE_NAME"] = rdTables.GetString(2);
  4734   4734                 row["COLUMN_NAME"] = primaryKeys[0].Value;
  4735   4735                 row["INDEX_NAME"] = row["CONSTRAINT_NAME"];
  4736   4736                 row["ORDINAL_POSITION"] = 0; // primaryKeys[0].Key;
  4737   4737                 row["COLLATION_NAME"] = "BINARY";
  4738   4738                 row["SORT_MODE"] = "ASC";
  4739   4739                 row["CONFLICT_OPTION"] = 2;
  4740   4740   
  4741   4741                 if (String.IsNullOrEmpty(strIndex) || String.Compare(strIndex, (string)row["INDEX_NAME"], StringComparison.OrdinalIgnoreCase) == 0)
  4742   4742                   tbl.Rows.Add(row);
  4743   4743               }
  4744   4744   
  4745         -            using (SQLiteCommand cmdIndexes = new SQLiteCommand(UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{2}] WHERE [type] LIKE 'index' AND [tbl_name] LIKE '{1}'", strCatalog, rdTables.GetString(2).Replace("'", "''"), master), this))
         4745  +            using (SQLiteCommand cmdIndexes = new SQLiteCommand(HelperMethods.StringFormat(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{2}] WHERE [type] LIKE 'index' AND [tbl_name] LIKE '{1}'", strCatalog, rdTables.GetString(2).Replace("'", "''"), master), this))
  4746   4746               using (SQLiteDataReader rdIndexes = cmdIndexes.ExecuteReader())
  4747   4747               {
  4748   4748                 while (rdIndexes.Read())
  4749   4749                 {
  4750   4750                   int ordinal = 0;
  4751   4751                   if (String.IsNullOrEmpty(strIndex) || String.Compare(strIndex, rdIndexes.GetString(1), StringComparison.OrdinalIgnoreCase) == 0)
  4752   4752                   {
  4753   4753                     try
  4754   4754                     {
  4755         -                    using (SQLiteCommand cmdIndex = new SQLiteCommand(UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA [{0}].index_info([{1}])", strCatalog, rdIndexes.GetString(1)), this))
         4755  +                    using (SQLiteCommand cmdIndex = new SQLiteCommand(HelperMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA [{0}].index_info([{1}])", strCatalog, rdIndexes.GetString(1)), this))
  4756   4756                       using (SQLiteDataReader rdIndex = cmdIndex.ExecuteReader())
  4757   4757                       {
  4758   4758                         while (rdIndex.Read())
  4759   4759                         {
  4760   4760                           string columnName = rdIndex.IsDBNull(2) ? null : rdIndex.GetString(2);
  4761   4761   
  4762   4762                           row = tbl.NewRow();
................................................................................
  4852   4852   
  4853   4853         if (String.IsNullOrEmpty(strCatalog)) strCatalog = "main";
  4854   4854   
  4855   4855         string master = (String.Compare(strCatalog, "temp", StringComparison.OrdinalIgnoreCase) == 0) ? _tempmasterdb : _masterdb;
  4856   4856   
  4857   4857         tbl.BeginLoadData();
  4858   4858   
  4859         -      using (SQLiteCommand cmdViews = new SQLiteCommand(UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'view'", strCatalog, master), this))
         4859  +      using (SQLiteCommand cmdViews = new SQLiteCommand(HelperMethods.StringFormat(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'view'", strCatalog, master), this))
  4860   4860         using (SQLiteDataReader rdViews = cmdViews.ExecuteReader())
  4861   4861         {
  4862   4862           while (rdViews.Read())
  4863   4863           {
  4864   4864             if (String.IsNullOrEmpty(strView) || String.Compare(strView, rdViews.GetString(2), StringComparison.OrdinalIgnoreCase) == 0)
  4865   4865             {
  4866         -            using (SQLiteCommand cmdViewSelect = new SQLiteCommand(UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}]", strCatalog, rdViews.GetString(2)), this))
         4866  +            using (SQLiteCommand cmdViewSelect = new SQLiteCommand(HelperMethods.StringFormat(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}]", strCatalog, rdViews.GetString(2)), this))
  4867   4867               {
  4868   4868                 strSql = rdViews.GetString(4).Replace('\r', ' ').Replace('\n', ' ').Replace('\t', ' ');
  4869   4869                 n = CultureInfo.InvariantCulture.CompareInfo.IndexOf(strSql, " AS ", CompareOptions.IgnoreCase);
  4870   4870                 if (n < 0)
  4871   4871                   continue;
  4872   4872   
  4873   4873                 strSql = strSql.Substring(n + 4);
................................................................................
  4957   4957   
  4958   4958         if (String.IsNullOrEmpty(strCatalog)) strCatalog = "main";
  4959   4959   
  4960   4960         string master = (String.Compare(strCatalog, "temp", StringComparison.OrdinalIgnoreCase) == 0) ? _tempmasterdb : _masterdb;
  4961   4961   
  4962   4962         tbl.BeginLoadData();
  4963   4963   
  4964         -      using (SQLiteCommand cmdTables = new SQLiteCommand(UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'table'", strCatalog, master), this))
         4964  +      using (SQLiteCommand cmdTables = new SQLiteCommand(HelperMethods.StringFormat(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'table'", strCatalog, master), this))
  4965   4965         using (SQLiteDataReader rdTables = cmdTables.ExecuteReader())
  4966   4966         {
  4967   4967           while (rdTables.Read())
  4968   4968           {
  4969   4969             if (String.IsNullOrEmpty(strTable) || String.Compare(strTable, rdTables.GetString(2), StringComparison.OrdinalIgnoreCase) == 0)
  4970   4970             {
  4971   4971               try
  4972   4972               {
  4973   4973                 using (SQLiteCommandBuilder builder = new SQLiteCommandBuilder())
  4974         -              using (SQLiteCommand cmdKey = new SQLiteCommand(UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA [{0}].foreign_key_list([{1}])", strCatalog, rdTables.GetString(2)), this))
         4974  +              using (SQLiteCommand cmdKey = new SQLiteCommand(HelperMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA [{0}].foreign_key_list([{1}])", strCatalog, rdTables.GetString(2)), this))
  4975   4975                 using (SQLiteDataReader rdKey = cmdKey.ExecuteReader())
  4976   4976                 {
  4977   4977                   while (rdKey.Read())
  4978   4978                   {
  4979   4979                     row = tbl.NewRow();
  4980   4980                     row["CONSTRAINT_CATALOG"] = strCatalog;
  4981         -                  row["CONSTRAINT_NAME"] = UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "FK_{0}_{1}_{2}", rdTables[2], rdKey.GetInt32(0), rdKey.GetInt32(1));
         4981  +                  row["CONSTRAINT_NAME"] = HelperMethods.StringFormat(CultureInfo.InvariantCulture, "FK_{0}_{1}_{2}", rdTables[2], rdKey.GetInt32(0), rdKey.GetInt32(1));
  4982   4982                     row["TABLE_CATALOG"] = strCatalog;
  4983   4983                     row["TABLE_NAME"] = builder.UnquoteIdentifier(rdTables.GetString(2));
  4984   4984                     row["CONSTRAINT_TYPE"] = "FOREIGN KEY";
  4985   4985                     row["IS_DEFERRABLE"] = false;
  4986   4986                     row["INITIALLY_DEFERRED"] = false;
  4987   4987                     row["FKEY_ID"] = rdKey[0];
  4988   4988                     row["FKEY_FROM_COLUMN"] = builder.UnquoteIdentifier(rdKey[3].ToString());
................................................................................
  5128   5128           {
  5129   5129               try
  5130   5130               {
  5131   5131                   if ((_flags & SQLiteConnectionFlags.LogCallbackException) ==
  5132   5132                           SQLiteConnectionFlags.LogCallbackException)
  5133   5133                   {
  5134   5134                       SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION,
  5135         -                        UnsafeNativeMethods.StringFormat(CultureInfo.CurrentCulture,
         5135  +                        HelperMethods.StringFormat(CultureInfo.CurrentCulture,
  5136   5136                           "Caught exception in \"Progress\" method: {1}",
  5137   5137                           e)); /* throw */
  5138   5138                   }
  5139   5139               }
  5140   5140               catch
  5141   5141               {
  5142   5142                   // do nothing.
................................................................................
  5181   5181           {
  5182   5182               try
  5183   5183               {
  5184   5184                   if ((_flags & SQLiteConnectionFlags.LogCallbackException) ==
  5185   5185                           SQLiteConnectionFlags.LogCallbackException)
  5186   5186                   {
  5187   5187                       SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION,
  5188         -                        UnsafeNativeMethods.StringFormat(CultureInfo.CurrentCulture,
         5188  +                        HelperMethods.StringFormat(CultureInfo.CurrentCulture,
  5189   5189                           "Caught exception in \"Authorize\" method: {1}",
  5190   5190                           e)); /* throw */
  5191   5191                   }
  5192   5192               }
  5193   5193               catch
  5194   5194               {
  5195   5195                   // do nothing.
................................................................................
  5230   5230           {
  5231   5231               try
  5232   5232               {
  5233   5233                   if ((_flags & SQLiteConnectionFlags.LogCallbackException) ==
  5234   5234                           SQLiteConnectionFlags.LogCallbackException)
  5235   5235                   {
  5236   5236                       SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION,
  5237         -                        UnsafeNativeMethods.StringFormat(CultureInfo.CurrentCulture,
         5237  +                        HelperMethods.StringFormat(CultureInfo.CurrentCulture,
  5238   5238                           "Caught exception in \"Update\" method: {1}",
  5239   5239                           e)); /* throw */
  5240   5240                   }
  5241   5241               }
  5242   5242               catch
  5243   5243               {
  5244   5244                   // do nothing.
................................................................................
  5321   5321           {
  5322   5322               try
  5323   5323               {
  5324   5324                   if ((_flags & SQLiteConnectionFlags.LogCallbackException) ==
  5325   5325                           SQLiteConnectionFlags.LogCallbackException)
  5326   5326                   {
  5327   5327                       SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION,
  5328         -                        UnsafeNativeMethods.StringFormat(CultureInfo.CurrentCulture,
         5328  +                        HelperMethods.StringFormat(CultureInfo.CurrentCulture,
  5329   5329                           "Caught exception in \"Trace\" method: {1}",
  5330   5330                           e)); /* throw */
  5331   5331                   }
  5332   5332               }
  5333   5333               catch
  5334   5334               {
  5335   5335                   // do nothing.
................................................................................
  5383   5383           {
  5384   5384               try
  5385   5385               {
  5386   5386                   if ((_flags & SQLiteConnectionFlags.LogCallbackException) ==
  5387   5387                           SQLiteConnectionFlags.LogCallbackException)
  5388   5388                   {
  5389   5389                       SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION,
  5390         -                        UnsafeNativeMethods.StringFormat(CultureInfo.CurrentCulture,
         5390  +                        HelperMethods.StringFormat(CultureInfo.CurrentCulture,
  5391   5391                           "Caught exception in \"Commit\" method: {1}",
  5392   5392                           e)); /* throw */
  5393   5393                   }
  5394   5394               }
  5395   5395               catch
  5396   5396               {
  5397   5397                   // do nothing.
................................................................................
  5425   5425           {
  5426   5426               try
  5427   5427               {
  5428   5428                   if ((_flags & SQLiteConnectionFlags.LogCallbackException) ==
  5429   5429                           SQLiteConnectionFlags.LogCallbackException)
  5430   5430                   {
  5431   5431                       SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION,
  5432         -                        UnsafeNativeMethods.StringFormat(CultureInfo.CurrentCulture,
         5432  +                        HelperMethods.StringFormat(CultureInfo.CurrentCulture,
  5433   5433                           "Caught exception in \"Rollback\" method: {1}",
  5434   5434                           e)); /* throw */
  5435   5435                   }
  5436   5436               }
  5437   5437               catch
  5438   5438               {
  5439   5439                   // do nothing.

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

  1148   1148               case TypeCode.Decimal:
  1149   1149                   return ((decimal)obj) != Decimal.Zero ? true : false;
  1150   1150               case TypeCode.String:
  1151   1151                   return viaFramework ?
  1152   1152                       Convert.ToBoolean(obj, provider) :
  1153   1153                       ToBoolean(ToStringWithProvider(obj, provider));
  1154   1154               default:
  1155         -                throw new SQLiteException(UnsafeNativeMethods.StringFormat(
         1155  +                throw new SQLiteException(HelperMethods.StringFormat(
  1156   1156                       CultureInfo.CurrentCulture,
  1157   1157                       "Cannot convert type {0} to boolean",
  1158   1158                       typeCode));
  1159   1159           }
  1160   1160       }
  1161   1161   
  1162   1162       /// <summary>
................................................................................
  1446   1446           DbType dbType,
  1447   1447           SQLiteConnectionFlags flags,
  1448   1448           string typeName
  1449   1449           )
  1450   1450       {
  1451   1451           if ((flags & SQLiteConnectionFlags.TraceWarning) == SQLiteConnectionFlags.TraceWarning)
  1452   1452           {
  1453         -            Trace.WriteLine(UnsafeNativeMethods.StringFormat(
         1453  +            Trace.WriteLine(HelperMethods.StringFormat(
  1454   1454                   CultureInfo.CurrentCulture,
  1455   1455                   "WARNING: Type mapping failed, returning default name \"{0}\" for type {1}.",
  1456   1456                   typeName, dbType));
  1457   1457           }
  1458   1458       }
  1459   1459   
  1460   1460       /// <summary>
................................................................................
  1475   1475           SQLiteConnectionFlags flags,
  1476   1476           DbType? dbType
  1477   1477           )
  1478   1478       {
  1479   1479           if (!String.IsNullOrEmpty(typeName) &&
  1480   1480               ((flags & SQLiteConnectionFlags.TraceWarning) == SQLiteConnectionFlags.TraceWarning))
  1481   1481           {
  1482         -            Trace.WriteLine(UnsafeNativeMethods.StringFormat(
         1482  +            Trace.WriteLine(HelperMethods.StringFormat(
  1483   1483                   CultureInfo.CurrentCulture,
  1484   1484                   "WARNING: Type mapping failed, returning default type {0} for name \"{1}\".",
  1485   1485                   dbType, typeName));
  1486   1486           }
  1487   1487       }
  1488   1488   #endif
  1489   1489   

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

  1123   1123                 }
  1124   1124               }
  1125   1125             }
  1126   1126   
  1127   1127             if (wantDefaultValue)
  1128   1128             {
  1129   1129               // Determine the default value for the column, which sucks because we have to query the schema for each column
  1130         -            using (SQLiteCommand cmdTable = new SQLiteCommand(UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA [{0}].TABLE_INFO([{1}])",
         1130  +            using (SQLiteCommand cmdTable = new SQLiteCommand(HelperMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA [{0}].TABLE_INFO([{1}])",
  1131   1131                 row[SchemaTableOptionalColumn.BaseCatalogName],
  1132   1132                 row[SchemaTableColumn.BaseTableName]
  1133   1133                 ), _command.Connection))
  1134   1134               using (DbDataReader rdTable = cmdTable.ExecuteReader())
  1135   1135               {
  1136   1136                 // Find the matching column
  1137   1137                 while (rdTable.Read())

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

   135    135   #if RETARGETABLE
   136    136               "RETARGETABLE",
   137    137   #endif
   138    138   
   139    139   #if SQLITE_STANDARD
   140    140               "SQLITE_STANDARD",
   141    141   #endif
          142  +
          143  +#if SQLITE_STANDARD_LIBRARY_NAME
          144  +            "SQLITE_STANDARD_LIBRARY_NAME",
          145  +#endif
   142    146   
   143    147   #if THROW_ON_DISPOSED
   144    148               "THROW_ON_DISPOSED",
   145    149   #endif
   146    150   
   147    151   #if TRACE
   148    152               "TRACE",

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

    27     27       {
    28     28         _transaction = cnn.BeginTransaction(GetSystemDataIsolationLevel(
    29     29             cnn, scope, defaultIsolationLevel, throwOnUnavailable,
    30     30             throwOnUnsupported));
    31     31   
    32     32         _scope = scope;
    33     33   
    34         -      _scope.EnlistVolatile(this, System.Transactions.EnlistmentOptions.None);
           34  +      _scope.EnlistVolatile(this, EnlistmentOptions.None);
    35     35       }
    36     36   
    37     37       ///////////////////////////////////////////////////////////////////////////
    38     38   
    39     39       #region Private Methods
    40     40       private System.Data.IsolationLevel GetSystemDataIsolationLevel(
    41     41           SQLiteConnection connection,
................................................................................
    60     60                   throw new InvalidOperationException(
    61     61                       "isolation level is unavailable");
    62     62               }
    63     63   
    64     64               return defaultIsolationLevel;
    65     65           }
    66     66   
    67         -        System.Transactions.IsolationLevel isolationLevel =
    68         -            transaction.IsolationLevel;
           67  +        IsolationLevel isolationLevel = transaction.IsolationLevel;
    69     68   
    70     69           //
    71     70           // TODO: Are these isolation level mappings actually correct?
    72     71           //
    73     72           switch (isolationLevel)
    74     73           {
    75     74               case IsolationLevel.Unspecified:
................................................................................
    92     91           // NOTE: When in "strict" mode, throw an exception if the isolation
    93     92           //       level is not recognized; otherwise, fallback to the default
    94     93           //       isolation level specified by the caller.
    95     94           //
    96     95           if (throwOnUnsupported)
    97     96           {
    98     97               throw new InvalidOperationException(
    99         -                UnsafeNativeMethods.StringFormat(CultureInfo.CurrentCulture,
           98  +                HelperMethods.StringFormat(CultureInfo.CurrentCulture,
   100     99                   "unsupported isolation level {0}", isolationLevel));
   101    100           }
   102    101   
   103    102           return defaultIsolationLevel;
   104    103       }
   105    104   
   106    105       ///////////////////////////////////////////////////////////////////////////

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

   179    179       /// <param name="message">Optional detailed error message.</param>
   180    180       /// <returns>Error message text for the return code.</returns>
   181    181       private static string GetStockErrorMessage(
   182    182           SQLiteErrorCode errorCode,
   183    183           string message
   184    184           )
   185    185       {
   186         -        return UnsafeNativeMethods.StringFormat(
          186  +        return HelperMethods.StringFormat(
   187    187               CultureInfo.CurrentCulture,
   188    188               "{0}{1}{2}",
   189    189               GetErrorString(errorCode),
   190    190   #if !NET_COMPACT_20
   191    191               Environment.NewLine, message).Trim();
   192    192   #else
   193    193               "\r\n", message).Trim();

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

   416    416           {
   417    417               try
   418    418               {
   419    419                   if ((_flags & SQLiteConnectionFlags.LogCallbackException) ==
   420    420                           SQLiteConnectionFlags.LogCallbackException)
   421    421                   {
   422    422                       SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION,
   423         -                        UnsafeNativeMethods.StringFormat(CultureInfo.CurrentCulture,
          423  +                        HelperMethods.StringFormat(CultureInfo.CurrentCulture,
   424    424                           "Caught exception in \"Invoke\" method: {0}",
   425    425                           e)); /* throw */
   426    426                   }
   427    427               }
   428    428               catch
   429    429               {
   430    430                   // do nothing.
................................................................................
   454    454           {
   455    455               try
   456    456               {
   457    457                   if ((_flags & SQLiteConnectionFlags.LogCallbackException) ==
   458    458                           SQLiteConnectionFlags.LogCallbackException)
   459    459                   {
   460    460                       SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION,
   461         -                        UnsafeNativeMethods.StringFormat(CultureInfo.CurrentCulture,
          461  +                        HelperMethods.StringFormat(CultureInfo.CurrentCulture,
   462    462                           "Caught exception in \"Compare\" (UTF8) method: {0}",
   463    463                           e)); /* throw */
   464    464                   }
   465    465               }
   466    466               catch
   467    467               {
   468    468                   // do nothing.
................................................................................
   501    501           {
   502    502               try
   503    503               {
   504    504                   if ((_flags & SQLiteConnectionFlags.LogCallbackException) ==
   505    505                           SQLiteConnectionFlags.LogCallbackException)
   506    506                   {
   507    507                       SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION,
   508         -                        UnsafeNativeMethods.StringFormat(CultureInfo.CurrentCulture,
          508  +                        HelperMethods.StringFormat(CultureInfo.CurrentCulture,
   509    509                           "Caught exception in \"Compare\" (UTF16) method: {0}",
   510    510                           e)); /* throw */
   511    511                   }
   512    512               }
   513    513               catch
   514    514               {
   515    515                   // do nothing.
................................................................................
   574    574           {
   575    575               try
   576    576               {
   577    577                   if ((_flags & SQLiteConnectionFlags.LogCallbackException) ==
   578    578                           SQLiteConnectionFlags.LogCallbackException)
   579    579                   {
   580    580                       SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION,
   581         -                        UnsafeNativeMethods.StringFormat(CultureInfo.CurrentCulture,
          581  +                        HelperMethods.StringFormat(CultureInfo.CurrentCulture,
   582    582                           "Caught exception in \"Step\" method: {1}",
   583    583                           e)); /* throw */
   584    584                   }
   585    585               }
   586    586               catch
   587    587               {
   588    588                   // do nothing.
................................................................................
   629    629           {
   630    630               try
   631    631               {
   632    632                   if ((_flags & SQLiteConnectionFlags.LogCallbackException) ==
   633    633                           SQLiteConnectionFlags.LogCallbackException)
   634    634                   {
   635    635                       SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION,
   636         -                        UnsafeNativeMethods.StringFormat(CultureInfo.CurrentCulture,
          636  +                        HelperMethods.StringFormat(CultureInfo.CurrentCulture,
   637    637                           "Caught exception in \"Final\" method: {1}",
   638    638                           e)); /* throw */
   639    639                   }
   640    640               }
   641    641               catch
   642    642               {
   643    643                   // do nothing.
................................................................................
  1545   1545         public override object Invoke(
  1546   1546             object[] args /* in */
  1547   1547             )
  1548   1548         {
  1549   1549             if (callback1 == null)
  1550   1550             {
  1551   1551                 throw new InvalidOperationException(
  1552         -                  UnsafeNativeMethods.StringFormat(
         1552  +                  HelperMethods.StringFormat(
  1553   1553                     CultureInfo.CurrentCulture,
  1554   1554                     NoCallbackError, "Invoke"));
  1555   1555             }
  1556   1556   
  1557   1557             SQLiteInvokeDelegate invokeDelegate =
  1558   1558                 callback1 as SQLiteInvokeDelegate;
  1559   1559   
................................................................................
  1595   1595             int stepNumber,        /* in */
  1596   1596             ref object contextData /* in, out */
  1597   1597             )
  1598   1598         {
  1599   1599             if (callback1 == null)
  1600   1600             {
  1601   1601                 throw new InvalidOperationException(
  1602         -                  UnsafeNativeMethods.StringFormat(
         1602  +                  HelperMethods.StringFormat(
  1603   1603                     CultureInfo.CurrentCulture,
  1604   1604                     NoCallbackError, "Step"));
  1605   1605             }
  1606   1606   
  1607   1607             SQLiteStepDelegate stepDelegate = callback1 as SQLiteStepDelegate;
  1608   1608   
  1609   1609             if (stepDelegate != null)
................................................................................
  1644   1644         public override object Final(
  1645   1645             object contextData /* in */
  1646   1646             )
  1647   1647         {
  1648   1648             if (callback2 == null)
  1649   1649             {
  1650   1650                 throw new InvalidOperationException(
  1651         -                  UnsafeNativeMethods.StringFormat(
         1651  +                  HelperMethods.StringFormat(
  1652   1652                     CultureInfo.CurrentCulture,
  1653   1653                     NoCallbackError, "Final"));
  1654   1654             }
  1655   1655   
  1656   1656             SQLiteFinalDelegate finalDelegate = callback2 as SQLiteFinalDelegate;
  1657   1657   
  1658   1658             if (finalDelegate != null)
................................................................................
  1694   1694             string param1, /* in */
  1695   1695             string param2  /* in */
  1696   1696             )
  1697   1697         {
  1698   1698             if (callback1 == null)
  1699   1699             {
  1700   1700                 throw new InvalidOperationException(
  1701         -                  UnsafeNativeMethods.StringFormat(
         1701  +                  HelperMethods.StringFormat(
  1702   1702                     CultureInfo.CurrentCulture,
  1703   1703                     NoCallbackError, "Compare"));
  1704   1704             }
  1705   1705   
  1706   1706             SQLiteCompareDelegate compareDelegate =
  1707   1707                 callback1 as SQLiteCompareDelegate;
  1708   1708   
................................................................................
  1717   1717                 object result = callback1.DynamicInvoke(GetCompareArgs(
  1718   1718                     param1, param2, false)); /* throw */
  1719   1719   
  1720   1720                 if (result is int)
  1721   1721                     return (int)result;
  1722   1722   
  1723   1723                 throw new InvalidOperationException(
  1724         -                  UnsafeNativeMethods.StringFormat(
         1724  +                  HelperMethods.StringFormat(
  1725   1725                     CultureInfo.CurrentCulture,
  1726   1726                     ResultInt32Error, "Compare"));
  1727   1727   #else
  1728   1728                 throw new NotImplementedException();
  1729   1729   #endif
  1730   1730             }
  1731   1731         }

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

    54     54               {
    55     55                   _command = cnn.CreateCommand();
    56     56                   for (int n = 0; n < columns.Length; n++)
    57     57                   {
    58     58                       columns[n] = builder.QuoteIdentifier(columns[n]);
    59     59                   }
    60     60               }
    61         -            _command.CommandText = UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "SELECT {0} FROM [{1}].[{2}] WHERE ROWID = ?", String.Join(",", columns), database, table);
           61  +            _command.CommandText = HelperMethods.StringFormat(CultureInfo.InvariantCulture, "SELECT {0} FROM [{1}].[{2}] WHERE ROWID = ?", String.Join(",", columns), database, table);
    62     62               _command.Parameters.AddWithValue(null, (long)0);
    63     63           }
    64     64   
    65     65           internal bool IsValid
    66     66           {
    67     67               set
    68     68               {

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

   555    555               {
   556    556                   type = "trace";
   557    557               }
   558    558   
   559    559               if ((errorCode != null) &&
   560    560                   !Object.ReferenceEquals(errorCode, String.Empty))
   561    561               {
   562         -                Trace.WriteLine(UnsafeNativeMethods.StringFormat(
          562  +                Trace.WriteLine(HelperMethods.StringFormat(
   563    563                       CultureInfo.CurrentCulture, "SQLite {0} ({1}): {2}",
   564    564                       type, errorCode, message));
   565    565               }
   566    566               else
   567    567               {
   568         -                Trace.WriteLine(UnsafeNativeMethods.StringFormat(
          568  +                Trace.WriteLine(HelperMethods.StringFormat(
   569    569                       CultureInfo.CurrentCulture, "SQLite {0}: {1}",
   570    570                       type, message));
   571    571               }
   572    572   #endif
   573    573           }
   574    574       }
   575    575   }

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

  5553   5553                   //
  5554   5554                   try
  5555   5555                   {
  5556   5556                       if (LogExceptionsNoThrow)
  5557   5557                       {
  5558   5558                           /* throw */
  5559   5559                           SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION,
  5560         -                            UnsafeNativeMethods.StringFormat(
         5560  +                            HelperMethods.StringFormat(
  5561   5561                               CultureInfo.CurrentCulture,
  5562   5562                               "Caught exception in \"{0}\" method: {1}",
  5563   5563                               destroy ? "xDestroy" : "xDisconnect", e));
  5564   5564                       }
  5565   5565                   }
  5566   5566                   catch
  5567   5567                   {
................................................................................
  5613   5613               )
  5614   5614           {
  5615   5615               try
  5616   5616               {
  5617   5617                   if (logErrors)
  5618   5618                   {
  5619   5619                       SQLiteLog.LogMessage(SQLiteErrorCode.Error,
  5620         -                        UnsafeNativeMethods.StringFormat(
         5620  +                        HelperMethods.StringFormat(
  5621   5621                           CultureInfo.CurrentCulture,
  5622   5622                           "Virtual table error: {0}", error)); /* throw */
  5623   5623                   }
  5624   5624               }
  5625   5625               catch
  5626   5626               {
  5627   5627                   // do nothing.
................................................................................
  5661   5661               catch (Exception e) /* NOTE: Must catch ALL. */
  5662   5662               {
  5663   5663                   try
  5664   5664                   {
  5665   5665                       if (logExceptions)
  5666   5666                       {
  5667   5667                           SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION,
  5668         -                            UnsafeNativeMethods.StringFormat(
         5668  +                            HelperMethods.StringFormat(
  5669   5669                               CultureInfo.CurrentCulture,
  5670   5670                               "Caught exception in \"SetTableError\" method: {0}",
  5671   5671                               e)); /* throw */
  5672   5672                       }
  5673   5673                   }
  5674   5674                   catch
  5675   5675                   {
................................................................................
  6063   6063   
  6064   6064               if ((tables != null) &&
  6065   6065                   tables.TryGetValue(pVtab, out table))
  6066   6066               {
  6067   6067                   return table;
  6068   6068               }
  6069   6069   
  6070         -            SetTableError(pVtab, UnsafeNativeMethods.StringFormat(
         6070  +            SetTableError(pVtab, HelperMethods.StringFormat(
  6071   6071                   CultureInfo.CurrentCulture,
  6072   6072                   "managed table for {0} not found", pVtab));
  6073   6073   
  6074   6074               return null;
  6075   6075           }
  6076   6076   
  6077   6077           ///////////////////////////////////////////////////////////////////////
................................................................................
  6157   6157   
  6158   6158               if ((cursors != null) &&
  6159   6159                   cursors.TryGetValue(pCursor, out cursor))
  6160   6160               {
  6161   6161                   return cursor;
  6162   6162               }
  6163   6163   
  6164         -            SetTableError(pVtab, UnsafeNativeMethods.StringFormat(
         6164  +            SetTableError(pVtab, HelperMethods.StringFormat(
  6165   6165                   CultureInfo.CurrentCulture,
  6166   6166                   "managed cursor for {0} not found", pCursor));
  6167   6167   
  6168   6168               return null;
  6169   6169           }
  6170   6170   
  6171   6171           ///////////////////////////////////////////////////////////////////////
................................................................................
  6243   6243           /// </returns>
  6244   6244           protected virtual string GetFunctionKey(
  6245   6245               int argumentCount,
  6246   6246               string name,
  6247   6247               SQLiteFunction function
  6248   6248               )
  6249   6249           {
  6250         -            return UnsafeNativeMethods.StringFormat(
         6250  +            return HelperMethods.StringFormat(
  6251   6251                   CultureInfo.InvariantCulture,
  6252   6252                   "{0}:{1}", argumentCount, name);
  6253   6253           }
  6254   6254           #endregion
  6255   6255   
  6256   6256           ///////////////////////////////////////////////////////////////////////
  6257   6257   
................................................................................
  8117   8117                   catch (Exception e)
  8118   8118                   {
  8119   8119                       try
  8120   8120                       {
  8121   8121                           if (LogExceptionsNoThrow)
  8122   8122                           {
  8123   8123                               SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION,
  8124         -                                UnsafeNativeMethods.StringFormat(
         8124  +                                HelperMethods.StringFormat(
  8125   8125                                   CultureInfo.CurrentCulture,
  8126   8126                                   "Caught exception in \"Dispose\" method: {0}",
  8127   8127                                   e)); /* throw */
  8128   8128                           }
  8129   8129                       }
  8130   8130                       catch
  8131   8131                       {

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

    20     20       {
    21     21           #region Private Constants
    22     22           /// <summary>
    23     23           /// The CREATE TABLE statement used to declare the schema for the
    24     24           /// virtual table.
    25     25           /// </summary>
    26     26           private static readonly string declareSql =
    27         -            UnsafeNativeMethods.StringFormat(
           27  +            HelperMethods.StringFormat(
    28     28                   CultureInfo.InvariantCulture, "CREATE TABLE {0}(x);",
    29     29                   typeof(SQLiteModuleCommon).Name);
    30     30           #endregion
    31     31   
    32     32           ///////////////////////////////////////////////////////////////////////
    33     33   
    34     34           #region Private Data
................................................................................
   115    115           protected virtual SQLiteErrorCode CursorTypeMismatchError(
   116    116               SQLiteVirtualTableCursor cursor,
   117    117               Type type
   118    118               )
   119    119           {
   120    120               if (type != null)
   121    121               {
   122         -                SetCursorError(cursor, UnsafeNativeMethods.StringFormat(
          122  +                SetCursorError(cursor, HelperMethods.StringFormat(
   123    123                       CultureInfo.CurrentCulture, "not a \"{0}\" cursor",
   124    124                       type));
   125    125               }
   126    126               else
   127    127               {
   128    128                   SetCursorError(cursor, "cursor type mismatch");
   129    129               }

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

   499    499               SQLiteIndex index
   500    500               )
   501    501           {
   502    502               CheckDisposed();
   503    503   
   504    504               if (!table.BestIndex(index))
   505    505               {
   506         -                SetTableError(table, UnsafeNativeMethods.StringFormat(
          506  +                SetTableError(table, HelperMethods.StringFormat(
   507    507                       CultureInfo.CurrentCulture,
   508    508                       "failed to select best index for virtual table \"{0}\"",
   509    509                       table.TableName));
   510    510   
   511    511                   return SQLiteErrorCode.Error;
   512    512               }
   513    513   
................................................................................
   827    827               SQLiteVirtualTable table,
   828    828               SQLiteValue[] values,
   829    829               ref long rowId
   830    830               )
   831    831           {
   832    832               CheckDisposed();
   833    833   
   834         -            SetTableError(table, UnsafeNativeMethods.StringFormat(
          834  +            SetTableError(table, HelperMethods.StringFormat(
   835    835                   CultureInfo.CurrentCulture,
   836    836                   "virtual table \"{0}\" is read-only", table.TableName));
   837    837   
   838    838               return SQLiteErrorCode.Error;
   839    839           }
   840    840   
   841    841           ///////////////////////////////////////////////////////////////////////
................................................................................
   857    857               string newName
   858    858               )
   859    859           {
   860    860               CheckDisposed();
   861    861   
   862    862               if (!table.Rename(newName))
   863    863               {
   864         -                SetTableError(table, UnsafeNativeMethods.StringFormat(
          864  +                SetTableError(table, HelperMethods.StringFormat(
   865    865                       CultureInfo.CurrentCulture,
   866    866                       "failed to rename virtual table from \"{0}\" to \"{1}\"",
   867    867                       table.TableName, newName));
   868    868   
   869    869                   return SQLiteErrorCode.Error;
   870    870               }
   871    871   

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

   423    423   
   424    424         foreach(SQLiteParameter p in _parameterList)
   425    425         {
   426    426           y ++;
   427    427           s = p.ParameterName;
   428    428           if (s == null)
   429    429           {
   430         -          s = UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, ";{0}", nUnnamed);
          430  +          s = HelperMethods.StringFormat(CultureInfo.InvariantCulture, ";{0}", nUnnamed);
   431    431             nUnnamed++;
   432    432           }
   433    433   
   434    434           int x;
   435    435           bool isMapped = false;
   436    436   
   437    437           if (activeStatement == null)
................................................................................
   452    452             stmt = null;
   453    453           }
   454    454   
   455    455           // If the parameter has a name, but the SQL statement uses unnamed references, this can happen -- attempt to map
   456    456           // the parameter by its index in the collection
   457    457           if (isMapped == false)
   458    458           {
   459         -          s = UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, ";{0}", y);
          459  +          s = HelperMethods.StringFormat(CultureInfo.InvariantCulture, ";{0}", y);
   460    460   
   461    461             stmt = activeStatement;
   462    462             for (n = 0; n < x; n++)
   463    463             {
   464    464               if (stmt == null) stmt = _command._statementList[n];
   465    465               if (stmt._paramNames != null)
   466    466               {

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

    81     81           _paramValues = new SQLiteParameter[n];
    82     82   
    83     83           for (x = 0; x < n; x++)
    84     84           {
    85     85             s = _sql.Bind_ParamName(this, _flags, x + 1);
    86     86             if (String.IsNullOrEmpty(s))
    87     87             {
    88         -            s = UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, ";{0}", nCmdStart);
           88  +            s = HelperMethods.StringFormat(CultureInfo.InvariantCulture, ";{0}", nCmdStart);
    89     89               nCmdStart++;
    90     90               _unnamedParameters++;
    91     91             }
    92     92             _paramNames[x] = s;
    93     93             _paramValues[x] = null;
    94     94           }
    95     95         }
................................................................................
   254    254         if ((obj != null) && (objType == DbType.Object))
   255    255             objType = SQLiteConvert.TypeToDbType(obj.GetType());
   256    256   
   257    257         if ((_flags & SQLiteConnectionFlags.LogPreBind) == SQLiteConnectionFlags.LogPreBind)
   258    258         {
   259    259             IntPtr handle = _sqlite_stmt;
   260    260   
   261         -          SQLiteLog.LogMessage(UnsafeNativeMethods.StringFormat(
          261  +          SQLiteLog.LogMessage(HelperMethods.StringFormat(
   262    262                 CultureInfo.CurrentCulture,
   263    263                 "Binding statement {0} paramter #{1} with database type {2} and raw value {{{3}}}...",
   264    264                 handle, index, objType, obj));
   265    265         }
   266    266   
   267    267         if ((obj == null) || Convert.IsDBNull(obj))
   268    268         {

Changes to System.Data.SQLite/Targets/System.Data.SQLite.Properties.targets.

   148    148         NOTE: For interaction with the native SQLite implementation, use the
   149    149               standard DLL (i.e. "sqlite3.dll")?
   150    150     -->
   151    151     <PropertyGroup Condition="'$(UseSqliteStandard)' != 'false'">
   152    152       <DefineConstants>$(DefineConstants);SQLITE_STANDARD</DefineConstants>
   153    153     </PropertyGroup>
   154    154   
          155  +  <!--
          156  +      NOTE: For interaction with the native SQLite implementation, use the
          157  +            standard DLL file name (i.e. "sqlite3.dll") even when compiled
          158  +            to use the interop DLL?
          159  +  -->
          160  +  <PropertyGroup Condition="'$(UseSqliteStandardLibraryName)' != 'false'">
          161  +    <DefineConstants>$(DefineConstants);SQLITE_STANDARD_LIBRARY_NAME</DefineConstants>
          162  +  </PropertyGroup>
          163  +
   155    164     <!--
   156    165         NOTE: Is the project being built to support the .NET Compact Framework?
   157    166     -->
   158    167     <PropertyGroup Condition="'$(IsCompactFramework)' != 'false'">
   159    168       <DefineConstants>$(DefineConstants);PLATFORM_COMPACTFRAMEWORK</DefineConstants>
   160    169     </PropertyGroup>
   161    170   

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

    14     14     using System.Diagnostics;
    15     15   #endif
    16     16   
    17     17     using System.Collections.Generic;
    18     18     using System.IO;
    19     19     using System.Reflection;
    20     20   
    21         -#if !PLATFORM_COMPACTFRAMEWORK && !DEBUG
           21  +#if !PLATFORM_COMPACTFRAMEWORK
    22     22     using System.Security;
    23     23   #endif
    24     24   
    25     25     using System.Runtime.InteropServices;
    26     26   
    27     27   #if !PLATFORM_COMPACTFRAMEWORK
    28     28     using System.Text;
................................................................................
    30     30   
    31     31   #if !PLATFORM_COMPACTFRAMEWORK || COUNT_HANDLE
    32     32     using System.Threading;
    33     33   #endif
    34     34   
    35     35     using System.Xml;
    36     36   
    37         -#if !PLATFORM_COMPACTFRAMEWORK && !DEBUG
    38         -  [SuppressUnmanagedCodeSecurity]
    39         -#endif
    40         -  internal static class UnsafeNativeMethods
           37  +  #region Debug Data Static Class
           38  +#if COUNT_HANDLE || DEBUG
           39  +  /// <summary>
           40  +  /// This class encapsulates some tracking data that is used for debugging
           41  +  /// and testing purposes.
           42  +  /// </summary>
           43  +  internal static class DebugData
    41     44     {
           45  +      #region Private Data
    42     46         #region Critical Handle Counts (Debug Build Only)
    43     47   #if COUNT_HANDLE
    44     48         //
    45     49         // NOTE: These counts represent the total number of outstanding
    46     50         //       (non-disposed) CriticalHandle derived object instances
    47     51         //       created by this library and are primarily for use by
    48     52         //       the test suite.  These counts are incremented by the
................................................................................
    54     58         internal static int statementCount;
    55     59         internal static int backupCount;
    56     60   #endif
    57     61         #endregion
    58     62   
    59     63         /////////////////////////////////////////////////////////////////////////
    60     64   
           65  +      #region Settings Read Counts (Debug Build Only)
           66  +#if DEBUG
           67  +      /// <summary>
           68  +      /// This lock is used to protect the static
           69  +      /// <see cref="settingReadCounts" /> field.
           70  +      /// </summary>
           71  +      private static readonly object staticSyncRoot = new object();
           72  +
           73  +      /////////////////////////////////////////////////////////////////////////
           74  +      /// <summary>
           75  +      /// This dictionary stores the read counts for the runtime configuration
           76  +      /// settings.  This information is only recorded when compiled in the
           77  +      /// "Debug" build configuration.
           78  +      /// </summary>
           79  +      private static Dictionary<string, int> settingReadCounts;
           80  +#endif
           81  +      #endregion
           82  +      #endregion
           83  +
           84  +      /////////////////////////////////////////////////////////////////////////
           85  +
           86  +      #region Public Methods
           87  +#if DEBUG
           88  +      /// <summary>
           89  +      /// Creates the dictionary used to store the read counts for each of the
           90  +      /// runtime configuration settings.  These numbers are used for debugging
           91  +      /// and testing purposes only.
           92  +      /// </summary>
           93  +      public static void InitializeSettingReadCounts()
           94  +      {
           95  +          lock (staticSyncRoot)
           96  +          {
           97  +              //
           98  +              // NOTE: Create the list of statistics that will contain the
           99  +              //       number of times each setting value has been read.
          100  +              //
          101  +              if (settingReadCounts == null)
          102  +                  settingReadCounts = new Dictionary<string, int>();
          103  +          }
          104  +      }
          105  +
          106  +      /////////////////////////////////////////////////////////////////////////
          107  +
          108  +      /// <summary>
          109  +      /// Increments the read count for the specified runtime configuration
          110  +      /// setting.  These numbers are used for debugging and testing purposes
          111  +      /// only.
          112  +      /// </summary>
          113  +      /// <param name="name">
          114  +      /// The name of the setting being read.
          115  +      /// </param>
          116  +      public static void IncrementSettingReadCount(
          117  +          string name
          118  +          )
          119  +      {
          120  +          lock (staticSyncRoot)
          121  +          {
          122  +              //
          123  +              // NOTE: Update statistics for this setting value.
          124  +              //
          125  +              if (settingReadCounts != null)
          126  +              {
          127  +                  int count;
          128  +
          129  +                  if (settingReadCounts.TryGetValue(name, out count))
          130  +                        settingReadCounts[name] = count + 1;
          131  +                  else
          132  +                        settingReadCounts.Add(name, 1);
          133  +              }
          134  +          }
          135  +      }
          136  +#endif
          137  +      #endregion
          138  +  }
          139  +#endif
          140  +  #endregion
          141  +
          142  +  /////////////////////////////////////////////////////////////////////////////
          143  +
          144  +  #region Helper Methods Static Class
          145  +  /// <summary>
          146  +  /// This static class provides some methods that are shared between the
          147  +  /// native library pre-loader and other classes.
          148  +  /// </summary>
          149  +  internal static class HelperMethods
          150  +  {
          151  +      #region Private Data
          152  +      /// <summary>
          153  +      /// This lock is used to protect the static <see cref="isMono" /> field.
          154  +      /// </summary>
          155  +      private static readonly object staticSyncRoot = new object();
          156  +
          157  +      /////////////////////////////////////////////////////////////////////////
          158  +      /// <summary>
          159  +      /// This type is only present when running on Mono.
          160  +      /// </summary>
          161  +      private static readonly string MonoRuntimeType = "Mono.Runtime";
          162  +
          163  +      /////////////////////////////////////////////////////////////////////////
          164  +      /// <summary>
          165  +      /// Keeps track of whether we are running on Mono.  Initially null, it is
          166  +      /// set by the <see cref="IsMono" /> method on its first call.  Later, it
          167  +      /// is returned verbatim by the <see cref="IsMono" /> method.
          168  +      /// </summary>
          169  +      private static bool? isMono = null;
          170  +      #endregion
          171  +
          172  +      /////////////////////////////////////////////////////////////////////////
          173  +
          174  +      #region Private Methods
          175  +      /// <summary>
          176  +      /// Determines whether or not this assembly is running on Mono.
          177  +      /// </summary>
          178  +      /// <returns>
          179  +      /// Non-zero if this assembly is running on Mono.
          180  +      /// </returns>
          181  +      private static bool IsMono()
          182  +      {
          183  +          try
          184  +          {
          185  +              lock (staticSyncRoot)
          186  +              {
          187  +                  if (isMono == null)
          188  +                      isMono = (Type.GetType(MonoRuntimeType) != null);
          189  +
          190  +                  return (bool)isMono;
          191  +              }
          192  +          }
          193  +          catch
          194  +          {
          195  +              // do nothing.
          196  +          }
          197  +
          198  +          return false;
          199  +      }
          200  +      #endregion
          201  +
          202  +      /////////////////////////////////////////////////////////////////////////
          203  +
          204  +      #region Internal Methods
          205  +      /// <summary>
          206  +      /// Determines if the current process is running on one of the Windows
          207  +      /// [sub-]platforms.
          208  +      /// </summary>
          209  +      /// <returns>
          210  +      /// Non-zero when running on Windows; otherwise, zero.
          211  +      /// </returns>
          212  +      internal static bool IsWindows()
          213  +      {
          214  +          PlatformID platformId = Environment.OSVersion.Platform;
          215  +
          216  +          if ((platformId == PlatformID.Win32S) ||
          217  +              (platformId == PlatformID.Win32Windows) ||
          218  +              (platformId == PlatformID.Win32NT) ||
          219  +              (platformId == PlatformID.WinCE))
          220  +          {
          221  +              return true;
          222  +          }
          223  +
          224  +          return false;
          225  +      }
          226  +
          227  +      /////////////////////////////////////////////////////////////////////////
          228  +      /// <summary>
          229  +      /// This is a wrapper around the
          230  +      /// <see cref="String.Format(IFormatProvider,String,Object[])" /> method.
          231  +      /// On Mono, it has to call the method overload without the
          232  +      /// <see cref="IFormatProvider" /> parameter, due to a bug in Mono.
          233  +      /// </summary>
          234  +      /// <param name="provider">
          235  +      /// This is used for culture-specific formatting.
          236  +      /// </param>
          237  +      /// <param name="format">
          238  +      /// The format string.
          239  +      /// </param>
          240  +      /// <param name="args">
          241  +      /// An array the objects to format.
          242  +      /// </param>
          243  +      /// <returns>
          244  +      /// The resulting string.
          245  +      /// </returns>
          246  +      internal static string StringFormat(
          247  +          IFormatProvider provider,
          248  +          string format,
          249  +          params object[] args
          250  +          )
          251  +      {
          252  +          if (IsMono())
          253  +              return String.Format(format, args);
          254  +          else
          255  +              return String.Format(provider, format, args);
          256  +      }
          257  +      #endregion
          258  +  }
          259  +  #endregion
          260  +
          261  +  /////////////////////////////////////////////////////////////////////////////
          262  +
          263  +  #region Native Library Helper Class
          264  +  /// <summary>
          265  +  /// This static class provides a thin wrapper around the native library
          266  +  /// loading features of the underlying platform.
          267  +  /// </summary>
          268  +  internal static class NativeLibraryHelper
          269  +  {
          270  +      #region Private Delegates
          271  +      /// <summary>
          272  +      /// This delegate is used to wrap the concept of loading a native
          273  +      /// library, based on a file name, and returning the loaded module
          274  +      /// handle.
          275  +      /// </summary>
          276  +      /// <param name="fileName">
          277  +      /// The file name of the native library to load.
          278  +      /// </param>
          279  +      /// <returns>
          280  +      /// The native module handle upon success -OR- IntPtr.Zero on failure.
          281  +      /// </returns>
          282  +      private delegate IntPtr LoadLibraryCallback(
          283  +          string fileName
          284  +      );
          285  +      #endregion
          286  +
          287  +      /////////////////////////////////////////////////////////////////////////
          288  +
          289  +      #region Private Methods
          290  +      /// <summary>
          291  +      /// Attempts to load the specified native library file using the Win32
          292  +      /// API.
          293  +      /// </summary>
          294  +      /// <param name="fileName">
          295  +      /// The file name of the native library to load.
          296  +      /// </param>
          297  +      /// <returns>
          298  +      /// The native module handle upon success -OR- IntPtr.Zero on failure.
          299  +      /// </returns>
          300  +      private static IntPtr LoadLibraryWin32(
          301  +          string fileName
          302  +          )
          303  +      {
          304  +          return UnsafeNativeMethodsWin32.LoadLibrary(fileName);
          305  +      }
          306  +
          307  +      /////////////////////////////////////////////////////////////////////////
          308  +
          309  +#if !PLATFORM_COMPACTFRAMEWORK
          310  +      /// <summary>
          311  +      /// Attempts to load the specified native library file using the POSIX
          312  +      /// API.
          313  +      /// </summary>
          314  +      /// <param name="fileName">
          315  +      /// The file name of the native library to load.
          316  +      /// </param>
          317  +      /// <returns>
          318  +      /// The native module handle upon success -OR- IntPtr.Zero on failure.
          319  +      /// </returns>
          320  +      private static IntPtr LoadLibraryPosix(
          321  +          string fileName
          322  +          )
          323  +      {
          324  +          return UnsafeNativeMethodsPosix.dlopen(
          325  +              fileName, UnsafeNativeMethodsPosix.RTLD_DEFAULT);
          326  +      }
          327  +#endif
          328  +      #endregion
          329  +
          330  +      /////////////////////////////////////////////////////////////////////////
          331  +
          332  +      #region Public Methods
          333  +      /// <summary>
          334  +      /// Attempts to load the specified native library file.
          335  +      /// </summary>
          336  +      /// <param name="fileName">
          337  +      /// The file name of the native library to load.
          338  +      /// </param>
          339  +      /// <returns>
          340  +      /// The native module handle upon success -OR- IntPtr.Zero on failure.
          341  +      /// </returns>
          342  +      public static IntPtr LoadLibrary(
          343  +          string fileName
          344  +          )
          345  +      {
          346  +          LoadLibraryCallback callback = LoadLibraryWin32;
          347  +
          348  +#if !PLATFORM_COMPACTFRAMEWORK
          349  +          if (!HelperMethods.IsWindows())
          350  +              callback = LoadLibraryPosix;
          351  +#endif
          352  +
          353  +          return callback(fileName);
          354  +      }
          355  +      #endregion
          356  +  }
          357  +  #endregion
          358  +
          359  +  /////////////////////////////////////////////////////////////////////////////
          360  +
          361  +  #region Unmanaged Interop Methods Static Class (POSIX)
          362  +#if !PLATFORM_COMPACTFRAMEWORK
          363  +  /// <summary>
          364  +  /// This class declares P/Invoke methods to call native POSIX APIs.
          365  +  /// </summary>
          366  +  [SuppressUnmanagedCodeSecurity]
          367  +  internal static class UnsafeNativeMethodsPosix
          368  +  {
          369  +      /////////////////////////////////////////////////////////////////////////
          370  +      /// <summary>
          371  +      /// This is the P/Invoke method that wraps the native Unix dlopen
          372  +      /// function.  See the POSIX documentation for full details on what it
          373  +      /// does.
          374  +      /// </summary>
          375  +      /// <param name="fileName">
          376  +      /// The name of the executable library.
          377  +      /// </param>
          378  +      /// <param name="mode">
          379  +      /// This must be a combination of the individual bit flags RTLD_LAZY,
          380  +      /// RTLD_NOW, RTLD_GLOBAL, and/or RTLD_LOCAL.
          381  +      /// </param>
          382  +      /// <returns>
          383  +      /// The native module handle upon success -OR- IntPtr.Zero on failure.
          384  +      /// </returns>
          385  +      [DllImport("__Internal", EntryPoint = "dlopen",
          386  +          CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi,
          387  +          BestFitMapping = false, ThrowOnUnmappableChar = true,
          388  +          SetLastError = true)]
          389  +      internal static extern IntPtr dlopen(string fileName, int mode);
          390  +
          391  +      /////////////////////////////////////////////////////////////////////////
          392  +      /// <summary>
          393  +      /// For use with dlopen(), bind function calls lazily.
          394  +      /// </summary>
          395  +      internal const int RTLD_LAZY = 0x1;
          396  +
          397  +      /////////////////////////////////////////////////////////////////////////
          398  +      /// <summary>
          399  +      /// For use with dlopen(), bind function calls immediately.
          400  +      /// </summary>
          401  +      internal const int RTLD_NOW = 0x2;
          402  +
          403  +      /////////////////////////////////////////////////////////////////////////
          404  +      /// <summary>
          405  +      /// For use with dlopen(), make symbols globally available.
          406  +      /// </summary>
          407  +      internal const int RTLD_GLOBAL = 0x100;
          408  +
          409  +      /////////////////////////////////////////////////////////////////////////
          410  +      /// <summary>
          411  +      /// For use with dlopen(), opposite of RTLD_GLOBAL, and the default.
          412  +      /// </summary>
          413  +      internal const int RTLD_LOCAL = 0x000;
          414  +
          415  +      /////////////////////////////////////////////////////////////////////////
          416  +      /// <summary>
          417  +      /// For use with dlopen(), the defaults used by this class.
          418  +      /// </summary>
          419  +      internal  const int RTLD_DEFAULT = RTLD_NOW | RTLD_GLOBAL;
          420  +  }
          421  +#endif
          422  +  #endregion
          423  +
          424  +  /////////////////////////////////////////////////////////////////////////////
          425  +
          426  +  #region Unmanaged Interop Methods Static Class (Win32)
          427  +  /// <summary>
          428  +  /// This class declares P/Invoke methods to call native Win32 APIs.
          429  +  /// </summary>
          430  +#if !PLATFORM_COMPACTFRAMEWORK
          431  +  [SuppressUnmanagedCodeSecurity]
          432  +#endif
          433  +  internal static class UnsafeNativeMethodsWin32
          434  +  {
          435  +      /////////////////////////////////////////////////////////////////////////
          436  +      /// <summary>
          437  +      /// This is the P/Invoke method that wraps the native Win32 LoadLibrary
          438  +      /// function.  See the MSDN documentation for full details on what it
          439  +      /// does.
          440  +      /// </summary>
          441  +      /// <param name="fileName">
          442  +      /// The name of the executable library.
          443  +      /// </param>
          444  +      /// <returns>
          445  +      /// The native module handle upon success -OR- IntPtr.Zero on failure.
          446  +      /// </returns>
          447  +#if !PLATFORM_COMPACTFRAMEWORK
          448  +      [DllImport("kernel32",
          449  +#else
          450  +      [DllImport("coredll",
          451  +#endif
          452  + CallingConvention = CallingConvention.Winapi, CharSet = CharSet.Auto,
          453  +#if !PLATFORM_COMPACTFRAMEWORK
          454  +          BestFitMapping = false, ThrowOnUnmappableChar = true,
          455  +#endif
          456  +          SetLastError = true)]
          457  +      internal static extern IntPtr LoadLibrary(string fileName);
          458  +
          459  +      /////////////////////////////////////////////////////////////////////////
          460  +
          461  +#if PLATFORM_COMPACTFRAMEWORK
          462  +      /// <summary>
          463  +      /// This is the P/Invoke method that wraps the native Win32 GetSystemInfo
          464  +      /// function.  See the MSDN documentation for full details on what it
          465  +      /// does.
          466  +      /// </summary>
          467  +      /// <param name="systemInfo">
          468  +      /// The system information structure to be filled in by the function.
          469  +      /// </param>
          470  +      [DllImport("coredll", CallingConvention = CallingConvention.Winapi)]
          471  +      internal static extern void GetSystemInfo(out SYSTEM_INFO systemInfo);
          472  +
          473  +      /////////////////////////////////////////////////////////////////////////
          474  +      /// <summary>
          475  +      /// This enumeration contains the possible values for the processor
          476  +      /// architecture field of the system information structure.
          477  +      /// </summary>
          478  +      internal enum ProcessorArchitecture : ushort /* COMPAT: Win32. */
          479  +      {
          480  +          Intel = 0,
          481  +          MIPS = 1,
          482  +          Alpha = 2,
          483  +          PowerPC = 3,
          484  +          SHx = 4,
          485  +          ARM = 5,
          486  +          IA64 = 6,
          487  +          Alpha64 = 7,
          488  +          MSIL = 8,
          489  +          AMD64 = 9,
          490  +          IA32_on_Win64 = 10,
          491  +          Unknown = 0xFFFF
          492  +      }
          493  +
          494  +      /////////////////////////////////////////////////////////////////////////
          495  +      /// <summary>
          496  +      /// This structure contains information about the current computer. This
          497  +      /// includes the processor type, page size, memory addresses, etc.
          498  +      /// </summary>
          499  +      [StructLayout(LayoutKind.Sequential)]
          500  +      internal struct SYSTEM_INFO
          501  +      {
          502  +          public ProcessorArchitecture wProcessorArchitecture;
          503  +          public ushort wReserved; /* NOT USED */
          504  +          public uint dwPageSize; /* NOT USED */
          505  +          public IntPtr lpMinimumApplicationAddress; /* NOT USED */
          506  +          public IntPtr lpMaximumApplicationAddress; /* NOT USED */
          507  +          public uint dwActiveProcessorMask; /* NOT USED */
          508  +          public uint dwNumberOfProcessors; /* NOT USED */
          509  +          public uint dwProcessorType; /* NOT USED */
          510  +          public uint dwAllocationGranularity; /* NOT USED */
          511  +          public ushort wProcessorLevel; /* NOT USED */
          512  +          public ushort wProcessorRevision; /* NOT USED */
          513  +      }
          514  +#endif
          515  +  }
          516  +  #endregion
          517  +
          518  +  /////////////////////////////////////////////////////////////////////////////
          519  +
          520  +  #region Unmanaged Interop Methods Static Class (SQLite)
          521  +  /// <summary>
          522  +  /// This class declares P/Invoke methods to call native SQLite APIs.
          523  +  /// </summary>
          524  +#if !PLATFORM_COMPACTFRAMEWORK
          525  +  [SuppressUnmanagedCodeSecurity]
          526  +#endif
          527  +  internal static class UnsafeNativeMethods
          528  +  {
    61    529         #region Shared Native SQLite Library Pre-Loading Code
    62    530         #region Private Constants
    63    531         /// <summary>
    64    532         /// The file extension used for dynamic link libraries.
    65    533         /// </summary>
    66    534         private static readonly string DllFileExtension = ".dll";
    67    535   
................................................................................
    86    554         #region Private Data
    87    555         /// <summary>
    88    556         /// This lock is used to protect the static _SQLiteNativeModuleFileName,
    89    557         /// _SQLiteNativeModuleHandle, and processorArchitecturePlatforms fields.
    90    558         /// </summary>
    91    559         private static readonly object staticSyncRoot = new object();
    92    560   
    93         -#if DEBUG
    94         -      /////////////////////////////////////////////////////////////////////////
    95         -      /// <summary>
    96         -      /// This dictionary stores the read counts for the runtime configuration
    97         -      /// settings.  This information is only recorded when compiled in the
    98         -      /// "Debug" build configuration.
    99         -      /// </summary>
   100         -      private static Dictionary<string, int> settingReadCounts;
   101         -#endif
   102         -
   103    561         /////////////////////////////////////////////////////////////////////////
   104    562         /// <summary>
   105    563         /// This dictionary stores the mappings between processor architecture
   106    564         /// names and platform names.  These mappings are now used for two
   107    565         /// purposes.  First, they are used to determine if the assembly code
   108    566         /// base should be used instead of the location, based upon whether one
   109    567         /// or more of the named sub-directories exist within the assembly code
................................................................................
   119    577         /// </summary>
   120    578         static UnsafeNativeMethods()
   121    579         {
   122    580             Initialize();
   123    581         }
   124    582   
   125    583         /////////////////////////////////////////////////////////////////////////
   126         -
   127         -      /// <summary>
   128         -      /// This type is only present when running on Mono.
   129         -      /// </summary>
   130         -      private static readonly string MonoRuntimeType = "Mono.Runtime";
   131         -
   132         -      /// <summary>
   133         -      /// Keeps track of whether we are running on Mono.  Initially null, it is
   134         -      /// set by the <see cref="IsMono" /> method on its first call.  Later, it
   135         -      /// is returned verbatim by the <see cref="IsMono" /> method.
   136         -      /// </summary>
   137         -      private static bool? isMono = null;
   138         -
   139         -      /// <summary>
   140         -      /// Determines whether or not this assembly is running on Mono.
   141         -      /// </summary>
   142         -      /// <returns>
   143         -      /// Non-zero if this assembly is running on Mono.
   144         -      /// </returns>
   145         -      private static bool IsMono()
   146         -      {
   147         -          try
   148         -          {
   149         -              lock (staticSyncRoot)
   150         -              {
   151         -                  if (isMono == null)
   152         -                      isMono = (Type.GetType(MonoRuntimeType) != null);
   153         -
   154         -                  return (bool)isMono;
   155         -              }
   156         -          }
   157         -          catch
   158         -          {
   159         -              // do nothing.
   160         -          }
   161         -
   162         -          return false;
   163         -      }
   164         -
   165         -      /////////////////////////////////////////////////////////////////////////
   166         -
   167         -      /// <summary>
   168         -      /// This is a wrapper around the
   169         -      /// <see cref="String.Format(IFormatProvider,String,Object[])" /> method.
   170         -      /// On Mono, it has to call the method overload without the
   171         -      /// <see cref="IFormatProvider" /> parameter, due to a bug in Mono.
   172         -      /// </summary>
   173         -      /// <param name="provider">
   174         -      /// This is used for culture-specific formatting.
   175         -      /// </param>
   176         -      /// <param name="format">
   177         -      /// The format string.
   178         -      /// </param>
   179         -      /// <param name="args">
   180         -      /// An array the objects to format.
   181         -      /// </param>
   182         -      /// <returns>
   183         -      /// The resulting string.
   184         -      /// </returns>
   185         -      internal static string StringFormat(
   186         -          IFormatProvider provider,
   187         -          string format,
   188         -          params object[] args
   189         -          )
   190         -      {
   191         -          if (IsMono())
   192         -              return String.Format(format, args);
   193         -          else
   194         -              return String.Format(provider, format, args);
   195         -      }
   196         -
   197         -      /////////////////////////////////////////////////////////////////////////
   198    584         /// <summary>
   199    585         /// Attempts to initialize this class by pre-loading the native SQLite
   200    586         /// library for the processor architecture of the current process.
   201    587         /// </summary>
   202    588         internal static void Initialize()
   203    589         {
   204    590   #if SQLITE_STANDARD || USE_INTEROP_DLL || PLATFORM_COMPACTFRAMEWORK
................................................................................
   207    593             // NOTE: If the "No_PreLoadSQLite" environment variable is set (to
   208    594             //       anything), skip all our special code and simply return.
   209    595             //
   210    596             if (GetSettingValue("No_PreLoadSQLite", null) != null)
   211    597                 return;
   212    598   #endif
   213    599   #endif
          600  +
          601  +          #region Debug Build Only
          602  +#if DEBUG
          603  +          //
          604  +          // NOTE: Create the list of statistics that will contain the
          605  +          //       number of times each setting value has been read.
          606  +          //
          607  +          DebugData.InitializeSettingReadCounts();
          608  +#endif
          609  +          #endregion
   214    610   
   215    611             lock (staticSyncRoot)
   216    612             {
   217         -#if DEBUG
   218         -              //
   219         -              // NOTE: Create the list of statistics that will contain the
   220         -              //       number of times each setting value has been read.
   221         -              //
   222         -              if (settingReadCounts == null)
   223         -                  settingReadCounts = new Dictionary<string, int>();
   224         -#endif
   225         -
   226    613                 //
   227    614                 // TODO: Make sure this list is updated if the supported
   228    615                 //       processor architecture names and/or platform names
   229    616                 //       changes.
   230    617                 //
   231    618                 if (processorArchitecturePlatforms == null)
   232    619                 {
................................................................................
   375    762             if (name == null)
   376    763                 return @default;
   377    764   
   378    765             /////////////////////////////////////////////////////////////////////
   379    766   
   380    767             #region Debug Build Only
   381    768   #if DEBUG
   382         -          lock (staticSyncRoot)
   383         -          {
   384         -              //
   385         -              // NOTE: Update statistics for this setting value.
   386         -              //
   387         -              if (settingReadCounts != null)
   388         -              {
   389         -                  int count;
   390         -
   391         -                  if (settingReadCounts.TryGetValue(name, out count))
   392         -                      settingReadCounts[name] = count + 1;
   393         -                  else
   394         -                      settingReadCounts.Add(name, 1);
   395         -              }
   396         -          }
          769  +          DebugData.IncrementSettingReadCount(name);
   397    770   #endif
   398    771             #endregion
   399    772   
   400    773             /////////////////////////////////////////////////////////////////////
   401    774   
   402    775             string value = null;
   403    776   
................................................................................
   404    777   #if !PLATFORM_COMPACTFRAMEWORK
   405    778             bool expand = true;
   406    779   
   407    780             if (Environment.GetEnvironmentVariable("No_Expand") != null)
   408    781             {
   409    782                 expand = false;
   410    783             }
   411         -          else if (Environment.GetEnvironmentVariable(StringFormat(
   412         -                  CultureInfo.InvariantCulture, "No_Expand_{0}",
   413         -                  name)) != null)
          784  +          else if (Environment.GetEnvironmentVariable(
          785  +                  HelperMethods.StringFormat(CultureInfo.InvariantCulture,
          786  +                  "No_Expand_{0}", name)) != null)
   414    787             {
   415    788                 expand = false;
   416    789             }
   417    790   
   418    791             value = Environment.GetEnvironmentVariable(name);
   419    792   
   420    793             if (expand && !String.IsNullOrEmpty(value))
................................................................................
   431    804                 if (fileName == null)
   432    805                     return @default;
   433    806   
   434    807                 XmlDocument document = new XmlDocument();
   435    808   
   436    809                 document.Load(fileName);
   437    810   
   438         -              XmlElement element = document.SelectSingleNode(StringFormat(
   439         -                  CultureInfo.InvariantCulture,
          811  +              XmlElement element = document.SelectSingleNode(
          812  +                  HelperMethods.StringFormat(CultureInfo.InvariantCulture,
   440    813                     "/configuration/appSettings/add[@key='{0}']", name)) as
   441    814                     XmlElement;
   442    815   
   443    816                 if (element != null)
   444    817                 {
   445    818                     if (element.HasAttribute("value"))
   446    819                         value = element.GetAttribute("value");
................................................................................
   459    832   #else
   460    833             catch (Exception)
   461    834   #endif
   462    835             {
   463    836   #if !NET_COMPACT_20 && TRACE_SHARED
   464    837                 try
   465    838                 {
   466         -                  Trace.WriteLine(StringFormat(
          839  +                  Trace.WriteLine(HelperMethods.StringFormat(
   467    840                         CultureInfo.CurrentCulture,
   468    841                         "Native library pre-loader failed to get setting " +
   469    842                         "\"{0}\" value: {1}", name, e)); /* throw */
   470    843                 }
   471    844                 catch
   472    845                 {
   473    846                     // do nothing.
................................................................................
   575    948                     directory, XmlConfigFileName);
   576    949   
   577    950                 if (File.Exists(xmlConfigFileName))
   578    951                 {
   579    952   #if !NET_COMPACT_20 && TRACE_DETECTION
   580    953                     try
   581    954                     {
   582         -                      Trace.WriteLine(StringFormat(
          955  +                      Trace.WriteLine(HelperMethods.StringFormat(
   583    956                             CultureInfo.CurrentCulture,
   584    957                             "Native library pre-loader found XML configuration file " +
   585    958                             "via code base for currently executing assembly: \"{0}\"",
   586    959                             xmlConfigFileName)); /* throw */
   587    960                     }
   588    961                     catch
   589    962                     {
................................................................................
   598    971                 List<string> matches = null;
   599    972   
   600    973                 if (CheckForArchitecturesAndPlatforms(directory, ref matches) > 0)
   601    974                 {
   602    975   #if !NET_COMPACT_20 && TRACE_DETECTION
   603    976                     try
   604    977                     {
   605         -                      Trace.WriteLine(StringFormat(
          978  +                      Trace.WriteLine(HelperMethods.StringFormat(
   606    979                             CultureInfo.CurrentCulture,
   607    980                             "Native library pre-loader found native sub-directories " +
   608    981                             "via code base for currently executing assembly: \"{0}\"",
   609    982                             ListToString(matches))); /* throw */
   610    983                     }
   611    984                     catch
   612    985                     {
................................................................................
   625    998   #else
   626    999             catch (Exception)
   627   1000   #endif
   628   1001             {
   629   1002   #if !NET_COMPACT_20 && TRACE_SHARED
   630   1003                 try
   631   1004                 {
   632         -                  Trace.WriteLine(StringFormat(
         1005  +                  Trace.WriteLine(HelperMethods.StringFormat(
   633   1006                         CultureInfo.CurrentCulture,
   634   1007                         "Native library pre-loader failed to check code base " +
   635   1008                         "for currently executing assembly: {0}", e)); /* throw */
   636   1009                 }
   637   1010                 catch
   638   1011                 {
   639   1012                     // do nothing.
................................................................................
   692   1065   #else
   693   1066             catch (Exception)
   694   1067   #endif
   695   1068             {
   696   1069   #if !NET_COMPACT_20 && TRACE_SHARED
   697   1070                 try
   698   1071                 {
   699         -                  Trace.WriteLine(StringFormat(
         1072  +                  Trace.WriteLine(HelperMethods.StringFormat(
   700   1073                         CultureInfo.CurrentCulture,
   701   1074                         "Native library pre-loader failed to get directory " +
   702   1075                         "for currently executing assembly: {0}", e)); /* throw */
   703   1076                 }
   704   1077                 catch
   705   1078                 {
   706   1079                     // do nothing.
................................................................................
   733   1106         /// <summary>
   734   1107         /// The name of the environment variable containing the processor
   735   1108         /// architecture of the current process.
   736   1109         /// </summary>
   737   1110         private static readonly string PROCESSOR_ARCHITECTURE =
   738   1111             "PROCESSOR_ARCHITECTURE";
   739   1112   
   740         -      /////////////////////////////////////////////////////////////////////////
   741         -      /// <summary>
   742         -      /// This is the P/Invoke method that wraps the native Win32 LoadLibrary
   743         -      /// function.  See the MSDN documentation for full details on what it
   744         -      /// does.
   745         -      /// </summary>
   746         -      /// <param name="fileName">
   747         -      /// The name of the executable library.
   748         -      /// </param>
   749         -      /// <returns>
   750         -      /// The native module handle upon success -OR- IntPtr.Zero on failure.
   751         -      /// </returns>
   752         -#if !PLATFORM_COMPACTFRAMEWORK
   753         -      [DllImport("kernel32",
   754         -#else
   755         -      [DllImport("coredll",
   756         -#endif
   757         -          CallingConvention = CallingConvention.Winapi, CharSet = CharSet.Auto,
   758         -#if !PLATFORM_COMPACTFRAMEWORK
   759         -          BestFitMapping = false, ThrowOnUnmappableChar = true,
   760         -#endif
   761         -          SetLastError = true)]
   762         -      private static extern IntPtr LoadLibrary(string fileName);
   763         -
   764         -      /////////////////////////////////////////////////////////////////////////
   765         -
   766         -#if PLATFORM_COMPACTFRAMEWORK
   767         -      /// <summary>
   768         -      /// This is the P/Invoke method that wraps the native Win32 GetSystemInfo
   769         -      /// function.  See the MSDN documentation for full details on what it
   770         -      /// does.
   771         -      /// </summary>
   772         -      /// <param name="systemInfo">
   773         -      /// The system information structure to be filled in by the function.
   774         -      /// </param>
   775         -      [DllImport("coredll", CallingConvention = CallingConvention.Winapi)]
   776         -      private static extern void GetSystemInfo(out SYSTEM_INFO systemInfo);
   777         -
   778         -      /////////////////////////////////////////////////////////////////////////
   779         -      /// <summary>
   780         -      /// This enumeration contains the possible values for the processor
   781         -      /// architecture field of the system information structure.
   782         -      /// </summary>
   783         -      private enum ProcessorArchitecture : ushort /* COMPAT: Win32. */
   784         -      {
   785         -          Intel = 0,
   786         -          MIPS = 1,
   787         -          Alpha = 2,
   788         -          PowerPC = 3,
   789         -          SHx = 4,
   790         -          ARM = 5,
   791         -          IA64 = 6,
   792         -          Alpha64 = 7,
   793         -          MSIL = 8,
   794         -          AMD64 = 9,
   795         -          IA32_on_Win64 = 10,
   796         -          Unknown = 0xFFFF
   797         -      }
   798         -
   799         -      /////////////////////////////////////////////////////////////////////////
   800         -      /// <summary>
   801         -      /// This structure contains information about the current computer. This
   802         -      /// includes the processor type, page size, memory addresses, etc.
   803         -      /// </summary>
   804         -      [StructLayout(LayoutKind.Sequential)]
   805         -      private struct SYSTEM_INFO
   806         -      {
   807         -          public ProcessorArchitecture wProcessorArchitecture;
   808         -          public ushort wReserved; /* NOT USED */
   809         -          public uint dwPageSize; /* NOT USED */
   810         -          public IntPtr lpMinimumApplicationAddress; /* NOT USED */
   811         -          public IntPtr lpMaximumApplicationAddress; /* NOT USED */
   812         -          public uint dwActiveProcessorMask; /* NOT USED */
   813         -          public uint dwNumberOfProcessors; /* NOT USED */
   814         -          public uint dwProcessorType; /* NOT USED */
   815         -          public uint dwAllocationGranularity; /* NOT USED */
   816         -          public ushort wProcessorLevel; /* NOT USED */
   817         -          public ushort wProcessorRevision; /* NOT USED */
   818         -      }
   819         -#endif
   820         -
   821   1113         /////////////////////////////////////////////////////////////////////////
   822   1114   
   823   1115         #region Private Data
   824   1116         /// <summary>
   825   1117         /// The native module file name for the native SQLite library or null.
   826   1118         /// </summary>
   827         -      private static string _SQLiteNativeModuleFileName = null;
         1119  +      internal static string _SQLiteNativeModuleFileName = null;
   828   1120   
   829   1121         /////////////////////////////////////////////////////////////////////////
   830   1122         /// <summary>
   831   1123         /// The native module handle for the native SQLite library or the value
   832   1124         /// IntPtr.Zero.
   833   1125         /// </summary>
   834   1126         private static IntPtr _SQLiteNativeModuleHandle = IntPtr.Zero;
   835   1127         #endregion
         1128  +
         1129  +      /////////////////////////////////////////////////////////////////////////
         1130  +      /// <summary>
         1131  +      /// Determines the base file name (without any directory information)
         1132  +      /// for the native SQLite library to be pre-loaded by this class.
         1133  +      /// </summary>
         1134  +      /// <returns>
         1135  +      /// The base file name for the native SQLite library to be pre-loaded by
         1136  +      /// this class -OR- null if its value cannot be determined.
         1137  +      /// </returns>
         1138  +      internal static string GetNativeLibraryFileNameOnly()
         1139  +      {
         1140  +          string fileNameOnly = GetSettingValue(
         1141  +              "PreLoadSQLite_LibraryFileNameOnly", null);
         1142  +
         1143  +          if (fileNameOnly != null)
         1144  +              return fileNameOnly;
         1145  +
         1146  +          return SQLITE_DLL; /* COMPAT */
         1147  +      }
   836   1148   
   837   1149         /////////////////////////////////////////////////////////////////////////
   838   1150         /// <summary>
   839   1151         /// Searches for the native SQLite library in the directory containing
   840   1152         /// the assembly currently being executed as well as the base directory
   841   1153         /// for the current application domain.
   842   1154         /// </summary>
................................................................................
   860   1172         {
   861   1173             if (GetSettingValue(
   862   1174                   "PreLoadSQLite_NoSearchForDirectory", null) != null)
   863   1175             {
   864   1176                 return false; /* DISABLED */
   865   1177             }
   866   1178   
         1179  +          //
         1180  +          // NOTE: Determine the base file name for the native SQLite library.
         1181  +          //       If this is not known by this class, we cannot continue.
         1182  +          //
         1183  +          string fileNameOnly = GetNativeLibraryFileNameOnly();
         1184  +
         1185  +          if (fileNameOnly == null)
         1186  +              return false;
         1187  +
   867   1188             //
   868   1189             // NOTE: Build the list of base directories and processor/platform
   869   1190             //       names.  These lists will be used to help locate the native
   870   1191             //       SQLite core library (or interop assembly) to pre-load into
   871   1192             //       this process.
   872   1193             //
   873   1194             string[] directories = {
................................................................................
   888   1209   
   889   1210                 foreach (string subDirectory in subDirectories)
   890   1211                 {
   891   1212                     if (subDirectory == null)
   892   1213                         continue;
   893   1214   
   894   1215                     string fileName = FixUpDllFileName(MaybeCombinePath(
   895         -                      MaybeCombinePath(directory, subDirectory), SQLITE_DLL));
         1216  +                      MaybeCombinePath(directory, subDirectory),
         1217  +                      fileNameOnly));
   896   1218   
   897   1219                     //
   898   1220                     // NOTE: If the SQLite DLL file exists, return success.
   899   1221                     //       Prior to returning, set the base directory and
   900   1222                     //       processor architecture to reflect the location
   901   1223                     //       where it was found.
   902   1224                     //
................................................................................
   978   1300         /// </returns>
   979   1301         private static string FixUpDllFileName(
   980   1302             string fileName /* in */
   981   1303             )
   982   1304         {
   983   1305             if (!String.IsNullOrEmpty(fileName))
   984   1306             {
   985         -              PlatformID platformId = Environment.OSVersion.Platform;
   986         -
   987         -              if ((platformId == PlatformID.Win32S) ||
   988         -                  (platformId == PlatformID.Win32Windows) ||
   989         -                  (platformId == PlatformID.Win32NT) ||
   990         -                  (platformId == PlatformID.WinCE))
         1307  +              if (HelperMethods.IsWindows())
   991   1308                 {
   992   1309                     if (!fileName.EndsWith(DllFileExtension,
   993   1310                             StringComparison.OrdinalIgnoreCase))
   994   1311                     {
   995   1312                         return fileName + DllFileExtension;
   996   1313                     }
   997   1314                 }
................................................................................
  1062   1379   #if !NET_COMPACT_20 && TRACE_DETECTION
  1063   1380                 try
  1064   1381                 {
  1065   1382                     //
  1066   1383                     // NOTE: Show that we hit a fairly unusual situation (i.e.
  1067   1384                     //       the "wrong" processor architecture was detected).
  1068   1385                     //
  1069         -                  Trace.WriteLine(StringFormat(
         1386  +                  Trace.WriteLine(HelperMethods.StringFormat(
  1070   1387                         CultureInfo.CurrentCulture,
  1071   1388                         "Native library pre-loader detected {0}-bit pointer " +
  1072   1389                         "size with processor architecture \"{1}\", using " +
  1073   1390                         "processor architecture \"{2}\" instead...",
  1074   1391                         IntPtr.Size * 8 /* bits */, savedProcessorArchitecture,
  1075   1392                         processorArchitecture)); /* throw */
  1076   1393                 }
................................................................................
  1091   1408                 try
  1092   1409                 {
  1093   1410                     //
  1094   1411                     // NOTE: The output of the GetSystemInfo function will be
  1095   1412                     //       placed here.  Only the processor architecture field
  1096   1413                     //       is used by this method.
  1097   1414                     //
  1098         -                  SYSTEM_INFO systemInfo;
         1415  +                  UnsafeNativeMethodsWin32.SYSTEM_INFO systemInfo;
  1099   1416   
  1100   1417                     //
  1101   1418                     // NOTE: Query the system information via P/Invoke, thus
  1102   1419                     //       filling the structure.
  1103   1420                     //
  1104         -                  GetSystemInfo(out systemInfo);
         1421  +                  UnsafeNativeMethodsWin32.GetSystemInfo(out systemInfo);
  1105   1422   
  1106   1423                     //
  1107   1424                     // NOTE: Return the processor architecture value as a string.
  1108   1425                     //
  1109   1426                     processorArchitecture =
  1110   1427                         systemInfo.wProcessorArchitecture.ToString();
  1111   1428                 }
................................................................................
  1210   1527   
  1211   1528             //
  1212   1529             // NOTE: If we failed to query the base directory, stop now.
  1213   1530             //
  1214   1531             if (baseDirectory == null)
  1215   1532                 return false;
  1216   1533   
         1534  +          //
         1535  +          // NOTE: Determine the base file name for the native SQLite library.
         1536  +          //       If this is not known by this class, we cannot continue.
         1537  +          //
         1538  +          string fileNameOnly = GetNativeLibraryFileNameOnly();
         1539  +
         1540  +          if (fileNameOnly == null)
         1541  +              return false;
         1542  +
  1217   1543             //
  1218   1544             // NOTE: If the native SQLite library exists in the base directory
  1219   1545             //       itself, stop now.
  1220   1546             //
  1221         -          string fileName = FixUpDllFileName(MaybeCombinePath(
  1222         -              baseDirectory, SQLITE_DLL));
         1547  +          string fileName = FixUpDllFileName(MaybeCombinePath(baseDirectory,
         1548  +              fileNameOnly));
  1223   1549   
  1224   1550             if (File.Exists(fileName))
  1225   1551                 return false;
  1226   1552   
  1227   1553             //
  1228   1554             // NOTE: If the specified processor architecture is null, use the
  1229   1555             //       default.
................................................................................
  1238   1564                 return false;
  1239   1565   
  1240   1566             //
  1241   1567             // NOTE: Build the full path and file name for the native SQLite
  1242   1568             //       library using the processor architecture name.
  1243   1569             //
  1244   1570             fileName = FixUpDllFileName(MaybeCombinePath(MaybeCombinePath(
  1245         -              baseDirectory, processorArchitecture), SQLITE_DLL));
         1571  +              baseDirectory, processorArchitecture), fileNameOnly));
  1246   1572   
  1247   1573             //
  1248   1574             // NOTE: If the file name based on the processor architecture name
  1249   1575             // is not found, try using the associated platform name.
  1250   1576             //
  1251   1577             if (!File.Exists(fileName))
  1252   1578             {
................................................................................
  1263   1589                     return false;
  1264   1590   
  1265   1591                 //
  1266   1592                 // NOTE: Build the full path and file name for the native SQLite
  1267   1593                 //       library using the platform name.
  1268   1594                 //
  1269   1595                 fileName = FixUpDllFileName(MaybeCombinePath(MaybeCombinePath(
  1270         -                  baseDirectory, platformName), SQLITE_DLL));
         1596  +                  baseDirectory, platformName), fileNameOnly));
  1271   1597   
  1272   1598                 //
  1273   1599                 // NOTE: If the file does not exist, skip trying to load it.
  1274   1600                 //
  1275   1601                 if (!File.Exists(fileName))
  1276   1602                     return false;
  1277   1603             }
................................................................................
  1281   1607   #if !NET_COMPACT_20 && TRACE_PRELOAD
  1282   1608                 try
  1283   1609                 {
  1284   1610                     //
  1285   1611                     // NOTE: Show exactly where we are trying to load the native
  1286   1612                     //       SQLite library from.
  1287   1613                     //
  1288         -                  Trace.WriteLine(StringFormat(
         1614  +                  Trace.WriteLine(HelperMethods.StringFormat(
  1289   1615                         CultureInfo.CurrentCulture,
  1290   1616                         "Native library pre-loader is trying to load native " +
  1291   1617                         "SQLite library \"{0}\"...", fileName)); /* throw */
  1292   1618                 }
  1293   1619                 catch
  1294   1620                 {
  1295   1621                     // do nothing.
  1296   1622                 }
  1297   1623   #endif
  1298   1624   
  1299   1625                 //
  1300   1626                 // NOTE: Attempt to load the native library.  This will either
  1301   1627                 //       return a valid native module handle, return IntPtr.Zero,
  1302         -              //       or throw an exception.
         1628  +              //       or throw an exception.  This must use the appropriate
         1629  +              //       P/Invoke method for the current operating system.
  1303   1630                 //
  1304   1631                 nativeModuleFileName = fileName;
  1305         -              nativeModuleHandle = LoadLibrary(fileName);
         1632  +              nativeModuleHandle = NativeLibraryHelper.LoadLibrary(fileName);
  1306   1633   
  1307   1634                 return (nativeModuleHandle != IntPtr.Zero);
  1308   1635             }
  1309   1636   #if !NET_COMPACT_20 && TRACE_PRELOAD
  1310   1637             catch (Exception e)
  1311   1638   #else
  1312   1639             catch (Exception)
................................................................................
  1321   1648                     int lastError = Marshal.GetLastWin32Error(); /* throw */
  1322   1649   
  1323   1650                     //
  1324   1651                     // NOTE: Show where we failed to load the native SQLite
  1325   1652                     //       library from along with the Win32 error code and
  1326   1653                     //       exception information.
  1327   1654                     //
  1328         -                  Trace.WriteLine(StringFormat(
         1655  +                  Trace.WriteLine(HelperMethods.StringFormat(
  1329   1656                         CultureInfo.CurrentCulture,
  1330   1657                         "Native library pre-loader failed to load native " +
  1331   1658                         "SQLite library \"{0}\" (getLastError = {1}): {2}",
  1332   1659                         fileName, lastError, e)); /* throw */
  1333   1660                 }
  1334   1661                 catch
  1335   1662                 {
................................................................................
  1350   1677       //
  1351   1678       // NOTE: On the .NET Compact Framework, the native interop assembly must
  1352   1679       //       be used because it provides several workarounds to .NET Compact
  1353   1680       //       Framework limitations important for proper operation of the core
  1354   1681       //       System.Data.SQLite functionality (e.g. being able to bind
  1355   1682       //       parameters and handle column values of types Int64 and Double).
  1356   1683       //
         1684  +#if SQLITE_STANDARD_LIBRARY_NAME
         1685  +    internal const string SQLITE_DLL = "sqlite3";
         1686  +#else
  1357   1687       internal const string SQLITE_DLL = "SQLite.Interop.100.dll";
         1688  +#endif
  1358   1689   #elif SQLITE_STANDARD
  1359   1690       //
  1360   1691       // NOTE: Otherwise, if the standard SQLite library is enabled, use it.
  1361   1692       //
  1362   1693       internal const string SQLITE_DLL = "sqlite3";
  1363   1694   #elif USE_INTEROP_DLL
  1364         -      //
         1695  +    //
  1365   1696       // NOTE: Otherwise, if the native SQLite interop assembly is enabled,
  1366   1697       //       use it.
  1367   1698       //
         1699  +#if SQLITE_STANDARD_LIBRARY_NAME
         1700  +    internal const string SQLITE_DLL = "sqlite3";
         1701  +#else
  1368   1702       internal const string SQLITE_DLL = "SQLite.Interop.dll";
         1703  +#endif
  1369   1704   #else
  1370   1705       //
  1371   1706       // NOTE: Finally, assume that the mixed-mode assembly is being used.
  1372   1707       //
  1373   1708       internal const string SQLITE_DLL = "System.Data.SQLite.dll";
  1374   1709   #endif
  1375   1710   
................................................................................
  2909   3244           public long estimatedRows;   /* Estimated number of rows returned */
  2910   3245           public SQLiteIndexFlags idxFlags; /* Mask of SQLITE_INDEX_SCAN_* flags */
  2911   3246           public long colUsed;         /* Input: Mask of columns used by statement */
  2912   3247       }
  2913   3248   #endif
  2914   3249       #endregion
  2915   3250     }
         3251  +  #endregion
  2916   3252   
  2917   3253     /////////////////////////////////////////////////////////////////////////////
  2918   3254   
         3255  +  #region .NET Compact Framework (only) CriticalHandle Class
  2919   3256   #if PLATFORM_COMPACTFRAMEWORK
  2920   3257     internal abstract class CriticalHandle : IDisposable
  2921   3258     {
  2922   3259       private bool _isClosed;
  2923   3260       protected IntPtr handle;
  2924   3261   
  2925   3262       protected CriticalHandle(IntPtr invalidHandleValue)
................................................................................
  2981   3318   
  2982   3319       public abstract bool IsInvalid
  2983   3320       {
  2984   3321         get;
  2985   3322       }
  2986   3323   
  2987   3324     }
  2988         -
  2989   3325   #endif
         3326  +  #endregion
  2990   3327   
  2991   3328       ///////////////////////////////////////////////////////////////////////////
  2992   3329   
  2993   3330       #region SQLiteConnectionHandle Class
  2994   3331       // Handles the unmanaged database pointer, and provides finalization
  2995   3332       // support for it.
  2996   3333       internal sealed class SQLiteConnectionHandle : CriticalHandle
................................................................................
  3046   3383           ///////////////////////////////////////////////////////////////////////
  3047   3384   
  3048   3385           private SQLiteConnectionHandle(bool ownHandle)
  3049   3386               : base(IntPtr.Zero)
  3050   3387           {
  3051   3388   #if COUNT_HANDLE
  3052   3389               if (ownHandle)
  3053         -                Interlocked.Increment(ref UnsafeNativeMethods.connectionCount);
         3390  +                Interlocked.Increment(ref DebugData.connectionCount);
  3054   3391   #endif
  3055   3392           }
  3056   3393   
  3057   3394           ///////////////////////////////////////////////////////////////////////
  3058   3395   
  3059   3396           protected override bool ReleaseHandle()
  3060   3397           {
................................................................................
  3078   3415                   if (localHandle != IntPtr.Zero)
  3079   3416                       SQLiteBase.CloseConnection(this, localHandle);
  3080   3417   #endif
  3081   3418   
  3082   3419   #if !NET_COMPACT_20 && TRACE_HANDLE
  3083   3420                   try
  3084   3421                   {
  3085         -                    Trace.WriteLine(UnsafeNativeMethods.StringFormat(
         3422  +                    Trace.WriteLine(HelperMethods.StringFormat(
  3086   3423                           CultureInfo.CurrentCulture,
  3087   3424                           "CloseConnection: {0}", localHandle)); /* throw */
  3088   3425                   }
  3089   3426                   catch
  3090   3427                   {
  3091   3428                   }
  3092   3429   #endif
................................................................................
  3097   3434                       {
  3098   3435                           SQLiteBase.CloseConnection(this, handle);
  3099   3436                           SetHandle(IntPtr.Zero);
  3100   3437                       }
  3101   3438                   }
  3102   3439   #endif
  3103   3440   #if COUNT_HANDLE
  3104         -                Interlocked.Decrement(
  3105         -                    ref UnsafeNativeMethods.connectionCount);
         3441  +                Interlocked.Decrement(ref DebugData.connectionCount);
  3106   3442   #endif
  3107   3443   #if DEBUG
  3108   3444                   return true;
  3109   3445   #endif
  3110   3446               }
  3111   3447   #if !NET_COMPACT_20 && TRACE_HANDLE
  3112   3448               catch (SQLiteException e)
................................................................................
  3113   3449   #else
  3114   3450               catch (SQLiteException)
  3115   3451   #endif
  3116   3452               {
  3117   3453   #if !NET_COMPACT_20 && TRACE_HANDLE
  3118   3454                   try
  3119   3455                   {
  3120         -                    Trace.WriteLine(UnsafeNativeMethods.StringFormat(
         3456  +                    Trace.WriteLine(HelperMethods.StringFormat(
  3121   3457                           CultureInfo.CurrentCulture,
  3122   3458                           "CloseConnection: {0}, exception: {1}",
  3123   3459                           handle, e)); /* throw */
  3124   3460                   }
  3125   3461                   catch
  3126   3462                   {
  3127   3463                   }
................................................................................
  3144   3480           }
  3145   3481   
  3146   3482           ///////////////////////////////////////////////////////////////////////
  3147   3483   
  3148   3484   #if COUNT_HANDLE
  3149   3485           public int WasReleasedOk()
  3150   3486           {
  3151         -            return Interlocked.Decrement(
  3152         -                ref UnsafeNativeMethods.connectionCount);
         3487  +            return Interlocked.Decrement(ref DebugData.connectionCount);
  3153   3488           }
  3154   3489   #endif
  3155   3490   
  3156   3491           ///////////////////////////////////////////////////////////////////////
  3157   3492   
  3158   3493           public bool OwnHandle
  3159   3494           {
................................................................................
  3245   3580   
  3246   3581           ///////////////////////////////////////////////////////////////////////
  3247   3582   
  3248   3583           private SQLiteStatementHandle()
  3249   3584               : base(IntPtr.Zero)
  3250   3585           {
  3251   3586   #if COUNT_HANDLE
  3252         -            Interlocked.Increment(
  3253         -                ref UnsafeNativeMethods.statementCount);
         3587  +            Interlocked.Increment(ref DebugData.statementCount);
  3254   3588   #endif
  3255   3589           }
  3256   3590   
  3257   3591           ///////////////////////////////////////////////////////////////////////
  3258   3592   
  3259   3593           protected override bool ReleaseHandle()
  3260   3594           {
................................................................................
  3266   3600   
  3267   3601                   if (localHandle != IntPtr.Zero)
  3268   3602                       SQLiteBase.FinalizeStatement(cnn, localHandle);
  3269   3603   
  3270   3604   #if !NET_COMPACT_20 && TRACE_HANDLE
  3271   3605                   try
  3272   3606                   {
  3273         -                    Trace.WriteLine(UnsafeNativeMethods.StringFormat(
         3607  +                    Trace.WriteLine(HelperMethods.StringFormat(
  3274   3608                           CultureInfo.CurrentCulture,
  3275   3609                           "FinalizeStatement: {0}", localHandle)); /* throw */
  3276   3610                   }
  3277   3611                   catch
  3278   3612                   {
  3279   3613                   }
  3280   3614   #endif
................................................................................
  3285   3619                       {
  3286   3620                           SQLiteBase.FinalizeStatement(cnn, handle);
  3287   3621                           SetHandle(IntPtr.Zero);
  3288   3622                       }
  3289   3623                   }
  3290   3624   #endif
  3291   3625   #if COUNT_HANDLE
  3292         -                Interlocked.Decrement(
  3293         -                    ref UnsafeNativeMethods.statementCount);
         3626  +                Interlocked.Decrement(ref DebugData.statementCount);
  3294   3627   #endif
  3295   3628   #if DEBUG
  3296   3629                   return true;
  3297   3630   #endif
  3298   3631               }
  3299   3632   #if !NET_COMPACT_20 && TRACE_HANDLE
  3300   3633               catch (SQLiteException e)
................................................................................
  3301   3634   #else
  3302   3635               catch (SQLiteException)
  3303   3636   #endif
  3304   3637               {
  3305   3638   #if !NET_COMPACT_20 && TRACE_HANDLE
  3306   3639                   try
  3307   3640                   {
  3308         -                    Trace.WriteLine(UnsafeNativeMethods.StringFormat(
         3641  +                    Trace.WriteLine(HelperMethods.StringFormat(
  3309   3642                           CultureInfo.CurrentCulture,
  3310   3643                           "FinalizeStatement: {0}, exception: {1}",
  3311   3644                           handle, e)); /* throw */
  3312   3645                   }
  3313   3646                   catch
  3314   3647                   {
  3315   3648                   }
................................................................................
  3332   3665           }
  3333   3666   
  3334   3667           ///////////////////////////////////////////////////////////////////////
  3335   3668   
  3336   3669   #if COUNT_HANDLE
  3337   3670           public int WasReleasedOk()
  3338   3671           {
  3339         -            return Interlocked.Decrement(
  3340         -                ref UnsafeNativeMethods.statementCount);
         3672  +            return Interlocked.Decrement(ref DebugData.statementCount);
  3341   3673           }
  3342   3674   #endif
  3343   3675   
  3344   3676           ///////////////////////////////////////////////////////////////////////
  3345   3677   
  3346   3678           public override bool IsInvalid
  3347   3679           {
................................................................................
  3418   3750   
  3419   3751           ///////////////////////////////////////////////////////////////////////
  3420   3752   
  3421   3753           private SQLiteBackupHandle()
  3422   3754               : base(IntPtr.Zero)
  3423   3755           {
  3424   3756   #if COUNT_HANDLE
  3425         -            Interlocked.Increment(
  3426         -                ref UnsafeNativeMethods.backupCount);
         3757  +            Interlocked.Increment(ref DebugData.backupCount);
  3427   3758   #endif
  3428   3759           }
  3429   3760   
  3430   3761           ///////////////////////////////////////////////////////////////////////
  3431   3762   
  3432   3763           protected override bool ReleaseHandle()
  3433   3764           {
................................................................................
  3439   3770   
  3440   3771                   if (localHandle != IntPtr.Zero)
  3441   3772                       SQLiteBase.FinishBackup(cnn, localHandle);
  3442   3773   
  3443   3774   #if !NET_COMPACT_20 && TRACE_HANDLE
  3444   3775                   try
  3445   3776                   {
  3446         -                    Trace.WriteLine(UnsafeNativeMethods.StringFormat(
         3777  +                    Trace.WriteLine(HelperMethods.StringFormat(
  3447   3778                           CultureInfo.CurrentCulture,
  3448   3779                           "FinishBackup: {0}", localHandle)); /* throw */
  3449   3780                   }
  3450   3781                   catch
  3451   3782                   {
  3452   3783                   }
  3453   3784   #endif
................................................................................
  3458   3789                       {
  3459   3790                           SQLiteBase.FinishBackup(cnn, handle);
  3460   3791                           SetHandle(IntPtr.Zero);
  3461   3792                       }
  3462   3793                   }
  3463   3794   #endif
  3464   3795   #if COUNT_HANDLE
  3465         -                Interlocked.Decrement(
  3466         -                    ref UnsafeNativeMethods.backupCount);
         3796  +                Interlocked.Decrement(ref DebugData.backupCount);
  3467   3797   #endif
  3468   3798   #if DEBUG
  3469   3799                   return true;
  3470   3800   #endif
  3471   3801               }
  3472   3802   #if !NET_COMPACT_20 && TRACE_HANDLE
  3473   3803               catch (SQLiteException e)
................................................................................
  3474   3804   #else
  3475   3805               catch (SQLiteException)
  3476   3806   #endif
  3477   3807               {
  3478   3808   #if !NET_COMPACT_20 && TRACE_HANDLE
  3479   3809                   try
  3480   3810                   {
  3481         -                    Trace.WriteLine(UnsafeNativeMethods.StringFormat(
         3811  +                    Trace.WriteLine(HelperMethods.StringFormat(
  3482   3812                           CultureInfo.CurrentCulture,
  3483   3813                           "FinishBackup: {0}, exception: {1}",
  3484   3814                           handle, e)); /* throw */
  3485   3815                   }
  3486   3816                   catch
  3487   3817                   {
  3488   3818                   }
................................................................................
  3505   3835           }
  3506   3836   
  3507   3837           ///////////////////////////////////////////////////////////////////////
  3508   3838   
  3509   3839   #if COUNT_HANDLE
  3510   3840           public int WasReleasedOk()
  3511   3841           {
  3512         -            return Interlocked.Decrement(
  3513         -                ref UnsafeNativeMethods.backupCount);
         3842  +            return Interlocked.Decrement(ref DebugData.backupCount);
  3514   3843           }
  3515   3844   #endif
  3516   3845   
  3517   3846           ///////////////////////////////////////////////////////////////////////
  3518   3847   
  3519   3848           public override bool IsInvalid
  3520   3849           {

Changes to Targets/SQLite.NET.Settings.targets.

   338    338                 standard DLL (i.e. "sqlite3.dll")?  By default, this is disabled.
   339    339                 This property is mutually exclusive with the "UseInteropDll" one,
   340    340                 above.  This should always be disabled in the project file that
   341    341                 builds the NetModule target.
   342    342       -->
   343    343       <UseSqliteStandard Condition="'$(UseSqliteStandard)' == ''">false</UseSqliteStandard>
   344    344   
          345  +    <!--
          346  +        NOTE: For interaction with the native SQLite implementation, use the
          347  +              standard DLL file name (i.e. "sqlite3.dll") even when compiled
          348  +              to use the interop DLL??  By default, this is disabled.  This
          349  +              should always be disabled in the project file that builds the
          350  +              NetModule target.
          351  +    -->
          352  +    <UseSqliteStandardLibraryName Condition="'$(UseSqliteStandardLibraryName)' == ''">false</UseSqliteStandardLibraryName>
          353  +
   345    354       <!--
   346    355           NOTE: Is the project being built to support the .NET Compact Framework?
   347    356       -->
   348    357       <IsCompactFramework Condition="'$(IsCompactFramework)' == ''">false</IsCompactFramework>
   349    358   
   350    359       <!--
   351    360           NOTE: Emit an AssemblyFlags attribute that includes the Retargetable

Changes to Tests/backup.eagle.

    77     77   for {set i 0} {$i < [llength $params(pages)]} {incr i} {
    78     78     set pages [lindex $params(pages) $i]
    79     79     set callback [lindex $params(callbacks) $i]
    80     80   
    81     81     runTest {test [appendArgs backup-1. $i] {BackupDatabase method} -setup {
    82     82       setupDb [set fileName(1) :memory:] "" "" "" "" "" \
    83     83           false false false true memDb
           84  +
           85  +    useLegacyDbPageAndCacheSizes memDb
    84     86   
    85     87       setupDb [set fileName(2) [appendArgs backup-1. $i .db]]
           88  +
           89  +    useLegacyDbPageAndCacheSizes db
    86     90     } -body {
    87     91       set id [object invoke Interpreter.GetActive NextId]
    88     92       set dataSource [file join [getDatabaseDirectory] $fileName(2)]
    89     93   
    90     94       sql execute $memDb {
    91     95         CREATE TABLE t1(x TEXT);
    92     96       }

Changes to Tests/basic.eagle.

   403    403       }
   404    404     }
   405    405   
   406    406     cleanupDb $fileName
   407    407   
   408    408     unset -nocomplain result count interval savedCount savedInterval results \
   409    409         errors code dataSource id db fileName
   410         -} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
   411         -System.Data.SQLite compileCSharp} -match regexp -result {^Ok\
          410  +} -constraints {eagle command.object windows monoBug28 command.sql compile.DATA\
          411  +SQLite System.Data.SQLite compileCSharp} -match regexp -result {^Ok\
   412    412   System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 True$}}
   413    413   
   414    414   ###############################################################################
   415    415   
   416    416   runTest {test data-1.8 {properly closed database file (non-query)} -setup {
   417    417     set fileName data-1.8.db
   418    418   } -body {
................................................................................
  1112   1112     #       The basic problem here is that the Parse [and TryParse] methods of
  1113   1113     #       the DateTime structure seem to always return local time, even when
  1114   1114     #       string value clearly indicates otherwise (i.e. the trailing "Z",
  1115   1115     #       indicating UTC).
  1116   1116     #
  1117   1117     expr {round([object invoke System.Data.SQLite.SQLiteConvert ToUnixEpoch \
  1118   1118         "2012-01-01 12:00:00Z"])}
  1119         -} -constraints {eagle command.object System.Data.SQLite} -result {1325390400}}
         1119  +} -constraints {eagle command.object monoBug42 System.Data.SQLite} -result \
         1120  +{1325390400}}
  1120   1121   
  1121   1122   ###############################################################################
  1122   1123   
  1123   1124   runTest {test data-1.21 {SQLiteConvert ToUnixEpoch (Local)} -body {
  1124   1125     #
  1125   1126     # NOTE: At first, the test result here may not seem correct; however, the
  1126   1127     #       same result can be seen by compiling and running the following C#
................................................................................
  1682   1683     set result
  1683   1684   } -cleanup {
  1684   1685     cleanupDb $fileName
  1685   1686   
  1686   1687     unset -nocomplain result db fileName
  1687   1688   } -constraints \
  1688   1689   {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
  1689         -{1024 1073741823 0 2 2000 delete 0}}
         1690  +[list [getDbDefaultPageSize] 1073741823 0 2 [getDbDefaultCacheSize] delete 0]}
  1690   1691   
  1691   1692   ###############################################################################
  1692   1693   
  1693   1694   runTest {test data-1.34 {SQLiteConnection.Open with SetDefaults=True} -setup {
  1694   1695     setupDb [set fileName data-1.34.db] "" "" "" "" SetDefaults=True
  1695   1696   } -body {
  1696   1697     set result [list]
................................................................................
  1706   1707     set result
  1707   1708   } -cleanup {
  1708   1709     cleanupDb $fileName
  1709   1710   
  1710   1711     unset -nocomplain result db fileName
  1711   1712   } -constraints \
  1712   1713   {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
  1713         -{1024 1073741823 0 2 2000 delete 0}}
         1714  +[list [getDbDefaultPageSize] 1073741823 0 2 [getDbDefaultCacheSize] delete 0]}
  1714   1715   
  1715   1716   ###############################################################################
  1716   1717   
  1717   1718   runTest {test data-1.35 {SQLiteConnection.Open without SetDefaults} -setup {
  1718   1719     setupDb [set fileName data-1.35.db]
  1719   1720   } -body {
  1720   1721     set result [list]
................................................................................
  1730   1731     set result
  1731   1732   } -cleanup {
  1732   1733     cleanupDb $fileName
  1733   1734   
  1734   1735     unset -nocomplain result db fileName
  1735   1736   } -constraints \
  1736   1737   {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
  1737         -{1024 1073741823 0 2 2000 delete 0}}
         1738  +[list [getDbDefaultPageSize] 1073741823 0 2 [getDbDefaultCacheSize] delete 0]}
  1738   1739   
  1739   1740   ###############################################################################
  1740   1741   
  1741   1742   runTest {test data-1.36 {SQLiteConnection.Open with PRAGMA overrides} -setup {
  1742   1743     #
  1743   1744     # NOTE: Attempt to open a connection with all available PRAGMA settings
  1744   1745     #       set to non-default values in the connection string.
................................................................................
  1822   1823         $directory(temp)]
  1823   1824   
  1824   1825     setupDb [set fileName data-1.37.db] "" "" "" "" "" false false false false
  1825   1826   
  1826   1827     sql execute $db "CREATE TABLE t1(x NOT NULL);"
  1827   1828   
  1828   1829     for {set i 1} {$i < 100} {incr i} {
  1829         -    sql execute $db "INSERT INTO t1 (x) VALUES(?);" [list param1 String $i]
         1830  +    sql execute $db "INSERT INTO t1 (x) VALUES(?);" \
         1831  +        [list param1 String [expr {randstr(1024)}]]
  1830   1832     }
  1831   1833   
  1832   1834     set found(data) [expr \
  1833   1835         {[llength [file list $directory(data) $fileName]] == 1}]
  1834   1836   
  1835   1837     set t [object create -alias Thread threadStart]
  1836   1838     sql execute $db "BEGIN TRANSACTION;"; $t Start
  1837   1839   
  1838   1840     for {set i 1} {$i < 1000} {incr i} {
  1839   1841       #
  1840   1842       # NOTE: Execute a query that should force the creation of a temporary file
  1841   1843       #       for its statement journal.
  1842   1844       #
  1843         -    sql execute $db "UPDATE t1 SET x = ?;" [list param1 String $i]
         1845  +    sql execute $db "UPDATE t1 SET x = ?;" \
         1846  +        [list param1 String [expr {randstr(1024)}]]
  1844   1847   
  1845   1848       #
  1846   1849       # NOTE: Give the other thread some time to notice the temporary file.
  1847   1850       #
  1848   1851       after [expr {int(rand() * 1000)}]
  1849   1852   
  1850   1853       #
................................................................................
  2502   2505         [list param1 DateTime [set dateTime [object invoke DateTime Parse \
  2503   2506         "2000.02.29 13:59:58.1234567Z"]]]] [sql execute -execute reader \
  2504   2507         -format list $db "SELECT x FROM t1;"]
  2505   2508   } -cleanup {
  2506   2509     cleanupDb $fileName
  2507   2510   
  2508   2511     unset -nocomplain dateTime db fileName
  2509         -} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
  2510         -System.Data.SQLite} -result {1 630874007980000000}}
         2512  +} -constraints {eagle command.object monoBug28 monoBug42 command.sql\
         2513  +compile.DATA SQLite System.Data.SQLite} -result {1 630874007980000000}}
  2511   2514   
  2512   2515   ###############################################################################
  2513   2516   
  2514   2517   runTest {test data-1.54 {bind function to a connection} -setup {
  2515   2518     set fileName data-1.54.db
  2516   2519   } -body {
  2517   2520     set id [object invoke Interpreter.GetActive NextId]
................................................................................
  2651   2654   runTest {test data-1.56 {totype extension} -setup {
  2652   2655     setupDb [set fileName data-1.56.db]
  2653   2656   } -body {
  2654   2657     set connection [getDbConnection]
  2655   2658     set result [list]
  2656   2659   
  2657   2660     $connection EnableExtensions true
  2658         -  $connection LoadExtension [getCoreBinaryFileName] sqlite3_totype_init
         2661  +
         2662  +  $connection LoadExtension \
         2663  +      [getNativeLibraryFileName null] sqlite3_totype_init
  2659   2664   
  2660   2665     lappend result [sql execute -execute scalar $db "SELECT tointeger('1');"]
  2661   2666     lappend result [sql execute -execute scalar $db "SELECT tointeger('1x');"]
  2662   2667     lappend result [sql execute -execute scalar $db "SELECT toreal('1.01');"]
  2663   2668     lappend result [sql execute -execute scalar $db "SELECT toreal('1.0x');"]
  2664   2669   
  2665   2670     set result
................................................................................
  2682   2687   } -body {
  2683   2688     unset -nocomplain pattern result
  2684   2689   
  2685   2690     set connection [getDbConnection]
  2686   2691     set result(1) [list]
  2687   2692   
  2688   2693     $connection EnableExtensions true
  2689         -  $connection LoadExtension [getCoreBinaryFileName] sqlite3_regexp_init
         2694  +
         2695  +  $connection LoadExtension \
         2696  +      [getNativeLibraryFileName null] sqlite3_regexp_init
  2690   2697   
  2691   2698     set pattern(1) {^\d+ [A-Z]{1,3}$}; # valid
  2692   2699     set pattern(2) {^\d+ [C]($}; # invalid
  2693   2700   
  2694   2701     lappend result(1) [catch {
  2695   2702       sql execute -execute scalar $db "SELECT REGEXP('$pattern(1)', '1 AB');"
  2696   2703     } result(2)] $result(2)
................................................................................
  2780   2787         "---- largest free SQLite heap block... " $nLargest " bytes\n"]
  2781   2788   
  2782   2789     lappend result [list $code $nFree $resetOk $nLargest]
  2783   2790   } -cleanup {
  2784   2791     cleanupDb $fileName
  2785   2792   
  2786   2793     unset -nocomplain nLargest resetOk nFree code result db fileName
  2787         -} -constraints {eagle command.object monoBug28 configuration.Release\
         2794  +} -constraints {eagle command.object windows monoBug28 configuration.Release\
  2788   2795   command.sql compile.DATA SQLite System.Data.SQLite} -match regexp -result \
  2789   2796   {^\{Busy 0 False 0\} \{Busy \d+ False 0\} \{Ok 0 True \d+\}$}}
  2790   2797   
  2791   2798   ###############################################################################
  2792   2799   
  2793   2800   runTest {test data-1.59 {percentile extension} -setup {
  2794   2801     setupDb [set fileName data-1.59.db]
  2795   2802   } -body {
  2796   2803     set connection [getDbConnection]
  2797   2804     set result [list]
  2798   2805   
  2799   2806     $connection EnableExtensions true
  2800         -  $connection LoadExtension [getCoreBinaryFileName] sqlite3_percentile_init
         2807  +
         2808  +  $connection LoadExtension \
         2809  +      [getNativeLibraryFileName null] sqlite3_percentile_init
  2801   2810   
  2802   2811     lappend result [sql execute $db "CREATE TABLE t1(x);"]
  2803   2812     lappend result [sql execute $db "INSERT INTO t1 VALUES(1),(2),(3),(4);"]
  2804   2813     lappend result [sql execute $db "SELECT percentile(x,25) FROM t1;"]
  2805   2814   
  2806   2815     lappend result [sql execute -execute scalar $db \
  2807   2816         "SELECT percentile(x,25) FROM t1;"]
................................................................................
  3099   3108     file size [file join [getDatabaseDirectory] $fileName]
  3100   3109   } -cleanup {
  3101   3110     cleanupDb $fileName
  3102   3111   
  3103   3112     unset -nocomplain db fileName
  3104   3113   } -constraints \
  3105   3114   {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
  3106         -{2048}}
         3115  +[expr {[getDbDefaultPageSize] * 2}]}
  3107   3116   
  3108   3117   ###############################################################################
  3109   3118   
  3110   3119   runTest {test data-1.67 {SQLiteConnection.SetChunkSize method} -setup {
  3111   3120     setupDb [set fileName data-1.67.db]
  3112   3121   } -body {
  3113   3122     set connection [getDbConnection]
................................................................................
  3224   3233   runTest {test data-1.71 {fts5 extension} -setup {
  3225   3234     setupDb [set fileName data-1.71.db]
  3226   3235   } -body {
  3227   3236     set connection [getDbConnection]
  3228   3237     set result [list]
  3229   3238   
  3230   3239     $connection EnableExtensions true
  3231         -  $connection LoadExtension [getCoreBinaryFileName] sqlite3_fts5_init
         3240  +
         3241  +  $connection LoadExtension \
         3242  +      [getNativeLibraryFileName null] sqlite3_fts5_init
  3232   3243   
  3233   3244     lappend result [sql execute -execute scalar $db "SELECT fts5_source_id();"]
  3234   3245   
  3235   3246     lappend result [sql execute -execute scalar $db \
  3236   3247         "CREATE VIRTUAL TABLE t1 USING fts5(x, prefix=\"1\");"]
  3237   3248   
  3238   3249     foreach x [list cat dog horse house] {
................................................................................
  3934   3945       INSERT INTO big (json) VALUES('{"a" : [8, 9.1, true, false, null, "y"]}');
  3935   3946     }
  3936   3947   
  3937   3948     set connection [getDbConnection]
  3938   3949     set result [list]
  3939   3950   
  3940   3951     $connection EnableExtensions true
  3941         -  $connection LoadExtension [getCoreBinaryFileName] sqlite3_json_init
         3952  +
         3953  +  $connection LoadExtension \
         3954  +      [getNativeLibraryFileName null] sqlite3_json_init
  3942   3955   
  3943   3956     lappend result [sql execute -execute scalar $db \
  3944   3957         {SELECT json('{ "this" : "is", "a": [ "test" ] }');}]
  3945   3958   
  3946   3959     lappend result [sql execute -execute reader -format list $db \
  3947   3960         "SELECT rowid, json_type(json) FROM big;"]
  3948   3961   
................................................................................
  4049   4062     }
  4050   4063   
  4051   4064     lappend result [sql execute -execute scalar $db {
  4052   4065       PRAGMA page_size;
  4053   4066     }]
  4054   4067   
  4055   4068     lappend result [sql execute $db {
  4056         -    PRAGMA page_size=4096;
         4069  +    PRAGMA page_size=8192;
  4057   4070     }]
  4058   4071   
  4059   4072     lappend result [sql execute $db {
  4060   4073       VACUUM;
  4061   4074     }]
  4062   4075   
  4063   4076     lappend result [sql execute -execute scalar $db {
................................................................................
  4065   4078     }]
  4066   4079   } -cleanup {
  4067   4080     cleanupDb $fileName
  4068   4081   
  4069   4082     unset -nocomplain result db fileName
  4070   4083   } -constraints \
  4071   4084   {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
  4072         -{1024 -1 1 4096}}
         4085  +[list [getDbDefaultPageSize] -1 1 8192]}
  4073   4086   
  4074   4087   ###############################################################################
  4075   4088   
  4076   4089   reportSQLiteResources $test_channel
  4077   4090   
  4078   4091   ###############################################################################
  4079   4092   
  4080   4093   runSQLiteTestFilesEpilogue
  4081   4094   runSQLiteTestEpilogue
  4082   4095   runTestEpilogue

Changes to Tests/stress.eagle.

   235    235         }
   236    236       }
   237    237     }
   238    238   
   239    239     #############################################################################
   240    240   
   241    241     proc useMem { ptr size } {
   242         -    if {![isMono]} then {
          242  +    if {[isWindows] && ![isMono]} then {
   243    243         #
   244    244         # HACK: The type signature of the ZeroMemory method changed as of the
   245    245         #       .NET Framework 4.5.  The second argument went from being of
   246    246         #       type UInt to type UIntPtr.
   247    247         #
   248    248         if {[haveConstraint dotNet40] && \
   249    249             [haveConstraint dotNet45OrHigher]} then {

Changes to Tests/thread.eagle.

   454    454         [collectGarbage $test_channel [expr {$count(1) * 1000}] false] \
   455    455         [getSQLiteHandleCounts $test_channel] \
   456    456         [reportSQLiteResources $test_channel]
   457    457   } -cleanup {
   458    458     cleanupDb $fileName
   459    459   
   460    460     unset -nocomplain result results errors code sql dataSource id db fileName
   461         -} -time true -constraints {eagle command.object monoBug28 command.sql\
   462         -compile.DATA SQLite System.Data.SQLite compileCSharp} -match regexp -result \
   463         -[appendArgs "^Ok System#CodeDom#Compiler#CompilerResults#\\d+ \\{\\} 0 \\{\\d+\
   464         -\\d+ " $count(1) "\\} \\{\\} \\{" $handle_counts "\\} " $memory_used \$]}
          461  +} -time true -constraints {eagle command.object monoBug28 monoCrash211\
          462  +monoCrash42 command.sql compile.DATA SQLite System.Data.SQLite compileCSharp} \
          463  +-match regexp -result [appendArgs "^Ok\
          464  +System#CodeDom#Compiler#CompilerResults#\\d+ \\{\\} 0 \\{\\d+ \\d+ " $count(1) \
          465  +"\\} \\{\\} \\{" $handle_counts "\\} " $memory_used \$]}
   465    466   
   466    467   ###############################################################################
   467    468   
   468    469   unset -nocomplain count
   469    470   
   470    471   ###############################################################################
   471    472   
   472    473   unset -nocomplain memory_used handle_counts
   473    474   
   474    475   ###############################################################################
   475    476   
   476    477   runSQLiteTestEpilogue
   477    478   runTestEpilogue

Changes to Tests/tkt-17045010df.eagle.

    22     22   
    23     23   runTest {test tkt-17045010df-1.1 {EnableExtensions & LoadExtension} -setup {
    24     24     setupDb [set fileName tkt-17045010df-1.1.db]
    25     25   } -body {
    26     26     set connection [getDbConnection]
    27     27   
    28     28     lappend result [catchAndReturn {$connection EnableExtensions false}]
           29  +
    29     30     lappend result [catchAndReturn {$connection LoadExtension \
    30         -      [getCoreBinaryFileName] interop_test_extension_init}]
           31  +      [getNativeLibraryFileName null] interop_test_extension_init}]
    31     32   
    32     33     lappend result [catchAndReturn {sql execute -execute scalar $db \
    33     34         "SELECT interopTest('test1');"}]
    34     35     lappend result [catchAndReturn {sql execute -execute scalar $db \
    35     36         "SELECT interopTest('test1', '1234');"}]
    36     37   
    37     38     lappend result [catchAndReturn {$connection EnableExtensions true}]
           39  +
    38     40     lappend result [catchAndReturn {$connection LoadExtension \
    39         -      [getCoreBinaryFileName] interop_test_extension_init}]
           41  +      [getNativeLibraryFileName null] interop_test_extension_init}]
    40     42   
    41     43     lappend result [catchAndReturn {sql execute -execute scalar $db \
    42     44         "SELECT interopTest('test2');"}]
    43     45     lappend result [catchAndReturn {sql execute -execute scalar $db \
    44     46         "SELECT interopTest('test2', '5678');"}]
    45     47   
    46     48     set result

Changes to Tests/tkt-343d392b51.eagle.

   429    429         } result] : [set result ""]}] $result
   430    430   } -cleanup {
   431    431     cleanupDb $fileName; unset -nocomplain db fileName
   432    432     cleanupDb $otherFileName
   433    433   
   434    434     unset -nocomplain result code results errors i sql otherTable otherDbName \
   435    435         otherDataSource dataSource id otherFileName
   436         -} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
   437         -System.Data.SQLite compileCSharp} -match regexp -result {^Ok\
   438         -System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\}$}}
          436  +} -constraints {eagle command.object monoBug28 monoBug211 command.sql\
          437  +compile.DATA SQLite System.Data.SQLite compileCSharp} -match regexp -result \
          438  +{^Ok System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\}$}}
   439    439   
   440    440   ###############################################################################
   441    441   
   442    442   runSQLiteTestEpilogue
   443    443   runTestEpilogue

Changes to Tests/tkt-393d954be0.eagle.

    54     54     catch {object invoke System.Data.SQLite.SQLiteConnection ConnectionPool null}
    55     55   
    56     56     unset -nocomplain db fileName exists counts openCount closeCount totalCount \
    57     57         nullPool
    58     58   } -constraints {eagle command.object monoBug28 buildConfiguration.Debug\
    59     59   command.sql compile.DATA SQLite System.Data.SQLite} -match regexp -result \
    60     60   [string map [list \n \r\n] {^True False \{\} 0 0 0\
    61         -\{Remove\(".*?\\tkt-393d954be0-1\.1\.db",\
           61  +\{Remove\(".*?[/\\]tkt-393d954be0-1\.1\.db",\
    62     62   100, 0\)
    63         -Add\(".*?\\tkt-393d954be0-1\.1\.db", -?\d+, 0\)
           63  +Add\(".*?[/\\]tkt-393d954be0-1\.1\.db", -?\d+, 0\)
    64     64   GetCounts\("tkt-393d954be0-1\.1\.db", , 0, 0, 0\)
    65     65   ClearPool\("tkt-393d954be0-1\.1\.db"\)
    66     66   ClearAllPools\(\)
    67     67   \}$}]}
    68     68   
    69     69   ###############################################################################
    70     70   
    71     71   runSQLiteTestEpilogue
    72     72   runTestEpilogue

Changes to Tests/tkt-47c6fa04d3.eagle.

   113    113         [expr {$code eq "Ok" ? [catch {
   114    114           object invoke -alias _Dynamic${id}.Test${id} GetDataTable
   115    115         } result] : [set result ""]}] $result [getRowsFromDataTable $result]
   116    116   } -cleanup {
   117    117     cleanupDb $fileName
   118    118   
   119    119     unset -nocomplain result results errors code sql dataSource id db fileName
   120         -} -constraints {eagle command.object monoBug40 command.sql compile.DATA SQLite\
   121         -System.Data.SQLite compileCSharp} -match regexp -result {^Ok\
   122         -System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 System#Data#DataTable#\d+\
   123         -\{\{\{id 2\} \{min 2\} \{max 3\} \{sum 5\}\} \{\{id 2\} \{min 1\} \{max 2\}\
   124         -\{sum 3\}\}\}$}}
          120  +} -constraints {eagle command.object monoBug211 monoBug40 command.sql\
          121  +compile.DATA SQLite System.Data.SQLite compileCSharp} -match regexp -result \
          122  +{^Ok System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0\
          123  +System#Data#DataTable#\d+ \{\{\{id 2\} \{min 2\} \{max 3\} \{sum 5\}\} \{\{id\
          124  +2\} \{min 1\} \{max 2\} \{sum 3\}\}\}$}}
   125    125   
   126    126   ###############################################################################
   127    127   
   128    128   runSQLiteTestEpilogue
   129    129   runTestEpilogue

Changes to Tests/tkt-4a791e70ab.eagle.

    56     56   
    57     57                 string sql = command.CommandText; /* ObjectDisposedException? */
    58     58               }
    59     59             }
    60     60           }
    61     61         }
    62     62       }
    63         -  }] true true true results errors System.Data.SQLite.dll]
           63  +  }] true true true results errors System.Data.SQLite.dll WarningLevel 0]
    64     64   
    65     65     list $code $results \
    66     66         [expr {[info exists errors] ? $errors : ""}] \
    67     67         [expr {$code eq "Ok" ? [catch {
    68     68           object invoke _Dynamic${id}.Test${id} Main
    69     69         } result] : [set result ""]}] $result
    70     70   } -cleanup {
    71     71     cleanupDb $fileName
    72     72   
    73     73     unset -nocomplain result results errors code dataSource id db fileName
    74         -} -constraints {eagle command.object monoBug40 command.sql compile.DATA SQLite\
    75         -System.Data.SQLite compileCSharp} -match regexp -result {^Ok\
    76         -System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\}$}}
           74  +} -constraints {eagle command.object monoBug211 monoBug40 command.sql\
           75  +compile.DATA SQLite System.Data.SQLite compileCSharp} -match regexp -result \
           76  +{^Ok System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\}$}}
    77     77   
    78     78   ###############################################################################
    79     79   
    80     80   runSQLiteTestEpilogue
    81     81   runTestEpilogue

Changes to Tests/tkt-5251bd0878.eagle.

    64     64     unset -nocomplain dataTable dataReader
    65     65   
    66     66     cleanupDb $fileName
    67     67   
    68     68     freeDbConnection
    69     69   
    70     70     unset -nocomplain column row result connection db fileName
    71         -} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
    72         -System.Data.SQLite} -result {{ColumnName x} {IsKey True} {ColumnName y} {IsKey\
    73         -False}}}
           71  +} -constraints {eagle command.object monoBug28 monoBug211 command.sql\
           72  +compile.DATA SQLite System.Data.SQLite} -result {{ColumnName x} {IsKey True}\
           73  +{ColumnName y} {IsKey False}}}
    74     74   
    75     75   ###############################################################################
    76     76   
    77     77   runSQLiteTestEpilogue
    78     78   runTestEpilogue

Changes to Tests/tkt-56b42d99c1.eagle.

    95     95         [expr {$code eq "Ok" ? [catch {
    96     96           object invoke _Dynamic${id}.Test${id} TryEnlistInTransaction
    97     97         } result] : [set result ""]}] $result
    98     98   } -cleanup {
    99     99     cleanupDb $fileName
   100    100   
   101    101     unset -nocomplain result results errors code dataSource id db fileName
   102         -} -constraints {eagle command.object monoBug40 command.sql compile.DATA SQLite\
   103         -System.Data.SQLite compileCSharp} -match regexp -result {^Ok\
   104         -System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 True$}}
          102  +} -constraints {eagle command.object monoBug211 monoBug42 command.sql\
          103  +compile.DATA SQLite System.Data.SQLite compileCSharp} -match regexp -result \
          104  +{^Ok System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 True$}}
   105    105   
   106    106   ###############################################################################
   107    107   
   108    108   runTest {test tkt-56b42d99c1-1.2 {enlisted transaction isolation} -setup {
   109    109     setupDb [set fileName tkt-56b42d99c1-1.2.db]
   110    110   } -body {
   111    111     set id [object invoke Interpreter.GetActive NextId]
................................................................................
   172    172         [expr {$code eq "Ok" ? [catch {
   173    173           object invoke _Dynamic${id}.Test${id} Main
   174    174         } result] : [set result ""]}] $result
   175    175   } -cleanup {
   176    176     cleanupDb $fileName
   177    177   
   178    178     unset -nocomplain result results errors code sql dataSource id db fileName
   179         -} -constraints {eagle command.object monoBug40 command.sql compile.DATA SQLite\
   180         -System.Data.SQLite compileCSharp} -match regexp -result {^Ok\
   181         -System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 0$}}
          179  +} -constraints {eagle command.object monoBug211 monoBug42 command.sql\
          180  +compile.DATA SQLite System.Data.SQLite compileCSharp} -match regexp -result \
          181  +{^Ok System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 0$}}
   182    182   
   183    183   ###############################################################################
   184    184   
   185    185   runTest {test tkt-56b42d99c1-1.3 {enlisted transaction isolation} -setup {
   186    186     setupDb [set fileName tkt-56b42d99c1-1.3.db]
   187    187   } -body {
   188    188     set id [object invoke Interpreter.GetActive NextId]
................................................................................
   403    403         [expr {$code eq "Ok" ? [catch {
   404    404           object invoke _Dynamic${id}.Test${id} Main
   405    405         } result] : [set result ""]}] $result
   406    406   } -cleanup {
   407    407     cleanupDb $fileName
   408    408   
   409    409     unset -nocomplain result results errors code sql dataSource id db fileName
   410         -} -constraints {eagle command.object monoBug40 command.sql compile.DATA SQLite\
   411         -System.Data.SQLite compileCSharp} -match regexp -result {^Ok\
   412         -System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 1$}}
          410  +} -constraints {eagle command.object monoBug211 monoBug42 command.sql\
          411  +compile.DATA SQLite System.Data.SQLite compileCSharp} -match regexp -result \
          412  +{^Ok System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 1$}}
   413    413   
   414    414   ###############################################################################
   415    415   
   416    416   set flags MapIsolationLevels
   417    417   
   418    418   ###############################################################################
   419    419   
................................................................................
   492    492         [expr {$code eq "Ok" ? [catch {
   493    493           object invoke _Dynamic${id}.Test${id} TryEnlistInTransaction
   494    494         } result] : [set result ""]}] $result
   495    495   } -cleanup {
   496    496     cleanupDb $fileName
   497    497   
   498    498     unset -nocomplain result results errors code dataSource id db fileName
   499         -} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
   500         -System.Data.SQLite compileCSharp} -match regexp -result {^Ok\
   501         -System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 True$}}
          499  +} -constraints {eagle command.object monoBug28 monoBug211 monoBug42 command.sql\
          500  +compile.DATA SQLite System.Data.SQLite compileCSharp} -match regexp -result \
          501  +{^Ok System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 True$}}
   502    502   
   503    503   ###############################################################################
   504    504   
   505    505   runTest {test tkt-56b42d99c1-1.7 {enlisted transaction isolation} -setup {
   506    506     setupDb [set fileName tkt-56b42d99c1-1.7.db]
   507    507   } -body {
   508    508     set id [object invoke Interpreter.GetActive NextId]
................................................................................
   569    569         [expr {$code eq "Ok" ? [catch {
   570    570           object invoke _Dynamic${id}.Test${id} Main
   571    571         } result] : [set result ""]}] $result
   572    572   } -cleanup {
   573    573     cleanupDb $fileName
   574    574   
   575    575     unset -nocomplain result results errors code sql dataSource id db fileName
   576         -} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
   577         -System.Data.SQLite compileCSharp} -match regexp -result {^Ok\
   578         -System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 0$}}
          576  +} -constraints {eagle command.object monoBug28 monoBug211 monoBug42 command.sql\
          577  +compile.DATA SQLite System.Data.SQLite compileCSharp} -match regexp -result \
          578  +{^Ok System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 0$}}
   579    579   
   580    580   ###############################################################################
   581    581   
   582    582   runTest {test tkt-56b42d99c1-1.8 {enlisted transaction isolation} -setup {
   583    583     setupDb [set fileName tkt-56b42d99c1-1.8.db]
   584    584   } -body {
   585    585     set id [object invoke Interpreter.GetActive NextId]
................................................................................
   800    800         [expr {$code eq "Ok" ? [catch {
   801    801           object invoke _Dynamic${id}.Test${id} Main
   802    802         } result] : [set result ""]}] $result
   803    803   } -cleanup {
   804    804     cleanupDb $fileName
   805    805   
   806    806     unset -nocomplain result results errors code sql dataSource id db fileName
   807         -} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
   808         -System.Data.SQLite compileCSharp} -match regexp -result {^Ok\
   809         -System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 1$}}
          807  +} -constraints {eagle command.object monoBug28 monoBug211 monoBug42 command.sql\
          808  +compile.DATA SQLite System.Data.SQLite compileCSharp} -match regexp -result \
          809  +{^Ok System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 1$}}
   810    810   
   811    811   ###############################################################################
   812    812   
   813    813   unset -nocomplain flags
   814    814   
   815    815   ###############################################################################
   816    816   
   817    817   runSQLiteTestEpilogue
   818    818   runTestEpilogue

Changes to Tests/tkt-58ed318f2f.eagle.

    19     19   runSQLiteTestPrologue
    20     20   
    21     21   ###############################################################################
    22     22   
    23     23   proc getSettingReadCount { name } {
    24     24     if {[haveConstraint buildConfiguration.Debug] && [catch {
    25     25       object invoke -flags +NonPublic -alias \
    26         -        System.Data.SQLite.UnsafeNativeMethods settingReadCounts
           26  +        System.Data.SQLite.DebugData settingReadCounts
    27     27     } settingReadCounts] == 0} then {
    28     28       if {[$settingReadCounts TryGetValue $name value]} then {
    29     29         tputs $::test_channel [appendArgs \
    30     30             "---- setting \"" $name "\" was read " $value " times\n"]
    31     31   
    32     32         return $value
    33     33       }

Changes to Tests/tkt-7714b60d61.eagle.

    51     51     unset -nocomplain dataTable dataAdapter command
    52     52   
    53     53     freeDbConnection
    54     54   
    55     55     cleanupDb $fileName
    56     56   
    57     57     unset -nocomplain connection db fileName
    58         -} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
    59         -System.Data.SQLite} -result {{{x 1} y} {{x 2} {y False}} {{x 3} {y True}} {{x\
    60         -4} {y False}} {{x 5} {y True}} {{x 6} {y False}} {{x 7} {y True}} {{x 8} {y\
    61         -False}} {{x 9} {y True}}}}
           58  +} -constraints {eagle command.object monoBug28 monoBug211 command.sql\
           59  +compile.DATA SQLite System.Data.SQLite} -result {{{x 1} y} {{x 2} {y False}}\
           60  +{{x 3} {y True}} {{x 4} {y False}} {{x 5} {y True}} {{x 6} {y False}} {{x 7}\
           61  +{y True}} {{x 8} {y False}} {{x 9} {y True}}}}
    62     62   
    63     63   ###############################################################################
    64     64   
    65     65   runSQLiteTestEpilogue
    66     66   runTestEpilogue

Changes to Tests/tkt-92dbf1229a.eagle.

    44     44     set result
    45     45   } -cleanup {
    46     46     unset -nocomplain dataTable dataReader
    47     47   
    48     48     cleanupDb $fileName
    49     49   
    50     50     unset -nocomplain column row result db fileName
    51         -} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
    52         -System.Data.SQLite} -result {{ColumnName x} {IsKey True} {ColumnName y} {IsKey\
    53         -True} {ColumnName w} {IsKey False} {ColumnName z} {IsKey False}}}
           51  +} -constraints {eagle command.object monoBug28 monoBug211 command.sql\
           52  +compile.DATA SQLite System.Data.SQLite} -result {{ColumnName x} {IsKey True}\
           53  +{ColumnName y} {IsKey True} {ColumnName w} {IsKey False} {ColumnName z} {IsKey\
           54  +False}}}
    54     55   
    55     56   ###############################################################################
    56     57   
    57     58   runSQLiteTestEpilogue
    58     59   runTestEpilogue

Changes to Tests/tkt-a7d04fb111.eagle.

    50     50     lappend result [expr {[lindex $result 0] == [lindex $result 1]}]
    51     51     lappend result [expr {[lindex $result 0] == [lindex $result 2]}]
    52     52     lappend result [expr {[lindex $result 1] == [lindex $result 2]}]
    53     53   } -cleanup {
    54     54     cleanupDb $fileName
    55     55   
    56     56     unset -nocomplain result dateTimeValue db fileName
    57         -} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
    58         -System.Data.SQLite} -result \
           57  +} -constraints {eagle command.object monoBug28 monoBug42 command.sql\
           58  +compile.DATA SQLite System.Data.SQLite} -result \
    59     59   {635598144000000000 635598144000000000 635598432000000000 True False False}}
    60     60   
    61     61   ###############################################################################
    62     62   
    63     63   runTest {test tkt-a7d04fb111-1.2 {Bind DateTime Local Ticks} -setup {
    64     64     setupDb [set fileName tkt-a7d04fb111-1.2.db] "" Ticks Local \
    65     65         BindDateTimeWithKind
................................................................................
    86     86     lappend result [expr {[lindex $result 0] == [lindex $result 1]}]
    87     87     lappend result [expr {[lindex $result 0] == [lindex $result 2]}]
    88     88     lappend result [expr {[lindex $result 1] == [lindex $result 2]}]
    89     89   } -cleanup {
    90     90     cleanupDb $fileName
    91     91   
    92     92     unset -nocomplain result dateTimeValue db fileName
    93         -} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
    94         -System.Data.SQLite} -result \
           93  +} -constraints {eagle command.object monoBug28 monoBug42 command.sql\
           94  +compile.DATA SQLite System.Data.SQLite} -result \
    95     95   {635598144000000000 635597856000000000 635598144000000000 False True False}}
    96     96   
    97     97   ###############################################################################
    98     98   
    99     99   runTest {test tkt-a7d04fb111-1.3 {Bind DateTime Utc ISO8601} -setup {
   100    100     setupDb [set fileName tkt-a7d04fb111-1.3.db] "" ISO8601 Utc \
   101    101         BindDateTimeWithKind
................................................................................
   122    122     lappend result [expr {[lindex $result 0] eq [lindex $result 1]}]
   123    123     lappend result [expr {[lindex $result 0] eq [lindex $result 2]}]
   124    124     lappend result [expr {[lindex $result 1] eq [lindex $result 2]}]
   125    125   } -cleanup {
   126    126     cleanupDb $fileName
   127    127   
   128    128     unset -nocomplain result dateTimeValue db fileName
   129         -} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
   130         -System.Data.SQLite} -result {{2015-02-18 00:00:00Z} {2015-02-18 00:00:00Z}\
   131         -{2015-02-18 08:00:00Z} True False False}}
          129  +} -constraints {eagle command.object monoBug28 monoBug42 command.sql\
          130  +compile.DATA SQLite System.Data.SQLite} -result {{2015-02-18 00:00:00Z}\
          131  +{2015-02-18 00:00:00Z} {2015-02-18 08:00:00Z} True False False}}
   132    132   
   133    133   ###############################################################################
   134    134   
   135    135   runTest {test tkt-a7d04fb111-1.4 {Bind DateTime Local ISO8601} -setup {
   136    136     setupDb [set fileName tkt-a7d04fb111-1.4.db] "" ISO8601 Local \
   137    137         BindDateTimeWithKind
   138    138   } -body {
................................................................................
   158    158     lappend result [expr {[lindex $result 0] eq [lindex $result 1]}]
   159    159     lappend result [expr {[lindex $result 0] eq [lindex $result 2]}]
   160    160     lappend result [expr {[lindex $result 1] eq [lindex $result 2]}]
   161    161   } -cleanup {
   162    162     cleanupDb $fileName
   163    163   
   164    164     unset -nocomplain result dateTimeValue db fileName
   165         -} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
   166         -System.Data.SQLite} -result {{2015-02-18 00:00:00} {2015-02-17 16:00:00}\
   167         -{2015-02-18 00:00:00} False True False}}
          165  +} -constraints {eagle command.object monoBug28 monoBug42 command.sql\
          166  +compile.DATA SQLite System.Data.SQLite} -result {{2015-02-18 00:00:00}\
          167  +{2015-02-17 16:00:00} {2015-02-18 00:00:00} False True False}}
   168    168   
   169    169   ###############################################################################
   170    170   
   171    171   runTest {test tkt-a7d04fb111-1.5 {Bind DateTime Utc JulianDay} -setup {
   172    172     setupDb [set fileName tkt-a7d04fb111-1.5.db] "" JulianDay Utc \
   173    173         BindDateTimeWithKind
   174    174   } -body {
................................................................................
   194    194     lappend result [expr {[lindex $result 0] == [lindex $result 1]}]
   195    195     lappend result [expr {[lindex $result 0] == [lindex $result 2]}]
   196    196     lappend result [expr {[lindex $result 1] == [lindex $result 2]}]
   197    197   } -cleanup {
   198    198     cleanupDb $fileName
   199    199   
   200    200     unset -nocomplain result dateTimeValue db fileName
   201         -} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
   202         -System.Data.SQLite} -result {2457071.5 2457071.5 2457071.83 True False False}}
          201  +} -constraints {eagle command.object monoBug28 monoBug42 command.sql\
          202  +compile.DATA SQLite System.Data.SQLite} -result {2457071.5 2457071.5 2457071.83\
          203  +True False False}}
   203    204   
   204    205   ###############################################################################
   205    206   
   206    207   runTest {test tkt-a7d04fb111-1.6 {Bind DateTime Local JulianDay} -setup {
   207    208     setupDb [set fileName tkt-a7d04fb111-1.6.db] "" JulianDay Local \
   208    209         BindDateTimeWithKind
   209    210   } -body {
................................................................................
   229    230     lappend result [expr {[lindex $result 0] == [lindex $result 1]}]
   230    231     lappend result [expr {[lindex $result 0] == [lindex $result 2]}]
   231    232     lappend result [expr {[lindex $result 1] == [lindex $result 2]}]
   232    233   } -cleanup {
   233    234     cleanupDb $fileName
   234    235   
   235    236     unset -nocomplain result dateTimeValue db fileName
   236         -} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
   237         -System.Data.SQLite} -result {2457071.5 2457071.17 2457071.5 False True False}}
          237  +} -constraints {eagle command.object monoBug28 monoBug42 command.sql\
          238  +compile.DATA SQLite System.Data.SQLite} -result {2457071.5 2457071.17 2457071.5\
          239  +False True False}}
   238    240   
   239    241   ###############################################################################
   240    242   
   241    243   runTest {test tkt-a7d04fb111-1.7 {Bind DateTime Utc UnixEpoch} -setup {
   242    244     setupDb [set fileName tkt-a7d04fb111-1.7.db] "" UnixEpoch Utc \
   243    245         BindDateTimeWithKind
   244    246   } -body {
................................................................................
   264    266     lappend result [expr {[lindex $result 0] == [lindex $result 1]}]
   265    267     lappend result [expr {[lindex $result 0] == [lindex $result 2]}]
   266    268     lappend result [expr {[lindex $result 1] == [lindex $result 2]}]
   267    269   } -cleanup {
   268    270     cleanupDb $fileName
   269    271   
   270    272     unset -nocomplain result dateTimeValue db fileName
   271         -} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
   272         -System.Data.SQLite} -result {1424217600 1424217600 1424246400 True False False}}
          273  +} -constraints {eagle command.object monoBug28 monoBug42 command.sql\
          274  +compile.DATA SQLite System.Data.SQLite} -result {1424217600 1424217600\
          275  +1424246400 True False False}}
   273    276   
   274    277   ###############################################################################
   275    278   
   276    279   runTest {test tkt-a7d04fb111-1.8 {Bind DateTime Local UnixEpoch} -setup {
   277    280     setupDb [set fileName tkt-a7d04fb111-1.8.db] "" UnixEpoch Local \
   278    281         BindDateTimeWithKind
   279    282   } -body {
................................................................................
   299    302     lappend result [expr {[lindex $result 0] == [lindex $result 1]}]
   300    303     lappend result [expr {[lindex $result 0] == [lindex $result 2]}]
   301    304     lappend result [expr {[lindex $result 1] == [lindex $result 2]}]
   302    305   } -cleanup {
   303    306     cleanupDb $fileName
   304    307   
   305    308     unset -nocomplain result dateTimeValue db fileName
   306         -} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
   307         -System.Data.SQLite} -result {1424217600 1424188800 1424217600 False True False}}
          309  +} -constraints {eagle command.object monoBug28 monoBug42 command.sql\
          310  +compile.DATA SQLite System.Data.SQLite} -result {1424217600 1424188800\
          311  +1424217600 False True False}}
   308    312   
   309    313   ###############################################################################
   310    314   
   311    315   runTest {test tkt-a7d04fb111-1.9 {Bind DateTime Utc Invariant} -setup {
   312    316     setupDb [set fileName tkt-a7d04fb111-1.9.db] "" InvariantCulture Utc \
   313    317         BindDateTimeWithKind
   314    318   } -body {
................................................................................
   334    338     lappend result [expr {[lindex $result 0] eq [lindex $result 1]}]
   335    339     lappend result [expr {[lindex $result 0] eq [lindex $result 2]}]
   336    340     lappend result [expr {[lindex $result 1] eq [lindex $result 2]}]
   337    341   } -cleanup {
   338    342     cleanupDb $fileName
   339    343   
   340    344     unset -nocomplain result dateTimeValue db fileName
   341         -} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
   342         -System.Data.SQLite} -result {2015-02-18T00:00:00.0000000\
          345  +} -constraints {eagle command.object monoBug28 monoBug42 command.sql\
          346  +compile.DATA SQLite System.Data.SQLite} -result {2015-02-18T00:00:00.0000000\
   343    347   2015-02-18T00:00:00.0000000Z 2015-02-18T08:00:00.0000000Z False False False}}
   344    348   
   345    349   ###############################################################################
   346    350   
   347    351   runTest {test tkt-a7d04fb111-1.10 {Bind DateTime Local Invariant} -setup {
   348    352     setupDb [set fileName tkt-a7d04fb111-1.10.db] "" InvariantCulture Local \
   349    353         BindDateTimeWithKind
................................................................................
   370    374     lappend result [expr {[lindex $result 0] eq [lindex $result 1]}]
   371    375     lappend result [expr {[lindex $result 0] eq [lindex $result 2]}]
   372    376     lappend result [expr {[lindex $result 1] eq [lindex $result 2]}]
   373    377   } -cleanup {
   374    378     cleanupDb $fileName
   375    379   
   376    380     unset -nocomplain result dateTimeValue db fileName
   377         -} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
   378         -System.Data.SQLite} -result {2015-02-18T00:00:00.0000000\
          381  +} -constraints {eagle command.object monoBug28 monoBug42 command.sql\
          382  +compile.DATA SQLite System.Data.SQLite} -result {2015-02-18T00:00:00.0000000\
   379    383   2015-02-17T16:00:00.0000000-08:00 2015-02-18T00:00:00.0000000-08:00 False False\
   380    384   False}}
   381    385   
   382    386   ###############################################################################
   383    387   
   384    388   unset -nocomplain rawDateTimeValue
   385    389   
   386    390   ###############################################################################
   387    391   
   388    392   runSQLiteTestEpilogue
   389    393   runTestEpilogue

Changes to Tests/tkt-aba4549801.eagle.

    56     56   } -cleanup {
    57     57     object invoke System.Data.SQLite.SQLiteConnection remove_Changed $callback
    58     58     catch {object removecallback $callback}
    59     59   
    60     60     unset -nocomplain rows transaction result callback db fileName
    61     61   
    62     62     rename onChanged ""
    63         -} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
    64         -System.Data.SQLite} -match regexp -result \
           63  +} -constraints {eagle command.object monoBug28 monoBug211 command.sql\
           64  +compile.DATA SQLite System.Data.SQLite} -match regexp -result \
    65     65   {^\{System#Data#SQLite#SQLiteConnection#\d+ Opening \{\} \{\} \{\} \{\}\}\
    66     66   \{System#Data#SQLite#SQLiteConnection#\d+ Closing \{\} \{\} \{\} \{\}\}\
    67     67   \{System#Data#SQLite#SQLiteConnection#\d+ Closed \{\} \{\} \{\} \{\}\}\
    68     68   \{System#Data#SQLite#SQLiteConnection#\d+ ConnectionString \{\} \{\} \{\}\
    69     69   \{\}\} \{\{\} NewCriticalHandle \{\} \{\} \{\}\
    70     70   System#Data#SQLite#SQLiteConnectionHandle#\d+\}\
    71     71   \{System#Data#SQLite#SQLiteConnection#\d+ NewCommand \{\}\

Changes to Tests/tkt-ae5267b863.eagle.

   142    142         [expr {$code eq "Ok" ? [catch {
   143    143           object invoke _Dynamic${id}.Test${id} Main
   144    144         } result] : [set result ""]}] $result
   145    145   } -cleanup {
   146    146     cleanupDb $fileName
   147    147   
   148    148     unset -nocomplain result code results errors sql dataSource id db fileName
   149         -} -constraints [fixConstraints {eagle command.object monoBug28 command.sql\
   150         -compile.DATA SQLite System.Data.SQLite !mda compileCSharp\
          149  +} -constraints [fixConstraints {eagle command.object monoBug28 monoBug211\
          150  +command.sql compile.DATA SQLite System.Data.SQLite !mda compileCSharp\
   151    151   !defineConstant.System.Data.SQLite.INTEROP_LEGACY_CLOSE}] -match regexp \
   152    152   -result {^Ok System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\}$}}
   153    153   
   154    154   ###############################################################################
   155    155   
   156    156   runSQLiteTestEpilogue
   157    157   runTestEpilogue

Changes to Tests/version.eagle.

  1080   1080       [file join SQLite.Interop props SQLite.Interop.2012.props] \
  1081   1081       [file join SQLite.Interop props SQLite.Interop.2013.props] \
  1082   1082       [file join SQLite.Interop props SQLite.Interop.2013.props] \
  1083   1083       [file join SQLite.Interop props SQLite.Interop.2013.props] \
  1084   1084       [file join SQLite.Interop props SQLite.Interop.2015.props] \
  1085   1085       [file join SQLite.Interop props SQLite.Interop.2015.props] \
  1086   1086       [file join SQLite.Interop props SQLite.Interop.2015.props] \
  1087         -    [file join SQLite.Interop src win interop.h] \
         1087  +    [file join SQLite.Interop src generic interop.h] \
  1088   1088       [file join System.Data.SQLite AssemblyInfo.cs] \
  1089   1089       [file join System.Data.SQLite AssemblyInfo.cs] \
  1090   1090       [file join System.Data.SQLite SQLite3.cs] \
  1091   1091       [file join System.Data.SQLite UnsafeNativeMethods.cs] \
  1092   1092       [file join System.Data.SQLite.Linq AssemblyInfo.cs] \
  1093   1093       [file join System.Data.SQLite.Linq AssemblyInfo.cs] \
  1094   1094       [file join test AssemblyInfo.cs] \

Changes to Tests/vtab.eagle.

    16     16   ###############################################################################
    17     17   
    18     18   package require System.Data.SQLite.Test
    19     19   runSQLiteTestPrologue
    20     20   
    21     21   ###############################################################################
    22     22   
           23  +proc normalizeVtabResult { value } {
           24  +  set result $value
           25  +
           26  +  if {[string first \r $result] != -1} then {
           27  +    set result [string map [list \r\n \n] $result]
           28  +  }
           29  +
           30  +  return [string map [list \n " -- "] $result]
           31  +}
           32  +
           33  +###############################################################################
           34  +
    23     35   runTest {test vtab-1.1 {basic virtual table support} -setup {
    24     36     set fileName vtab-1.1.db
    25     37   } -body {
    26     38     set id [object invoke Interpreter.GetActive NextId]
    27     39     set dataSource [file join [getDatabaseDirectory] $fileName]
    28     40   
    29     41     set sql { \
................................................................................
    92    104       }
    93    105     }] true true true results errors System.Data.SQLite.dll]
    94    106   
    95    107     list $code $results \
    96    108         [expr {[info exists errors] ? $errors : ""}] \
    97    109         [expr {$code eq "Ok" ? [catch {
    98    110           object invoke _Dynamic${id}.Test${id} Main
    99         -      } result] : [set result ""]}] $result
          111  +      } result] : [set result ""]}] [normalizeVtabResult $result]
   100    112   } -cleanup {
   101    113     cleanupDb $fileName
   102    114   
   103    115     unset -nocomplain result code results errors sql dataSource id fileName
   104    116   } -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
   105    117   System.Data.SQLite defineConstant.System.Data.SQLite.INTEROP_VIRTUAL_TABLE\
   106         -compileCSharp} -match regexp -result \
   107         -{^Ok System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\}$}}
          118  +compileCSharp} -match regexp -result [normalizeVtabResult \
          119  +{^Ok System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\}$}]}
   108    120   
   109    121   ###############################################################################
   110    122   
   111    123   runTest {test vtab-1.2.1 {IEnumerable virtual table} -setup {
   112    124     set fileName vtab-1.2.1.db
   113    125   } -body {
   114    126     set id [object invoke Interpreter.GetActive NextId]
................................................................................
   197    209       }
   198    210     }] true true true results errors [list System.Data.SQLite.dll Eagle.dll]]
   199    211   
   200    212     list $code $results \
   201    213         [expr {[info exists errors] ? $errors : ""}] \
   202    214         [expr {$code eq "Ok" ? [catch {
   203    215           object invoke _Dynamic${id}.Test${id} GetList one two three 4 5.0
   204         -      } result] : [set result ""]}] $result
          216  +      } result] : [set result ""]}] [normalizeVtabResult $result]
   205    217   } -cleanup {
   206    218     cleanupDb $fileName
   207    219   
   208    220     unset -nocomplain result code results errors sql dataSource id fileName
   209    221   } -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
   210    222   System.Data.SQLite defineConstant.System.Data.SQLite.INTEROP_VIRTUAL_TABLE\
   211         -compileCSharp} -match regexp -result [string map [list \n \r\n] {^Ok\
          223  +compileCSharp} -match regexp -result [normalizeVtabResult {^Ok\
   212    224   System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{one two three 4 5\.0 Error\
   213         -\{SQL logic error or missing database
   214         -virtual table "t\d+" is read-only\}\}$}]}
          225  +\{SQL logic error or missing database -- virtual table "t\d+" is\
          226  +read-only\}\}$}]}
   215    227   
   216    228   ###############################################################################
   217    229   
   218    230   runTest {test vtab-1.2.2 {IEnumerable virtual table} -setup {
   219    231     set fileName vtab-1.2.2.db
   220    232   } -body {
   221    233     set id [object invoke Interpreter.GetActive NextId]
................................................................................
   307    319       }
   308    320     }] true true true results errors [list System.Data.SQLite.dll Eagle.dll]]
   309    321   
   310    322     list $code $results \
   311    323         [expr {[info exists errors] ? $errors : ""}] \
   312    324         [expr {$code eq "Ok" ? [catch {
   313    325           object invoke _Dynamic${id}.Test${id} GetList one two three 4 5.0
   314         -      } result] : [set result ""]}] $result
          326  +      } result] : [set result ""]}] [normalizeVtabResult $result]
   315    327   } -cleanup {
   316    328     cleanupDb $fileName
   317    329   
   318    330     unset -nocomplain result code results errors sql dataSource id fileName
   319    331   } -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
   320    332   System.Data.SQLite defineConstant.System.Data.SQLite.INTEROP_VIRTUAL_TABLE\
   321         -compileCSharp} -match regexp -result [string map [list \n \r\n] {^Ok\
          333  +compileCSharp} -match regexp -result [normalizeVtabResult {^Ok\
   322    334   System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{one two three 4 5\.0 Error\
   323         -\{SQL logic error or missing database
   324         -virtual table "t\d+" is read-only\}\}$}]}
          335  +\{SQL logic error or missing database -- virtual table "t\d+" is\
          336  +read-only\}\}$}]}
   325    337   
   326    338   ###############################################################################
   327    339   
   328    340   runTest {test vtab-1.3.1 {IEnumerable<T> virtual table} -setup {
   329    341     set fileName vtab-1.3.1.db
   330    342   } -body {
   331    343     set id [object invoke Interpreter.GetActive NextId]
................................................................................
   415    427       }
   416    428     }] true true true results errors [list System.Data.SQLite.dll Eagle.dll]]
   417    429   
   418    430     list $code $results \
   419    431         [expr {[info exists errors] ? $errors : ""}] \
   420    432         [expr {$code eq "Ok" ? [catch {
   421    433           object invoke _Dynamic${id}.Test${id} GetList 1 2 3 4 5
   422         -      } result] : [set result ""]}] $result
          434  +      } result] : [set result ""]}] [normalizeVtabResult $result]
   423    435   } -cleanup {
   424    436     cleanupDb $fileName
   425    437   
   426    438     unset -nocomplain result code results errors sql dataSource id fileName
   427    439   } -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
   428    440   System.Data.SQLite defineConstant.System.Data.SQLite.INTEROP_VIRTUAL_TABLE\
   429         -compileCSharp} -match regexp -result [string map [list \n \r\n] {^Ok\
          441  +compileCSharp} -match regexp -result [normalizeVtabResult {^Ok\
   430    442   System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{1 2 3 4 5 Error \{SQL\
   431         -logic error or missing database
   432         -virtual table "t\d+" is read-only\}\}$}]}
          443  +logic error or missing database -- virtual table "t\d+" is read-only\}\}$}]}
   433    444   
   434    445   ###############################################################################
   435    446   
   436    447   runTest {test vtab-1.3.2 {IEnumerable<T> virtual table} -setup {
   437    448     set fileName vtab-1.3.2.db
   438    449   } -body {
   439    450     set id [object invoke Interpreter.GetActive NextId]
................................................................................
   526    537       }
   527    538     }] true true true results errors [list System.Data.SQLite.dll Eagle.dll]]
   528    539   
   529    540     list $code $results \
   530    541         [expr {[info exists errors] ? $errors : ""}] \
   531    542         [expr {$code eq "Ok" ? [catch {
   532    543           object invoke _Dynamic${id}.Test${id} GetList 1 2 3 4 5
   533         -      } result] : [set result ""]}] $result
          544  +      } result] : [set result ""]}] [normalizeVtabResult $result]
   534    545   } -cleanup {
   535    546     cleanupDb $fileName
   536    547   
   537    548     unset -nocomplain result code results errors sql dataSource id fileName
   538    549   } -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
   539    550   System.Data.SQLite defineConstant.System.Data.SQLite.INTEROP_VIRTUAL_TABLE\
   540         -compileCSharp} -match regexp -result [string map [list \n \r\n] {^Ok\
          551  +compileCSharp} -match regexp -result [normalizeVtabResult {^Ok\
   541    552   System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{1 2 3 4 5 Error \{SQL\
   542         -logic error or missing database
   543         -virtual table "t\d+" is read-only\}\}$}]}
          553  +logic error or missing database -- virtual table "t\d+" is read-only\}\}$}]}
   544    554   
   545    555   ###############################################################################
   546    556   
   547    557   runTest {test vtab-1.4 {virtual table function support} -setup {
   548    558     set fileName vtab-1.4.db
   549    559   } -body {
   550    560     set id [object invoke Interpreter.GetActive NextId]
................................................................................
   777    787       }
   778    788     }] true true true results errors [list System.Data.SQLite.dll Eagle.dll]]
   779    789   
   780    790     list $code $results \
   781    791         [expr {[info exists errors] ? $errors : ""}] \
   782    792         [expr {$code eq "Ok" ? [catch {
   783    793           object invoke _Dynamic${id}.Test${id} GetList
   784         -      } result] : [set result ""]}] $result
          794  +      } result] : [set result ""]}] [normalizeVtabResult $result]
   785    795   } -cleanup {
   786    796     cleanupDb $fileName
   787    797   
   788    798     unset -nocomplain result code results errors sql dataSource id fileName
   789    799   } -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
   790    800   System.Data.SQLite defineConstant.System.Data.SQLite.INTEROP_VIRTUAL_TABLE\
   791         -compileCSharp} -match regexp -result [string map [list \n \r\n] {^Ok\
          801  +compileCSharp} -match regexp -result [normalizeVtabResult {^Ok\
   792    802   System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\{\} b25l \{SQL logic\
   793         -error or missing database
   794         -unable to use function Base64 in the requested context\} \{SQL logic error or\
   795         -missing database
   796         -no such function: Base65\}\}$}]}
          803  +error or missing database -- unable to use function Base64 in the requested\
          804  +context\} \{SQL logic error or missing database -- no such function:\
          805  +Base65\}\}$}]}
   797    806   
   798    807   ###############################################################################
   799    808   
   800    809   runTest {test vtab-1.5 {virtual table function support} -setup {
   801    810     set fileName vtab-1.5.db
   802    811   } -body {
   803    812     set id [object invoke Interpreter.GetActive NextId]
................................................................................
  1030   1039       }
  1031   1040     }] true true true results errors [list System.Data.SQLite.dll Eagle.dll]]
  1032   1041   
  1033   1042     list $code $results \
  1034   1043         [expr {[info exists errors] ? $errors : ""}] \
  1035   1044         [expr {$code eq "Ok" ? [catch {
  1036   1045           object invoke _Dynamic${id}.Test${id} GetList
  1037         -      } result] : [set result ""]}] $result
         1046  +      } result] : [set result ""]}] [normalizeVtabResult $result]
  1038   1047   } -cleanup {
  1039   1048     cleanupDb $fileName
  1040   1049   
  1041   1050     unset -nocomplain result code results errors sql dataSource id fileName
  1042   1051   } -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
  1043   1052   System.Data.SQLite defineConstant.System.Data.SQLite.INTEROP_VIRTUAL_TABLE\
  1044         -compileCSharp} -match regexp -result [string map [list \n \r\n] {^Ok\
         1053  +compileCSharp} -match regexp -result [normalizeVtabResult {^Ok\
  1045   1054   System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\{\} b25l \{SQL logic\
  1046         -error or missing database
  1047         -(?:unable to use function Base64 in the requested context|need exactly one\
  1048         -argument, got 3)\} \{SQL logic error or missing database
  1049         -no such function: Base65\}\}$}]}
         1055  +error or missing database -- (?:unable to use function Base64 in the requested\
         1056  +context|need exactly one argument, got 3)\} \{SQL logic error or missing\
         1057  +database -- no such function: Base65\}\}$}]}
  1050   1058   
  1051   1059   ###############################################################################
  1052   1060   
  1053   1061   runTest {test vtab-1.6 {virtual table rename support} -setup {
  1054   1062     set fileName vtab-1.6.db
  1055   1063   } -body {
  1056   1064     set id [object invoke Interpreter.GetActive NextId]
................................................................................
  1209   1217       }
  1210   1218     }] true true true results errors [list System.Data.SQLite.dll Eagle.dll]]
  1211   1219   
  1212   1220     list $code $results \
  1213   1221         [expr {[info exists errors] ? $errors : ""}] \
  1214   1222         [expr {$code eq "Ok" ? [catch {
  1215   1223           object invoke _Dynamic${id}.Test${id} GetList
  1216         -      } result] : [set result ""]}] $result
         1224  +      } result] : [set result ""]}] [normalizeVtabResult $result]
  1217   1225   } -cleanup {
  1218   1226     cleanupDb $fileName
  1219   1227   
  1220   1228     unset -nocomplain result code results errors sql dataSource id fileName
  1221   1229   } -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
  1222   1230   System.Data.SQLite defineConstant.System.Data.SQLite.INTEROP_VIRTUAL_TABLE\
  1223         -compileCSharp} -match regexp -result [string map [list \n \r\n] {^Ok\
         1231  +compileCSharp} -match regexp -result [normalizeVtabResult {^Ok\
  1224   1232   System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\{\} t\d+ \{\} x\d+\}$}]}
  1225   1233   
  1226   1234   ###############################################################################
  1227   1235   
  1228   1236   runTest {test vtab-1.7 {virtual table xBestIndex marshalling (1)} -setup {
  1229   1237     set fileName vtab-1.7.db
  1230   1238   } -body {
................................................................................
  1351   1359       }
  1352   1360     }] true true true results errors [list System.Data.SQLite.dll Eagle.dll]]
  1353   1361   
  1354   1362     list $code $results \
  1355   1363         [expr {[info exists errors] ? $errors : ""}] \
  1356   1364         [expr {$code eq "Ok" ? [catch {
  1357   1365           object invoke _Dynamic${id}.Test${id} GetList one two three 4 5.0
  1358         -      } result] : [set result ""]}] $result
         1366  +      } result] : [set result ""]}] [normalizeVtabResult $result]
  1359   1367   } -cleanup {
  1360   1368     cleanupDb $fileName
  1361   1369   
  1362   1370     unset -nocomplain result code results errors sql dataSource id fileName
  1363   1371   } -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
  1364   1372   System.Data.SQLite defineConstant.System.Data.SQLite.INTEROP_VIRTUAL_TABLE\
  1365         -compileCSharp} -match regexp -result [string map [list \n \r\n] {^Ok\
         1373  +compileCSharp} -match regexp -result [normalizeVtabResult {^Ok\
  1366   1374   System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{0 5 two three one 5\.0\
  1367   1375   4 \{ConstraintUsages is OK\}\}$}]}
  1368   1376   
  1369   1377   ###############################################################################
  1370   1378   
  1371   1379   runTest {test vtab-1.8 {virtual table xBestIndex marshalling (2)} -setup {
  1372   1380     set fileName vtab-1.8.db
................................................................................
  1495   1503       }
  1496   1504     }] true true true results errors [list System.Data.SQLite.dll Eagle.dll]]
  1497   1505   
  1498   1506     list $code $results \
  1499   1507         [expr {[info exists errors] ? $errors : ""}] \
  1500   1508         [expr {$code eq "Ok" ? [catch {
  1501   1509           object invoke _Dynamic${id}.Test${id} GetList one two three 4 5.0
  1502         -      } result] : [set result ""]}] $result
         1510  +      } result] : [set result ""]}] [normalizeVtabResult $result]
  1503   1511   } -cleanup {
  1504   1512     cleanupDb $fileName
  1505   1513   
  1506   1514     unset -nocomplain result code results errors sql dataSource id fileName
  1507   1515   } -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
  1508   1516   System.Data.SQLite defineConstant.System.Data.SQLite.INTEROP_VIRTUAL_TABLE\
  1509         -compileCSharp} -match regexp -result [string map [list \n \r\n] {^Ok\
         1517  +compileCSharp} -match regexp -result [normalizeVtabResult {^Ok\
  1510   1518   System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{0 5 one three\
  1511   1519   \{ConstraintUsages is OK\}\}$}]}
  1512   1520   
  1513   1521   ###############################################################################
  1514   1522   
  1515   1523   runTest {test vtab-1.9 {IEnumerable virtual table w/large byte array} -setup {
  1516   1524     set fileName vtab-1.9.db
................................................................................
  1573   1581       }
  1574   1582     }] true true true results errors System.Data.SQLite.dll]
  1575   1583   
  1576   1584     list $code $results \
  1577   1585         [expr {[info exists errors] ? $errors : ""}] \
  1578   1586         [expr {$code eq "Ok" ? [catch {
  1579   1587           object invoke _Dynamic${id}.Test${id} GetSum
  1580         -      } result] : [set result ""]}] $result
         1588  +      } result] : [set result ""]}] [normalizeVtabResult $result]
  1581   1589   } -cleanup {
  1582   1590     cleanupDb $fileName
  1583   1591   
  1584   1592     unset -nocomplain result code results errors sql dataSource id fileName
  1585   1593   } -time true -constraints {eagle command.object monoBug28 command.sql\
  1586   1594   compile.DATA SQLite System.Data.SQLite\
  1587   1595   defineConstant.System.Data.SQLite.INTEROP_VIRTUAL_TABLE compileCSharp} -match \
  1588         -regexp -result [string map [list \n \r\n] {^Ok\
         1596  +regexp -result [normalizeVtabResult {^Ok\
  1589   1597   System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 (?:-)?\d+$}]}
  1590   1598   
  1591   1599   ###############################################################################
  1592   1600   
  1593   1601   runTest {test vtab-1.10 {virtual table xRowId uniqueness} -setup {
  1594   1602     set fileName vtab-1.10.db
  1595   1603   } -body {
................................................................................
  1670   1678       }
  1671   1679     }] true true true results errors [list System.Data.SQLite.dll Eagle.dll]]
  1672   1680   
  1673   1681     list $code $results \
  1674   1682         [expr {[info exists errors] ? $errors : ""}] \
  1675   1683         [expr {$code eq "Ok" ? [catch {
  1676   1684           object invoke _Dynamic${id}.Test${id} GetList one one two one two two
  1677         -      } result] : [set result ""]}] $result
         1685  +      } result] : [set result ""]}] [normalizeVtabResult $result]
  1678   1686   } -cleanup {
  1679   1687     cleanupDb $fileName
  1680   1688   
  1681   1689     unset -nocomplain result code results errors sql dataSource id fileName
  1682   1690   } -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
  1683   1691   System.Data.SQLite defineConstant.System.Data.SQLite.INTEROP_VIRTUAL_TABLE\
  1684         -compileCSharp} -match regexp -result [string map [list \n \r\n] {^Ok\
         1692  +compileCSharp} -match regexp -result [normalizeVtabResult {^Ok\
  1685   1693   System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{0 4294967296 4294967296\
  1686   1694   8589934592 8589934592 12884901888 12884901888 17179869184 17179869184\
  1687   1695   21474836480 21474836480 25769803776 25769803776\}$}]}
  1688   1696   
  1689   1697   ###############################################################################
  1690   1698   
  1691   1699   runTest {test vtab-1.11 {IEnumerable virtual table w/object identity} -setup {
................................................................................
  1761   1769       }
  1762   1770     }] true true true results errors [list System.Data.SQLite.dll Eagle.dll]]
  1763   1771   
  1764   1772     list $code $results \
  1765   1773         [expr {[info exists errors] ? $errors : ""}] \
  1766   1774         [expr {$code eq "Ok" ? [catch {
  1767   1775           object invoke _Dynamic${id}.Test${id} GetList one two three 4 5.0
  1768         -      } result] : [set result ""]}] $result
         1776  +      } result] : [set result ""]}] [normalizeVtabResult $result]
  1769   1777   } -cleanup {
  1770   1778     cleanupDb $fileName
  1771   1779   
  1772   1780     unset -nocomplain result code results errors sql dataSource id fileName
  1773   1781   } -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
  1774   1782   System.Data.SQLite defineConstant.System.Data.SQLite.INTEROP_VIRTUAL_TABLE\
  1775         -compileCSharp} -match regexp -result [string map [list \n \r\n] {^Ok\
         1783  +compileCSharp} -match regexp -result [normalizeVtabResult {^Ok\
  1776   1784   System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{-?\d+ one -?\d+ two -?\d+\
  1777   1785   three -?\d+ 4 -?\d+ 5\.0\}$}]}
  1778   1786   
  1779   1787   ###############################################################################
  1780   1788   
  1781   1789   runTest {test vtab-1.12 {SQLiteIndex managed-to-native-to-managed} -setup {
  1782   1790     set nConstraint 3; set nOrderBy 3
................................................................................
  1975   1983   
  1976   1984     unset -nocomplain constraintUsage
  1977   1985     unset -nocomplain orderBy nOrderBy iOrderBy
  1978   1986     unset -nocomplain constraint nConstraint iConstraint
  1979   1987     unset -nocomplain pIndex index
  1980   1988   } -constraints {eagle command.object SQLite System.Data.SQLite\
  1981   1989   defineConstant.System.Data.SQLite.INTEROP_VIRTUAL_TABLE} -result {}}
         1990  +
         1991  +###############################################################################
         1992  +
         1993  +rename normalizeVtabResult ""
  1982   1994   
  1983   1995   ###############################################################################
  1984   1996   
  1985   1997   runSQLiteTestEpilogue
  1986   1998   runTestEpilogue

Changes to lib/System.Data.SQLite/common.eagle.

   502    502           # NOTE: Otherwise, return both the generic POSIX file name and the
   503    503           #       Mac OS X file name, since we do not currently have an easy
   504    504           #       way to detect which of those platforms we are running on.
   505    505           #
   506    506           return [list libsqlite3.so libsqlite3.dylib]
   507    507         }
   508    508       }
          509  +
          510  +    proc getNativeLibraryFileName { {default ""} } {
          511  +      set directory [file dirname [getCoreBinaryFileName]]
          512  +
          513  +      foreach fileNameOnly [getNativeLibraryFileNamesOnly] {
          514  +        set fileName [file join $directory $fileNameOnly]
          515  +
          516  +        if {[file exists $fileName]} then {
          517  +          return $fileName
          518  +        }
          519  +      }
          520  +
          521  +      return $default
          522  +    }
   509    523   
   510    524       proc isBuildAvailable { native directory {varName ""} } {
   511    525         #
   512    526         # NOTE: Build the fully qualified file name for the primary assembly
   513    527         #       containing the System.Data.SQLite managed components.  It
   514    528         #       should be noted that this assembly file may also contain the
   515    529         #       native components, if a native build is in use.
................................................................................
  1849   1863         } finally {
  1850   1864           if {[info exists db]} then {
  1851   1865             catch {sql close $db}
  1852   1866             unset -nocomplain db
  1853   1867           }
  1854   1868         }
  1855   1869       }
         1870  +
         1871  +    proc getDbDefaultCacheSize {} {
         1872  +      try {
         1873  +        set db [sql open -type SQLite {Data Source=:memory:;}]
         1874  +        return [sql execute -execute scalar $db "PRAGMA cache_size;"]
         1875  +      } finally {
         1876  +        if {[info exists db]} then {
         1877  +          catch {sql close $db}
         1878  +          unset -nocomplain db
         1879  +        }
         1880  +      }
         1881  +    }
         1882  +
         1883  +    proc useLegacyDbPageAndCacheSizes { varName } {
         1884  +      #
         1885  +      # NOTE: Refer to the specified variable (e.g. "db") in the context of our
         1886  +      #       caller.  It contains the database connection handle that will be
         1887  +      #       used to execute queries used to set the page and cache sizes.
         1888  +      #
         1889  +      upvar 1 $varName db
         1890  +
         1891  +      sql execute $db {
         1892  +        PRAGMA page_size = 1024;
         1893  +        PRAGMA cache_size = 2000;
         1894  +      }
         1895  +
         1896  +      return [list \
         1897  +          [sql execute -execute scalar $db "PRAGMA page_size;"] \
         1898  +          [sql execute -execute scalar $db "PRAGMA cache_size;"]]
         1899  +    }
  1856   1900   
  1857   1901       proc extractSystemDataSQLiteExceptionMessage { value } {
  1858   1902         #
  1859   1903         # NOTE: If the string conforms to format of the normal exception
  1860   1904         #       error strings, extract and return only the error message
  1861   1905         #       portion itself.
  1862   1906         #
................................................................................
  2877   2921                 defineConstant.System.Data.SQLite.COUNT_HANDLE]} then {
  2878   2922           #
  2879   2923           # NOTE: Add each critical handle count to the resulting list.
  2880   2924           #
  2881   2925           foreach name [list connectionCount statementCount backupCount] {
  2882   2926             if {[catch {
  2883   2927               object invoke -flags +NonPublic \
  2884         -                System.Data.SQLite.UnsafeNativeMethods $name
         2928  +                System.Data.SQLite.DebugData $name
  2885   2929             } value] == 0} then {
  2886   2930               if {!$quiet} then {
  2887   2931                 tputs $channel [appendArgs \
  2888   2932                     "---- critical handle count \"" $name "\" is " $value \n]
  2889   2933               }
  2890   2934   
  2891   2935               lappend result $value
................................................................................
  3840   3884               INTEROP_INCLUDE_CEROD INTEROP_INCLUDE_EXTRA INTEROP_INCLUDE_SEE \
  3841   3885               INTEROP_INCLUDE_ZIPVFS INTEROP_JSON1_EXTENSION \
  3842   3886               INTEROP_LEGACY_CLOSE INTEROP_LOG INTEROP_PERCENTILE_EXTENSION \
  3843   3887               INTEROP_REGEXP_EXTENSION INTEROP_TEST_EXTENSION \
  3844   3888               INTEROP_TOTYPE_EXTENSION INTEROP_VIRTUAL_TABLE NET_20 NET_35 \
  3845   3889               NET_40 NET_45 NET_451 NET_452 NET_46 NET_461 NET_COMPACT_20 \
  3846   3890               PLATFORM_COMPACTFRAMEWORK PRELOAD_NATIVE_LIBRARY RETARGETABLE \
  3847         -            SQLITE_STANDARD THROW_ON_DISPOSED TRACE TRACE_CONNECTION \
  3848         -            TRACE_DETECTION TRACE_HANDLE TRACE_PRELOAD TRACE_SHARED \
  3849         -            TRACE_STATEMENT TRACE_WARNING TRACK_MEMORY_BYTES \
         3891  +            SQLITE_STANDARD SQLITE_STANDARD_LIBRARY_NAME THROW_ON_DISPOSED \
         3892  +            TRACE TRACE_CONNECTION TRACE_DETECTION TRACE_HANDLE TRACE_PRELOAD \
         3893  +            TRACE_SHARED TRACE_STATEMENT TRACE_WARNING TRACK_MEMORY_BYTES \
  3850   3894               USE_ENTITY_FRAMEWORK_6 USE_INTEROP_DLL USE_PREPARE_V2 WINDOWS] {
  3851   3895             #
  3852   3896             # NOTE: Check if the compile-time option is listed in the list of
  3853   3897             #       "define constants" kept track of by the managed assembly.
  3854   3898             #
  3855   3899             checkForSQLiteDefineConstant $::test_channel $defineConstant
  3856   3900           }

Changes to readme.htm.

   209    209   <h2><b>Version History</b></h2>
   210    210   
   211    211   <p>
   212    212       <b>1.0.100.0 - April XX, 2016 <font color="red">(release scheduled)</font></b>
   213    213   </p>
   214    214   <ul>
   215    215       <li>Updated to <a href="https://www.sqlite.org/draft/releaselog/3_12_0.html">SQLite 3.12.0</a>.</li>
          216  +    <li>Support compiling and using the interop assembly on Linux and Mac OS X.</li>
          217  +    <li>Support running the test suite under Mono on Linux and Mac OS X.</li>
   216    218       <li>Properly handle NULL values in the &quot;name&quot; column of the results returned by PRAGMA index_info(). Fix for [5251bd0878].</li>
   217    219       <li>For column types that resolve to boolean, recognize case-insensitive prefixes of &quot;True&quot; and &quot;False&quot;. Fix for [dbd65441a5].</li>
   218    220       <li>Add NoVerifyTextAffinity connection flag to skip type affinity checking when fetching a column value as a string. Pursuant to [dbd65441a5].</li>
   219    221       <li>The UnixEpoch DateTime format should use Int64 internally, not Int32.&nbsp;<b>** Potentially Incompatible Change **</b></li>
   220    222       <li>Avoid using Path.Combine with null values in the native library pre-loader. Fix for [da685c0bac].</li>
   221    223       <li>Fix the (unsupported) legacy CryptoAPI based codec so that it no longer prevents page size changes.</li>
   222    224   </ul>

Changes to www/build.wiki.

   156    156           <li>&lt;root&gt;\SQLite.Designer\source.extension.vsixmanifest</li>
   157    157           <li>&lt;root&gt;\SQLite.Interop\props\SQLite.Interop.2005.vsprops</li>
   158    158           <li>&lt;root&gt;\SQLite.Interop\props\SQLite.Interop.2008.vsprops</li>
   159    159           <li>&lt;root&gt;\SQLite.Interop\props\SQLite.Interop.2010.props</li>
   160    160           <li>&lt;root&gt;\SQLite.Interop\props\SQLite.Interop.2012.props</li>
   161    161           <li>&lt;root&gt;\SQLite.Interop\props\SQLite.Interop.2013.props</li>
   162    162           <li>&lt;root&gt;\SQLite.Interop\props\SQLite.Interop.2015.props</li>
   163         -        <li>&lt;root&gt;\SQLite.Interop\src\win\interop.h</li>
          163  +        <li>&lt;root&gt;\SQLite.Interop\src\generic\interop.h</li>
   164    164           <li>&lt;root&gt;\System.Data.SQLite\AssemblyInfo.cs</li>
   165    165           <li>&lt;root&gt;\System.Data.SQLite\SQLite3.cs</li>
   166    166           <li>&lt;root&gt;\System.Data.SQLite\UnsafeNativeMethods.cs</li>
   167    167           <li>&lt;root&gt;\System.Data.SQLite.Linq\AssemblyInfo.cs</li>
   168    168           <li>&lt;root&gt;\test\AssemblyInfo.cs</li>
   169    169           <li>&lt;root&gt;\test\app.config</li>
   170    170           <li>&lt;root&gt;\testce\AssemblyInfo.cs</li>

Changes to www/news.wiki.

     3      3   <b>Version History</b>
     4      4   
     5      5   <p>
     6      6       <b>1.0.100.0 - April XX, 2016 <font color="red">(release scheduled)</font></b>
     7      7   </p>
     8      8   <ul>
     9      9       <li>Updated to <a href="https://www.sqlite.org/draft/releaselog/3_12_0.html">SQLite 3.12.0</a>.</li>
           10  +    <li>Support compiling and using the interop assembly on Linux and Mac OS X.</li>
           11  +    <li>Support running the test suite under Mono on Linux and Mac OS X.</li>
    10     12       <li>Properly handle NULL values in the &quot;name&quot; column of the results returned by PRAGMA index_info(). Fix for [5251bd0878].</li>
    11     13       <li>For column types that resolve to boolean, recognize case-insensitive prefixes of &quot;True&quot; and &quot;False&quot;. Fix for [dbd65441a5].</li>
    12     14       <li>Add NoVerifyTextAffinity connection flag to skip type affinity checking when fetching a column value as a string. Pursuant to [dbd65441a5].</li>
    13     15       <li>The UnixEpoch DateTime format should use Int64 internally, not Int32.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    14     16       <li>Avoid using Path.Combine with null values in the native library pre-loader. Fix for [da685c0bac].</li>
    15     17       <li>Fix the (unsupported) legacy CryptoAPI based codec so that it no longer prevents page size changes.</li>
    16     18   </ul>