Fix metadata for NCLOB

This commit is contained in:
Christopher Jones 2020-03-04 10:54:07 +11:00
parent adc3ec16be
commit 5382af124b
4 changed files with 17 additions and 10 deletions

View File

@ -46,6 +46,13 @@ and
- Added SODA function
[`sodaCollection.truncate()`](https://oracle.github.io/node-oracledb/doc/api.html#sodacolltruncate).
- Fixed Lob class
[`lob.type`](https://oracle.github.io/node-oracledb/doc/api.html#proplobtype)
and
[`metaData.fetchType`](https://oracle.github.io/node-oracledb/doc/api.html#execmetadata)
when streaming NCLOB data. They are now `oracledb.NCLOB` instead of
`oracledb.CLOB`.`
- Removed use of git in `package/buildpackage.js` making offline builds cleaner
for self-hosted node-oracledb.

View File

@ -5152,12 +5152,12 @@ The maximum value for `pieceSize` is limited to the value of UINT_MAX.
readonly Number type
```
This read-only attribute shows the type of Lob being used. It will
have the value of one of the constants
[`oracledb.BLOB`](#oracledbconstantsnodbtype) or
[`oracledb.CLOB`](#oracledbconstantsnodbtype). The value is derived from the
bind type when using LOB bind variables, or from the column type when
a LOB is returned by a query.
This read-only attribute shows the type of Lob being used. It will have the
value of one of the constants [`oracledb.BLOB`](#oracledbconstantsnodbtype),
[`oracledb.CLOB`](#oracledbconstantsnodbtype) or
[`oracledb.NCLOB`](#oracledbconstantsnodbtype). The value is derived from the
bind type when using LOB bind variables, or from the column type when a LOB is
returned by a query.
### <a name="lobmethods"></a> 7.2 Lob Methods

View File

@ -238,8 +238,9 @@ static uint32_t njsVariable_getDataType(njsVariable *var)
case DPI_ORACLE_TYPE_TIMESTAMP_LTZ:
return NJS_DATATYPE_DATE;
case DPI_ORACLE_TYPE_CLOB:
case DPI_ORACLE_TYPE_NCLOB:
return NJS_DATATYPE_CLOB;
case DPI_ORACLE_TYPE_NCLOB:
return NJS_DATATYPE_NCLOB;
case DPI_ORACLE_TYPE_BLOB:
return NJS_DATATYPE_BLOB;
case DPI_ORACLE_TYPE_OBJECT:
@ -841,8 +842,7 @@ static bool njsVariable_processBuffer(njsVariable *var,
return njsBaton_setError(baton, errInsufficientMemory);
for (i = 0; i < buffer->numElements; i++) {
lob = &buffer->lobs[i];
lob->dataType = (var->varTypeNum == DPI_ORACLE_TYPE_BLOB) ?
NJS_DATATYPE_BLOB : NJS_DATATYPE_CLOB;
lob->dataType = var->varTypeNum;
lob->isAutoClose = true;
elementIndex = baton->bufferRowIndex + i;
data = &buffer->dpiVarData[elementIndex];

View File

@ -1296,7 +1296,7 @@ describe('17. extendedMetaData.js', function() {
should.not.exist(err);
(result.metaData).should.deepEqual(
[ { name: 'NCLB',
fetchType: oracledb.CLOB,
fetchType: oracledb.NCLOB,
dbType: oracledb.DB_TYPE_NCLOB,
dbTypeName: "NCLOB",
nullable: true } ]