System.Data.SQLite

Check-in [1fdf3de322]
Login

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

Overview
Comment:Add test and candidate fix for [47c6fa04d3].
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | tkt-47c6fa04d3
Files: files | file ages | folders
SHA1: 1fdf3de3225c54b4b9b7deadd8563172dbe4d3c3
User & Date: mistachkin 2014-12-03 21:14:15.245
Context
2014-12-03
21:41
Set the name for the new test. check-in: 50f7902c6f user: mistachkin tags: tkt-47c6fa04d3
21:14
Add test and candidate fix for [47c6fa04d3]. check-in: 1fdf3de322 user: mistachkin tags: tkt-47c6fa04d3
2014-11-28
08:38
Fix typo on the release process web page. Fix for [89774dc93e]. check-in: 0d23e2583b user: mistachkin tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to System.Data.SQLite/SQLiteDataReader.cs.
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
            (string)row[SchemaTableOptionalColumn.BaseCatalogName],
            (string)row[SchemaTableColumn.BaseTableName],
            strColumn,
            ref dataType, ref collSeq, ref bNotNull, ref bPrimaryKey, ref bAutoIncrement);

          if (bNotNull || bPrimaryKey) row[SchemaTableColumn.AllowDBNull] = false;

          row[SchemaTableColumn.IsKey] = bPrimaryKey;
          row[SchemaTableOptionalColumn.IsAutoIncrement] = bAutoIncrement;
          row["CollationType"] = collSeq;

          // For types like varchar(50) and such, extract the size
          arSize = dataType.Split('(');
          if (arSize.Length > 1)
          {







|







1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
            (string)row[SchemaTableOptionalColumn.BaseCatalogName],
            (string)row[SchemaTableColumn.BaseTableName],
            strColumn,
            ref dataType, ref collSeq, ref bNotNull, ref bPrimaryKey, ref bAutoIncrement);

          if (bNotNull || bPrimaryKey) row[SchemaTableColumn.AllowDBNull] = false;

          row[SchemaTableColumn.IsKey] = bPrimaryKey && parentToColumns.Count <= 1;
          row[SchemaTableOptionalColumn.IsAutoIncrement] = bAutoIncrement;
          row["CollationType"] = collSeq;

          // For types like varchar(50) and such, extract the size
          arSize = dataType.Split('(');
          if (arSize.Length > 1)
          {
Added Tests/tkt-47c6fa04d3.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
###############################################################################
#
# tkt-47c6fa04d3.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-47c6fa04d3-1.1 {} -setup {
  setupDb [set fileName tkt-47c6fa04d3-1.1.db]
} -body {
  sql execute $db {
    CREATE TABLE t1(
      t1x INTEGER PRIMARY KEY NOT NULL,
      t1y TEXT NOT NULL
    );

    INSERT INTO t1 (t1x, t1y) VALUES(1, 'one_t1');
    INSERT INTO t1 (t1x, t1y) VALUES(2, 'two_t1');
    INSERT INTO t1 (t1x, t1y) VALUES(3, 'three_t1');

    CREATE TABLE t2(
      t2x INTEGER PRIMARY KEY NOT NULL,
      t2t1x INTEGER NOT NULL,
      t2y TEXT,
      t2z INTEGER NOT NULL DEFAULT(0)
    );

    INSERT INTO t2 (t2x, t2t1x, t2y, t2z) VALUES(1, 2, 'one_t2', 1);
    INSERT INTO t2 (t2x, t2t1x, t2y, t2z) VALUES(2, 2, 'two_t2', 2);
    INSERT INTO t2 (t2x, t2t1x, t2y, t2z) VALUES(3, 2, 'three_t2', 3);

    CREATE TABLE t3(
      t3x INTEGER PRIMARY KEY NOT NULL,
      t3y INTEGER NOT NULL,
      t3z INTEGER NOT NULL
    );

    INSERT INTO t3 (t3x, t3y, t3z) VALUES(1, 2, 3);
    INSERT INTO t3 (t3x, t3y, t3z) VALUES(2, 1, 2);
  }

  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  set sql {
    SELECT t1.t1x AS id, t3.t3y AS min, t3.t3z AS max,
           SUM(t2.t2z) AS sum
    FROM t1 t1 INNER JOIN t3 t3 INNER JOIN t2 t2
    ON t2.t2t1x = t1.t1x AND t2.t2z BETWEEN t3.t3y AND t3.t3z
    GROUP BY t1.t1x, t3.t3x, t3.t3y, t3.t3z;
  }

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System.Data;
    using System.Data.SQLite;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        public static DataTable GetDataTable()
        {
          DataTable dataTable;

          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};[getFlagsProperty]"))
          {
            connection.Open();

            using (SQLiteCommand command = new SQLiteCommand(@"${sql}",
                connection))
            {
              using (SQLiteDataReader dataReader = command.ExecuteReader())
              {
                dataTable = new DataTable();
                dataTable.Load(dataReader);

                return dataTable;
              }
            }
          }
        }

        ///////////////////////////////////////////////////////////////////////

        public static void Main()
        {
          // do nothing.
        }
      }
    }
  }] true true true results errors System.Data.SQLite.dll]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catch {
        object invoke -alias _Dynamic${id}.Test${id} GetDataTable
      } result] : [set result ""]}] $result [getRowsFromDataTable $result]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result results errors code sql dataSource id db fileName
} -constraints {eagle monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite compileCSharp} -match regexp -result {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 System#Data#DataTable#\d+\
\{\{\{id 2\} \{min 2\} \{max 3\} \{sum 5\}\} \{\{id 2\} \{min 1\} \{max 2\}\
\{sum 3\}\}\}$}}

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

runSQLiteTestEpilogue
runTestEpilogue