@@ -932,6 +932,148 @@ describe('74. clobPlsqlBindAsString_bindin.js', function() {
932
932
] , done ) ;
933
933
} ) ; // 74.1.26
934
934
935
+ it ( '74.1.27 bind error: NJS-037, bind by name 1' , function ( done ) {
936
+ var bindVar = {
937
+ i : { val : [ "sequence" ] , type : oracledb . NUMBER , dir : oracledb . BIND_IN } ,
938
+ c : { val : "sequence" , type : oracledb . STRING , dir : oracledb . BIND_IN , maxSize : 50000 }
939
+ } ;
940
+ connection . execute (
941
+ sqlRun ,
942
+ bindVar ,
943
+ { autoCommit : true } ,
944
+ function ( err ) {
945
+ should . exist ( err ) ;
946
+ // NJS-037: invalid data type at array index 0 for bind ":i"
947
+ ( err . message ) . should . startWith ( 'NJS-037:' ) ;
948
+ ( err . message ) . should . match ( / ^ N J S - 0 3 7 : .* \s i n d e x \s 0 \s .* \s b i n d \s " : i " $ / ) ;
949
+ done ( ) ;
950
+ }
951
+ ) ;
952
+ } ) ; // 74.1.27
953
+
954
+ it ( '74.1.28 bind error: NJS-037, bind by name 2' , function ( done ) {
955
+ var sequence = insertID ++ ;
956
+ var bindVar = {
957
+ i : { val : sequence , type : oracledb . NUMBER , dir : oracledb . BIND_IN } ,
958
+ c : { val : [ 0 ] , type : oracledb . STRING , dir : oracledb . BIND_IN , maxSize : 50000 }
959
+ } ;
960
+ connection . execute (
961
+ sqlRun ,
962
+ bindVar ,
963
+ { autoCommit : true } ,
964
+ function ( err ) {
965
+ should . exist ( err ) ;
966
+ // NJS-037: invalid data type at array index 0 for bind ":c"
967
+ ( err . message ) . should . startWith ( 'NJS-037:' ) ;
968
+ ( err . message ) . should . match ( / ^ N J S - 0 3 7 : .* \s i n d e x \s 0 \s .* \s b i n d \s " : c " $ / ) ;
969
+ done ( ) ;
970
+ }
971
+ ) ;
972
+ } ) ; // 74.1.28
973
+
974
+ it ( '74.1.29 bind error: NJS-037, bind by name 3' , function ( done ) {
975
+ var bindVar = {
976
+ i : { val : [ 1 , "sequence" ] , type : oracledb . NUMBER , dir : oracledb . BIND_IN } ,
977
+ c : { val : "sequence" , type : oracledb . STRING , dir : oracledb . BIND_IN , maxSize : 50000 }
978
+ } ;
979
+ connection . execute (
980
+ sqlRun ,
981
+ bindVar ,
982
+ { autoCommit : true } ,
983
+ function ( err ) {
984
+ should . exist ( err ) ;
985
+ // NJS-037: invalid data type at array index 1 for bind ":i"
986
+ ( err . message ) . should . startWith ( 'NJS-037:' ) ;
987
+ ( err . message ) . should . match ( / ^ N J S - 0 3 7 : .* \s i n d e x \s 1 \s .* \s b i n d \s " : i " $ / ) ;
988
+ done ( ) ;
989
+ }
990
+ ) ;
991
+ } ) ; // 74.1.29
992
+
993
+ it ( '74.1.30 bind error: NJS-037, bind by name 4' , function ( done ) {
994
+ var bindVar = {
995
+ i : { val : [ 1 , 2 ] , type : oracledb . NUMBER , dir : oracledb . BIND_IN } ,
996
+ c : { val : [ "sequence" , "ab" , 3 ] , type : oracledb . STRING , dir : oracledb . BIND_IN , maxSize : 50000 }
997
+ } ;
998
+ connection . execute (
999
+ sqlRun ,
1000
+ bindVar ,
1001
+ { autoCommit : true } ,
1002
+ function ( err ) {
1003
+ should . exist ( err ) ;
1004
+ // NJS-037: invalid data type at array index 2 for bind ":c"
1005
+ ( err . message ) . should . startWith ( 'NJS-037:' ) ;
1006
+ ( err . message ) . should . match ( / ^ N J S - 0 3 7 : .* \s i n d e x \s 2 \s .* \s b i n d \s " : c " $ / ) ;
1007
+ done ( ) ;
1008
+ }
1009
+ ) ;
1010
+ } ) ; // 74.1.30
1011
+
1012
+ it ( '74.1.31 bind error: NJS-052, bind by pos 1' , function ( done ) {
1013
+ var sequence = insertID ++ ;
1014
+ var bindVar = [ sequence , { val : [ 0 ] , type : oracledb . STRING , dir : oracledb . BIND_IN , maxSize : 50000 } ] ;
1015
+ connection . execute (
1016
+ sqlRun ,
1017
+ bindVar ,
1018
+ { autoCommit : true } ,
1019
+ function ( err ) {
1020
+ should . exist ( err ) ;
1021
+ // NJS-052: invalid data type at array index 0 for bind position 2
1022
+ ( err . message ) . should . startWith ( 'NJS-052:' ) ;
1023
+ ( err . message ) . should . match ( / ^ N J S - 0 5 2 : .* \s i n d e x \s 0 \s .* \s p o s i t i o n \s 2 $ / ) ;
1024
+ done ( ) ;
1025
+ }
1026
+ ) ;
1027
+ } ) ; // 74.1.31
1028
+
1029
+ it ( '74.1.32 bind error: NJS-052, bind by pos 2' , function ( done ) {
1030
+ var bindVar = [ { val : [ "sequence" ] , type : oracledb . NUMBER , dir : oracledb . BIND_IN } , { val : "sequence" , type : oracledb . STRING , dir : oracledb . BIND_IN , maxSize : 50000 } ] ;
1031
+ connection . execute (
1032
+ sqlRun ,
1033
+ bindVar ,
1034
+ { autoCommit : true } ,
1035
+ function ( err ) {
1036
+ should . exist ( err ) ;
1037
+ // NJS-052: invalid data type at array index 0 for bind position 1
1038
+ ( err . message ) . should . startWith ( 'NJS-052:' ) ;
1039
+ ( err . message ) . should . match ( / ^ N J S - 0 5 2 : .* \s i n d e x \s 0 \s .* \s p o s i t i o n \s 1 $ / ) ;
1040
+ done ( ) ;
1041
+ }
1042
+ ) ;
1043
+ } ) ; // 74.1.32
1044
+
1045
+ it ( '74.1.33 bind error: NJS-052, bind by pos 3' , function ( done ) {
1046
+ var bindVar = [ { val : [ 1 , 2 , "sequence" ] , type : oracledb . NUMBER , dir : oracledb . BIND_IN } , { val : "sequence" , type : oracledb . STRING , dir : oracledb . BIND_IN , maxSize : 50000 } ] ;
1047
+ connection . execute (
1048
+ sqlRun ,
1049
+ bindVar ,
1050
+ { autoCommit : true } ,
1051
+ function ( err ) {
1052
+ should . exist ( err ) ;
1053
+ // NJS-052: invalid data type at array index 2 for bind position 1
1054
+ ( err . message ) . should . startWith ( 'NJS-052:' ) ;
1055
+ ( err . message ) . should . match ( / ^ N J S - 0 5 2 : .* \s i n d e x \s 2 \s .* \s p o s i t i o n \s 1 $ / ) ;
1056
+ done ( ) ;
1057
+ }
1058
+ ) ;
1059
+ } ) ; // 74.1.33
1060
+
1061
+ it ( '74.1.35 bind error: NJS-052, bind by pos 4' , function ( done ) {
1062
+ var bindVar = [ { val : [ 1 , 2 ] , type : oracledb . NUMBER , dir : oracledb . BIND_IN } , { val : [ "sequence" , 1 ] , type : oracledb . STRING , dir : oracledb . BIND_IN , maxSize : 50000 } ] ;
1063
+ connection . execute (
1064
+ sqlRun ,
1065
+ bindVar ,
1066
+ { autoCommit : true } ,
1067
+ function ( err ) {
1068
+ should . exist ( err ) ;
1069
+ // NJS-052: invalid data type at array index 1 for bind position 2
1070
+ ( err . message ) . should . startWith ( 'NJS-052:' ) ;
1071
+ ( err . message ) . should . match ( / ^ N J S - 0 5 2 : .* \s i n d e x \s 1 \s .* \s p o s i t i o n \s 2 $ / ) ;
1072
+ done ( ) ;
1073
+ }
1074
+ ) ;
1075
+ } ) ; // 74.1.35
1076
+
935
1077
} ) ; // 74.1
936
1078
937
1079
describe ( '74.2 CLOB, PLSQL, BIND_IN to VARCHAR2' , function ( ) {
0 commit comments