fix for corrupted utf-8 results

This commit is contained in:
oldmoe 2008-09-06 03:59:20 +02:00
parent 02e8481161
commit 8e1cd8ea20
2 changed files with 11 additions and 2 deletions

View File

@ -1272,7 +1272,8 @@ 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;
}
@ -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", all_hashes, -1);*/
/* MysqlField object method */
rb_define_method(cMysqlField, "name", field_name, 0);

View File

@ -7,3 +7,11 @@ class Mysql
get_result
end
end
class Mysql::Result
def all_hashes
rows = []
each_hash { |row| rows << row }
rows
end
end