MCPcopy Create free account
hub / github.com/blizzard4591/openMittsu / getOptionValueInternal

Method getOptionValueInternal

src/database/SimpleDatabase.cpp:1225–1238  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1223 }
1224
1225 QString SimpleDatabase::getOptionValueInternal(QString const& optionName, bool isInternalOption) {
1226 QSqlQuery query(database);
1227 query.prepare(QStringLiteral("SELECT `value` FROM `settings` WHERE `is_internal` = :isInternal AND `name` = :name"));
1228 query.bindValue(QStringLiteral(":name"), QVariant(optionName));
1229 query.bindValue(QStringLiteral(":isInternal"), QVariant(((isInternalOption) ? 1 : 0)));
1230
1231 if (!query.exec() || !query.isSelect()) {
1232 throw openmittsu::exceptions::InternalErrorException() << "Could not fetch option " << optionName.toStdString() << " from settings. Query error: " << query.lastError().text().toStdString();
1233 } else if (!query.next()) {
1234 throw openmittsu::exceptions::InternalErrorException() << "Could not fetch option " << optionName.toStdString() << " from settings - it does not exist.";
1235 } else {
1236 return query.value(QStringLiteral("value")).toString();
1237 }
1238 }
1239
1240 bool SimpleDatabase::hasOptionInternal(QString const& optionName, bool isInternalOption) {
1241 QSqlQuery query(database);

Callers

nothing calls this directly

Calls 3

valueMethod · 0.80
nextMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected