Comparing version 0.6.4 to 0.6.5
@@ -6,3 +6,3 @@ //binary data writer tuned for creating | ||
this.size = size || 1024; | ||
this.buffer = new Buffer(this.size + 5); | ||
this.buffer = Buffer(this.size + 5); | ||
this.offset = 5; | ||
@@ -40,2 +40,14 @@ this.headerPosition = 0; | ||
//for versions of node requiring 'length' as 3rd argument to buffer.write | ||
var writeString = function(buffer, string, offset, len) { | ||
buffer.write(string, offset, len); | ||
} | ||
//overwrite function for older versions of node | ||
if(Buffer.prototype.write.length === 3) { | ||
writeString = function(buffer, string, offset, len) { | ||
buffer.write(string, offset); | ||
} | ||
} | ||
p.addCString = function(string) { | ||
@@ -48,3 +60,3 @@ //just write a 0 for empty or null strings | ||
this._ensure(len + 1); //+1 for null terminator | ||
this.buffer.write(string, this.offset, len); | ||
writeString(this.buffer, string, this.offset, len); | ||
this.offset += len; | ||
@@ -59,3 +71,3 @@ } | ||
this._ensure(1); | ||
this.buffer.write(char, this.offset, 1); | ||
writeString(this.buffer, char, this.offset, 1); | ||
this.offset++; | ||
@@ -62,0 +74,0 @@ return this; |
{ "name": "pg", | ||
"version": "0.6.4", | ||
"version": "0.6.5", | ||
"description": "PostgreSQL client - pure javascript & libpq with the same API", | ||
@@ -4,0 +4,0 @@ "keywords" : ["postgres", "pg", "libpq", "postgre", "database", "rdbms"], |
198541
5282