@@ -38,6 +38,7 @@ var oracledb = require('oracledb');
38
38
var should = require ( 'should' ) ;
39
39
var async = require ( 'async' ) ;
40
40
var dbConfig = require ( './dbConfig.js' ) ;
41
+ var assist = require ( './dataTypeAssist.js' ) ;
41
42
42
43
describe ( '4. binding.js' , function ( ) {
43
44
@@ -662,20 +663,32 @@ describe('4. binding.js', function() {
662
663
] , done ) ;
663
664
} )
664
665
665
- it . skip ( '4.4.2 default value is 200' , function ( done ) {
666
+ it ( '4.4.2 default value is 200' , function ( done ) {
667
+ connection . execute (
668
+ "BEGIN :o := lpad('A', 200, 'x'); END;" ,
669
+ { o : { type : oracledb . STRING , dir : oracledb . BIND_OUT } } ,
670
+ function ( err , result ) {
671
+ should . not . exist ( err ) ;
672
+ ( result . outBinds . o . length ) . should . be . exactly ( 200 ) ;
673
+ done ( ) ;
674
+ }
675
+ ) ;
676
+ } )
677
+
678
+ it . skip ( '4.4.3 Negative - bind out data exceeds default length' , function ( done ) {
666
679
connection . execute (
667
680
"BEGIN :o := lpad('A',201,'x'); END;" ,
668
681
{ o : { type : oracledb . STRING , dir : oracledb . BIND_OUT } } ,
669
682
function ( err , result ) {
670
683
should . exist ( err ) ;
671
684
err . message . should . startWith ( 'ORA-06502:' ) ;
672
- console . log ( result . outBinds . o . length ) ;
685
+ // console.log(result.outBinds.o.length);
673
686
done ( ) ;
674
687
}
675
688
) ;
676
689
} )
677
690
678
- it . skip ( '4.4.3 maximum value is 32767' , function ( done ) {
691
+ it . skip ( '4.4.4 maximum value is 32767' , function ( done ) {
679
692
connection . execute (
680
693
"BEGIN :o := lpad('A',32767,'x'); END;" ,
681
694
{ o : { type : oracledb . STRING , dir : oracledb . BIND_OUT , maxSize :50000 } } ,
@@ -686,5 +699,51 @@ describe('4. binding.js', function() {
686
699
}
687
700
) ;
688
701
} )
689
- } )
702
+ } ) // 4.4
703
+
704
+ describe . skip ( '4.5 The default direction for binding is BIND_IN' , function ( ) {
705
+ var connection = null ;
706
+ var tableName = "oracledb_raw" ;
707
+
708
+ before ( function ( done ) {
709
+ oracledb . getConnection ( credential , function ( err , conn ) {
710
+ if ( err ) { console . error ( err . message ) ; return ; }
711
+ connection = conn ;
712
+ assist . createTable ( connection , tableName , done ) ;
713
+ } ) ;
714
+ } )
715
+
716
+ after ( function ( done ) {
717
+ async . series ( [
718
+ function ( callback ) {
719
+ connection . execute (
720
+ "DROP TABLE " + tableName ,
721
+ function ( err ) {
722
+ should . not . exist ( err ) ;
723
+ callback ( ) ;
724
+ }
725
+ ) ;
726
+ } ,
727
+ function ( callback ) {
728
+ connection . release ( function ( err ) {
729
+ should . not . exist ( err ) ;
730
+ callback ( ) ;
731
+ } ) ;
732
+ }
733
+ ] , done ) ;
734
+ } )
735
+
736
+
737
+ it ( '4.5.1' , function ( done ) {
738
+ connection . execute (
739
+ "insert into oracledb_raw (num) values (:id)" ,
740
+ { id : { val : 1 , type : oracledb . NUMBER } } , // fails with error NJS-013: invalid bind direction
741
+ // { id: { val: 1, type: oracledb.NUMBER, dir: oracledb.BIND_IN } }, // works
742
+ function ( err , result ) {
743
+ should . not . exist ( err ) ;
744
+ done ( ) ;
745
+ }
746
+ ) ;
747
+ } )
748
+ } ) // 4.5
690
749
} )
0 commit comments