Skip to content

Commit deeccf3

Browse files
committed
Remove streamNumRows and use oracledb.maxRows until we revisit parameter passing
1 parent 9a3bc94 commit deeccf3

File tree

5 files changed

+21
-43
lines changed

5 files changed

+21
-43
lines changed

doc/api.md

Lines changed: 15 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ limitations under the License.
5252
- 3.2.14 [queueRequests](#propdbqueuerequests)
5353
- 3.2.15 [queueTimeout](#propdbqueuetimeout)
5454
- 3.2.16 [stmtCacheSize](#propdbstmtcachesize)
55-
- 3.2.17 [streamNumRows](#propdbstreamnumrows)
56-
- 3.2.18 [version](#propdbversion)
55+
- 3.2.17 [version](#propdbversion)
5756
- 3.3 [Oracledb Methods](#oracledbmethods)
5857
- 3.3.1 [createPool()](#createpool)
5958
- 3.3.2 [getConnection()](#getconnectiondb)
@@ -490,6 +489,9 @@ The default value is 100.
490489

491490
This property may be overridden in an [`execute()`](#execute) call.
492491

492+
This property is also used by [`queryStream()`](#querystream) as an
493+
internal buffer size tuning parameter.
494+
493495
To improve database efficiency, SQL queries should use a row
494496
limiting clause like [OFFSET /
495497
FETCH](https://docs.oracle.com/database/121/SQLRF/statements_10002.htm#BABEAACC)
@@ -747,25 +749,7 @@ var oracledb = require('oracledb');
747749
oracledb.stmtCacheSize = 30;
748750
```
749751

750-
#### <a name="propdbstreamnumrows"></a> 3.2.17 streamNumRows
751-
752-
A value used when streaming rows with [`queryStream()`](#querystream).
753-
It does not limit the total number of rows returned by the stream or
754-
the `data` events generated. The value is passed to internal
755-
[getRows()](#getrows) calls and is used only for tuning.
756-
757-
The default value is 100.
758-
759-
This property may be overridden in a [`queryStream()`](#querystream) call.
760-
761-
##### Example
762-
763-
```javascript
764-
var oracledb = require('oracledb');
765-
oracledb.streamNumRows = 100;
766-
```
767-
768-
#### <a name="propdbversion"></a> 3.2.18 version
752+
#### <a name="propdbversion"></a> 3.2.17 version
769753
```
770754
readonly Number version
771755
```
@@ -1450,15 +1434,18 @@ Query results must be fetched to completion to avoid resource leaks.
14501434

14511435
The connection must remain open until the stream is completely read.
14521436

1437+
For tuning purposes the [`oracledb.maxRows`](#propdbmaxrows) property
1438+
can be used to size an internal buffer used by `queryStream()`. Note
1439+
it does not limit the number of rows returned by the stream. The
1440+
[`oracledb.prefetchRows`](#propdbprefetchrows) value will also affect
1441+
performance.
1442+
14531443
See [Streaming Query Results](#streamingresults) for more information.
14541444

14551445
##### Parameters
14561446

14571447
See [execute()](#execute).
14581448

1459-
An additional options attribute `streamNumRows` can be set. This
1460-
overrides *Oracledb* [`streamNumRows`](#propdbstreamnumrows).
1461-
14621449
#### <a name="release"></a> 4.2.5 release()
14631450

14641451
##### Prototype
@@ -2439,12 +2426,11 @@ The query stream implementation is a wrapper over the
24392426
[getRows()](#getrows) are made internally to fetch each successive
24402427
subset of data, each row of which will generate a `data` event. The
24412428
number of rows fetched from the database by each `getRows()` call is
2442-
specified by the [`oracledb.streamNumRows`](#propdbstreamnumrows)
2443-
value or the `queryStream()` option attribute `streamNumRows`. This
2444-
value does not alter the number of rows returned by the stream since
2429+
set to the value of [`oracledb.maxRows`](#propdbmaxrows). This value
2430+
does not alter the number of rows returned by the stream since
24452431
`getRows()` will be called each time more rows are needed. However
24462432
the value can be used to tune performance, as also can the value of
2447-
[`prefetchRows`](#propdbprefetchrows).
2433+
[`oracledb.prefetchRows`](#propdbprefetchrows).
24482434
24492435
There is no explicit ResultSet `close()` call for streaming query
24502436
results. This call will be executed internally when all data has been
@@ -2454,11 +2440,7 @@ data, use a [ResultSet with callbacks](#resultsethandling).
24542440
An example of streaming query results is:
24552441
24562442
```javascript
2457-
var stream = connection.queryStream('SELECT employees_name FROM employees',
2458-
[], // no bind variables
2459-
{ streamNumRows: 100 } // Used for tuning. Does not affect how many rows are returned.
2460-
// Default is 100
2461-
);
2443+
var stream = connection.queryStream('SELECT employees_name FROM employees');
24622444

24632445
stream.on('error', function (error) {
24642446
// handle any error...

examples/selectstream.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,7 @@ oracledb.getConnection(
4444
}
4545

4646
var stream = connection.queryStream(
47-
'SELECT first_name, last_name FROM employees ORDER BY employee_id',
48-
[], // no bind variables
49-
{ streamNumRows: 100 } // Used for tuning. Does not affect how many rows are returned.
50-
// Default is 100
47+
'SELECT first_name, last_name FROM employees ORDER BY employee_id'
5148
);
5249

5350
stream.on('error', function (error) {

lib/oracledb.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,6 @@ function extend(oracledb) {
155155
value: oracledbCLib.ResultSet,
156156
enumerable: true
157157
},
158-
streamNumRows: {
159-
value: 100,
160-
enumerable: true,
161-
writable: true
162-
},
163158
queueRequests: {
164159
value: true,
165160
enumerable: true,

lib/resultset-read-stream.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function ResultSetReadStream(conn, sql, binding, options) {
3131

3232
options.resultSet = true;
3333

34-
self.streamNumRows = options.streamNumRows || conn._oracledb.streamNumRows;
34+
self.streamNumRows = conn._oracledb.maxRows || 100;
3535

3636
Readable.call(self, {
3737
objectMode: true

lib/resultset.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ function extend(resultSet) {
7070
value: getRows,
7171
enumerable: true,
7272
writable: true
73+
},
74+
streamNumRows: { // Number of rows each getRows() call will make when usign queryStream
75+
enumerable: false,
76+
writable: true
7377
}
7478
}
7579
);

0 commit comments

Comments
 (0)