2011-12-08 19:12:43 +01:00
|
|
|
/* ============================================================
|
|
|
|
* QupZilla - WebKit based browser
|
2013-02-26 12:56:11 +01:00
|
|
|
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
|
2011-12-08 19:12:43 +01:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
* ============================================================ */
|
|
|
|
#include "databasewriter.h"
|
|
|
|
|
2012-02-29 18:33:50 +01:00
|
|
|
#include <QTimer>
|
|
|
|
|
2012-03-15 19:35:37 +01:00
|
|
|
DatabaseWriter::DatabaseWriter(QObject* parent)
|
2012-03-14 14:04:20 +01:00
|
|
|
: QObject(parent)
|
2011-12-08 19:12:43 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void DatabaseWriter::executeQuery(const QSqlQuery &query)
|
|
|
|
{
|
|
|
|
m_queries.append(query);
|
|
|
|
|
2011-12-17 14:30:54 +01:00
|
|
|
QTimer::singleShot(0, this, SLOT(execute()));
|
2011-12-08 19:12:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void DatabaseWriter::execute()
|
|
|
|
{
|
|
|
|
if (m_queries.count() == 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-04-16 23:10:05 +02:00
|
|
|
QSqlQuery query = m_queries.first();
|
2011-12-08 19:12:43 +01:00
|
|
|
query.exec();
|
2013-02-26 12:56:11 +01:00
|
|
|
|
2013-04-16 23:10:05 +02:00
|
|
|
m_queries.remove(0);
|
2011-12-08 19:12:43 +01:00
|
|
|
}
|