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
211
+
int bytesWritten = 0;
212
+
for(unsignedint i = 0; i < arr->Length(); i++) {
213
+
Local<Value> currVal = arr->Get(i);
214
+
if(!currVal->IsString()) {
215
+
std::ostringstream message;
216
+
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";
217
+
baton->error = newstd::string(message.str());
218
+
return;
219
+
}
220
+
221
+
String::Utf8Value utfStr(currVal);
222
+
223
+
// Copy this string onto the strArr (we put \0 in the beginning as this is what strcat expects).
// Set the length of this element, add +1 for the '\0'
229
+
value->elementLength[i] = utfStr.length() + 1;
230
+
}
231
+
232
+
value->value = strArr;
233
+
value->collectionLength = arr->Length();
234
+
value->elementsSize = longestString;
235
+
}
236
+
237
+
// Integer array.
238
+
elseif (val->IsNumber()) {
239
+
// Allocate memory and copy the ints.
240
+
double* intArr = newdouble[arr->Length()];
241
+
for(unsignedint i = 0; i < arr->Length(); i++) {
242
+
Local<Value> currVal = arr->Get(i);
243
+
if(!currVal->IsNumber()) {
244
+
std::ostringstream message;
245
+
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";
246
+
baton->error = newstd::string(message.str());
247
+
return;
248
+
}
249
+
250
+
intArr[i] = currVal->ToNumber()->Value();
251
+
}
252
+
253
+
value->value = intArr;
254
+
value->collectionLength = arr->Length();
255
+
value->elementsSize = sizeof(double);
256
+
value->elemetnsType = oracle::occi::OCCIFLOAT;
257
+
}
258
+
259
+
// Unsupported type
260
+
else {
261
+
baton->error = newstd::string("The type of the first element in the input array is not supported");
0 commit comments