async5.test 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. set testdir [file dirname $argv0]
  13. source $testdir/tester.tcl
  14. if {[info commands sqlite3async_initialize] eq ""} {
  15. # The async logic is not built into this system
  16. finish_test
  17. return
  18. }
  19. db close
  20. forcedelete test2.db
  21. sqlite3async_initialize "" 1
  22. sqlite3async_control halt never
  23. sqlite3 db test.db
  24. do_test async5-1.1 {
  25. execsql {
  26. ATTACH 'test2.db' AS next;
  27. CREATE TABLE main.t1(a, b);
  28. CREATE TABLE next.t2(a, b);
  29. BEGIN;
  30. INSERT INTO t1 VALUES(1, 2);
  31. INSERT INTO t2 VALUES(3, 4);
  32. COMMIT;
  33. }
  34. } {}
  35. do_test async5-1.2 {
  36. execsql { SELECT * FROM t1 }
  37. } {1 2}
  38. do_test async5-1.3 {
  39. execsql { SELECT * FROM t2 }
  40. } {3 4}
  41. do_test async5-1.4 {
  42. execsql {
  43. BEGIN;
  44. INSERT INTO t1 VALUES('a', 'b');
  45. INSERT INTO t2 VALUES('c', 'd');
  46. COMMIT;
  47. }
  48. } {}
  49. do_test async5-1.5 {
  50. execsql { SELECT * FROM t1 }
  51. } {1 2 a b}
  52. do_test async5-1.6 {
  53. execsql { SELECT * FROM t2 }
  54. } {3 4 c d}
  55. db close
  56. sqlite3async_control halt idle
  57. sqlite3async_start
  58. sqlite3async_wait
  59. sqlite3async_control halt never
  60. sqlite3async_shutdown
  61. set sqlite3async_trace 0
  62. finish_test