SqlQuery: add BindDoubleOrNullValue() method

To facilitate serializing of the two DB fields added by the previous change.
This commit is contained in:
Roman Lebedev
2023-06-27 04:54:30 +03:00
committed by Jonas Kvinge
parent 0a4888f861
commit 73c56f038e
2 changed files with 9 additions and 0 deletions

View File

@@ -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);