@@ -32,14 +32,14 @@ typedef struct {
3232 VALUE block_given ;
3333} result_each_args ;
3434
35- VALUE cBigDecimal , cDateTime , cDate ;
36- static VALUE cMysql2Result ;
37- static VALUE opt_decimal_zero , opt_float_zero , opt_time_year , opt_time_month , opt_utc_offset ;
3835extern VALUE mMysql2 , cMysql2Client , cMysql2Error ;
39- static ID intern_new , intern_utc , intern_local , intern_localtime , intern_local_offset , intern_civil , intern_new_offset ;
40- static VALUE sym_symbolize_keys , sym_as , sym_array , sym_database_timezone , sym_application_timezone ,
41- sym_local , sym_utc , sym_cast_booleans , sym_cache_rows , sym_cast , sym_stream , sym_name ;
42- static ID intern_merge ;
36+ static VALUE cMysql2Result , cDateTime , cDate ;
37+ static VALUE opt_decimal_zero , opt_float_zero , opt_time_year , opt_time_month , opt_utc_offset ;
38+ static ID intern_new , intern_utc , intern_local , intern_localtime , intern_local_offset ,
39+ intern_civil , intern_new_offset , intern_merge , intern_BigDecimal ;
40+ static VALUE sym_symbolize_keys , sym_as , sym_array , sym_database_timezone ,
41+ sym_application_timezone , sym_local , sym_utc , sym_cast_booleans ,
42+ sym_cache_rows , sym_cast , sym_stream , sym_name ;
4343
4444/* Mark any VALUEs that are only referenced in C, so the GC won't get them. */
4545static void rb_mysql_result_mark (void * wrapper ) {
@@ -444,7 +444,7 @@ static VALUE rb_mysql_result_fetch_row_stmt(VALUE self, MYSQL_FIELD * fields, co
444444 }
445445 case MYSQL_TYPE_DECIMAL : // char[]
446446 case MYSQL_TYPE_NEWDECIMAL : // char[]
447- val = rb_funcall (cBigDecimal , intern_new , 1 , rb_str_new (result_buffer -> buffer , * (result_buffer -> length )));
447+ val = rb_funcall (rb_mKernel , intern_BigDecimal , 1 , rb_str_new (result_buffer -> buffer , * (result_buffer -> length )));
448448 break ;
449449 case MYSQL_TYPE_STRING : // char[]
450450 case MYSQL_TYPE_VAR_STRING : // char[]
@@ -546,9 +546,9 @@ static VALUE rb_mysql_result_fetch_row(VALUE self, MYSQL_FIELD * fields, const r
546546 if (fields [i ].decimals == 0 ) {
547547 val = rb_cstr2inum (row [i ], 10 );
548548 } else if (strtod (row [i ], NULL ) == 0.000000 ){
549- val = rb_funcall (cBigDecimal , intern_new , 1 , opt_decimal_zero );
549+ val = rb_funcall (rb_mKernel , intern_BigDecimal , 1 , opt_decimal_zero );
550550 }else {
551- val = rb_funcall (cBigDecimal , intern_new , 1 , rb_str_new (row [i ], fieldLengths [i ]));
551+ val = rb_funcall (rb_mKernel , intern_BigDecimal , 1 , rb_str_new (row [i ], fieldLengths [i ]));
552552 }
553553 break ;
554554 case MYSQL_TYPE_FLOAT : /* FLOAT field */
@@ -959,7 +959,6 @@ VALUE rb_mysql_result_to_obj(VALUE client, VALUE encoding, VALUE options, MYSQL_
959959}
960960
961961void init_mysql2_result () {
962- cBigDecimal = rb_const_get (rb_cObject , rb_intern ("BigDecimal" ));
963962 cDate = rb_const_get (rb_cObject , rb_intern ("Date" ));
964963 cDateTime = rb_const_get (rb_cObject , rb_intern ("DateTime" ));
965964
@@ -978,6 +977,7 @@ void init_mysql2_result() {
978977 intern_local_offset = rb_intern ("local_offset" );
979978 intern_civil = rb_intern ("civil" );
980979 intern_new_offset = rb_intern ("new_offset" );
980+ intern_BigDecimal = rb_intern ("BigDecimal" );
981981
982982 sym_symbolize_keys = ID2SYM (rb_intern ("symbolize_keys" ));
983983 sym_as = ID2SYM (rb_intern ("as" ));
0 commit comments