code cleanup

This commit is contained in:
brianc 2010-10-01 00:27:42 -05:00
parent 961f3f1984
commit d2c22afc36

View File

@ -1,18 +1,14 @@
var EventEmitter = require('events').EventEmitter;
var sys = require('sys');
var net = require('net');
var NUL = '\0';
var chars = Buffer('RSKZQCTD','utf8');
var UTF8 = {
R: chars[0],
S: chars[1],
K: chars[2],
Z: chars[3],
Q: chars[4],
C: chars[5],
T: chars[6],
D: chars[7]
var NUL = '\0';
var chars = ['R','S','K','Z','Q','C','T','D'];
var charBuff = Buffer(chars.join(''),'utf8');
var UTF8 = {};
for(var i = 0; i < charBuff.length; i++){
var char = chars[i];
UTF8[char] = charBuff[i];
};
@ -24,6 +20,7 @@ var Client = function(config) {
this.port = config.port || 5432;
this.queryQueue = [];
};
sys.inherits(Client, EventEmitter);
Client.prototype.connect = function() {
@ -111,6 +108,7 @@ p.parse = function() {
}
return messages;
};
p.parseMessage = function() {
if(this.buffer.length == this.offset) {
return false;