mirror of
https://github.com/brianc/node-postgres.git
synced 2026-01-18 15:55:05 +00:00
support for 'emptyQuery' command
This commit is contained in:
parent
adcadd5810
commit
cafded964e
@ -198,7 +198,8 @@ var messageNames = {
|
||||
1: 'parseComplete',
|
||||
2: 'bindComplete',
|
||||
A: 'notification',
|
||||
n: 'noData'
|
||||
n: 'noData',
|
||||
I: 'emptyQuery'
|
||||
};
|
||||
|
||||
p.parseMessage = function() {
|
||||
@ -334,15 +335,18 @@ p.parseE = function(msg) {
|
||||
//same thing, different name
|
||||
p.parseN = p.parseE;
|
||||
|
||||
//some messages are only a header portion and
|
||||
//require no more parsing
|
||||
var noParse = function(msg) { return msg; };
|
||||
|
||||
//parses parseComplete
|
||||
p.parse1 = function(msg) {
|
||||
return msg;
|
||||
};
|
||||
p.parse1 = noParse;
|
||||
|
||||
//parses bindComplete
|
||||
p.parse2 = function(msg) {
|
||||
return msg;
|
||||
};
|
||||
p.parse2 = noParse;
|
||||
|
||||
//parse emptyQuery
|
||||
p.parseI = noParse;
|
||||
|
||||
p.parseA = function(msg) {
|
||||
msg.processId = this.parseInt32();
|
||||
|
||||
8
test/integration/client/empty-query-tests.js
Normal file
8
test/integration/client/empty-query-tests.js
Normal file
@ -0,0 +1,8 @@
|
||||
var helper = require(__dirname+'/test-helper');
|
||||
var client = helper.client();
|
||||
|
||||
test("empty query message handling", function() {
|
||||
client.query("");
|
||||
assert.raises(client.connection, 'emptyQuery');
|
||||
client.on('drain', client.end.bind(client));
|
||||
});
|
||||
@ -113,4 +113,8 @@ buffers.notification = function(id, channel, payload) {
|
||||
.join(true, 'A')
|
||||
};
|
||||
|
||||
buffers.emptyQuery = function() {
|
||||
return new BufferList().join(true, 'I');
|
||||
};
|
||||
|
||||
module.exports = buffers;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user