2008-12-18 21:31:38 +03:00
|
|
|
# 2008 December 15
|
|
|
|
#
|
|
|
|
# The author disclaims copyright to this source code. In place of
|
|
|
|
# a legal notice, here is a blessing:
|
|
|
|
#
|
|
|
|
# May you do good and not evil.
|
|
|
|
# May you find forgiveness for yourself and forgive others.
|
|
|
|
# May you share freely, never taking more than you give.
|
|
|
|
#
|
|
|
|
#***********************************************************************
|
|
|
|
#
|
2009-01-07 11:12:16 +03:00
|
|
|
# $Id: savepoint3.test,v 1.3 2009/01/07 08:12:16 danielk1977 Exp $
|
2008-12-18 21:31:38 +03:00
|
|
|
|
|
|
|
set testdir [file dirname $argv0]
|
|
|
|
source $testdir/tester.tcl
|
|
|
|
|
|
|
|
source $testdir/malloc_common.tcl
|
|
|
|
|
|
|
|
do_malloc_test savepoint3-1 -sqlprep {
|
|
|
|
CREATE TABLE t1(a, b, c);
|
|
|
|
INSERT INTO t1 VALUES(1, 2, 3);
|
|
|
|
} -sqlbody {
|
|
|
|
SAVEPOINT one;
|
|
|
|
INSERT INTO t1 VALUES(4, 5, 6);
|
|
|
|
SAVEPOINT two;
|
|
|
|
DELETE FROM t1;
|
|
|
|
ROLLBACK TO two;
|
|
|
|
RELEASE one;
|
|
|
|
}
|
|
|
|
|
2009-01-01 18:20:37 +03:00
|
|
|
do_malloc_test savepoint3-2 -sqlprep {
|
2008-12-18 21:31:38 +03:00
|
|
|
PRAGMA cache_size = 10;
|
|
|
|
CREATE TABLE t1(a, b, c);
|
|
|
|
INSERT INTO t1 VALUES(randstr(400,400), randstr(400,400), randstr(400,400));
|
|
|
|
INSERT INTO t1 SELECT
|
|
|
|
randstr(400,400), randstr(400,400), randstr(400,400) FROM t1;
|
|
|
|
INSERT INTO t1
|
|
|
|
SELECT randstr(400,400), randstr(400,400), randstr(400,400) FROM t1;
|
|
|
|
INSERT INTO t1
|
|
|
|
SELECT randstr(400,400), randstr(400,400), randstr(400,400) FROM t1;
|
|
|
|
INSERT INTO t1
|
|
|
|
SELECT randstr(400,400), randstr(400,400), randstr(400,400) FROM t1;
|
|
|
|
INSERT INTO t1
|
|
|
|
SELECT randstr(400,400), randstr(400,400), randstr(400,400) FROM t1;
|
|
|
|
INSERT INTO t1
|
|
|
|
SELECT randstr(400,400), randstr(400,400), randstr(400,400) FROM t1;
|
|
|
|
INSERT INTO t1
|
|
|
|
SELECT randstr(400,400), randstr(400,400), randstr(400,400) FROM t1;
|
|
|
|
INSERT INTO t1
|
|
|
|
SELECT randstr(400,400), randstr(400,400), randstr(400,400) FROM t1;
|
|
|
|
} -sqlbody {
|
|
|
|
PRAGMA cache_size = 10;
|
|
|
|
SAVEPOINT one;
|
|
|
|
DELETE FROM t1 WHERE rowid < 5;
|
|
|
|
SAVEPOINT two;
|
|
|
|
DELETE FROM t1 WHERE rowid > 10;
|
|
|
|
ROLLBACK TO two;
|
|
|
|
ROLLBACK TO one;
|
|
|
|
RELEASE one;
|
|
|
|
}
|
|
|
|
|
2009-01-07 11:12:16 +03:00
|
|
|
do_ioerr_test savepoint3.3 -sqlprep {
|
|
|
|
CREATE TABLE t1(a, b, c);
|
|
|
|
INSERT INTO t1 VALUES(1, randstr(1000,1000), randstr(1000,1000));
|
|
|
|
INSERT INTO t1 VALUES(2, randstr(1000,1000), randstr(1000,1000));
|
|
|
|
} -sqlbody {
|
|
|
|
BEGIN;
|
|
|
|
UPDATE t1 SET a = 3 WHERE a = 1;
|
|
|
|
SAVEPOINT one;
|
|
|
|
UPDATE t1 SET a = 4 WHERE a = 2;
|
|
|
|
COMMIT;
|
|
|
|
} -cleanup {
|
|
|
|
db eval {
|
|
|
|
SAVEPOINT one;
|
|
|
|
RELEASE one;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-12-18 21:31:38 +03:00
|
|
|
finish_test
|
|
|
|
|