SQLC-6: ensure proper behavior of sqlcipher_export() on virtual tables (i.e. FTS3)

This commit is contained in:
Stephen Lombardo 2011-08-17 14:15:32 -04:00
parent 56fa635aff
commit 50c0ed42af

View File

@ -744,7 +744,8 @@ file delete -force test.db
# use the sqlcipher_export function
# to copy a complicated database.
# tests autoincrement fields,
# indexes, views, and triggers
# indexes, views, and triggers,
# tables and virtual tables
do_test export-database {
sqlite_orig db test.db
@ -763,16 +764,22 @@ do_test export-database {
CREATE VIEW v1 AS
SELECT c FROM t1;
CREATE VIRTUAL TABLE fts USING fts3(a,b);
BEGIN;
-- start with one known value
INSERT INTO t2 VALUES(1000000,'value 1000000');
}
for {set i 1} {$i<=1000} {incr i} {
for {set i 1} {$i<=999} {incr i} {
set r [expr {int(rand()*500000)}]
execsql "INSERT INTO t2 VALUES($i,'value $r');"
}
execsql {
INSERT INTO fts SELECT b,c FROM t1;
COMMIT;
ATTACH DATABASE 'test2.db' AS db2 KEY 'testkey2';
PRAGMA db2.cipher_page_size = 4096;
@ -793,8 +800,9 @@ do_test export-database {
INSERT INTO t2 VALUES(1001, 'value 938383');
SELECT count(*) FROM t1; -- verify the trigger worked
SELECT seq FROM sqlite_sequence WHERE name = 't1'; -- verify that autoincrement worked
SELECT a FROM fts WHERE b MATCH '1000000';
}
} {1000 1000 1 1000 1001 1001}
} {1000 1000 1 1000 1001 1001 1000000}
db close
file delete -force test.db
file delete -force test2.db