node-postgres/test/integration/client/no-row-result-tests.js
Brian Carlson 337d49dddb Return field metadata on result object
Closes #209
Native implementation requires significant refactor and so I wont work on this
if/until there is an issue for it
2013-06-03 12:14:47 -05:00

24 lines
733 B
JavaScript

var helper = require(__dirname + '/test-helper');
var pg = helper.pg;
var config = helper.config;
test('can access results when no rows are returned', function() {
if(config.native) return false;
var checkResult = function(result) {
assert(result.fields, 'should have fields definition');
assert.equal(result.fields.length, 1);
assert.equal(result.fields[0].name, 'val');
assert.equal(result.fields[0].dataTypeID, 25);
pg.end();
};
pg.connect(config, assert.success(function(client, done) {
var query = client.query('select $1::text as val limit 0', ['hi'], assert.success(function(result) {
checkResult(result);
done();
}));
assert.emits(query, 'end', checkResult);
}));
});