1 # 2009 July 19 2 # 3 # May you do good and not evil. 4 # May you find forgiveness for yourself and forgive others. 5 # May you share freely, never taking more than you give. 6 # 7 #*********************************************************************** 8 # This file tests that asynchronous IO is compatible with multi-file 9 # transactions. 10 # 11 # $Id: async5.test,v 1.1 2009/07/18 11:52:04 danielk1977 Exp $ 12 13 set testdir [file dirname $argv0] 14 source $testdir/tester.tcl 15 16 if {[info commands sqlite3async_initialize] eq ""} { 17 # The async logic is not built into this system 18 finish_test 19 return 20 } 21 22 db close 23 file delete -force test2.db 24 sqlite3async_initialize "" 1 25 sqlite3async_control halt never 26 sqlite3 db test.db 27 28 do_test async5-1.1 { 29 execsql { 30 ATTACH 'test2.db' AS next; 31 CREATE TABLE main.t1(a, b); 32 CREATE TABLE next.t2(a, b); 33 BEGIN; 34 INSERT INTO t1 VALUES(1, 2); 35 INSERT INTO t2 VALUES(3, 4); 36 COMMIT; 37 } 38 } {} 39 do_test async5-1.2 { 40 execsql { SELECT * FROM t1 } 41 } {1 2} 42 do_test async5-1.3 { 43 execsql { SELECT * FROM t2 } 44 } {3 4} 45 do_test async5-1.4 { 46 execsql { 47 BEGIN; 48 INSERT INTO t1 VALUES('a', 'b'); 49 INSERT INTO t2 VALUES('c', 'd'); 50 COMMIT; 51 } 52 } {} 53 do_test async5-1.5 { 54 execsql { SELECT * FROM t1 } 55 } {1 2 a b} 56 do_test async5-1.6 { 57 execsql { SELECT * FROM t2 } 58 } {3 4 c d} 59 60 db close 61 62 sqlite3async_control halt idle 63 sqlite3async_start 64 sqlite3async_wait 65 sqlite3async_control halt never 66 sqlite3async_shutdown 67 set sqlite3async_trace 0 68 finish_test 69 70