mirror of
https://github.com/brianc/node-postgres.git
synced 2025-12-08 20:16:25 +00:00
Merge branch 'master' of https://github.com/kesavkolla/node-postgres into kesavkolla-master
This commit is contained in:
commit
ee775eb88e
@ -313,7 +313,9 @@ Client.prototype.query = function(config, values, callback) {
|
||||
if(this.binary && !query.binary) {
|
||||
query.binary = true;
|
||||
}
|
||||
query._result._getTypeParser = this._types.getTypeParser.bind(this._types);
|
||||
if(query._result) {
|
||||
query._result._getTypeParser = this._types.getTypeParser.bind(this._types);
|
||||
}
|
||||
|
||||
this.queryQueue.push(query);
|
||||
this._pulseQueryQueue();
|
||||
|
||||
@ -25,7 +25,8 @@
|
||||
"pg-connection-string": "0.1.3",
|
||||
"pg-types": "1.6.0",
|
||||
"pgpass": "0.0.3",
|
||||
"semver": "^4.1.0"
|
||||
"semver": "^4.1.0",
|
||||
"pg-copy-streams":"~0.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"async": "0.9.0",
|
||||
|
||||
30
test/integration/gh-issues/699-tests.js
Normal file
30
test/integration/gh-issues/699-tests.js
Normal file
@ -0,0 +1,30 @@
|
||||
var helper = require('../test-helper');
|
||||
var assert = require('assert');
|
||||
var copyFrom = require('pg-copy-streams').from;
|
||||
|
||||
|
||||
helper.pg.connect(function (err, client, done) {
|
||||
if (err) throw err;
|
||||
|
||||
var c = 'CREATE TEMP TABLE employee (id integer, fname varchar(400), lname varchar(400))';
|
||||
|
||||
client.query(c, function (err) {
|
||||
if (err) throw err;
|
||||
|
||||
var stream = con.query(copyFrom("COPY employee FROM STDIN"));
|
||||
stream.on('end', function () {
|
||||
done();
|
||||
helper.pg.end();
|
||||
});
|
||||
|
||||
stream.on('error', function () {
|
||||
throw new Error('Error in copy stream');
|
||||
});
|
||||
|
||||
for (var i = 1; i <= 5; i++) {
|
||||
var line = ['1\ttest', i, '\tuser', i, '\n'];
|
||||
stream.write(line.join(''));
|
||||
}
|
||||
stream.end();
|
||||
});
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user