1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-12-24 14:17:58 +03:00

Add a reference counter to a structure used internally by the Tcl interface so that it does not segfault if the database connection is closed from any of the various callback scripts that may be invoked.

FossilOrigin-Name: e54a33ce56432b23947583d34cf12fc64a55bbc49eb77c7f33cff5926df51070
This commit is contained in:
dan
2021-09-16 14:17:14 +00:00
parent eb56e29053
commit bea28c73a3
4 changed files with 123 additions and 61 deletions

View File

@@ -848,4 +848,40 @@ do_catchsql_test 19.911 {
} {1 {invalid command name "bind_fallback_does_not_exist"}}
db bind_fallback {}
#-------------------------------------------------------------------------
do_test 20.0 {
db transaction {
db close
}
} {}
do_test 20.1 {
sqlite3 db test.db
set rc [catch {
db eval {SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3} { db close }
} msg]
list $rc $msg
} {1 {invalid command name "db"}}
proc closedb {} {
db close
return 10
}
proc func1 {} { return 1 }
sqlite3 db test.db
db func closedb closedb
db func func1 func1
do_test 20.2 {
set rc [catch {
db eval {
SELECT closedb(),func1() UNION ALL SELECT 20,30 UNION ALL SELECT 30,40
}
} msg]
list $rc $msg
} {0 {10 1 20 30 30 40}}
finish_test