Home | History | Annotate | Download | only in test
      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 
     18 set testdir [file dirname $argv0]
     19 source $testdir/tester.tcl
     20 
     21 do_test savepoint5-1.1 {
     22   db eval {
     23     SAVEPOINT sp1;
     24     CREATE TABLE t1(x);
     25     INSERT INTO t1 VALUES(1);
     26     SELECT count(*) FROM sqlite_master;
     27     SELECT * FROM t1;
     28   }
     29 } {1 1}
     30 do_test savepoint5-1.2 {
     31   db eval {
     32     ROLLBACK TO sp1;
     33     SELECT count(*) FROM sqlite_master;
     34   }
     35 } {0}
     36 do_test savepoint5-1.3 {
     37   db eval {
     38     CREATE TABLE t1(x);
     39     INSERT INTO t1 VALUES(1);
     40     SELECT count(*) FROM sqlite_master;
     41     SELECT * FROM t1;
     42   }
     43 } {1 1}
     44 
     45 
     46 finish_test
     47