Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add a couple more virtual table tests. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
5b884e5199227fcfe84c4de9e42bc8ea |
User & Date: | mistachkin 2013-08-07 20:40:43.915 |
Context
2013-08-08
| ||
00:37 | Final updates for release 1.0.88.0. check-in: 4dc52a42ad user: mistachkin tags: trunk, release, release-1.0.88.0 | |
2013-08-07
| ||
23:40 | Final updates for release 1.0.88.0. Closed-Leaf check-in: 17fd4c1265 user: mistachkin tags: preRelease | |
20:40 | Add a couple more virtual table tests. check-in: 5b884e5199 user: mistachkin tags: trunk | |
03:51 | When automatically registering custom functions, use the executing assembly (i.e. System.Data.SQLite) for reference detection. Fix for [4e49a58c4c]. check-in: 80a4ab671c user: mistachkin tags: trunk | |
Changes
Changes to Tests/vtab.eagle.
︙ | ︙ | |||
104 105 106 107 108 109 110 | } -constraints \ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite\ defineConstant.System.Data.SQLite.INTEROP_VIRTUAL_TABLE} -match regexp -result \ {^Ok System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\}$}} ############################################################################### | | | | 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | } -constraints \ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite\ defineConstant.System.Data.SQLite.INTEROP_VIRTUAL_TABLE} -match regexp -result \ {^Ok System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\}$}} ############################################################################### runTest {test vtab-1.2.1 {IEnumerable virtual table} -setup { set fileName vtab-1.2.1.db } -body { set id [object invoke Interpreter.GetActive NextId] set dataSource [file join [getDatabaseDirectory] $fileName] set sql(1) { \ CREATE VIRTUAL TABLE t${id} USING mod${id}; \ } |
︙ | ︙ | |||
211 212 213 214 215 216 217 | defineConstant.System.Data.SQLite.INTEROP_VIRTUAL_TABLE} -match regexp -result \ [string map [list \n \r\n] {^Ok System#CodeDom#Compiler#CompilerResults#\d+\ \{\} 0 \{one two three 4 5\.0 Error \{SQL logic error or missing database virtual table "t\d+" is read-only\}\}$}]} ############################################################################### | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 | defineConstant.System.Data.SQLite.INTEROP_VIRTUAL_TABLE} -match regexp -result \ [string map [list \n \r\n] {^Ok System#CodeDom#Compiler#CompilerResults#\d+\ \{\} 0 \{one two three 4 5\.0 Error \{SQL logic error or missing database virtual table "t\d+" is read-only\}\}$}]} ############################################################################### runTest {test vtab-1.2.2 {IEnumerable virtual table} -setup { set fileName vtab-1.2.2.db } -body { set id [object invoke Interpreter.GetActive NextId] set dataSource [file join [getDatabaseDirectory] $fileName] set sql(1) { \ CREATE VIRTUAL TABLE t${id} USING mod${id}; \ } set sql(2) { \ SELECT * FROM t${id}; \ } set sql(3) { \ UPDATE t${id} SET x = 1; \ } unset -nocomplain results errors set code [compileCSharpWith [subst { using System; using System.Data.SQLite; using Eagle._Containers.Public; namespace _Dynamic${id} { public static class Test${id} { public static StringList GetList(params string\[\] strings) { StringList result = new StringList(); using (SQLiteConnection connection = new SQLiteConnection( "Data Source=${dataSource};")) { connection.Open(); SQLiteModule module = new SQLiteModuleEnumerable( "mod${id}", strings); connection.CreateModule(module); using (SQLiteCommand command = connection.CreateCommand()) { command.CommandText = "[subst ${sql(1)}]"; command.ExecuteNonQuery(); } using (SQLiteCommand command = connection.CreateCommand()) { command.CommandText = "[subst ${sql(2)}]"; using (SQLiteDataReader dataReader = command.ExecuteReader()) { while (dataReader.Read()) result.Add(dataReader\[0\].ToString()); } } using (SQLiteCommand command = connection.CreateCommand()) { command.CommandText = "[subst ${sql(3)}]"; try { command.ExecuteNonQuery(); } catch (SQLiteException e) { result.Add(e.ResultCode.ToString()); result.Add(e.Message); } } module.Dispose(); connection.Close(); } return result; } /////////////////////////////////////////////////////////////////////// public static void Main() { // do nothing. } } } }] true true true results errors [list System.Data.SQLite.dll Eagle.dll]] list $code $results \ [expr {[info exists errors] ? $errors : ""}] \ [expr {$code eq "Ok" ? [catch { object invoke _Dynamic${id}.Test${id} GetList one two three 4 5.0 } result] : [set result ""]}] $result } -cleanup { cleanupDb $fileName unset -nocomplain result code results errors sql dataSource id fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite\ defineConstant.System.Data.SQLite.INTEROP_VIRTUAL_TABLE} -match regexp -result \ [string map [list \n \r\n] {^Ok System#CodeDom#Compiler#CompilerResults#\d+\ \{\} 0 \{one two three 4 5\.0 Error \{SQL logic error or missing database virtual table "t\d+" is read-only\}\}$}]} ############################################################################### runTest {test vtab-1.3.1 {IEnumerable<T> virtual table} -setup { set fileName vtab-1.3.1.db } -body { set id [object invoke Interpreter.GetActive NextId] set dataSource [file join [getDatabaseDirectory] $fileName] set sql(1) { \ CREATE VIRTUAL TABLE t${id} USING mod${id}; \ } |
︙ | ︙ | |||
287 288 289 290 291 292 293 294 295 296 297 298 299 300 | result.Add(e.ResultCode.ToString()); result.Add(e.Message); } } connection.Close(); } return result; } /////////////////////////////////////////////////////////////////////// public static void Main() | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 | result.Add(e.ResultCode.ToString()); result.Add(e.Message); } } connection.Close(); } return result; } /////////////////////////////////////////////////////////////////////// public static void Main() { // do nothing. } } } }] true true true results errors [list System.Data.SQLite.dll Eagle.dll]] list $code $results \ [expr {[info exists errors] ? $errors : ""}] \ [expr {$code eq "Ok" ? [catch { object invoke _Dynamic${id}.Test${id} GetList 1 2 3 4 5 } result] : [set result ""]}] $result } -cleanup { cleanupDb $fileName unset -nocomplain result code results errors sql dataSource id fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite\ defineConstant.System.Data.SQLite.INTEROP_VIRTUAL_TABLE} -match regexp -result \ [string map [list \n \r\n] {^Ok System#CodeDom#Compiler#CompilerResults#\d+\ \{\} 0 \{1 2 3 4 5 Error \{SQL logic error or missing database virtual table "t\d+" is read-only\}\}$}]} ############################################################################### runTest {test vtab-1.3.2 {IEnumerable<T> virtual table} -setup { set fileName vtab-1.3.2.db } -body { set id [object invoke Interpreter.GetActive NextId] set dataSource [file join [getDatabaseDirectory] $fileName] set sql(1) { \ CREATE VIRTUAL TABLE t${id} USING mod${id}; \ } set sql(2) { \ SELECT * FROM t${id}; \ } set sql(3) { \ UPDATE t${id} SET x = 1; \ } unset -nocomplain results errors set code [compileCSharpWith [subst { using System; using System.Data.SQLite; using System.Data.SQLite.Generic; using Eagle._Containers.Public; namespace _Dynamic${id} { public static class Test${id} { public static StringList GetList(params int\[\] integers) { StringList result = new StringList(); using (SQLiteConnection connection = new SQLiteConnection( "Data Source=${dataSource};")) { connection.Open(); SQLiteModule module = new SQLiteModuleEnumerable<int>( "mod${id}", integers); connection.CreateModule(module); using (SQLiteCommand command = connection.CreateCommand()) { command.CommandText = "[subst ${sql(1)}]"; command.ExecuteNonQuery(); } using (SQLiteCommand command = connection.CreateCommand()) { command.CommandText = "[subst ${sql(2)}]"; using (SQLiteDataReader dataReader = command.ExecuteReader()) { while (dataReader.Read()) result.Add(dataReader\[0\].ToString()); } } using (SQLiteCommand command = connection.CreateCommand()) { command.CommandText = "[subst ${sql(3)}]"; try { command.ExecuteNonQuery(); } catch (SQLiteException e) { result.Add(e.ResultCode.ToString()); result.Add(e.Message); } } module.Dispose(); connection.Close(); } return result; } /////////////////////////////////////////////////////////////////////// public static void Main() |
︙ | ︙ |