@@ -511,7 +511,6 @@ static VALUE rb_mysql_result_fetch_row(VALUE self, MYSQL_FIELD * fields, const r
511
511
{
512
512
VALUE rowVal ;
513
513
MYSQL_ROW row ;
514
- MYSQL_FIELD * fields ;
515
514
unsigned int i = 0 ;
516
515
unsigned long * fieldLengths ;
517
516
void * ptr ;
@@ -759,6 +758,37 @@ static VALUE rb_mysql_result_fetch_fields(VALUE self) {
759
758
return wrapper -> fields ;
760
759
}
761
760
761
+ static void rb_mysql_row_query_options (VALUE opts , ID * db_timezone , ID * app_timezone , int * symbolizeKeys , int * asArray , int * castBool , int * cast , int * cacheRows ) {
762
+ ID dbTz , appTz ;
763
+
764
+ * symbolizeKeys = RTEST (rb_hash_aref (opts , sym_symbolize_keys ));
765
+ * asArray = rb_hash_aref (opts , sym_as ) == sym_array ;
766
+ * castBool = RTEST (rb_hash_aref (opts , sym_cast_booleans ));
767
+ * cacheRows = RTEST (rb_hash_aref (opts , sym_cache_rows ));
768
+ * cast = RTEST (rb_hash_aref (opts , sym_cast ));
769
+
770
+ dbTz = rb_hash_aref (opts , sym_database_timezone );
771
+ if (dbTz == sym_local ) {
772
+ * db_timezone = intern_local ;
773
+ } else if (dbTz == sym_utc ) {
774
+ * db_timezone = intern_utc ;
775
+ } else {
776
+ if (!NIL_P (dbTz )) {
777
+ rb_warn (":database_timezone option must be :utc or :local - defaulting to :local" );
778
+ }
779
+ * db_timezone = intern_local ;
780
+ }
781
+
782
+ appTz = rb_hash_aref (opts , sym_application_timezone );
783
+ if (appTz == sym_local ) {
784
+ * app_timezone = intern_local ;
785
+ } else if (appTz == sym_utc ) {
786
+ * app_timezone = intern_utc ;
787
+ } else {
788
+ * app_timezone = Qnil ;
789
+ }
790
+ }
791
+
762
792
static VALUE rb_mysql_result_each_ (VALUE self ,
763
793
VALUE (* fetch_row_func )(VALUE , MYSQL_FIELD * fields , const result_each_args * args ),
764
794
const result_each_args * args )
0 commit comments