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); + }); +});