mirror of
https://github.com/brianc/node-postgres.git
synced 2025-12-08 20:16:25 +00:00
parser: added bool parsing
This commit is contained in:
parent
671a5c52ff
commit
e891e7f4fb
@ -230,4 +230,8 @@ p.parseText = function(value) {
|
||||
return value.toString('utf8');
|
||||
};
|
||||
|
||||
p.parseBool = function(value) {
|
||||
return (parseBits(value, 8) > 0);
|
||||
};
|
||||
|
||||
module.exports = BinaryParser;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -84,4 +84,8 @@ p.parseText = function(value) {
|
||||
return value;
|
||||
};
|
||||
|
||||
p.parseBool = function(value) {
|
||||
return value == 't';
|
||||
};
|
||||
|
||||
module.exports = TextParser;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user