1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-27 20:41:58 +03:00

Add a new sqlite3_is_interrupted() interface that can be used by long-running

app-defined functions and similar to see if they need to exit early due to
an sqlite3_interrupt() call.

FossilOrigin-Name: d030f341369b7f32789cbcf3d0ad9a2ac5cad99a56dac7dfe68b7f06dc339b17
This commit is contained in:
drh
2023-01-11 00:27:06 +00:00
parent 706631de32
commit 3b7a19b033
8 changed files with 81 additions and 17 deletions

View File

@ -94,14 +94,28 @@ ifcapable {vacuum && !default_autovacuum} {
} 1
}
ifcapable {explain} {
do_test interrupt-2.5 {
do_test interrupt-2.5.1 {
sqlite3_is_interrupted $DB
} {0}
do_test interrupt-2.5.2 {
unset -nocomplain ::interrupt_count
set ::interrupt_count 0
set sql {EXPLAIN SELECT max(a,b), a, b FROM t1}
execsql $sql
set rc [catch {db eval $sql {sqlite3_interrupt $DB}} msg]
set rc [catch {db eval $sql {
sqlite3_interrupt $DB;
incr ::interrupt_count [sqlite3_is_interrupted $DB];
}} msg]
lappend rc $msg
} {1 interrupted}
do_test interrupt-2.5.3 {
set ::interrupt_count
} {1}
}
integrity_check interrupt-2.6
do_test interrupt-2.7 {
sqlite3_is_interrupted $DB
} {0}
# Ticket #594. If an interrupt occurs in the middle of a transaction
# and that transaction is later rolled back, the internal schema tables do