Skip to content

Commit 4ddd953

Browse files
committed
FIXME reminder for mysql_stmt_store_result()
1 parent 8e0e0c4 commit 4ddd953

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

ext/mysql2/statement.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,15 @@ static VALUE each(VALUE self) {
331331
unsigned long field_count;
332332
unsigned long i;
333333

334+
// FIXME we are calling mysql_stmt_store_result() *before* instead of *after*
335+
// binding the data buffers with mysql_stmt_bind_result(). Turn into a config
336+
// flag for result sets that require a lot of memory?
337+
//
338+
// From MySQL docs:
339+
// "By default, result sets are fetched unbuffered a row at a time from the
340+
// server. To buffer the entire result set on the client, call
341+
// mysql_stmt_store_result() after binding the data buffers and before
342+
// calling mysql_stmt_fetch()."
334343
if (mysql_stmt_store_result(stmt)) {
335344
rb_raise(cMysql2Error, "%s", mysql_stmt_error(stmt));
336345
}

0 commit comments

Comments
 (0)