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

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

Overview
Comment:NULL values should be mapped to type 'object', not 'DBNull'. Fix for ticket [48a6b8e4ca]. Also see ticket [49e30d7612].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: dcc277f29ad03b425d1b3881eba5e4069088c4ab
User & Date: mistachkin 2013-04-29 23:00:38
References
2013-04-29
23:03 Closed ticket [49e30d7612]: Error with NULL columns plus 4 other changes artifact: fde65442f2 user: mistachkin
23:02 Fixed ticket [48a6b8e4ca]: Reading PRAGMA table_info using SQLiteDataAdapter fails plus 4 other changes artifact: de4c7e3ab6 user: mistachkin
Context
2013-04-30
00:29
Update release version to 1.0.86.0. check-in: 545d22c1ff user: mistachkin tags: trunk
2013-04-29
23:00
NULL values should be mapped to type 'object', not 'DBNull'. Fix for ticket [48a6b8e4ca]. Also see ticket [49e30d7612]. check-in: dcc277f29a user: mistachkin tags: trunk
22:58
Remove superfluous using statements from C# tests. check-in: 959547ff1f user: mistachkin tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

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

   577    577   
   578    578       private static Type[] _affinitytotype = {
   579    579         typeof(object),   // Uninitialized (0)
   580    580         typeof(Int64),    // Int64 (1)
   581    581         typeof(Double),   // Double (2)
   582    582         typeof(string),   // Text (3)
   583    583         typeof(byte[]),   // Blob (4)
   584         -      typeof(DBNull),   // Null (5)
          584  +      typeof(object),   // Null (5)
   585    585         typeof(DateTime), // DateTime (10)
   586    586         typeof(object)    // None (11)
   587    587       };
   588    588   
   589    589       /// <summary>
   590    590       /// For a given intrinsic type, return a DbType
   591    591       /// </summary>

Added Tests/tkt-48a6b8e4ca.eagle.

            1  +###############################################################################
            2  +#
            3  +# tkt-48a6b8e4ca.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-48a6b8e4ca-1.1 {SQLiteTypeToType with NULL values} -setup {
           24  +  setupDb [set fileName tkt-48a6b8e4ca-1.1.db]
           25  +} -body {
           26  +  set id [object invoke Interpreter.GetActive NextId]
           27  +  set dataSource [file join [getDatabaseDirectory] $fileName]
           28  +
           29  +  sql execute $db {
           30  +    CREATE TABLE t1(x);
           31  +  }
           32  +
           33  +  set sql { \
           34  +    PRAGMA table_info(t1); \
           35  +  }
           36  +
           37  +  unset -nocomplain results errors
           38  +
           39  +  set code [compileCSharpWith [subst {
           40  +    using System.Data;
           41  +    using System.Data.SQLite;
           42  +
           43  +    namespace _Dynamic${id}
           44  +    {
           45  +      public static class Test${id}
           46  +      {
           47  +        public static void Main()
           48  +        {
           49  +          using (SQLiteConnection connection = new SQLiteConnection(
           50  +              "Data Source=${dataSource};"))
           51  +          {
           52  +            connection.Open();
           53  +
           54  +            using (SQLiteCommand command = new SQLiteCommand("${sql}",
           55  +                connection))
           56  +            {
           57  +              using (SQLiteDataAdapter dataAdapter = new SQLiteDataAdapter(
           58  +                  command))
           59  +              {
           60  +                using (DataSet dataSet = new DataSet())
           61  +                {
           62  +                  dataAdapter.Fill(dataSet);
           63  +                }
           64  +              }
           65  +            }
           66  +          }
           67  +        }
           68  +      }
           69  +    }
           70  +  }] true true true results errors System.Data.SQLite.dll]
           71  +
           72  +  list $code $results \
           73  +      [expr {[info exists errors] ? $errors : ""}] \
           74  +      [expr {$code eq "Ok" ? [catch {
           75  +        object invoke _Dynamic${id}.Test${id} Main
           76  +      } result] : [set result ""]}] $result
           77  +} -cleanup {
           78  +  cleanupDb $fileName
           79  +
           80  +  unset -nocomplain result code results errors sql dataSource id db fileName
           81  +} -constraints \
           82  +{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -match \
           83  +regexp -result {^Ok System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\}$}}
           84  +
           85  +###############################################################################
           86  +
           87  +runSQLiteTestEpilogue
           88  +runTestEpilogue