1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

Always reload the schema after a rollback. Ticket #594. (CVS 1229)

FossilOrigin-Name: 12c7a83f8e4055c4590983ef212648c781ebd963
This commit is contained in:
drh
2004-02-12 15:31:21 +00:00
parent 93581642d2
commit 8ef83ffed8
9 changed files with 69 additions and 26 deletions

View File

@ -12,7 +12,7 @@
# focus of this script is testing the ATTACH and DETACH commands
# and related functionality.
#
# $Id: attach.test,v 1.11 2003/07/18 01:25:35 drh Exp $
# $Id: attach.test,v 1.12 2004/02/12 15:31:22 drh Exp $
#
set testdir [file dirname $argv0]
@ -364,8 +364,12 @@ do_test attach-3.13 {
catchsql {UPDATE t2 SET x=x+1 WHERE x=50}
} {1 {database is locked}}
do_test attach-3.14 {
# the "database is locked" error on the previous test should have
# caused a rollback.
# Unable to reinitialize the schema tables because the aux database
# is still locked.
catchsql {SELECT * FROM t1}
} {1 {database is locked}}
do_test attach-3.15 {
execsql COMMIT db2
execsql {SELECT * FROM t1}
} {1 2 3 4}

View File

@ -12,7 +12,7 @@
# focus of this script is testing the ATTACH and DETACH commands
# and related functionality.
#
# $Id: attach2.test,v 1.4 2004/01/20 11:54:03 drh Exp $
# $Id: attach2.test,v 1.5 2004/02/12 15:31:22 drh Exp $
#
@ -108,6 +108,7 @@ do_test attach2-2.10 {
do_test attach2-2.11 {
# when the write failed in the previous test, the transaction should
# have rolled back.
db2 eval ROLLBACK
execsql {
SELECT * FROM t1
}
@ -122,7 +123,6 @@ do_test attach2-2.12 {
#
do_test attach2-3.1 {
db close
db2 eval ROLLBACK
set DB [sqlite db test.db]
set rc [catch {sqlite_compile $DB "ATTACH 'test2.db' AS t2" TAIL} VM]
if {$rc} {lappend rc $VM}

View File

@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this script is the sqlite_interrupt() API.
#
# $Id: interrupt.test,v 1.1 2004/02/12 13:02:57 drh Exp $
# $Id: interrupt.test,v 1.2 2004/02/12 15:31:22 drh Exp $
set testdir [file dirname $argv0]
@ -105,5 +105,40 @@ do_test interrupt-2.4 {
} 1
integrity_check interrupt-2.5
# Ticket #594. If an interrupt occurs in the middle of a transaction
# and that transaction is later rolled back, the internal schema tables do
# not reset.
#
for {set i 1} {$i<50} {incr i 5} {
do_test interrupt-3.$i.1 {
execsql {
BEGIN;
CREATE TEMP TABLE t2(x,y);
SELECT name FROM sqlite_temp_master;
}
} {t2}
do_test interrupt-3.$i.2 {
set ::sqlite_interrupt_count $::i
catchsql {
INSERT INTO t2 SELECT * FROM t1;
}
} {1 interrupted}
do_test interrupt-3.$i.3 {
execsql {
SELECT name FROM sqlite_temp_master;
}
} {t2}
do_test interrupt-3.$i.4 {
catchsql {
ROLLBACK
}
} {0 {}}
do_test interrupt-3.$i.5 {
catchsql {SELECT name FROM sqlite_temp_master};
execsql {
SELECT name FROM sqlite_temp_master;
}
} {}
}
finish_test