Skip to content

Commit 30ecc70

Browse files
committed
used __tiny_func__ in whole QueryBuilder
1 parent 194b5e4 commit 30ecc70

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

src/orm/query/querybuilder.cpp

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "orm/databaseconnection.hpp"
88
#include "orm/exceptions/invalidargumenterror.hpp"
99
#include "orm/query/joinclause.hpp"
10+
#include "orm/utils/type.hpp"
1011

1112
TINYORM_BEGIN_COMMON_NAMESPACE
1213

@@ -297,8 +298,10 @@ Builder::upsert(const QVector<QVariantMap> &values, const QStringList &uniqueBy,
297298
// If the update is an empty vector then throw and don't insert
298299
if (update.isEmpty())
299300
throw Exceptions::InvalidArgumentError(
300-
"The upsert method doesn't support an empty update argument, please use "
301-
"the insert method instead.");
301+
QStringLiteral(
302+
"The 'upsert' method doesn't support an empty update argument, "
303+
"please use the 'insert' method instead in %1().")
304+
.arg(__tiny_func__));
302305

303306
return m_connection.affectingStatement(
304307
m_grammar.compileUpsert(*this, values, uniqueBy, update),
@@ -806,8 +809,9 @@ Builder::whereRowValues(const QVector<Column> &columns, const QString &compariso
806809
{
807810
if (columns.size() != values.size() || columns.isEmpty())
808811
throw Exceptions::InvalidArgumentError(
809-
"The number of columns must match the number of values and "
810-
"can not be empty.");
812+
QStringLiteral("The number of columns must match the number of values "
813+
"and can not be empty in %1().")
814+
.arg(__tiny_func__));
811815

812816
m_wheres.append({.comparison = comparison, .condition = condition,
813817
.type = WhereType::ROW_VALUES,
@@ -1017,7 +1021,10 @@ Builder &Builder::orderBy(const Column &column, const QString &direction)
10171021

10181022
if (directionLower != ASC && directionLower != DESC)
10191023
throw Exceptions::InvalidArgumentError(
1020-
R"(Order direction must be "asc" or "desc", case is not important.)");
1024+
QStringLiteral(
1025+
"Order direction must be \"asc\" or \"desc\", case is not important "
1026+
"in %1().)")
1027+
.arg(__tiny_func__));
10211028

10221029
m_orders.append({column, directionLower});
10231030

@@ -1600,7 +1607,9 @@ void Builder::enforceOrderBy() const
16001607
{
16011608
if (m_orders.isEmpty())
16021609
throw Exceptions::RuntimeError(
1603-
"You must specify an orderBy clause when using this function.");
1610+
QStringLiteral("You must specify an orderBy clause when using "
1611+
"the '%1()' method in %2().")
1612+
.arg(__func__, __tiny_func__));
16041613
}
16051614

16061615
QVector<OrderByItem> Builder::removeExistingOrdersFor(const QString &column) const
@@ -1728,8 +1737,9 @@ void Builder::checkBindingType(const BindingType type) const
17281737

17291738
// TODO add hash which maps BindingType to the QString silverqx
17301739
throw Exceptions::InvalidArgumentError(
1731-
QStringLiteral("Invalid binding type: %1")
1732-
.arg(static_cast<int>(type)));
1740+
QStringLiteral("Invalid binding type '%1' in %2().")
1741+
.arg(static_cast<int>(type))
1742+
.arg(__tiny_func__));
17331743
}
17341744

17351745
const QVector<QString> &Builder::getOperators()

0 commit comments

Comments
 (0)