mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-05-08 12:59:52 -05:00
Fix attaching not encrypted databases in the SQLCipher build
Even when trying to attach a non-encrypted database in the SQLCipher build we would try to give a passphrase - though an empty one. This yields an invalid SQL statement, so attaching would never work. This is fixed by this commit. See issue #1088.
This commit is contained in:
+3
-2
@@ -178,8 +178,9 @@ bool DBBrowserDB::attach(const QString& filename, QString attach_as)
|
||||
|
||||
// Attach database
|
||||
QString key;
|
||||
if(cipher) key = cipher->password();
|
||||
if(!executeSQL(QString("ATTACH '%1' AS %2 KEY %3").arg(filename).arg(sqlb::escapeIdentifier(attach_as)).arg(key), false))
|
||||
if(cipher && is_encrypted)
|
||||
key = "KEY " + cipher->password();
|
||||
if(!executeSQL(QString("ATTACH '%1' AS %2 %3").arg(filename).arg(sqlb::escapeIdentifier(attach_as)).arg(key), false))
|
||||
{
|
||||
QMessageBox::warning(0, qApp->applicationName(), lastErrorMessage);
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user