OCCIBLOB extraction #92

Closed
Alrico opened this Issue Oct 25, 2013 · 2 comments

Projects

None yet

3 participants

Alrico commented Oct 25, 2013

I've connected my web server node.js to Oracle, and I've already select some data from de database.There is no problem when I select data types like string or number, but I need to read some BLOBs too.
In order to extract my BLOB, I execute one Procedure from Oracle called "readBasicBlob" but I don't reach the expected results... In fact, each time the call is executed, I see different results in a random way...
I've tried to execute the example function include in outparam.js, and the result of the BLOB extraction is (000000001111111) instead of (010101010101010)
It's wire because the OCCIBLOB method it's the only one without a validation test in outparams.js. Anyone knows why?? Maybe the OCCIBLOB has not passed the validation test??
I've tried to avoid the OCCIBLOB use, but without this element my code becomes really complicated...
Anyone could help me?
Thanks a lot!!

maxux commented Dec 4, 2013

I got the same problem, buffer was wrong, don't know why. I fixed it (don't know if it's a good way, but it's a workaround):

On file connection.cpp, line ~742:

Replace:

node::Buffer *nodeBuff = node::Buffer::New(buffer, lobLength, RandomBytesFree, NULL);
v8::Localv8::Object globalObj = v8::Context::GetCurrent()->Global();

With:

node::Buffer *nodeBuff = node::Buffer::New(lobLength);
memcpy(Buffer::Data(nodeBuff), buffer, lobLength);
v8::Localv8::Object globalObj = v8::Context::GetCurrent()->Global();

And same for line ~619, but with "blobLength" and not "lobLength" this time.

@burkostya burkostya pushed a commit to burkostya/node-oracle that referenced this issue Mar 17, 2014
Konstantin Burykin fix BLOB reading
We do not need these deletes because `node::Buffer::New` accepts `RandomBytesFree` callback for deleting `buffer` by GC. fixes #92
84a0f9b

@maxux your fix solves the problem. thanks

@raztus raztus closed this in #160 Sep 17, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment