Comparing version 2.6.2 to 2.7.0
@@ -212,7 +212,16 @@ var net = require('net'); | ||
var len = values.length; | ||
var useBinary = false; | ||
for (var j = 0; j < len; j++) | ||
useBinary |= values[j] instanceof Buffer; | ||
var buffer = this.writer | ||
.addCString(config.portal) | ||
.addCString(config.statement) | ||
.addInt16(0) //always use default text format | ||
.addInt16(len); //number of parameters | ||
.addCString(config.statement); | ||
if (!useBinary) | ||
buffer.addInt16(0); | ||
else { | ||
buffer.addInt16(len); | ||
for (j = 0; j < len; j++) | ||
buffer.addInt16(values[j] instanceof Buffer); | ||
} | ||
buffer.addInt16(len); | ||
for(var i = 0; i < len; i++) { | ||
@@ -222,2 +231,5 @@ var val = values[i]; | ||
buffer.addInt32(-1); | ||
} else if (val instanceof Buffer) { | ||
buffer.addInt32(val.length); | ||
buffer.add(val); | ||
} else { | ||
@@ -224,0 +236,0 @@ buffer.addInt32(Buffer.byteLength(val)); |
@@ -133,14 +133,14 @@ //require the c++ bindings & export to javascript | ||
if(this._namedQueries[query.name]) { | ||
this._sendQueryPrepared(query.name, query.values||[]); | ||
this._sendQueryPrepared(query.name, query.values||[], query.singleRowMode); | ||
} else { | ||
this._namedQuery = true; | ||
this._namedQueries[query.name] = true; | ||
this._sendPrepare(query.name, query.text, (query.values||[]).length); | ||
this._sendPrepare(query.name, query.text, (query.values||[]).length, query.singleRowMode); | ||
} | ||
} else if(query.values) { | ||
//call native function | ||
this._sendQueryWithParams(query.text, query.values); | ||
this._sendQueryWithParams(query.text, query.values, query.singleRowMode); | ||
} else { | ||
//call native function | ||
this._sendQuery(query.text); | ||
this._sendQuery(query.text, query.singleRowMode); | ||
} | ||
@@ -147,0 +147,0 @@ }; |
@@ -23,3 +23,8 @@ var EventEmitter = require('events').EventEmitter; | ||
this.callback = c.callback; | ||
this.singleRowMode = false; | ||
if(!this.callback) { | ||
this.singleRowMode = true; | ||
} | ||
this._result = new Result(config.rowMode); | ||
@@ -26,0 +31,0 @@ this._addedFields = false; |
@@ -49,2 +49,5 @@ var url = require('url'); | ||
var prepareValue = function(val) { | ||
if (val instanceof Buffer) { | ||
return val; | ||
} | ||
if(val instanceof Date) { | ||
@@ -51,0 +54,0 @@ return dateToString(val); |
{ | ||
"name": "pg.js", | ||
"version": "2.6.2", | ||
"version": "2.7.0", | ||
"description": "node-postgres without the bindings", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"prepublish": "make" | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
@@ -10,0 +9,0 @@ "author": "Brian M. Carlson", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
74822
2461