System.Data.SQLite
Check-in [67f18e8aaa]
Not logged in

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

Overview
Comment:1.0.46.0
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | sourceforge
Files: files | file ages | folders
SHA1:67f18e8aaa591a8104e3e9c493af77cad2aa13ff
User & Date: rmsimpson 2007-10-01 03:25:29
References
2014-09-22
19:42 Ticket [e122d26e70] Is the call to ColumnAffinity in SQLiteDataReader.GetSQLiteType(SQLiteConnectionFlags flags, int i) needed? status still Open with 6 other changes artifact: 6359a77cd4 user: mistachkin
Context
2007-12-04
16:07
1.0.47.0 check-in: 7518ccfcff user: rmsimpson tags: sourceforge
2007-10-01
03:25
1.0.46.0 check-in: 67f18e8aaa user: rmsimpson tags: sourceforge
2007-09-25
22:50
1.0.45.0 code merge with SQLite 3.4.2 check-in: 5e670230f4 user: rmsimpson tags: sourceforge
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to Doc/Extra/dbfactorysupport.html.

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







|







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

Changes to Doc/Extra/version.html.

50
51
52
53
54
55
56
57
58








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

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








    <p><b>1.0.45.0 - September 25, 2007</b></p>
    <ul>
    <li><strong>Breaking change in GetSchema("Indexes") </strong>-- MetaDataCollections
      restrictions and identifier parts counts were wrong for this schema and I was using
      the wrong final parameter as the final restriction.&nbsp; Meaning, if you use the
      Indexes schema and are querying for a specific index the array should now be {catalog,
      null, table, index } instead of {catalog, null, table, null, index}</li>







<
|
>
>
>
>
>
>
>
>







50
51
52
53
54
55
56

57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
            </span>
          </td>
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">

    <h1 class="heading">Version History</h1>
    <p><b>1.0.46.0 - September 30, 2007</b></p>
    <ul>
    <li>Fixed faulty logic in type discovery code when using SQLiteDataReader.GetValue().</li>
      <li>Fixed Connection.Open() bug when dealing with :memory: databases.</li>
      <li>Fixed SQLiteCommand.ExecuteScalar() to return a properly-typed value.</li>
      <li>Added support for SQLiteParameter.ResetDbType().</li>
      <li>Added test cases for rigid and flexible type testing.</li>
    </ul>
    <p><b>1.0.45.0 - September 25, 2007</b></p>
    <ul>
    <li><strong>Breaking change in GetSchema("Indexes") </strong>-- MetaDataCollections
      restrictions and identifier parts counts were wrong for this schema and I was using
      the wrong final parameter as the final restriction.&nbsp; Meaning, if you use the
      Indexes schema and are querying for a specific index the array should now be {catalog,
      null, table, index } instead of {catalog, null, table, null, index}</li>

Changes to Doc/SQLite.NET.chm.

cannot compute difference between binary files

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

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

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

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







|







 







|


|







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

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

VS_VERSION_INFO VERSIONINFO
 FILEVERSION 1,0,46,0
 PRODUCTVERSION 1,0,0,0
 FILEFLAGSMASK 0x17L
#ifdef _DEBUG
 FILEFLAGS 0x1L
#else
 FILEFLAGS 0x0L
#endif
................................................................................
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "040904b0"
        BEGIN
            VALUE "Comments", "http://sqlite.phxsoftware.com"
            VALUE "FileDescription", "System.Data.SQLite Interop Library"
            VALUE "FileVersion", "1.0.46.0"
            VALUE "InternalName", "SQLite.Interop.DLL"
            VALUE "LegalCopyright", "Released to the public domain"
            VALUE "OriginalFilename", "SQLite3.DLL 3.4.2"
            VALUE "ProductName", "System.Data.SQLite"
            VALUE "ProductVersion", "1.0"
        END
    END
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x409, 1200

Changes to SQLite.Interop/merge.h.

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

#include <windef.h>

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

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







|







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

#include <windef.h>

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

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

Changes to SQLite.Interop/merge_full.h.

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

#include <windef.h>

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

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







|







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

#include <windef.h>

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

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

Changes to SQLite.NET.suo.

cannot compute difference between binary files

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

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







|

|

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

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

88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...
336
337
338
339
340
341
342

343
344
345

346
347

348
349
350
351

352
353
354
355
356
357
358
359
360

361
362
363
364
365
366
367
...
640
641
642
643
644
645
646


647






648
649
650
651
652
653
654
655
...
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
      {
        _fileName = strFilename;
        _sql = SQLiteConnectionPool.Remove(strFilename);
      }

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

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

        _sql = db;
      }
