Skip to content

Commit 02d49cc

Browse files
committed
OSON encode/decoder to support field name length > 255 bytes & relative offsets + Code refactoring for fetching Oracle Client and DB server versions in Thick mode
1 parent 9491db7 commit 02d49cc

File tree

16 files changed

+686
-307
lines changed

16 files changed

+686
-307
lines changed

doc/src/release_notes.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ Common Changes
1717
returned by SODA in Oracle Database 23.4 and higher in the ``_id``
1818
attribute of documents stored in native collections.
1919

20+
#) Added support for an Oracle Database 23c JSON feature allowing for field
21+
names with more than 255 UTF-8 encoded bytes.
22+
23+
#) Added support for an Oracle Database 23c JSON feature improving JSON
24+
storage usage.
25+
2026
Thin Mode Changes
2127
++++++++++++++++++
2228

lib/connection.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,7 @@ class Connection extends EventEmitter {
860860
//---------------------------------------------------------------------------
861861
encodeOSON(value) {
862862
const encoder = new oson.OsonEncoder();
863-
return encoder.encode(transformer.transformJsonValue(value));
863+
return encoder.encode(transformer.transformJsonValue(value), this._impl._osonMaxFieldNameSize);
864864
}
865865

866866
//---------------------------------------------------------------------------

lib/errors.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ messages.set(ERR_INTEGER_TOO_LARGE, // NJS-112
358358
messages.set(ERR_UNEXPECTED_DATA, // NJS-113
359359
'unexpected data received: %s');
360360
messages.set(ERR_OSON_FIELD_NAME_LIMITATION, // NJS-114
361-
'OSON field names may not exceed 255 UTF-8 encoded bytes');
361+
'OSON field names may not exceed %d UTF-8 encoded bytes');
362362
messages.set(ERR_ORACLE_NUMBER_NO_REPR, // NJS-115
363363
'value cannot be represented as an Oracle Database number');
364364
messages.set(ERR_UNSUPPORTED_VERIFIER_TYPE, // NJS-116

lib/impl/connection.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class ConnectionImpl {
3737
this._inProgress = false;
3838
this._dbObjectTypes = new Map();
3939
this._requestQueue = [];
40+
this._osonMaxFieldNameSize = 255;
4041
}
4142

4243
//---------------------------------------------------------------------------

lib/impl/datahandlers/constants.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ module.exports = {
4444
TNS_JSON_MAGIC_BYTE_1: 0xff,
4545
TNS_JSON_MAGIC_BYTE_2: 0x4a, // 'J'
4646
TNS_JSON_MAGIC_BYTE_3: 0x5a, // 'Z'
47-
TNS_JSON_VERSION: 1,
47+
TNS_JSON_VERSION_MAX_FNAME_255: 1,
48+
TNS_JSON_VERSION_MAX_FNAME_65535: 3,
4849
TNS_JSON_FLAG_HASH_ID_UINT8: 0x0100,
4950
TNS_JSON_FLAG_HASH_ID_UINT16: 0x0200,
5051
TNS_JSON_FLAG_NUM_FNAMES_UINT16: 0x0400,
@@ -56,6 +57,7 @@ module.exports = {
5657
TNS_JSON_FLAG_LEN_IN_PCODE: 0x04,
5758
TNS_JSON_FLAG_NUM_FNAMES_UINT32: 0x08,
5859
TNS_JSON_FLAG_IS_SCALAR: 0x10,
60+
TNS_JSON_FLAG_SEC_FNAMES_SEG_UINT16: 0x100,
5961

6062
// JSON data types
6163
TNS_JSON_TYPE_NULL: 0x30,

0 commit comments

Comments
 (0)