Skip to content

Commit a675adf

Browse files
committed
Emit Lob end event before close. Another fix by @bjouhier
1 parent 91c285e commit a675adf

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
- Changed write-only attributes to allow console.log() on Connection objects. Note the attribute values will show as null; refer to the documentation.
1010

11-
- Remove non-portable memory allocation for queries that return NULL.
11+
- Removed non-portable memory allocation for queries that return NULL.
1212

1313
- Added check to make sure `maxRows` is greater than zero for non-ResultSet queries.
1414

@@ -24,6 +24,8 @@
2424

2525
- Added a `type` property to the Lob class to distinguish CLOB and BLOB types.
2626

27+
- Corrected the order of Stream 'end' and 'close' events when reading a LOB.
28+
2729
- Made installation halt sooner for Node.js versions currently known to be unusable.
2830

2931
## node-oracledb v1.1.0 (3 Sep 2015)

examples/blobstream2.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@ oracledb.getConnection(
8686
}
8787
});
8888
});
89+
lob.on('close',
90+
function(chunk)
91+
{
92+
console.log("lob.on 'close' event");
93+
});
8994
lob.on('error',
9095
function(err)
9196
{

examples/clobstream2.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ oracledb.getConnection(
8181
}
8282
});
8383
});
84+
lob.on('close',
85+
function(chunk)
86+
{
87+
console.log("lob.on 'close' event");
88+
});
8489
lob.on('error',
8590
function(err)
8691
{

lib/oracledb.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,12 @@ Lob.prototype._read = function()
6666
self.emit('error', err);
6767
return;
6868
}
69+
self.push(str);
6970
if (!str) {
70-
self.close();
71+
process.nextTick(function() {
72+
self.close();
73+
});
7174
}
72-
self.push(str);
7375
});
7476
}
7577

0 commit comments

Comments
 (0)