diff --git a/test/integration/connection/bound-command-tests.js b/test/integration/connection/bound-command-tests.js index 87ce514..ac9d348 100644 --- a/test/integration/connection/bound-command-tests.js +++ b/test/integration/connection/bound-command-tests.js @@ -2,6 +2,9 @@ var helper = require(__dirname + '/test-helper'); http://developer.postgresql.org/pgdocs/postgres/protocol-flow.html#PROTOCOL-FLOW-EXT-QUERY helper.connect(function(con) { + con.on('message', function(msg) { + console.log(msg.name); + }); con.parse({ text: 'select * from ids' @@ -9,26 +12,24 @@ helper.connect(function(con) { con.flush(); con.once('parseComplete', function() { - console.log('parseComplete'); con.bind(); con.flush(); }); con.once('bindComplete', function() { - console.log('bindComplete'); con.execute(); con.flush(); }); - con.on('dataRow', function(msg) { - sys.debug("got row from pepared query"); + con.once('dataRow', function(msg) { + console.log("row: " + sys.inspect(msg)); }); - con.on('commandComplete', function() { + con.once('commandComplete', function() { con.sync(); }); - con.on('readyForQuery', function() { + con.once('readyForQuery', function() { con.end(); }); diff --git a/test/integration/connection/test-helper.js b/test/integration/connection/test-helper.js index ae86a0e..c80514d 100644 --- a/test/integration/connection/test-helper.js +++ b/test/integration/connection/test-helper.js @@ -22,14 +22,13 @@ var connect = function(callback) { authConnect(function(con) { con.once('readyForQuery', function() { con.query('create temp table ids(id integer)'); + con.once('readyForQuery', function() { + con.query('insert into ids(id) values(1); insert into ids(id) values(2);'); + con.once('readyForQuery', function() { + callback(con); + }); + }); }); - con.once('readyForQuery', function() { - con.query('insert into ids(id) values(1); insert into ids(id) values(2);'); - }); - con.once('readyForQuery', function() { - callback(con); - }); - }); };