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

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

Overview
Comment:Add test for the transaction disposal exception handling behavior.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: b21d16dad9b897392ae503afcf2e32da26e92980
User & Date: mistachkin 2012-02-13 23:38:41
Context
2012-02-13
23:39
Test whitespace style adjustments. check-in: c49c15f654 user: mistachkin tags: trunk
23:38
Add test for the transaction disposal exception handling behavior. check-in: b21d16dad9 user: mistachkin tags: trunk
10:22
Modify transaction object disposal so that it can never cause an exception to be thrown. check-in: a45597a38c user: mistachkin tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to Tests/basic.eagle.

  1092   1092                  TABLE_NAME,
  1093   1093                  CONSTRAINT_TYPE,
  1094   1094                  IS_DEFERRABLE,
  1095   1095                  INITIALLY_DEFERRED,
  1096   1096                  NULL
  1097   1097           FROM TEMP.SCHEMAFOREIGNKEYS;
  1098   1098       }}
         1099  +
         1100  +###############################################################################
         1101  +
         1102  +runTest {test data-1.21 {SQLiteTransaction disposal} -setup {
         1103  +  setupDb [set fileName data-1.21.db]
         1104  +} -body {
         1105  +  sql execute $db "CREATE TABLE t1(x TEXT);"
         1106  +
         1107  +  sql execute $db {
         1108  +    INSERT INTO t1 (x) VALUES('test1');
         1109  +    INSERT INTO t1 (x) VALUES('test2');
         1110  +    INSERT INTO t1 (x) VALUES('test3');
         1111  +  }
         1112  +
         1113  +  set sql "SELECT x FROM t1 ORDER BY x COLLATE DOTHROW;"
         1114  +
         1115  +  set id [object invoke Interpreter.GetActive NextId]
         1116  +  set dataSource [file join [getDatabaseDirectory] $fileName]
         1117  +
         1118  +  unset -nocomplain results errors
         1119  +
         1120  +  set code [compileCSharpWith [subst {
         1121  +    using System;
         1122  +    using System.Data.SQLite;
         1123  +
         1124  +    namespace _Dynamic${id}
         1125  +    {
         1126  +      \[SQLiteFunction(Name = "DOTHROW", FuncType = FunctionType.Collation)\]
         1127  +      public class Test${id} : SQLiteFunction
         1128  +      {
         1129  +        public override int Compare(
         1130  +          string param1,
         1131  +          string param2
         1132  +          )
         1133  +        {
         1134  +          throw new Exception("not implemented");
         1135  +        }
         1136  +
         1137  +        ///////////////////////////////////////////////////////////////////////
         1138  +
         1139  +        public static void Main()
         1140  +        {
         1141  +          SQLiteFunction.RegisterFunction(typeof(Test${id}));
         1142  +
         1143  +          using (SQLiteConnection connection = new SQLiteConnection(
         1144  +              "Data Source=${dataSource};"))
         1145  +          {
         1146  +            connection.Open();
         1147  +
         1148  +            using (SQLiteTransaction transaction =
         1149  +                connection.BeginTransaction())
         1150  +            {
         1151  +              try
         1152  +              {
         1153  +                SQLiteCommand command = connection.CreateCommand();
         1154  +
         1155  +                command.CommandText = "${sql}";
         1156  +                command.ExecuteNonQuery();
         1157  +              }
         1158  +              catch
         1159  +              {
         1160  +                // do nothing.
         1161  +              }
         1162  +            }
         1163  +          }
         1164  +        }
         1165  +      }
         1166  +    }
         1167  +  }] true true true results errors System.Data.SQLite.dll]
         1168  +
         1169  +  list $code $results \
         1170  +      [expr {[info exists errors] ? $errors : ""}] \
         1171  +      [expr {$code eq "Ok" ? [catch {
         1172  +        object invoke _Dynamic${id}.Test${id} Main
         1173  +      } result] : [set result ""]}] $result
         1174  +} -cleanup {
         1175  +  cleanupDb $fileName
         1176  +
         1177  +  unset -nocomplain result results errors code sql dataSource id db fileName
         1178  +} -constraints \
         1179  +{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -match \
         1180  +regexp -result {^Ok System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\}$}}
  1099   1181   
  1100   1182   ###############################################################################
  1101   1183   
  1102   1184   unset -nocomplain testExeFile testLinqExeFile northwindEfDbFile testLinqOutFile
  1103   1185   
  1104   1186   ###############################################################################
  1105   1187   
  1106   1188   runSQLiteTestEpilogue
  1107   1189   runTestEpilogue