@@ -792,11 +792,11 @@ describe('71. lobBind1.js', function() {
792792
793793 } ) ; // 71.1.8
794794
795- it ( '71.1.9 Negative: BIND_INOUT, PL/SQL, String as bind IN Value' , function ( done ) {
795+ it ( '71.1.9 BIND_INOUT, PL/SQL, a String as the bind IN Value' , function ( done ) {
796796
797797 var seq = 9 ;
798- var inStr = "I love the sunshine today!" ,
799- outStr = "A new day has come." ;
798+ var inStr = "I love the sunshine today!" ;
799+ var outStr = "A new day has come." ;
800800
801801 var proc = "CREATE OR REPLACE PROCEDURE nodb_proc_clob_inout3 \n" +
802802 " (p_num IN NUMBER, p_inout IN OUT CLOB) \n" +
@@ -820,11 +820,26 @@ describe('71. lobBind1.js', function() {
820820 io : { val : inStr , type : oracledb . CLOB , dir : oracledb . BIND_INOUT }
821821 } ,
822822 { autoCommit : true } ,
823- function ( err ) {
824- should . exist ( err ) ;
825- // NJS-011: encountered bind value and type mismatch in parameter 2
826- ( err . message ) . should . startWith ( 'NJS-011:' ) ;
827- cb ( ) ;
823+ function ( err , result ) {
824+ should . not . exist ( err ) ;
825+ should . exist ( result ) ;
826+ var lobout = result . outBinds . io ;
827+
828+ lobout . setEncoding ( "utf8" ) ;
829+ var clobData = '' ;
830+
831+ lobout . on ( 'data' , function ( chunk ) {
832+ clobData += chunk ;
833+ } ) ;
834+
835+ lobout . on ( 'error' , function ( err ) {
836+ should . not . exist ( err , "lob.on 'error' event!" ) ;
837+ } ) ;
838+
839+ lobout . on ( 'end' , function ( ) {
840+ should . strictEqual ( clobData , outStr ) ;
841+ return cb ( ) ;
842+ } ) ;
828843 }
829844 ) ;
830845 } ,
@@ -1541,7 +1556,7 @@ describe('71. lobBind1.js', function() {
15411556
15421557 } ) ; // 71.2.8
15431558
1544- it ( '71.2.9 Negative: BIND_INOUT, PL/SQL, Buffer as bind IN value' , function ( done ) {
1559+ it ( '71.2.9 BIND_INOUT, PL/SQL, a Buffer as the bind IN value' , function ( done ) {
15451560
15461561 var seq = 9 ;
15471562 var inBuf = assist . createBuffer ( 10 ) ;
@@ -1573,12 +1588,32 @@ describe('71. lobBind1.js', function() {
15731588 sql ,
15741589 bindvar ,
15751590 { autoCommit : true } ,
1576- function ( err ) {
1577- should . exist ( err ) ;
1578- ( err . message ) . should . startWith ( 'NJS-011:' ) ;
1579- // NJS-011: encountered bind value and type mismatch in parameter 2
1591+ function ( err , result ) {
1592+ should . not . exist ( err ) ;
1593+ should . exist ( result ) ;
1594+ var lob = result . outBinds . io ;
1595+ should . exist ( lob ) ;
1596+
1597+ var blobData , totalLength = 0 ;
1598+ blobData = node6plus ? Buffer . alloc ( 0 ) : new Buffer ( 0 ) ;
1599+
1600+ lob . on ( 'data' , function ( chunk ) {
1601+ totalLength = totalLength + chunk . length ;
1602+ blobData = Buffer . concat ( [ blobData , chunk ] , totalLength ) ;
1603+ } ) ;
1604+
1605+ lob . on ( 'error' , function ( err ) {
1606+ should . not . exist ( err , "lob.on 'error' event." ) ;
1607+ } ) ;
1608+
1609+ lob . on ( 'end' , function ( ) {
1610+ fs . readFile ( jpgFileName , function ( err , originalData ) {
1611+ should . not . exist ( err ) ;
1612+ should . strictEqual ( totalLength , originalData . length ) ;
1613+ return cb ( ) ;
1614+ } ) ;
1615+ } ) ;
15801616
1581- cb ( ) ;
15821617 }
15831618 ) ;
15841619 } ,
0 commit comments