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 Side-by-Side Diffs Ignore Whitespace Patch

Added Tests/tkt-5363fd4af6.eagle.

            1  +###############################################################################
            2  +#
            3  +# tkt-5363fd4af6.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-5363fd4af6-1.1 {data reader access violation} -setup {
           24  +  set fileName tkt-5363fd4af6-1.1.db
           25  +} -body {
           26  +  set id [object invoke Interpreter.GetActive NextId]
           27  +  set dataSource [file join [getDatabaseDirectory] $fileName]
           28  +
           29  +  set sql { \
           30  +    CREATE TABLE t1(x); \
           31  +    INSERT INTO t1 (x) VALUES(1); \
           32  +    INSERT INTO t1 (x) VALUES(2); \
           33  +    INSERT INTO t1 (x) VALUES(3); \
           34  +    SELECT x FROM t1 ORDER BY x; \
           35  +  }
           36  +
           37  +  unset -nocomplain results errors
           38  +
           39  +  set code [compileCSharpWith [subst {
           40  +    using System.Data.SQLite;
           41  +    using Eagle._Containers.Public;
           42  +
           43  +    namespace _Dynamic${id}
           44  +    {
           45  +      public static class Test${id}
           46  +      {
           47  +        public static StringList GetList()
           48  +        {
           49  +          StringList result = new StringList();
           50  +
           51  +          using (SQLiteConnection connection = new SQLiteConnection(
           52  +              "Data Source=${dataSource};"))
           53  +          {
           54  +            connection.Open();
           55  +
           56  +            SQLiteCommand command = new SQLiteCommand("${sql}", connection);
           57  +            SQLiteDataReader dataReader = command.ExecuteReader();
           58  +            command.Dispose();
           59  +
           60  +            while (dataReader.Read())
           61  +              result.Add(dataReader\["x"\].ToString());
           62  +          }
           63  +
           64  +          return result;
           65  +        }
           66  +
           67  +        ///////////////////////////////////////////////////////////////////////
           68  +
           69  +        public static void Main()
           70  +        {
           71  +          // do nothing.
           72  +        }
           73  +      }
           74  +    }
           75  +  }] true true true results errors [list System.Data.SQLite.dll Eagle.dll]]
           76  +
           77  +  list $code $results \
           78  +      [expr {[info exists errors] ? $errors : ""}] \
           79  +      [expr {$code eq "Ok" ? [catch {
           80  +        object invoke _Dynamic${id}.Test${id} GetList
           81  +      } result] : [set result ""]}] $result
           82  +} -cleanup {
           83  +  cleanupDb $fileName
           84  +
           85  +  unset -nocomplain result results errors code sql dataSource id fileName
           86  +} -constraints \
           87  +{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} \
           88  +-match regexp -result {^Ok System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0\
           89  +\{1 2 3\}$}}
           90  +
           91  +###############################################################################
           92  +
           93  +runSQLiteTestEpilogue
           94  +runTestEpilogue