@@ -427,7 +427,7 @@ describe('43. plsqlBinding1.js', function() {
427
427
) ;
428
428
} )
429
429
430
- it ( '42.2.5 the type of the array element should be compatible with binding type declaration ' , function ( done ) {
430
+ it ( '42.2.5 negative case (string): incorrect type of array elements ' , function ( done ) {
431
431
var bindvars = {
432
432
p : { type : oracledb . STRING , dir : oracledb . BIND_IN , val : [ 'hello' , 1 ] }
433
433
} ;
@@ -444,7 +444,7 @@ describe('43. plsqlBinding1.js', function() {
444
444
) ;
445
445
} )
446
446
447
- it ( '42.2.6 type compatibility ' , function ( done ) {
447
+ it ( '42.2.6 negative case (number): incorrect type of array element ' , function ( done ) {
448
448
var bindvars = {
449
449
p : { type : oracledb . NUMBER , dir : oracledb . BIND_IN , val : [ 1 , 'hello' ] }
450
450
} ;
@@ -461,7 +461,7 @@ describe('43. plsqlBinding1.js', function() {
461
461
) ;
462
462
} )
463
463
464
- it ( '42.2.7 dose not allow array syntax of bindings ' , function ( done ) {
464
+ it ( '42.2.7 supports binding by position ' , function ( done ) {
465
465
var bindvars = [
466
466
{ type : oracledb . STRING , dir : oracledb . BIND_IN , val : [ 'hello' , 'node.js' ] }
467
467
] ;
@@ -578,7 +578,7 @@ describe('43. plsqlBinding1.js', function() {
578
578
bindvars ,
579
579
function ( err , result ) {
580
580
should . not . exist ( err ) ;
581
- console . log ( result ) ;
581
+ // console.log(result);
582
582
result . outBinds . stringValue . should . be . exactly ( '(Space odyssey)' ) ;
583
583
result . outBinds . numberValue . should . be . exactly ( 2101 ) ;
584
584
//result.outBinds.dateValue.should.eql(releaseDate)
@@ -598,7 +598,7 @@ describe('43. plsqlBinding1.js', function() {
598
598
] , done ) ;
599
599
} ) ;
600
600
601
- it ( '43.3.3 binding PL/SQL scalar OUT' , function ( done ) {
601
+ it ( '43.3.3 binding PL/SQL scalar OUT by name ' , function ( done ) {
602
602
async . series ( [
603
603
function ( callback ) {
604
604
var proc = "CREATE OR REPLACE\n" +
@@ -632,7 +632,7 @@ describe('43. plsqlBinding1.js', function() {
632
632
// console.log(result);
633
633
result . outBinds . stringValue . should . be . exactly ( 'Space odyssey' ) ;
634
634
result . outBinds . numberValue . should . be . exactly ( 2001 ) ;
635
- ( typeof ( result . outBinds . dateValue ) ) . should . eql ( 'object' ) ;
635
+ ( Object . prototype . toString . call ( result . outBinds . dateValue ) ) . should . eql ( '[ object Date] ' ) ;
636
636
callback ( ) ;
637
637
}
638
638
) ;
@@ -649,6 +649,57 @@ describe('43. plsqlBinding1.js', function() {
649
649
] , done ) ;
650
650
} ) ;
651
651
652
+ it ( '43.3.4 binding PL/SQL scalar OUT by postion' , function ( done ) {
653
+ async . series ( [
654
+ function ( callback ) {
655
+ var proc = "CREATE OR REPLACE\n" +
656
+ "PROCEDURE test(stringValue OUT VARCHAR2, numberValue OUT NUMBER, dateValue OUT DATE)\n" +
657
+ "IS\n" +
658
+ "BEGIN\n" +
659
+ " stringValue := 'Space odyssey';\n" +
660
+ " numberValue := 2001;\n" +
661
+ " dateValue := TO_DATE('04-02-1968', 'MM-DD-YYYY');" +
662
+ "END test;\n" ;
663
+ connection . should . be . ok ;
664
+ connection . execute (
665
+ proc ,
666
+ function ( err ) {
667
+ should . not . exist ( err ) ;
668
+ callback ( ) ;
669
+ }
670
+ ) ;
671
+ } ,
672
+ function ( callback ) {
673
+ var bindvars = [
674
+ { type : oracledb . STRING , dir : oracledb . BIND_OUT } ,
675
+ { type : oracledb . NUMBER , dir : oracledb . BIND_OUT } ,
676
+ { type : oracledb . DATE , dir : oracledb . BIND_OUT }
677
+ ] ;
678
+ connection . execute (
679
+ "BEGIN test(:1, :2, :3); END;" ,
680
+ bindvars ,
681
+ function ( err , result ) {
682
+ should . not . exist ( err ) ;
683
+ // console.log(result);
684
+ result . outBinds [ 0 ] . should . be . exactly ( 'Space odyssey' ) ;
685
+ result . outBinds [ 1 ] . should . be . exactly ( 2001 ) ;
686
+ ( Object . prototype . toString . call ( result . outBinds [ 2 ] ) ) . should . eql ( '[object Date]' ) ;
687
+ callback ( ) ;
688
+ }
689
+ ) ;
690
+ } ,
691
+ function ( callback ) {
692
+ connection . execute (
693
+ "DROP PROCEDURE test" ,
694
+ function ( err ) {
695
+ should . not . exist ( err ) ;
696
+ callback ( ) ;
697
+ }
698
+ ) ;
699
+ }
700
+ ] , done ) ;
701
+ } )
702
+
652
703
} ) // 43.3
653
704
654
705
describe ( '43.4 test attribute - maxArraySize' , function ( ) {
@@ -805,7 +856,7 @@ describe('43. plsqlBinding1.js', function() {
805
856
) ;
806
857
} )
807
858
808
- it ( '43.4.6 negative case: <0' , function ( done ) {
859
+ it ( '43.4.6 negative case: < 0' , function ( done ) {
809
860
var bindvars = {
810
861
p : { type : oracledb . NUMBER , dir : oracledb . BIND_INOUT , val : [ 1 , 2 , 3 ] , maxArraySize : - 9 }
811
862
} ;
@@ -837,7 +888,7 @@ describe('43. plsqlBinding1.js', function() {
837
888
) ;
838
889
} )
839
890
840
- it ( '43.4.8 negative case: assigning it to be a string' , function ( done ) {
891
+ it ( '43.4.8 negative case: assign a string to it ' , function ( done ) {
841
892
var bindvars = {
842
893
p : { type : oracledb . NUMBER , dir : oracledb . BIND_INOUT , val : [ 1 , 2 , 3 ] , maxArraySize : 'foobar' }
843
894
} ;
0 commit comments