mirror of
https://github.com/strawberrymusicplayer/strawberry
synced 2025-02-05 20:03:28 +01:00
SqlQuery: add BindDoubleOrNullValue()
method
To facilitate serializing of the two DB fields added by the previous change.
This commit is contained in:
parent
0a4888f861
commit
73c56f038e
@ -72,6 +72,12 @@ void SqlQuery::BindFloatValue(const QString &placeholder, const float value) {
|
||||
|
||||
}
|
||||
|
||||
void SqlQuery::BindDoubleOrNullValue(const QString &placeholder, const std::optional<double> value) {
|
||||
|
||||
BindValue(placeholder, value.has_value() ? *value : QVariant());
|
||||
|
||||
}
|
||||
|
||||
void SqlQuery::BindBoolValue(const QString &placeholder, const bool value) {
|
||||
|
||||
BindValue(placeholder, value ? 1 : 0);
|
||||
|
@ -22,6 +22,8 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <optional>
|
||||
|
||||
#include <QMap>
|
||||
#include <QVariant>
|
||||
#include <QString>
|
||||
@ -40,6 +42,7 @@ class SqlQuery : public QSqlQuery {
|
||||
void BindLongLongValue(const QString &placeholder, const qint64 value);
|
||||
void BindLongLongValueOrZero(const QString &placeholder, const qint64 value);
|
||||
void BindFloatValue(const QString &placeholder, const float value);
|
||||
void BindDoubleOrNullValue(const QString &placeholder, const std::optional<double> value);
|
||||
void BindBoolValue(const QString &placeholder, const bool value);
|
||||
void BindNotNullIntValue(const QString &placeholder, const int value);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user