Add test to key multiple databases with pragma using different keys

This commit is contained in:
Nick Parker 2013-08-30 15:47:48 -05:00
parent 7a6ce37e61
commit 2cb820717e
1 changed files with 26 additions and 0 deletions

View File

@ -2064,6 +2064,32 @@ db close
file delete -force test.db file delete -force test.db
file delete -force new.db file delete -force new.db
do_test key-multiple-databases-with-different-keys-using-pragma {
sqlite_orig db test.db
execsql {
pragma key = 'foobar';
create table t1(a,b);
insert into t1(a,b) values('baz','qux');
attach database 'new.db' as new;
pragma new.key = 'foo';
create table new.t1(a,b);
insert into new.t1(a,b) values('foo', 'bar');
detach database new;
}
db close
sqlite_orig db new.db
execsql {
pragma key = 'foo';
attach database 'test.db' as test key 'foobar';
select * from t1;
select * from test.t1;
}
} {foo bar baz qux}
db close
file delete -force test.db
file delete -force new.db
do_test rekey-database-by-name { do_test rekey-database-by-name {
sqlite_orig db test.db sqlite_orig db test.db
execsql { execsql {