mirror of
https://github.com/brianc/node-postgres.git
synced 2025-12-08 20:16:25 +00:00
binaryParser: added function to parse text fields
This commit is contained in:
parent
acdd726a29
commit
ba9b85fe26
@ -226,4 +226,12 @@ p.parseIntArray = p.parseStringArray = function(value) {
|
||||
return parse(dims, elementType);
|
||||
};
|
||||
|
||||
p.parseText = function(value) {
|
||||
var convertToChar = function(chr) {
|
||||
return String.fromCharCode(chr);
|
||||
};
|
||||
|
||||
return value.map(convertToChar).join('');
|
||||
};
|
||||
|
||||
module.exports = BinaryParser;
|
||||
|
||||
@ -62,6 +62,9 @@ p.handleRowDescription = function(msg) {
|
||||
case 23:
|
||||
this._fieldConverters[i] = parsers[format].parseInt32;
|
||||
break;
|
||||
case 25:
|
||||
this._fieldConverters[i] = parsers[format].parseText;
|
||||
break;
|
||||
case 26:
|
||||
this._fieldConverters[i] = parsers[format].parseInt64;
|
||||
break;
|
||||
|
||||
@ -80,4 +80,8 @@ p.parseStringArray = function(value) {
|
||||
});
|
||||
};
|
||||
|
||||
p.parseText = function(value) {
|
||||
return value;
|
||||
};
|
||||
|
||||
module.exports = TextParser;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user