From 380abbf6a62e34510c25622d7b3e0f7d5a97c560 Mon Sep 17 00:00:00 2001 From: brianc Date: Sat, 23 Oct 2010 12:58:40 -0500 Subject: [PATCH] start working on parsing --- lib/client.js | 4 ++++ test/unit/prepared-query-tests.js | 27 +++++++++++++++++++++++++++ test/unit/test-buffers.js | 4 +++- 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/lib/client.js b/lib/client.js index a3819543..7e6baef8 100644 --- a/lib/client.js +++ b/lib/client.js @@ -109,6 +109,10 @@ p.query = function(text) { return this; }; +p.parse = function(text, types) { + +}; + p.pulseQueryQueue = function(ready) { if(!this.readyForQuery) { return; diff --git a/test/unit/prepared-query-tests.js b/test/unit/prepared-query-tests.js index de62c92e..195ccc93 100644 --- a/test/unit/prepared-query-tests.js +++ b/test/unit/prepared-query-tests.js @@ -1 +1,28 @@ require(__dirname+"/test-helper"); +//http://developer.postgresql.org/pgdocs/postgres/protocol-flow.html#PROTOCOL-FLOW-EXT-QUERY +var client = createClient(); +client.stream.emit('data', buffers.readyForQuery()); +//client sends parse message + +test('prepared queries', function() { + + test("parse messages", function() { + + test('parsing a query with no parameters', function() { + client.parse('!'); + assert.length(client.stream.packets, 1); + }); + + }); + + //server raises parse complete message + + test('sends bind message', function() { + return false; + }); + + test('recieves rows', function() { + return false; + }); + +}); diff --git a/test/unit/test-buffers.js b/test/unit/test-buffers.js index 8a35f4b4..f14674e1 100644 --- a/test/unit/test-buffers.js +++ b/test/unit/test-buffers.js @@ -77,6 +77,8 @@ buffers.error = function(fields) { return buf.join(true, 'E'); }; - +buffers.parseComplete = function() { + return new BufferList().join(true, '1'); +}; module.exports = buffers;