mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-29 08:01:23 +03:00
Test that the rollback-hook is invoked if a commit-hook implementation returns non-zero (causing a rollback). Remove documentation comment that says otherwise from sqlite.h.in.
FossilOrigin-Name: 012cf101bf8be9e39c138786ea5a5039b8131e55
This commit is contained in:
@ -334,4 +334,31 @@ do_test hook-5.2.2 {
|
||||
# End rollback-hook testing.
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Test that if a commit-hook returns non-zero (causing a rollback), the
|
||||
# rollback-hook is invoked.
|
||||
#
|
||||
proc commit_hook {} {
|
||||
lappend ::hooks COMMIT
|
||||
return 1
|
||||
}
|
||||
proc rollback_hook {} {
|
||||
lappend ::hooks ROLLBACK
|
||||
}
|
||||
do_test hook-6.1 {
|
||||
set ::hooks [list]
|
||||
db commit_hook commit_hook
|
||||
db rollback_hook rollback_hook
|
||||
catchsql {
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES('two', 'II');
|
||||
COMMIT;
|
||||
}
|
||||
execsql { SELECT * FROM t1 }
|
||||
} {one I}
|
||||
do_test hook-6.2 {
|
||||
set ::hooks
|
||||
} {COMMIT ROLLBACK}
|
||||
unset ::hooks
|
||||
|
||||
finish_test
|
||||
|
Reference in New Issue
Block a user