mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-05-19 12:08:23 -05:00
Fix attaching an unencrypted database to an encrypted database
When opening a plain database and trying to attach an unencrypted database we need to explicitly specify that there is no key for the attached database. Otherwise SQLCipher is going to use the same key as for the main database which results in an error. See issue #1814.
This commit is contained in:
@@ -249,6 +249,8 @@ bool DBBrowserDB::attach(const QString& filePath, QString attach_as)
|
||||
QString key;
|
||||
if(cipherSettings && is_encrypted)
|
||||
key = "KEY " + cipherSettings->getPassword();
|
||||
else
|
||||
key = "KEY ''";
|
||||
|
||||
if(!executeSQL(QString("ATTACH '%1' AS %2 %3").arg(filePath).arg(sqlb::escapeIdentifier(attach_as)).arg(key), false))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user