Line data Source code
1 : #include "GetAllDBSettingsOperation.h"
2 : #include <QVariant>
3 :
4 2 : GetAllDBSettingsOperation::GetAllDBSettingsOperation(OperationManager *parent, QMap<DBSettingsKey, QString>* settings) :
5 : DBOperation(parent),
6 2 : settings(settings)
7 : {
8 :
9 2 : }
10 :
11 2 : void GetAllDBSettingsOperation::execute()
12 : {
13 : // Kindly ask the database for the rest.
14 2 : QSqlQuery query(db());
15 2 : if (!query.exec("SELECT * FROM DBSettings")) {
16 0 : reportError("Could not load all db settings. :(");
17 0 : return;
18 : }
19 :
20 3 : while (query.next()) {
21 2 : settings->insert( (DBSettingsKey)query.value("id").toInt(),
22 2 : query.value("value").toString());
23 : }
24 2 : }
|