System.Data.SQLite

Login
This project makes use of Eagle, provided by Mistachkin Systems.
Eagle: Secure Software Automation

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

Changes In Branch tkt-a799e3978f Excluding Merge-Ins

This is equivalent to a diff from f722d13e2d to d583659651

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
19:07
Additions and corrections to the DbType mapping related lookup tables. Pursuant to ticket [a799e3978f]. Closed-Leaf check-in: d583659651 user: mistachkin tags: tkt-a799e3978f
18:11
Synchronize access to the '_enlistment' field of SQLiteConnection objects. Even thought the SQLiteConnection class is not designed to be thread-safe, this field must be protected from multi-threaded access due to how (asynchronous) transaction scope completion is implemented by the .NET Framework. Candidate fix for ticket [5cee5409f8]. check-in: 8f44046b6f user: mistachkin tags: tkt-5cee5409f8
2018-01-23
00:44
Update the Eagle shell configuration file. check-in: f722d13e2d user: mistachkin tags: trunk
2018-01-22
22:28
Minor revisions to the test for ticket [0e48e80333]. check-in: 5017305c0d user: mistachkin tags: trunk

Changes to Setup/data/verify.lst.

884
885
886
887
888
889
890

891
892
893
894
895
896
897
  Tests/tkt-92dbf1229a.eagle
  Tests/tkt-94252b9059.eagle
  Tests/tkt-964063da16.eagle
  Tests/tkt-996d13cd87.eagle
  Tests/tkt-9ba9346f75.eagle
  Tests/tkt-9d353b0bd8.eagle
  Tests/tkt-a4d9c7ee94.eagle

  Tests/tkt-a7d04fb111.eagle
  Tests/tkt-aba4549801.eagle
  Tests/tkt-ac47dd230a.eagle
  Tests/tkt-ae5267b863.eagle
  Tests/tkt-b167206ad3.eagle
  Tests/tkt-b4a7ddc83f.eagle
  Tests/tkt-bb4b04d457.eagle







>







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

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

1247
1248
1249
1250
1251
1252
1253




1254
1255
1256
1257
1258
1259
1260
    private static Type[] _affinitytotype = {
      typeof(object),   // Uninitialized (0)
      typeof(Int64),    // Int64 (1)
      typeof(Double),   // Double (2)
      typeof(string),   // Text (3)
      typeof(byte[]),   // Blob (4)
      typeof(object),   // Null (5)




      typeof(DateTime), // DateTime (10)
      typeof(object)    // None (11)
    };

    /// <summary>
    /// For a given intrinsic type, return a DbType
    /// </summary>







>
>
>
>







1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
    private static Type[] _affinitytotype = {
      typeof(object),   // Uninitialized (0)
      typeof(Int64),    // Int64 (1)
      typeof(Double),   // Double (2)
      typeof(string),   // Text (3)
      typeof(byte[]),   // Blob (4)
      typeof(object),   // Null (5)
      null,             // Undefined (6)
      null,             // Undefined (7)
      null,             // Undefined (8)
      null,             // Undefined (9)
      typeof(DateTime), // DateTime (10)
      typeof(object)    // None (11)
    };

    /// <summary>
    /// For a given intrinsic type, return a DbType
    /// </summary>
1326
1327
1328
1329
1330
1331
1332
1333


1334
1335
1336
1337
1338
1339
1340
      2,            // UInt16 (18)
      4,            // UInt32 (19)
      8,            // UInt64 (20)
      8,            // VarNumeric (21)
      int.MaxValue, // AnsiStringFixedLength (22)
      int.MaxValue, // StringFixedLength (23)
      int.MaxValue, // ?? (24)
      int.MaxValue  // Xml (25)


    };

    internal static object DbTypeToNumericPrecision(DbType typ)
    {
      return _dbtypetonumericprecision[(int)typ];
    }








|
>
>







1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
      2,            // UInt16 (18)
      4,            // UInt32 (19)
      8,            // UInt64 (20)
      8,            // VarNumeric (21)
      int.MaxValue, // AnsiStringFixedLength (22)
      int.MaxValue, // StringFixedLength (23)
      int.MaxValue, // ?? (24)
      int.MaxValue, // Xml (25)
      8,            // DateTime2 (26)
      10            // DateTimeOffset (27)
    };

    internal static object DbTypeToNumericPrecision(DbType typ)
    {
      return _dbtypetonumericprecision[(int)typ];
    }

1360
1361
1362
1363
1364
1365
1366


1367
1368
1369
1370
1371
1372
1373
1374
      5,            // UInt16 (18)
      10,           // UInt32 (19)
      19,           // UInt64 (20)
      53,           // VarNumeric (21)
      DBNull.Value, // AnsiStringFixedLength (22)
      DBNull.Value, // StringFixedLength (23)
      DBNull.Value, // ?? (24)


      DBNull.Value  // Xml (25)
    };

    internal static object DbTypeToNumericScale(DbType typ)
    {
      return _dbtypetonumericscale[(int)typ];
    }








>
>
|







1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
      5,            // UInt16 (18)
      10,           // UInt32 (19)
      19,           // UInt64 (20)
      53,           // VarNumeric (21)
      DBNull.Value, // AnsiStringFixedLength (22)
      DBNull.Value, // StringFixedLength (23)
      DBNull.Value, // ?? (24)
      DBNull.Value, // Xml (25)
      DBNull.Value, // DateTime2 (26)
      DBNull.Value  // DateTimeOffset (27)
    };

    internal static object DbTypeToNumericScale(DbType typ)
    {
      return _dbtypetonumericscale[(int)typ];
    }

1394
1395
1396
1397
1398
1399
1400


1401
1402
1403
1404
1405
1406
1407
1408
      0,            // UInt16 (18)
      0,            // UInt32 (19)
      0,            // UInt64 (20)
      0,            // VarNumeric (21)
      DBNull.Value, // AnsiStringFixedLength (22)
      DBNull.Value, // StringFixedLength (23)
      DBNull.Value, // ?? (24)


      DBNull.Value  // Xml (25)
    };

    /// <summary>
    /// Determines the default database type name to be used when a
    /// per-connection value is not available.
    /// </summary>
    /// <param name="connection">







>
>
|







1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
      0,            // UInt16 (18)
      0,            // UInt32 (19)
      0,            // UInt64 (20)
      0,            // VarNumeric (21)
      DBNull.Value, // AnsiStringFixedLength (22)
      DBNull.Value, // StringFixedLength (23)
      DBNull.Value, // ?? (24)
      DBNull.Value, // Xml (25)
      DBNull.Value, // DateTime2 (26)
      DBNull.Value  // DateTimeOffset (27)
    };

    /// <summary>
    /// Determines the default database type name to be used when a
    /// per-connection value is not available.
    /// </summary>
    /// <param name="connection">
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620










1621
1622
1623
1624
1625
1626
1627
    /// <returns>The closest-match .NET type</returns>
    internal static Type DbTypeToType(DbType typ)
    {
      return _dbtypeToType[(int)typ];
    }

    private static Type[] _dbtypeToType = {
      typeof(string),   // AnsiString (0)
      typeof(byte[]),   // Binary (1)
      typeof(byte),     // Byte (2)
      typeof(bool),     // Boolean (3)
      typeof(decimal),  // Currency (4)
      typeof(DateTime), // Date (5)
      typeof(DateTime), // DateTime (6)
      typeof(decimal),  // Decimal (7)
      typeof(double),   // Double (8)
      typeof(Guid),     // Guid (9)
      typeof(Int16),    // Int16 (10)
      typeof(Int32),    // Int32 (11)
      typeof(Int64),    // Int64 (12)
      typeof(object),   // Object (13)
      typeof(sbyte),    // SByte (14)
      typeof(float),    // Single (15)
      typeof(string),   // String (16)
      typeof(DateTime), // Time (17)
      typeof(UInt16),   // UInt16 (18)
      typeof(UInt32),   // UInt32 (19)
      typeof(UInt64),   // UInt64 (20)
      typeof(double),   // VarNumeric (21)
      typeof(string),   // AnsiStringFixedLength (22)
      typeof(string),   // StringFixedLength (23)
      typeof(string),   // ?? (24)
      typeof(string),   // Xml (25)










    };

    /// <summary>
    /// For a given type, return the closest-match SQLite TypeAffinity, which only understands a very limited subset of types.
    /// </summary>
    /// <param name="typ">The type to evaluate</param>
    /// <param name="flags">The flags associated with the connection.</param>







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







