uni::CallbackType Connection::Execute(const uni::FunctionCallbackInfo& args) { UNI_SCOPE(scope); Connection* connection = ObjectWrap::Unwrap<Connection>(args.This()); REQ_STRING_ARG(0, sql); REQ_ARRAY_ARG(1, values); REQ_FUN_ARG(2, callback); String::Utf8Value sqlVal(sql); ExecuteBaton* baton = new ExecuteBaton(connection, *sqlVal, &values, &callback); if (baton->error) { Local<String> message = String::New(baton->error->c_str()); delete baton; UNI_THROW(Exception::Error(message)); } uv_work_t* req = new uv_work_t(); req->data = baton; uv_queue_work(uv_default_loop(), req, EIO_Execute, (uv_after_work_cb)EIO_AfterExecute); connection->Ref(); UNI_RETURN(scope, args, Undefined()); }
Handle<Value> Connection::Execute(const Arguments& args) { HandleScope scope; Connection* connection = ObjectWrap::Unwrap<Connection>(args.This()); REQ_STRING_ARG(0, sql); REQ_ARRAY_ARG(1, values); REQ_FUN_ARG(2, callback); String::AsciiValue sqlVal(sql); ExecuteBaton* baton; try { baton = new ExecuteBaton(connection, *sqlVal, &values, &callback); } catch(NodeOracleException &ex) { return scope.Close(ThrowException(Exception::Error(String::New(ex.getMessage().c_str())))); } uv_work_t* req = new uv_work_t(); req->data = baton; uv_queue_work(uv_default_loop(), req, EIO_Execute, (uv_after_work_cb)EIO_AfterExecute); connection->Ref(); return scope.Close(Undefined()); }
Handle<Value> Connection::Execute(const Arguments& args) { Connection* connection = ObjectWrap::Unwrap<Connection>(args.This()); REQ_STRING_ARG(0, sql); REQ_ARRAY_ARG(1, values); REQ_FUN_ARG(2, callback); String::AsciiValue sqlVal(sql); ExecuteBaton* baton; try { baton = new ExecuteBaton(connection, *sqlVal, &values, &callback); } catch(NodeOracleException &ex) { Handle<Value> argv[2]; argv[0] = Exception::Error(String::New(ex.getMessage().c_str())); argv[1] = Undefined(); callback->Call(Context::GetCurrent()->Global(), 2, argv); return Undefined(); } uv_work_t* req = new uv_work_t(); req->data = baton; uv_queue_work(uv_default_loop(), req, EIO_Execute, (uv_after_work_cb)EIO_AfterExecute); connection->Ref(); return Undefined(); }
uni::CallbackType Connection::Rollback(const uni::FunctionCallbackInfo& args) { UNI_SCOPE(scope); Connection* connection = ObjectWrap::Unwrap<Connection>(args.This()); REQ_FUN_ARG(0, callback); RollbackBaton* baton = new RollbackBaton(connection, &callback); uv_work_t* req = new uv_work_t(); req->data = baton; uv_queue_work(uv_default_loop(), req, EIO_Rollback, (uv_after_work_cb)EIO_AfterRollback); connection->Ref(); UNI_RETURN(scope, args, Undefined()); }
Handle<Value> Connection::Commit(const Arguments& args) { HandleScope scope; Connection* connection = ObjectWrap::Unwrap<Connection>(args.This()); REQ_FUN_ARG(0, callback); CommitBaton* baton; try { baton = new CommitBaton(connection, &callback); } catch(NodeOracleException &ex) { return scope.Close(ThrowException(Exception::Error(String::New(ex.getMessage().c_str())))); } uv_work_t* req = new uv_work_t(); req->data = baton; uv_queue_work(uv_default_loop(), req, EIO_Commit, (uv_after_work_cb)EIO_AfterCommit); connection->Ref(); return scope.Close(Undefined()); }
Handle<Value> Connection::Commit(const Arguments& args) { Connection* connection = ObjectWrap::Unwrap<Connection>(args.This()); REQ_FUN_ARG(0, callback); CommitBaton* baton; try { baton = new CommitBaton(connection, &callback); } catch(NodeOracleException &ex) { Handle<Value> argv[2]; argv[0] = Exception::Error(String::New(ex.getMessage().c_str())); argv[1] = Undefined(); callback->Call(Context::GetCurrent()->Global(), 2, argv); return Undefined(); } uv_work_t* req = new uv_work_t(); req->data = baton; uv_queue_work(uv_default_loop(), req, EIO_Commit, (uv_after_work_cb)EIO_AfterCommit); connection->Ref(); return Undefined(); }