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

Method getTableVersion

src/database/SimpleDatabase.cpp:456–471  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

454 }
455
456 int SimpleDatabase::getTableVersion(Tables const& table) {
457 QSqlQuery query(database);
458 QString const tableName = getTableName(table);
459
460 query.prepare(QStringLiteral("SELECT `version` FROM `table_versions` WHERE `table_name` = :tableName"));
461 query.bindValue(QStringLiteral(":tableName"), QVariant(tableName));
462 if (!query.exec()) {
463 throw openmittsu::exceptions::InternalErrorException() << "Could not query table version data for " << tableName.toStdString() << " from 'table_versions'. Query error: " << query.lastError().text().toStdString();
464 }
465
466 if (query.next()) {
467 return query.value(0).toInt();
468 }
469
470 throw openmittsu::exceptions::InternalErrorException() << "Could not look up table version data for table '" << tableName.toStdString() << "'. Query error: " << query.lastError().text().toStdString();
471 }
472
473 int SimpleDatabase::createTableIfMissingAndGetVersion(Tables const& table, int createStatementVersion) {
474 if (!doesTableExist(table)) {

Callers

nothing calls this directly

Calls 3

valueMethod · 0.80
nextMethod · 0.45
toIntMethod · 0.45

Tested by

no test coverage detected