Zero the "immediate FK constraint counter" associated with a statement object when sqlite3_reset() is called. Fix for [c39ff61c43].

FossilOrigin-Name: f660be615a0c1f4641782a83744533f5d3119218
This commit is contained in:
dan
2010-04-29 22:57:56 +00:00
parent 8c6f666b26
commit 6908343c65
4 changed files with 36 additions and 19 deletions
+26
View File
@@ -1598,6 +1598,32 @@ ifcapable auth {
unset authargs
}
do_test fkey2-19.1 {
execsql {
CREATE TABLE main(id INTEGER PRIMARY KEY);
CREATE TABLE sub(id INT REFERENCES main(id));
INSERT INTO main VALUES(1);
INSERT INTO main VALUES(2);
INSERT INTO sub VALUES(2);
}
} {}
do_test fkey2-19.2 {
set S [sqlite3_prepare_v2 db "DELETE FROM main WHERE id = ?" -1 dummy]
sqlite3_bind_int $S 1 2
sqlite3_step $S
} {SQLITE_CONSTRAINT}
do_test fkey2-19.3 {
sqlite3_reset $S
} {SQLITE_CONSTRAINT}
do_test fkey2-19.4 {
sqlite3_bind_int $S 1 1
sqlite3_step $S
} {SQLITE_DONE}
do_test fkey2-19.4 {
sqlite3_finalize $S
} {SQLITE_OK}
#-------------------------------------------------------------------------
# The following block of tests, those prefixed with "fkey2-genfkey.", are
# the same tests that were used to test the ".genfkey" command provided