|
7 | 7 | #include "orm/databaseconnection.hpp" |
8 | 8 | #include "orm/exceptions/invalidargumenterror.hpp" |
9 | 9 | #include "orm/query/joinclause.hpp" |
| 10 | +#include "orm/utils/type.hpp" |
10 | 11 |
|
11 | 12 | TINYORM_BEGIN_COMMON_NAMESPACE |
12 | 13 |
|
@@ -297,8 +298,10 @@ Builder::upsert(const QVector<QVariantMap> &values, const QStringList &uniqueBy, |
297 | 298 | // If the update is an empty vector then throw and don't insert |
298 | 299 | if (update.isEmpty()) |
299 | 300 | 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__)); |
302 | 305 |
|
303 | 306 | return m_connection.affectingStatement( |
304 | 307 | m_grammar.compileUpsert(*this, values, uniqueBy, update), |
@@ -806,8 +809,9 @@ Builder::whereRowValues(const QVector<Column> &columns, const QString &compariso |
806 | 809 | { |
807 | 810 | if (columns.size() != values.size() || columns.isEmpty()) |
808 | 811 | 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__)); |
811 | 815 |
|
812 | 816 | m_wheres.append({.comparison = comparison, .condition = condition, |
813 | 817 | .type = WhereType::ROW_VALUES, |
@@ -1017,7 +1021,10 @@ Builder &Builder::orderBy(const Column &column, const QString &direction) |
1017 | 1021 |
|
1018 | 1022 | if (directionLower != ASC && directionLower != DESC) |
1019 | 1023 | 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__)); |
1021 | 1028 |
|
1022 | 1029 | m_orders.append({column, directionLower}); |
1023 | 1030 |
|
@@ -1600,7 +1607,9 @@ void Builder::enforceOrderBy() const |
1600 | 1607 | { |
1601 | 1608 | if (m_orders.isEmpty()) |
1602 | 1609 | 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__)); |
1604 | 1613 | } |
1605 | 1614 |
|
1606 | 1615 | QVector<OrderByItem> Builder::removeExistingOrdersFor(const QString &column) const |
@@ -1728,8 +1737,9 @@ void Builder::checkBindingType(const BindingType type) const |
1728 | 1737 |
|
1729 | 1738 | // TODO add hash which maps BindingType to the QString silverqx |
1730 | 1739 | 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__)); |
1733 | 1743 | } |
1734 | 1744 |
|
1735 | 1745 | const QVector<QString> &Builder::getOperators() |
|
0 commit comments