Skip to content

Commit a335cd4

Browse files
committed
Add edition support in Thin Mode
1 parent 3a12a06 commit a335cd4

File tree

6 files changed

+28
-15
lines changed

6 files changed

+28
-15
lines changed

doc/src/api_manual/oracledb.rst

+4-5
Original file line numberDiff line numberDiff line change
@@ -853,18 +853,17 @@ Each of the configuration properties is described below.
853853

854854
See :ref:`Edition-Based Redefinition <ebr>` for more information.
855855

856-
.. note::
857-
858-
This property can only be used in the node-oracledb Thick mode. See
859-
:ref:`enablingthick`.
860-
861856
**Example**
862857

863858
.. code-block:: javascript
864859
865860
const oracledb = require('oracledb');
866861
oracledb.edition = 'ed_2';
867862
863+
.. versionchanged:: 6.8
864+
865+
Support for this property was added in node-oracledb Thin mode.
866+
868867
.. attribute:: oracledb.errorOnConcurrentExecute
869868

870869
.. versionadded:: 5.2

doc/src/release_notes.rst

+3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ Common Changes
2020
Thin Mode Changes
2121
+++++++++++++++++
2222

23+
#) Added support for setting the :attr:`~oracledb.edition` when connecting to
24+
the database.
25+
2326
#) Fixed error message in ``NJS-131`` to provide the correct range of the
2427
database object collection types.
2528

doc/src/user_guide/appendix_a.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ node-oracledb Thin and Thick modes. For more details see :ref:`modediff`.
153153
- Yes - Out-of-Band (OOB) Connection Breaks not supported
154154
- Yes
155155
* - Edition Based Redefinition (EBR) (see :ref:`ebr`)
156-
- No
156+
- Yes
157157
- Yes
158158
* - SQL execution (see :ref:`sqlexecution`)
159159
- Yes

doc/src/user_guide/plsql_execution.rst

+6-6
Original file line numberDiff line numberDiff line change
@@ -213,15 +213,15 @@ updated and tested while production users are still accessing the
213213
original version. Once every user has begun using the objects in the new
214214
edition, the old objects can be dropped.
215215

216-
.. note::
217-
218-
In this release, Edition-Based Redefinition is only supported in the
219-
node-oracledb Thick mode. See :ref:`enablingthick`.
220-
221216
To choose the edition, node-oracledb applications can set
222217
:attr:`oracledb.edition` globally, or specify a value
223218
when :ref:`creating a pool <createpoolpoolattrsedition>` or a
224-
:ref:`standalone connection <getconnectiondbattrsedition>`.
219+
:ref:`standalone connection <getconnectiondbattrsedition>`. You can also set
220+
the edition by using the ``ORA_EDITION`` environment variable. The edition
221+
value set as part of the connection parameters in
222+
:meth:`oracledb.createPool()` or :meth:`oracledb.getConnection()` takes
223+
precedence over the values specified in the :attr:`oracledb.edition` property
224+
or the ``ORA_EDITION`` environment variable.
225225

226226
The example below shows how a PL/SQL function ``DISCOUNT`` can be
227227
created with two different implementations. The initial procedure is

lib/thin/protocol/messages/auth.js

+11
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@ class AuthMessage extends Message {
107107
this.osUser = config.osUser;
108108
this.program = config.program;
109109
this.terminal = config.terminal;
110+
if (config.edition) {
111+
this.edition = config.edition;
112+
} else if (process.env.ORA_EDITION) {
113+
this.edition = process.env.ORA_EDITION;
114+
}
110115
this.setAuthMode(config);
111116
}
112117

@@ -235,6 +240,9 @@ class AuthMessage extends Message {
235240
this.encryptedJDWPData = ED.getEncryptedJSWPData(this.sessionKey, this.conn.jdwpData);
236241
numPairs += 1;
237242
}
243+
if (this.edition) {
244+
numPairs += 1;
245+
}
238246
if (this.schemaUser.length !== 0) {
239247
numPairs += 1;
240248
}
@@ -297,6 +305,9 @@ class AuthMessage extends Message {
297305
if (this.conn.jdwpData) {
298306
buf.writeKeyValue("AUTH_ORA_DEBUG_JDWP", this.encryptedJDWPData);
299307
}
308+
if (this.edition) {
309+
buf.writeKeyValue("AUTH_ORA_EDITION", this.edition);
310+
}
300311

301312
}
302313
}

test/editionTest.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ describe('160. editionTest.js', function() {
6565

6666
before(async function() {
6767

68-
let isRunnable = Boolean(!oracledb.thin && dbConfig.test.DBA_PRIVILEGE
69-
&& !dbConfig.test.drcp && !(await testsUtil.cmanTdmCheck()));
68+
let isRunnable = dbConfig.test.DBA_PRIVILEGE && !dbConfig.test.drcp
69+
&& !(await testsUtil.cmanTdmCheck());
7070
if (isRunnable) {
7171
const connection = await oracledb.getConnection(dbConfig);
72-
if (connection.oracleServerVersion < 1202000100) {
72+
if (connection.oracleServerVersion < 1201000200) {
7373
isRunnable = false;
7474
}
7575
await connection.close();

0 commit comments

Comments
 (0)