diff options
author | Marco Bubke <[email protected]> | 2023-02-27 10:30:26 +0100 |
---|---|---|
committer | Marco Bubke <[email protected]> | 2023-02-28 09:48:30 +0000 |
commit | cc507063bc9e5a608d38437122f0b892c02c0283 (patch) | |
tree | 0824e27cb178a6e55b12473404a9b01e608424c3 /src/libs/sqlite/sqlstatementbuilder.cpp | |
parent | 306f239c202241f1a8a9883dface2688acb602d8 (diff) |
Sqlite: Inject RTTI into TU
We had problems on macOS with the catching of exceptions because the has
type_info::hash_code was different. This is probably a bug because RTTI
code is injected for an inline class.
To work around that problem we implemented the virtual what method for
every exception.
Task-number: QDS-9266
Change-Id: I79052c8b70adead412d1940b17195151fb19ebb9
Reviewed-by: Qt CI Bot <[email protected]>
Reviewed-by: <[email protected]>
Reviewed-by: Vikas Pachdha <[email protected]>
Diffstat (limited to 'src/libs/sqlite/sqlstatementbuilder.cpp')
-rw-r--r-- | src/libs/sqlite/sqlstatementbuilder.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/libs/sqlite/sqlstatementbuilder.cpp b/src/libs/sqlite/sqlstatementbuilder.cpp index 9f13e3170e8..e6b7e2bf080 100644 --- a/src/libs/sqlite/sqlstatementbuilder.cpp +++ b/src/libs/sqlite/sqlstatementbuilder.cpp @@ -197,30 +197,37 @@ void SqlStatementBuilder::checkIfPlaceHolderExists(Utils::SmallStringView name) void SqlStatementBuilder::checkIfNoPlaceHoldersAynmoreExists() const { if (m_sqlStatement.contains('$')) - throwException("SqlStatementBuilder::bind: there are still placeholder in the sql statement!", m_sqlTemplate.constData()); + throwException( + "SqlStatementBuilder::bind: there are still placeholder in the sql statement!", + m_sqlTemplate); } void SqlStatementBuilder::checkBindingTextIsNotEmpty(Utils::SmallStringView text) const { if (text.isEmpty()) - throwException("SqlStatementBuilder::bind: binding text it empty!", m_sqlTemplate.constData()); + throwException("SqlStatementBuilder::bind: binding text it empty!", m_sqlTemplate); } void SqlStatementBuilder::checkBindingTextVectorIsNotEmpty(const Utils::SmallStringVector &textVector) const { if (textVector.empty()) - throwException("SqlStatementBuilder::bind: binding text vector it empty!", m_sqlTemplate.constData()); + throwException("SqlStatementBuilder::bind: binding text vector it empty!", m_sqlTemplate); } void SqlStatementBuilder::checkBindingIntegerVectorIsNotEmpty(const std::vector<int> &integerVector) const { if (integerVector.empty()) - throwException("SqlStatementBuilder::bind: binding integer vector it empty!", m_sqlTemplate.constData()); + throwException("SqlStatementBuilder::bind: binding integer vector it empty!", m_sqlTemplate); } -void SqlStatementBuilder::throwException(const char *whatHasHappened, const char *errorMessage) +void SqlStatementBuilder::throwException(const char *whatHasHappened, Utils::SmallString sqlTemplate) { - throw SqlStatementBuilderException(whatHasHappened, errorMessage); + throw SqlStatementBuilderException(whatHasHappened, std::move(sqlTemplate)); +} + +const char *SqlStatementBuilderException::what() const noexcept +{ + return m_whatHasHappened; } } // namespace Sqlite |