@@ -847,13 +847,24 @@ class Connection extends EventEmitter {
847
847
let options = { } ;
848
848
849
849
// process arguments
850
- errors . assertArgCount ( arguments , 1 , 3 ) ;
851
- errors . assertParamValue ( typeof sql === 'string' , 1 ) ;
852
- if ( arguments . length >= 2 ) {
853
- binds = await this . _processExecuteBinds ( a2 ) ;
854
- }
855
- if ( arguments . length == 3 ) {
856
- options = this . _verifyExecOpts ( a3 , false ) ;
850
+ if ( nodbUtil . isObject ( sql ) && typeof sql . statement === 'string' ) {
851
+ errors . assertArgCount ( arguments , 1 , 2 ) ;
852
+ if ( sql . values ) {
853
+ binds = await this . _processExecuteBinds ( sql . values ) ;
854
+ }
855
+ sql = sql . statement ;
856
+ if ( arguments . length == 2 ) {
857
+ options = this . _verifyExecOpts ( a2 , false ) ;
858
+ }
859
+ } else {
860
+ errors . assertArgCount ( arguments , 1 , 3 ) ;
861
+ errors . assertParamValue ( typeof sql === 'string' , 1 ) ;
862
+ if ( arguments . length >= 2 ) {
863
+ binds = await this . _processExecuteBinds ( a2 ) ;
864
+ }
865
+ if ( arguments . length == 3 ) {
866
+ options = this . _verifyExecOpts ( a3 , false ) ;
867
+ }
857
868
}
858
869
this . _addDefaultsToExecOpts ( options ) ;
859
870
errors . assert ( this . _impl , errors . ERR_INVALID_CONNECTION ) ;
0 commit comments