Permalink
Browse files

trying to make it work with windows

  • Loading branch information...
1 parent 2d52c3a commit 97fdeb5e35c04b17cecbd7a96017fe8b90aac069 @joeferner committed Feb 8, 2012
Showing with 41 additions and 28 deletions.
  1. +1 −0 .gitignore
  2. +15 −12 src/connection.cpp
  3. +9 −7 src/connection.h
  4. +3 −1 src/executeBaton.h
  5. +5 −4 src/oracle_bindings.cpp
  6. +5 −3 src/oracle_bindings.h
  7. +3 −1 src/outParam.h
View
@@ -4,3 +4,4 @@ node_modules
*.sh
*.swp
.lock*
+.idea
View
@@ -60,7 +60,9 @@ Handle<Value> Connection::Execute(const Arguments& args) {
return Undefined();
}
- eio_custom(EIO_Execute, EIO_PRI_DEFAULT, EIO_AfterExecute, baton);
+ uv_work_t* req = new uv_work_t();
+ req->data = baton;
+ uv_queue_work(uv_default_loop(), req, EIO_Execute, EIO_AfterExecute);
ev_ref(EV_DEFAULT_UC);
connection->Ref();
@@ -91,7 +93,9 @@ Handle<Value> Connection::Commit(const Arguments& args) {
return Undefined();
}
- eio_custom(EIO_Commit, EIO_PRI_DEFAULT, EIO_AfterCommit, baton);
+ uv_work_t* req = new uv_work_t();
+ req->data = baton;
+ uv_queue_work(uv_default_loop(), req, EIO_Commit, EIO_AfterCommit);
ev_ref(EV_DEFAULT_UC);
connection->Ref();
@@ -115,7 +119,9 @@ Handle<Value> Connection::Rollback(const Arguments& args) {
return Undefined();
}
- eio_custom(EIO_Rollback, EIO_PRI_DEFAULT, EIO_AfterRollback, baton);
+ uv_work_t* req = new uv_work_t();
+ req->data = baton;
+ uv_queue_work(uv_default_loop(), req, EIO_Rollback, EIO_AfterRollback);
ev_ref(EV_DEFAULT_UC);
connection->Ref();
@@ -248,13 +254,13 @@ row_t* Connection::CreateRowFromCurrentResultSetRow(oracle::occi::ResultSet* rs,
return row;
}
-void Connection::EIO_Commit(eio_req* req) {
+void Connection::EIO_Commit(uv_work_t* req) {
CommitBaton* baton = static_cast<CommitBaton*>(req->data);
baton->connection->m_connection->commit();
}
-int Connection::EIO_AfterCommit(eio_req* req) {
+void Connection::EIO_AfterCommit(uv_work_t* req) {
CommitBaton* baton = static_cast<CommitBaton*>(req->data);
ev_unref(EV_DEFAULT_UC);
baton->connection->Unref();
@@ -264,16 +270,15 @@ int Connection::EIO_AfterCommit(eio_req* req) {
baton->callback->Call(Context::GetCurrent()->Global(), 1, argv);
delete baton;
- return 0;
}
-void Connection::EIO_Rollback(eio_req* req) {
+void Connection::EIO_Rollback(uv_work_t* req) {
RollbackBaton* baton = static_cast<RollbackBaton*>(req->data);
baton->connection->m_connection->rollback();
}
-int Connection::EIO_AfterRollback(eio_req* req) {
+void Connection::EIO_AfterRollback(uv_work_t* req) {
RollbackBaton* baton = static_cast<RollbackBaton*>(req->data);
ev_unref(EV_DEFAULT_UC);
baton->connection->Unref();
@@ -283,10 +288,9 @@ int Connection::EIO_AfterRollback(eio_req* req) {
baton->callback->Call(Context::GetCurrent()->Global(), 1, argv);
delete baton;
- return 0;
}
-void Connection::EIO_Execute(eio_req* req) {
+void Connection::EIO_Execute(uv_work_t* req) {
ExecuteBaton* baton = static_cast<ExecuteBaton*>(req->data);
baton->rows = NULL;
@@ -436,7 +440,7 @@ Local<Array> Connection::CreateV8ArrayFromRows(ExecuteBaton* baton) {
return rows;
}
-int Connection::EIO_AfterExecute(eio_req* req) {
+void Connection::EIO_AfterExecute(uv_work_t* req) {
ExecuteBaton* baton = static_cast<ExecuteBaton*>(req->data);
ev_unref(EV_DEFAULT_UC);
baton->connection->Unref();
@@ -469,7 +473,6 @@ int Connection::EIO_AfterExecute(eio_req* req) {
}
delete baton;
- return 0;
}
void Connection::setConnection(oracle::occi::Environment* environment, oracle::occi::Connection* connection) {
View
@@ -4,7 +4,9 @@
#include <v8.h>
#include <node.h>
-#include <unistd.h>
+#ifndef WIN32
+ #include <unistd.h>
+#endif
#include <occi.h>
#include <oro.h>
#include "utils.h"
@@ -24,12 +26,12 @@ class Connection : ObjectWrap {
static Handle<Value> Rollback(const Arguments& args);
static Handle<Value> SetAutoCommit(const Arguments& args);
static Persistent<FunctionTemplate> constructorTemplate;
- static void EIO_Execute(eio_req* req);
- static int EIO_AfterExecute(eio_req* req);
- static void EIO_Commit(eio_req* req);
- static int EIO_AfterCommit(eio_req* req);
- static void EIO_Rollback(eio_req* req);
- static int EIO_AfterRollback(eio_req* req);
+ static void EIO_Execute(uv_work_t* req);
+ static void EIO_AfterExecute(uv_work_t* req);
+ static void EIO_Commit(uv_work_t* req);
+ static void EIO_AfterCommit(uv_work_t* req);
+ static void EIO_Rollback(uv_work_t* req);
+ static void EIO_AfterRollback(uv_work_t* req);
void closeConnection();
Connection();
View
@@ -6,7 +6,9 @@ class Connection;
#include <v8.h>
#include <node.h>
-#include <unistd.h>
+#ifndef WIN32
+ #include <unistd.h>
+#endif
#include <occi.h>
#include <string>
#include <sstream>
View
@@ -68,13 +68,15 @@ Handle<Value> OracleClient::Connect(const Arguments& args) {
client->Ref();
- eio_custom(EIO_Connect, EIO_PRI_DEFAULT, EIO_AfterConnect, baton);
+ uv_work_t* req = new uv_work_t();
+ req->data = baton;
+ uv_queue_work(uv_default_loop(), req, EIO_Connect, EIO_AfterConnect);
ev_ref(EV_DEFAULT_UC);
return Undefined();
}
-void OracleClient::EIO_Connect(eio_req* req) {
+void OracleClient::EIO_Connect(uv_work_t* req) {
connect_baton_t* baton = static_cast<connect_baton_t*>(req->data);
baton->error = NULL;
@@ -88,7 +90,7 @@ void OracleClient::EIO_Connect(eio_req* req) {
}
}
-int OracleClient::EIO_AfterConnect(eio_req* req) {
+void OracleClient::EIO_AfterConnect(uv_work_t* req) {
HandleScope scope;
connect_baton_t* baton = static_cast<connect_baton_t*>(req->data);
ev_unref(EV_DEFAULT_UC);
@@ -111,7 +113,6 @@ int OracleClient::EIO_AfterConnect(eio_req* req) {
if(baton->error) delete baton->error;
delete baton;
- return 0;
}
extern "C" {
View
@@ -4,7 +4,9 @@
#include <v8.h>
#include <node.h>
-#include <unistd.h>
+#ifndef WIN32
+ #include <unistd.h>
+#endif
#include <occi.h>
#include "utils.h"
@@ -16,8 +18,8 @@ class OracleClient : ObjectWrap {
static void Init(Handle<Object> target);
static Handle<Value> New(const Arguments& args);
static Handle<Value> Connect(const Arguments& args);
- static void EIO_Connect(eio_req* req);
- static int EIO_AfterConnect(eio_req* req);
+ static void EIO_Connect(uv_work_t* req);
+ static void EIO_AfterConnect(uv_work_t* req);
OracleClient();
~OracleClient();
View
@@ -4,7 +4,9 @@
#include <v8.h>
#include <node.h>
-#include <unistd.h>
+#ifndef WIN32
+ #include <unistd.h>
+#endif
#include "utils.h"
using namespace node;

0 comments on commit 97fdeb5

Please sign in to comment.