From e9838cc5bbf689a8042fa1f92b6c12b0fd97a3d3 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Mon, 21 Nov 2011 11:23:26 +0100 Subject: [PATCH] fix textParsers some textParsers requires the input value to be a string, so convert it before calling the textParsers the same problem exists in test/integration/connection/query-test so that there also need to be a String call --- lib/types.js | 6 ++++-- test/integration/connection/query-tests.js | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/types.js b/lib/types.js index c3fd8a48..c2bbc110 100644 --- a/lib/types.js +++ b/lib/types.js @@ -8,7 +8,7 @@ var typeParsers = { //the empty parse function var noParse = function(val) { - return val; + return String(val); } //returns a function used to convert a specific type (specified by @@ -21,7 +21,9 @@ var getTypeParser = function(oid, format) { }; textParsers.init(function(oid, converter) { - typeParsers.text[oid] = converter; + typeParsers.text[oid] = function(value) { + return converter(String(value)); + }; }); binaryParsers.init(function(oid, converter) { diff --git a/test/integration/connection/query-tests.js b/test/integration/connection/query-tests.js index 79e0e13a..f308546d 100644 --- a/test/integration/connection/query-tests.js +++ b/test/integration/connection/query-tests.js @@ -20,6 +20,6 @@ test('simple query', function() { process.on('exit', function() { assert.equal(rows.length, 2); assert.equal(rows[0].length, 1); - assert.strictEqual(rows[0] [0], '1'); - assert.strictEqual(rows[1] [0], '2'); + assert.strictEqual(String(rows[0] [0]), '1'); + assert.strictEqual(String(rows[1] [0]), '2'); });