Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: brianc/node-postgres
base: 400d410ad5
...
head fork: brianc/node-postgres
compare: 66b569c3fc
Checking mergeability… Don't worry, you can still create the pull request.
  • 4 commits
  • 1 file changed
  • 0 commit comments
  • 2 contributors
Showing with 26 additions and 3 deletions.
  1. +26 −3 lib/textParsers.js
View
29 lib/textParsers.js
@@ -119,9 +119,32 @@ var parseInterval = function(val) {
};
var parseByteA = function(val) {
- return new Buffer(val.replace(/\\([0-7]{3})/g, function (full_match, code) {
- return String.fromCharCode(parseInt(code, 8));
- }).replace(/\\\\/g, "\\"), "binary");
+ if(/^\\x/.test(val)){
+ // new 'hex' style response (pg >9.0)
+ return new Buffer(val.substr(2), 'hex');
+ }else{
+ out = ""
+ i = 0
+ while(i < val.length){
+ if(val[i] != "\\"){
+ out += val[i]
+ ++i
+ }else{
+ if(val.substr(i+1,3).match(/[0-7]{3}/)){
+ out += String.fromCharCode(parseInt(val.substr(i+1,3),8))
+ i += 4
+ }else{
+ backslashes = 1
+ while(i+backslashes < val.length && val[i+backslashes] == "\\")
+ backslashes++
+ for(k=0; k<Math.floor(backslashes/2); ++k)
+ out += "\\"
+ i += Math.floor(backslashes / 2) * 2
+ }
+ }
+ }
+ return new Buffer(out,"binary");
+ }
}
var maxLen = Number.MAX_VALUE.toString().length

No commit comments for this range

Something went wrong with that request. Please try again.