mirror of
https://github.com/brianc/node-postgres.git
synced 2025-12-08 20:16:25 +00:00
added null terminator (c-string) to query
This commit is contained in:
parent
f9b5c7b03e
commit
e69b6faa82
@ -105,7 +105,7 @@ var Query = function() {
|
||||
sys.inherits(Query, EventEmitter);
|
||||
|
||||
Query.prototype.toBuffer = function() {
|
||||
var textBuffer = new Buffer(this.text,'utf8');
|
||||
var textBuffer = new Buffer(this.text+'\0','utf8');
|
||||
var len = textBuffer.length + 4;
|
||||
var fullBuffer = new Buffer(len + 1);
|
||||
fullBuffer[0] = 0x51;
|
||||
|
||||
@ -3,10 +3,14 @@ require(__dirname+"/test-helper");
|
||||
//little helper to make a
|
||||
//fresh client to the test DB
|
||||
var makeClient = function() {
|
||||
return new Client({
|
||||
var client = new Client({
|
||||
user: 'brian',
|
||||
database: 'pgjstest'
|
||||
});
|
||||
client.on('Error', function(msg) {
|
||||
console.log(msg);
|
||||
});
|
||||
return client;
|
||||
};
|
||||
|
||||
var client1 = makeClient();
|
||||
@ -27,12 +31,13 @@ var client3 = makeClient();
|
||||
client3.connect();
|
||||
client3.on('ReadyForQuery', function() {
|
||||
console.log('client3 ready for query');
|
||||
var query = client3.query('create temporary table bang (id integer)');
|
||||
query.on('end', function() {
|
||||
client3.disconnect();
|
||||
});
|
||||
|
||||
});
|
||||
var query = client3.query('create temporary table bang (id integer)');
|
||||
query.on('end', function() {
|
||||
client3.disconnect();
|
||||
});
|
||||
|
||||
|
||||
// client.query('create temporary table bang (id integer)');
|
||||
// client.query('insert into bang(id) VALUES(1)');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user