Skip to content

Commit 4749234

Browse files
committed
FwdSqlQuery: Add FwdSqlQuery::bindValue overloads to resolve method resolution conflicts
This prevents e.g. pQuery->bindValue(":position", 1) from causing a compile-time error, as the compiler cannot decide between QVariant(int) and DbId(int) (even though the latter is deleted).
1 parent 17be527 commit 4749234

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

src/util/db/fwdsqlquery.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,31 @@ class FwdSqlQuery final : protected QSqlQuery {
7272
bindValue(placeholder, value.toVariant());
7373
}
7474

75+
// Overloaded functions for all QVariant types to resolve overload conflicts
76+
void bindValue(const QString& placeholder, const int value) {
77+
bindValue(placeholder, QVariant(value));
78+
}
79+
80+
void bindValue(const QString& placeholder, const unsigned int value) {
81+
bindValue(placeholder, QVariant(value));
82+
}
83+
84+
void bindValue(const QString& placeholder, const long long int value) {
85+
bindValue(placeholder, QVariant(value));
86+
}
87+
88+
void bindValue(const QString& placeholder, const unsigned long long int value) {
89+
bindValue(placeholder, QVariant(value));
90+
}
91+
92+
void bindValue(const QString& placeholder, const float value) {
93+
bindValue(placeholder, QVariant(value));
94+
}
95+
96+
void bindValue(const QString& placeholder, const double value) {
97+
bindValue(placeholder, QVariant(value));
98+
}
99+
75100
QString executedQuery() const {
76101
return QSqlQuery::executedQuery();
77102
}

0 commit comments

Comments
 (0)