Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Made changes with OutParam::OCCICLOB bacause of problems with output cirillic chars #173

Open
wants to merge 1 commit into from

3 participants

@piraman

I found a problem with output data with cyrillic chars from oracle. When output was large size (over ~2000 chars) i got unrecognized chars in clob. The settings are: NLS_LANG=.UTF8 (also tried AMERICAN_AMERICA.UTF8, AMERICAN_AMERICA.AL32UTF8.). After i made changes in connection.cpp it started work. :)

@piraman piraman commented on the diff
src/connection.cpp
@@ -795,12 +795,13 @@ void Connection::handleResult(ExecuteBaton* baton, Handle<Value> (&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];
@piraman
piraman added a note

Not enough size

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@realityfilter

I think this problem might have something todo with bugfix of pull request #198.

Currently reading a clob is broken because the whole buffer gets appended to the result string regardless of the read count.

@raztus
Collaborator

@piraman I've just merged #198. Would you please try it from master and see if it fixes your issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 1 deletion.
  1. +2 −1  src/connection.cpp
View
3  src/connection.cpp
@@ -795,12 +795,13 @@ void Connection::handleResult(ExecuteBaton* baton, Handle<Value> (&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];
@piraman
piraman added a note

Not enough size

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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);
Something went wrong with that request. Please try again.