2012-03-22 11:36:18 +08:00
|
|
|
var helper = require(__dirname + '/test-helper');
|
|
|
|
|
2013-03-08 05:57:00 +08:00
|
|
|
helper.pg.connect(helper.config, assert.success(function(client, done) {
|
2014-03-16 04:36:27 +08:00
|
|
|
var types = require('pg-types');
|
2012-03-22 11:36:18 +08:00
|
|
|
//1231 = numericOID
|
|
|
|
types.setTypeParser(1700, function(){
|
|
|
|
return 'yes';
|
|
|
|
})
|
|
|
|
types.setTypeParser(1700, 'binary', function(){
|
|
|
|
return 'yes';
|
|
|
|
})
|
|
|
|
var bignum = '294733346389144765940638005275322203805';
|
|
|
|
client.query('CREATE TEMP TABLE bignumz(id numeric)');
|
|
|
|
client.query('INSERT INTO bignumz(id) VALUES ($1)', [bignum]);
|
|
|
|
client.query('SELECT * FROM bignumz', assert.success(function(result) {
|
|
|
|
assert.equal(result.rows[0].id, 'yes')
|
|
|
|
helper.pg.end();
|
2013-03-08 05:57:00 +08:00
|
|
|
done();
|
2012-03-22 11:36:18 +08:00
|
|
|
}))
|
|
|
|
}));
|
|
|
|
|
|
|
|
//custom type converter
|