aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/sqlite/sqliteexception.cpp
diff options
context:
space:
mode:
authorMarco Bubke <[email protected]>2025-06-10 21:34:52 +0200
committerMarco Bubke <[email protected]>2025-06-12 10:33:31 +0000
commite12b1ef30dc2d7b3ec24ed1dc1e79e7bcbed5a7a (patch)
treec9bd1533b2531f0b603e9746357b736eda6c0aa7 /src/libs/sqlite/sqliteexception.cpp
parent7c9716a8de2217e223640092a87ef1e6f19f339d (diff)
Sqlite: Fix exception message
Utils::SmallString is not anymore null terminated. Change-Id: I685af8df662d7d8ae2d9c773b381a0a63789f6b4 Reviewed-by: Thomas Hartmann <[email protected]>
Diffstat (limited to 'src/libs/sqlite/sqliteexception.cpp')
-rw-r--r--src/libs/sqlite/sqliteexception.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/libs/sqlite/sqliteexception.cpp b/src/libs/sqlite/sqliteexception.cpp
index 11689204884..5ea31e036ae 100644
--- a/src/libs/sqlite/sqliteexception.cpp
+++ b/src/libs/sqlite/sqliteexception.cpp
@@ -15,6 +15,8 @@
namespace Sqlite {
+using namespace std::string_literals;
+
using NanotraceHR::keyValue;
const char *Exception::what() const noexcept
@@ -24,15 +26,16 @@ const char *Exception::what() const noexcept
const char *ExceptionWithMessage::what() const noexcept
{
- static Utils::SmallString text = Utils::SmallString::join(
- {"Sqlite::ExceptionWithMessage", m_sqliteErrorMessage});
+ static std::string text;
+ text = "Sqlite::ExceptionWithMessage: ";
+ text += message();
- return text.data();
+ return text.c_str();
}
void ExceptionWithMessage::printWarning() const
{
- qWarning() << what() << m_sqliteErrorMessage;
+ qWarning() << what();
}
StatementIsBusy::StatementIsBusy(Utils::SmallString &&sqliteErrorMessage,
@@ -63,10 +66,11 @@ StatementHasError::StatementHasError(Utils::SmallString &&sqliteErrorMessage,
const char *StatementHasError::what() const noexcept
{
- static Utils::SmallString text = Utils::SmallString::join(
- {"Sqlite::StatementHasError: ", message()});
+ static std::string text;
+ text = "Sqlite::StatementHasError: ";
+ text += message();
- return text.data();
+ return text.c_str();
}
const char *StatementIsMisused::what() const noexcept