Skip to content

Commit eb0242a

Browse files
committed
Update tests
1 parent a69f201 commit eb0242a

File tree

1 file changed

+73
-2
lines changed

1 file changed

+73
-2
lines changed

test/dbObjectOutBind.js

Lines changed: 73 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,28 +60,68 @@ describe('262. dbObjectOutBind.js', function() {
6060
group by group_by;
6161
end;`;
6262
let proc3 =
63-
`create or replace procedure nodb_getDataCursor3(
63+
`create or replace procedure nodb_getDataCursor3(p_cur out sys_refcursor) is
64+
begin
65+
open p_cur for
66+
select
67+
rownum, substr('randomtext',1,rownum),
68+
substr('randomtext',rownum)
69+
from
70+
dual
71+
connect by level <= 10;
72+
end;`;
73+
let proc4 =
74+
`create or replace procedure nodb_getDataCursor4(p_cur out sys_refcursor) is
75+
begin
76+
open p_cur for
77+
select
78+
substr('sometext',level,1)
79+
from
80+
dual
81+
connect by level <= 8;
82+
end;`;
83+
let proc5 =
84+
`create or replace procedure nodb_getDataCursor5(
6485
p_cur1 out sys_refcursor,
6586
p_cur2 out sys_refcursor
6687
) is
6788
begin
6889
nodb_getDataCursor1(p_cur1);
6990
nodb_getDataCursor2(p_cur2);
7091
end;`;
92+
let proc6 =
93+
`create or replace procedure nodb_getDataCursor6(
94+
p_cur1 out sys_refcursor,
95+
p_cur2 out sys_refcursor,
96+
p_cur3 out sys_refcursor,
97+
p_cur4 out sys_refcursor
98+
) is
99+
begin
100+
nodb_getDataCursor1(p_cur1);
101+
nodb_getDataCursor2(p_cur2);
102+
nodb_getDataCursor1(p_cur3);
103+
nodb_getDataCursor2(p_cur4);
104+
end;`;
71105

72106
before(async function() {
73107
try {
74108
conn = await oracledb.getConnection(dbConfig);
75109
await conn.execute(proc1);
76110
await conn.execute(proc2);
77111
await conn.execute(proc3);
112+
await conn.execute(proc4);
113+
await conn.execute(proc5);
114+
await conn.execute(proc6);
78115
} catch (e) {
79116
assert.fail(e);
80117
}
81118
});
82119

83120
after(async function() {
84121
try {
122+
await conn.execute(`DROP PROCEDURE nodb_getDataCursor6`);
123+
await conn.execute(`DROP PROCEDURE nodb_getDataCursor5`);
124+
await conn.execute(`DROP PROCEDURE nodb_getDataCursor4`);
85125
await conn.execute(`DROP PROCEDURE nodb_getDataCursor3`);
86126
await conn.execute(`DROP PROCEDURE nodb_getDataCursor2`);
87127
await conn.execute(`DROP PROCEDURE nodb_getDataCursor1`);
@@ -94,7 +134,7 @@ describe('262. dbObjectOutBind.js', function() {
94134
it('262.1 call procedure with 2 OUT binds of DbObject', async function() {
95135
try {
96136
let result = await conn.execute(
97-
`BEGIN nodb_getDataCursor3(p_cur1 => :p_cur1,
137+
`BEGIN nodb_getDataCursor5(p_cur1 => :p_cur1,
98138
p_cur2 => :p_cur2); end;`,
99139
{
100140
p_cur1: {type: oracledb.CURSOR, dir: oracledb.BIND_OUT},
@@ -108,5 +148,36 @@ describe('262. dbObjectOutBind.js', function() {
108148
}
109149
});
110150

151+
it('262.2 call procedure with multiple OUT binds of DbObject', async function() {
152+
try {
153+
let result = await conn.execute(
154+
`BEGIN nodb_getDataCursor6(p_cur1 => :p_cur1,
155+
p_cur2 => :p_cur2, p_cur3 => :p_cur3, p_cur4 => :p_cur4); end;`,
156+
{
157+
p_cur1: {type: oracledb.CURSOR, dir: oracledb.BIND_OUT},
158+
p_cur2: {type: oracledb.CURSOR, dir: oracledb.BIND_OUT},
159+
p_cur3: {type: oracledb.CURSOR, dir: oracledb.BIND_OUT},
160+
p_cur4: {type: oracledb.CURSOR, dir: oracledb.BIND_OUT}
161+
}
162+
);
163+
let resultSet = await result.outBinds.p_cur1.getRows();
164+
assert.equal(resultSet.length, 9);
165+
result.outBinds.p_cur1.close();
166+
167+
resultSet = await result.outBinds.p_cur2.getRows();
168+
assert.equal(resultSet.length, 3);
169+
result.outBinds.p_cur2.close();
170+
171+
resultSet = await result.outBinds.p_cur3.getRows();
172+
assert.equal(resultSet.length, 9);
173+
result.outBinds.p_cur3.close();
174+
175+
resultSet = await result.outBinds.p_cur4.getRows();
176+
assert.equal(resultSet.length, 3);
177+
result.outBinds.p_cur4.close();
178+
} catch (e) {
179+
assert.fail(e);
180+
}
181+
});
111182
});
112183

0 commit comments

Comments
 (0)