System.Data.SQLite
Artifact Content
Not logged in

Artifact ed0aa7542183a435756bd6e20cd36520362b345e:


###############################################################################
#
# tkt-3113734605.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-3113734605-1.1 {ColumnSize and NumericPrecision} -setup {
  setupDb [set fileName tkt-3113734605-1.1.db]
} -body {
  set connection [getDbConnection]

  set result [list]

  sql execute $db {
    CREATE TABLE t1(
      v BINARY(12), w CHAR(23), x NCHAR(34), y VARCHAR(45), z NVARCHAR(56)
    );
  }

  sql execute $db "CREATE VIEW v1 AS SELECT * FROM t1;"

  foreach collectionName [list TABLECOLUMNS VIEWCOLUMNS] {
    set dataTable [object invoke -alias $connection GetSchema $collectionName]

    if {[string length $dataTable] > 0} then {
      set dataRows [$dataTable Rows]

      object foreach -alias dataRow $dataRows {
        lappend result [set value [$dataRow get_Item TABLE_NAME]]
        lappend result [set value [$dataRow get_Item COLUMN_NAME]]
        lappend result [set value [$dataRow get_Item CHARACTER_MAXIMUM_LENGTH]]
        lappend result [set value [$dataRow get_Item NUMERIC_PRECISION]]
      }
    }
  }

  set result
} -cleanup {
  cleanupDb $fileName

  freeDbConnection

  unset -nocomplain value dataRow dataRows dataTable collectionName result \
      connection db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -match \
regexp -result {^t1 v 12 System#DBNull#\d+ t1 w 23 System#DBNull#\d+ t1 x 34\
System#DBNull#\d+ t1 y 45 System#DBNull#\d+ t1 z 56 System#DBNull#\d+ v1 v 12\
System#DBNull#\d+ v1 w 23 System#DBNull#\d+ v1 x 34 System#DBNull#\d+ v1 y 45\
System#DBNull#\d+ v1 z 56 System#DBNull#\d+ t1 v 12 System#DBNull#\d+ t1 w 23\
System#DBNull#\d+ t1 x 34 System#DBNull#\d+ t1 y 45 System#DBNull#\d+ t1 z 56\
System#DBNull#\d+$}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue