mirror of
https://github.com/brianc/node-postgres.git
synced 2026-01-18 15:55:05 +00:00
Use normalizeQueryConfig in native query
This commit is contained in:
parent
df36bece86
commit
55c3b3691c
@ -118,35 +118,7 @@ Client.prototype.query = function(config, values, callback) {
|
||||
return config;
|
||||
}
|
||||
|
||||
var conf = { };
|
||||
|
||||
//support query('text', ...) style calls
|
||||
if(typeof config == 'string') {
|
||||
conf.text = config;
|
||||
}
|
||||
|
||||
//support passing everything in via a config object
|
||||
if(typeof config == 'object') {
|
||||
conf.text = config.text;
|
||||
conf.values = config.values;
|
||||
conf.name = config.name;
|
||||
conf.callback = config.callback;
|
||||
conf.rowMode = config.rowMode;
|
||||
}
|
||||
|
||||
//support query({...}, function() {}) style calls
|
||||
//& support query(..., ['values'], ...) style calls
|
||||
if(typeof values == 'function') {
|
||||
conf.callback = values;
|
||||
}
|
||||
else if(util.isArray(values)) {
|
||||
conf.values = values;
|
||||
}
|
||||
if(typeof callback == 'function') {
|
||||
conf.callback = callback;
|
||||
}
|
||||
|
||||
var query = new NativeQuery(conf);
|
||||
var query = new NativeQuery(config, values, callback);
|
||||
this._queryQueue.push(query);
|
||||
this._pulseQueryQueue();
|
||||
return query;
|
||||
|
||||
@ -1 +1 @@
|
||||
module.exports = require('./client')
|
||||
module.exports = require('./client');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user