@@ -524,12 +524,14 @@ bool njsConnection::ProcessBinds(Nan::NAN_METHOD_ARGS_TYPE args,
524
524
unsigned int index, njsBaton *baton)
525
525
{
526
526
Nan::HandleScope scope;
527
- if (args[index]->IsArray ()) {
528
- Local<Array> bindsArray = Local<Array>::Cast (args[index]);
527
+ if (args[static_cast <int >(index)]->IsArray ()) {
528
+ Local<Array> bindsArray = Local<Array>::Cast (
529
+ args[static_cast <int >(index)]);
529
530
return ProcessBindsByPos (bindsArray, baton);
530
531
}
531
- if (args[index]->IsObject () && !args[index]->IsFunction ()) {
532
- Local<Object> bindsObject = args[index]->ToObject ();
532
+ if (args[static_cast <int >(index)]->IsObject () &&
533
+ !args[static_cast <int >(index)]->IsFunction ()) {
534
+ Local<Object> bindsObject = args[static_cast <int >(index)]->ToObject ();
533
535
return ProcessBindsByName (bindsObject, baton);
534
536
}
535
537
baton->error = njsMessages::Get (errInvalidParameterType, index);
@@ -550,15 +552,18 @@ bool njsConnection::ProcessBindsByName(Handle<Object> bindObj, njsBaton *baton)
550
552
baton->bindVars = new njsVariable[baton->numBindVars ];
551
553
for (uint32_t i = 0 ; i < baton->numBindVars ; i++) {
552
554
njsVariable *var = &baton->bindVars [i];
553
- Local<String > temp = array-> Get (i).As <String> ();
555
+ Local<Value > temp = Nan:: Get (array, i).ToLocalChecked ();
554
556
v8::String::Utf8Value v8str (temp->ToString ());
555
- std::string str = std::string (*v8str, v8str.length ());
557
+ std::string str = std::string (*v8str,
558
+ static_cast <size_t >(v8str.length ()));
556
559
var->name = " :" + str;
557
560
var->pos = i + 1 ;
558
-
559
- Local<Value> val = bindObj->Get (temp);
560
- if (val.IsEmpty ())
561
+ MaybeLocal<Value> mval = Nan::Get (bindObj,
562
+ Nan::New (str).ToLocalChecked ());
563
+ Local<Value> val;
564
+ if (!mval.ToLocal (&val))
561
565
return false ;
566
+
562
567
if (!ProcessBind (val, var, false , baton))
563
568
return false ;
564
569
}
@@ -580,9 +585,7 @@ bool njsConnection::ProcessBindsByPos(Handle<Array> binds, njsBaton *baton)
580
585
for (uint32_t i = 0 ; i < baton->numBindVars ; i++) {
581
586
njsVariable *var = &baton->bindVars [i];
582
587
var->pos = i + 1 ;
583
- Local<Value> val = binds->Get (i);
584
- if (val.IsEmpty ())
585
- return false ;
588
+ Local<Value> val = Nan::Get (binds,i).ToLocalChecked ();
586
589
if (!ProcessBind (val, var, true , baton))
587
590
return false ;
588
591
}
@@ -627,9 +630,12 @@ bool njsConnection::ProcessBind(Local<Value> val, njsVariable *var,
627
630
Local<Array> keys = bindUnit->GetOwnPropertyNames ();
628
631
bool valid = false ;
629
632
for (uint32_t i = 0 ; i < keys->Length (); i++) {
630
- Local<String> temp = keys->Get (i).As <String>();
633
+ Local<String> temp = Nan::Get (keys,
634
+ i).ToLocalChecked ().As <String>();
635
+
631
636
v8::String::Utf8Value utf8str (temp->ToString ());
632
- std::string key = std::string (*utf8str, utf8str.length ());
637
+ std::string key = std::string (*utf8str,
638
+ static_cast <size_t >(utf8str.length ()));
633
639
if (key.compare (" dir" ) == 0 ||
634
640
key.compare (" type" ) == 0 ||
635
641
key.compare (" maxSize" ) == 0 ||
@@ -659,8 +665,8 @@ bool njsConnection::ProcessBind(Local<Value> val, njsVariable *var,
659
665
return false ;
660
666
if (var->maxArraySize > 0 )
661
667
var->isArray = true ;
662
- bindValue =
663
- bindUnit-> Get ( Nan::New<v8::String>(" val" ).ToLocalChecked ());
668
+ bindValue = Nan::Get (bindUnit,
669
+ Nan::New<v8::String>(" val" ).ToLocalChecked ()). ToLocalChecked ( );
664
670
665
671
// otherwise, bind value is directly passed and other values are defaults
666
672
} else {
@@ -818,7 +824,7 @@ bool njsConnection::ProcessBindValue(Local<Value> value, njsVariable *var,
818
824
819
825
// process each element in the array
820
826
for (uint32_t i = 0 ; i < arrayVal->Length (); i++) {
821
- Local<Value> elementValue = arrayVal-> Get (i );
827
+ Local<Value> elementValue = Nan:: Get (arrayVal, i). ToLocalChecked ( );
822
828
if (!ProcessScalarBindValue (elementValue, var, i, baton))
823
829
return false ;
824
830
}
@@ -857,7 +863,7 @@ bool njsConnection::ProcessScalarBindValue(Local<Value> value,
857
863
if (utf8str.length () == 0 )
858
864
data->isNull = 1 ;
859
865
else if (dpiVar_setFromBytes (var->dpiVarHandle , pos, *utf8str,
860
- utf8str.length ()) < 0 ) {
866
+ static_cast < uint32_t >( utf8str.length () )) < 0 ) {
861
867
baton->GetDPIError ();
862
868
return false ;
863
869
}
@@ -970,7 +976,7 @@ bool njsConnection::GetBindTypeAndSizeFromValue(njsVariable *var,
970
976
} else if (value->IsString ()) {
971
977
*bindType = NJS_DATATYPE_STR;
972
978
v8::String::Utf8Value utf8str (value->ToString ());
973
- *maxSize = utf8str.length ();
979
+ *maxSize = static_cast < uint32_t >( utf8str.length () );
974
980
} else if (value->IsInt32 () || value->IsUint32 ()) {
975
981
*bindType = NJS_DATATYPE_INT;
976
982
} else if (value->IsNumber ()) {
@@ -983,7 +989,7 @@ bool njsConnection::GetBindTypeAndSizeFromValue(njsVariable *var,
983
989
Local<Value> element;
984
990
uint32_t elementBindType, elementMaxSize;
985
991
for (uint32_t i = 0 ; i < arrayVal->Length (); i++) {
986
- element = arrayVal-> Get (i );
992
+ element = Nan:: Get (arrayVal, i). ToLocalChecked ( );
987
993
if (element->IsUndefined () || element->IsNull ())
988
994
continue ;
989
995
if (!GetBindTypeAndSizeFromValue (var, element, &elementBindType,
@@ -997,10 +1003,11 @@ bool njsConnection::GetBindTypeAndSizeFromValue(njsVariable *var,
997
1003
} else if (value->IsObject ()) {
998
1004
if (Buffer::HasInstance (value)) {
999
1005
*bindType = NJS_DATATYPE_BUFFER;
1000
- *maxSize = (uint32_t ) Buffer::Length (value->ToObject ());
1006
+ *maxSize = static_cast <uint32_t >(
1007
+ Buffer::Length (value->ToObject ()));
1001
1008
} else if (njsILob::HasInstance (value)) {
1002
1009
njsILob *lob = njsILob::GetInstance (value);
1003
- *bindType = lob->GetDataType ();
1010
+ *bindType = static_cast < uint32_t >( lob->GetDataType () );
1004
1011
}
1005
1012
} else {
1006
1013
baton->error = njsMessages::Get (errInvalidBindDataType, 2 );
@@ -1021,13 +1028,14 @@ bool njsConnection::ProcessOptions(Nan::NAN_METHOD_ARGS_TYPE args,
1021
1028
Nan::HandleScope scope;
1022
1029
1023
1030
// an object is expected, not an array
1024
- if (!args[index]->IsObject () || args[index]->IsArray ()) {
1031
+ if (!args[static_cast <int >(index)]->IsObject () ||
1032
+ args[static_cast <int >(index)]->IsArray ()) {
1025
1033
baton->error = njsMessages::Get (errInvalidParameterType, index);
1026
1034
return false ;
1027
1035
}
1028
1036
1029
1037
// process the basic options
1030
- Local<Object> options = args[index]->ToObject ();
1038
+ Local<Object> options = args[static_cast < int >( index) ]->ToObject ();
1031
1039
if (!baton->GetUnsignedIntFromJSON (options, " maxRows" , 2 , &baton->maxRows ))
1032
1040
return false ;
1033
1041
if (!baton->GetPositiveIntFromJSON (options, " fetchArraySize" , 2 ,
@@ -1051,9 +1059,12 @@ bool njsConnection::ProcessOptions(Nan::NAN_METHOD_ARGS_TYPE args,
1051
1059
1052
1060
// process the fetchAs specifications, if applicable
1053
1061
Local<Value> key = Nan::New<v8::String>(" fetchInfo" ).ToLocalChecked ();
1054
- Local<Value> val = options->Get (key);
1055
- if (val.IsEmpty ())
1062
+ MaybeLocal<Value> mval = Nan::Get (options, key);
1063
+ Local<Value> val;
1064
+
1065
+ if (!mval.ToLocal (&val))
1056
1066
return false ;
1067
+
1057
1068
if (!val->IsUndefined () && !val->IsNull ()) {
1058
1069
Local<Object> jsFetchInfo = val->ToObject ();
1059
1070
Local<Array> keys = jsFetchInfo->GetOwnPropertyNames ();
@@ -1064,11 +1075,18 @@ bool njsConnection::ProcessOptions(Nan::NAN_METHOD_ARGS_TYPE args,
1064
1075
baton->numFetchInfo = keys->Length ();
1065
1076
baton->fetchInfo = new njsFetchInfo[baton->numFetchInfo ];
1066
1077
for (uint32_t i = 0 ; i < baton->numFetchInfo ; i++) {
1067
- Local<String> temp = keys->Get (i).As <String>();
1078
+ Local<String> temp = Nan::Get (keys,
1079
+ i).ToLocalChecked ().As <String>();
1080
+
1068
1081
v8::String::Utf8Value utf8str (temp->ToString ());
1069
- baton->fetchInfo [i].name = std::string (*utf8str, utf8str.length ());
1070
- Local<Object> colInfo = jsFetchInfo->Get (temp)->ToObject ();
1071
- uint32_t tempType = NJS_DATATYPE_UNKNOWN;
1082
+ baton->fetchInfo [i].name = std::string (*utf8str,
1083
+ static_cast <size_t >(utf8str.length ()));
1084
+ v8::String::Utf8Value v8str (temp->ToString ());
1085
+ std::string str = std::string (*v8str,
1086
+ static_cast <size_t >(v8str.length ()));
1087
+ Local<Object> colInfo = Nan::Get (jsFetchInfo,
1088
+ Nan::New (str).ToLocalChecked ()).ToLocalChecked ()->ToObject ();
1089
+ uint32_t tempType = static_cast <uint32_t >(NJS_DATATYPE_UNKNOWN);
1072
1090
if (!baton->GetUnsignedIntFromJSON (colInfo, " type" , 2 , &tempType))
1073
1091
return false ;
1074
1092
if (tempType == (uint32_t ) NJS_DATATYPE_UNKNOWN) {
@@ -1110,7 +1128,8 @@ bool njsConnection::GetScalarValueFromVar(njsBaton *baton, njsVariable *var,
1110
1128
argv[0 ] = njsILob::CreateFromProtoLob (protoLob);
1111
1129
Local<Value> key = Nan::New<String>(" newLob" ).ToLocalChecked ();
1112
1130
Local<Object> jsOracledb = Nan::New (baton->jsOracledb );
1113
- Local<Function> fn = Local<Function>::Cast (jsOracledb->Get (key));
1131
+ Local<Function> fn = Local<Function>::Cast (Nan::Get ( jsOracledb,
1132
+ key).ToLocalChecked ());
1114
1133
temp = fn->Call (jsOracledb, 1 , argv);
1115
1134
}
1116
1135
value = scope.Escape (temp);
@@ -1291,7 +1310,8 @@ void njsConnection::SetTextAttribute(Nan::NAN_SETTER_ARGS_TYPE args,
1291
1310
return ;
1292
1311
}
1293
1312
v8::String::Utf8Value utfstr (value->ToString ());
1294
- if ((*setter)(connection->dpiConnHandle , *utfstr, utfstr.length ()) < 0 )
1313
+ if ((*setter)(connection->dpiConnHandle , *utfstr,
1314
+ static_cast <int32_t > (utfstr.length ()) < 0 ))
1295
1315
njsOracledb::ThrowDPIError ();
1296
1316
}
1297
1317
@@ -1683,7 +1703,8 @@ void njsConnection::Async_AfterCreateLob(njsBaton *baton, Local<Value> argv[])
1683
1703
tempArgv[0 ] = njsILob::CreateFromProtoLob (baton->protoILob );
1684
1704
Local<Value> key = Nan::New<String>(" newLob" ).ToLocalChecked ();
1685
1705
Local<Object> jsOracledb = Nan::New (baton->jsOracledb );
1686
- Local<Function> fn = Local<Function>::Cast (jsOracledb->Get (key));
1706
+ Local<Function> fn = Local<Function>::Cast (Nan::Get (jsOracledb,
1707
+ key).ToLocalChecked ());
1687
1708
Local<Value> temp = fn->Call (jsOracledb, 1 , tempArgv);
1688
1709
argv[1 ] = scope.Escape (temp);
1689
1710
}
@@ -1805,10 +1826,10 @@ NAN_GETTER(njsConnection::GetOracleServerVersion)
1805
1826
njsOracledb::ThrowDPIError ();
1806
1827
return ;
1807
1828
}
1808
- uint32_t oracleServerVersion =
1829
+ uint32_t oracleServerVersion = static_cast < uint32_t > (
1809
1830
100000000 * versionInfo.versionNum +
1810
1831
1000000 * versionInfo.releaseNum + 10000 * versionInfo.updateNum +
1811
- 100 * versionInfo.portReleaseNum + versionInfo.portUpdateNum ;
1832
+ 100 * versionInfo.portReleaseNum + versionInfo.portUpdateNum ) ;
1812
1833
info.GetReturnValue ().Set (oracleServerVersion);
1813
1834
}
1814
1835
0 commit comments