parser: added bool parsing

This commit is contained in:
Alexander Sulfrian 2011-06-16 18:32:20 +02:00
parent 671a5c52ff
commit e891e7f4fb
3 changed files with 11 additions and 0 deletions

View File

@ -230,4 +230,8 @@ p.parseText = function(value) {
return value.toString('utf8');
};
p.parseBool = function(value) {
return (parseBits(value, 8) > 0);
};
module.exports = BinaryParser;

View File

@ -53,6 +53,9 @@ p.handleRowDescription = function(msg) {
var format = field.format;
this._fieldNames[i] = field.name;
switch(dataTypeId) {
case 16:
this._fieldConverters[i] = parsers[format].parseBool;
break;
case 20:
this._fieldConverters[i] = parsers[format].parseInt64;
break;

View File

@ -84,4 +84,8 @@ p.parseText = function(value) {
return value;
};
p.parseBool = function(value) {
return value == 't';
};
module.exports = TextParser;