Skip to content

Commit 5027f69

Browse files
committed
Documentation, example and test updates
1 parent 2c4702d commit 5027f69

File tree

4 files changed

+21
-9
lines changed

4 files changed

+21
-9
lines changed

doc/src/user_guide/connection_handling.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1082,7 +1082,7 @@ See `appcontext.js <https://github.com/oracle/node-oracledb/tree/main/
10821082
examples/appcontext.js>`__ for a runnable example.
10831083

10841084
In Thin mode, you can set the application context for pooled connections by
1085-
using the :ref:`appContext <createpoolpoolattrsappcontext>`property in
1085+
using the :ref:`appContext <createpoolpoolattrsappcontext>` property in
10861086
:meth:`oracledb.createPool()`.
10871087

10881088
You can use application contexts to set up restrictive policies that are

examples/typehandlernum.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2023, 2024, Oracle and/or its affiliates. */
1+
/* Copyright (c) 2023, 2025, Oracle and/or its affiliates. */
22

33
/******************************************************************************
44
*
@@ -69,8 +69,11 @@ console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
6969
// will be processed by the converter function before it is returned to the
7070
// application.
7171

72-
function fth(metaData) {
72+
function fth(metaData, rowsetMetaData) {
7373
if (metaData.name == 'N_COL' && metaData.dbType === oracledb.DB_TYPE_NUMBER) {
74+
// Gets the metadata of the N_COL column
75+
const nColColumn = rowsetMetaData.find(col => col.name === 'N_COL');
76+
console.log(" MetaData of the N_COL column:", nColColumn);
7477
return {converter: formatNumber};
7578
}
7679
}
@@ -100,24 +103,25 @@ async function run() {
100103
}
101104

102105
await connection.execute(
103-
`CREATE TABLE no_typehandler_tab (n_col NUMBER)`);
106+
`CREATE TABLE no_typehandler_tab (id NUMBER, n_col NUMBER)`);
104107

105108
const data = 123456.78;
106109
console.log('2. Inserting number ' + data);
107110

108-
const inssql = `INSERT INTO no_typehandler_tab (n_col) VALUES (:bv)`;
111+
const inssql = `INSERT INTO no_typehandler_tab (id, n_col) VALUES (1, :bv)`;
109112
await connection.execute(inssql, { bv: data });
110113

111114
// Example 1
112115

113116
console.log('3. Selecting a formatted number');
114117

115118
let result = await connection.execute(
116-
"select n_col from no_typehandler_tab",
119+
"SELECT id, n_col FROM no_typehandler_tab WHERE id = 1",
117120
[],
118121
{ fetchTypeHandler: fth }
119122
);
120-
console.log(` Column ${result.metaData[0].name} is formatted as ${result.rows[0][0]}`);
123+
console.log(` Row fetched: ${result.rows}`);
124+
console.log(` Column ${result.metaData[0].name} is formatted as ${result.rows[0][1]}`);
121125

122126
// Example 2
123127

test/list.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6300,6 +6300,6 @@ oracledb.OUT_FORMAT_OBJECT and resultSet = true
63006300
314. dbObject21.js
63016301
314.1 check attribute metadata
63026302
314.1.1 check metadata of DbObject attributes
6303-
315. Pool maxLifetimeSession
6303+
315. poolMaxLifeTimeSession.js
63046304
315.1 Testing maxLifetimeSession on conn release
63056305
315.2 Testing maxLifetimeSession on conn acquire

test/poolMaxLifetimeSession.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,17 @@ const assert = require('assert');
3636
const dbConfig = require('./dbconfig.js');
3737
const testUtil = require('./testsUtil.js');
3838

39-
(oracledb.thin ? describe : describe.skip)('315. Pool maxLifetimeSession', function() {
39+
describe('315. poolMaxLifeTimeSession.js', function() {
4040
let pool;
4141

42+
before(function() {
43+
if (!oracledb.thin) this.skip();
44+
});
45+
46+
after(function() {
47+
if (!oracledb.thin) return;
48+
});
49+
4250
afterEach(async function() {
4351
await pool?.close(0);
4452
});

0 commit comments

Comments
 (0)