added option for using the binary format
This commit is contained in:
parent
a9e40a2d7d
commit
796b8dfadc
@ -122,6 +122,7 @@ p.bind = function(config) {
|
||||
config = config || {};
|
||||
config.portal = config.portal || '';
|
||||
config.statement = config.statement || '';
|
||||
config.binary = config.binary || false;
|
||||
var values = config.values || [];
|
||||
var len = values.length;
|
||||
var buffer = this.writer
|
||||
@ -139,8 +140,14 @@ p.bind = function(config) {
|
||||
buffer.addString(val);
|
||||
}
|
||||
}
|
||||
buffer.addInt16(1); // format codes to use binary
|
||||
buffer.addInt16(1);
|
||||
|
||||
if (config.binary) {
|
||||
buffer.addInt16(1); // format codes to use binary
|
||||
buffer.addInt16(1);
|
||||
}
|
||||
else {
|
||||
buffer.addInt16(0); // format codes to use text
|
||||
}
|
||||
//0x42 = 'B'
|
||||
|
||||
this._send(0x42, buffer);
|
||||
|
@ -10,6 +10,7 @@ var Query = function(config) {
|
||||
this.rows = config.rows;
|
||||
this.types = config.types;
|
||||
this.name = config.name;
|
||||
this.binary = config.binary;
|
||||
//for code clarity purposes we'll declare this here though it's not
|
||||
//set or used until a rowDescription message comes in
|
||||
this.rowDescription = null;
|
||||
@ -21,7 +22,7 @@ sys.inherits(Query, EventEmitter);
|
||||
var p = Query.prototype;
|
||||
|
||||
p.requiresPreparation = function() {
|
||||
return (this.values || 0).length > 0 || this.name || this.rows;
|
||||
return (this.values || 0).length > 0 || this.name || this.rows || this.binary;
|
||||
};
|
||||
|
||||
|
||||
@ -182,7 +183,8 @@ p.prepare = function(connection) {
|
||||
connection.bind({
|
||||
portal: self.name,
|
||||
statement: self.name,
|
||||
values: self.values
|
||||
values: self.values,
|
||||
binary: self.binary
|
||||
});
|
||||
|
||||
connection.describe({
|
||||
|
Loading…
Reference in New Issue
Block a user