Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Database is locked. Unable to fetch row in "DETACH DATABASE..."
QtWS25 Last Chance

Database is locked. Unable to fetch row in "DETACH DATABASE..."

Scheduled Pinned Locked Moved General and Desktop
sqlitesqlciphersqldatabase
1 Posts 1 Posters 1.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mkolenda
    wrote on 8 Sept 2015, 13:54 last edited by
    #1

    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::handleSqlError is 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.

    1 Reply Last reply
    0

    1/1

    8 Sept 2015, 13:54

    • Login

    • Login or register to search.
    1 out of 1
    • First post
      1/1
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved