aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2014-11-25 08:53:16 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2014-11-25 08:53:16 +0200
commit52f9ad475d953e00dfebddf67efea4df07355ea6 (patch)
treef5b7f5c85280f22e51dcee86d828397317511695
parentb39e670403bfdff6870d9b9c7b075230e84c27cf (diff)
Get rid of trailing newlines in error messages
-rw-r--r--odb/oracle/error.cxx7
1 files changed, 7 insertions, 0 deletions
diff --git a/odb/oracle/error.cxx b/odb/oracle/error.cxx
index 68bdc44..006fef5 100644
--- a/odb/oracle/error.cxx
+++ b/odb/oracle/error.cxx
@@ -4,6 +4,7 @@
#include <oci.h>
+#include <cstring> // std::strlen
#include <cassert>
#include <odb/details/buffer.hxx>
@@ -184,6 +185,12 @@ namespace odb
if (r == OCI_NO_DATA)
break;
+ // Get rid of a trailing newline if there is one.
+ //
+ size_t n (strlen (b));
+ if (n != 0 && b[n - 1] == '\n')
+ b[n - 1] = '\0';
+
dbe.append (e, b);
}