1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
    /// <returns>The closest-match .NET type</returns>
    internal static Type DbTypeToType(DbType typ)
    {
      return _dbtypeToType[(int)typ];
    }

    private static Type[] _dbtypeToType = {
      typeof(string),        // AnsiString (0)
      typeof(byte[]),        // Binary (1)
      typeof(byte),          // Byte (2)
      typeof(bool),          // Boolean (3)
      typeof(decimal),       // Currency (4)
      typeof(DateTime),      // Date (5)
      typeof(DateTime),      // DateTime (6)
      typeof(decimal),       // Decimal (7)
      typeof(double),        // Double (8)
      typeof(Guid),          // Guid (9)
      typeof(Int16),         // Int16 (10)
      typeof(Int32),         // Int32 (11)
      typeof(Int64),         // Int64 (12)
      typeof(object),        // Object (13)
      typeof(sbyte),         // SByte (14)
      typeof(float),         // Single (15)
      typeof(string),        // String (16)
      typeof(DateTime),      // Time (17)
      typeof(UInt16),        // UInt16 (18)
      typeof(UInt32),        // UInt32 (19)
      typeof(UInt64),        // UInt64 (20)
      typeof(double),        // VarNumeric (21)
      typeof(string),        // AnsiStringFixedLength (22)
      typeof(string),        // StringFixedLength (23)
      typeof(string),        // ?? (24)
      typeof(string),        // Xml (25)
      typeof(DateTime),      // DateTime2 (26)
#if NET_35 || NET_40 || NET_45 || NET_451 || NET_452 || NET_46 || NET_461 || NET_462 || NET_47 || NET_471
      //
      // NOTE: This type is only available on the
      //       .NET Framework 2.0 SP1 and later.
      //
      typeof(DateTimeOffset) // DateTimeOffset (27)
#else
      typeof(DateTime)       // DateTimeOffset (27)
#endif
    };

    /// <summary>
    /// For a given type, return the closest-match SQLite TypeAffinity, which only understands a very limited subset of types.
    /// </summary>
    /// <param name="typ">The type to evaluate</param>
    /// <param name="flags">The flags associated with the connection.</param>

Added Tests/tkt-a799e3978f.eagle.































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
###############################################################################
#
# tkt-a799e3978f.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

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

package require System.Data.SQLite.Test
runSQLiteTestPrologue

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

runTest {test tkt-a799e3978f-1.1 {DateTime2 type mapping} -setup {
  setupDb [set fileName tkt-a799e3978f-1.1.db] "" "" "" UseConnectionTypes
} -body {
  set connection [getDbConnection]
  set result [list]

  lappend result [sql execute $db \
      "CREATE TABLE t1(x INTEGER PRIMARY KEY, y DATETIME2);"]

  set dateTime [clock format [clock scan "2014-02-01 12:34:56Z"] \
      -format yyyyMMddHHmmss -gmt true]

  lappend result [sql execute $db [appendArgs \
      "INSERT INTO t1 (y) VALUES('" $dateTime "');"]]

  lappend result [sql execute -verbatim -execute reader -format list \
      -datetimeformat [getDateTimeFormat] $db "SELECT x, y FROM t1;"]

  lappend result [$connection ClearTypeMappings]; # 0
  lappend result [$connection AddTypeMapping DATETIME2 DateTime false]; # 0

  lappend result [sql execute -verbatim -execute reader -format list \
      -datetimeformat [getDateTimeFormat] $db "SELECT x, y FROM t1;"]

  set result
} -cleanup {
  freeDbConnection

  unset -nocomplain result connection

  cleanupDb $fileName

  unset -nocomplain dateTime db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result \
{0 1 {1 20140201123456} 0 0 {1 {2014-02-01 12:34:56}}}}

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

runSQLiteTestEpilogue
runTestEpilogue