Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

fix for corrupted utf-8 results

  • Loading branch information...
commit 8e1cd8ea20bcbbdc6dd3da136c197c49f0c81001 1 parent 02e8481
Mohammad A. Ali authored September 06, 2008
5  ext/mysql.c
@@ -1272,7 +1272,8 @@ static VALUE each_hash(int argc, VALUE* argv, VALUE obj)
1272 1272
     rb_scan_args(argc, argv, "01", &with_table);
1273 1273
     if (with_table == Qnil)
1274 1274
 	with_table = Qfalse;
1275  
-    process_all_hashes(obj, with_table, 0, 1);
  1275
+    while ((hash = fetch_hash2(obj, with_table)) != Qnil)
  1276
+	rb_yield(hash);
1276 1277
     return obj;
1277 1278
 }
1278 1279
 
@@ -2240,7 +2241,7 @@ void Init_mysql(void)
2240 2241
     rb_define_method(cMysqlRes, "row_tell", row_tell, 0);
2241 2242
     rb_define_method(cMysqlRes, "each", each, 0);
2242 2243
     rb_define_method(cMysqlRes, "each_hash", each_hash, -1);
2243  
-    rb_define_method(cMysqlRes, "all_hashes", all_hashes, -1);
  2244
+    /*rb_define_method(cMysqlRes, "all_hashes", all_hashes, -1);*/
2244 2245
 
2245 2246
     /* MysqlField object method */
2246 2247
     rb_define_method(cMysqlField, "name", field_name, 0);
8  lib/mysqlplus.rb
@@ -7,3 +7,11 @@ def async_query(sql)
7 7
     get_result
8 8
   end
9 9
 end
  10
+
  11
+class Mysql::Result
  12
+  def all_hashes
  13
+    rows = []
  14
+    each_hash { |row| rows << row }
  15
+    rows
  16
+  end
  17
+end

0 notes on commit 8e1cd8e

Please sign in to comment.
Something went wrong with that request. Please try again.