Go to the documentation of this file.
5 #include "mythconfig.h"
29 const QString &newnumber, QString &dbver)
35 QString(
"DELETE FROM settings WHERE value='%1';").arg(versionkey);
41 QString(
"DB Error (Deleting old %1 DB version number): \n"
42 "Query was: %2 \nError was: %3 \nnew version: %4")
47 LOG(VB_GENERAL, LOG_ERR, msg);
52 thequery = QString(
"INSERT INTO settings (value, data, hostname) "
53 "VALUES ('%1', %2, NULL);").arg(versionkey, newnumber);
59 QString(
"DB Error (Setting new %1 DB version number): \n"
60 "Query was: %2 \nError was: %3 \nnew version: %4")
65 LOG(VB_GENERAL, LOG_ERR, msg);
84 for (
const auto & update : updates)
86 const char *thequery = update.c_str();
87 if ((strlen(thequery) != 0U) && !query.
exec(thequery))
90 QString(
"DB Error (Performing %1 database upgrade): \n"
91 "Query was: %2 \nError was: %3")
95 LOG(VB_GENERAL, LOG_ERR, msg);
114 const QString &component,
const QString &versionkey,
119 LOG(VB_GENERAL, LOG_CRIT, QString(
"Upgrading to %1 schema version %2")
QSqlQuery wrapper that fetches a DB connection from the connection pool.
static QString DBErrorMessage(const QSqlError &err)
bool exec(void)
Wrap QSqlQuery::exec() so we can display SQL.
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
static MSqlQueryInfo InitCon(ConnectionReuse _reuse=kNormalConnection)
Only use this in combination with MSqlQuery constructor.
bool performUpdateSeries(const QString &component, const DBUpdates &updates)
bool UpdateDBVersionNumber(const QString &component, const QString &versionkey, const QString &newnumber, QString &dbver)
Updates the schema version stored in the database.
QSqlError lastError(void) const
bool performActualUpdate(const QString &component, const QString &versionkey, const DBUpdates &updates, const QString &version, QString &dbver)
std::vector< std::string > DBUpdates
bool prepare(const QString &query)
QSqlQuery::prepare() is not thread safe in Qt <= 3.3.2.