Skip to content

Commit 4c693e0

Browse files
committed
Handle Binding for null Boolean value
1 parent 8e21944 commit 4c693e0

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

lib/thin/protocol/messages/withData.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,9 @@ class MessageWithData extends Message {
447447

448448
if (!this.inFetch) {
449449
const actualNumBytes = buf.readSB4();
450-
if (actualNumBytes !== 0 && colValue !== null) {
450+
if (actualNumBytes < 0 && oraTypeNum === constants.TNS_DATA_TYPE_BOOLEAN) {
451+
colValue = null;
452+
} else if (actualNumBytes !== 0 && colValue !== null) {
451453
errors.throwErr(errors.ERR_INSUFFICIENT_BUFFER_FOR_BINDS);
452454
}
453455
} else if (oraTypeNum === constants.TNS_DATA_TYPE_LONG || oraTypeNum === constants.TNS_DATA_TYPE_LONG_RAW || variable.maxSize > buf.caps.maxStringSize) {

test/booleanBind.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,4 +273,14 @@ describe('224. booleanBind.js', function() {
273273
//(result.outBinds[0].DATEVALUE).should.be.a.Date();
274274
assert.strictEqual(true, result.outBinds[0].BOOLEANVALUE);
275275
}); // 224.9
276+
277+
it('224.10 OUT bind value "null"', async function() {
278+
const binds = {
279+
outval: { dir: oracledb.BIND_OUT, type: oracledb.DB_TYPE_BOOLEAN }
280+
};
281+
const sql = `begin :outval := null; end;`;
282+
283+
const result = await conn.execute(sql, binds);
284+
assert.strictEqual(null, result.outBinds.outval);
285+
}); // 224.10
276286
});

0 commit comments

Comments
 (0)