From c4df361449486ded2455dbe26a44ae1251edcdfe Mon Sep 17 00:00:00 2001 From: Roger Pack Date: Fri, 5 Sep 2008 20:13:46 -0600 Subject: [PATCH] rename all hashes to all_hashes_experimental, revert each_hash to its previous behavior --- ext/mysql.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ext/mysql.c b/ext/mysql.c index fb7536a..3ed0f1b 100644 --- a/ext/mysql.c +++ b/ext/mysql.c @@ -1272,12 +1272,13 @@ static VALUE each_hash(int argc, VALUE* argv, VALUE obj) rb_scan_args(argc, argv, "01", &with_table); if (with_table == Qnil) with_table = Qfalse; - process_all_hashes(obj, with_table, 0, 1); + while ((hash = fetch_hash2(obj, with_table)) != Qnil) + rb_yield(hash); return obj; } -/* all_hashes(with_table=false) -- returns an array of hashes, one hash per row */ -static VALUE all_hashes(int argc, VALUE* argv, VALUE obj) +/* all_hashes_experimental(with_table=false) -- returns an array of hashes, one hash per row */ +static VALUE all_hashes_experimental(int argc, VALUE* argv, VALUE obj) { VALUE with_table; VALUE field_names; @@ -2240,7 +2241,7 @@ void Init_mysql(void) rb_define_method(cMysqlRes, "row_tell", row_tell, 0); rb_define_method(cMysqlRes, "each", each, 0); rb_define_method(cMysqlRes, "each_hash", each_hash, -1); - rb_define_method(cMysqlRes, "all_hashes", all_hashes, -1); + rb_define_method(cMysqlRes, "all_hashes_experimental", all_hashes_experimental, -1); /* MysqlField object method */ rb_define_method(cMysqlField, "name", field_name, 0);