................................................................................
      int len;
      IntPtr p = UnsafeNativeMethods.sqlite3_column_decltype_interop(stmt._sqlite_stmt, index, out len);
      nAffinity = ColumnAffinity(stmt, index);

      if (p != IntPtr.Zero) return UTF8ToString(p, len);
      else
      {

        string[] ar = stmt.TypeDefinitions;
        if (ar != null)
        {

          if (index < ar.Length && ar[index] != null)
            return ar[index];

        }

        switch (nAffinity)
        {

          case TypeAffinity.Int64:
            return "BIGINT";
          case TypeAffinity.Double:
            return "DOUBLE";
          case TypeAffinity.Blob:
            return "BLOB";
          default:
            return "TEXT";
        }

      }
    }

    internal override int ColumnIndex(SQLiteStatement stmt, string columnName)
    {
      int x = ColumnCount(stmt);

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









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

          int n = (int)GetBytes(stmt, index, 0, null, 0, 0);
          byte[] b = new byte[n];
................................................................................
          if (typ.Type == DbType.Guid && n == 16)
            return new Guid(b);

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

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







<







 







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







 







>
>

>
>
>
>
>
>
|







 







<
|

|

<
<
<
|

|

<
<
<
|







88
89
90
91
92
93
94

95
96
97
98
99
100
101
...
335
336
337
338
339
340
341
342
343
344

345
346
347
348
349

350

351
352
353
354
355
356
357
358
359

360
361
362
363
364
365
366
367
...
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
...
666
667
668
669
670
671
672

673
674
675
676



677
678
679
680



681
682
683
684
685
686
687
688
      {
        _fileName = strFilename;
        _sql = SQLiteConnectionPool.Remove(strFilename);
      }

      if (_sql == null)
      {

        IntPtr db;

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

        _sql = db;
      }
................................................................................
      int len;
      IntPtr p = UnsafeNativeMethods.sqlite3_column_decltype_interop(stmt._sqlite_stmt, index, out len);
      nAffinity = ColumnAffinity(stmt, index);

      if (p != IntPtr.Zero) return UTF8ToString(p, len);
      else
      {
        return String.Empty;
        //string[] ar = stmt.TypeDefinitions;
        //if (ar != null)

        //{
        //  if (index < ar.Length && ar[index] != null)
        //    return ar[index];
        //}


        //switch (nAffinity)

        //{
        //  case TypeAffinity.Int64:
        //    return "BIGINT";
        //  case TypeAffinity.Double:
        //    return "DOUBLE";
        //  case TypeAffinity.Blob:
        //    return "BLOB";
        //  default:
        //    return "TEXT";

        //}
      }
    }

    internal override int ColumnIndex(SQLiteStatement stmt, string columnName)
    {
      int x = ColumnCount(stmt);

................................................................................
    /// <param name="stmt">The statement being step()'d through</param>
    /// <param name="index">The column index to retrieve</param>
    /// <param name="typ">The type of data contained in the column.  If Uninitialized, this function will retrieve the datatype information.</param>
    /// <returns>Returns the data in the column</returns>
    internal override object GetValue(SQLiteStatement stmt, int index, SQLiteType typ)
    {
      if (IsNull(stmt, index)) return DBNull.Value;
      TypeAffinity aff = typ.Affinity;
      Type t = null;

      if (typ.Type != DbType.Object)
      {
        t = SQLiteConvert.SQLiteTypeToType(typ);
        aff = TypeToAffinity(t);
      }

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

          int n = (int)GetBytes(stmt, index, 0, null, 0, 0);
          byte[] b = new byte[n];
................................................................................
          if (typ.Type == DbType.Guid && n == 16)
            return new Guid(b);

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

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



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



          return GetText(stmt, index);
      }
    }

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

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

593
594
595
596
597
598
599


600
601
602
603
604
605
606
      {
        stmt = GetStatement(x);
        x++;
        if (stmt == null) break;

        if (_cnn._sql.Step(stmt) == true && ret == null)
        {


          ret = _cnn._sql.GetValue(stmt, 0, typ);
        }
        _cnn._sql.Reset(stmt);
      }

      return ret;
    }







>
>







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

        if (_cnn._sql.Step(stmt) == true && ret == null)
        {
          typ.Type = SQLiteConvert.TypeNameToDbType(_cnn._sql.ColumnType(stmt, 0, out typ.Affinity));

          ret = _cnn._sql.GetValue(stmt, 0, typ);
        }
        _cnn._sql.Reset(stmt);
      }

      return ret;
    }

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

482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
...
788
789
790
791
792
793
794


795
796
797
798


799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
    /// <summary>
    /// When the database connection is closed, all commands linked to this connection are automatically reset.
    /// </summary>
    public override void Close()
    {
      if (_sql != null)
      {
        // Force any commands associated with this connection to release their unmanaged
        // resources.  The commands are still valid and will automatically re-acquire the
        // unmanaged resources the next time they are run -- provided this connection is
        // re-opened before then.
        //WeakReference[] clone;

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

        //for (int n = 0; n < clone.Length; n++)
        //{
        //  SQLiteCommand cmd = null;
        //  try
        //  {
        //    cmd = clone[n].Target as SQLiteCommand;
        //  }
        //  catch
        //  {
        //  }
        //  if (cmd != null)
        //    cmd.ClearCommands();
        //}

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

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

      if (String.Compare(fileName, ":MEMORY:", true, CultureInfo.InvariantCulture) == 0)
        fileName = ":memory:";


#if PLATFORM_COMPACTFRAMEWORK
      else if (fileName.StartsWith(".\\"))
        fileName = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetCallingAssembly().GetName().CodeBase) + fileName.Substring(1);
#endif


      try
      {
        bool usePooling = (Convert.ToBoolean(FindKey(opts, "Pooling", Boolean.FalseString), CultureInfo.CurrentCulture) == true);
        bool bUTF16 = (Convert.ToBoolean(FindKey(opts, "UseUTF16Encoding", Boolean.FalseString), CultureInfo.CurrentCulture) == true);
        SQLiteDateFormats dateFormat = String.Compare(FindKey(opts, "DateTimeFormat", "ISO8601"), "ticks", true, CultureInfo.InvariantCulture) == 0 ? SQLiteDateFormats.Ticks : SQLiteDateFormats.ISO8601;

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

        fileName = ExpandFileName(fileName);

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







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







 







>
>

|
|

>
>











<
<







482
483
484
485
486
487
488


























489
490
491
492
493
494
495
...
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787


788
789
790
791
792
793
794
    /// <summary>
    /// When the database connection is closed, all commands linked to this connection are automatically reset.
    /// </summary>
    public override void Close()
    {
      if (_sql != null)
      {


























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

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

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

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



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

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

907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937

      typ = _fieldTypeArray[i];

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

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

        typ.Affinity = newaffinity;
      }

      return typ;
    }

    /// <summary>
    /// Reads the next row from the resultset
    /// </summary>







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







907
908
909
910
911
912
913
914

915














916
917
918
919
920
921
922

      typ = _fieldTypeArray[i];

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

        typ.Affinity = _activeStatement._sql.ColumnAffinity(_activeStatement, i);















      return typ;
    }

    /// <summary>
    /// Reads the next row from the resultset
    /// </summary>

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

299
300
301
302
303
304
305






306

307
308
309
310
311
312
313
...
340
341
342
343
344
345
346
347
348
349
350

351
352
353
354
355
356
357
    [DbProviderSpecificTypeProperty(true)]
    [RefreshProperties(RefreshProperties.All)]
#endif
    public override DbType DbType
    {
      get
      {






        if (_dbType == -1) return DbType.String; // Unassigned default value is String

        return (DbType)_dbType;
      }
      set
      {
        _dbType = (int)value;
      }
    }
................................................................................
      set
      {
        _parameterName = value;
      }
    }

    /// <summary>
    /// Not implemented
    /// </summary>
    public override void ResetDbType()
    {

    }

    /// <summary>
    /// Returns the size of the parameter
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [DefaultValue((int)0)]







