savepoint5.test 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. # 2009 January 2
  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. # Verify that a SAVEPOINT on a new, empty database followed by a
  13. # ROLLBACK TO that savepoint starts over again with another new
  14. # empty database.
  15. #
  16. # $Id: savepoint5.test,v 1.1 2009/01/02 21:08:09 drh Exp $
  17. set testdir [file dirname $argv0]
  18. source $testdir/tester.tcl
  19. do_test savepoint5-1.1 {
  20. db eval {
  21. SAVEPOINT sp1;
  22. CREATE TABLE t1(x);
  23. INSERT INTO t1 VALUES(1);
  24. SELECT count(*) FROM sqlite_master;
  25. SELECT * FROM t1;
  26. }
  27. } {1 1}
  28. do_test savepoint5-1.2 {
  29. db eval {
  30. ROLLBACK TO sp1;
  31. SELECT count(*) FROM sqlite_master;
  32. }
  33. } {0}
  34. do_test savepoint5-1.3 {
  35. db eval {
  36. CREATE TABLE t1(x);
  37. INSERT INTO t1 VALUES(1);
  38. SELECT count(*) FROM sqlite_master;
  39. SELECT * FROM t1;
  40. }
  41. } {1 1}
  42. finish_test