Skip to content

Commit b2ea4ed

Browse files
committed
Add test for PL/SQL block with empty outBinds
1 parent 2fdc56a commit b2ea4ed

File tree

3 files changed

+60
-2
lines changed

3 files changed

+60
-2
lines changed

test/binding.js

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,7 @@ describe('4. binding.js', function() {
735735
})
736736

737737

738-
it('4.5.1',function(done) {
738+
it('4.5.1 ',function(done) {
739739
connection.execute(
740740
"insert into oracledb_raw (num) values (:id)",
741741
{ id: { val: 1, type: oracledb.NUMBER } }, // fails with error NJS-013: invalid bind direction
@@ -747,4 +747,43 @@ describe('4. binding.js', function() {
747747
);
748748
})
749749
}) // 4.5
750+
751+
describe('4.6 PL/SQL block with empty outBinds', function() {
752+
753+
it('4.6.1 ', function(done) {
754+
755+
var sql = "begin execute immediate 'drop table does_not_exist'; "
756+
+ "exception when others then "
757+
+ "if sqlcode <> -942 then "
758+
+ "raise; "
759+
+ "end if; end;";
760+
var binds = [];
761+
var options = {};
762+
763+
oracledb.getConnection(
764+
credential,
765+
function(err, connection)
766+
{
767+
should.not.exist(err);
768+
connection.execute(
769+
sql,
770+
binds,
771+
options,
772+
function(err, result)
773+
{
774+
should.not.exist(err);
775+
result.should.eql(
776+
{ rowsAffected: undefined,
777+
outBinds: undefined,
778+
rows: undefined,
779+
metaData: undefined }
780+
);
781+
done();
782+
}
783+
);
784+
}
785+
);
786+
787+
})
788+
})
750789
})

test/dataTypeTimestamp1.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,24 @@ describe('33. dataTypeTimestamp1.js', function() {
143143
});
144144
})
145145

146+
it('33.3.3 returns scalar types from PL/SQL block', function(done) {
147+
var sql = "BEGIN SELECT systimestamp into :bv from dual; END;";
148+
var binds = { bv: { dir: oracledb.BIND_OUT, type: oracledb.STRING } };
149+
var options = { outFormat: oracledb.OBJECT };
150+
151+
connection.execute(
152+
sql,
153+
binds,
154+
options,
155+
function(err, result) {
156+
should.not.exist(err);
157+
(result.outBinds.bv).should.be.a.String;
158+
done();
159+
}
160+
);
161+
162+
})
163+
146164
}) // end of 33.3 suite
147165

148166
})

test/list.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
4.4 test maxSize option
9595
4.4.1 outBind & maxSize restriction
9696
4.4.2 default value is 200
97-
- 4.4.3 Negative - bind out data exceeds default length
97+
4.4.3 Negative - bind out data exceeds default length
9898
- 4.4.4 maximum value is 32767
9999
4.5 The default direction for binding is BIND_IN
100100
- 4.5.1
@@ -303,6 +303,7 @@
303303
32.3 insert SQL Date data
304304
32.3.1 SELECT query - original data
305305
32.3.2 SELECT query - formatted data for comparison
306+
33.3.3 returns scalar types from PL/SQL block
306307

307308
33. dataTypeTimestamp1.js
308309
33.1 Testing JavaScript Date with database TIMESTAMP

0 commit comments

Comments
 (0)