System.Data.SQLite
Check-in [686803b92e]
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 | tkt-5cee5409f8
Files: files | file ages | folders
SHA1: 686803b92e5aa15eb76fe87b37934c2d96220b37
User & Date: mistachkin 2018-01-25 18:56:59
Context
2018-01-25
19:21
Work in progress on ticket [5cee5409f8]: use the enlistment lock to protect against several race conditions between SQLiteEnlistment and SQLiteConnection. check-in: 0dc736558b user: mistachkin tags: tkt-5cee5409f8
18:56
Merge updates from trunk. check-in: 686803b92e user: mistachkin tags: tkt-5cee5409f8
18:53
In the enlistment cleanup, validate the 'cnn' parameter prior to attempting to use it. check-in: 6ec25f2c57 user: mistachkin tags: tkt-5cee5409f8
2018-01-24
19:53
Additions and corrections to the DbType mapping related lookup tables. Pursuant to ticket [a799e3978f]. check-in: 939cc5db59 user: mistachkin tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

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

    46     46       <p><b>1.0.107.0 - January XX, 2018 <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_22_0.html">SQLite 3.22.0</a>.</li>
    49     49         <li>Improve performance of type name lookups by removing superfluous locking and string creation.</li>
    50     50         <li>Fix some internal memory accounting present only in the debug build.</li>
    51     51         <li>Make sure inbound native delegates are unhooked before adding a connection to the pool. Fix for <a href="https://system.data.sqlite.org/index.html/info/0e48e80333">[0e48e80333]</a>.</li>
    52     52         <li>Add preliminary support for the .NET Framework 4.7.1.</li>
           53  +      <li>Updates to internal DbType mapping related lookup tables. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/a799e3978f">[a799e3978f]</a>.</li>
    53     54       </ul>
    54     55       <p><b>1.0.106.0 - November 2, 2017</b></p>
    55     56       <ul>
    56     57         <li>Updated to <a href="https://www.sqlite.org/releaselog/3_21_0.html">SQLite 3.21.0</a>.</li>
    57     58         <li>Add full support for the native <a href="https://www.sqlite.org/sessionintro.html">session</a> extension.</li>
    58     59         <li>Add BindDecimalAsText and GetDecimalAsText connection flags to force binding and returning of decimal values as text. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/b167206ad3">[b167206ad3]</a>.</li>
    59     60         <li>Add BindInvariantDecimal and GetInvariantDecimal connection flags, enabled by default, to force binding and returning of decimal values using the invariant culture. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/b167206ad3">[b167206ad3]</a>.&nbsp;<b>** Potentially Incompatible Change **</b></li>

Changes to Setup/data/verify.lst.

   884    884     Tests/tkt-92dbf1229a.eagle
   885    885     Tests/tkt-94252b9059.eagle
   886    886     Tests/tkt-964063da16.eagle
   887    887     Tests/tkt-996d13cd87.eagle
   888    888     Tests/tkt-9ba9346f75.eagle
   889    889     Tests/tkt-9d353b0bd8.eagle
   890    890     Tests/tkt-a4d9c7ee94.eagle
          891  +  Tests/tkt-a799e3978f.eagle
   891    892     Tests/tkt-a7d04fb111.eagle
   892    893     Tests/tkt-aba4549801.eagle
   893    894     Tests/tkt-ac47dd230a.eagle
   894    895     Tests/tkt-ae5267b863.eagle
   895    896     Tests/tkt-b167206ad3.eagle
   896    897     Tests/tkt-b4a7ddc83f.eagle
   897    898     Tests/tkt-bb4b04d457.eagle

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

  1247   1247       private static Type[] _affinitytotype = {
  1248   1248         typeof(object),   // Uninitialized (0)
  1249   1249         typeof(Int64),    // Int64 (1)
  1250   1250         typeof(Double),   // Double (2)
  1251   1251         typeof(string),   // Text (3)
  1252   1252         typeof(byte[]),   // Blob (4)
  1253   1253         typeof(object),   // Null (5)
         1254  +      null,             // Undefined (6)
         1255  +      null,             // Undefined (7)
         1256  +      null,             // Undefined (8)
         1257  +      null,             // Undefined (9)
  1254   1258         typeof(DateTime), // DateTime (10)
  1255   1259         typeof(object)    // None (11)
  1256   1260       };
  1257   1261   
  1258   1262       /// <summary>
  1259   1263       /// For a given intrinsic type, return a DbType
  1260   1264       /// </summary>
................................................................................
  1326   1330         2,            // UInt16 (18)
  1327   1331         4,            // UInt32 (19)
  1328   1332         8,            // UInt64 (20)
  1329   1333         8,            // VarNumeric (21)
  1330   1334         int.MaxValue, // AnsiStringFixedLength (22)
  1331   1335         int.MaxValue, // StringFixedLength (23)
  1332   1336         int.MaxValue, // ?? (24)
  1333         -      int.MaxValue  // Xml (25)
         1337  +      int.MaxValue, // Xml (25)
         1338  +      8,            // DateTime2 (26)
         1339  +      10            // DateTimeOffset (27)
  1334   1340       };
  1335   1341   
  1336   1342       internal static object DbTypeToNumericPrecision(DbType typ)
  1337   1343       {
  1338   1344         return _dbtypetonumericprecision[(int)typ];
  1339   1345       }
  1340   1346   
................................................................................
  1360   1366         5,            // UInt16 (18)
  1361   1367         10,           // UInt32 (19)
  1362   1368         19,           // UInt64 (20)
  1363   1369         53,           // VarNumeric (21)
  1364   1370         DBNull.Value, // AnsiStringFixedLength (22)
  1365   1371         DBNull.Value, // StringFixedLength (23)
  1366   1372         DBNull.Value, // ?? (24)
  1367         -      DBNull.Value  // Xml (25)
         1373  +      DBNull.Value, // Xml (25)
         1374  +      DBNull.Value, // DateTime2 (26)
         1375  +      DBNull.Value  // DateTimeOffset (27)
  1368   1376       };
  1369   1377   
  1370   1378       internal static object DbTypeToNumericScale(DbType typ)
  1371   1379       {
  1372   1380         return _dbtypetonumericscale[(int)typ];
  1373   1381       }
  1374   1382   
................................................................................
  1394   1402         0,            // UInt16 (18)
  1395   1403         0,            // UInt32 (19)
  1396   1404         0,            // UInt64 (20)
  1397   1405         0,            // VarNumeric (21)
  1398   1406         DBNull.Value, // AnsiStringFixedLength (22)
  1399   1407         DBNull.Value, // StringFixedLength (23)
  1400   1408         DBNull.Value, // ?? (24)
  1401         -      DBNull.Value  // Xml (25)
         1409  +      DBNull.Value, // Xml (25)
         1410  +      DBNull.Value, // DateTime2 (26)
         1411  +      DBNull.Value  // DateTimeOffset (27)
  1402   1412       };
  1403   1413   
  1404   1414       /// <summary>
  1405   1415       /// Determines the default database type name to be used when a
  1406   1416       /// per-connection value is not available.
  1407   1417       /// </summary>
  1408   1418       /// <param name="connection">
