Handle<Value> closeNdb(const Arguments &args) {
  DEBUG_MARKER(UDEB_DETAIL);
  typedef NativeDestructorCall<Ndb> MCALL;
  MCALL * mcallptr = new MCALL(args);
  mcallptr->runAsync();
  return Undefined();
}
Handle<Value> Ndb_cluster_connection_delete_wrapper(const Arguments &args) {
  DEBUG_MARKER(UDEB_DETAIL);
  typedef NativeDestructorCall<Ndb_cluster_connection> MCALL;
  MCALL * mcallptr = new MCALL(args);
  mcallptr->runAsync();
  return Undefined();
}
Exemple #3
0
void closeNdb(const Arguments &args) {
  DEBUG_MARKER(UDEB_DETAIL);
  typedef NativeDestructorCall<Ndb> MCALL;
  MCALL * mcallptr = new MCALL(args);
  mcallptr->runAsync();
  args.GetReturnValue().SetUndefined();
}
/* int connect(int no_retries=30, int retry_delay_in_seconds=1, int verbose=0);
   3 args SYNC / 4 args ASYNC
*/
Handle<Value> Ndb_cluster_connection_connect(const Arguments &args) {
    DEBUG_MARKER(UDEB_DETAIL);
    HandleScope scope;
    Local<Value> ret;

    REQUIRE_MIN_ARGS(3);
    REQUIRE_MAX_ARGS(4);

    typedef NativeMethodCall_3_ <int, Ndb_cluster_connection, int, int, int> MCALL;
    MCALL * mcallptr = new MCALL(& Ndb_cluster_connection::connect, args);

    if(args.Length() == 4) {
        DEBUG_PRINT_DETAIL("async");
        mcallptr->runAsync();
        ret = JS_VOID_RETURN;
    }
    else {
        DEBUG_PRINT_DETAIL("sync");
        mcallptr->run();
        ret = mcallptr->jsReturnVal();
        delete mcallptr;
    }

    return scope.Close(ret);
}
void Ndb_cluster_connection_delete_wrapper(const Arguments &args) {
  DEBUG_MARKER(UDEB_DETAIL);
  EscapableHandleScope scope(args.GetIsolate());
  typedef NativeDestructorCall<Ndb_cluster_connection> MCALL;
  MCALL * mcallptr = new MCALL(args);
  mcallptr->runAsync();
  args.GetReturnValue().SetUndefined();
}
// int fetchResults(buffer, forceSend, callback) 
// ASYNC; CALLBACK GETS (Null-Or-Error, Int) 
Handle<Value> scanFetchResults(const Arguments & args) { 
  DEBUG_MARKER(UDEB_DETAIL);
  REQUIRE_ARGS_LENGTH(3);
  typedef NativeMethodCall_2_<int, ScanOperation, char *, bool> MCALL;
  MCALL * ncallptr = new MCALL(& ScanOperation::fetchResults, args);
  ncallptr->errorHandler = getNdbErrorIfLessThanZero;
  ncallptr->runAsync();
  return Undefined();
}
// fetchAllResults()
// ASYNC
Handle<Value> queryFetchAllResults(const Arguments &args) {
  HandleScope scope;
  REQUIRE_ARGS_LENGTH(1);
  typedef NativeMethodCall_0_<int, QueryOperation> MCALL;
  MCALL * mcallptr = new MCALL(& QueryOperation::fetchAllResults, args);
  mcallptr->errorHandler = getNdbErrorIfLessThanZero;
  mcallptr->runAsync();
  return Undefined();
}
// 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();
}
Handle<Value> create_ndb(const Arguments &args) {
  REQUIRE_ARGS_LENGTH(3);  

  typedef NativeCFunctionCall_2_<Ndb *, Ndb_cluster_connection *, const char *> MCALL;
  MCALL * mcallptr = new MCALL(& async_create_ndb, args);
  mcallptr->wrapReturnValueAs(& NdbEnvelope);
  mcallptr->runAsync();
  return Undefined();
}
Handle<Value> getAutoIncValue(const Arguments &args) {
  DEBUG_MARKER(UDEB_DEBUG);
  REQUIRE_ARGS_LENGTH(4);  
  typedef NativeCFunctionCall_3_<Uint64, Ndb *, const NdbDictionary::Table *,
                                 uint32_t> MCALL;
  MCALL * mcallptr = new MCALL(& getAutoInc, args);
  mcallptr->runAsync();
  return Undefined();
}
// void prepareAndExecute() 
// ASYNC
Handle<Value> queryPrepareAndExecute(const Arguments &args) {
  HandleScope scope;
  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();
  return Undefined();
}
// 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();
}
// prepareScan wrapper
Handle<Value> prepareScan_wrapper(const Arguments &args) {
  DEBUG_MARKER(UDEB_DEBUG);
  REQUIRE_ARGS_LENGTH(1);
  typedef NativeMethodCall_0_<NdbScanOperation *, DBScanHelper> MCALL;
  MCALL * mcallptr = new MCALL(& DBScanHelper::prepareScan, args);
  mcallptr->wrapReturnValueAs(getNdbScanOperationEnvelope());
  mcallptr->errorHandler = getNdbErrorIfNull<NdbScanOperation *, DBScanHelper>;
  mcallptr->runAsync();
  
  return Undefined();
}
Handle<Value> startTransaction(const Arguments &args) {  
  REQUIRE_ARGS_LENGTH(4);  
  typedef NativeMethodCall_3_<NdbTransaction *, Ndb, 
                              const NdbDictionary::Table *, 
                              const char *, uint32_t> MCALL;

  MCALL * mcallptr = new MCALL(& Ndb::startTransaction, args);
  DEBUG_PRINT("startTransaction %p", mcallptr->native_obj);
  mcallptr->wrapReturnValueAs(getNdbTransactionEnvelope());
  mcallptr->errorHandler = getNdbErrorIfNull<NdbTransaction *, Ndb>;
  mcallptr->runAsync();
  
  return Undefined();
}
Handle<Value> newDBSessionImpl(const Arguments & args) {
  DEBUG_MARKER(UDEB_DETAIL);
  HandleScope scope;
  
  PROHIBIT_CONSTRUCTOR_CALL();
  REQUIRE_ARGS_LENGTH(5);

  typedef NativeCFunctionCall_4_<DBSessionImpl *, Ndb_cluster_connection *,
                                 AsyncNdbContext *, const char *, int> MCALL;
  MCALL * mcallptr = new MCALL(& asyncNewDBSessionImpl, args);
  mcallptr->wrapReturnValueAs(& DBSessionImplEnvelope);
  mcallptr->runAsync();
  return Undefined();
}
/*   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());
  };
}
/*   int wait_until_ready(int timeout_for_first_alive,
                          int timeout_after_first_alive,
                          callback);
     2 args SYNC / 3 args ASYNC
*/
Handle<Value> Ndb_cluster_connection_wait_until_ready(const Arguments &args) {
  DEBUG_MARKER(UDEB_DETAIL);
  HandleScope scope;
  Local<Value> ret = Local<Value>(*Undefined());
  
  REQUIRE_MIN_ARGS(2);
  REQUIRE_MAX_ARGS(3);
  
  typedef NativeMethodCall_2_<int, Ndb_cluster_connection, int, int> MCALL;
  MCALL * mcallptr = new MCALL(& Ndb_cluster_connection::wait_until_ready, args);

  if(args.Length() == 3) {
    mcallptr->runAsync();
  }
  else {
    mcallptr->run();
    ret = mcallptr->jsReturnVal();
    delete mcallptr;
  };
  
  return scope.Close(ret);
}
/* 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());
  }
}