Go to the documentation of this file.
23 else if (query.
next())
25 QString result = query.
value(0).toString();
27 if (!query.
value(0).isNull())
41 QString querystr =
"SELECT * FROM " + table +
" WHERE "
58 querystr =
"UPDATE " + table +
" SET " +
GetSetClause(bindings) +
70 querystr =
"INSERT INTO " + table +
" SET "
110 QString keycolumnTag =
":WHERE" +
m_keycolumn.toUpper();
119 QString keycolumnTag =
":SETKEY" +
m_keycolumn.toUpper();
132 SimpleDBStorage(_user,
"settings",
"data"), m_settingname(std::move(name))
142 QString valueTag(
":WHEREVALUE");
143 QString hostnameTag(
":WHEREHOSTNAME");
145 QString clause(
"value = " + valueTag +
" AND hostname = " + hostnameTag);
155 QString valueTag(
":SETVALUE");
156 QString dataTag(
":SETDATA");
157 QString hostnameTag(
":SETHOSTNAME");
158 QString clause(
"value = " + valueTag +
", data = " + dataTag
159 +
", hostname = " + hostnameTag);
179 SimpleDBStorage(_user,
"settings",
"data"), m_settingname(std::move(name))
185 QString valueTag(
":WHEREVALUE");
186 QString clause(
"value = " + valueTag);
195 QString valueTag(
":SETVALUE");
196 QString dataTag(
":SETDATA");
198 QString clause(
"value = " + valueTag +
", data = " + dataTag);
bool IsSaveRequired(void) const override
QMap< QString, QVariant > MSqlBindings
typedef for a map of string -> string bindings for generic queries.
bool isActive(void) const
bool next(void)
Wrap QSqlQuery::next() so we can display the query results.
QSqlQuery wrapper that fetches a DB connection from the connection pool.
HostDBStorage(StorageUser *_user, QString name)
QString GetWhereClause(MSqlBindings &bindings) const override
void bindValues(const MSqlBindings &bindings)
Add all the bindings in the passed in bindings.
QVariant value(int i) const
QString GetSetClause(MSqlBindings &bindings) const override
QString GetColumnName(void) const
bool exec(void)
Wrap QSqlQuery::exec() so we can display SQL.
virtual QString GetDBValue(void) const =0
QString GetWhereClause(MSqlBindings &bindings) const override
QString GetWhereClause(MSqlBindings &bindings) const override
QString GetSetClause(MSqlBindings &bindings) const override
virtual QString GetWhereClause(MSqlBindings &bindings) const =0
static MSqlQueryInfo InitCon(ConnectionReuse _reuse=kNormalConnection)
Only use this in combination with MSqlQuery constructor.
static void DBError(const QString &where, const MSqlQuery &query)
GlobalDBStorage(StorageUser *_user, QString name)
QString GetTableName(void) const
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
static MythDB * getMythDB()
virtual QString GetSetClause(MSqlBindings &bindings) const
QString GetSetClause(MSqlBindings &bindings) const override
void ClearSettingsCache(const QString &myKey=QString(""))
virtual void SetDBValue(const QString &)=0
bool prepare(const QString &query)
QSqlQuery::prepare() is not thread safe in Qt <= 3.3.2.
void SetSaveRequired(void) override