Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add experimental test for ticket [343d392b51] (so far, no exception is raised). |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | tkt-343d392b51 |
Files: | files | file ages | folders |
SHA1: |
6c53fbe92c3348234517f6fe0fa249b3 |
User & Date: | mistachkin 2011-09-29 04:45:17.195 |
Context
2011-10-06
| ||
05:28 | Merge with trunk. check-in: 3ab8344ffc user: mistachkin tags: tkt-343d392b51 | |
2011-09-29
| ||
04:45 | Add experimental test for ticket [343d392b51] (so far, no exception is raised). check-in: 6c53fbe92c user: mistachkin tags: tkt-343d392b51 | |
04:43 | Allow the various binary file delete/copy/load operations to be skipped during the test prologue (for the System.Data.SQLite related binaries). check-in: d2e601c947 user: mistachkin tags: trunk | |
Changes
Added Tests/tkt-343d392b51.eagle.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | ############################################################################### # # tkt-343d392b51.eagle -- # # Written by Joe Mistachkin. # Released to the public domain, use at your own risk! # ############################################################################### package require Eagle package require EagleLibrary package require EagleTest runTestPrologue ############################################################################### package require System.Data.SQLite.Test runSQLiteTestPrologue ############################################################################### runTest {test tkt-343d392b51-1.1 {SQLiteDataAdapter batch updates} -setup { setupDb [set fileName tkt-343d392b51-1.1.db] set otherFileName tkt-343d392b51-1.1-otherDb.db } -body { set id [object invoke Interpreter.GetActive NextId] set dataSource [file join [getTemporaryPath] $fileName] set otherDataSource [file join [getTemporaryPath] $otherFileName] set otherDbName otherDb set table [appendArgs $otherDbName .t1] set sql(1) [subst { \ ATTACH DATABASE '${otherDataSource}' AS ${otherDbName}; \ CREATE TABLE ${table}(x INTEGER PRIMARY KEY, y); \ [for {set i 1} {$i < 200} {incr i} { append sql(inserts) \ "INSERT INTO ${table} (x, y) VALUES($i, '$i'); " }; return [expr {[info exists sql(inserts)] ? $sql(inserts) : ""}]] \ }] set sql(2) [subst { \ SELECT x, y FROM ${table} ORDER BY x; \ }] unset -nocomplain results errors set code [compileCSharpWith [subst { using System.Data; using System.Data.SQLite; namespace _Dynamic${id} { public class Test${id} { public static void Main() { using (SQLiteConnection connection = new SQLiteConnection( "Data Source=${dataSource};")) { connection.Open(); using (SQLiteCommand command = connection.CreateCommand()) { command.CommandText = "${sql(1)}"; command.ExecuteNonQuery(); } using (SQLiteDataAdapter dataAdapter = new SQLiteDataAdapter( "${sql(2)}", connection)) { using (DataSet dataSet = new DataSet()) { dataAdapter.Fill(dataSet, "${table}"); DataTable dataTable = dataSet.Tables\["${table}"\]; dataTable.Columns\["x"\].Unique = true; dataTable.PrimaryKey = new DataColumn\[\] { dataTable.Columns\["x"\] }; SQLiteCommandBuilder commandBuilder = new SQLiteCommandBuilder(dataAdapter); foreach (DataRow dataRow in dataTable.Rows) { // // NOTE: Update even rows and delete odd rows. // if ((long)dataRow\["x"\] % 2 == 0) dataRow\["y"\] = "zero"; else dataRow.Delete(); } dataAdapter.Update(dataTable); // DBConcurrencyException (?) } } } } } } }] results errors System.Data.SQLite.dll] list $code $results \ [expr {[info exists errors] ? $errors : ""}] \ [expr {$code eq "Ok" ? [catch { object invoke _Dynamic${id}.Test${id} Main } result] : [set result ""]}] $result } -cleanup { cleanupDb $otherFileName cleanupDb $fileName unset -nocomplain result code results errors i sql table otherDbName \ otherDataSource dataSource id db otherFileName fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA System.Data.SQLite} -match regexp \ -result {^Ok System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\}$}} ############################################################################### runSQLiteTestEpilogue runTestEpilogue |