Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blob OUT inconsistently returning #231

Open
cyates81 opened this issue Nov 3, 2014 · 1 comment
Open

Blob OUT inconsistently returning #231

cyates81 opened this issue Nov 3, 2014 · 1 comment

Comments

@cyates81
Copy link

cyates81 commented Nov 3, 2014

Hello,

I have a stored procedure which has an out parameter of type BLOB. The content of that blob is a large string compressed using the java DeflaterOutputStream class.

I use node-oracle to get the return value and then pass it to zlib.inflate from node.js.

Here's the strange part...if I run the exact same test code a bunch of times in a row, say 20 times, half the time it works fine and half the time zlib throws either an incorrect header check error or an unknown compression method error.

As a test I wrote out the bytes to a file every call and they would always be the same size.
So it seems that either bytes are getting swapped or somehow the blob doesn't return properly around 50% of the time. I'm pretty sure the issue is with node-oracle because as a test I wrote a C# version which calls the same stored procedure and it uncompresses fine every time.

Am I doing something wrong or did I uncover a bug?

oracle.execute('call test_compress(:1)', [new oracle.OutParam(oracle.OCCIBLOB)], function(err, results) {
  console.dir(results.returnParam.length);
  zlib.inflate(results.returnParam, function(err, uncompressed) {
    if (err) {
      console.log(err);
      fs.writeFile('bad1', results.returnParam);
    } else {
      fs.writeFile('compressed1', results.returnParam);
      var StringDecoder = require('string_decoder').StringDecoder;
      var decoder = new StringDecoder('utf8');
      console.log(decoder.write(uncompressed));
    }
  });
});
@cyates81
Copy link
Author

cyates81 commented Nov 4, 2014

I thought I was testing this against the latest commit but was really only testing against the npm version. When using the latest commit it works as expected.

However, I never mentioned that when compiling I get an error on line 271 of executeBaton.cpp saying that pow is ambiguous. I had to add a static_cast<float>.

I'll try to do a pull request tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant