You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// loop thru the arr and copy the strings into the strArr
226
+
int bytesWritten = 0;
227
+
for(unsignedint i = 0; i < arr->Length(); i++) {
228
+
Local<Value> currVal = arr->Get(i);
229
+
if(!currVal->IsString()) {
230
+
std::ostringstream message;
231
+
message << "Input array has object with invalid type at index " << i << ", all object must be of type 'string' which is the type of the first element";
232
+
baton->error = newstd::string(message.str());
233
+
return;
234
+
}
235
+
236
+
String::Utf8Value utfStr(currVal);
237
+
238
+
// Copy this string onto the strArr (we put \0 in the beginning as this is what strcat expects).
message << "Input array has object with invalid type at index " << i << ", all object must be of type 'number' which is the type of the first element";
265
+
baton->error = newstd::string(message.str());
266
+
return;
267
+
}
268
+
269
+
// JS numbers can exceed oracle numbers, make sure this is not the case.
270
+
double d = currVal->ToNumber()->Value();
271
+
if (d > 9.99999999999999999999999999999999999999*std::pow(10, 125) || d < -9.99999999999999999999999999999999999999*std::pow(10, 125)) {
272
+
std::ostringstream message;
273
+
message << "Input array has number that is out of the range of Oracle numbers, check the number at index " << i;
274
+
baton->error = newstd::string(message.str());
275
+
return;
276
+
}
277
+
278
+
// Convert the JS number into Oracle Number and get its bytes representation
279
+
oracle::occi::Number n = d;
280
+
oracle::occi::Bytes b = n.toBytes();
281
+
arrParam->elementLength[i] = b.length ();
282
+
b.getBytes(&numArr[i*21], b.length());
283
+
}
284
+
285
+
arrParam->value = numArr;
286
+
arrParam->collectionLength = arr->Length();
287
+
arrParam->elementsSize = 21;
288
+
}
164
289
290
+
// Unsupported type
291
+
else {
292
+
baton->error = newstd::string("The type of the first element in the input array is not supported");
0 commit comments