parsing a single row description

This commit is contained in:
brianc 2010-09-30 22:48:50 -05:00
parent df88e11a14
commit 012d2a13f5
2 changed files with 5 additions and 5 deletions

View File

@ -191,12 +191,12 @@ p.parseT = function() {
msg.fieldCount = this.readInt16();
msg.fields = [];
for(var i = 0; i < msg.fieldCount; i++){
msg.fields[i] = this.parseRow();
msg.fields[i] = this.parseField();
}
return msg;
};
p.parseRow = function() {
p.parseField = function() {
var row = {
name: this.parseCString(),
tableID: this.readInt32(),

View File

@ -97,6 +97,7 @@ test('Parser on single messages', function() {
assert.equal(result.fields.length, 0);
});
var oneRowDescBuff = new BufferList()
.addInt16(1)
.addCString('id') //field name
@ -105,15 +106,14 @@ test('Parser on single messages', function() {
.addInt32(3) //objectId of field's data type
.addInt16(4) //datatype size
.addInt32(5) //type modifier
.addInt32(0) //format code, 0 => text
.addInt16(0) //format code, 0 => text
.join(true,'T');
console.log(oneRowDescBuff);
test('parses single row description',function() {
var result = new Parser(oneRowDescBuff).parse()[0];
assert.same(result, {
name: 'RowDescription',
id: 'T',
length: 29,
length: 27,
fieldCount: 1
});
});