Skip to content

Commit e690481

Browse files
committed
Remove parsing datatypes; result.cmdStatus added
Remove parsing datatypes in order to keep all the values as strings. This is not compatible commit with an upstream version of driver. cmdStatus shows the state of the command returned by Postgers. It's useful to detect what type of command was executed (SELECT vs INSERT etc)
1 parent e087305 commit e690481

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

lib/result.js

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,21 @@ var Result = function (rowMode) {
2222
this._parsers = []
2323
this.RowCtor = null
2424
this.rowAsArray = rowMode === 'array'
25+
this.cmdStatus = null;
2526
if (this.rowAsArray) {
2627
this.parseRow = this._parseRowAsArray
2728
}
2829
}
2930

3031
var matchRegexp = /^([A-Za-z]+)(?: (\d+))?(?: (\d+))?/
3132

32-
// adds a command complete message
33-
Result.prototype.addCommandComplete = function (msg) {
34-
var match
35-
if (msg.text) {
36-
// pure javascript
37-
match = matchRegexp.exec(msg.text)
33+
//adds a command complete message
34+
Result.prototype.addCommandComplete = function(msg) {
35+
this.cmdStatus = msg.text;
36+
var match;
37+
if(msg.text) {
38+
//pure javascript
39+
match = matchRegexp.exec(msg.text);
3840
} else {
3941
// native bindings
4042
match = matchRegexp.exec(msg.command)
@@ -52,15 +54,11 @@ Result.prototype.addCommandComplete = function (msg) {
5254
}
5355
}
5456

55-
Result.prototype._parseRowAsArray = function (rowData) {
56-
var row = []
57-
for (var i = 0, len = rowData.length; i < len; i++) {
58-
var rawValue = rowData[i]
59-
if (rawValue !== null) {
60-
row.push(this._parsers[i](rawValue))
61-
} else {
62-
row.push(null)
63-
}
57+
Result.prototype._parseRowAsArray = function(rowData) {
58+
var row = [];
59+
for(var i = 0, len = rowData.length; i < len; i++) {
60+
var rawValue = rowData[i];
61+
row.push(rawValue);
6462
}
6563
return row
6664
}

0 commit comments

Comments
 (0)