@@ -231,6 +231,7 @@ limitations under the License.
231
231
21 . [ Async/Await and node-oracledb] ( #asyncawaitoverview )
232
232
22 . [ Tracing SQL and PL/SQL Statements] ( #tracingsql )
233
233
23 . [ Migrating from node-oracledb 1.13 to node-oracledb 2.0] ( #migratev1v2 )
234
+ 24 . [ Migrating from node-oracledb 2.0 to node-oracledb 2.1] ( #migratev20v21 )
234
235
235
236
## <a name =" intro " ></a > 1. Introduction
236
237
@@ -3783,7 +3784,7 @@ function fetchRowsFromRS(connection, resultSet, numRows)
3783
3784
3784
3785
#### <a name="streamingresults"></a> 9.1.3 Query Streaming
3785
3786
3786
- Streaming query results allows data to be piped to other streams, for
3787
+ Streaming of query results allows data to be piped to other streams, for
3787
3788
example when dealing with HTTP responses.
3788
3789
3789
3790
Use [` connection .queryStream ()` ](#querystream) to create a stream from
@@ -3797,27 +3798,21 @@ With streaming, each row is returned as a `data` event. Query
3797
3798
metadata is available via a ` metadata` event. The ` end` event
3798
3799
indicates the end of the query results.
3799
3800
3801
+ Query results should be fetched to completion to avoid resource leaks,
3802
+ or (from Node.js 8 onwards) the Stream [` destroy ()` ][92] method can be
3803
+ used to terminate a stream early. For older Node.js versions use a
3804
+ [ResultSet with callbacks](#resultsethandling) if you need to stop a
3805
+ query before retrieving all data. Note the previous, experimental
3806
+ ` _close ()` method no longer emits a 'close' event.
3807
+
3800
3808
The connection must remain open until the stream is completely read.
3801
3809
3802
3810
The query stream implementation is a wrapper over the [ResultSet
3803
- Class](#resultsetclass). In particular, calls to
3804
- [getRows()](#getrows) are made internally to fetch each successive
3805
- subset of data, each row of which will generate a ` data` event. The
3806
- number of rows fetched from the database by each ` getRows ()` call is
3807
- set to the value of [` oracledb .fetchArraySize ` ](#propdbfetcharraysize)
3808
- or the option [` fetchArraySize` ](#propexecfetcharraysize). This value
3809
- does not alter the number of rows returned by the stream since
3810
- ` getRows ()` will be called each time more rows are needed. However
3811
- the value can be used to tune performance.
3812
-
3813
- Query results must be fetched to completion to avoid resource leaks.
3814
- The ResultSet ` close ()` call for streaming query results will be
3815
- executed internally when all data has been fetched. If you need to be
3816
- able to stop a query before retrieving all data, use a
3817
- [ResultSet with callbacks](#resultsethandling). (Note: An
3818
- experimental ` querystream ._close ()` method exists to terminate a
3819
- stream early. It is under evaluation, may changed or be removed, and
3820
- should not be used in production.)
3811
+ Class](#resultsetclass). In particular, successive calls to
3812
+ [getRow()](#getrow) are made internally. Each row will generate a
3813
+ ` data` event. For tuning, adjust the value of
3814
+ [` oracledb .fetchArraySize ` ](#propdbfetcharraysize) or the ` execute ()`
3815
+ option [` fetchArraySize` ](#propexecfetcharraysize).
3821
3816
3822
3817
An example of streaming query results is:
3823
3818
@@ -6759,8 +6754,16 @@ When upgrading from node-oracledb version 1.13 to version 2.0:
6759
6754
- Test applications to check if changes such as the improved property
6760
6755
validation uncover latent problems in your code.
6761
6756
6757
+ ## <a name="migratev20v21"></a> 24. Migrating from node-oracledb 2.0 to node-oracledb 2.1
6758
+
6759
+ When upgrading from node-oracledb version 2.0 to version 2.1:
6762
6760
6761
+ - If using the experimental ` _close` method with [Query
6762
+ Streaming](#streamingresults) in Node 8 or later:
6763
6763
6764
+ - Change the method name from ` _close ()` to [` destroy ()` ][92].
6765
+ - Stop passing a callback.
6766
+ - Optionally pass an error.
6764
6767
6765
6768
[1]: https://www.npmjs.com/package/oracledb
6766
6769
[2]: https://github.com/oracle/node-oracledb/blob/master/INSTALL.md
@@ -6853,3 +6856,4 @@ When upgrading from node-oracledb version 1.13 to version 2.0:
6853
6856
[89]: https://github.com/oracle/node-oracledb/tree/master/examples/dbconfig.js
6854
6857
[90]: https://docs.oracle.com/en/database/oracle/oracle-database/12.2/admin/getting-started-with-database-administration.html#GUID-5F1E393E-97B8-43BC-BD68-3595251A6F7C
6855
6858
[91]: https://www.youtube.com/watch?v=WDJacg0NuLo
6859
+ [92]: https://nodejs.org/api/stream.html#stream_readable_destroy_error
0 commit comments