From: APTX Date: Tue, 26 Mar 2013 20:54:29 +0000 (+0100) Subject: Use proper exec in AsyncQueryTask X-Git-Url: https://gitweb.aptx.org/?a=commitdiff_plain;h=514204c078f048930b0e7f19d88029928b9d800b;p=localmylist.git Use proper exec in AsyncQueryTask --- diff --git a/localmylist/asyncquerytask.cpp b/localmylist/asyncquerytask.cpp index 655fd62..df03fa6 100644 --- a/localmylist/asyncquerytask.cpp +++ b/localmylist/asyncquerytask.cpp @@ -41,11 +41,11 @@ bool AsyncQueryTask::canUseThreads() const void AsyncQueryTask::start() { - QSqlQuery q(db->connection()); + QSqlQuery q = db->prepareOneShot(m_query->query); m_result = new Internal::Result; - if (!q.prepare(m_query->query)) + if (q.lastError().isValid()) { m_result->error = q.lastError().text(); emit finished(); @@ -57,7 +57,7 @@ void AsyncQueryTask::start() q.bindValue(v.name, v.value, v.paramType); } - if (!q.exec()) + if (!db->exec(q)) { m_result->error = q.lastError().text(); }