connection tests w/ two clients

This commit is contained in:
brianc 2010-10-03 01:08:04 -05:00
parent 2acad1377c
commit 891aacce54
2 changed files with 23 additions and 6 deletions

View File

@ -56,6 +56,10 @@ Client.prototype.disconnect = function() {
this.con.write(terminationBuffer);
};
Client.prototype.query = function() {
};
var Parser = function(buffer) {
this.offset = 0;
this.buffer = buffer;

View File

@ -1,13 +1,26 @@
require(__dirname+"/test-helper");
var client = new Client({
user: 'brian',
database: 'pgjstest'
//little helper to make a
//fresh client to the test DB
var makeClient = function() {
return new Client({
user: 'brian',
database: 'pgjstest'
});
};
var client1 = makeClient();
client1.connect();
client1.on('ReadyForQuery', function() {
console.log('client1 ready for query');
client1.disconnect();
});
client.connect();
client.on('ReadyForQuery', function() {
client.disconnect();
var client2 = makeClient();
client2.connect();
client2.on('ReadyForQuery', function() {
console.log('client2 ready for query');
client2.disconnect();
});
// client.query('create temporary table bang (id integer)');