>
>
>
>
>
>
|
>







 







|



>







299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
...
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
    [DbProviderSpecificTypeProperty(true)]
    [RefreshProperties(RefreshProperties.All)]
#endif
    public override DbType DbType
    {
      get
      {
        if (_dbType == -1)
        {
          if (_objValue != null && _objValue != DBNull.Value)
          {
            return SQLiteConvert.TypeToDbType(_objValue.GetType());
          }
          return DbType.String; // Unassigned default value is String
        }
        return (DbType)_dbType;
      }
      set
      {
        _dbType = (int)value;
      }
    }
................................................................................
      set
      {
        _parameterName = value;
      }
    }

    /// <summary>
    /// Resets the DbType of the parameter so it can be inferred from the value
    /// </summary>
    public override void ResetDbType()
    {
      _dbType = -1;
    }

    /// <summary>
    /// Returns the size of the parameter
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [DefaultValue((int)0)]

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

cannot compute difference between binary files

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

cannot compute difference between binary files

Changes to bin/CompactFramework/testce.exe.

cannot compute difference between binary files

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

cannot compute difference between binary files

Changes to bin/Designer/install.exe.

cannot compute difference between binary files

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

cannot compute difference between binary files

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

cannot compute difference between binary files

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

cannot compute difference between binary files

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

cannot compute difference between binary files

Changes to bin/test.exe.

cannot compute difference between binary files

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

cannot compute difference between binary files

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

cannot compute difference between binary files

Changes to readme.htm.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
...
115
116
117
118
119
120
121



















































122
123

124
125
126
127
128

129
130
131
132
133
134
135
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title></title>
  </head>
  <body>
    ADO.NET 2.0 SQLite Data Provider<br>
    Version 1.0.42.0 June &nbsp;1, 2007<br>
    Using SQLite 3.3.17<br>
    Written by Robert Simpson (<a href="mailto:robert@blackcastlesoft.com">robert@blackcastlesoft.com</a>)<br>
    Released to the public domain, use at your own risk!<br>
    Official provider website:&nbsp; <a href="http://sqlite.phxsoftware.com">http://sqlite.phxsoftware.com</a><br />
    <br>
    The latest version can be downloaded <a href="http://sourceforge.net/projects/sqlite-dotnet2">
      here</a>
    <br>
................................................................................
    <p>
      The core sqlite engine is compiled directly from the unmodified source code available
      at the sqlite.org website.&nbsp; Several additional pieces are compiled on top of
      it to extend its functionality, but the core engine's source is not changed.</p>
    <p></p>
    <p>
      <b>Version History</b></p>



















































    <p><b>1.0.43.0 - June 2, 2007</b></p>
    <ul>

    <li>Fixed a reuse bug in the SQLiteDataAdapter in conjunction with the SQLiteCommandBuilder.&nbsp;
      It's been there unnoticed for more than a year, so it looks like most folks never
      encountered it.</li>
      <li>Fixed an event handler bug in SQLiteCommandBuilder in which it could fail to unlatch
        from the DataAdapter when reused.&nbsp; Relates to the previous bugfix.</li>

    </ul>
    <p><b>1.0.42.0 - June 1, 2007</b></p>
    <ul>
    <li>Code merge with SQLite 3.3.17</li>
      <li>Changed the SQLiteFunction static constructor so it only enumerates loaded modules
        that have referenced the SQLite assembly, which hopefully should cut down dramatically
        the time it takes for that function to execute.&nbsp;</li>







|
|







 







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

>
|

|


>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
...
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title></title>
  </head>
  <body>
    ADO.NET 2.0 SQLite Data Provider<br>
    Version 1.0.46.0 September 30, 2007<br>
    Using SQLite 3.4.2<br>
    Written by Robert Simpson (<a href="mailto:robert@blackcastlesoft.com">robert@blackcastlesoft.com</a>)<br>
    Released to the public domain, use at your own risk!<br>
    Official provider website:&nbsp; <a href="http://sqlite.phxsoftware.com">http://sqlite.phxsoftware.com</a><br />
    <br>
    The latest version can be downloaded <a href="http://sourceforge.net/projects/sqlite-dotnet2">
      here</a>
    <br>
