aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobin Krahl <me@robin-krahl.de>2017-03-25 15:21:43 +0100
committerRobin Krahl <me@robin-krahl.de>2017-03-25 15:21:43 +0100
commiteef18d10b4edb26713f683f4b5cd5b0770e9e875 (patch)
tree84ae85e831cf95ac1a1a8db3c2eb4afff063e17b /src
parent701de7a5a0890003ccd9ce0ba6eff322ed791009 (diff)
downloadsqlitepp-eef18d10b4edb26713f683f4b5cd5b0770e9e875.tar.gz
sqlitepp-eef18d10b4edb26713f683f4b5cd5b0770e9e875.tar.bz2
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.
Diffstat (limited to 'src')
-rw-r--r--src/sqlitepp.cpp4
1 files changed, 3 insertions, 1 deletions
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: