mirror of
https://github.com/brianc/node-postgres.git
synced 2025-12-08 20:16:25 +00:00
removing working but untested code
This commit is contained in:
parent
02f23647a2
commit
80ed3e7ffe
40
lib/index.js
40
lib/index.js
@ -49,46 +49,6 @@ Client.prototype.connect = function() {
|
||||
});
|
||||
});
|
||||
this.con = con;
|
||||
this.on('ReadyForQuery', function() {
|
||||
self.readyForQuery = true;
|
||||
self.pulseQueryQueue();
|
||||
});
|
||||
this.on('message', function(msg) {
|
||||
console.log(msg.name);
|
||||
});
|
||||
};
|
||||
|
||||
Client.prototype.query = function(queryText) {
|
||||
this.queryQueue.push(new Query({
|
||||
text: queryText
|
||||
}));
|
||||
this.pulseQueryQueue();
|
||||
};
|
||||
|
||||
Client.prototype.pulseQueryQueue = function() {
|
||||
if(!this.readyForQuery) {
|
||||
return;
|
||||
}
|
||||
var query = this.queryQueue.shift();
|
||||
if(!query) {
|
||||
return;
|
||||
}
|
||||
var txt = query.text + "\0"
|
||||
var queryTextBuffer = Buffer(txt);
|
||||
var len = queryTextBuffer.length+4;
|
||||
var messageBuffer = Buffer(queryTextBuffer.length + 5);
|
||||
messageBuffer[0] = UTF8.Q;
|
||||
messageBuffer[1] = len >>> 24;
|
||||
messageBuffer[2] = len >>> 16;
|
||||
messageBuffer[3] = len >>> 8;
|
||||
messageBuffer[4] = len >>> 0;
|
||||
messageBuffer.write(txt,5);
|
||||
this.con.write(messageBuffer);
|
||||
this.readyForQuery = false;
|
||||
};
|
||||
|
||||
var Query = function(config) {
|
||||
this.text = config.text;
|
||||
};
|
||||
|
||||
var Parser = function(buffer) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user