Skip to content

Commit f8962fd

Browse files
committed
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
1 parent 5d8c8bb commit f8962fd

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lib/client.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ var Client = function(config) {
2020
this.connection = config.connection || new Connection({stream: config.stream});
2121
this.queryQueue = [];
2222
this.password = config.password || defaults.password;
23+
this.binary = config.binary || defaults.binary;
2324
this.encoding = 'utf8';
2425
this.processID = null;
2526
this.secretKey = null;
@@ -173,6 +174,9 @@ p._pulseQueryQueue = function() {
173174
p.query = function(config, values, callback) {
174175
//can take in strings or config objects
175176
config = (typeof(config) == 'string') ? { text: config } : config;
177+
if (this.binary && !('binary' in config)) {
178+
config.binary = true;
179+
}
176180

177181
if(values) {
178182
if(typeof values === 'function') {

lib/defaults.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,7 @@ module.exports = {
1414
//0 will disable connection pooling
1515
poolSize: 10,
1616
//duration of node-pool timeout
17-
poolIdleTimeout: 30000
17+
poolIdleTimeout: 30000,
18+
// binary result mode
19+
binary: false
1820
}

0 commit comments

Comments
 (0)