Update the sqldiff tool so that it generates an rbu_count table.
FossilOrigin-Name: 1f7afb6e9be9f549a91bf2ab492df15698df89fd
This commit is contained in:
@@ -36,6 +36,7 @@ proc step_rbu {target rbu} {
|
||||
}
|
||||
|
||||
proc apply_rbudiff {sql target} {
|
||||
test_rbucount $sql
|
||||
forcedelete rbu.db
|
||||
sqlite3 rbudb rbu.db
|
||||
rbudb eval $sql
|
||||
@@ -43,6 +44,27 @@ proc apply_rbudiff {sql target} {
|
||||
step_rbu $target rbu.db
|
||||
}
|
||||
|
||||
# The only argument is the output of an [sqldiff -rbu] run. This command
|
||||
# tests that the contents of the rbu_count table is correct. An exception
|
||||
# is thrown if it is not.
|
||||
#
|
||||
proc test_rbucount {sql} {
|
||||
sqlite3 tmpdb ""
|
||||
tmpdb eval $sql
|
||||
tmpdb eval {
|
||||
SELECT name FROM sqlite_master WHERE name LIKE 'data%' AND type='table'
|
||||
} {
|
||||
set a [tmpdb eval "SELECT count(*) FROM $name"]
|
||||
set b [tmpdb eval {SELECT cnt FROM rbu_count WHERE tbl = $name}]
|
||||
if {$a != $b} {
|
||||
tmpdb close
|
||||
error "rbu_count error - tbl = $name"
|
||||
}
|
||||
}
|
||||
tmpdb close
|
||||
return ""
|
||||
}
|
||||
|
||||
proc rbudiff_cksum {db1} {
|
||||
set txt ""
|
||||
|
||||
|
||||
@@ -381,6 +381,16 @@ foreach {bReopen} { 0 1 } {
|
||||
}
|
||||
{2500 4000 6000 8000 10000}
|
||||
{5000 10000}
|
||||
|
||||
3 {
|
||||
CREATE TABLE data0_t1(rbu_rowid, a, b, c, rbu_control);
|
||||
INSERT INTO data0_t1 VALUES(1, NULL, NULL, NULL, 1);
|
||||
INSERT INTO data0_t1 VALUES(2, NULL, NULL, 7, '..x');
|
||||
CREATE TABLE rbu_count(tbl, cnt);
|
||||
INSERT INTO rbu_count VALUES('data0_t1', 2);
|
||||
}
|
||||
{2500 4000 6000 8000 10000}
|
||||
{5000 10000}
|
||||
} {
|
||||
|
||||
reset_db ; execsql $tbl
|
||||
|
||||
Reference in New Issue
Block a user