connection can be binary by default

if connection is created with config.binary = true, all queries get
executed with binary result unless explicit disabled with binary = false
This commit is contained in:
Alexander Sulfrian 2011-11-21 11:45:55 +01:00
parent 5d8c8bbcdc
commit f8962fd036
2 changed files with 7 additions and 1 deletions

View File

@ -20,6 +20,7 @@ var Client = function(config) {
this.connection = config.connection || new Connection({stream: config.stream});
this.queryQueue = [];
this.password = config.password || defaults.password;
this.binary = config.binary || defaults.binary;
this.encoding = 'utf8';
this.processID = null;
this.secretKey = null;
@ -173,6 +174,9 @@ p._pulseQueryQueue = function() {
p.query = function(config, values, callback) {
//can take in strings or config objects
config = (typeof(config) == 'string') ? { text: config } : config;
if (this.binary && !('binary' in config)) {
config.binary = true;
}
if(values) {
if(typeof values === 'function') {

View File

@ -14,5 +14,7 @@ module.exports = {
//0 will disable connection pooling
poolSize: 10,
//duration of node-pool timeout
poolIdleTimeout: 30000
poolIdleTimeout: 30000,
// binary result mode
binary: false
}