@@ -648,7 +648,6 @@ static VALUE rb_query(VALUE self, VALUE sql, VALUE current) {
648
648
struct async_query_args async_args ;
649
649
#endif
650
650
struct nogvl_send_query_args args ;
651
- int async = 0 ;
652
651
GET_CLIENT (self );
653
652
654
653
REQUIRE_CONNECTED (wrapper );
@@ -658,8 +657,6 @@ static VALUE rb_query(VALUE self, VALUE sql, VALUE current) {
658
657
Check_Type (current , T_HASH );
659
658
rb_iv_set (self , "@current_query_options" , current );
660
659
661
- async = rb_hash_aref (current , sym_async ) == Qtrue ;
662
-
663
660
Check_Type (sql , T_STRING );
664
661
#ifdef HAVE_RUBY_ENCODING_H
665
662
/* ensure the string is in the encoding the connection is expecting */
@@ -676,15 +673,15 @@ static VALUE rb_query(VALUE self, VALUE sql, VALUE current) {
676
673
#ifndef _WIN32
677
674
rb_rescue2 (do_send_query , (VALUE )& args , disconnect_and_raise , self , rb_eException , (VALUE )0 );
678
675
679
- if (!async ) {
676
+ if (rb_hash_aref (current , sym_async ) == Qtrue ) {
677
+ return Qnil ;
678
+ } else {
680
679
async_args .fd = wrapper -> client -> net .fd ;
681
680
async_args .self = self ;
682
681
683
682
rb_rescue2 (do_query , (VALUE )& async_args , disconnect_and_raise , self , rb_eException , (VALUE )0 );
684
683
685
684
return rb_mysql_client_async_result (self );
686
- } else {
687
- return Qnil ;
688
685
}
689
686
#else
690
687
do_send_query (& args );
0 commit comments