@@ -446,7 +446,7 @@ static VALUE rb_mysql_result_each(int argc, VALUE * argv, VALUE self) {
446446 mysql2_result_wrapper * wrapper ;
447447 unsigned long i ;
448448 const char * errstr ;
449- int symbolizeKeys = 0 , asArray = 0 , castBool = 0 , cacheRows = 1 , cast = 1 ;
449+ int symbolizeKeys , asArray , castBool , cacheRows , cast ;
450450 MYSQL_FIELD * fields = NULL ;
451451
452452 GetMysql2Result (self , wrapper );
@@ -459,25 +459,11 @@ static VALUE rb_mysql_result_each(int argc, VALUE * argv, VALUE self) {
459459 opts = defaults ;
460460 }
461461
462- if (rb_hash_aref (opts , sym_symbolize_keys ) == Qtrue ) {
463- symbolizeKeys = 1 ;
464- }
465-
466- if (rb_hash_aref (opts , sym_as ) == sym_array ) {
467- asArray = 1 ;
468- }
469-
470- if (rb_hash_aref (opts , sym_cast_booleans ) == Qtrue ) {
471- castBool = 1 ;
472- }
473-
474- if (rb_hash_aref (opts , sym_cache_rows ) == Qfalse ) {
475- cacheRows = 0 ;
476- }
477-
478- if (rb_hash_aref (opts , sym_cast ) == Qfalse ) {
479- cast = 0 ;
480- }
462+ symbolizeKeys = RTEST (rb_hash_aref (opts , sym_symbolize_keys ));
463+ asArray = rb_hash_aref (opts , sym_as ) == sym_array ;
464+ castBool = RTEST (rb_hash_aref (opts , sym_cast_booleans ));
465+ cacheRows = RTEST (rb_hash_aref (opts , sym_cache_rows ));
466+ cast = RTEST (rb_hash_aref (opts , sym_cast ));
481467
482468 if (wrapper -> is_streaming && cacheRows ) {
483469 rb_warn ("cacheRows is ignored if streaming is true" );
0 commit comments