diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2014-11-25 08:53:16 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2014-11-25 08:53:16 +0200 |
commit | 1bbe71637e6b10aea3cb10db1fe3c7bb80f6382b (patch) | |
tree | c48bb3211fd38b2f5c69945c8f1e94caed6a8b85 | |
parent | 239c24da194d98e0823642d408d35fc8fe3e7ae9 (diff) |
Get rid of trailing newlines in error messages
-rw-r--r-- | odb/mssql/error.cxx | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/odb/mssql/error.cxx b/odb/mssql/error.cxx index 0c41d32..7ac3f88 100644 --- a/odb/mssql/error.cxx +++ b/odb/mssql/error.cxx @@ -3,6 +3,7 @@ // license : ODB NCUEL; see accompanying LICENSE file #include <string> +#include <cstring> // std::strlen #include <odb/mssql/mssql.hxx> #include <odb/mssql/error.hxx> @@ -222,6 +223,12 @@ namespace odb conn->mark_failed (); } + // Get rid of a trailing newline if there is one. + // + size_t n (strlen (msg)); + if (n != 0 && msg[n - 1] == '\n') + msg[n - 1] = '\0'; + e.append (native_code, sqlstate, msg); } else |