added support for describe command

This commit is contained in:
brianc 2010-10-28 00:27:08 -05:00
parent 239a12fa1c
commit c848a5ad92
2 changed files with 13 additions and 0 deletions

View File

@ -109,6 +109,7 @@ p.parse = function(query) {
for(var i = 0; i < len; i++) {
buffer.addInt32(query.types[i]);
}
this.send('P', buffer.join());
return this;
@ -163,6 +164,10 @@ p.end = function() {
this.send('X', Buffer(0));
};
p.describe = function(msg) {
this.send('D',Buffer(msg.type+msg.name+'\0'));
};
//parsing methods
p.setBuffer = function(buffer) {
if(this.lastBuffer) { //we have unfinished biznaz

View File

@ -155,3 +155,11 @@ test('sends end command', function() {
var expected = new Buffer([0x58, 0, 0, 0, 4]);
assert.recieved(stream, expected);
});
test('sends describe command',function() {
test('describe statement', function() {
con.describe({type: 's', name: 'bang'});
var expected = new BufferList().addChar('s').addCString('bang').join(true, 'D')
assert.recieved(stream, expected);
});
});