Comparing version 0.5.1 to 0.5.2
@@ -125,2 +125,8 @@ //maps types from javascript to postgres and vise-versa | ||
var parseByteA = function(val) { | ||
return new Buffer(val.replace(/\\([0-7]{3})/g, function (full_match, code) { | ||
return String.fromCharCode(parseInt(code, 8)); | ||
}).replace(/\\\\/g, "\\"), "binary"); | ||
} | ||
//default string type parser registrations | ||
@@ -140,2 +146,3 @@ registerStringTypeParser(20, parseInt); | ||
registerStringTypeParser(1186, parseInterval); | ||
registerStringTypeParser(17, parseByteA); | ||
@@ -142,0 +149,0 @@ module.exports = { |
{ "name": "pg", | ||
"version": "0.5.1", | ||
"version": "0.5.2", | ||
"description": "PostgreSQL client - pure javascript & libpq with the same API", | ||
@@ -4,0 +4,0 @@ "keywords" : ["postgres", "pg", "libpq", "postgre", "database", "rdbms"], |
@@ -112,2 +112,3 @@ #node-postgres | ||
* [napa3um](https://github.com/napa3um) | ||
* [drdaeman](https://github.com/drdaeman) | ||
@@ -114,0 +115,0 @@ ## Documentation |
@@ -35,2 +35,4 @@ var sys = require('sys'); | ||
var con = new pg.Client({ | ||
host: args.host, | ||
port: args.port, | ||
user: args.user, | ||
@@ -37,0 +39,0 @@ password: args.password, |
@@ -12,3 +12,3 @@ var net = require('net'); | ||
}); | ||
con.connect('5432','localhost'); | ||
con.connect(helper.args.port || '5432', helper.args.host || 'localhost'); | ||
con.once('connect', function() { | ||
@@ -15,0 +15,0 @@ con.startup({ |
@@ -1,2 +0,2 @@ | ||
require(__dirname+'/../test-helper'); | ||
var helper = require(__dirname+'/../test-helper'); | ||
var Connection = require('connection'); | ||
@@ -12,3 +12,3 @@ var makeClient = function() { | ||
var client = new Client({connection: connection}); | ||
client.connect(); | ||
client.connect(helper.args.port, helper.args.host); | ||
client.connection.emit('connect'); | ||
@@ -15,0 +15,0 @@ return client; |
@@ -122,2 +122,16 @@ var helper = require(__dirname + '/test-helper'); | ||
} | ||
},{ | ||
name: 'bytea', | ||
dataTypeID: 17, | ||
actual: 'foo\\000\\200\\\\\\377', | ||
expected: function(val) { | ||
assert.deepEqual(val, new Buffer([102, 111, 111, 0, 128, 92, 255])); | ||
} | ||
},{ | ||
name: 'empty bytea', | ||
dataTypeID: 17, | ||
actual: '', | ||
expected: function(val) { | ||
assert.deepEqual(val, new Buffer(0)); | ||
} | ||
}]; | ||
@@ -124,0 +138,0 @@ |
@@ -26,1 +26,3 @@ var helper = require(__dirname+'/../test-helper'); | ||
}; | ||
module.exports = helper; |
190674
5062
155