Skip to content

Commit

Permalink
Attach new codec before btree copy
Browse files Browse the repository at this point in the history
  • Loading branch information
developernotes committed Jul 29, 2013
1 parent 9b415f6 commit f844a5d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/crypto_impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -979,8 +979,9 @@ int sqlcipher_codec_ctx_migrate(codec_ctx *ctx) {
assert( 1==sqlite3BtreeIsInTrans(pDest) );
assert( 1==sqlite3BtreeIsInTrans(pSrc) );


sqlite3CodecGetKey(db, db->nDb - 1, (void**)&key, &password_sz);
sqlcipher_codec_ctx_set_pass(ctx, key, password_sz, 2);
sqlite3CodecAttach(db, 0, key, password_sz);

int i = 0;
for(i=0; i<ArraySize(aCopy); i+=2){
Expand All @@ -997,7 +998,6 @@ int sqlcipher_codec_ctx_migrate(codec_ctx *ctx) {
db->nChange = saved_nChange;
db->nTotalChange = saved_nTotalChange;
db->xTrace = saved_xTrace;
sqlite3BtreeSetPageSize(pDest, -1, -1, 1);
db->autoCommit = 1;
if( pDb ){
sqlite3BtreeClose(pDb->pBt);
Expand Down

0 comments on commit f844a5d

Please sign in to comment.