Using cache_size before sqlite3_key

Hi

Is it necessary to execute ordinary sqllite program statement after calling sqlite3_key method?

I tried to call “pragma cache_size” before calling sqlite3_key on existing database but it gives me"SQLError (26) [File opened that is not a database file ] when executing first query statement on the database.

Hello @mabdelazim

In this case, setting the PRAGMA cache_size operates directly on the underlying btree within SQLCipher. When a btree is opened in SQLCipher, it causes the pager to reader the file header. If a key has not been provided prior to this operation, the database file can not be decrypted and you will receive the error message above.