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
This commit is contained in:
Alexander Sulfrian 2011-11-21 11:23:26 +01:00
parent aff94b0068
commit e9838cc5bb
2 changed files with 6 additions and 4 deletions

View File

@ -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) {

View File

@ -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');
});