Comparing version 0.6.2 to 0.6.3
@@ -66,2 +66,3 @@ //maps types from javascript to postgres and vise-versa | ||
if (!val) return null; | ||
if (val === '{}') return []; | ||
if (val[0] !== '{' || val[val.length-1] !== '}') | ||
@@ -68,0 +69,0 @@ throw "Not postgresql array! (" + arrStr + ")"; |
{ "name": "pg", | ||
"version": "0.6.2", | ||
"version": "0.6.3", | ||
"description": "PostgreSQL client - pure javascript & libpq with the same API", | ||
@@ -4,0 +4,0 @@ "keywords" : ["postgres", "pg", "libpq", "postgre", "database", "rdbms"], |
@@ -120,2 +120,3 @@ #node-postgres | ||
* [bdunavant](https://github.com/bdunavant) | ||
* [tokumine](https://github.com/tokumine) | ||
@@ -122,0 +123,0 @@ ## Documentation |
var helper = require(__dirname + '/test-helper'); | ||
var q = {}; | ||
q.dateParser = require(__dirname + "/../../../lib/types").getStringTypeParser(1114); | ||
q.stringArrayParser = require(__dirname + "/../../../lib/types").getStringTypeParser(1009); | ||
@@ -39,1 +40,30 @@ test("testing dateParser", function() { | ||
test("testing empty array", function(){ | ||
var input = '{}'; | ||
var expected = []; | ||
assert.deepEqual(q.stringArrayParser(input), expected); | ||
}); | ||
test("testing empty string array", function(){ | ||
var input = '{""}'; | ||
var expected = [""]; | ||
assert.deepEqual(q.stringArrayParser(input), expected); | ||
}); | ||
test("testing numeric array", function(){ | ||
var input = '{1,2,3,4}'; | ||
var expected = [1,2,3,4]; | ||
assert.deepEqual(q.stringArrayParser(input), expected); | ||
}); | ||
test("testing stringy array", function(){ | ||
var input = '{a,b,c,d}'; | ||
var expected = ['a','b','c','d']; | ||
assert.deepEqual(q.stringArrayParser(input), expected); | ||
}); | ||
test("testing NULL array", function(){ | ||
var input = '{NULL,NULL}'; | ||
var expected = [null,null]; | ||
assert.deepEqual(q.stringArrayParser(input), expected); | ||
}); |
198127
5273
165
134