@@ -647,7 +647,6 @@ static VALUE rb_query(VALUE self, VALUE sql, VALUE current) {
647
647
struct async_query_args async_args ;
648
648
#endif
649
649
struct nogvl_send_query_args args ;
650
- int async = 0 ;
651
650
VALUE thread_current = rb_thread_current ();
652
651
GET_CLIENT (self );
653
652
@@ -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 */
@@ -689,15 +686,15 @@ static VALUE rb_query(VALUE self, VALUE sql, VALUE current) {
689
686
#ifndef _WIN32
690
687
rb_rescue2 (do_send_query , (VALUE )& args , disconnect_and_raise , self , rb_eException , (VALUE )0 );
691
688
692
- if (!async ) {
689
+ if (rb_hash_aref (current , sym_async ) == Qtrue ) {
690
+ return Qnil ;
691
+ } else {
693
692
async_args .fd = wrapper -> client -> net .fd ;
694
693
async_args .self = self ;
695
694
696
695
rb_rescue2 (do_query , (VALUE )& async_args , disconnect_and_raise , self , rb_eException , (VALUE )0 );
697
696
698
697
return rb_mysql_client_async_result (self );
699
- } else {
700
- return Qnil ;
701
698
}
702
699
#else
703
700
do_send_query (& args );
0 commit comments