From 50c0ed42afd86692519097b5aa37e8731acfa9b8 Mon Sep 17 00:00:00 2001 From: Stephen Lombardo Date: Wed, 17 Aug 2011 14:15:32 -0400 Subject: [PATCH] SQLC-6: ensure proper behavior of sqlcipher_export() on virtual tables (i.e. FTS3) --- test/crypto.test | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/test/crypto.test b/test/crypto.test index 5f56719..71604d8 100644 --- a/test/crypto.test +++ b/test/crypto.test @@ -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