Skip to content

Commit e891e7f

Browse files
committed
parser: added bool parsing
1 parent 671a5c5 commit e891e7f

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

lib/binaryParser.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,4 +230,8 @@ p.parseText = function(value) {
230230
return value.toString('utf8');
231231
};
232232

233+
p.parseBool = function(value) {
234+
return (parseBits(value, 8) > 0);
235+
};
236+
233237
module.exports = BinaryParser;

lib/query.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ p.handleRowDescription = function(msg) {
5353
var format = field.format;
5454
this._fieldNames[i] = field.name;
5555
switch(dataTypeId) {
56+
case 16:
57+
this._fieldConverters[i] = parsers[format].parseBool;
58+
break;
5659
case 20:
5760
this._fieldConverters[i] = parsers[format].parseInt64;
5861
break;

lib/textParser.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,8 @@ p.parseText = function(value) {
8484
return value;
8585
};
8686

87+
p.parseBool = function(value) {
88+
return value == 't';
89+
};
90+
8791
module.exports = TextParser;

0 commit comments

Comments
 (0)