@@ -304,7 +304,13 @@ async fn exe_query_mysql<'e>(
304304 }
305305 }
306306
307- if let JsValueFacade :: JsFunction { cached_function } = row_consumer {
307+ if row_consumer. is_null_or_undefined ( ) {
308+ // turn row args vec into array
309+ let arr_facade = JsValueFacade :: Array {
310+ val : row_args_vec
311+ } ;
312+ ret_vec. push ( arr_facade) ;
313+ } else if let JsValueFacade :: JsFunction { cached_function } = row_consumer {
308314 let mut func_res = cached_function. invoke_function ( row_args_vec) . await ?;
309315 while let JsValueFacade :: JsPromise { cached_promise } = func_res {
310316 let prom_res = cached_promise. get_promise_result ( ) . await ?;
@@ -566,7 +572,13 @@ async fn exe_query_postgres<'e>(
566572 }
567573 }
568574
569- if let JsValueFacade :: JsFunction { cached_function } = row_consumer {
575+ if row_consumer. is_null_or_undefined ( ) {
576+ // turn row args vec into array
577+ let arr_facade = JsValueFacade :: Array {
578+ val : row_args_vec
579+ } ;
580+ ret_vec. push ( arr_facade) ;
581+ } else if let JsValueFacade :: JsFunction { cached_function } = row_consumer {
570582 let mut func_res = cached_function. invoke_function ( row_args_vec) . await ?;
571583 while let JsValueFacade :: JsPromise { cached_promise } = func_res {
572584 let prom_res = cached_promise. get_promise_result ( ) . await ?;
@@ -1079,9 +1091,9 @@ unsafe extern "C" fn fn_connection_query(
10791091 if !( args. len ( ) == 3
10801092 && args[ 0 ] . is_string ( )
10811093 && ( args[ 1 ] . is_array ( ) || args[ 1 ] . is_object ( ) || args[ 1 ] . is_null ( ) )
1082- && args[ 2 ] . is_function ( ) )
1094+ && ( args[ 2 ] . is_function ( ) || args [ 2 ] . is_null ( ) ) )
10831095 {
1084- return q_ctx. report_ex ( "query requires three args (qry: string, arguments: Array<primitive> | Record<string, primitive>, row_consumer: () => Promise<any>)" ) ;
1096+ return q_ctx. report_ex ( "query requires three args (qry: string, arguments: null | Array<primitive> | Record<string, primitive>, row_consumer: null | () => Promise<any>)" ) ;
10851097 }
10861098
10871099 if let Some ( proxy_instance_id) = get_proxy_instance_id ( context, & this_val_adapter) {
@@ -1364,9 +1376,9 @@ unsafe extern "C" fn fn_transaction_query(
13641376 if !( args. len ( ) == 3
13651377 && args[ 0 ] . is_string ( )
13661378 && ( args[ 1 ] . is_array ( ) || args[ 1 ] . is_object ( ) || args[ 1 ] . is_null ( ) )
1367- && args[ 2 ] . is_function ( ) )
1379+ && ( args[ 2 ] . is_function ( ) || args [ 2 ] . is_null ( ) ) )
13681380 {
1369- return q_ctx. report_ex ( "query requires three args (qry: string, arguments: Array<primitive> | Record<string, primitive>, row_consumer: () => Promise<any>)" ) ;
1381+ return q_ctx. report_ex ( "query requires three args (qry: string, arguments: null | Array<primitive> | Record<string, primitive>, row_consumer: null | () => Promise<any>)" ) ;
13701382 }
13711383
13721384 if let Some ( proxy_instance_id) = get_proxy_instance_id ( context, & this_val_adapter) {
0 commit comments