Commit 7e1bebad authored by Lisa's avatar Lisa

New queries used in akabeicore.

parent c4962b41
......@@ -18,6 +18,7 @@
#include <akabeihelpers_p.h>
#include <akabeidelta_p.h>
#include <akabeigroup_p.h>
#include <akabeiquery.h>
#include <QHash>
#include <QtConcurrentRun>
......@@ -483,13 +484,13 @@ Backend::Status Backend::status() const
QUuid Backend::groups()
{
QString sql = "SELECT * FROM groups";
QString sql = Queries::allGroups();
return queryGroups(sql);
}
QUuid Backend::packages()
{
QString sql = "SELECT * FROM packages";
QString sql = Queries::allPackages();
return queryPackages(sql);
}
......@@ -553,32 +554,32 @@ QUuid Backend::orphanPackages()
QUuid Backend::searchGroups(const QString& token)
{
QString sql = "SELECT * FROM groups WHERE name LIKE \"%" + token + "%\" OR description LIKE \"%" + token + "%\"";
return queryGroups(sql);
return queryGroups( Queries::selectPackagesNameOrDescription("%" + token + "%", "LIKE") );
}
//TODO: Maybe abstract the query generation, because the same is used in database as well
QUuid Backend::searchPackages(const QString& token, SearchType type)
{
QString sql;
switch (type) {
case SearchNameLike:
sql = "SELECT * FROM packages WHERE name LIKE \"%" + token + "%\"";
sql = Queries::selectPackages("name", "LIKE", "%" + token + "%");
break;
case SearchNameEqual:
sql = "SELECT * FROM packages WHERE name=\"" + token + "\"";
sql = Queries::selectPackages("name", "=", "%" + token + "%");
break;
case SearchDescriptionLike:
sql = "SELECT * FROM packages WHERE description LIKE \"%" + token + "%\"";
sql = Queries::selectPackages("description", "LIKE", "%" + token + "%");
break;
case SearchDescriptionEqual:
sql = "SELECT * FROM packages WHERE description=\"" + token + "\"";
sql = Queries::selectPackages("description", "=", "%" + token + "%");
break;
case SearchNameAndDescriptionLike:
sql = "SELECT * FROM packages WHERE name LIKE \"%" + token + "%\" OR description LIKE \"%" + token + "%\"";
sql = Queries::selectPackagesNameOrDescription("%" + token + "%", "LIKE");
break;
case SearchNameAndDescriptionEqual:
sql = "SELECT * FROM PACKAGES WHERE name=\"" + token + "\" OR description=\"" + token + "\"";
sql = Queries::selectPackagesNameOrDescription("%" + token + "%", "=");
break;
}
return queryPackages(sql);
......
......@@ -18,6 +18,7 @@
#include <utime.h>
#include <libarchive++/archivehandler.h>
#include <SQLiteConnection.h>
#include "akabeiquery.h"
/*
* This is an utility class we use for sorting the cache entries according to some date/time.
......@@ -243,7 +244,7 @@ bool Cache::Private::cleanNotInstalled()
SQLiteConnection database(databasedir.absoluteFilePath("local.db"), true);
foreach (QString const& file, cacheFiles) {
database.bind(":Filename", file.split("/").last());
SQLiteResource res = database.query("SELECT * FROM packages WHERE filename=:Filename");
SQLiteResource res = database.query( Queries::selectPackages("filename", "=", ":Filename") );
if (res.getRowsCount() == 0) {
QFile f(file);
......
......@@ -17,6 +17,7 @@
#include <akabeidelta_p.h>
#include <akabeihook_p.h>
#include <akabeidebug.h>
#include <akabeiquery.h>
namespace Akabei {
//TODO: Only open local database readwrite
......@@ -60,7 +61,7 @@ QString Database::name() const
void DatabasePrivate::populateGroupCache()
{
groupCache.clear();
SQLiteResource table = dbConnection.query("SELECT * FROM groups;");
SQLiteResource table = dbConnection.query( Queries::allGroups() );
for (int i = 0; i < table.getRowsCount(); i++) {
Group* group = groupFromRow(table, i);
......@@ -254,7 +255,7 @@ Delta* DatabasePrivate::deltaFromRow(SQLiteResource& table, int row)
Akabei::Package::List DatabasePrivate::packagesFromHook(QString const& hook)
{
Akabei::Package::List pkgs;
SQLiteResource table = dbConnection.query("SELECT * FROM belongshook JOIN packages ON hookname='" + hook + "' AND belongshook.package=packages.id");
SQLiteResource table = dbConnection.query( Queries::packagesFromHook(hook) );
for (int row = 0; row < table.getRowsCount(); row++) {
pkgs << packageFromRow(table, row);
......@@ -327,30 +328,31 @@ Error Database::error() const
Package::List Database::packages()
{
return queryPackages("SELECT * FROM packages");
return queryPackages( Queries::allPackages() );
}
Package::List Database::searchPackages(QString const& token, SearchType type)
{
QString sql;
switch (type) {
case SearchNameLike:
sql = "SELECT * FROM packages WHERE name LIKE \'%" + token + "%\'";
sql = Queries::selectPackages("name", "LIKE", "%" + token + "%");
break;
case SearchNameEqual:
sql = "SELECT * FROM packages WHERE name=\'" + token + "\'";
sql = Queries::selectPackages("name", "=", "%" + token + "%");
break;
case SearchDescriptionLike:
sql = "SELECT * FROM packages WHERE description LIKE \'%" + token + "%\'";
sql = Queries::selectPackages("description", "LIKE", "%" + token + "%");
break;
case SearchDescriptionEqual:
sql = "SELECT * FROM packages WHERE description=\'" + token + "\'";
sql = Queries::selectPackages("description", "=", "%" + token + "%");
break;
case SearchNameAndDescriptionLike:
sql = "SELECT * FROM packages WHERE name LIKE \'%" + token + "%\' OR description LIKE \'%" + token + "%\'";
sql = Queries::selectPackagesNameOrDescription("%" + token + "%", "LIKE");
break;
case SearchNameAndDescriptionEqual:
sql = "SELECT * FROM PACKAGES WHERE name=\'" + token + "\' OR description=\'" + token + "\'";
sql = Queries::selectPackagesNameOrDescription("%" + token + "%", "=");
break;
}
return queryPackages(sql);
......@@ -410,13 +412,13 @@ Akabei::Package::List Database::queryPackages(QString const& sql)
QList< Group* > Database::groups()
{
QString sql = "SELECT * FROM groups";
QString sql = Queries::allGroups();
return queryGroups(sql);
}
QList< Group* > Database::searchGroups(QString const& token)
{
QString sql = QString("SELECT * FROM groups WHERE name LIKE \"%%%1%%\" OR description LIKE \"%%%1%%\"").arg(token);
QString sql = Queries::selectGroupsNameOrDescription(token, "LIKE");
return queryGroups(sql);
}
......
......@@ -12,6 +12,7 @@
#include <akabeibackend.h>
#include <akabeihelpers.h>
#include <akabeiquery.h>
namespace Akabei
{
......@@ -54,7 +55,7 @@ QList< Akabei::Package* > Group::packages() const
Helpers::PackageEventLoop e;
e.connect(Backend::instance(), SIGNAL(queryPackagesCompleted(QUuid,QList<Akabei::Package*>)),
&e, SLOT(requestQuit(QUuid,QList<Akabei::Package*>)));
e.setUuid(Backend::instance()->queryPackages("SELECT * FROM packages JOIN belongsgroup ON packages.id=belongsgroup.package WHERE belongsgroup.groupname='" + d->name + "';"));
e.setUuid( Backend::instance()->queryPackages( Queries::allPackagesInGroup(d->name) ) );
e.exec();
return e.result();
}
......@@ -66,8 +67,7 @@ QList< Package* > Group::search(const QString& token) const
Helpers::PackageEventLoop e;
e.connect(Backend::instance(), SIGNAL(queryPackagesCompleted(QUuid,QList<Akabei::Package*>)),
&e, SLOT(requestQuit(QUuid,QList<Akabei::Package*>)));
e.setUuid(Backend::instance()->queryPackages("SELECT * FROM packages JOIN belongsgroup ON packages.id=belongsgroup.package WHERE belongsgroup.groupname='" + d->name + "' AND "
"(name LIKE \"%" + token + "%\" OR description LIKE \"%" + token + "%\")"));
e.setUuid(Backend::instance()->queryPackages( Queries::packagesInGroup(d->name, token) ));
e.exec();
return e.result();
}
......
......@@ -28,6 +28,7 @@
#include <QDir>
#include <QUrl>
#include <akabeidebug.h>
#include <akabeiquery.h>
#include <stdlib.h>
......@@ -312,7 +313,7 @@ int QueryPerformer::beginTransaction(Database* db)
DatabasePrivate *d = QueryHelper::databasePrivateFromDatabase(db);
try {
d->dbConnection.query("BEGIN;");
d->dbConnection.query( Queries::begin() );
} catch (SQLiteException& e) {
return SQLITE_ABORT;
}
......@@ -325,7 +326,7 @@ int QueryPerformer::commitTransaction(Database* db)
DatabasePrivate *d = QueryHelper::databasePrivateFromDatabase(db);
try {
d->dbConnection.query("COMMIT;");
d->dbConnection.query( Queries::commit() );
} catch (SQLiteException& e) {
return SQLITE_ABORT;
}
......@@ -338,7 +339,7 @@ int QueryPerformer::rollbackTransaction(Database* db)
DatabasePrivate *d = QueryHelper::databasePrivateFromDatabase(db);
try {
d->dbConnection.query("ROLLBACK;");
d->dbConnection.query( Queries::rollback() );
} catch (SQLiteException& e) {
return SQLITE_ABORT;
}
......
......@@ -26,6 +26,7 @@
#include <akabeidebug.h>
#include <akabeipackage.h>
#include <akabeilog.h>
#include <akabeiquery.h>
namespace Akabei {
void PackagePrivate::setName(const QString &n)
......@@ -503,10 +504,7 @@ Package::List Package::computeDependencies()
Package::List dependencies;
for (QHash<QString, QString>::iterator i = versionedDeps.begin(); i != versionedDeps.end(); ++i) {
QString queryString = QString("SELECT * FROM packages WHERE name LIKE \"%1\"")
.arg(i.key());
//First we check if the package is already installed
QString queryString = Queries::selectPackages("name", "LIKE", i.key());
Package::List query = Backend::instance()->localDatabase()->queryPackages(queryString);
if (!query.isEmpty()) {
if (i.value().isEmpty() || query.first()->version().respectsConstraint(i.value())) {
......@@ -577,13 +575,13 @@ Package::List Package::computeRequiredBy()
Q_D(Package);
QWriteLocker locker(d->mutex);
if (d->requiredBy.isEmpty()) {
const QString query = "SELECT `packages`.* FROM `depends` JOIN `packages` ON `packages`.`id` = `depends`.`package` WHERE `depends`.`dependency` REGEXP \"^" + d->name + "(<|<=|=|>=|>).*|^" + d->name + "$\"";
const QString query = Queries::requiredByPackages("^" + d->name + "(<|<=|=|>=|>).*|^" + d->name + "$");
Package::List requiredBy = Akabei::Backend::instance()->localDatabase()->queryPackages(query);
foreach (Akabei::Database* database, Akabei::Backend::instance()->databases()) {
requiredBy << database->queryPackages(query);
}
foreach (const QString &pro, d->providers) {
const QString proQuery = "SELECT `packages`.* FROM `depends` JOIN `packages` ON `packages`.`id` = `depends`.`package` WHERE `depends`.`dependency` REGEXP \"^" + pro + "(<|<=|=|>=|>).*|^" + pro + "$\"";
const QString proQuery = Queries::packageDependencies("^" + pro + "(<|<=|=|>=|>).*|^" + pro + "$", "REGEXP");
requiredBy << Akabei::Backend::instance()->localDatabase()->queryPackages(proQuery);
foreach (Akabei::Database* database, Akabei::Backend::instance()->databases()) {
requiredBy << database->queryPackages(proQuery);
......@@ -648,8 +646,7 @@ QStringList Package::retrieveFiles()
if (d->database != 0 && d->databaseId >= 0) {
// Ok, query the db
// Add files
QString sql = QString("SELECT * FROM files WHERE package=%1")
.arg(d->databaseId);
QString sql = QString( Queries::packageProperty("*", "files", d->databaseId) );
try {
SQLiteConnection &c = d->database->d_func()->dbConnection;
......@@ -702,7 +699,7 @@ QList< Hook* > Package::retrieveHooks()
return QList<Hook*>();
if (d->hookCache.isEmpty()) {
QString sql = "SELECT * FROM belongshook JOIN hooks ON package=" + QString::number(d->databaseId) + " AND belongshook.hookname=hooks.name;";
QString sql = Queries::packageHooks(d->databaseId);
d->hookCache = d->database->queryHooks(sql);
foreach (Hook * hook, d->hookCache)
d->hooks << hook->name();
......@@ -756,7 +753,7 @@ bool Package::isInstalled() const
if (d->database == Akabei::Backend::instance()->localDatabase())
return true;
QString sql = "SELECT * FROM packages WHERE name=\"" + d->name + "\"";
QString sql = Queries::selectPackages("name", "=", d->name);
QList<Package*> l = Akabei::Backend::instance()->localDatabase()->queryPackages(sql);
return (l.size() > 0) && (l.first()->version() >= version());
}
......@@ -841,7 +838,7 @@ QString Package::retrieveScriptlet()
if (d->database != 0 && d->databaseId >= 0) {
// Ok, query the db
// Add files
QString sql = "SELECT * FROM scriptlets WHERE package=" + QString::number(d->databaseId);
QString sql = Queries::packageProperty("*", "scriptlets", d->databaseId);
try {
SQLiteConnection& c = d->database->d_func()->dbConnection;
......@@ -866,8 +863,7 @@ QList< Delta* > Package::retrieveDeltas()
QWriteLocker locker(d->mutex);
if (d->deltaCache.isEmpty()) {
if (d->database != 0 && d->databaseId >= 0) {
QString sql = QString("SELECT * FROM deltas WHERE package=%1")
.arg(d->databaseId);
QString sql = Queries::packageProperty("*", "deltas", d->databaseId);
QList<Delta*> deltas = d->database->queryDeltas(sql);
foreach (Delta* del, deltas)
d->deltaCache[Version(del->versionTo())] = del;
......
......@@ -17,22 +17,32 @@ namespace Queries
QString selectGroups(const QString& property, const QString& comparison, const QString& value)
{
return QString("SELECT * FROM groups WHERE %1 %2 %3;").arg(property, comparison, value);
return QString("SELECT * FROM groups WHERE %1 %2 \"%3\";").arg(property, comparison, value);
}
QString selectGroupsNameOrDescription(const QString& token, const QString& comparison)
{
return QString("SELECT * FROM groups WHERE name %1 \"%2\" OR description %2 \"%3\";").arg(token, comparison, token);
}
QString selectPackages(const QString& property, const QString& comparison, const QString& value)
{
return QString("SELECT * FROM packages WHERE %1 %2 %3;").arg(property, comparison, value);
return QString("SELECT * FROM packages WHERE %1 %2 \"%3\";").arg(property, comparison, value);
}
QString selectPackagesNameOrDescription(const QString& token, const QString& comparison)
{
return QString("SELECT * FROM packages WHERE name %1 \"%2\" OR description %2 \"%3\";").arg(token, comparison, token);
}
QString selectHooks(const QString& property, const QString& comparison, const QString& value)
{
return QString("SELECT * FROM hooks WHERE %1 %2 %3:").arg(property, comparison, value);
return QString("SELECT * FROM hooks WHERE %1 %2 \"%3\":").arg(property, comparison, value);
}
QString selectDeltas(const QString& property, const QString& comparison, const QString& value)
{
return QString("SELECT * FROM deltas WHERE %1 %2 %3;").arg(property, comparison, value);
return QString("SELECT * FROM deltas WHERE %1 %2 \"%3\";").arg(property, comparison, value);
}
QString allPackages()
......@@ -45,47 +55,49 @@ QString allGroups()
return QString("SELECT * FROM groups;");
}
QString packageProperty(const QString& property, const QString& table, const QString& packageId)
QString packageProperty(const QString& property, const QString& table, int packageId)
{
return QString("SELECT %1 FROM %2 WHERE package=%3;").arg(property, table, packageId);
QString id = QString::number(packageId);
return QString("SELECT %1 FROM %2 WHERE package=\"%3\";").arg(property, table, id);
}
QString packageHooks(const QString& packageId)
QString packageHooks(int packageId)
{
return QString("SELECT * FROM belongshook JOIN hooks ON package=%1 AND belongshook.hookname=hooks.name;").arg(packageId);
QString id = QString::number(packageId);
return QString("SELECT * FROM belongshook JOIN hooks ON package=\"%1\" AND belongshook.hookname=hooks.name;").arg(id);
}
QString packagesFromHook(const QString& hook)
{
return QString("SELECT * FROM belongshook JOIN packages ON hookname=%1 AND belongshook.package=packages.id;").arg(hook);
return QString("SELECT * FROM belongshook JOIN packages ON hookname=\"%1\" AND belongshook.package=packages.id;").arg(hook);
}
QString packagesInGroup(const QString& group, const QString& packageName, const QString& packageDescription)
QString packagesInGroup(const QString& group, const QString& token)
{
return QString("SELECT * FROM packages JOIN belongsgroup ON packages.id=belongsgroup.package WHERE belongsgroup.groupname=%1 \
AND (name LIKE %2 OR description LIKE %3);").arg(group, packageName, packageDescription);
return QString("SELECT * FROM packages JOIN belongsgroup ON packages.id=belongsgroup.package WHERE belongsgroup.groupname=\"%1\" \
AND (name LIKE \"%2\" OR description LIKE \"%2\");").arg(group, token);
}
QString belongsGroup(const QString& group, const QString& package)
{
return QString("SELECT * FROM belongsgroup JOIN groups ON groups.name=%1 AND package=%2;").arg(group, package);
return QString("SELECT * FROM belongsgroup JOIN groups ON groups.name=\"%1\" AND package=\"%2\";").arg(group, package);
}
QString allPackagesInGroup(const QString& group)
{
return QString("SELECT * FROM packages JOIN belongsgroup ON packages.id=belongsgroup.package \
WHERE belongsgroup.groupname=%1;").arg(group);
WHERE belongsgroup.groupname=\"%1\";").arg(group);
}
QString requiredByPackages(const QString& dependency)
{
return QString("SELECT packages.* FROM depends JOIN packages ON packages.id = depends.package \
WHERE depends.dependency REGEXP %1;").arg(dependency);
WHERE depends.dependency REGEXP \"%1\";").arg(dependency);
}
QString packageDependencies(const QString& dependency)
QString packageDependencies(const QString& dependency, const QString& comparison)
{
return QString("SELECT * FROM packages JOIN depends ON packages.id=depends.package WHERE dependency LIKE %1;").arg(dependency);
return QString("SELECT * FROM packages JOIN depends ON packages.id=depends.package WHERE depends.dependency %0 \"%1\";").arg(comparison, dependency);
}
QString begin()
......@@ -103,5 +115,10 @@ QString vacuum()
return QString("VACUUM;");
}
QString rollback()
{
return QString("ROLLBACK;");
}
}
}
\ No newline at end of file
......@@ -29,6 +29,14 @@ namespace Queries
*/
QString AKABEICORESHARED_EXPORT selectGroups(const QString &, const QString &, const QString &);
/**
* Query to select groups with more freedom.
*
* @param token a pattern for the name and/or description.
* @param comparison the comparison method (LIKE, exact comparison...)
*/
QString AKABEICORESHARED_EXPORT selectGroupsNameOrDescription(const QString &, const QString &);
/**
* Query to select packages.
*
......@@ -38,6 +46,14 @@ QString AKABEICORESHARED_EXPORT selectGroups(const QString &, const QString &, c
*/
QString AKABEICORESHARED_EXPORT selectPackages(const QString &, const QString &, const QString &);
/**
* Query to select packages with more freedom.
*
* @param token a pattern for the name and/or description.
* @param comparison the comparison method (LIKE, exact comparison...)
*/
QString AKABEICORESHARED_EXPORT selectPackagesNameOrDescription(const QString &, const QString &);
/**
* Query to select hooks.
*
......@@ -73,14 +89,14 @@ QString AKABEICORESHARED_EXPORT allGroups();
* @param table the table from which the property is taken.
* @param packageId the package ID to distinguish its properties.
*/
QString AKABEICORESHARED_EXPORT packageProperty(const QString &, const QString &, const QString &);
QString AKABEICORESHARED_EXPORT packageProperty(const QString &, const QString &, int);
/**
* Query for the package hooks.
*
* @param packageId the package ID.
*/
QString AKABEICORESHARED_EXPORT packageHooks(const QString &);
QString AKABEICORESHARED_EXPORT packageHooks(int);
/**
* Query for all the packages with a certain hook.
......@@ -93,10 +109,9 @@ QString AKABEICORESHARED_EXPORT packagesFromHook(const QString &);
* Query that selects some packages in a group.
*
* @param group the group's name.
* @param packageName the package's name.
* @param packageDescription the package's description.
* @param token pattern for package's name and description.
*/
QString AKABEICORESHARED_EXPORT packagesInGroup(const QString &, const QString &, const QString &);
QString AKABEICORESHARED_EXPORT packagesInGroup(const QString &, const QString &);
/**
* Query that shows us if a package belongs to some group.
......@@ -124,8 +139,9 @@ QString AKABEICORESHARED_EXPORT requiredByPackages(const QString &);
* Query for some package's dependencies.
*
* @param dependency a regexp's filter for the dependencies.
* @param comparison the comparison method (LIKE, exact comparison...)
*/
QString AKABEICORESHARED_EXPORT packageDependencies(const QString &);
QString AKABEICORESHARED_EXPORT packageDependencies(const QString &, const QString &);
/**
* Query that begins a transaction.
......@@ -138,9 +154,14 @@ QString AKABEICORESHARED_EXPORT begin();
QString AKABEICORESHARED_EXPORT commit();
/**
* Query that aborts a transaction, undoing all its changes.
* Query that vacuums the database.
*/
QString AKABEICORESHARED_EXPORT vacuum();
/**
* Query that rollbacks a transaction.
*/
QString AKABEICORESHARED_EXPORT rollback();
}
}
......
......@@ -19,6 +19,7 @@
#include <akabeipackage.h>
#include <akabeioperation_p.h>
#include <akabeierror.h>
#include "akabeiquery.h"
#include <QFile>
#include <QtConcurrentMap>
......@@ -387,7 +388,7 @@ void ValidatorWorker::processNextPhase()
// Check if we are breaking dependencies somehow
foreach (const QString &target, targetRemovals) {
QString rT = Helpers::versionedTarget(target).first;
QString sql = "SELECT * FROM packages JOIN depends ON packages.id=depends.package WHERE dependency LIKE \"%;" + rT + "%\"";
QString sql = Queries::packageDependencies(rT, "LIKE");
QList<Package*> ret = Backend::instance()->localDatabase()->queryPackages(sql);
// Iterate: we might have found targets that are not the ones we're looking for (due to version handling)
foreach (Package *p, ret) {
......
......@@ -14,6 +14,7 @@
#include <qtemporaryfile.h>
#include "akabeicoreconfig.h"
#include "akabeipackage.h"
#include <akabeiquery.h>
#include <QDebug>
AkabeiSQLiteTest::AkabeiSQLiteTest(QObject * parent) : QObject(parent)
......@@ -59,7 +60,7 @@ void AkabeiSQLiteTest::test()
}
try {
c.query("BEGIN");
c.query( Akabei::Queries::begin() );
} catch (SQLiteException& e) {
std::string error = QString("Query error: %1").arg(e.what()).toStdString();
QVERIFY2(false, error.c_str());
......@@ -134,7 +135,10 @@ void AkabeiSQLiteTest::test()
}
try {
QString query = "SELECT * FROM packages WHERE name=\"" + name + "\"";
QString query = Akabei::Queries::selectPackages("name", "=", name);
QString expectedQuery = "SELECT * FROM packages WHERE name = \"" + name + "\";";
QCOMPARE(query, expectedQuery);
SQLiteResource r = c.query(query);
QCOMPARE(r.getRowsCount(), 1);
QCOMPARE(name, r.getDataAt(0, "name").toString());
......
......@@ -25,6 +25,7 @@
#include <akabeidelta.h>
#include <akabeidatabase.h>
#include <SQLiteConnection.h>
#include <akabeiquery.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
......@@ -369,7 +370,7 @@ bool DatabaseWorker::add(const QStringList& targets, const QHash< QString, Akabe
out.flush();
try {
db->query("BEGIN");
db->query( Akabei::Queries::begin() );
out << "done." << endl;
} catch (SQLiteException& ex) {
out << "Failed! Could not begin the transaction. SQLite error: " << ex.what() << endl;
......@@ -489,7 +490,7 @@ bool DatabaseWorker::add(const QStringList& targets, const QHash< QString, Akabe
out.flush();
try {
db->query("COMMIT");
db->query( Akabei::Queries::commit() );
out << "done." << endl;
} catch (SQLiteException& ex) {
out << "Failed! Could not commit the transaction. SQLite error message: " << ex.what() << endl;
......@@ -500,7 +501,7 @@ bool DatabaseWorker::add(const QStringList& targets, const QHash< QString, Akabe
out.flush();
try {
db->query("VACUUM");
db->query( Akabei::Queries::vacuum() );
out << "done." << endl;
} catch (SQLiteException& ex) {
out << "Failed! Could not vacuum the db. SQLite error message: " << ex.what() << endl;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment