예제 #1
0
void getInterpretedCode(const Arguments & args) {
  DEBUG_MARKER(UDEB_DETAIL);
  EscapableHandleScope scope(args.GetIsolate());
  typedef NativeConstMethodCall_0_<const NdbInterpretedCode *, NdbScanFilter> NCALL;
  NCALL ncall(& NdbScanFilter::getInterpretedCode, args);
  ncall.wrapReturnValueAs(getConstNdbInterpretedCodeEnvelope());
  ncall.run();  
  args.GetReturnValue().Set(scope.Escape(ncall.jsReturnVal()));
}
예제 #2
0
 /* Constructor */
 GetTableCall(const Arguments &args) : 
   NativeCFunctionCall_3_<int, SessionImpl *, const char *, const char *>(NULL, args),
   ndb_table(0), per_table_ndb(0), idx_list(), fk_list(), fk_count(0),
   isolate(args.GetIsolate())
 {
   ndb = arg0->ndb; 
   dbName = arg1;
   tableName = arg2;
 }
예제 #3
0
// fetchAllResults()
// ASYNC
void queryFetchAllResults(const Arguments &args) {
  EscapableHandleScope scope(args.GetIsolate());
  REQUIRE_ARGS_LENGTH(1);
  typedef NativeMethodCall_0_<int, QueryOperation> MCALL;
  MCALL * mcallptr = new MCALL(& QueryOperation::fetchAllResults, args);
  mcallptr->errorHandler = getNdbErrorIfLessThanZero;
  mcallptr->runAsync();
  args.GetReturnValue().SetUndefined();
}
예제 #4
0
// void prepareAndExecute() 
// ASYNC
void queryPrepareAndExecute(const Arguments &args) {
  EscapableHandleScope scope(args.GetIsolate());
  DEBUG_MARKER(UDEB_DEBUG);
  REQUIRE_ARGS_LENGTH(1);
  typedef NativeMethodCall_0_<int, QueryOperation> MCALL;
  MCALL * mcallptr = new MCALL(& QueryOperation::prepareAndExecute, args);
  mcallptr->errorHandler = getNdbErrorIfLessThanZero;
  mcallptr->runAsync();
  args.GetReturnValue().SetUndefined();
}
/*  unsigned node_id();
    IMMEDIATE
*/
void Ndb_cluster_connection_node_id(const Arguments &args) {
  DEBUG_MARKER(UDEB_DETAIL);
  EscapableHandleScope scope(args.GetIsolate());
  
  REQUIRE_ARGS_LENGTH(0);  
  
  typedef NativeMethodCall_0_<unsigned int, Ndb_cluster_connection> MCALL;
  MCALL mcall(& Ndb_cluster_connection::node_id, args);
  mcall.run();
  args.GetReturnValue().Set(mcall.jsReturnVal());
 }
예제 #6
0
void setNull_wrapper(const Arguments &args) {
  DEBUG_MARKER(UDEB_DEBUG);
  EscapableHandleScope scope(args.GetIsolate());
  
  REQUIRE_ARGS_LENGTH(2);

  typedef NativeVoidConstMethodCall_2_<const Record, int, char *> NCALL;

  NCALL ncall(& Record::setNull, args);
  ncall.run();
  
  args.GetReturnValue().Set(scope.Escape(ncall.jsReturnVal()));
}
예제 #7
0
void getBufferSize_wrapper(const Arguments &args) {
  DEBUG_MARKER(UDEB_DETAIL);
  EscapableHandleScope scope(args.GetIsolate());
  
  REQUIRE_ARGS_LENGTH(0);

  typedef NativeConstMethodCall_0_<size_t, const Record> NCALL;

  NCALL ncall(& Record::getBufferSize, args);
  ncall.run();
  
  args.GetReturnValue().Set(scope.Escape(ncall.jsReturnVal()));
}
void get_latest_error_msg_wrapper(const Arguments &args) {
  DEBUG_MARKER(UDEB_DETAIL);
  EscapableHandleScope scope(args.GetIsolate());
  
  REQUIRE_ARGS_LENGTH(0);
  
  typedef NativeConstMethodCall_0_<const char *, Ndb_cluster_connection> MCALL;
  MCALL mcall(& Ndb_cluster_connection::get_latest_error_msg, args);
  mcall.wrapReturnValueAs(& ErrorMessageEnvelope);
  mcall.run();
  
  args.GetReturnValue().Set(mcall.jsReturnVal());
}
예제 #9
0
/* read(columnNumber, buffer)
*/
void record_encoderRead(const Arguments & args) {
  EscapableHandleScope scope(args.GetIsolate());
  const Record * record = unwrapPointer<Record *>(args.Holder());
  int columnNumber = args[0]->Uint32Value();
  char * buffer = node::Buffer::Data(args[1]->ToObject());

  const NdbDictionary::Column * col = record->getColumn(columnNumber);
  size_t offset = record->getColumnOffset(columnNumber);

  const NdbTypeEncoder * encoder = getEncoderForColumn(col);
  Local<Value> read = encoder->read(col, buffer, offset);

  args.GetReturnValue().Set(scope.Escape(read));
}
예제 #10
0
void newNdbScanFilter(const Arguments & args) {
  DEBUG_MARKER(UDEB_DETAIL);
  EscapableHandleScope scope(args.GetIsolate());
  
  PROHIBIT_CONSTRUCTOR_CALL();
  REQUIRE_ARGS_LENGTH(1);

  JsValueConverter<NdbInterpretedCode *> arg0(args[0]);
  
  NdbScanFilter * f = new NdbScanFilter(arg0.toC());
  
  Local<Value> jsObject = NdbScanFilterEnvelope.wrap(f);
  NdbScanFilterEnvelope.freeFromGC(f, jsObject);
  args.GetReturnValue().Set(scope.Escape(jsObject));
}
예제 #11
0
Handle<Value> JSN_Print(const Arguments& args) {
	HandleScope handle_scope(args.GetIsolate());

	bool first = true;
	for (int i = 0; i < args.Length(); i++) {
		if (first) {
			first = false;
		} else {
			printf(" ");
		}
		String::Utf8Value str(args[i]);
		const char* cstr = ToCString(str);
		printf("%s", cstr);
	}
	printf("\n");
	fflush(stdout);
	return Undefined();
}
예제 #12
0
/* arg0: TableMetadata wrapping NdbDictionary::Table *
   arg1: Ndb *
   arg2: number of columns
   arg3: array of NdbDictionary::Column *
*/
void getRecordForMapping(const Arguments &args) {
  DEBUG_MARKER(UDEB_DEBUG);
  EscapableHandleScope scope(args.GetIsolate());
  const NdbDictionary::Table *table = 
    unwrapPointer<const NdbDictionary::Table *>(args[0]->ToObject());
  Ndb * ndb = unwrapPointer<Ndb *>(args[1]->ToObject());
  unsigned int nColumns = args[2]->Int32Value();
  Record * record = new Record(ndb->getDictionary(), nColumns);
  for(unsigned int i = 0 ; i < nColumns ; i++) {
    const NdbDictionary::Column * col = 
      unwrapPointer<const NdbDictionary::Column *>
        (args[3]->ToObject()->Get(i)->ToObject());
    record->addColumn(col);
  }
  record->completeTableRecord(table);

  args.GetReturnValue().Set(scope.Escape(Record_Wrapper(record)));
}
/*   int wait_until_ready(int timeout_for_first_alive,
                          int timeout_after_first_alive,
                          callback);
     2 args SYNC / 3 args ASYNC
*/
void Ndb_cluster_connection_wait_until_ready(const Arguments &args) {
  DEBUG_MARKER(UDEB_DETAIL);
  EscapableHandleScope scope(args.GetIsolate());

  args.GetReturnValue().SetUndefined();
  REQUIRE_MIN_ARGS(2);
  REQUIRE_MAX_ARGS(3);
  
  typedef NativeMethodCall_2_<int, Ndb_cluster_connection, int, int> MCALL;

  if(args.Length() == 3) {
    MCALL * mcallptr = new MCALL(& Ndb_cluster_connection::wait_until_ready, args);
    mcallptr->runAsync();
  }
  else {
    MCALL mcall(& Ndb_cluster_connection::wait_until_ready, args);
    mcall.run();
    args.GetReturnValue().Set(mcall.jsReturnVal());
  };
}
/*  Ndb_cluster_connection(const char * connectstring = 0);
*/
void Ndb_cluster_connection_new_wrapper(const Arguments &args) {
  DEBUG_MARKER(UDEB_DETAIL);
  EscapableHandleScope scope(args.GetIsolate());
  
  REQUIRE_CONSTRUCTOR_CALL();
  REQUIRE_ARGS_LENGTH(1);

  JsValueConverter<const char *> arg0(args[0]);
  
  Ndb_cluster_connection * c = new Ndb_cluster_connection(arg0.toC());

  /* We do not expose set_max_adaptive_send_time() to JavaScript nor even
     consider using the default value of 10 ms.
  */
  c->set_max_adaptive_send_time(1);

  Local<Value> wrapper = NdbccEnvelope.wrap(c);
  NdbccEnvelope.freeFromGC(c, wrapper);

  args.GetReturnValue().Set(wrapper);
}
/* int connect(int no_retries=30, int retry_delay_in_seconds=1, int verbose=0);
   3 args SYNC / 4 args ASYNC
*/
void Ndb_cluster_connection_connect(const Arguments &args) {
  DEBUG_MARKER(UDEB_DETAIL);
  EscapableHandleScope scope(args.GetIsolate());

  args.GetReturnValue().SetUndefined();
  REQUIRE_MIN_ARGS(3);
  REQUIRE_MAX_ARGS(4);

  typedef NativeMethodCall_3_ <int, Ndb_cluster_connection, int, int, int> MCALL;

  if(args.Length() == 4) {
    DEBUG_PRINT_DETAIL("async");
    MCALL * mcallptr = new MCALL(& Ndb_cluster_connection::connect, args);
    mcallptr->runAsync();
  }
  else {
    DEBUG_PRINT_DETAIL("sync");
    MCALL mcall(& Ndb_cluster_connection::connect, args);
    mcall.run();
    args.GetReturnValue().Set(mcall.jsReturnVal());
  }
}
예제 #16
0
파일: module.cpp 프로젝트: Botrix/pentago
static Ref<supertensor_index_t> make_index(const Arguments& args) {
  Isolate* iso = args.GetIsolate();
  if (args.Length() < 1)
    throw TypeError(format("supertensor_index_t: expected one sections_t argument, got %d arguments",args.Length()));
  return new_<supertensor_index_t>(from_js<const sections_t&>(iso,args[0]));
}
예제 #17
0
void newIndexBound(const Arguments &args) {
  EscapableHandleScope scope(args.GetIsolate());

  NdbIndexScanOperation::IndexBound * bound = 
    new NdbIndexScanOperation::IndexBound;
  Local<Value> jsBound = IndexBoundEnvelope.wrap(bound);

  const Local<Object> spec = args[0]->ToObject();
  Local<Value> v;
  Local<Object> o;


  bound->low_key = 0;
  v = spec->Get(BOUND_LOW_KEY);
  if(v->IsNull()) {
    bound->low_key = 0;
  } else {
    o = v->ToObject();
    bound->low_key = node::Buffer::Data(o);
  }

  bound->low_key_count = 0;
  v = spec->Get(BOUND_LOW_KEY_COUNT);
  if(! v->IsNull()) {
    bound->low_key_count = v->Uint32Value();
  }
  
  bound->low_inclusive = false;
  v = spec->Get(BOUND_LOW_INCLUSIVE);
  if(! v->IsNull()) {
    bound->low_inclusive = v->BooleanValue();
  }
  
  bound->high_key = 0;
  v = spec->Get(BOUND_HIGH_KEY);
  if(v->IsNull()) {
    bound->high_key = 0;
  } else {
    o = v->ToObject();
    bound->high_key = node::Buffer::Data(o);
  }
  
  bound->high_key_count = 0;
  v = spec->Get(BOUND_HIGH_KEY_COUNT);
  if(! v->IsNull()) {
    bound->high_key_count = v->Uint32Value();
  }
  
  bound->high_inclusive = false;
  v = spec->Get(BOUND_HIGH_INCLUSIVE);
  if(! v->IsNull()) {
    bound->high_inclusive = v->BooleanValue();
  }
  
  bound->range_no = 0;
  v = spec->Get(BOUND_RANGE_NO);
  if(! v->IsNull()) {
    bound->range_no = v->Uint32Value();
  }

  debug_print_bound(bound);

  args.GetReturnValue().Set(scope.Escape(jsBound));
}
예제 #18
0
 /* Constructor */
 ListTablesCall(const Arguments &args) :
   NativeCFunctionCall_2_<int, SessionImpl *, const char *>(NULL, args),
   list(),
   isolate(args.GetIsolate())
 {
 }