Commit 5174aaae by King Koopa

Updated for new v8

parent b69ed971
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
}, },
"dependencies": { "dependencies": {
"node-pre-gyp": "0.5.x", "node-pre-gyp": "0.5.x",
"nan": "~0.8.0" "nan": "git://github.com/rvagg/nan.git#0.9-wip"
}, },
"bundledDependencies": [ "bundledDependencies": [
"node-pre-gyp" "node-pre-gyp"
......
...@@ -40,11 +40,11 @@ public: ...@@ -40,11 +40,11 @@ public:
db(db_), status(SQLITE_OK) { db(db_), status(SQLITE_OK) {
db->Ref(); db->Ref();
request.data = this; request.data = this;
NanAssignPersistent(Function, callback, cb_); NanAssignPersistent(callback, cb_);
} }
virtual ~Baton() { virtual ~Baton() {
db->Unref(); db->Unref();
callback.Dispose(); NanDisposePersistent(callback);
} }
}; };
......
...@@ -57,54 +57,54 @@ const char* sqlite_authorizer_string(int type); ...@@ -57,54 +57,54 @@ const char* sqlite_authorizer_string(int type);
#define DEFINE_CONSTANT_INTEGER(target, constant, name) \ #define DEFINE_CONSTANT_INTEGER(target, constant, name) \
(target)->Set( \ (target)->Set( \
String::NewSymbol(#name), \ NanSymbol(#name), \
Integer::New(constant), \ NanNew<Integer>(constant), \
static_cast<PropertyAttribute>(ReadOnly | DontDelete) \ static_cast<PropertyAttribute>(ReadOnly | DontDelete) \
); );
#define DEFINE_CONSTANT_STRING(target, constant, name) \ #define DEFINE_CONSTANT_STRING(target, constant, name) \
(target)->Set( \ (target)->Set( \
String::NewSymbol(#name), \ NanSymbol(#name), \
String::NewSymbol(constant), \ NanSymbol(constant), \
static_cast<PropertyAttribute>(ReadOnly | DontDelete) \ static_cast<PropertyAttribute>(ReadOnly | DontDelete) \
); );
#define NODE_SET_GETTER(target, name, function) \ #define NODE_SET_GETTER(target, name, function) \
(target)->InstanceTemplate() \ (target)->InstanceTemplate() \
->SetAccessor(String::NewSymbol(name), (function)); ->SetAccessor(NanSymbol(name), (function));
#define GET_STRING(source, name, property) \ #define GET_STRING(source, name, property) \
String::Utf8Value name((source)->Get(String::NewSymbol(property))); String::Utf8Value name((source)->Get(NanSymbol(property)));
#define GET_INTEGER(source, name, property) \ #define GET_INTEGER(source, name, property) \
int name = (source)->Get(String::NewSymbol(property))->Int32Value(); int name = (source)->Get(NanSymbol(property))->Int32Value();
#define EXCEPTION(msg, errno, name) \ #define EXCEPTION(msg, errno, name) \
Local<Value> name = Exception::Error( \ Local<Value> name = Exception::Error( \
String::Concat( \ String::Concat( \
String::Concat( \ String::Concat( \
String::NewSymbol(sqlite_code_string(errno)), \ NanSymbol(sqlite_code_string(errno)), \
String::NewSymbol(": ") \ NanSymbol(": ") \
), \ ), \
(msg) \ (msg) \
) \ ) \
); \ ); \
Local<Object> name ##_obj = name->ToObject(); \ Local<Object> name ##_obj = name->ToObject(); \
name ##_obj->Set(String::NewSymbol("errno"), Integer::New(errno)); \ name ##_obj->Set(NanSymbol("errno"), NanNew<Integer>(errno)); \
name ##_obj->Set(String::NewSymbol("code"), \ name ##_obj->Set(NanSymbol("code"), \
String::NewSymbol(sqlite_code_string(errno))); NanSymbol(sqlite_code_string(errno)));
#define EMIT_EVENT(obj, argc, argv) \ #define EMIT_EVENT(obj, argc, argv) \
TRY_CATCH_CALL((obj), \ TRY_CATCH_CALL((obj), \
Local<Function>::Cast((obj)->Get(String::NewSymbol("emit"))), \ Local<Function>::Cast((obj)->Get(NanSymbol("emit"))), \
argc, argv \ argc, argv \
); );
#define TRY_CATCH_CALL(context, callback, argc, argv) \ #define TRY_CATCH_CALL(context, callback, argc, argv) \
{ TryCatch try_catch; \ { TryCatch try_catch; \
MakeCallback((context), (callback), (argc), (argv)); \ NanMakeCallback((context), (callback), (argc), (argv)); \
if (try_catch.HasCaught()) { \ if (try_catch.HasCaught()) { \
FatalException(try_catch); \ FatalException(try_catch); \
} } } }
......
...@@ -88,7 +88,7 @@ public: ...@@ -88,7 +88,7 @@ public:
Baton(Statement* stmt_, Handle<Function> cb_) : stmt(stmt_) { Baton(Statement* stmt_, Handle<Function> cb_) : stmt(stmt_) {
stmt->Ref(); stmt->Ref();
request.data = this; request.data = this;
NanAssignPersistent(Function, callback, cb_); NanAssignPersistent(callback, cb_);
} }
virtual ~Baton() { virtual ~Baton() {
for (unsigned int i = 0; i < parameters.size(); i++) { for (unsigned int i = 0; i < parameters.size(); i++) {
...@@ -96,7 +96,7 @@ public: ...@@ -96,7 +96,7 @@ public:
DELETE_FIELD(field); DELETE_FIELD(field);
} }
stmt->Unref(); stmt->Unref();
callback.Dispose(); NanDisposePersistent(callback);
} }
}; };
...@@ -176,8 +176,8 @@ public: ...@@ -176,8 +176,8 @@ public:
~Async() { ~Async() {
stmt->Unref(); stmt->Unref();
item_cb.Dispose(); NanDisposePersistent(item_cb);
completed_cb.Dispose(); NanDisposePersistent(completed_cb);
NODE_SQLITE3_MUTEX_DESTROY NODE_SQLITE3_MUTEX_DESTROY
} }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment