|
1 |
| -// Copyright (c) 2015, 2024, Oracle and/or its affiliates. |
| 1 | +// Copyright (c) 2015, 2025, Oracle and/or its affiliates. |
2 | 2 |
|
3 | 3 | //-----------------------------------------------------------------------------
|
4 | 4 | //
|
@@ -49,6 +49,7 @@ NJS_NAPI_METHOD_DECL_SYNC(njsConnection_getExternalName);
|
49 | 49 | NJS_NAPI_METHOD_DECL_SYNC(njsConnection_getInstanceName);
|
50 | 50 | NJS_NAPI_METHOD_DECL_SYNC(njsConnection_getInternalName);
|
51 | 51 | NJS_NAPI_METHOD_DECL_SYNC(njsConnection_getMaxOpenCursors);
|
| 52 | +NJS_NAPI_METHOD_DECL_SYNC(njsConnection_getMaxIdentifierLength); |
52 | 53 | NJS_NAPI_METHOD_DECL_SYNC(njsConnection_getOracleServerVersion);
|
53 | 54 | NJS_NAPI_METHOD_DECL_SYNC(njsConnection_getOracleServerVersionString);
|
54 | 55 | NJS_NAPI_METHOD_DECL_ASYNC(njsConnection_getQueue);
|
@@ -157,6 +158,8 @@ static const napi_property_descriptor njsClassProperties[] = {
|
157 | 158 | napi_default, NULL },
|
158 | 159 | { "getMaxOpenCursors", NULL, njsConnection_getMaxOpenCursors, NULL, NULL,
|
159 | 160 | NULL, napi_default, NULL },
|
| 161 | + { "getMaxIdentifierLength", NULL, njsConnection_getMaxIdentifierLength, NULL, NULL, |
| 162 | + NULL, napi_default, NULL }, |
160 | 163 | { "getOracleServerVersion", NULL, njsConnection_getOracleServerVersion,
|
161 | 164 | NULL, NULL, NULL, napi_default, NULL },
|
162 | 165 | { "getOracleServerVersionString", NULL,
|
@@ -1236,6 +1239,29 @@ NJS_NAPI_METHOD_IMPL_SYNC(njsConnection_getMaxOpenCursors, 0, NULL)
|
1236 | 1239 | return true;
|
1237 | 1240 | }
|
1238 | 1241 |
|
| 1242 | +//----------------------------------------------------------------------------- |
| 1243 | +// njsConnection_getMaxIdentifierLength() |
| 1244 | +// Get accessor of "maxIdentifierLength" property. |
| 1245 | +//----------------------------------------------------------------------------- |
| 1246 | +NJS_NAPI_METHOD_IMPL_SYNC(njsConnection_getMaxIdentifierLength, 0, NULL) |
| 1247 | +{ |
| 1248 | + njsConnection *conn = (njsConnection*) callingInstance; |
| 1249 | + dpiConnInfo connInfo; |
| 1250 | + |
| 1251 | + if (conn->handle) { |
| 1252 | + if (dpiConn_getInfo(conn->handle, &connInfo) < 0) |
| 1253 | + return njsUtils_throwErrorDPI(env, globals); |
| 1254 | + // The check below is made, because Oracle Client does not return the |
| 1255 | + // max identifier length reliably when using Oracle Client |
| 1256 | + // 12.1 (or lower) to connect to Oracle Database 12.2 (or higher). |
| 1257 | + // See https://github.com/oracle/python-oracledb/issues/395 |
| 1258 | + if (connInfo.maxIdentifierLength != 0) |
| 1259 | + NJS_CHECK_NAPI(env, napi_create_uint32(env, connInfo.maxIdentifierLength, |
| 1260 | + returnValue)) |
| 1261 | + } |
| 1262 | + return true; |
| 1263 | +} |
| 1264 | + |
1239 | 1265 |
|
1240 | 1266 | //-----------------------------------------------------------------------------
|
1241 | 1267 | // njsConnection_getExecuteManyOutBinds()
|
|
0 commit comments