Skip to content

Commit 2cabc76

Browse files
committed
Fix condition for already rows cached
`mysql_num_rows(wrapper->result)` returns 0 when result rows is 0.
1 parent e8001bb commit 2cabc76

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ext/mysql2/result.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -913,7 +913,7 @@ static VALUE rb_mysql_result_each(int argc, VALUE * argv, VALUE self) {
913913
app_timezone = Qnil;
914914
}
915915

916-
if (wrapper->lastRowProcessed == 0 && !wrapper->is_streaming) {
916+
if (wrapper->rows == Qnil && !wrapper->is_streaming) {
917917
wrapper->numberOfRows = wrapper->stmt_wrapper ? mysql_stmt_num_rows(wrapper->stmt_wrapper->stmt) : mysql_num_rows(wrapper->result);
918918
if (wrapper->numberOfRows == 0) {
919919
rb_mysql_result_free_result(wrapper);

0 commit comments

Comments
 (0)