1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

Experimental change to include changes made to the sqlite_stat1 table in

changesets generated by the sessions module. sqlite_stat1 entries in such
changesets are ignored by legacy clients.

FossilOrigin-Name: bd46c4429693545eb16db85692fc591ac529796aa746f5f21df1ce4380619320
This commit is contained in:
dan
2018-01-12 16:44:29 +00:00
parent f225059b8b
commit 614efe2b4b
10 changed files with 231 additions and 16 deletions

View File

@ -906,5 +906,56 @@ do_preupdate_test 10.3 {
DELETE FROM t3 WHERE b=1
} {DELETE main t3 1 1 0 {} 1}
#-------------------------------------------------------------------------
# Test that the "update" hook is not fired for operations on the
# sqlite_stat1 table performed by ANALYZE, even if a pre-update hook is
# registered.
ifcapable analyze {
reset_db
do_execsql_test 11.1 {
CREATE TABLE t1(a, b);
CREATE INDEX idx1 ON t1(a);
CREATE INDEX idx2 ON t1(b);
INSERT INTO t1 VALUES(1, 2);
INSERT INTO t1 VALUES(3, 4);
INSERT INTO t1 VALUES(5, 6);
INSERT INTO t1 VALUES(7, 8);
}
db preupdate hook preupdate_cb
db update_hook update_cb
proc preupdate_cb {args} { lappend ::res "preupdate" $args }
proc update_cb {args} { lappend ::res "update" $args }
set ::res [list]
do_test 11.2 {
execsql ANALYZE
set ::res
} [list {*}{
preupdate {INSERT main sqlite_stat1 1 1}
preupdate {INSERT main sqlite_stat1 2 2}
}]
do_execsql_test 11.3 {
INSERT INTO t1 VALUES(9, 10);
INSERT INTO t1 VALUES(11, 12);
INSERT INTO t1 VALUES(13, 14);
INSERT INTO t1 VALUES(15, 16);
}
set ::res [list]
do_test 11.4 {
execsql ANALYZE
set ::res
} [list {*}{
preupdate {DELETE main sqlite_stat1 1 1}
preupdate {DELETE main sqlite_stat1 2 2}
preupdate {INSERT main sqlite_stat1 1 1}
preupdate {INSERT main sqlite_stat1 2 2}
}]
}
finish_test