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

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

Overview
Comment:Add another test.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | tkt-1f7bfff467
Files: files | file ages | folders
SHA1:cda90ad6d160a74809bea7a518d4066d45178022
User & Date: mistachkin 2016-10-30 20:38:43
Context
2016-10-31
01:23
Merge updates from trunk. check-in: 09c590c144 user: mistachkin tags: tkt-1f7bfff467
2016-10-30
20:38
Add another test. check-in: cda90ad6d1 user: mistachkin tags: tkt-1f7bfff467
20:31
Fix commit of nested transactions that are out-of-order. Use a sequence number to construct SAVEPOINT names, not a random number. check-in: 0898ed0bbf user: mistachkin tags: tkt-1f7bfff467
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to Tests/tkt-1f7bfff467.eagle.

   148    148   } -cleanup {
   149    149     cleanupDb $fileName
   150    150   
   151    151     unset -nocomplain result results errors code sql dataSource id db fileName
   152    152   } -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
   153    153   System.Data.SQLite compileCSharp} -match regexp -result {^Ok\
   154    154   System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\} \{1 2 3\}$}}
          155  +
          156  +###############################################################################
          157  +
          158  +runTest {test tkt-1f7bfff467-1.3 {rollback outer transaction} -setup {
          159  +  setupDb [set fileName tkt-1f7bfff467-1.3.db]
          160  +} -body {
          161  +  sql execute $db {
          162  +    CREATE TABLE t1(x);
          163  +    INSERT INTO t1(x) VALUES(1);
          164  +  }
          165  +
          166  +  set sql(1) { \
          167  +    INSERT INTO t1(x) VALUES(2); \
          168  +  }
          169  +
          170  +  set sql(2) { \
          171  +    INSERT INTO t1(x) VALUES(3); \
          172  +  }
          173  +
          174  +  set id [object invoke Interpreter.GetActive NextId]
          175  +  set dataSource [file join [getDatabaseDirectory] $fileName]
          176  +
          177  +  unset -nocomplain results errors
          178  +
          179  +  set code [compileCSharpWith [subst {
          180  +    using System.Data.SQLite;
          181  +
          182  +    namespace _Dynamic${id}
          183  +    {
          184  +      public static class Test${id}
          185  +      {
          186  +        public static void Main()
          187  +        {
          188  +          using (SQLiteConnection connection = new SQLiteConnection(
          189  +              "Data Source=${dataSource};[getFlagsProperty]"))
          190  +          {
          191  +            connection.Open();
          192  +
          193  +            using (SQLiteTransaction transaction1 =
          194  +                connection.BeginTransaction())
          195  +            {
          196  +              using (SQLiteCommand command1 = new SQLiteCommand("${sql(1)}",
          197  +                  connection))
          198  +              {
          199  +                command1.Transaction = transaction1;
          200  +                command1.ExecuteNonQuery();
          201  +              }
          202  +
          203  +              using (SQLiteTransaction transaction2 =
          204  +                  connection.BeginTransaction())
          205  +              {
          206  +                using (SQLiteCommand command2 = new SQLiteCommand("${sql(2)}",
          207  +                    connection))
          208  +                {
          209  +                  command2.Transaction = transaction2;
          210  +                  command2.ExecuteNonQuery();
          211  +
          212  +                  transaction1.Rollback();
          213  +                }
          214  +              }
          215  +            }
          216  +          }
          217  +        }
          218  +      }
          219  +    }
          220  +  }] true true true results errors System.Data.SQLite.dll]
          221  +
          222  +  list $code $results \
          223  +      [expr {[info exists errors] ? $errors : ""}] \
          224  +      [expr {$code eq "Ok" ? [catch {
          225  +        object invoke _Dynamic${id}.Test${id} Main
          226  +      } result] : [set result ""]}] $result \
          227  +      [sql execute -execute reader -format list $db \
          228  +          "SELECT x FROM t1 ORDER BY x;"]
          229  +} -cleanup {
          230  +  cleanupDb $fileName
          231  +
          232  +  unset -nocomplain result results errors code sql dataSource id db fileName
          233  +} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
          234  +System.Data.SQLite compileCSharp} -match regexp -result {^Ok\
          235  +System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\} 1$}}
   155    236   
   156    237   ###############################################################################
   157    238   
   158    239   runSQLiteTestEpilogue
   159    240   runTestEpilogue