Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix to error event in async calls

  • Loading branch information...
commit 445ff92ed1bd8c6bf44908353bde06dc5f9e4d0f 1 parent afee1d2
@xdenser authored
Showing with 6 additions and 4 deletions.
  1. +4 −2 firebird.js
  2. +2 −2 src/fb-bindings-connection.cc
View
6 firebird.js
@@ -45,22 +45,24 @@ var superConnect = Connection.prototype.connect;
Connection.prototype.connect = function(db,user,pass,role,cb){
var obj = this;
superConnect.call(this,db,user,pass,role,function (err){
- if(err) obj.emit('error',err);
+ if(err && (!cb || obj.listeners('error').length)) obj.emit('error',err);
else obj.emit('connected');
if(cb) cb(err);
});
};
+
var superQuery = Connection.prototype.query;
Connection.prototype.query = function(sql,cb){
var obj = this;
superQuery.call(this,sql,function(err,res){
- if(err) obj.emit('error',err);
+ if(err && (!cb || obj.listeners('error').length)) obj.emit('error',err);
else obj.emit('result',res);
if(cb) cb(err,res);
});
};
+
binding.FBblob.prototype._readAll = function(initialSize, chunkSize, callback){
if(initialSize instanceof Function)
{
View
4 src/fb-bindings-connection.cc
@@ -789,7 +789,7 @@ Handle<Value>
void Connection::EIO_After_Query(uv_work_t *req)
{
- uv_unref(uv_default_loop());
+ // uv_unref(uv_default_loop());
HandleScope scope;
struct query_request *q_req = (struct query_request *)(req->data);
delete req;
@@ -874,7 +874,7 @@ Handle<Value>
uv_queue_work(uv_default_loop(), req, EIO_Query, EIO_After_Query);
- uv_ref(uv_default_loop());
+ //uv_ref(uv_default_loop());
conn->Ref();
return Undefined();
Please sign in to comment.
Something went wrong with that request. Please try again.