@@ -75,8 +75,9 @@ limitations under the License.
75
75
7 . [ SQL Execution] ( #sqlexecution )
76
76
- 7.1 [ SELECT Statements] ( #select )
77
77
- 7.1.1 [ Query Output Formats] ( #queryoutputformats )
78
- - 7.1.2 [ Result Type Mapping] ( #typemap )
79
- - 7.1.3 [ Statement Caching] ( #stmtcache )
78
+ - 7.1.2 [ Query Column Metadata] ( #querymeta )
79
+ - 7.1.3 [ Result Type Mapping] ( #typemap )
80
+ - 7.1.4 [ Statement Caching] ( #stmtcache )
80
81
- 7.2 [ Bind Parameters for Prepared Statements] ( #bind )
81
82
- 7.2.1 [ IN Bind Parameters] ( #inbind )
82
83
- 7.2.2 [ OUT and IN OUT Bind Parameters] ( #outbind )
@@ -1050,6 +1051,13 @@ one single row. The number of rows returned is limited to the
1050
1051
` maxRows ` configuration property of the * Oracledb* object, although
1051
1052
this may be overridden in any ` execute() ` call.
1052
1053
1054
+ ```
1055
+ array metaData
1056
+ ```
1057
+
1058
+ For ` SELECT ` statements, this contains an array of column names for
1059
+ the select list. For non queries, this property is undefined.
1060
+
1053
1061
```
1054
1062
Array/object outBinds
1055
1063
```
@@ -1355,7 +1363,38 @@ property names are uppercase. This is the default casing behavior for
1355
1363
Oracle client programs when a database table is created with
1356
1364
case-insensitive column names.
1357
1365
1358
- ### <a name =" typemap " ></a > 7.1.2 Result Type Mapping
1366
+ ### <a name =" querymeta " ></a > 7.1.2 Query Column Metadata
1367
+
1368
+ The column names of a query are returned in the
1369
+ [ ` execute() ` ] ( #execute ) callback ` result ` parameter:
1370
+
1371
+ ``` javascript
1372
+ connection .execute (" SELECT department_id, department_name "
1373
+ + " FROM departments "
1374
+ + " WHERE department_id = :did" ,
1375
+ [180 ],
1376
+ function (err , result )
1377
+ {
1378
+ if (err) {
1379
+ console .error (err .message );
1380
+ return ;
1381
+ }
1382
+ console .log (result .metaData );
1383
+ });
1384
+ ```
1385
+
1386
+ The output is an array of objects, one per column. Each object has a
1387
+ ` name ` attribute:
1388
+
1389
+ ```
1390
+ [ { name: 'DEPARTMENT_ID' }, { name: 'DEPARTMENT_NAME' } ]
1391
+ ```
1392
+
1393
+ The names are in uppercase. This is the default casing behavior for
1394
+ Oracle client programs when a database table is created with
1395
+ case-insensitive column names.
1396
+
1397
+ ### <a name =" typemap " ></a > 7.1.3 Result Type Mapping
1359
1398
1360
1399
Oracle character, number and date columns can be selected. Data types
1361
1400
that are currently unsupported give a "datatype is not supported"
@@ -1377,7 +1416,7 @@ Query result type mappings for Oracle Database types to JavaScript types are:
1377
1416
When binding a JavaScript Date value in an ` INSERT ` statement, the date is also inserted as `TIMESTAMP WITH
1378
1417
LOCAL TIMEZONE` using OCIDateTime.
1379
1418
1380
- ### <a name =" stmtcache " ></a > 7.1.3 Statement Caching
1419
+ ### <a name =" stmtcache " ></a > 7.1.4 Statement Caching
1381
1420
1382
1421
Node-oracledb uses the
1383
1422
[ Oracle OCI statement cache] ( https://docs.oracle.com/database/121/LNOCI/oci09adv.htm#i471377 )
0 commit comments