From b1bf771d6fb924950fb49926a5b0861c0faa466d Mon Sep 17 00:00:00 2001 From: Roger Pack Date: Mon, 8 Sep 2008 12:10:12 -0600 Subject: [PATCH] add back in all_hashes method--this time hopefully with the right line lengths --- ext/mysql.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/ext/mysql.c b/ext/mysql.c index 739d352..383c7ae 100644 --- a/ext/mysql.c +++ b/ext/mysql.c @@ -1129,7 +1129,7 @@ static VALUE process_all_hashes(VALUE obj, VALUE with_table, int build_array, in VALUE ary; if(build_array) ary = rb_ary_new(); - MYSQL_ROW row = mysql_fetch_row(res); // need one early to determine the columns + MYSQL_ROW row = mysql_fetch_row(res); // grab one off the top, to determine the rows if (row == NULL){ if(build_array){ return ary; @@ -1137,7 +1137,6 @@ static VALUE process_all_hashes(VALUE obj, VALUE with_table, int build_array, in return Qnil; } } - unsigned long* lengths = mysql_fetch_lengths(res); MYSQL_FIELD* fields = mysql_fetch_fields(res); unsigned int i; VALUE hash; @@ -1171,9 +1170,11 @@ static VALUE process_all_hashes(VALUE obj, VALUE with_table, int build_array, in } } + unsigned long* lengths = NULL; while(row != NULL) { hash = rb_hash_new(); + lengths = mysql_fetch_lengths(res); for (i=0; i