Skip to content

Commit 9e06797

Browse files
committed
Add tests
1 parent 5994145 commit 9e06797

File tree

3 files changed

+67
-9
lines changed

3 files changed

+67
-9
lines changed

test/list.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -443,8 +443,9 @@
443443
- 44.3 default binding type and direction with binding by name
444444
44.4 default binding type and direction with binding by position
445445
44.5 null elements in String and Number arrays
446-
44.6 NJS-039: empty array is not allowed for IN bind
447-
- 44.7 maxSize option applies to each elements of an array
446+
44.6 empty array for BIND_IN and BIND_INOUT
447+
44.7 empty array for BIND_OUT
448+
- 44.8 maxSize option applies to each elements of an array
448449

449450

450451
51. accessTerminatedPoolAttributes.js

test/plsqlBinding1.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ describe('43. plsqlBinding1.js', function() {
379379
" PROCEDURE test2(p IN OUT NOCOPY numbersType);\n" +
380380
" PROCEDURE test3(p IN datesType);\n" +
381381
" PROCEDURE test4(p IN stringsType);\n" +
382-
" PROCEDURE test5(p IN numbersType);\n" +
382+
" PROCEDURE test5(p OUT stringsType);\n" +
383383
"END;";
384384
connection.should.be.ok;
385385
connection.execute(
@@ -398,7 +398,7 @@ describe('43. plsqlBinding1.js', function() {
398398
" PROCEDURE test2(p IN OUT NOCOPY numbersType) IS BEGIN NULL; END;\n" +
399399
" PROCEDURE test3(p IN datesType) IS BEGIN NULL; END;\n" +
400400
" PROCEDURE test4(p IN stringsType) IS BEGIN NULL; END;\n" +
401-
" PROCEDURE test5(p IN numbersType) IS BEGIN NULL; END;\n" +
401+
" PROCEDURE test5(p OUT stringsType) IS BEGIN NULL; END;\n" +
402402
"END;";
403403
connection.should.be.ok;
404404
connection.execute(
@@ -519,7 +519,7 @@ describe('43. plsqlBinding1.js', function() {
519519
p: {type: oracledb.NUMBER, dir: oracledb.BIND_IN, val: [1, 'hello']}
520520
};
521521
connection.execute(
522-
"BEGIN oracledb_testpack.test5(:p); END;",
522+
"BEGIN oracledb_testpack.test1(:p); END;",
523523
bindvars,
524524
function(err, result) {
525525
should.exist(err);

test/plsqlBinding2.js

Lines changed: 61 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ describe('44. plsqlBinding2.js', function() {
539539
], done);
540540
}) // 44.5
541541

542-
it('44.6 NJS-039: empty array is not allowed for IN bind', function(done) {
542+
it('44.6 empty array for BIND_IN and BIND_INOUT', function(done) {
543543
async.series([
544544
// Pass arrays of values to a PL/SQL procedure
545545
function(callback) {
@@ -557,6 +557,7 @@ describe('44. plsqlBinding2.js', function() {
557557
function(err) {
558558
should.exist(err);
559559
(err.message).should.startWith('NJS-039');
560+
// NJS-039: empty array is not allowed for IN bind
560561
callback();
561562
}
562563
);
@@ -569,6 +570,7 @@ describe('44. plsqlBinding2.js', function() {
569570
beach_inout: { type: oracledb.STRING,
570571
dir: oracledb.BIND_INOUT,
571572
val: [],
573+
maxArraySize: 0
572574
},
573575
depth_inout: { type: oracledb.NUMBER,
574576
dir: oracledb.BIND_INOUT,
@@ -585,7 +587,63 @@ describe('44. plsqlBinding2.js', function() {
585587
], done);
586588
}) // 44.6
587589

588-
it.skip('44.7 maxSize option applies to each elements of an array', function(done) {
590+
it('44.7 empty array for BIND_OUT', function(done) {
591+
async.series([
592+
function(callback) {
593+
var proc = "CREATE OR REPLACE PACKAGE\n" +
594+
"oracledb_testpack\n" +
595+
"IS\n" +
596+
" TYPE stringsType IS TABLE OF VARCHAR2(2000) INDEX BY BINARY_INTEGER;\n" +
597+
" PROCEDURE test(p OUT stringsType);\n" +
598+
"END;";
599+
connection.execute(
600+
proc,
601+
function(err) {
602+
should.not.exist(err);
603+
callback();
604+
}
605+
);
606+
},
607+
function(callback) {
608+
var proc = "CREATE OR REPLACE PACKAGE BODY\n" +
609+
"oracledb_testpack\n" +
610+
"IS\n" +
611+
" PROCEDURE test(p OUT stringsType) IS BEGIN NULL; END;\n" +
612+
"END;";
613+
connection.execute(
614+
proc,
615+
function(err) {
616+
should.not.exist(err);
617+
callback();
618+
}
619+
);
620+
},
621+
function(callback) {
622+
connection.execute(
623+
"BEGIN oracledb_testpack.test(:0); END;",
624+
[
625+
{type: oracledb.STRING, dir: oracledb.BIND_OUT, maxArraySize: 1}
626+
],
627+
function(err, result) {
628+
should.not.exist(err);
629+
result.outBinds[0].should.eql([]);
630+
callback();
631+
}
632+
);
633+
},
634+
function(callback) {
635+
connection.execute(
636+
"DROP PACKAGE oracledb_testpack",
637+
function(err) {
638+
should.not.exist(err);
639+
callback();
640+
}
641+
);
642+
}
643+
], done);
644+
}) // 44.7
645+
646+
it.skip('44.8 maxSize option applies to each elements of an array', function(done) {
589647
async.series([
590648
// Pass arrays of values to a PL/SQL procedure
591649
function(callback) {
@@ -658,7 +716,6 @@ describe('44. plsqlBinding2.js', function() {
658716
);
659717
}
660718
], done);
661-
}) // 44.7
662-
719+
}) // 44.8
663720

664721
})

0 commit comments

Comments
 (0)