diff --git a/lib/result.js b/lib/result.js index 1648b082..68820933 100644 --- a/lib/result.js +++ b/lib/result.js @@ -10,26 +10,27 @@ var Result = function() { var p = Result.prototype; -var matchRegexp = /([A-Za-z]+) (\d+ )?(\d+)?/ +var matchRegexp = /([A-Za-z]+) (\d+ )?(\d+)?/; //adds a command complete message p.addCommandComplete = function(msg) { + var match; if(msg.text) { //pure javascript - var match = matchRegexp.exec(msg.text); + match = matchRegexp.exec(msg.text); } else { //native bindings - var match = matchRegexp.exec(msg.command); + match = matchRegexp.exec(msg.command); } if(match) { this.command = match[1]; //match 3 will only be existing on insert commands if(match[3]) { //msg.value is from native bindings - this.rowCount = parseInt(match[3] || msg.value); - this.oid = parseInt(match[2]); + this.rowCount = parseInt(match[3] || msg.value, 10); + this.oid = parseInt(match[2], 10); } else { - this.rowCount = parseInt(match[2]); + this.rowCount = parseInt(match[2], 10); } } };