Description
A few days ago an issue was opened for my wxSQLite3 component regarding the use of rekey
for a memory database. As mentioned on the SQLite SEE documentation page in-memory databases are not encrypted (using PRAGMA key='passphrase';
has absolutely no effect). The user was satisfied with that information and simply removed the call to the rekey function that was causing problems for him.
However, IMHO the current behaviour of the key and rekey functions if called accidentally for in-memory databases can cause problems and should therefore be addressed.
The problem affects not only wxSQLite3, but also sqleet, as can be verified by executing the following SQL command sequence in the sqleet shell:
.open :memory:
create table t1 (c1 int, c2 char);
insert into t1 values (1,'A text value');
pragma rekey='test';
select * from t1;
The last select command results in displaying Error: file is not a database
.
I have not yet tracked down from where this error results. All I can say is that the page encryption/decryption function is never called while executing rekey.
AFAICT not only in-memory databases, but also temporary databases are affected. The question is how wxSQLite3 and sqleet should behave under those circumstances. Should the key and rekey functions detect whether they operate on an in-memory or temporary database and silently do nothing? Or should they issue an error message? What's your opinion?
Activity