diff --git a/lib/client.js b/lib/client.js index 1a9c447f..7c865a62 100644 --- a/lib/client.js +++ b/lib/client.js @@ -110,11 +110,11 @@ p.connect = function() { if(!self.activeQuery) { self.emit('error', error); } else { - self.activeQuery.handleError(error); //need to sync after error during a prepared statement if(self.activeQuery.isPreparedStatement) { con.sync(); } + self.activeQuery.handleError(error); self.activeQuery = null; } }); @@ -138,17 +138,16 @@ p.pulseQueryQueue = function() { p.query = function(config, values, callback) { //can take in strings or config objects config = (config.text || config.name) ? config : { text: config }; + if(values) { if(typeof values === 'function') { callback = values; - } - else { + } else { config.values = values; } } - if(callback) { - config.callback = callback; - } + + config.callback = callback; var query = new Query(config); this.queryQueue.push(query);