rbuB.test 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. # 2014 August 30
  2. #
  3. # The author disclaims copyright to this source code. In place of
  4. # a legal notice, here is a blessing:
  5. #
  6. # May you do good and not evil.
  7. # May you find forgiveness for yourself and forgive others.
  8. # May you share freely, never taking more than you give.
  9. #
  10. #***********************************************************************
  11. #
  12. #
  13. source [file join [file dirname [info script]] rbu_common.tcl]
  14. if_no_rbu_support { finish_test ; return }
  15. set ::testprefix rbuB
  16. db close
  17. sqlite3_shutdown
  18. test_sqlite3_log xLog
  19. reset_db
  20. proc xLog {args} { }
  21. set db_sql {
  22. CREATE TABLE t1(a PRIMARY KEY, b, c);
  23. }
  24. set rbu_sql {
  25. CREATE TABLE data_t1(a, b, c, rbu_control);
  26. INSERT INTO data_t1 VALUES(1, 2, 3, 0);
  27. INSERT INTO data_t1 VALUES(4, 5, 6, 0);
  28. INSERT INTO data_t1 VALUES(7, 8, 9, 0);
  29. }
  30. do_test 1.1 {
  31. forcedelete rbu.db
  32. sqlite3 rbu rbu.db
  33. rbu eval $rbu_sql
  34. rbu close
  35. db eval $db_sql
  36. } {}
  37. set ::errlog [list]
  38. proc xLog {err msg} { lappend ::errlog $err }
  39. do_test 1.2 {
  40. run_rbu test.db rbu.db
  41. } {SQLITE_DONE}
  42. do_test 1.3 {
  43. set ::errlog
  44. } {SQLITE_NOTICE_RECOVER_WAL SQLITE_NOTICE_RBU}
  45. do_execsql_test 1.4 {
  46. SELECT * FROM t1
  47. } {1 2 3 4 5 6 7 8 9}
  48. db close
  49. sqlite3_shutdown
  50. test_sqlite3_log
  51. sqlite3_initialize
  52. finish_test