Commit cacde384 by King Koopa

Updates

parent 5174aaae
......@@ -42,7 +42,7 @@ void Database::Process() {
// Call all callbacks with the error object.
while (!queue.empty()) {
Call* call = queue.front();
Local<Function> cb = NanPersistentToLocal(call->baton->callback);
Local<Function> cb = NanNew(call->baton->callback);
if (!cb.IsEmpty() && cb->IsFunction()) {
TRY_CATCH_CALL(NanObjectWrapHandle(this), cb, 1, argv);
called = true;
......@@ -82,7 +82,7 @@ void Database::Process() {
void Database::Schedule(Work_Callback callback, Baton* baton, bool exclusive) {
if (!open && locked) {
EXCEPTION(NanNew<String>("Database is closed"), SQLITE_MISUSE, exception);
Local<Function> cb = NanPersistentToLocal(baton->callback);
Local<Function> cb = NanNew(baton->callback);
if (!cb.IsEmpty() && cb->IsFunction()) {
Local<Value> argv[] = { exception };
TRY_CATCH_CALL(NanObjectWrapHandle(this), cb, 1, argv);
......@@ -181,7 +181,7 @@ void Database::Work_AfterOpen(uv_work_t* req) {
argv[0] = NanNew(NanNull());
}
Local<Function> cb = NanPersistentToLocal(baton->callback);
Local<Function> cb = NanNew(baton->callback);
if (!cb.IsEmpty() && cb->IsFunction()) {
TRY_CATCH_CALL(NanObjectWrapHandle(db), cb, 1, argv);
......@@ -260,7 +260,7 @@ void Database::Work_AfterClose(uv_work_t* req) {
argv[0] = NanNew(NanNull());
}
Local<Function> cb = NanPersistentToLocal(baton->callback);
Local<Function> cb = NanNew(baton->callback);
// Fire callbacks.
if (!cb.IsEmpty() && cb->IsFunction()) {
......@@ -531,7 +531,7 @@ void Database::Work_AfterExec(uv_work_t* req) {
ExecBaton* baton = static_cast<ExecBaton*>(req->data);
Database* db = baton->db;
Local<Function> cb = NanPersistentToLocal(baton->callback);
Local<Function> cb = NanNew(baton->callback);
if (baton->status != SQLITE_OK) {
EXCEPTION(NanNew<String>(baton->message.c_str()), baton->status, exception);
......@@ -575,7 +575,7 @@ void Database::Work_Wait(Baton* baton) {
assert(baton->db->_handle);
assert(baton->db->pending == 0);
Local<Function> cb = NanPersistentToLocal(baton->callback);
Local<Function> cb = NanNew(baton->callback);
if (!cb.IsEmpty() && cb->IsFunction()) {
Local<Value> argv[] = { NanNew(NanNull()) };
TRY_CATCH_CALL(NanObjectWrapHandle(baton->db), cb, 1, argv);
......@@ -634,7 +634,7 @@ void Database::Work_AfterLoadExtension(uv_work_t* req) {
NanScope();
LoadExtensionBaton* baton = static_cast<LoadExtensionBaton*>(req->data);
Database* db = baton->db;
Local<Function> cb = NanPersistentToLocal(baton->callback);
Local<Function> cb = NanNew(baton->callback);
if (baton->status != SQLITE_OK) {
EXCEPTION(NanNew<String>(baton->message.c_str()), baton->status, exception);
......
......@@ -26,7 +26,7 @@ public:
static inline bool HasInstance(Handle<Value> val) {
if (!val->IsObject()) return false;
Local<Object> obj = val->ToObject();
return NanPersistentToLocal(constructor_template)->HasInstance(obj);
return NanNew(constructor_template)->HasInstance(obj);
}
struct Baton {
......
......@@ -65,7 +65,7 @@ template <class T> void Statement::Error(T* baton) {
assert(stmt->status != 0);
EXCEPTION(NanNew<String>(stmt->message.c_str()), stmt->status, exception);
Local<Function> cb = NanPersistentToLocal(baton->callback);
Local<Function> cb = NanNew(baton->callback);
if (!cb.IsEmpty() && cb->IsFunction()) {
Local<Value> argv[] = { exception };
......@@ -154,7 +154,7 @@ void Statement::Work_AfterPrepare(uv_work_t* req) {
}
else {
stmt->prepared = true;
Local<Function> cb = NanPersistentToLocal(baton->callback);
Local<Function> cb = NanNew(baton->callback);
if (!cb.IsEmpty() && cb->IsFunction()) {
Local<Value> argv[] = { NanNew(NanNull()) };
TRY_CATCH_CALL(NanObjectWrapHandle(stmt), cb, 1, argv);
......@@ -338,7 +338,7 @@ void Statement::Work_AfterBind(uv_work_t* req) {
}
else {
// Fire callbacks.
Local<Function> cb = NanPersistentToLocal(baton->callback);
Local<Function> cb = NanNew(baton->callback);
if (!cb.IsEmpty() && cb->IsFunction()) {
Local<Value> argv[] = { NanNew(NanNull()) };
TRY_CATCH_CALL(NanObjectWrapHandle(stmt), cb, 1, argv);
......@@ -401,7 +401,7 @@ void Statement::Work_AfterGet(uv_work_t* req) {
}
else {
// Fire callbacks.
Local<Function> cb = NanPersistentToLocal(baton->callback);
Local<Function> cb = NanNew(baton->callback);
if (!cb.IsEmpty() && cb->IsFunction()) {
if (stmt->status == SQLITE_ROW) {
// Create the result array from the data we acquired.
......@@ -471,7 +471,7 @@ void Statement::Work_AfterRun(uv_work_t* req) {
}
else {
// Fire callbacks.
Local<Function> cb = NanPersistentToLocal(baton->callback);
Local<Function> cb = NanNew(baton->callback);
if (!cb.IsEmpty() && cb->IsFunction()) {
NanObjectWrapHandle(stmt)->Set(NanSymbol("lastID"), NanNew<Integer>(baton->inserted_id));
NanObjectWrapHandle(stmt)->Set(NanSymbol("changes"), NanNew<Integer>(baton->changes));
......@@ -537,7 +537,7 @@ void Statement::Work_AfterAll(uv_work_t* req) {
}
else {
// Fire callbacks.
Local<Function> cb = NanPersistentToLocal(baton->callback);
Local<Function> cb = NanNew(baton->callback);
if (!cb.IsEmpty() && cb->IsFunction()) {
if (baton->rows.size()) {
// Create the result array from the data we acquired.
......@@ -664,7 +664,7 @@ void Statement::AsyncEach(uv_async_t* handle, int status) {
break;
}
Local<Function> cb = NanPersistentToLocal(async->item_cb);
Local<Function> cb = NanNew(async->item_cb);
if (!cb.IsEmpty() && cb->IsFunction()) {
Local<Value> argv[2];
argv[0] = NanNew(NanNull());
......@@ -680,7 +680,7 @@ void Statement::AsyncEach(uv_async_t* handle, int status) {
}
}
Local<Function> cb = NanPersistentToLocal(async->completed_cb);
Local<Function> cb = NanNew(async->completed_cb);
if (async->completed) {
if (!cb.IsEmpty() &&
cb->IsFunction()) {
......@@ -733,7 +733,7 @@ void Statement::Work_AfterReset(uv_work_t* req) {
STATEMENT_INIT(Baton);
// Fire callbacks.
Local<Function> cb = NanPersistentToLocal(baton->callback);
Local<Function> cb = NanNew(baton->callback);
if (!cb.IsEmpty() && cb->IsFunction()) {
Local<Value> argv[] = { NanNew(NanNull()) };
TRY_CATCH_CALL(NanObjectWrapHandle(stmt), cb, 1, argv);
......@@ -825,7 +825,7 @@ void Statement::Finalize(Baton* baton) {
baton->stmt->Finalize();
// Fire callback in case there was one.
Local<Function> cb = NanPersistentToLocal(baton->callback);
Local<Function> cb = NanNew(baton->callback);
if (!cb.IsEmpty() && cb->IsFunction()) {
TRY_CATCH_CALL(NanObjectWrapHandle(baton->stmt), cb, 0, NULL);
}
......@@ -857,7 +857,7 @@ void Statement::CleanQueue() {
Call* call = queue.front();
queue.pop();
Local<Function> cb = NanPersistentToLocal(call->baton->callback);
Local<Function> cb = NanNew(call->baton->callback);
if (prepared && !cb.IsEmpty() &&
cb->IsFunction()) {
......
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