This repository was archived by the owner on Apr 11, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +198
-198
lines changed Expand file tree Collapse file tree 3 files changed +198
-198
lines changed Original file line number Diff line number Diff line change @@ -354,29 +354,25 @@ Client.prototype._pulseQueryQueue = function () {
354
354
}
355
355
} ;
356
356
357
- Client . prototype . copyFrom = function ( text ) {
358
- throw new Error ( "For PostgreSQL COPY TO/COPY FROM support npm install pg-copy-streams" ) ;
359
- } ;
360
-
361
- Client . prototype . copyTo = function ( text ) {
362
- throw new Error ( "For PostgreSQL COPY TO/COPY FROM support npm install pg-copy-streams" ) ;
363
- } ;
364
-
365
- const DeprecatedQuery = require ( './utils' ) . deprecateEventEmitter ( Query )
366
-
367
357
Client . prototype . query = function ( config , values , callback ) {
368
358
//can take in strings, config object or query object
369
359
var query ;
370
360
var result ;
371
361
if ( typeof config . submit == 'function' ) {
372
- query = config
373
- result = query
362
+ result = query = config
374
363
if ( typeof values == 'function' ) {
375
364
query . callback = query . callback || values
376
365
}
377
366
} else {
378
- query = new DeprecatedQuery ( config , values , callback )
379
- result = query
367
+ query = new Query ( config , values , callback )
368
+ if ( ! query . callback ) {
369
+ let resolve , reject ;
370
+ result = new Promise ( ( res , rej ) => {
371
+ resolve = res
372
+ reject = rej
373
+ } )
374
+ query . callback = ( err , res ) => err ? reject ( err ) : resolve ( res )
375
+ }
380
376
}
381
377
382
378
if ( this . binary && ! query . binary ) {
You can’t perform that action at this time.
0 commit comments