Skip to content

Commit e9838cc

Browse files
committed
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
1 parent aff94b0 commit e9838cc

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

lib/types.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ var typeParsers = {
88

99
//the empty parse function
1010
var noParse = function(val) {
11-
return val;
11+
return String(val);
1212
}
1313

1414
//returns a function used to convert a specific type (specified by
@@ -21,7 +21,9 @@ var getTypeParser = function(oid, format) {
2121
};
2222

2323
textParsers.init(function(oid, converter) {
24-
typeParsers.text[oid] = converter;
24+
typeParsers.text[oid] = function(value) {
25+
return converter(String(value));
26+
};
2527
});
2628

2729
binaryParsers.init(function(oid, converter) {

test/integration/connection/query-tests.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ test('simple query', function() {
2020
process.on('exit', function() {
2121
assert.equal(rows.length, 2);
2222
assert.equal(rows[0].length, 1);
23-
assert.strictEqual(rows[0] [0], '1');
24-
assert.strictEqual(rows[1] [0], '2');
23+
assert.strictEqual(String(rows[0] [0]), '1');
24+
assert.strictEqual(String(rows[1] [0]), '2');
2525
});

0 commit comments

Comments
 (0)