From 60e11d0bddaa0147507a1a222ad56015f2882e6a Mon Sep 17 00:00:00 2001 From: Sargon Date: Fri, 18 Apr 2014 11:53:50 +0400 Subject: [PATCH] Made changes with OutParam::OCCICLOB bacause of issue #92 --- src/connection.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/connection.cpp b/src/connection.cpp index 9339234..d3bddee 100644 --- a/src/connection.cpp +++ b/src/connection.cpp @@ -795,12 +795,13 @@ void Connection::handleResult(ExecuteBaton* baton, Handle (&argv)[2]) { output->clobVal.open(oracle::occi::OCCI_LOB_READONLY); oracle::occi::Stream* instream = output->clobVal.getStream(1,0); size_t chunkSize = output->clobVal.getChunkSize(); - char *buffer = new char[chunkSize]; + char *buffer = new char[chunkSize + 1]; memset(buffer, 0, chunkSize); std::string clobVal; int numBytesRead = instream->readBuffer(buffer, chunkSize); int totalBytesRead = 0; while (numBytesRead != -1) { + buffer[numBytesRead] = 0; totalBytesRead += numBytesRead; clobVal.append(buffer); numBytesRead = instream->readBuffer(buffer, chunkSize);