mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-29 08:01:23 +03:00
Have queries interrupted by the progress-handler return SQLITE_INTERRUPT. Rollback any active transaction if a DML statement returns SQLITE_INTERRUPT. (CVS 4061)
FossilOrigin-Name: 33454b5691637da7ded7d18d7f5726b796260c6b
This commit is contained in:
@ -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.14 2007/05/15 16:51:37 drh Exp $
|
||||
# $Id: interrupt.test,v 1.15 2007/06/13 16:49:49 danielk1977 Exp $
|
||||
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
@ -122,6 +122,10 @@ integrity_check interrupt-2.6
|
||||
# and that transaction is later rolled back, the internal schema tables do
|
||||
# not reset.
|
||||
#
|
||||
# UPDATE: Interrupting a DML statement in the middle of a transaction now
|
||||
# causes the transaction to roll back. Leaving the transaction open after
|
||||
# an SQL statement was interrupted halfway through risks database corruption.
|
||||
#
|
||||
ifcapable tempdb {
|
||||
for {set i 1} {$i<50} {incr i 5} {
|
||||
do_test interrupt-3.$i.1 {
|
||||
@ -141,12 +145,12 @@ ifcapable tempdb {
|
||||
execsql {
|
||||
SELECT name FROM sqlite_temp_master;
|
||||
}
|
||||
} {t2}
|
||||
} {}
|
||||
do_test interrupt-3.$i.4 {
|
||||
catchsql {
|
||||
ROLLBACK
|
||||
}
|
||||
} {0 {}}
|
||||
} {1 {cannot rollback - no transaction is active}}
|
||||
do_test interrupt-3.$i.5 {
|
||||
catchsql {SELECT name FROM sqlite_temp_master};
|
||||
execsql {
|
||||
|
Reference in New Issue
Block a user