mirror of
https://github.com/brianc/node-postgres.git
synced 2025-12-08 20:16:25 +00:00
beginnings of actually TDDd query
This commit is contained in:
parent
891aacce54
commit
0df4f6037c
12
lib/index.js
12
lib/index.js
@ -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;
|
||||
|
||||
@ -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) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user