Database is locked. Unable to fetch row in "DETACH DATABASE..."
General and Desktop
1
Posts
1
Posters
1.9k
Views
1
Watching
-
In my restless dreams I see this code:
bool DatabaseManager::saveEncryptedDatabase(const QString &path, const QString &password) { QSqlQuery q; q.exec(QString("ATTACH DATABASE '%1' AS encrypted KEY '%2'").arg(path, password)); Utils::handleSqlError(q); q.exec(QString("SELECT sqlcipher_export('encrypted')")); Utils::handleSqlError(q); q.exec("DETACH DATABASE encrypted"); Utils::handleSqlError(q); return true; }Where
Utils::handleSqlErroris printing error if any occured.
Result:"SQL Query Error: database encrypted is locked Unable to fetch row in\nDETACH DATABASE encrypted"I have even delayed it to timer and tried to detach every 250ms. No luck. I've tried with transactions. Still nothing though.
I've got dandruff on my head.