................................................................................
    <p>
      The core sqlite engine is compiled directly from the unmodified source code available
      at the sqlite.org website.&nbsp; Several additional pieces are compiled on top of
      it to extend its functionality, but the core engine's source is not changed.</p>
    <p></p>
    <p>
      <b>Version History</b></p>
    <p><b>1.0.46.0 - September 30, 2007</b></p>
    <ul>
    <li>Fixed faulty logic in type discovery code when using SQLiteDataReader.GetValue().</li>
      <li>Fixed Connection.Open() bug when dealing with :memory: databases.</li>
      <li>Fixed SQLiteCommand.ExecuteScalar() to return a properly-typed value.</li>
      <li>Added support for SQLiteParameter.ResetDbType().</li>
      <li>Added test cases for rigid and flexible type testing.</li>
    </ul>
    <p><b>1.0.45.0 - September 25, 2007</b></p>
    <ul>
    <li><strong>Breaking change in GetSchema("Indexes") </strong>-- MetaDataCollections
      restrictions and identifier parts counts were wrong for this schema and I was using
      the wrong final parameter as the final restriction.&nbsp; Meaning, if you use the
      Indexes schema and are querying for a specific index the array should now be {catalog,
      null, table, index } instead of {catalog, null, table, null, index}</li>
      <li>Code merge with SQLite 3.4.2</li>
      <li>Fixed some errors in the encryption module, most notably when a non-default page
        size is specified in the connection string. </li>
      <li>Fixed SQLiteDataReader to better handle type-less usage scenarios, which also
        fixes problems with null values and datetimes.</li>
      <li>Fixed the leftover temp files problem on WinCE </li>
      <li>Added connection pooling.&nbsp; The default is disabled for now, but may change
      in the future.&nbsp; Set "Pooling=True" in the connection string to enable it. </li>
      <li>Sped up SQLiteConnection.Open() considerably.</li>
      <li>Added some more robust cleanup code regarding SQLiteFunctions.</li>
      <li>Minor additions to the code to allow for future LINQ integration into the main
        codebase.</li>
      <li>Fixed a long-standing bug in the Open() command of SQLiteConnection which failed
      to honor the documented default behavior of the SQLite.NET provider to open the
      database in "Synchronous=Normal" mode.&nbsp; The default was "Full". </li>
      <li>If Open() fails, it no longer sets the connection state to Broken.&nbsp; It instead
        reverts back to Closed, and cleans up after itself.</li>
      <li>Added several new parameters to the ConnectionString for setting max page count,
        legacy file format, and another called FailIfMissing to raise an error rather than
        create the database file automatically if it does not already exist.</li>
      <li>Fixed some designer toolbox references to the wrong version of the SQLite.Designer</li>
      <li>Fixed a bug in the mergebin utility with regards to COR20 metadata rowsize computations.&nbsp;
      </li>
      <li>Minor documentation corrections &nbsp;&nbsp;</li>
    </ul>
    <p><b>1.0.44.0 - July 21, 2007</b></p>
    <ul>
    <li>Code merge with SQLite 3.4.1</li>
      <li>Fixed a bug in SQLiteConnection.Open() which threw the wrong kind of error in
        the wrong kind of way when a database file could not be opened or created.&nbsp;</li>
      <li>Small enhancements to the TYPES keyword, and added documentation for it in the
        help file.</li>
      <li>Hopefully fixed the occasional SQLITE_BUSY errors that cropped up when starting
        a transaction.&nbsp; Usually occurred in high-contention scenarios, and the underlying
        SQLite engine bypasses the busy handler in this scenario to return immediately.</li>
    </ul>
    <p><b>1.0.43.0 - June 21, 2007</b></p>
    <ul>
    <li>Code merge with SQLite 3.4.0</li>
      <li>Fixed a reuse bug in the SQLiteDataAdapter in conjunction with the SQLiteCommandBuilder.&nbsp;
      It's been there unnoticed for more than a year, so it looks like most folks never
      encountered it. </li>
      <li>Fixed an event handler bug in SQLiteCommandBuilder in which it could fail to unlatch
        from the DataAdapter when reused.&nbsp; Relates to the previous bugfix.</li>
      <li>Fixed a double-dispose bug in SQLiteStatement that triggered a SQLiteException.&nbsp;</li>
    </ul>
    <p><b>1.0.42.0 - June 1, 2007</b></p>
    <ul>
    <li>Code merge with SQLite 3.3.17</li>
      <li>Changed the SQLiteFunction static constructor so it only enumerates loaded modules
        that have referenced the SQLite assembly, which hopefully should cut down dramatically
        the time it takes for that function to execute.&nbsp;</li>

Changes to test/Program.cs.

1
2
3
4
5


6
7
8
9
10
11
12
..
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using System;
using System.Data;
using System.Text;
using System.Data.Common;
using System.Data.SQLite;



namespace test
{
  class Program
  {
    static void Main(string[] args)
    {
................................................................................
      DbProviderFactory fact;
      fact = DbProviderFactories.GetFactory("System.Data.SQLite");

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

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

        TestCases.Run(fact, cnn);
      }

      Console.ReadKey();
    }





>
>







 







|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
..
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
using System;
using System.Data;
using System.Text;
using System.Data.Common;
using System.Data.SQLite;
using System.Data.SqlClient;
using System.Transactions;

namespace test
{
  class Program
  {
    static void Main(string[] args)
    {
................................................................................
      DbProviderFactory fact;
      fact = DbProviderFactories.GetFactory("System.Data.SQLite");

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

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

        TestCases.Run(fact, cnn);
      }

