xref: /sqlite-3.40.0/test/savepoint5.test (revision 9f0bbf9c)
1*9f0bbf9cSdrh# 2009 January 2
2*9f0bbf9cSdrh#
3*9f0bbf9cSdrh# The author disclaims copyright to this source code.  In place of
4*9f0bbf9cSdrh# a legal notice, here is a blessing:
5*9f0bbf9cSdrh#
6*9f0bbf9cSdrh#    May you do good and not evil.
7*9f0bbf9cSdrh#    May you find forgiveness for yourself and forgive others.
8*9f0bbf9cSdrh#    May you share freely, never taking more than you give.
9*9f0bbf9cSdrh#
10*9f0bbf9cSdrh#***********************************************************************
11*9f0bbf9cSdrh#
12*9f0bbf9cSdrh# Verify that a SAVEPOINT on a new, empty database followed by a
13*9f0bbf9cSdrh# ROLLBACK TO that savepoint starts over again with another new
14*9f0bbf9cSdrh# empty database.
15*9f0bbf9cSdrh#
16*9f0bbf9cSdrh# $Id: savepoint5.test,v 1.1 2009/01/02 21:08:09 drh Exp $
17*9f0bbf9cSdrh
18*9f0bbf9cSdrhset testdir [file dirname $argv0]
19*9f0bbf9cSdrhsource $testdir/tester.tcl
20*9f0bbf9cSdrh
21*9f0bbf9cSdrhdo_test savepoint5-1.1 {
22*9f0bbf9cSdrh  db eval {
23*9f0bbf9cSdrh    SAVEPOINT sp1;
24*9f0bbf9cSdrh    CREATE TABLE t1(x);
25*9f0bbf9cSdrh    INSERT INTO t1 VALUES(1);
26*9f0bbf9cSdrh    SELECT count(*) FROM sqlite_master;
27*9f0bbf9cSdrh    SELECT * FROM t1;
28*9f0bbf9cSdrh  }
29*9f0bbf9cSdrh} {1 1}
30*9f0bbf9cSdrhdo_test savepoint5-1.2 {
31*9f0bbf9cSdrh  db eval {
32*9f0bbf9cSdrh    ROLLBACK TO sp1;
33*9f0bbf9cSdrh    SELECT count(*) FROM sqlite_master;
34*9f0bbf9cSdrh  }
35*9f0bbf9cSdrh} {0}
36*9f0bbf9cSdrhdo_test savepoint5-1.3 {
37*9f0bbf9cSdrh  db eval {
38*9f0bbf9cSdrh    CREATE TABLE t1(x);
39*9f0bbf9cSdrh    INSERT INTO t1 VALUES(1);
40*9f0bbf9cSdrh    SELECT count(*) FROM sqlite_master;
41*9f0bbf9cSdrh    SELECT * FROM t1;
42*9f0bbf9cSdrh  }
43*9f0bbf9cSdrh} {1 1}
44*9f0bbf9cSdrh
45*9f0bbf9cSdrh
46*9f0bbf9cSdrhfinish_test
47