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

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

Overview
Comment:Add virtual table test to cover the marshalling performed with xBestIndex.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | marshalFixes
Files: files | file ages | folders
SHA1: e1483fef81f1fb9ea7f321e520154275c05296e1
User & Date: mistachkin 2013-07-15 06:53:33
Context
2013-07-15
07:00
Fix typo. Closed-Leaf check-in: c365a97aa9 user: mistachkin tags: marshalFixes
06:53
Add virtual table test to cover the marshalling performed with xBestIndex. check-in: e1483fef81 user: mistachkin tags: marshalFixes
05:54
Fix SQLiteCommand object disposal issue revealed by the previous check-in. check-in: db65a60fcf user: mistachkin tags: marshalFixes
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to Tests/vtab.eagle.

   206    206     cleanupDb $fileName
   207    207   
   208    208     unset -nocomplain result code results errors sql dataSource id fileName
   209    209   } -constraints \
   210    210   {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite\
   211    211   defineConstant.System.Data.SQLite.INTEROP_VIRTUAL_TABLE} -match regexp -result \
   212    212   [string map [list \n \r\n] {^Ok System#CodeDom#Compiler#CompilerResults#\d+\
   213         -\{\} 0 \{one two three 4 5.0 Error \{SQL logic error or missing database
          213  +\{\} 0 \{one two three 4 5\.0 Error \{SQL logic error or missing database
   214    214   virtual table "t\d+" is read-only\}\}$}]}
   215    215   
   216    216   ###############################################################################
   217    217   
   218    218   runTest {test vtab-1.3 {IEnumerable<T> virtual table} -setup {
   219    219     set fileName vtab-1.3.db
   220    220   } -body {
................................................................................
   998    998   
   999    999     unset -nocomplain result code results errors sql dataSource id fileName
  1000   1000   } -constraints \
  1001   1001   {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite\
  1002   1002   defineConstant.System.Data.SQLite.INTEROP_VIRTUAL_TABLE} -match regexp -result \
  1003   1003   [string map [list \n \r\n] {^Ok System#CodeDom#Compiler#CompilerResults#\d+\
  1004   1004   \{\} 0 \{\{\} t\d+ \{\} x\d+\}$}]}
         1005  +
         1006  +###############################################################################
         1007  +
         1008  +runTest {test vtab-1.7 {virtual table xBestIndex marshalling} -setup {
         1009  +  set fileName vtab-1.7.db
         1010  +} -body {
         1011  +  set id [object invoke Interpreter.GetActive NextId]
         1012  +  set dataSource [file join [getDatabaseDirectory] $fileName]
         1013  +
         1014  +  set sql(1) { \
         1015  +    CREATE TABLE t${id}(y CHAR(10) NOT NULL PRIMARY KEY); \
         1016  +    CREATE VIRTUAL TABLE u${id} USING mod${id}; \
         1017  +  }
         1018  +
         1019  +  set sql(2) { \
         1020  +    INSERT INTO t${id} SELECT x FROM u${id}; \
         1021  +  }
         1022  +
         1023  +  set sql(3) { \
         1024  +    SELECT v${id}.y FROM t${id} v${id} LEFT OUTER JOIN \
         1025  +    u${id} ON u${id}.x = v${id}.y WHERE u${id}.x IS NOT NULL \
         1026  +    ORDER BY v${id}.y DESC; \
         1027  +  }
         1028  +
         1029  +  unset -nocomplain results errors
         1030  +
         1031  +  set code [compileCSharpWith [subst {
         1032  +    using System;
         1033  +    using System.Data.SQLite;
         1034  +    using Eagle._Containers.Public;
         1035  +
         1036  +    namespace _Dynamic${id}
         1037  +    {
         1038  +      public static class Test${id}
         1039  +      {
         1040  +        public static StringList GetList(params string\[\] strings)
         1041  +        {
         1042  +          StringList result = new StringList();
         1043  +
         1044  +          using (SQLiteConnection connection = new SQLiteConnection(
         1045  +              "Data Source=${dataSource};"))
         1046  +          {
         1047  +            connection.Open();
         1048  +
         1049  +            connection.CreateModule(new SQLiteModuleEnumerable(
         1050  +              "mod${id}", strings));
         1051  +
         1052  +            using (SQLiteCommand command = connection.CreateCommand())
         1053  +            {
         1054  +              command.CommandText = "[subst ${sql(1)}]";
         1055  +              result.Add(command.ExecuteNonQuery().ToString());
         1056  +            }
         1057  +
         1058  +            using (SQLiteCommand command = connection.CreateCommand())
         1059  +            {
         1060  +              command.CommandText = "[subst ${sql(2)}]";
         1061  +              result.Add(command.ExecuteNonQuery().ToString());
         1062  +            }
         1063  +
         1064  +            using (SQLiteCommand command = connection.CreateCommand())
         1065  +            {
         1066  +              command.CommandText = "[subst ${sql(3)}]";
         1067  +
         1068  +              using (SQLiteDataReader dataReader = command.ExecuteReader())
         1069  +              {
         1070  +                while (dataReader.Read())
         1071  +                  result.Add(dataReader\[0\].ToString());
         1072  +              }
         1073  +            }
         1074  +
         1075  +            connection.Close();
         1076  +          }
         1077  +
         1078  +          return result;
         1079  +        }
         1080  +
         1081  +        ///////////////////////////////////////////////////////////////////////
         1082  +
         1083  +        public static void Main()
         1084  +        {
         1085  +          // do nothing.
         1086  +        }
         1087  +      }
         1088  +    }
         1089  +  }] true true true results errors [list System.Data.SQLite.dll Eagle.dll]]
         1090  +
         1091  +  list $code $results \
         1092  +      [expr {[info exists errors] ? $errors : ""}] \
         1093  +      [expr {$code eq "Ok" ? [catch {
         1094  +        object invoke _Dynamic${id}.Test${id} GetList one two three 4 5.0
         1095  +      } result] : [set result ""]}] $result
         1096  +} -cleanup {
         1097  +  cleanupDb $fileName
         1098  +
         1099  +  unset -nocomplain result code results errors sql dataSource id fileName
         1100  +} -constraints \
         1101  +{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite\
         1102  +defineConstant.System.Data.SQLite.INTEROP_VIRTUAL_TABLE} -match regexp -result \
         1103  +[string map [list \n \r\n] {^Ok System#CodeDom#Compiler#CompilerResults#\d+\
         1104  +\{\} 0 \{0 5 two three one 5\.0 4\}$}]}
  1005   1105   
  1006   1106   ###############################################################################
  1007   1107   
  1008   1108   runSQLiteTestEpilogue
  1009   1109   runTestEpilogue