      Console.ReadKey();
    }

Changes to test/TestCases.cs.

84
85
86
87
88
89
90



91
92
93
94
95
96
97
...
164
165
166
167
168
169
170
























































































171
172
173
174
175
176
177
    {
      Console.WriteLine("\r\nBeginning Test on " + cnn.GetType().ToString());
      try { CreateTable(cnn); Console.WriteLine("SUCCESS - CreateTable"); }
      catch (Exception) { Console.WriteLine("FAIL - CreateTable"); }

      try { FullTextTest(cnn); Console.WriteLine("SUCCESS - Full Text Search"); }
      catch (Exception) { Console.WriteLine("FAIL - Full Text Search"); }




      try { DisposePattenTest(cnn); Console.WriteLine("SUCCESS - Dispose pattern test"); }
      catch (Exception) { Console.WriteLine("FAIL - Dispose pattern test"); }

      try { KeyInfoTest(fact, cnn); Console.WriteLine("SUCCESS - KeyInfo Fetch"); }
      catch (Exception) { Console.WriteLine("FAIL - KeyInfo Fetch"); }

................................................................................
          DbCommand cmd = newcnn.CreateCommand();
          cmd.CommandText = "SELECT * FROM TestCase";
          DbDataReader reader = cmd.ExecuteReader();
          reader.Read();
        }
      }
    }

























































































    internal static void KeyInfoTest(DbProviderFactory fact, DbConnection cnn)
    {
      using (DbCommand cmd = cnn.CreateCommand())
      {
        // First test against integer primary key (optimized) keyinfo fetch
        cmd.CommandText = "Create table keyinfotest (id integer primary key, myuniquevalue integer unique not null, myvalue varchar(50))";







>
>
>







 







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







84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
...
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
    {
      Console.WriteLine("\r\nBeginning Test on " + cnn.GetType().ToString());
      try { CreateTable(cnn); Console.WriteLine("SUCCESS - CreateTable"); }
      catch (Exception) { Console.WriteLine("FAIL - CreateTable"); }

      try { FullTextTest(cnn); Console.WriteLine("SUCCESS - Full Text Search"); }
      catch (Exception) { Console.WriteLine("FAIL - Full Text Search"); }

      try { DataTypeTest(cnn); Console.WriteLine("SUCCESS - DataType Test"); }
      catch (Exception) { Console.WriteLine("FAIL - DataType Test"); }

      try { DisposePattenTest(cnn); Console.WriteLine("SUCCESS - Dispose pattern test"); }
      catch (Exception) { Console.WriteLine("FAIL - Dispose pattern test"); }

      try { KeyInfoTest(fact, cnn); Console.WriteLine("SUCCESS - KeyInfo Fetch"); }
      catch (Exception) { Console.WriteLine("FAIL - KeyInfo Fetch"); }

................................................................................
          DbCommand cmd = newcnn.CreateCommand();
          cmd.CommandText = "SELECT * FROM TestCase";
          DbDataReader reader = cmd.ExecuteReader();
          reader.Read();
        }
      }
    }

    internal static void DataTypeTest(DbConnection cnn)
    {
      DateTime now = DateTime.Now;
      using (DbCommand cmd = cnn.CreateCommand())
      {
        cmd.CommandText = "create table datatypetest(id integer primary key, myvalue, datetimevalue datetime, decimalvalue decimal)";
        cmd.ExecuteNonQuery();

        cmd.CommandText = "insert into datatypetest(myvalue, datetimevalue, decimalvalue) values(?,?,?)";
        DbParameter p1 = cmd.CreateParameter();
        DbParameter p2 = cmd.CreateParameter();
        DbParameter p3 = cmd.CreateParameter();

        cmd.Parameters.Add(p1);
        cmd.Parameters.Add(p2);
        cmd.Parameters.Add(p3);

        p1.Value = 1;
        p2.Value = DateTime.MinValue;
        p3.Value = (Decimal)1.05;
        cmd.ExecuteNonQuery();

        p1.ResetDbType();
        p2.ResetDbType();
        p3.ResetDbType();

        p1.Value = "One";
        p2.Value = "2001-01-01";
        p3.Value = (Decimal)1.0;
        cmd.ExecuteNonQuery();

        p1.ResetDbType();
        p2.ResetDbType();
        p3.ResetDbType();

        p1.Value = 1.01;
        p2.Value = now;
        p3.Value = (Decimal)9.91;
        cmd.ExecuteNonQuery();

        cmd.CommandText = "select myvalue, datetimevalue, decimalvalue from datatypetest";
        using (DbDataReader reader = cmd.ExecuteReader())
        {
          for (int n = 0; n < 3; n++)
          {
            reader.Read();
            if (reader.GetValue(1).GetType() != reader.GetDateTime(1).GetType()) throw new ArgumentOutOfRangeException();
            if (reader.GetValue(2).GetType() != reader.GetDecimal(2).GetType()) throw new ArgumentOutOfRangeException();

            switch (n)
            {
              case 0:
                if (reader.GetValue(0).GetType() != typeof(long)) throw new ArgumentOutOfRangeException();

                if (reader.GetValue(0).Equals((long)1) == false) throw new ArgumentOutOfRangeException();
                if (reader.GetValue(1).Equals(DateTime.MinValue) == false) throw new ArgumentOutOfRangeException();
                if (reader.GetValue(2).Equals((Decimal)1.05) == false) throw new ArgumentOutOfRangeException();

                if (reader.GetInt64(0) != (long)1) throw new ArgumentOutOfRangeException();
                if (reader.GetValue(1).Equals(reader.GetDateTime(1)) == false) throw new ArgumentOutOfRangeException();
                if (reader.GetValue(2).Equals(reader.GetDecimal(2)) == false) throw new ArgumentOutOfRangeException();
                break;
              case 1:
                if (reader.GetValue(0).GetType() != typeof(string)) throw new ArgumentOutOfRangeException();
                if (reader.GetValue(0).Equals("One") == false) throw new ArgumentOutOfRangeException();
                if (reader.GetValue(1).Equals(new DateTime(2001, 1, 1)) == false) throw new ArgumentOutOfRangeException();
                if (reader.GetValue(2).Equals((Decimal)1.0) == false) throw new ArgumentOutOfRangeException();

                if (reader.GetString(0) != "One") throw new ArgumentOutOfRangeException();
                if (reader.GetValue(1).Equals(reader.GetDateTime(1)) == false) throw new ArgumentOutOfRangeException();
                if (reader.GetValue(2).Equals(reader.GetDecimal(2)) == false) throw new ArgumentOutOfRangeException();
                break;
              case 2:
                if (reader.GetValue(0).GetType() != typeof(double)) throw new ArgumentOutOfRangeException();
                if (reader.GetValue(0).Equals(1.01) == false) throw new ArgumentOutOfRangeException();
                if (reader.GetValue(1).Equals(now) == false) throw new ArgumentOutOfRangeException();
                if (reader.GetValue(2).Equals((Decimal)9.91) == false) throw new ArgumentOutOfRangeException();

                if (reader.GetDouble(0) != 1.01) throw new ArgumentOutOfRangeException();
                if (reader.GetValue(1).Equals(reader.GetDateTime(1)) == false) throw new ArgumentOutOfRangeException();
                if (reader.GetValue(2).Equals(reader.GetDecimal(2)) == false) throw new ArgumentOutOfRangeException();
                break;
            }
          }
        }
      }
    }

    internal static void KeyInfoTest(DbProviderFactory fact, DbConnection cnn)
    {
      using (DbCommand cmd = cnn.CreateCommand())
      {
        // First test against integer primary key (optimized) keyinfo fetch
        cmd.CommandText = "Create table keyinfotest (id integer primary key, myuniquevalue integer unique not null, myvalue varchar(50))";

Changes to testce/TestCases.cs.

71
72
73
74
75
76
77



78
79
80
81
82
83
84
...
196
197
198
199
200
201
202
























































































203
204
205
206
207
208
209
      frm = new Form1();

      frm.Show();

      frm.WriteLine("\r\nBeginning Test on " + cnn.GetType().ToString());
      try { CreateTable(cnn); frm.WriteLine("SUCCESS - CreateTable"); }
      catch (Exception) { frm.WriteLine("FAIL - CreateTable"); }




      try { FullTextTest(cnn); frm.WriteLine("SUCCESS - Full Text Search"); }
      catch (Exception) { frm.WriteLine("FAIL - Full Text Search"); }

      try { KeyInfoTest(cnn); frm.WriteLine("SUCCESS - KeyInfo Fetch"); }
      catch (Exception) { frm.WriteLine("FAIL - KeyInfo Fetch"); }

................................................................................
          {
            if (updatecmd.Parameters.Count != 4)
              throw new ArgumentOutOfRangeException("Wrong number of parameters in update command!");
          }
        }
      }
    }

























































































    internal static void FullTextTest(DbConnection cnn)
    {
      using (DbCommand cmd = cnn.CreateCommand())
      {
        cmd.CommandText = "CREATE VIRTUAL TABLE FullText USING FTS2(name, ingredients);";
        cmd.ExecuteNonQuery();







>
>
>







 







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







71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
...
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
      frm = new Form1();

      frm.Show();

      frm.WriteLine("\r\nBeginning Test on " + cnn.GetType().ToString());
      try { CreateTable(cnn); frm.WriteLine("SUCCESS - CreateTable"); }
      catch (Exception) { frm.WriteLine("FAIL - CreateTable"); }

      try { DataTypeTest(cnn); frm.WriteLine("SUCCESS - DataType Test"); }
      catch (Exception) { frm.WriteLine("FAIL - DataType Test"); }

      try { FullTextTest(cnn); frm.WriteLine("SUCCESS - Full Text Search"); }
      catch (Exception) { frm.WriteLine("FAIL - Full Text Search"); }

      try { KeyInfoTest(cnn); frm.WriteLine("SUCCESS - KeyInfo Fetch"); }
      catch (Exception) { frm.WriteLine("FAIL - KeyInfo Fetch"); }

................................................................................
          {
            if (updatecmd.Parameters.Count != 4)
              throw new ArgumentOutOfRangeException("Wrong number of parameters in update command!");
          }
        }
      }
    }

    internal static void DataTypeTest(DbConnection cnn)
    {
      DateTime now = DateTime.Now;
      using (DbCommand cmd = cnn.CreateCommand())
      {
        cmd.CommandText = "create table datatypetest(id integer primary key, myvalue, datetimevalue datetime, decimalvalue decimal)";
        cmd.ExecuteNonQuery();

        cmd.CommandText = "insert into datatypetest(myvalue, datetimevalue, decimalvalue) values(?,?,?)";
        DbParameter p1 = cmd.CreateParameter();
        DbParameter p2 = cmd.CreateParameter();
        DbParameter p3 = cmd.CreateParameter();

        cmd.Parameters.Add(p1);
        cmd.Parameters.Add(p2);
        cmd.Parameters.Add(p3);

        p1.Value = 1;
        p2.Value = DateTime.MinValue;
        p3.Value = (Decimal)1.05;
        cmd.ExecuteNonQuery();

        p1.ResetDbType();
        p2.ResetDbType();
        p3.ResetDbType();

        p1.Value = "One";
        p2.Value = "2001-01-01";
        p3.Value = (Decimal)1.0;
        cmd.ExecuteNonQuery();

        p1.ResetDbType();
        p2.ResetDbType();
        p3.ResetDbType();

        p1.Value = 1.01;
        p2.Value = now;
        p3.Value = (Decimal)9.91;
        cmd.ExecuteNonQuery();

        cmd.CommandText = "select myvalue, datetimevalue, decimalvalue from datatypetest";
        using (DbDataReader reader = cmd.ExecuteReader())
        {
          for (int n = 0; n < 3; n++)
          {
            reader.Read();
            if (reader.GetValue(1).GetType() != reader.GetDateTime(1).GetType()) throw new ArgumentOutOfRangeException();
            if (reader.GetValue(2).GetType() != reader.GetDecimal(2).GetType()) throw new ArgumentOutOfRangeException();

            switch (n)
            {
              case 0:
                if (reader.GetValue(0).GetType() != typeof(long)) throw new ArgumentOutOfRangeException();

                if (reader.GetValue(0).Equals((long)1) == false) throw new ArgumentOutOfRangeException();
                if (reader.GetValue(1).Equals(DateTime.MinValue) == false) throw new ArgumentOutOfRangeException();
                if (reader.GetValue(2).Equals((Decimal)1.05) == false) throw new ArgumentOutOfRangeException();

                if (reader.GetInt64(0) != (long)1) throw new ArgumentOutOfRangeException();
                if (reader.GetValue(1).Equals(reader.GetDateTime(1)) == false) throw new ArgumentOutOfRangeException();
                if (reader.GetValue(2).Equals(reader.GetDecimal(2)) == false) throw new ArgumentOutOfRangeException();
                break;
              case 1:
                if (reader.GetValue(0).GetType() != typeof(string)) throw new ArgumentOutOfRangeException();
                if (reader.GetValue(0).Equals("One") == false) throw new ArgumentOutOfRangeException();
                if (reader.GetValue(1).Equals(new DateTime(2001, 1, 1)) == false) throw new ArgumentOutOfRangeException();
                if (reader.GetValue(2).Equals((Decimal)1.0) == false) throw new ArgumentOutOfRangeException();

                if (reader.GetString(0) != "One") throw new ArgumentOutOfRangeException();
                if (reader.GetValue(1).Equals(reader.GetDateTime(1)) == false) throw new ArgumentOutOfRangeException();
                if (reader.GetValue(2).Equals(reader.GetDecimal(2)) == false) throw new ArgumentOutOfRangeException();
                break;
              case 2:
                if (reader.GetValue(0).GetType() != typeof(double)) throw new ArgumentOutOfRangeException();
                if (reader.GetValue(0).Equals(1.01) == false) throw new ArgumentOutOfRangeException();
                if (reader.GetValue(1).Equals(now) == false) throw new ArgumentOutOfRangeException();
                if (reader.GetValue(2).Equals((Decimal)9.91) == false) throw new ArgumentOutOfRangeException();

                if (reader.GetDouble(0) != 1.01) throw new ArgumentOutOfRangeException();
                if (reader.GetValue(1).Equals(reader.GetDateTime(1)) == false) throw new ArgumentOutOfRangeException();
                if (reader.GetValue(2).Equals(reader.GetDecimal(2)) == false) throw new ArgumentOutOfRangeException();
                break;
            }
          }
        }
      }
    }

    internal static void FullTextTest(DbConnection cnn)
    {
      using (DbCommand cmd = cnn.CreateCommand())
      {
        cmd.CommandText = "CREATE VIRTUAL TABLE FullText USING FTS2(name, ingredients);";
        cmd.ExecuteNonQuery();

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

cannot compute difference between binary files

Changes to tools/setup/exe/setup/setup.rc.

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

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

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







|







 







|







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

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

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

Changes to tools/setup/sqlite_setup.suo.

cannot compute difference between binary files

Changes to tools/setup/sqlite_setup.vdproj.

618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
...
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
...
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
...
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
....
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
....
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
            "IsDependency" = "11:FALSE"
            "IsolateTo" = "8:"
            }
            "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_2C7EDFF06B61482393D94E3A63D90113"
            {
            "AssemblyRegister" = "3:1"
            "AssemblyIsInGAC" = "11:FALSE"
            "AssemblyAsmDisplayName" = "8:test, Version=1.0.0.27079, Culture=neutral, processorArchitecture=x86"
                "ScatterAssemblies"
                {
                    "_2C7EDFF06B61482393D94E3A63D90113"
                    {
                    "Name" = "8:test.exe"
                    "Attributes" = "3:512"
                    }
................................................................................
            "IsDependency" = "11:FALSE"
            "IsolateTo" = "8:"
            }
            "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_40DFF08BA903482D807E715A041CA8B1"
            {
            "AssemblyRegister" = "3:1"
            "AssemblyIsInGAC" = "11:FALSE"
            "AssemblyAsmDisplayName" = "8:install, Version=1.0.0.27432, Culture=neutral, processorArchitecture=x86"
                "ScatterAssemblies"
                {
                    "_40DFF08BA903482D807E715A041CA8B1"
                    {
                    "Name" = "8:install.exe"
                    "Attributes" = "3:512"
                    }
................................................................................
            "IsDependency" = "11:FALSE"
            "IsolateTo" = "8:"
            }
            "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_40F352185F3B41A485F42BFC64BF9162"
            {
            "AssemblyRegister" = "3:1"
            "AssemblyIsInGAC" = "11:FALSE"
            "AssemblyAsmDisplayName" = "8:testce, Version=1.0.0.27115, Culture=neutral, processorArchitecture=MSIL"
                "ScatterAssemblies"
                {
                    "_40F352185F3B41A485F42BFC64BF9162"
                    {
                    "Name" = "8:testce.exe"
                    "Attributes" = "3:512"
                    }
................................................................................
            "IsDependency" = "11:FALSE"
            "IsolateTo" = "8:"
            }
            "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_A18DBDB7776215EAD9A52C96F8CA1E91"
            {
            "AssemblyRegister" = "3:1"
            "AssemblyIsInGAC" = "11:FALSE"
            "AssemblyAsmDisplayName" = "8:System.Data.SQLite, Version=1.0.45.0, Culture=neutral, PublicKeyToken=1fdb50b1b62b4c84, processorArchitecture=x86"
                "ScatterAssemblies"
                {
                    "_A18DBDB7776215EAD9A52C96F8CA1E91"
                    {
                    "Name" = "8:System.Data.SQLite.DLL"
                    "Attributes" = "3:512"
                    }
................................................................................
            "IsDependency" = "11:TRUE"
            "IsolateTo" = "8:"
            }
            "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_F320FBAE871DA320178BEEA242900CC7"
            {
            "AssemblyRegister" = "3:1"
            "AssemblyIsInGAC" = "11:FALSE"
            "AssemblyAsmDisplayName" = "8:System.Data.SQLite, Version=1.0.45.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=x86"
                "ScatterAssemblies"
                {
                    "_F320FBAE871DA320178BEEA242900CC7"
                    {
                    "Name" = "8:System.Data.SQLite.DLL"
                    "Attributes" = "3:512"
                    }
................................................................................
        {
        "LangId" = "3:1033"
        }
        "Product"
        {
        "Name" = "8:Microsoft Visual Studio"
        "ProductName" = "8:SQLite ADO.NET 2.0 Provider"
        "ProductCode" = "8:{C8C58E1B-E2E4-4838-A284-A0BF4BAC2E17}"
        "PackageCode" = "8:{6C5503A2-52F8-4C54-8DC1-D970D0F17756}"
        "UpgradeCode" = "8:{78329A82-AFB1-453B-AF00-D46AC911DA89}"
        "RestartWWWService" = "11:FALSE"
        "RemovePreviousVersions" = "11:TRUE"
        "DetectNewerInstalledVersion" = "11:TRUE"
        "InstallAllUsers" = "11:TRUE"
        "ProductVersion" = "8:1.045.0"
        "Manufacturer" = "8:Phoenix Software Solutions, LLC"
        "ARPHELPTELEPHONE" = "8:"
        "ARPHELPLINK" = "8:http://sqlite.phxsoftware.com"
        "Title" = "8:SQLite ADO.NET 2.0 Provider"
        "Subject" = "8:"
        "ARPCONTACT" = "8:Phoenix Software Solutions, LLC"
        "Keywords" = "8:"







|







 







|







 







|







 







|







 







|







 







|
|





|







618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
...
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
...
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
...
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
....
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
....
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
            "IsDependency" = "11:FALSE"
            "IsolateTo" = "8:"
            }
            "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_2C7EDFF06B61482393D94E3A63D90113"
            {
            "AssemblyRegister" = "3:1"
            "AssemblyIsInGAC" = "11:FALSE"
            "AssemblyAsmDisplayName" = "8:test, Version=1.0.0.35203, Culture=neutral, processorArchitecture=x86"
                "ScatterAssemblies"
                {
                    "_2C7EDFF06B61482393D94E3A63D90113"
                    {
                    "Name" = "8:test.exe"
                    "Attributes" = "3:512"
                    }
................................................................................
            "IsDependency" = "11:FALSE"
            "IsolateTo" = "8:"
            }
            "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_40DFF08BA903482D807E715A041CA8B1"
            {
            "AssemblyRegister" = "3:1"
            "AssemblyIsInGAC" = "11:FALSE"
            "AssemblyAsmDisplayName" = "8:install, Version=1.0.0.36491, Culture=neutral, processorArchitecture=x86"
                "ScatterAssemblies"
                {
                    "_40DFF08BA903482D807E715A041CA8B1"
                    {
                    "Name" = "8:install.exe"
                    "Attributes" = "3:512"
                    }
................................................................................
            "IsDependency" = "11:FALSE"
            "IsolateTo" = "8:"
            }
            "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_40F352185F3B41A485F42BFC64BF9162"
            {
            "AssemblyRegister" = "3:1"
            "AssemblyIsInGAC" = "11:FALSE"
            "AssemblyAsmDisplayName" = "8:testce, Version=1.0.0.36383, Culture=neutral, processorArchitecture=MSIL"
                "ScatterAssemblies"
                {
                    "_40F352185F3B41A485F42BFC64BF9162"
                    {
                    "Name" = "8:testce.exe"
                    "Attributes" = "3:512"
                    }
................................................................................
            "IsDependency" = "11:FALSE"
            "IsolateTo" = "8:"
            }
            "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_A18DBDB7776215EAD9A52C96F8CA1E91"
            {
            "AssemblyRegister" = "3:1"
            "AssemblyIsInGAC" = "11:FALSE"
            "AssemblyAsmDisplayName" = "8:System.Data.SQLite, Version=1.0.46.0, Culture=neutral, PublicKeyToken=1fdb50b1b62b4c84, processorArchitecture=x86"
                "ScatterAssemblies"
                {
                    "_A18DBDB7776215EAD9A52C96F8CA1E91"
                    {
                    "Name" = "8:System.Data.SQLite.DLL"
                    "Attributes" = "3:512"
                    }
................................................................................
            "IsDependency" = "11:TRUE"
            "IsolateTo" = "8:"
            }
            "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_F320FBAE871DA320178BEEA242900CC7"
            {
            "AssemblyRegister" = "3:1"
            "AssemblyIsInGAC" = "11:FALSE"
            "AssemblyAsmDisplayName" = "8:System.Data.SQLite, Version=1.0.46.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=x86"
                "ScatterAssemblies"
                {
                    "_F320FBAE871DA320178BEEA242900CC7"
                    {
                    "Name" = "8:System.Data.SQLite.DLL"
                    "Attributes" = "3:512"
                    }
................................................................................
        {
        "LangId" = "3:1033"
        }
        "Product"
        {
        "Name" = "8:Microsoft Visual Studio"
        "ProductName" = "8:SQLite ADO.NET 2.0 Provider"
        "ProductCode" = "8:{94A4B462-C696-4CBC-ADAF-805BA6D5638A}"
        "PackageCode" = "8:{9FF262B9-1455-4B97-B219-A0052B20CD0F}"
        "UpgradeCode" = "8:{78329A82-AFB1-453B-AF00-D46AC911DA89}"
        "RestartWWWService" = "11:FALSE"
        "RemovePreviousVersions" = "11:TRUE"
        "DetectNewerInstalledVersion" = "11:TRUE"
        "InstallAllUsers" = "11:TRUE"
        "ProductVersion" = "8:1.046.0"
        "Manufacturer" = "8:Phoenix Software Solutions, LLC"
        "ARPHELPTELEPHONE" = "8:"
        "ARPHELPLINK" = "8:http://sqlite.phxsoftware.com"
        "Title" = "8:SQLite ADO.NET 2.0 Provider"
        "Subject" = "8:"
        "ARPCONTACT" = "8:Phoenix Software Solutions, LLC"
        "Keywords" = "8:"