本文整理汇总了C++中Local::IsArray方法的典型用法代码示例。如果您正苦于以下问题:C++ Local::IsArray方法的具体用法?C++ Local::IsArray怎么用?C++ Local::IsArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Local
的用法示例。
在下文中一共展示了Local::IsArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void
encodeArray(bson_buffer *bb, const char *name, const Local<Value> element) {
Local<Array> a = Array::Cast(*element);
bson_buffer *arr = bson_append_start_array(bb, name);
for (int i = 0, l=a->Length(); i < l; i++) {
Local<Value> val = a->Get(Number::New(i));
stringstream keybuf;
string keyval;
keybuf << i << endl;
keybuf >> keyval;
if (val->IsString()) {
encodeString(arr, keyval.c_str(), val);
}
else if (val->IsInt32()) {
encodeInteger(arr, keyval.c_str(), val);
}
else if (val->IsNumber()) {
encodeNumber(arr, keyval.c_str(), val);
}
else if (val->IsBoolean()) {
encodeBoolean(arr, keyval.c_str(), val);
}
else if (val->IsArray()) {
encodeArray(arr, keyval.c_str(), val);
}
else if (val->IsObject()) {
bson bson(encodeObject(val));
bson_append_bson(arr, keyval.c_str(), &bson);
bson_destroy(&bson);
}
}
bson_append_finish_object(arr);
}
示例2: prepare_import_results
void prepare_import_results(Local<Value> returned_value, sass_context_wrapper* ctx_w) {
NanScope();
if (returned_value->IsArray()) {
Handle<Array> array = Handle<Array>::Cast(returned_value);
ctx_w->imports = sass_make_import_list(array->Length());
for (size_t i = 0; i < array->Length(); ++i) {
Local<Value> value = array->Get(i);
if (!value->IsObject())
continue;
Local<Object> object = Local<Object>::Cast(value);
char* path = create_string(object->Get(NanNew<String>("file")));
char* contents = create_string(object->Get(NanNew<String>("contents")));
ctx_w->imports[i] = sass_make_import_entry(path, (!contents || contents[0] == '\0') ? 0 : strdup(contents), 0);
}
}
else if (returned_value->IsObject()) {
ctx_w->imports = sass_make_import_list(1);
Local<Object> object = Local<Object>::Cast(returned_value);
char* path = create_string(object->Get(NanNew<String>("file")));
char* contents = create_string(object->Get(NanNew<String>("contents")));
ctx_w->imports[0] = sass_make_import_entry(path, (!contents || contents[0] == '\0') ? 0 : strdup(contents), 0);
}
else {
ctx_w->imports = sass_make_import_list(1);
ctx_w->imports[0] = sass_make_import_entry(ctx_w->file, 0, 0);
}
}
示例3: SerializePart
int SerializePart(google::protobuf::Message *message, Handle<Object> subj) {
NanScope();
// get a reflection
const Reflection *r = message->GetReflection();
const Descriptor *d = message->GetDescriptor();
// build a list of required properties
vector<string> required;
for (int i = 0; i < d->field_count(); i++) {
const FieldDescriptor *field = d->field(i);
if (field->is_required())
required.push_back(field->name());
}
// build a reflection
// get properties of passed object
Local<Array> properties = subj->GetPropertyNames();
uint32_t len = properties->Length();
// check that all required properties are present
for (uint32_t i = 0; i < required.size(); i++) {
Handle<String> key = String::New(required.at(i).c_str());
if (!subj->Has(key))
return -1;
}
for (uint32_t i = 0; i < len; i++) {
Local<Value> property = properties->Get(i);
Local<String> property_s = property->ToString();
if (*property_s == NULL)
continue;
String::Utf8Value temp(property);
std::string propertyName = std::string(*temp);
const FieldDescriptor *field = d->FindFieldByName(propertyName);
if (field == NULL) continue;
Local<Value> val = subj->Get(property);
if (field->is_repeated()) {
if (!val->IsArray())
continue;
Handle<Array> array = val.As<Array>();
int len = array->Length();
for (int i = 0; i < len; i++)
SerializeField(message, r, field, array->Get(i));
} else {
SerializeField(message, r, field, val);
}
}
return 0;
}
示例4: Setter
void BookWrap::Setter(uint32_t index, Local<Value> value, const PropertyCallbackInfo<Value>& info) {
Isolate* isolate = info.GetIsolate();
HandleScope scope(isolate);
BookWrap* bw = ObjectWrap::Unwrap<BookWrap>(info.This());
Book* b = bw->m_book;
if (value->IsArray()) {
if (index < b->size()) {
Local<v8::Array> arr = Local<v8::Array>::Cast(value);
if (arr->Length() == 3) {
const String::Utf8Value firstname(arr->Get(0)->ToString());
const String::Utf8Value lastname(arr->Get(1)->ToString());
const time_t birthday = time_t(0.001*(*arr->Get(2))->NumberValue());
Person *p = (*b)[index];
p->firstname(*firstname);
p->lastname(*lastname);
p->birthday(birthday);
}
else {
isolate->ThrowException(Exception::TypeError(String::NewFromUtf8(isolate, "Three elements expected")));
info.GetReturnValue().SetUndefined();
return;
}
}
if (index == b->size()) {
Local<v8::Array> arr = Local<v8::Array>::Cast(value);
if (arr->Length() == 3) {
const String::Utf8Value firstname(arr->Get(0)->ToString());
const String::Utf8Value lastname(arr->Get(1)->ToString());
const time_t birthday = time_t(0.001*(*arr->Get(2))->NumberValue());
Person *p = new Person();
p->firstname(*firstname);
p->lastname(*lastname);
p->birthday(birthday);
b->add(p);
}
else {
isolate->ThrowException(Exception::TypeError(String::NewFromUtf8(isolate, "Three elements expected")));
info.GetReturnValue().SetUndefined();
return;
}
}
else {
isolate->ThrowException(Exception::RangeError(String::NewFromUtf8(isolate, "Invalid index")));
info.GetReturnValue().SetUndefined();
return;
}
}
else {
isolate->ThrowException(Exception::TypeError(String::NewFromUtf8(isolate, "Object expected")));
info.GetReturnValue().SetUndefined();
return;
}
info.GetReturnValue().SetUndefined();
}
示例5: object
void V8BuilderPolicy::AppendToDictKeyList(std::string const & _key,
type const & var)
{
Nan::HandleScope scope;
Local<Value> object(Nan::New(object_));
assert(object->IsObject());
Local<Object> obj = Local<Object>::Cast(object);
KeyMap::const_iterator k_it = keys_.find(_key);
if (k_it == keys_.end())
{
Nan::Persistent<v8::String> * pers_key =
new Nan::Persistent<v8::String>(Nan::New(_key).ToLocalChecked());
keys_[_key] = pers_key;
k_it = keys_.find(_key);
}
Local<String> key = Nan::New(*k_it->second);
// Local<String> key = Nan::New(_key).ToLocalChecked();
if (obj->Has(key))
{
Local<Value> value = obj->Get(key);
if (value->IsArray())
{
Local<Array> arr = Local<Array>::Cast(value);
arr->Set(arr->Length(), Nan::New(var));
}
else
{
Local<Array> arr(Nan::New<Array>());
arr->Set(0, value);
arr->Set(1, Nan::New(var));
obj->Set(key, arr);
}
}
else
{
if (options_.explicit_array_)
{
Local<Array> arr(Nan::New<Array>());
arr->Set(0, Nan::New(var));
obj->Set(key, arr);
}
else
{
obj->Set(key, Nan::New(var));
}
}
}
示例6: _setEmail
void ContactsPersonProxy::_setEmail(void* userContext, Handle<Value> value)
{
ContactsPersonProxy *obj = (ContactsPersonProxy*) userContext;
if(!value->IsObject()) return;
Handle<Object> emailObject = value->ToObject();
Local<Array> emailProperties = emailObject->GetPropertyNames();
for(int i = 0, len = emailProperties->Length(); i < len; i++)
{
Local<String> allEmailsKey = emailProperties->Get(i)->ToString();
Local<Value> allEmailsValue = emailObject->Get(allEmailsKey);
AttributeSubKind::Type subKind = AttributeSubKind::Other;
QString allEmailsKeyString = titanium::V8ValueToQString(allEmailsKey).toLower();
if(allEmailsKeyString == "work")
{
subKind = AttributeSubKind::Work;
}
else
if(allEmailsKeyString == "personal")
{
subKind = AttributeSubKind::Personal;
}
else
if(allEmailsKeyString == "home")
{
subKind = AttributeSubKind::Home;
}
if(!allEmailsValue->IsArray()) return;
Local<Array> emails = Local<Array>::Cast(allEmailsValue);
for(int i = 0, len = emails->Length(); i < len; i++)
{
Local<Value> emailValue = emails->Get(Number::New(i));
if(emailValue->IsString() || emailValue->IsNumber())
{
obj->setContactDetails(AttributeKind::Email, subKind, emailValue);
}
else
{
// Something goes here, throw an error?
}
}
}
}
示例7: SetMediaBox
void PDFPageDriver::SetMediaBox(Local<String> property,Local<Value> value,const AccessorInfo &info)
{
HandleScope scope;
PDFPageDriver* pageDriver = ObjectWrap::Unwrap<PDFPageDriver>(info.Holder());
if(!value->IsArray())
ThrowException(Exception::TypeError(String::New("Media box is set to a value which is not a 4 numbers array")));
if(value->ToObject()->Get(v8::String::New("length"))->ToObject()->Uint32Value() != 4)
ThrowException(Exception::TypeError(String::New("Media box is set to a value which is not a 4 numbers array")));
pageDriver->mPDFPage->SetMediaBox(PDFRectangle(value->ToObject()->Get(0)->ToNumber()->Value(),
value->ToObject()->Get(1)->ToNumber()->Value(),
value->ToObject()->Get(2)->ToNumber()->Value(),
value->ToObject()->Get(3)->ToNumber()->Value()));
}
示例8: getGetdnsType
static GetdnsType getGetdnsType(Local<Value> value) {
if (value->IsNumber() || value->IsNumberObject()) {
return IntType;
} else if (value->IsBoolean() || value->IsBooleanObject()) {
return BoolType;
} else if (value->IsString() || value->IsStringObject()) {
return StringType;
} else if (value->IsObject()) {
// could be a node buffer or array
if (node::Buffer::HasInstance(value)) {
return BinDataType;
} else if (value->IsArray()) {
return ListType;
} else if (GNUtil::isDictionaryObject(value)) {
return DictType;
}
}
return UnknownType;
}
示例9: setUpstreams
static void setUpstreams(getdns_context* context, Handle<Value> opt) {
if (opt->IsArray()) {
getdns_list* upstreams = getdns_list_create();
Handle<Array> values = Handle<Array>::Cast(opt);
for (uint32_t i = 0; i < values->Length(); ++i) {
Local<Value> ipOrTuple = values->Get(i);
getdns_dict* ipDict = NULL;
if (ipOrTuple->IsArray()) {
// two tuple - first is IP, 2nd is port
Handle<Array> tuple = Handle<Array>::Cast(ipOrTuple);
if (tuple->Length() > 0) {
String::AsciiValue asciiStr(tuple->Get(0)->ToString());
ipDict = getdns_util_create_ip(*asciiStr);
if (ipDict && tuple->Length() > 1 &&
tuple->Get(1)->IsNumber()) {
// port
uint32_t port = tuple->Get(1)->Uint32Value();
getdns_dict_set_int(ipDict, "port", port);
}
}
} else {
String::AsciiValue asciiStr(ipOrTuple->ToString());
ipDict = getdns_util_create_ip(*asciiStr);
}
if (ipDict) {
size_t len = 0;
getdns_list_get_length(upstreams, &len);
getdns_list_set_dict(upstreams, len, ipDict);
getdns_dict_destroy(ipDict);
} else {
Local<String> msg = String::Concat(String::New("Upstream value is invalid: "), ipOrTuple->ToString());
ThrowException(Exception::TypeError(msg));
}
}
getdns_return_t r = getdns_context_set_upstream_recursive_servers(context, upstreams);
getdns_list_destroy(upstreams);
if (r != GETDNS_RETURN_GOOD) {
ThrowException(Exception::TypeError(String::New("Failed to set upstreams.")));
}
}
}
示例10: _setPhone
void ContactsPersonProxy::_setPhone(void* userContext, Handle<Value> value)
{
ContactsPersonProxy *obj = (ContactsPersonProxy*) userContext;
if(!value->IsObject()) return;
Handle<Object> phoneObject = value->ToObject();
Local<Array> phoneProperties = phoneObject->GetPropertyNames();
for(int i = 0, len = phoneProperties->Length(); i < len; i++)
{
Local<String> phoneKey = phoneProperties->Get(i)->ToString();
Local<Value> phoneValue = phoneObject->Get(phoneKey);
AttributeSubKind::Type subKind = AttributeSubKind::Other;
QString phoneStringValue = titanium::V8ValueToQString(phoneKey);
if(phoneStringValue == "home") {
subKind = AttributeSubKind::Home;
} else
if(phoneStringValue == "work") {
subKind = AttributeSubKind::Work;
} else
if(phoneStringValue == "mobile") {
subKind = AttributeSubKind::PhoneMobile;
}
if(!phoneValue->IsArray()) return;
Local<Array> phones = Local<Array>::Cast(phoneValue);
for(int i = 0, len = phones->Length(); i < len; i++)
{
Local<Value> currentMessage = phones->Get(Number::New(i));
if(!currentMessage->IsString()) return;
obj->setContactDetails(AttributeKind::Phone, subKind, currentMessage);
}
}
}
示例11: SerializePart
void SerializePart(google::protobuf::Message *message, Handle<Object> src) {
Handle<Function> to_array = handle_->GetInternalField(3).As<Function>();
Handle<Array> properties = to_array->Call(src, 0, NULL).As<Array>();
const Reflection *r = message->GetReflection();
for (int i = 0; i < descriptor->field_count(); i++) {
Local<Value> value = properties->Get(i);
if (value->IsUndefined() || value->IsNull())
continue;
const FieldDescriptor* field = descriptor->field(i);
if (field->is_repeated()) {
if (value->IsArray()) {
Handle<Array> array = value.As<Array>();
int length = array->Length();
for (int j = 0; j < length; j++)
SerializeField(message, r, field, array->Get(j));
}
else if (value->IsObject() &&
field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE &&
field->message_type()->name().compare(0, 20, "KeyValuePair_String_") == 0) {
Local<Object> object = value.As<Object>();
Local<Array> subProperties = object->GetOwnPropertyNames();
int len = subProperties->Length();
for (int keyIdx = 0; keyIdx < len; keyIdx++) {
Local<Object> keyValuePair = Object::New();
Local<Value> key = subProperties->Get(keyIdx);
keyValuePair->Set(KeySymbol, key);
keyValuePair->Set(ValueSymbol, object->Get(key));
SerializeField(message, r, field, keyValuePair);
}
}
} else {
SerializeField(message, r, field, value);
}
}
}
示例12: ThrowException
Handle<Value>
Session::Request(const Arguments& args)
{
HandleScope scope;
if (args.Length() < 1 || !args[0]->IsString()) {
return ThrowException(Exception::Error(String::New(
"Service URI string must be provided as first parameter.")));
}
if (args.Length() < 2 || !args[1]->IsString()) {
return ThrowException(Exception::Error(String::New(
"String request name must be provided as second parameter.")));
}
if (args.Length() < 3 || !args[2]->IsObject()) {
return ThrowException(Exception::Error(String::New(
"Object containing request parameters must be provided "
"as third parameter.")));
}
if (args.Length() < 4 || !args[3]->IsInt32()) {
return ThrowException(Exception::Error(String::New(
"Integer correlation identifier must be provided "
"as fourth parameter.")));
}
if (args.Length() >= 5 && !args[4]->IsUndefined() && !args[4]->IsString()) {
return ThrowException(Exception::Error(String::New(
"Optional request label must be a string.")));
}
if (args.Length() > 5) {
return ThrowException(Exception::Error(String::New(
"Function expects at most five arguments.")));
}
int cidi = args[3]->Int32Value();
Session* session = ObjectWrap::Unwrap<Session>(args.This());
BLPAPI_EXCEPTION_TRY
Local<String> uri = args[0]->ToString();
String::AsciiValue uriv(uri);
blpapi::Service service = session->d_session->getService(*uriv);
Local<String> name = args[1]->ToString();
String::Utf8Value namev(name);
blpapi::Request request = service.createRequest(*namev);
// Loop over object properties, appending/setting into the request.
Local<Object> obj = args[2]->ToObject();
Local<Array> props = obj->GetPropertyNames();
for (std::size_t i = 0; i < props->Length(); ++i) {
// Process the key.
Local<Value> keyval = props->Get(i);
Local<String> key = keyval->ToString();
String::Utf8Value keyv(key);
// Process the value.
//
// The values present on the outer object are marshalled into the
// blpapi::Request by setting values using 'set'. Arrays indicate
// values which should be marshalled using 'append'.
Local<Value> val = obj->Get(keyval);
if (val->IsString()) {
Local<String> s = val->ToString();
String::Utf8Value valv(s);
request.set(*keyv, *valv);
} else if (val->IsBoolean()) {
request.set(*keyv, val->BooleanValue());
} else if (val->IsNumber()) {
request.set(*keyv, val->NumberValue());
} else if (val->IsInt32()) {
request.set(*keyv, val->Int32Value());
} else if (val->IsUint32()) {
request.set(*keyv,
static_cast<blpapi::Int64>(val->Uint32Value()));
} else if (val->IsDate()) {
blpapi::Datetime dt;
mkdatetime(&dt, val);
request.set(*keyv, dt);
} else if (val->IsArray()) {
// Arrays are marshalled into the blpapi::Request by appending
// value types using the key of the array in the outer object.
Local<Object> subarray = val->ToObject();
int jmax = Array::Cast(*val)->Length();
for (int j = 0; j < jmax; ++j) {
Local<Value> subval = subarray->Get(j);
// Only strings, booleans, and numbers are marshalled.
if (subval->IsString()) {
Local<String> s = subval->ToString();
String::Utf8Value subvalv(s);
request.append(*keyv, *subvalv);
} else if (subval->IsBoolean()) {
request.append(*keyv, subval->BooleanValue());
} else if (subval->IsNumber()) {
request.append(*keyv, subval->NumberValue());
} else if (subval->IsInt32()) {
request.append(*keyv, subval->Int32Value());
} else if (subval->IsUint32()) {
//.........这里部分代码省略.........
示例13: nbounds
DBScanHelper::DBScanHelper(const Arguments &args) :
nbounds(0),
isIndexScan(false)
{
DEBUG_MARKER(UDEB_DEBUG);
Local<Value> v;
const Local<Object> spec = args[0]->ToObject();
int opcode = args[1]->Int32Value();
tx = unwrapPointer<NdbTransaction *>(args[2]->ToObject());
lmode = NdbOperation::LM_CommittedRead;
scan_options = & options;
options.optionsPresent = 0ULL;
v = spec->Get(SCAN_TABLE_RECORD);
if(! v->IsNull()) {
Local<Object> o = v->ToObject();
row_record = unwrapPointer<const Record *>(o);
}
v = spec->Get(SCAN_INDEX_RECORD);
if(! v->IsNull()) {
Local<Object> o = v->ToObject();
isIndexScan = true;
key_record = unwrapPointer<const Record *>(o);
}
v = spec->Get(SCAN_LOCK_MODE);
if(! v->IsNull()) {
int intLockMode = v->Int32Value();
lmode = static_cast<NdbOperation::LockMode>(intLockMode);
}
// SCAN_BOUNDS is an array of BoundHelpers
v = spec->Get(SCAN_BOUNDS);
if(v->IsArray()) {
Local<Object> o = v->ToObject();
while(o->Has(nbounds)) {
nbounds++;
}
bounds = new NdbIndexScanOperation::IndexBound *[nbounds];
for(int i = 0 ; i < nbounds ; i++) {
Local<Object> b = o->Get(i)->ToObject();
bounds[i] = unwrapPointer<NdbIndexScanOperation::IndexBound *>(b);
}
}
v = spec->Get(SCAN_OPTION_FLAGS);
if(! v->IsNull()) {
options.scan_flags = v->Uint32Value();
options.optionsPresent |= NdbScanOperation::ScanOptions::SO_SCANFLAGS;
}
v = spec->Get(SCAN_OPTION_BATCH_SIZE);
if(! v->IsNull()) {
options.batch = v->Uint32Value();
options.optionsPresent |= NdbScanOperation::ScanOptions::SO_BATCH;
}
v = spec->Get(SCAN_OPTION_PARALLELISM);
if(! v->IsNull()) {
options.parallel = v->Uint32Value();
options.optionsPresent |= NdbScanOperation::ScanOptions::SO_PARALLEL;
}
v = spec->Get(SCAN_FILTER_CODE);
if(! v->IsNull()) {
Local<Object> o = v->ToObject();
options.interpretedCode = unwrapPointer<NdbInterpretedCode *>(o);
options.optionsPresent |= NdbScanOperation::ScanOptions::SO_INTERPRETED;
}
/* Scanning delete requires key info */
if(opcode == OP_SCAN_DELETE) {
options.scan_flags |= NdbScanOperation::SF_KeyInfo;
options.optionsPresent |= NdbScanOperation::ScanOptions::SO_SCANFLAGS;
}
/* Done defining the object */
}
示例14: checkArgument
void JSZCluster::checkArgument(const v8::FunctionCallbackInfo<v8::Value> &info, unsigned int index,
const std::shared_ptr<ClusterCmdParamsBase> &cmdParam) {
if (info.Length() <= ((int) index + 1)) {
stringstream stream;
stream << EXECUTE_CMD_BY_ID << " needs almost " << index << " arguments where the first is the cmd";
throw JSException(stream.str());
}
Local<v8::Value> arg = info[index + 1];
switch (cmdParam->getZCLDataType()) {
case ZCLTypeDataType::ZCLTypeUInt8:
case ZCLTypeDataType::ZCLTypeUInt16:
case ZCLTypeDataType::ZCLTypeUInt24:
case ZCLTypeDataType::ZCLTypeUInt32:
case ZCLTypeDataType::ZCLTypeUInt40:
case ZCLTypeDataType::ZCLTypeUInt48:
case ZCLTypeDataType::ZCLTypeUInt56:
case ZCLTypeDataType::ZCLTypeUInt64:
if (!arg->IsUint32()) {
stringstream stream;
stream << EXECUTE_CMD_BY_ID << " needs as argument " << index << " an unsigned integer";
throw JSException(stream.str());
}
break;
case ZCLTypeDataType::ZCLTypeSInt8:
case ZCLTypeDataType::ZCLTypeSInt16:
case ZCLTypeDataType::ZCLTypeSInt24:
case ZCLTypeDataType::ZCLTypeSInt32:
case ZCLTypeDataType::ZCLTypeSInt40:
case ZCLTypeDataType::ZCLTypeSInt48:
case ZCLTypeDataType::ZCLTypeSInt56:
case ZCLTypeDataType::ZCLTypeSInt64:
if (!arg->IsInt32()) {
stringstream stream;
stream << EXECUTE_CMD_BY_ID << " needs as argument " << index << " an integer";
throw JSException(stream.str());
}
break;
case ZCLTypeDataType::ZCLTypeIEEEaddress:
case ZCLTypeDataType::ZCLTypeStringChar:
if (!arg->IsString()) {
stringstream stream;
stream << EXECUTE_CMD_BY_ID << " needs as argument " << index << " a string";
throw JSException(stream.str());
}
break;
case ZCLTypeDataType::ZCLTypeArray:
if (!arg->IsUint32Array() && !arg->IsUint32Array()) {
if (!arg->IsArray()) {
stringstream stream;
stream << EXECUTE_CMD_BY_ID << " needs as argument " << index << " an array";
throw JSException(stream.str());
}
}
break;
default:
stringstream stream;
stream << EXECUTE_CMD_BY_ID << " needs as argument " << index << " a type "
<< cmdParam->getZCLDataType() << " the it is not managed";
throw JSException(stream.str());
}
}
示例15: KeyOperation
ScanOperation::ScanOperation(const Arguments &args) :
KeyOperation(),
scan_op(0),
index_scan_op(0),
nbounds(0),
isIndexScan(false)
{
DEBUG_MARKER(UDEB_DEBUG);
Local<Value> v;
const Local<Object> spec = args[0]->ToObject();
opcode = args[1]->Int32Value();
ctx = unwrapPointer<TransactionImpl *>(args[2]->ToObject());
lmode = NdbOperation::LM_CommittedRead;
scan_options.scan_flags = 0;
scan_options.optionsPresent = 0ULL;
v = spec->Get(SCAN_TABLE_RECORD);
if(! v->IsNull()) {
Local<Object> o = v->ToObject();
row_record = unwrapPointer<const Record *>(o);
createBlobReadHandles(row_record);
}
v = spec->Get(SCAN_INDEX_RECORD);
if(! v->IsNull()) {
Local<Object> o = v->ToObject();
isIndexScan = true;
key_record = unwrapPointer<const Record *>(o);
}
v = spec->Get(SCAN_LOCK_MODE);
if(! v->IsNull()) {
int intLockMode = v->Int32Value();
DEBUG_PRINT("Scan lock mode %d", intLockMode);
lmode = static_cast<NdbOperation::LockMode>(intLockMode);
}
// SCAN_BOUNDS is an array of BoundHelpers
v = spec->Get(SCAN_BOUNDS);
if(v->IsArray()) {
Local<Object> o = v->ToObject();
while(o->Has(nbounds)) {
nbounds++;
}
DEBUG_PRINT("Index Scan with %d IndexBounds", nbounds);
bounds = new NdbIndexScanOperation::IndexBound *[nbounds];
for(int i = 0 ; i < nbounds ; i++) {
Local<Object> b = o->Get(i)->ToObject();
bounds[i] = unwrapPointer<NdbIndexScanOperation::IndexBound *>(b);
}
}
v = spec->Get(SCAN_OPTION_FLAGS);
if(! v->IsNull()) {
scan_options.scan_flags = v->Uint32Value();
}
v = spec->Get(SCAN_OPTION_BATCH_SIZE);
if(! v->IsNull()) {
scan_options.batch = v->Uint32Value();
scan_options.optionsPresent |= NdbScanOperation::ScanOptions::SO_BATCH;
}
v = spec->Get(SCAN_OPTION_PARALLELISM);
if(! v->IsNull()) {
scan_options.parallel = v->Uint32Value();
scan_options.optionsPresent |= NdbScanOperation::ScanOptions::SO_PARALLEL;
}
v = spec->Get(SCAN_FILTER_CODE);
if(! v->IsNull()) {
Local<Object> o = v->ToObject();
scan_options.interpretedCode = unwrapPointer<NdbInterpretedCode *>(o);
scan_options.optionsPresent |= NdbScanOperation::ScanOptions::SO_INTERPRETED;
}
/* Scanning delete requires key info */
if(opcode == OP_SCAN_DELETE) {
scan_options.scan_flags |= NdbScanOperation::SF_KeyInfo;
}
/* If any flags were set, also set SO_SCANFLAGS options */
if(scan_options.scan_flags != 0) {
scan_options.optionsPresent |= NdbScanOperation::ScanOptions::SO_SCANFLAGS;
}
/* Done defining the object */
debug_print_flags_and_options(scan_options);
}