From 1fe7d2eb7cb9c7e362078791d8e3b9ba4d500e44 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Enar=20V=C3=A4ikene?= Date: Fri, 23 Sep 2011 13:13:22 +0300 Subject: [PATCH] Info message that initialization is completed is now output at the end of the init() function where it belongs. Some reformatting of the code for better readability. --- src/apps/PswGen/Storage/module.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/apps/PswGen/Storage/module.cpp b/src/apps/PswGen/Storage/module.cpp index b062b30..b7676ab 100644 --- a/src/apps/PswGen/Storage/module.cpp +++ b/src/apps/PswGen/Storage/module.cpp @@ -102,8 +102,6 @@ StorageImpl::~StorageImpl() bool StorageImpl::init() { - EVAF_INFO("%s initialized", qPrintable(objectName())); - // Open the database if (!QSqlDatabase::contains(DbConnectionName)) { // No database connection yet @@ -131,6 +129,8 @@ bool StorageImpl::init() /// Register our interface Common::iRegistry::instance()->registerInterface("iStorage", this); + EVAF_INFO("%s initialized", qPrintable(objectName())); + return true; } @@ -150,7 +150,8 @@ bool StorageImpl::save(QString const & name, QExplicitlySharedDataPointermodified()) { QSqlQuery q(mDb); - if (!q.exec(QString("UPDATE data SET length = \'%1\', flags = \'%2\' WHERE name = \'%3\';").arg(data->length()).arg(data->flags()).arg(name))) { + if (!q.exec(QString("UPDATE data SET length = \'%1\', flags = \'%2\' WHERE name = \'%3\';") + .arg(data->length()).arg(data->flags()).arg(name))) { QSqlError err = mDb.lastError(); EVAF_ERROR("Failed to update \'%s\' : %s", qPrintable(name), qPrintable(err.text())); return false; @@ -160,7 +161,9 @@ bool StorageImpl::save(QString const & name, QExplicitlySharedDataPointerlength()).arg(int(data->flags())))) { + if (!q.exec(QString("INSERT INTO data (name, length, flags) VALUES (\'%1\', %2, %3);") + .arg(name).arg(data->length()) + .arg(int(data->flags())))) { QSqlError err = mDb.lastError(); EVAF_ERROR("Failed to insert \'%s\' : %s", qPrintable(name), qPrintable(err.text())); return false; -- 2.45.0