diff options
author | Robin Krahl <me@robin-krahl.de> | 2017-03-25 15:21:43 +0100 |
---|---|---|
committer | Robin Krahl <me@robin-krahl.de> | 2017-03-25 15:21:43 +0100 |
commit | eef18d10b4edb26713f683f4b5cd5b0770e9e875 (patch) | |
tree | 84ae85e831cf95ac1a1a8db3c2eb4afff063e17b | |
parent | 701de7a5a0890003ccd9ce0ba6eff322ed791009 (diff) | |
download | sqlitepp-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.
-rw-r--r-- | src/sqlitepp.cpp | 4 |
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: |