................................................................................
  1588   1598       /// <returns>The closest-match .NET type</returns>
  1589   1599       internal static Type DbTypeToType(DbType typ)
  1590   1600       {
  1591   1601         return _dbtypeToType[(int)typ];
  1592   1602       }
  1593   1603   
  1594   1604       private static Type[] _dbtypeToType = {
  1595         -      typeof(string),   // AnsiString (0)
  1596         -      typeof(byte[]),   // Binary (1)
  1597         -      typeof(byte),     // Byte (2)
  1598         -      typeof(bool),     // Boolean (3)
  1599         -      typeof(decimal),  // Currency (4)
  1600         -      typeof(DateTime), // Date (5)
  1601         -      typeof(DateTime), // DateTime (6)
  1602         -      typeof(decimal),  // Decimal (7)
  1603         -      typeof(double),   // Double (8)
  1604         -      typeof(Guid),     // Guid (9)
  1605         -      typeof(Int16),    // Int16 (10)
  1606         -      typeof(Int32),    // Int32 (11)
  1607         -      typeof(Int64),    // Int64 (12)
  1608         -      typeof(object),   // Object (13)
  1609         -      typeof(sbyte),    // SByte (14)
  1610         -      typeof(float),    // Single (15)
  1611         -      typeof(string),   // String (16)
  1612         -      typeof(DateTime), // Time (17)
  1613         -      typeof(UInt16),   // UInt16 (18)
  1614         -      typeof(UInt32),   // UInt32 (19)
  1615         -      typeof(UInt64),   // UInt64 (20)
  1616         -      typeof(double),   // VarNumeric (21)
  1617         -      typeof(string),   // AnsiStringFixedLength (22)
  1618         -      typeof(string),   // StringFixedLength (23)
  1619         -      typeof(string),   // ?? (24)
  1620         -      typeof(string),   // Xml (25)
         1605  +      typeof(string),        // AnsiString (0)
         1606  +      typeof(byte[]),        // Binary (1)
         1607  +      typeof(byte),          // Byte (2)
         1608  +      typeof(bool),          // Boolean (3)
         1609  +      typeof(decimal),       // Currency (4)
         1610  +      typeof(DateTime),      // Date (5)
         1611  +      typeof(DateTime),      // DateTime (6)
         1612  +      typeof(decimal),       // Decimal (7)
         1613  +      typeof(double),        // Double (8)
         1614  +      typeof(Guid),          // Guid (9)
         1615  +      typeof(Int16),         // Int16 (10)
         1616  +      typeof(Int32),         // Int32 (11)
         1617  +      typeof(Int64),         // Int64 (12)
         1618  +      typeof(object),        // Object (13)
         1619  +      typeof(sbyte),         // SByte (14)
         1620  +      typeof(float),         // Single (15)
         1621  +      typeof(string),        // String (16)
         1622  +      typeof(DateTime),      // Time (17)
         1623  +      typeof(UInt16),        // UInt16 (18)
         1624  +      typeof(UInt32),        // UInt32 (19)
         1625  +      typeof(UInt64),        // UInt64 (20)
         1626  +      typeof(double),        // VarNumeric (21)
         1627  +      typeof(string),        // AnsiStringFixedLength (22)
         1628  +      typeof(string),        // StringFixedLength (23)
         1629  +      typeof(string),        // ?? (24)
         1630  +      typeof(string),        // Xml (25)
         1631  +      typeof(DateTime),      // DateTime2 (26)
         1632  +#if NET_35 || NET_40 || NET_45 || NET_451 || NET_452 || NET_46 || NET_461 || NET_462 || NET_47 || NET_471
         1633  +      //
         1634  +      // NOTE: This type is only available on the
         1635  +      //       .NET Framework 2.0 SP1 and later.
         1636  +      //
         1637  +      typeof(DateTimeOffset) // DateTimeOffset (27)
         1638  +#else
         1639  +      typeof(DateTime)       // DateTimeOffset (27)
         1640  +#endif
  1621   1641       };
  1622   1642   
  1623   1643       /// <summary>
  1624   1644       /// For a given type, return the closest-match SQLite TypeAffinity, which only understands a very limited subset of types.
  1625   1645       /// </summary>
  1626   1646       /// <param name="typ">The type to evaluate</param>
  1627   1647       /// <param name="flags">The flags associated with the connection.</param>

Added Tests/tkt-a799e3978f.eagle.

            1  +###############################################################################
            2  +#
            3  +# tkt-a799e3978f.eagle --
            4  +#
            5  +# Written by Joe Mistachkin.
            6  +# Released to the public domain, use at your own risk!
            7  +#
            8  +###############################################################################
            9  +
           10  +package require Eagle
           11  +package require Eagle.Library
           12  +package require Eagle.Test
           13  +
           14  +runTestPrologue
           15  +
           16  +###############################################################################
           17  +
           18  +package require System.Data.SQLite.Test
           19  +runSQLiteTestPrologue
           20  +
           21  +###############################################################################
           22  +
           23  +runTest {test tkt-a799e3978f-1.1 {DateTime2 type mapping} -setup {
           24  +  setupDb [set fileName tkt-a799e3978f-1.1.db] "" "" "" UseConnectionTypes
           25  +} -body {
           26  +  set connection [getDbConnection]
           27  +  set result [list]
           28  +
           29  +  lappend result [sql execute $db \
           30  +      "CREATE TABLE t1(x INTEGER PRIMARY KEY, y DATETIME2);"]
           31  +
           32  +  set dateTime [clock format [clock scan "2014-02-01 12:34:56Z"] \
           33  +      -format yyyyMMddHHmmss -gmt true]
           34  +
           35  +  lappend result [sql execute $db [appendArgs \
           36  +      "INSERT INTO t1 (y) VALUES('" $dateTime "');"]]
           37  +
           38  +  lappend result [sql execute -verbatim -execute reader -format list \
           39  +      -datetimeformat [getDateTimeFormat] $db "SELECT x, y FROM t1;"]
           40  +
           41  +  lappend result [$connection ClearTypeMappings]; # 0
           42  +  lappend result [$connection AddTypeMapping DATETIME2 DateTime false]; # 0
           43  +
           44  +  lappend result [sql execute -verbatim -execute reader -format list \
           45  +      -datetimeformat [getDateTimeFormat] $db "SELECT x, y FROM t1;"]
           46  +
           47  +  set result
           48  +} -cleanup {
           49  +  freeDbConnection
           50  +
           51  +  unset -nocomplain result connection
           52  +
           53  +  cleanupDb $fileName
           54  +
           55  +  unset -nocomplain dateTime db fileName
           56  +} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
           57  +System.Data.SQLite} -result \
           58  +{0 1 {1 20140201123456} 0 0 {1 {2014-02-01 12:34:56}}}}
           59  +
           60  +###############################################################################
           61  +
           62  +runSQLiteTestEpilogue
           63  +runTestEpilogue

Changes to readme.htm.

   212    212   </p>
   213    213   <ul>
   214    214       <li>Updated to <a href="https://www.sqlite.org/draft/releaselog/3_22_0.html">SQLite 3.22.0</a>.</li>
   215    215       <li>Improve performance of type name lookups by removing superfluous locking and string creation.</li>
   216    216       <li>Fix some internal memory accounting present only in the debug build.</li>
   217    217       <li>Make sure inbound native delegates are unhooked before adding a connection to the pool. Fix for [0e48e80333].</li>
   218    218       <li>Add preliminary support for the .NET Framework 4.7.1.</li>
          219  +    <li>Updates to internal DbType mapping related lookup tables. Pursuant to [a799e3978f].</li>
   219    220   </ul>
   220    221   <p>
   221    222       <b>1.0.106.0 - November 2, 2017</b>
   222    223   </p>
   223    224   <ul>
   224    225       <li>Updated to <a href="https://www.sqlite.org/releaselog/3_21_0.html">SQLite 3.21.0</a>.</li>
   225    226       <li>Add full support for the native <a href="https://www.sqlite.org/sessionintro.html">session</a> extension.</li>

Changes to www/news.wiki.

    49     49   </p>
    50     50   <ul>
    51     51       <li>Updated to [https://www.sqlite.org/draft/releaselog/3_22_0.html|SQLite 3.22.0].</li>
    52     52       <li>Improve performance of type name lookups by removing superfluous locking and string creation.</li>
    53     53       <li>Fix some internal memory accounting present only in the debug build.</li>
    54     54       <li>Make sure inbound native delegates are unhooked before adding a connection to the pool. Fix for [0e48e80333].</li>
    55     55       <li>Add preliminary support for the .NET Framework 4.7.1.</li>
           56  +    <li>Updates to internal DbType mapping related lookup tables. Pursuant to [a799e3978f].</li>
    56     57   </ul>
    57     58   <p>
    58     59       <b>1.0.106.0 - November 2, 2017</b>
    59     60   </p>
    60     61   <ul>
    61     62       <li>Updated to [https://www.sqlite.org/releaselog/3_21_0.html|SQLite 3.21.0].</li>
    62     63       <li>Add full support for the native [https://www.sqlite.org/sessionintro.html|session] extension.</li>