From c848a5ad928f877aab22b7aa3eef8b549cf6bbfb Mon Sep 17 00:00:00 2001 From: brianc Date: Thu, 28 Oct 2010 00:27:08 -0500 Subject: [PATCH] added support for describe command --- lib/connection.js | 5 +++++ test/unit/connection/outbound-sending-tests.js | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/lib/connection.js b/lib/connection.js index d501d4f6..9a17f166 100644 --- a/lib/connection.js +++ b/lib/connection.js @@ -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 diff --git a/test/unit/connection/outbound-sending-tests.js b/test/unit/connection/outbound-sending-tests.js index baa030c2..1bb77ec9 100644 --- a/test/unit/connection/outbound-sending-tests.js +++ b/test/unit/connection/outbound-sending-tests.js @@ -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); + }); +});