From eef18d10b4edb26713f683f4b5cd5b0770e9e875 Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Sat, 25 Mar 2017 15:21:43 +0100 Subject: sqlite.cpp: Use ostringstream instead of + Using operator+ with a C string and an integer is pointer arithmetic instead of string concatenation. Therefore, this patch replaces the operator+ with a std::ostringstream to actually concatenate the string and the integer. --- src/sqlitepp.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/sqlitepp.cpp b/src/sqlitepp.cpp index fc14f63..10315e5 100644 --- a/src/sqlitepp.cpp +++ b/src/sqlitepp.cpp @@ -143,11 +143,13 @@ int Statement::getParameterIndex(const std::string& name) const { } void Statement::handleBindResult(const int index, const int result) const { + std::ostringstream s; switch (result) { case SQLITE_OK: break; case SQLITE_RANGE: - throw std::out_of_range("Bind index out of range: " + index); + s << "Bind index out of range: " << index; + throw std::out_of_range(s.str()); case SQLITE_NOMEM: throw std::runtime_error("No memory to bind parameter"); default: -- cgit v1.2.3