Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix for corrupted utf-8 results

  • Loading branch information...
commit 8e1cd8ea20bcbbdc6dd3da136c197c49f0c81001 1 parent 02e8481
@oldmoe authored
Showing with 11 additions and 2 deletions.
  1. +3 −2 ext/mysql.c
  2. +8 −0 lib/mysqlplus.rb
View
5 ext/mysql.c
@@ -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
8 lib/mysqlplus.rb
@@ -7,3 +7,11 @@ def async_query(sql)
get_result
end
end
+
+class Mysql::Result
+ def all_hashes
+ rows = []
+ each_hash { |row| rows << row }
+ rows
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.