@@ -294,7 +294,7 @@ static void rb_mysql_result_alloc_result_buffers(VALUE self, MYSQL_FIELD *fields
294
294
}
295
295
}
296
296
297
- static VALUE rb_mysql_result_stmt_fetch_row (VALUE self , ID db_timezone , ID app_timezone , int symbolizeKeys , int asArray , int castBool , int cast , MYSQL_FIELD * fields ) {
297
+ static VALUE rb_mysql_result_stmt_fetch_row (VALUE self , ID db_timezone , ID app_timezone , int symbolizeKeys , int asArray , int castBool , MYSQL_FIELD * fields ) {
298
298
VALUE rowVal ;
299
299
mysql2_result_wrapper * wrapper ;
300
300
unsigned int i = 0 ;
@@ -780,12 +780,13 @@ static VALUE rb_mysql_result_each_nonstmt(VALUE self, const result_each_args* ar
780
780
wrapper -> numberOfRows ++ ;
781
781
if (args -> block_given != Qnil ) {
782
782
rb_yield (row );
783
+ wrapper -> lastRowProcessed ++ ;
783
784
}
784
785
}
785
786
} while (row != Qnil );
786
787
787
788
rb_mysql_result_free_result (wrapper );
788
- // wrapper->numberOfRows = wrapper->lastRowProcessed;
789
+ wrapper -> numberOfRows = wrapper -> lastRowProcessed ;
789
790
wrapper -> streamingComplete = 1 ;
790
791
791
792
// Check for errors, the connection might have gone out from under us
@@ -864,17 +865,18 @@ static VALUE rb_mysql_result_each_stmt(VALUE self, const result_each_args* args)
864
865
fields = mysql_fetch_fields (wrapper -> result );
865
866
866
867
do {
867
- row = rb_mysql_result_stmt_fetch_row (self , args -> db_timezone , args -> app_timezone , args -> symbolizeKeys , args -> asArray , args -> castBool , args -> cast , fields );
868
+ row = rb_mysql_result_stmt_fetch_row (self , args -> db_timezone , args -> app_timezone , args -> symbolizeKeys , args -> asArray , args -> castBool , fields );
868
869
if (row != Qnil ) {
869
870
wrapper -> numberOfRows ++ ;
870
871
if (args -> block_given != Qnil ) {
871
872
rb_yield (row );
873
+ wrapper -> lastRowProcessed ++ ;
872
874
}
873
875
}
874
876
} while (row != Qnil );
875
877
876
878
rb_mysql_result_free_result (wrapper );
877
- // wrapper->numberOfRows = wrapper->lastRowProcessed;
879
+ wrapper -> numberOfRows = wrapper -> lastRowProcessed ;
878
880
wrapper -> streamingComplete = 1 ;
879
881
880
882
// Check for errors, the connection might have gone out from under us
@@ -903,7 +905,7 @@ static VALUE rb_mysql_result_each_stmt(VALUE self, const result_each_args* args)
903
905
if (args -> cacheRows && i < rowsProcessed ) {
904
906
row = rb_ary_entry (wrapper -> rows , i );
905
907
} else {
906
- row = rb_mysql_result_stmt_fetch_row (self , args -> db_timezone , args -> app_timezone , args -> symbolizeKeys , args -> asArray , args -> castBool , args -> cast , fields );
908
+ row = rb_mysql_result_stmt_fetch_row (self , args -> db_timezone , args -> app_timezone , args -> symbolizeKeys , args -> asArray , args -> castBool , fields );
907
909
if (args -> cacheRows ) {
908
910
rb_ary_store (wrapper -> rows , i , row );
909
911
}
@@ -962,10 +964,14 @@ static VALUE rb_mysql_result_each(int argc, VALUE * argv, VALUE self) {
962
964
rb_warn ("cacheRows is ignored if streaming is true" );
963
965
}
964
966
965
- if (wrapper -> stmt && !args .cacheRows && !args .streaming ) {
967
+ if (wrapper -> stmt && !args .cacheRows && !args .streaming ) {
966
968
rb_warn ("cacheRows is forced for prepared statements (if not streaming)" );
967
969
}
968
970
971
+ if (wrapper -> stmt && !args .cast ) {
972
+ rb_warn ("cast is forced for prepared statements" );
973
+ }
974
+
969
975
dbTz = rb_hash_aref (opts , sym_database_timezone );
970
976
if (dbTz == sym_local ) {
971
977
db_timezone = intern_local ;
0 commit comments