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

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

Overview
Comment:Do not use the 16-bit 'short' type to keep track of numeric precision or scale when building the schema table for a query. Fix for [ef2216192d].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: c07cca890bd0dd18bec9555cf335ab6fd91cbfcf
User & Date: mistachkin 2013-12-19 13:01:07
References
2013-12-19
13:02 Closed ticket [ef2216192d]: Use Varchar type with size more than 65536 will trigger error when using SQLiteCommandBuilder plus 4 other changes artifact: f69ca58604 user: mistachkin
Context
2013-12-19
13:11
Update version history docs. check-in: 29f80bd37b user: mistachkin tags: trunk
13:01
Do not use the 16-bit 'short' type to keep track of numeric precision or scale when building the schema table for a query. Fix for [ef2216192d]. check-in: c07cca890b user: mistachkin tags: trunk
09:47
Remove several prologue overrides from the Eagle vendor script now that beta 29 is checked-in. check-in: ebbd7bca45 user: mistachkin tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to System.Data.SQLite/SQLiteDataReader.cs.

   862    862         string strTable = "";
   863    863         string strColumn = "";
   864    864   
   865    865         tbl.Locale = CultureInfo.InvariantCulture;
   866    866         tbl.Columns.Add(SchemaTableColumn.ColumnName, typeof(String));
   867    867         tbl.Columns.Add(SchemaTableColumn.ColumnOrdinal, typeof(int));
   868    868         tbl.Columns.Add(SchemaTableColumn.ColumnSize, typeof(int));
   869         -      tbl.Columns.Add(SchemaTableColumn.NumericPrecision, typeof(short));
   870         -      tbl.Columns.Add(SchemaTableColumn.NumericScale, typeof(short));
          869  +      tbl.Columns.Add(SchemaTableColumn.NumericPrecision, typeof(int));
          870  +      tbl.Columns.Add(SchemaTableColumn.NumericScale, typeof(int));
   871    871         tbl.Columns.Add(SchemaTableColumn.IsUnique, typeof(Boolean));
   872    872         tbl.Columns.Add(SchemaTableColumn.IsKey, typeof(Boolean));
   873    873         tbl.Columns.Add(SchemaTableOptionalColumn.BaseServerName, typeof(string));
   874    874         tbl.Columns.Add(SchemaTableOptionalColumn.BaseCatalogName, typeof(String));
   875    875         tbl.Columns.Add(SchemaTableColumn.BaseColumnName, typeof(String));
   876    876         tbl.Columns.Add(SchemaTableColumn.BaseSchemaName, typeof(String));
   877    877         tbl.Columns.Add(SchemaTableColumn.BaseTableName, typeof(String));

Added Tests/tkt-ef2216192d.eagle.

            1  +###############################################################################
            2  +#
            3  +# tkt-ef2216192d.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-ef2216192d-1.1 {GetSchemaTable w/large VARCHAR} -setup {
           24  +  setupDb [set fileName tkt-ef2216192d-1.1.db]
           25  +} -body {
           26  +  sql execute $db "CREATE TABLE t1(x INTEGER PRIMARY KEY, y VARCHAR(32768));"
           27  +
           28  +  set id [object invoke Interpreter.GetActive NextId]
           29  +  set dataSource [file join [getDatabaseDirectory] $fileName]
           30  +
           31  +  set sql { \
           32  +    SELECT x, y FROM t1; \
           33  +  }
           34  +
           35  +  unset -nocomplain results errors
           36  +
           37  +  set code [compileCSharpWith [subst {
           38  +    using System.Data.SQLite;
           39  +
           40  +    namespace _Dynamic${id}
           41  +    {
           42  +      public static class Test${id}
           43  +      {
           44  +        public static void Main()
           45  +        {
           46  +          using (SQLiteConnection connection = new SQLiteConnection(
           47  +              "Data Source=${dataSource};"))
           48  +          {
           49  +            connection.Open();
           50  +
           51  +            using (SQLiteDataAdapter dataAdapter = new SQLiteDataAdapter(
           52  +                "${sql}", connection))
           53  +            {
           54  +              using (SQLiteCommandBuilder commandBuilder =
           55  +                  new SQLiteCommandBuilder(dataAdapter))
           56  +              {
           57  +                dataAdapter.InsertCommand = commandBuilder.GetInsertCommand();
           58  +                dataAdapter.UpdateCommand = commandBuilder.GetUpdateCommand();
           59  +                dataAdapter.DeleteCommand = commandBuilder.GetDeleteCommand();
           60  +
           61  +                //
           62  +                // NOTE: If we get to this point without an exception being
           63  +                //       thrown, this test has succeeded.
           64  +                //
           65  +              }
           66  +            }
           67  +          }
           68  +        }
           69  +      }
           70  +    }
           71  +  }] true true true results errors System.Data.SQLite.dll]
           72  +
           73  +  list $code $results \
           74  +      [expr {[info exists errors] ? $errors : ""}] \
           75  +      [expr {$code eq "Ok" ? [catch {
           76  +        object invoke _Dynamic${id}.Test${id} Main
           77  +      } result] : [set result ""]}] $result
           78  +} -cleanup {
           79  +  cleanupDb $fileName
           80  +
           81  +  unset -nocomplain result results errors code sql dataSource id db fileName
           82  +} -constraints {eagle monoBug28 command.sql compile.DATA SQLite\
           83  +System.Data.SQLite compileCSharp} -match regexp -result {^Ok\
           84  +System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\}$}}
           85  +
           86  +###############################################################################
           87  +
           88  +runSQLiteTestEpilogue
           89  +runTestEpilogue