System.Data.SQLite
Check-in [01af053e49]
Not logged in

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

Overview
Comment:Add draft test for ticket [5363fd4af6].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | strictStatement
Files: files | file ages | folders
SHA1: 01af053e49757414f11fbe26b4f65d300e6bfb4b
User & Date: mistachkin 2013-07-04 20:41:33
Context
2013-07-05
18:57
Merge updates from trunk. check-in: adb53faf97 user: mistachkin tags: strictStatement
2013-07-04
20:41
Add draft test for ticket [5363fd4af6]. check-in: 01af053e49 user: mistachkin tags: strictStatement
19:50
Experimental changes to validate that SQLiteStatement parameters are not disposed. check-in: e325dfa45f user: mistachkin tags: strictStatement
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added Tests/tkt-5363fd4af6.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
###############################################################################
#
# tkt-5363fd4af6.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-5363fd4af6-1.1 {data reader access violation} -setup {
  set fileName tkt-5363fd4af6-1.1.db
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  set sql { \
    CREATE TABLE t1(x); \
    INSERT INTO t1 (x) VALUES(1); \
    INSERT INTO t1 (x) VALUES(2); \
    INSERT INTO t1 (x) VALUES(3); \
    SELECT x FROM t1 ORDER BY x; \
  }

  unset -nocomplain results errors

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

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        public static StringList GetList()
        {
          StringList result = new StringList();

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

            SQLiteCommand command = new SQLiteCommand("${sql}", connection);
            SQLiteDataReader dataReader = command.ExecuteReader();
            command.Dispose();

            while (dataReader.Read())
              result.Add(dataReader\["x"\].ToString());
          }

          return result;
        }

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

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

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

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

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

runSQLiteTestEpilogue
runTestEpilogue