Skip to content

Commit 1fcf9d8

Browse files
author
Christopher Jones
committed
Various doc updates
1 parent 2b423f9 commit 1fcf9d8

File tree

1 file changed

+41
-31
lines changed

1 file changed

+41
-31
lines changed

doc/api.md

Lines changed: 41 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -973,6 +973,8 @@ The default properties may be overridden by specifying new properties
973973
in the `poolAttrs` parameter.
974974

975975
It is possible to add pools to the pool cache when calling `createPool()`.
976+
This allows pools to later be accessed by name, removing the need to
977+
pass the pool object through code.
976978
See [Connection Pool Cache](#connpoolcache) for more details.
977979

978980
A pool should be terminated with the [`pool.close()`](#poolclose)
@@ -1181,12 +1183,12 @@ The following table shows the various signatures that can be used when invoking
11811183

11821184
Signature | Description
11831185
--------- | -----------
1184-
oracledb.getConnection() | Gets a connection from the default pool. Returns a promise.
1185-
oracledb.getConnection(callback) | Gets a connection from the default pool. Invokes the callback.
1186-
oracledb.getConnection(poolAlias) | Gets a connection from the pool with the specified `poolAlias`. Returns a promise.
1187-
oracledb.getConnection(poolAlias, callback) | Gets a connection from the pool with the specified `poolAlias`. Invokes the callback.
1188-
oracledb.getConnection(connAttrs) | Creates a standalone, non-pooled connection. Returns a promise.
1189-
oracledb.getConnection(connAttrs, callback) | Creates a standalone, non-pooled connection. Invokes the callback.
1186+
`oracledb.getConnection()` | Gets a connection from the previously created default pool. Returns a promise.
1187+
`oracledb.getConnection(callback)` | Gets a connection from the previously created default pool. Invokes the callback.
1188+
`oracledb.getConnection(poolAlias)` | Gets a connection from the previously created pool with the specified `poolAlias`. Returns a promise.
1189+
`oracledb.getConnection(poolAlias, callback)` | Gets a connection from the previously created pool with the specified `poolAlias`. Invokes the callback.
1190+
`oracledb.getConnection(connAttrs)` | Creates a standalone, non-pooled connection. Returns a promise.
1191+
`oracledb.getConnection(connAttrs, callback)` | Creates a standalone, non-pooled connection. Invokes the callback.
11901192

11911193
See [Connection Handling](#connectionhandling) for more information on
11921194
connections.
@@ -2132,12 +2134,12 @@ An alias for [pool.close()](#poolclose).
21322134

21332135
## <a name="resultsetclass"></a> 7. ResultSet Class
21342136

2135-
Result sets allow query results to fetched from the database one at a
2137+
Result Sets allow query results to fetched from the database one at a
21362138
time, or in groups of rows. They can also be converted to Readable
2137-
Streams. Result sets enable applications to process very large data
2139+
Streams. Result Sets enable applications to process very large data
21382140
sets.
21392141

2140-
Result sets should also be used where the number of query rows cannot
2142+
Result Sets should also be used where the number of query rows cannot
21412143
be predicted and may be larger than a sensible
21422144
[`maxRows`](#propdbmaxrows) size.
21432145

@@ -2148,9 +2150,9 @@ node-oracledb when binding as type [`CURSOR`](#oracledbconstantsnodbtype) to a
21482150
PL/SQL REF CURSOR bind parameter.
21492151

21502152
The value of [`prefetchRows`](#propdbprefetchrows) can be adjusted to
2151-
tune the performance of result sets.
2153+
tune the performance of Result Sets.
21522154

2153-
See [ResultSet Handling](#resultsethandling) for more information on result sets.
2155+
See [ResultSet Handling](#resultsethandling) for more information on Result Sets.
21542156

21552157
### <a name="resultsetproperties"></a> 7.1 ResultSet Properties
21562158

@@ -2207,7 +2209,7 @@ promise = getRow();
22072209

22082210
##### Description
22092211

2210-
This call fetches one row of the result set as an object or an array of column values, depending on the value of [outFormat](#propdboutformat).
2212+
This call fetches one row of the Result Set as an object or an array of column values, depending on the value of [outFormat](#propdboutformat).
22112213

22122214
At the end of fetching, the `ResultSet` should be freed by calling [`close()`](#close).
22132215

@@ -2226,7 +2228,7 @@ promise = getRows(Number numRows);
22262228

22272229
##### Description
22282230

2229-
This call fetches `numRows` rows of the result set as an object or an array of column values, depending on the value of [outFormat](#propdboutformat).
2231+
This call fetches `numRows` rows of the Result Set as an object or an array of column values, depending on the value of [outFormat](#propdboutformat).
22302232

22312233
At the end of fetching, the `ResultSet` should be freed by calling [`close()`](#close).
22322234

@@ -2304,7 +2306,7 @@ oracledb.getConnection(
23042306
```
23052307

23062308
Applications which are heavy users of connections should create and
2307-
use a [Connection Pool]("#connpooling).
2309+
use a [Connection Pool](#connpooling).
23082310

23092311
### <a name="connectionstrings"></a> 8.1 Connection Strings
23102312

@@ -2956,6 +2958,12 @@ release the connection.
29562958
Queries may optionally be streamed using the *Connection*
29572959
[`queryStream()`](#querystream) method.
29582960
2961+
Connections can handle one database operation at a time. Other
2962+
operations will block. Structure your code to avoid starting parallel
2963+
operations on connections. For example, instead of using
2964+
`async.each()` which calls each of its items in parallel, use
2965+
`async.eachSeries()`.
2966+
29592967
### <a name="select"></a> 9.1 SELECT Statements
29602968
29612969
#### <a name="fetchingrows"></a> 9.1.1 Fetching Rows
@@ -2990,19 +2998,19 @@ stream wrapper, as described [later](#streamingresults). This
29902998
prevents query results being unexpectedly truncated by the
29912999
[`maxRows`](#propdbmaxrows) limit and removes the need to oversize
29923000
`maxRows` to avoid such truncation. Otherwise, for queries that
2993-
return a known small number of rows, non-result set queries may have
3001+
return a known small number of rows, non-Result Set queries may have
29943002
less overhead.
29953003
2996-
A result set is created when the `execute()` option property
2997-
[`resultSet`](#executeoptions) is `true`. Result set rows can be
3004+
A Result Set is created when the `execute()` option property
3005+
[`resultSet`](#executeoptions) is `true`. Result Set rows can be
29983006
fetched using [`getRow()`](#getrow) or [`getRows()`](#getrows) on the
29993007
`execute()` callback function's `result.resultSet` parameter property.
30003008
3001-
For result sets the [`maxRows`](#propdbmaxrows) limit is ignored. All
3009+
For Result Sets, the [`maxRows`](#propdbmaxrows) limit is ignored. All
30023010
rows can be fetched.
30033011
30043012
When all rows have been fetched, or the application does not want to
3005-
continue getting more rows, then the result set should be freed using
3013+
continue getting more rows, then the Result Set should be freed using
30063014
[`close()`](#close).
30073015
30083016
REF CURSORS returned from a PL/SQL block via an `oracledb.CURSOR` OUT
@@ -3023,7 +3031,7 @@ To fetch one row at a time use `getRow()` :
30233031
connection.execute(
30243032
"SELECT employee_id, last_name FROM employees ORDER BY employee_id",
30253033
[], // no bind variables
3026-
{ resultSet: true }, // return a result set. Default is false
3034+
{ resultSet: true }, // return a Result Set. Default is false
30273035
function(err, result)
30283036
{
30293037
if (err) { . . . }
@@ -3037,9 +3045,9 @@ function fetchOneRowFromRS(connection, resultSet)
30373045
function (err, row)
30383046
{
30393047
if (err) {
3040-
. . . // close the result set and release the connection
3048+
. . . // close the Result Set and release the connection
30413049
} else if (!row) { // no rows, or no more rows
3042-
. . . // close the result set and release the connection
3050+
. . . // close the Result Set and release the connection
30433051
} else {
30443052
console.log(row);
30453053
fetchOneRowFromRS(connection, resultSet); // get next row
@@ -3056,7 +3064,7 @@ var numRows = 10; // number of rows to return from each call to getRows()
30563064
connection.execute(
30573065
"SELECT employee_id, last_name FROM employees ORDER BY employee_id",
30583066
[], // no bind variables
3059-
{ resultSet: true }, // return a result set. Default is false
3067+
{ resultSet: true }, // return a Result Set. Default is false
30603068
function(err, result)
30613069
{
30623070
if (err) { . . . }
@@ -3071,15 +3079,15 @@ function fetchRowsFromRS(connection, resultSet, numRows)
30713079
function (err, rows)
30723080
{
30733081
if (err) {
3074-
. . . // close the result set and release the connection
3082+
. . . // close the Result Set and release the connection
30753083
} else if (rows.length > 0) { // got some rows
30763084
console.log(rows); // process rows
30773085
if (rows.length === numRows) // might be more rows
30783086
fetchRowsFromRS(connection, resultSet, numRows);
30793087
else // got fewer rows than requested so must be at end
3080-
. . . // close the result set and release the connection
3088+
. . . // close the Result Set and release the connection
30813089
} else { // else no rows
3082-
. . . // close the result set and release the connection
3090+
. . . // close the Result Set and release the connection
30833091
}
30843092
});
30853093
}
@@ -3317,6 +3325,8 @@ The default query result type mappings for Oracle Database types to JavaScript t
33173325
[OCIDateTime](https://docs.oracle.com/database/122/LNOCI/object-relational-data-types-in-oci.htm#LNOCI16840).
33183326
When binding a JavaScript Date value in an `INSERT` statement, the date is also inserted as `TIMESTAMP WITH
33193327
LOCAL TIME ZONE` using OCIDateTime.
3328+
See [Working with Dates Using the Node.js Driver](https://jsao.io/2016/09/working-with-dates-using-the-nodejs-driver/) for
3329+
a discussion of date handling.
33203330
33213331
##### Fetching as String
33223332
@@ -3965,7 +3975,7 @@ See [selectjson.js](https://github.com/oracle/node-oracledb/tree/master/examples
39653975
and [selectjsonclob.js](https://github.com/oracle/node-oracledb/tree/master/examples/selectjsonclob.js)
39663976
for runnable examples.
39673977
3968-
For more information about using JSON in Oracle Database see
3978+
For more information about using JSON in Oracle Database see the
39693979
[Database JSON Developer's Guide](https://docs.oracle.com/database/122/ADJSN/toc.htm).
39703980
39713981
## <a name="bind"></a> 13. Bind Parameters for Prepared Statements
@@ -4252,7 +4262,7 @@ Oracle REF CURSORS can be fetched in node-oracledb by binding a
42524262
also be converted to a Readable Stream by using
42534263
[`toQueryStream()`](#toquerystream).
42544264
4255-
If using `getRow()` or `getRows()` the result set must be freed using
4265+
If using `getRow()` or `getRows()` the Result Set must be freed using
42564266
[`close()`](#close) when all rows have been fetched, or when the
42574267
application does not want to continue getting more rows. If the REF
42584268
CURSOR is set to NULL or is not set in the PL/SQL procedure then the
@@ -4307,15 +4317,15 @@ function fetchRowsFromRS(connection, resultSet, numRows)
43074317
function (err, rows)
43084318
{
43094319
if (err) {
4310-
. . . // close the result set and release the connection
4320+
. . . // close the Result Set and release the connection
43114321
} else if (rows.length > 0) { // got some rows
43124322
console.log(rows); // process rows
43134323
if (rows.length === numRows) // might be more rows
43144324
fetchRowsFromRS(connection, resultSet, numRows);
43154325
else // got fewer rows than requested so must be at end
4316-
. . . // close the result set and release the connection
4326+
. . . // close the Result Set and release the connection
43174327
} else { // else no rows
4318-
. . . // close the result set and release the connection
4328+
. . . // close the Result Set and release the connection
43194329
}
43204330
});
43214331
}

0 commit comments

Comments
 (0)