@@ -124,6 +124,7 @@ static void rb_mysql_client_mark(void * wrapper) {
124
124
static VALUE rb_raise_mysql2_error (mysql_client_wrapper * wrapper ) {
125
125
VALUE rb_error_msg = rb_str_new2 (mysql_error (wrapper -> client ));
126
126
VALUE rb_sql_state = rb_tainted_str_new2 (mysql_sqlstate (wrapper -> client ));
127
+ VALUE e ;
127
128
#ifdef HAVE_RUBY_ENCODING_H
128
129
rb_encoding * default_internal_enc = rb_default_internal_encoding ();
129
130
rb_encoding * conn_enc = rb_to_encoding (wrapper -> encoding );
@@ -136,7 +137,7 @@ static VALUE rb_raise_mysql2_error(mysql_client_wrapper *wrapper) {
136
137
}
137
138
#endif
138
139
139
- VALUE e = rb_exc_new3 (cMysql2Error , rb_error_msg );
140
+ e = rb_exc_new3 (cMysql2Error , rb_error_msg );
140
141
rb_funcall (e , intern_error_number_eql , 1 , UINT2NUM (mysql_errno (wrapper -> client )));
141
142
rb_funcall (e , intern_sql_state_eql , 1 , rb_sql_state );
142
143
rb_exc_raise (e );
@@ -530,11 +531,11 @@ static VALUE finish_and_mark_inactive(void *args) {
530
531
* again.
531
532
*/
532
533
static VALUE rb_mysql_client_abandon_results (VALUE self ) {
533
- GET_CLIENT (self );
534
-
535
534
MYSQL_RES * result ;
536
535
int ret ;
537
536
537
+ GET_CLIENT (self );
538
+
538
539
while (mysql_more_results (wrapper -> client ) == 1 ) {
539
540
ret = mysql_next_result (wrapper -> client );
540
541
if (ret > 0 ) {
@@ -810,9 +811,12 @@ static VALUE rb_mysql_client_server_info(VALUE self) {
810
811
static VALUE rb_mysql_client_socket (VALUE self ) {
811
812
GET_CLIENT (self );
812
813
#ifndef _WIN32
813
- REQUIRE_CONNECTED (wrapper );
814
- int fd_set_fd = wrapper -> client -> net .fd ;
815
- return INT2NUM (fd_set_fd );
814
+ {
815
+ int fd_set_fd ;
816
+ REQUIRE_CONNECTED (wrapper );
817
+ fd_set_fd = wrapper -> client -> net .fd ;
818
+ return INT2NUM (fd_set_fd );
819
+ }
816
820
#else
817
821
rb_raise (cMysql2Error , "Raw access to the mysql file descriptor isn't supported on Windows" );
818
822
#endif
@@ -939,8 +943,8 @@ static VALUE rb_mysql_client_more_results(VALUE self)
939
943
*/
940
944
static VALUE rb_mysql_client_next_result (VALUE self )
941
945
{
942
- GET_CLIENT (self );
943
946
int ret ;
947
+ GET_CLIENT (self );
944
948
ret = mysql_next_result (wrapper -> client );
945
949
if (ret > 0 ) {
946
950
rb_raise_mysql2_error (wrapper );
0 commit comments