Index: Tests/basic.eagle ================================================================== --- Tests/basic.eagle +++ Tests/basic.eagle @@ -1381,11 +1381,37 @@ FROM TEMP.SCHEMAFOREIGNKEYS; }} ############################################################################### -runTest {test data-1.25 {LINQ SQL_CONSTRAINTS resource} -body { +runTest {test data-1.25 {EF6 SQL_CONSTRAINTCOLUMNS resource} -body { + object invoke -flags +NonPublic \ + System.Data.SQLite.EF6.Properties.Resources SQL_CONSTRAINTCOLUMNS +} -constraints {eagle System.Data.SQLite System.Data.SQLite.EF6} -result { + CREATE TEMP VIEW SCHEMACONSTRAINTCOLUMNS AS + SELECT CONSTRAINT_CATALOG, + NULL AS CONSTRAINT_SCHEMA, + CONSTRAINT_NAME, + TABLE_CATALOG, + NULL AS TABLE_SCHEMA, + TABLE_NAME, + COLUMN_NAME + FROM TEMP.SCHEMAINDEXCOLUMNS + UNION + SELECT CONSTRAINT_CATALOG, + NULL, + CONSTRAINT_NAME, + TABLE_CATALOG, + NULL, + TABLE_NAME, + FKEY_FROM_COLUMN + FROM TEMP.SCHEMAFOREIGNKEYS; + }} + +############################################################################### + +runTest {test data-1.26 {LINQ SQL_CONSTRAINTS resource} -body { object invoke -flags +NonPublic \ System.Data.SQLite.Linq.Properties.Resources SQL_CONSTRAINTS } -constraints {eagle System.Data.SQLite System.Data.SQLite.Linq} -result { CREATE TEMP VIEW SCHEMACONSTRAINTS AS SELECT INDEX_CATALOG AS CONSTRAINT_CATALOG, @@ -1427,12 +1453,58 @@ FROM TEMP.SCHEMAFOREIGNKEYS; }} ############################################################################### -runTest {test data-1.26 {SQLiteDataReader GetValues w/collection} -setup { - setupDb [set fileName data-1.26.db] +runTest {test data-1.27 {EF6 SQL_CONSTRAINTS resource} -body { + object invoke -flags +NonPublic \ + System.Data.SQLite.EF6.Properties.Resources SQL_CONSTRAINTS +} -constraints {eagle System.Data.SQLite System.Data.SQLite.EF6} -result { + CREATE TEMP VIEW SCHEMACONSTRAINTS AS + SELECT INDEX_CATALOG AS CONSTRAINT_CATALOG, + NULL AS CONSTRAINT_SCHEMA, + INDEX_NAME AS CONSTRAINT_NAME, + TABLE_CATALOG, + NULL AS TABLE_SCHEMA, + TABLE_NAME, + 'PRIMARY KEY' AS CONSTRAINT_TYPE, + 0 AS IS_DEFERRABLE, + 0 AS INITIALLY_DEFERRED, + NULL AS CHECK_CLAUSE + FROM TEMP.SCHEMAINDEXES + WHERE PRIMARY_KEY = 1 + UNION + SELECT INDEX_CATALOG, + NULL, + INDEX_NAME, + TABLE_CATALOG, + NULL, + TABLE_NAME, + 'UNIQUE', + 0, + 0, + NULL + FROM TEMP.SCHEMAINDEXES + WHERE PRIMARY_KEY = 0 AND [UNIQUE] = 1 + UNION + SELECT CONSTRAINT_CATALOG, + NULL, + CONSTRAINT_NAME, + TABLE_CATALOG, + NULL, + TABLE_NAME, + CONSTRAINT_TYPE, + IS_DEFERRABLE, + INITIALLY_DEFERRED, + NULL + FROM TEMP.SCHEMAFOREIGNKEYS; + }} + +############################################################################### + +runTest {test data-1.28 {SQLiteDataReader GetValues w/collection} -setup { + setupDb [set fileName data-1.28.db] } -body { sql execute $db { CREATE TABLE t1(x INTEGER PRIMARY KEY ASC, y TEXT); INSERT INTO t1 (x, y) VALUES(1, 'aardvark'); INSERT INTO t1 (x, y) VALUES(2, 'bear'); @@ -1488,12 +1560,12 @@ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \ {{26 26} {zebra zebra}}} ############################################################################### -runTest {test data-1.27 {LINQ ISQLiteSchemaExtensions.BuildTempSchema} -setup { - setupDb [set fileName data-1.27.db] +runTest {test data-1.29 {LINQ ISQLiteSchemaExtensions.BuildTempSchema} -setup { + setupDb [set fileName data-1.29.db] } -body { set connection [getDbConnection] set providerServices [object invoke -flags +NonPublic \ System.Data.SQLite.Linq.SQLiteProviderServices Instance] @@ -1510,11 +1582,33 @@ } -constraints {eagle SQLite System.Data.SQLite System.Data.SQLite.Linq} \ -result {}} ############################################################################### -runTest {test data-1.28 {VARCHAR / NVARCHAR types with spaces} -body { +runTest {test data-1.30 {EF6 ISQLiteSchemaExtensions.BuildTempSchema} -setup { + setupDb [set fileName data-1.30.db] +} -body { + set connection [getDbConnection] + + set providerServices [object invoke -flags +NonPublic \ + System.Data.SQLite.EF6.SQLiteProviderServices Instance] + + object invoke -flags +NonPublic -type \ + System.Data.SQLite.ISQLiteSchemaExtensions $providerServices \ + BuildTempSchema $connection +} -cleanup { + cleanupDb $fileName + + freeDbConnection + + unset -nocomplain providerServices connection db fileName +} -constraints {eagle SQLite System.Data.SQLite System.Data.SQLite.EF6} \ +-result {}} + +############################################################################### + +runTest {test data-1.31 {VARCHAR / NVARCHAR types with spaces} -body { list [object invoke -flags +NonPublic System.Data.SQLite.SQLiteConvert \ TypeNameToDbType VARCHAR None] \ [object invoke -flags +NonPublic System.Data.SQLite.SQLiteConvert \ TypeNameToDbType NVARCHAR None] \ [object invoke -flags +NonPublic System.Data.SQLite.SQLiteConvert \ @@ -1528,11 +1622,11 @@ } -constraints {eagle System.Data.SQLite} -result \ {AnsiString String AnsiString String AnsiString String}} ############################################################################### -runTest {test data-1.29 {SetMemoryStatus method} -setup { +runTest {test data-1.32 {SetMemoryStatus method} -setup { # # NOTE: Make sure that SQLite core library is completely shutdown prior to # starting this test. # shutdownSQLite $test_channel @@ -1616,12 +1710,12 @@ regexp -result {^Ok Misuse Ok Ok System#IntPtr#\d+ System#IntPtr#\d+ \d+ \d+\ \d+ \d+ \d+ True True True True True True$}} ############################################################################### -runTest {test data-1.30 {SQLiteConnection.Open with SetDefaults=False} -setup { - setupDb [set fileName data-1.30.db] "" "" "" "" SetDefaults=False +runTest {test data-1.33 {SQLiteConnection.Open with SetDefaults=False} -setup { + setupDb [set fileName data-1.33.db] "" "" "" "" SetDefaults=False } -body { set result [list] lappend result [sql execute -execute scalar $db "PRAGMA page_size;"] lappend result [sql execute -execute scalar $db "PRAGMA max_page_count;"] @@ -1640,12 +1734,12 @@ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \ {1024 1073741823 0 2 2000 delete 0}} ############################################################################### -runTest {test data-1.31 {SQLiteConnection.Open with SetDefaults=True} -setup { - setupDb [set fileName data-1.31.db] "" "" "" "" SetDefaults=True +runTest {test data-1.34 {SQLiteConnection.Open with SetDefaults=True} -setup { + setupDb [set fileName data-1.34.db] "" "" "" "" SetDefaults=True } -body { set result [list] lappend result [sql execute -execute scalar $db "PRAGMA page_size;"] lappend result [sql execute -execute scalar $db "PRAGMA max_page_count;"] @@ -1664,12 +1758,12 @@ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \ {1024 1073741823 0 2 2000 delete 0}} ############################################################################### -runTest {test data-1.32 {SQLiteConnection.Open without SetDefaults} -setup { - setupDb [set fileName data-1.32.db] +runTest {test data-1.35 {SQLiteConnection.Open without SetDefaults} -setup { + setupDb [set fileName data-1.35.db] } -body { set result [list] lappend result [sql execute -execute scalar $db "PRAGMA page_size;"] lappend result [sql execute -execute scalar $db "PRAGMA max_page_count;"] @@ -1688,16 +1782,16 @@ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \ {1024 1073741823 0 2 2000 delete 0}} ############################################################################### -runTest {test data-1.33 {SQLiteConnection.Open with PRAGMA overrides} -setup { +runTest {test data-1.36 {SQLiteConnection.Open with PRAGMA overrides} -setup { # # NOTE: Attempt to open a connection with all available PRAGMA settings # set to non-default values in the connection string. # - setupDb [set fileName data-1.33.db] "" "" "" "" [join [list \ + setupDb [set fileName data-1.36.db] "" "" "" "" [join [list \ "Page Size=4096" "Max Page Count=2048" "Legacy Format=True" \ Synchronous=Normal "Cache Size=4096" "Journal Mode=Wal" \ "Foreign Keys=True"] \;] } -body { set result [list] @@ -1719,11 +1813,11 @@ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \ {4096 2048 1 1 4096 wal 1}} ############################################################################### -runTest {test data-1.34 {sqlite3_win32_set_directory function} -setup { +runTest {test data-1.37 {sqlite3_win32_set_directory function} -setup { set directory(base) [getDatabaseDirectory] if {[string length $directory(base)] == 0 || \ ![file exists $directory(base)] || \ ![file isdirectory $directory(base)]} then { @@ -1771,11 +1865,11 @@ lappend result [object invoke -flags +NonPublic \ System.Data.SQLite.UnsafeNativeMethods sqlite3_win32_set_directory 2 \ $directory(temp)] - setupDb [set fileName data-1.34.db] "" "" "" "" "" false false false false + setupDb [set fileName data-1.37.db] "" "" "" "" "" false false false false sql execute $db "CREATE TABLE t1(x NOT NULL);" for {set i 1} {$i < 100} {incr i} { sql execute $db "INSERT INTO t1 (x) VALUES(?);" [list param1 String $i] @@ -1860,11 +1954,11 @@ } -constraints {eagle windows monoBug28 command.sql compile.DATA SQLite\ System.Data.SQLite sqlite3_win32_set_directory} -result {Ok Ok True True}} ############################################################################### -runTest {test data-1.35 {serialization of SQLiteException} -body { +runTest {test data-1.38 {serialization of SQLiteException} -body { set serializer [object create -alias \ System.Runtime.Serialization.Formatters.Binary.BinaryFormatter] set stream [object create -alias System.IO.MemoryStream] @@ -1888,12 +1982,12 @@ this is a test} CantOpen {unable to open database file this is a test} True True}]} ############################################################################### -runTest {test data-1.36 {unencrypted database, with password} -setup { - setupDb [set fileName data-1.36.db] +runTest {test data-1.39 {unencrypted database, with password} -setup { + setupDb [set fileName data-1.39.db] } -body { sql execute $db "CREATE TABLE t1(x);" sql execute $db "INSERT INTO t1 (x) VALUES(1);" cleanupDb $fileName db true false false @@ -1927,12 +2021,12 @@ not a database.*?\} 1 \{System\.Data\.SQLite\.SQLiteException \(0x80004005\):\ file is encrypted or is not a database.*?\} 0 1 0 2$}} ############################################################################### -runTest {test data-1.37 {encrypted database, wrong password} -setup { - setupDb [set fileName data-1.37.db] "" "" "" "" "Password=12345;" +runTest {test data-1.40 {encrypted database, wrong password} -setup { + setupDb [set fileName data-1.40.db] "" "" "" "" "Password=12345;" } -body { sql execute $db "CREATE TABLE t1(x);" sql execute $db "INSERT INTO t1 (x) VALUES(1);" cleanupDb $fileName db true false false @@ -1966,12 +2060,12 @@ not a database.*?\} 1 \{System\.Data\.SQLite\.SQLiteException \(0x80004005\):\ file is encrypted or is not a database.*?\} 0 1 0 2$}} ############################################################################### -runTest {test data-1.38 {encrypted database, password w/start-space} -setup { - setupDb [set fileName data-1.38.db] "" "" "" "" "Password= 1234;" +runTest {test data-1.41 {encrypted database, password w/start-space} -setup { + setupDb [set fileName data-1.41.db] "" "" "" "" "Password= 1234;" } -body { sql execute $db "CREATE TABLE t1(x);" sql execute $db "INSERT INTO t1 (x) VALUES(1);" cleanupDb $fileName db true false false @@ -2002,12 +2096,12 @@ } -constraints {eagle defineConstant.System.Data.SQLite.INTEROP_CODEC monoBug28\ command.sql compile.DATA SQLite System.Data.SQLite} -result {0 1 0 1 0 1 0 3}} ############################################################################### -runTest {test data-1.39 {encrypted database, w/quoted-start-space} -setup { - setupDb [set fileName data-1.39.db] "" "" "" "" "Password=\" 1234\";" +runTest {test data-1.42 {encrypted database, w/quoted-start-space} -setup { + setupDb [set fileName data-1.42.db] "" "" "" "" "Password=\" 1234\";" } -body { sql execute $db "CREATE TABLE t1(x);" sql execute $db "INSERT INTO t1 (x) VALUES(1);" cleanupDb $fileName db true false false @@ -2041,12 +2135,12 @@ not a database.*?\} 1 \{System\.Data\.SQLite\.SQLiteException \(0x80004005\):\ file is encrypted or is not a database.*?\} 0 1 0 2$}} ############################################################################### -runTest {test data-1.40 {encrypted database, password w/mid-space} -setup { - setupDb [set fileName data-1.40.db] "" "" "" "" "Password=12 45;" +runTest {test data-1.43 {encrypted database, password w/mid-space} -setup { + setupDb [set fileName data-1.43.db] "" "" "" "" "Password=12 45;" } -body { sql execute $db "CREATE TABLE t1(x);" sql execute $db "INSERT INTO t1 (x) VALUES(1);" cleanupDb $fileName db true false false @@ -2080,12 +2174,12 @@ not a database.*?\} 1 \{System\.Data\.SQLite\.SQLiteException \(0x80004005\):\ file is encrypted or is not a database.*?\} 0 1 0 2$}} ############################################################################### -runTest {test data-1.41 {encrypted database, password w/end-space} -setup { - setupDb [set fileName data-1.41.db] "" "" "" "" "Password=1234 ;" +runTest {test data-1.44 {encrypted database, password w/end-space} -setup { + setupDb [set fileName data-1.44.db] "" "" "" "" "Password=1234 ;" } -body { sql execute $db "CREATE TABLE t1(x);" sql execute $db "INSERT INTO t1 (x) VALUES(1);" cleanupDb $fileName db true false false @@ -2116,12 +2210,12 @@ } -constraints {eagle defineConstant.System.Data.SQLite.INTEROP_CODEC monoBug28\ command.sql compile.DATA SQLite System.Data.SQLite} -result {0 1 0 1 0 1 0 3}} ############################################################################### -runTest {test data-1.42 {encrypted database, w/quoted-end-space} -setup { - setupDb [set fileName data-1.42.db] "" "" "" "" "Password=\"1234 \";" +runTest {test data-1.45 {encrypted database, w/quoted-end-space} -setup { + setupDb [set fileName data-1.45.db] "" "" "" "" "Password=\"1234 \";" } -body { sql execute $db "CREATE TABLE t1(x);" sql execute $db "INSERT INTO t1 (x) VALUES(1);" cleanupDb $fileName db true false false @@ -2155,12 +2249,12 @@ not a database.*?\} 1 \{System\.Data\.SQLite\.SQLiteException \(0x80004005\):\ file is encrypted or is not a database.*?\} 0 1 0 2$}} ############################################################################### -runTest {test data-1.43 {encrypted database, password via builder} -setup { - setupDb [set fileName data-1.43.db] "" "" "" "" "Password=67 89;" +runTest {test data-1.46 {encrypted database, password via builder} -setup { + setupDb [set fileName data-1.46.db] "" "" "" "" "Password=67 89;" } -body { sql execute $db "CREATE TABLE t1(x);" sql execute $db "INSERT INTO t1 (x) VALUES(1);" cleanupDb $fileName db true false false @@ -2206,11 +2300,11 @@ } -constraints {eagle defineConstant.System.Data.SQLite.INTEROP_CODEC monoBug28\ command.sql compile.DATA SQLite System.Data.SQLite} -result {0 1 0 1 0 1 0 3}} ############################################################################### -runTest {test data-1.44 {quoted connection string properties} -setup { +runTest {test data-1.47 {quoted connection string properties} -setup { unset -nocomplain result list pair strings string } -body { set result [list] set strings [list \ @@ -2235,12 +2329,12 @@ ThreeFour} {{One Two} {Three Four}} {{One Two} {Three Four}} {OneTwo ThreeFour}\ {OneTwo ThreeFour} {{One Two} {Three Four}} {{One Two} {Three Four}}}} ############################################################################### -runTest {test data-1.45 {rollback to nested savepoint} -setup { - setupDb [set fileName data-1.45.db] +runTest {test data-1.48 {rollback to nested savepoint} -setup { + setupDb [set fileName data-1.48.db] } -body { sql execute $db "BEGIN IMMEDIATE TRANSACTION;" sql execute $db "SAVEPOINT one;" sql execute $db "CREATE TABLE t1(x);" @@ -2265,12 +2359,12 @@ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \ {1 2 1}} ############################################################################### -runTest {test data-1.46 {NoExtensionFunctions connection flag} -setup { - setupDb [set fileName data-1.46.db] +runTest {test data-1.49 {NoExtensionFunctions connection flag} -setup { + setupDb [set fileName data-1.49.db] } -body { set result [list] lappend result [catch {sql execute -execute scalar $db \ "SELECT replicate('1234', 2);"} output] $output @@ -2297,12 +2391,12 @@ regexp -result {^0 12341234 1 \{System\.Data\.SQLite\.SQLiteException\ \(0x80004005\): SQL logic error or missing database.*?\} 0 1234123412341234$}} ############################################################################### -runTest {test data-1.47 {column name and index lookup} -setup { - setupDb [set fileName data-1.47.db] +runTest {test data-1.50 {column name and index lookup} -setup { + setupDb [set fileName data-1.50.db] } -body { sql execute $db { CREATE TABLE t1(x, y, z); INSERT INTO t1 (x, y, z) VALUES(1, 'foo', 1234); } @@ -2333,12 +2427,12 @@ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \ {{x 0 1} {y 1 foo} {z 2 1234}}} ############################################################################### -runTest {test data-1.48 {nullable value types} -setup { - setupDb [set fileName data-1.48.db] +runTest {test data-1.51 {nullable value types} -setup { + setupDb [set fileName data-1.51.db] } -body { sql execute $db { CREATE TABLE t1(x INTEGER); INSERT INTO t1 (x) VALUES(NULL); INSERT INTO t1 (x) VALUES(1); @@ -2375,11 +2469,11 @@ the target of an invocation\. ---> System\.InvalidCastException:.*\}\ System#DBNull#\d+\} \{0 x 1 0 1 1\}$}} ############################################################################### -runTest {test data-1.49 {static SQLiteCommand.Execute method} -setup { +runTest {test data-1.52 {static SQLiteCommand.Execute method} -setup { unset -nocomplain result sql } -body { set sql(1) { \ CREATE TABLE t1(x); \ INSERT INTO t1 (x) VALUES (NULL); \ @@ -2424,12 +2518,12 @@ -result {^\{\} 1 System#DBNull#\d+ System#Data#SQLite#SQLiteDataReader#\d+ \{\}\ 1 1 System#Data#SQLite#SQLiteDataReader#\d+$}} ############################################################################### -runTest {test data-1.50 {BindAllAsText w/DateTime} -setup { - setupDb [set fileName data-1.50.db] "" Ticks Utc BindAllAsText +runTest {test data-1.53 {BindAllAsText w/DateTime} -setup { + setupDb [set fileName data-1.53.db] "" Ticks Utc BindAllAsText } -body { sql execute $db "CREATE TABLE t1(x);" list [sql execute $db "INSERT INTO t1 (x) VALUES(?);" \ [list param1 DateTime [set dateTime [object invoke DateTime Parse \ @@ -2443,12 +2537,12 @@ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \ {1 630874007980000000}} ############################################################################### -runTest {test data-1.51 {bind SQLiteFunction to one SQLiteConnection} -setup { - set fileName data-1.51.db +runTest {test data-1.54 {bind SQLiteFunction to one SQLiteConnection} -setup { + set fileName data-1.54.db } -body { set id [object invoke Interpreter.GetActive NextId] set dataSource [file join [getDatabaseDirectory] $fileName] set sql { \ @@ -2543,11 +2637,11 @@ logic error or missing database no such function: MyRandom.*\}$}]} ############################################################################### -runTest {test data-1.52 {SQLiteConvert TypeNameToDbType} -setup { +runTest {test data-1.55 {SQLiteConvert TypeNameToDbType} -setup { unset -nocomplain result typeName } -body { foreach typeName [list \ BIGINT BIGUINT BINARY BIT BLOB BOOL BOOLEAN CHAR CLOB COUNTER CURRENCY \ DATE DATETIME DECIMAL DOUBLE FLOAT GENERAL GUID IDENTITY IMAGE INT INT8 \ @@ -2583,12 +2677,12 @@ UInt64} {VARBINARY Binary} {VARCHAR AnsiString} {VARCHAR2 AnsiString} {YESNO\ Boolean}}} ############################################################################### -runTest {test data-1.53 {totype extension} -setup { - setupDb [set fileName data-1.53.db] +runTest {test data-1.56 {totype extension} -setup { + setupDb [set fileName data-1.56.db] } -body { set connection [getDbConnection] set result [list] $connection EnableExtensions true @@ -2612,12 +2706,12 @@ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \ {1 {} 1.01 {}}} ############################################################################### -runTest {test data-1.54 {regexp extension} -setup { - setupDb [set fileName data-1.54.db] +runTest {test data-1.57 {regexp extension} -setup { + setupDb [set fileName data-1.57.db] } -body { unset -nocomplain pattern result set connection [getDbConnection] set result(1) [list] @@ -2678,12 +2772,12 @@ reportSQLiteResources $test_channel ############################################################################### -runTest {test data-1.55 {SQLiteConnection.ReleaseMemory method} -setup { - setupDb [set fileName data-1.55.db] +runTest {test data-1.58 {SQLiteConnection.ReleaseMemory method} -setup { + setupDb [set fileName data-1.58.db] } -body { set result [list] set nFree 0; set resetOk false; set nLargest 0 set code [object invoke \ @@ -2725,12 +2819,12 @@ SQLite System.Data.SQLite} -match regexp -result {^\{Busy 0 False 0\} \{Busy\ \d+ False 0\} \{Ok 0 True \d+\}$}} ############################################################################### -runTest {test data-1.56 {percentile extension} -setup { - setupDb [set fileName data-1.56.db] +runTest {test data-1.59 {percentile extension} -setup { + setupDb [set fileName data-1.59.db] } -body { set connection [getDbConnection] set result [list] $connection EnableExtensions true