Makes encoding an optional parameter

This commit is contained in:
Dave 2013-06-06 12:06:52 -07:00
parent bbf945968e
commit d69070529c
2 changed files with 7 additions and 2 deletions

View File

@ -38,6 +38,7 @@ var ConnectionParameters = function(config) {
this.password = val('password', config);
this.binary = val('binary', config);
this.ssl = config.ssl || defaults.ssl;
this.client_encoding = config.encoding || defaults.encoding;
//a domain socket begins with '/'
this.isDomainSocket = (!(this.host||'').indexOf('/'));
};
@ -61,7 +62,9 @@ ConnectionParameters.prototype.getLibpqConnectionString = function(cb) {
params.push("host=" + this.host);
return cb(null, params.join(' '));
}
params.push("client_encoding='utf-8'");
if(this.client_encoding) {
params.push(this.client_encoding);
}
dns.lookup(this.host, function(err, address) {
if(err) return cb(err, null);
params.push("hostaddr=" + address);

View File

@ -31,5 +31,7 @@ module.exports = {
reapIntervalMillis: 1000,
//pool log function / boolean
poolLog: false
poolLog: false,
encoding: ""
};