renamed methods

This commit is contained in:
brianc 2010-10-13 22:38:26 -05:00
parent 39897a16c7
commit deb8aeb319

View File

@ -1,5 +1,5 @@
var Parser = function(buffer) {
};
var p = Parser.prototype;
@ -11,6 +11,7 @@ p.setBuffer = function(buffer) {
p.parseMessage = function() {
if(this.buffer.length == this.offset) {
//clean packet - nothing left for next buffer
return false;
}
var messageID = this.buffer[this.offset];
@ -43,8 +44,8 @@ p.parse83 = function(buffer) {
//parse 'K' message
p.parse75 = function() {
var msg = this.parseStart('backendKeyData');
msg.processID = this.readInt32();
msg.secretKey = this.readInt32();
msg.processID = this.parseInt32();
msg.secretKey = this.parseInt32();
return msg;
};
@ -60,7 +61,7 @@ p.parseStart = function(name) {
return {
name: name,
id: this.readChar(),
length: this.readInt32()
length: this.parseInt32()
}
};
@ -78,7 +79,7 @@ p.parse90 = function() {
//parse 'T' message
p.parse84 = function() {
var msg = this.parseStart('rowDescription');
msg.fieldCount = this.readInt16();
msg.fieldCount = this.parseInt16();
var fields = [];
for(var i = 0; i < msg.fieldCount; i++){
fields[i] = this.parseField();
@ -90,12 +91,12 @@ p.parse84 = function() {
p.parseField = function() {
var row = {
name: this.parseCString(),
tableID: this.readInt32(),
columnID: this.readInt16(),
dataType: this.readInt32(),
dataTypeSize: this.readInt16(),
dataTypeModifier: this.readInt32(),
format: this.readInt16() == 0 ? 'text' : 'binary'
tableID: this.parseInt32(),
columnID: this.parseInt16(),
dataType: this.parseInt32(),
dataTypeSize: this.parseInt16(),
dataTypeModifier: this.parseInt32(),
format: this.parseInt16() == 0 ? 'text' : 'binary'
};
return row;
};
@ -103,10 +104,10 @@ p.parseField = function() {
//parse 'D' message
p.parse68 = function() {
var msg = this.parseStart('dataRow');
var fieldCount = this.readInt16();
var fieldCount = this.parseInt16();
var fields = [];
for(var i = 0; i < fieldCount; i++) {
var length = this.readInt32();
var length = this.parseInt32();
fields[i] = (length == -1 ? null : this.readString(length))
};
msg.fieldCount = fieldCount;
@ -139,7 +140,7 @@ p.parse69 = function() {
};
p.readInt32 = function() {
p.parseInt32 = function() {
var buffer = this.buffer;
return ((buffer[this.offset++] << 24) +
(buffer[this.offset++] << 16) +
@ -147,12 +148,12 @@ p.readInt32 = function() {
buffer[this.offset++]);
};
p.readInt16 = function() {
p.parseInt16 = function() {
return ((this.buffer[this.offset++] << 8) + (this.buffer[this.offset++] << 0));
};
p.parseLength = function() {
return this.readInt32();
return this.parseInt32();
};
p.readString = function(length) {