rename all hashes to all_hashes_experimental, revert each_hash to its previous behavior

This commit is contained in:
Roger Pack 2008-09-05 20:13:46 -06:00
parent 866f4cfa3e
commit c4df361449

View File

@ -1272,12 +1272,13 @@ static VALUE each_hash(int argc, VALUE* argv, VALUE obj)
rb_scan_args(argc, argv, "01", &with_table); rb_scan_args(argc, argv, "01", &with_table);
if (with_table == Qnil) if (with_table == Qnil)
with_table = Qfalse; with_table = Qfalse;
process_all_hashes(obj, with_table, 0, 1); while ((hash = fetch_hash2(obj, with_table)) != Qnil)
rb_yield(hash);
return obj; return obj;
} }
/* all_hashes(with_table=false) -- returns an array of hashes, one hash per row */ /* all_hashes_experimental(with_table=false) -- returns an array of hashes, one hash per row */
static VALUE all_hashes(int argc, VALUE* argv, VALUE obj) static VALUE all_hashes_experimental(int argc, VALUE* argv, VALUE obj)
{ {
VALUE with_table; VALUE with_table;
VALUE field_names; VALUE field_names;
@ -2240,7 +2241,7 @@ void Init_mysql(void)
rb_define_method(cMysqlRes, "row_tell", row_tell, 0); rb_define_method(cMysqlRes, "row_tell", row_tell, 0);
rb_define_method(cMysqlRes, "each", each, 0); rb_define_method(cMysqlRes, "each", each, 0);
rb_define_method(cMysqlRes, "each_hash", each_hash, -1); 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 */ /* MysqlField object method */
rb_define_method(cMysqlField, "name", field_name, 0); rb_define_method(cMysqlField, "name", field_name, 0);