beginnings of actually TDDd query

This commit is contained in:
brianc 2010-10-03 01:14:19 -05:00
parent 891aacce54
commit 0df4f6037c
2 changed files with 22 additions and 1 deletions

View File

@ -57,9 +57,19 @@ Client.prototype.disconnect = function() {
};
Client.prototype.query = function() {
return new Query();
};
var Query = function() {
EventEmitter.call(this);
var self = this;
process.nextTick(function() {
self.emit('end');
});
};
sys.inherits(Query, EventEmitter);
var Parser = function(buffer) {
this.offset = 0;
this.buffer = buffer;

View File

@ -23,6 +23,17 @@ client2.on('ReadyForQuery', function() {
client2.disconnect();
});
var client3 = makeClient();
client3.connect();
client3.on('ReadyForQuery', function() {
console.log('client3 ready for query');
var query = client3.query('create temporary table bang (id integer)');
query.on('end', function() {
client3.disconnect();
});
});
// client.query('create temporary table bang (id integer)');
// client.query('insert into bang(id) VALUES(1)');
// client.query('select * from bang',function(err, results, fields) {