mirror of
https://github.com/brianc/node-postgres.git
synced 2025-12-08 20:16:25 +00:00
added support for describe command
This commit is contained in:
parent
239a12fa1c
commit
c848a5ad92
@ -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
|
||||
|
||||
@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user