Skip to content

Commit 0ae3b9e

Browse files
committed
Update outFormat and connection doc
1 parent 03fef76 commit 0ae3b9e

File tree

1 file changed

+51
-10
lines changed

1 file changed

+51
-10
lines changed

doc/api.md

Lines changed: 51 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -323,13 +323,15 @@ queries from returning unexpectedly large numbers of rows.
323323

324324
<a name="propdboutformat"></a>
325325
```
326-
String outFormat
326+
Number outFormat
327327
```
328328

329329
The format of rows fetched by the `execute()` call. This can be either
330-
`ARRAY` or `OBJECT`. If specified as `ARRAY`, each row is fetched as an
331-
array of column values. The default value is `ARRAY`, which is more
332-
efficient.
330+
of the [Oracledb constants](#oracledbconstants) `ARRAY` or `OBJECT`.
331+
The default value is `ARRAY` which is more efficient.
332+
333+
If specified as `ARRAY`, each row is fetched as an array of column
334+
values.
333335

334336
If specified as `OBJECT`, each row is fetched as a JavaScript object.
335337
The object has a property for each column name, with the property
@@ -1144,7 +1146,7 @@ Callback function parameter | Description
11441146
## <a name="connectionhandling"></a> 6. Connection Handling
11451147

11461148
Connections can be created directly by *Oracledb*
1147-
[getConnection()](#getconnectiondb):
1149+
[`getConnection()`](#getconnectiondb):
11481150

11491151
```javascript
11501152
var oracledb = require('oracledb');
@@ -1155,12 +1157,18 @@ oracledb.getConnection(
11551157
password : "welcome",
11561158
connectString : "localhost/XE"
11571159
},
1158-
. . .
1159-
);
1160+
function(err, connection)
1161+
{
1162+
if (err) {
1163+
console.error(err.message);
1164+
return;
1165+
}
1166+
. . .
1167+
});
11601168
```
11611169

11621170
Alternatively connections can be obtained from *Pool*
1163-
[getConnection()](#getconnectionpool):
1171+
[`getConnection()`](#getconnectionpool):
11641172

11651173

11661174
```javascript
@@ -1188,10 +1196,43 @@ recycled. However, in situations where connections are used
11881196
infrequently, direct connections may be more efficient than using a
11891197
connection pool.
11901198

1199+
Connections should be released with [`release()`](#release) when no
1200+
longer needed:
1201+
1202+
```javascript
1203+
var oracledb = require('oracledb');
1204+
1205+
oracledb.getConnection(
1206+
{
1207+
user : "hr",
1208+
password : "welcome",
1209+
connectString : "localhost/XE"
1210+
},
1211+
function(err, connection)
1212+
{
1213+
if (err) {
1214+
console.error(err.message);
1215+
return;
1216+
}
1217+
1218+
. . .
1219+
1220+
connection.release(
1221+
function(err)
1222+
{
1223+
console.error(err.message);
1224+
return;
1225+
});
1226+
});
1227+
```
1228+
1229+
This is particularly true with connection pools. Pooled connections
1230+
should also be released before calling [`terminate()`](#terminate).
1231+
11911232
### <a name="connectionstrings"></a> 6.1 Connection Strings
11921233

1193-
The *Oracledb* [getConnection()](#getconnectiondb) and *Pool*
1194-
[getConnection()](#getconnectionpool) `connectString` can be an
1234+
The *Oracledb* [`getConnection()`](#getconnectiondb) and *Pool*
1235+
[`getConnection()`](#getconnectionpool) `connectString` can be an
11951236
Easy Connect string, or a Connect Name from a `tnsnames.ora` file, or
11961237
the name of a local Oracle database instance.
11971238

0 commit comments

Comments
 (0)