Репозитории ALT
5.1: | 2.8.1-alt2 |
4.1: | 2.7.5-alt1 |
4.0: | 2.7-alt2 |
3.0: | 2.4.5-alt1 |
Группа :: Разработка/Ruby
Пакет: mysql-ruby
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: mysql-ruby-2.8.1-alt2.patch
Скачать
Скачать
mysql.c | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/mysql.c b/mysql.c
index 0750149..7dff8e9 100644
--- a/mysql.c
+++ b/mysql.c
@@ -1076,7 +1076,17 @@ static VALUE fetch_hash2(VALUE obj, VALUE with_table)
}
}
for (i=0; i<n; i++) {
- rb_hash_aset(hash, rb_ary_entry(colname, i), row[i]? rb_tainted_str_new(row[i], lengths[i]): Qnil);
+ if (fields[i].type == MYSQL_TYPE_BLOB) {
+ /* To distinguish between binary and non-binary data for string data types, check whether the charsetnr value is 63.
+ If so, the character set is binary, which indicates binary rather than non-binary data. */
+ if(fields[i].charsetnr == 63) {
+ rb_hash_aset(hash, rb_ary_entry(colname, i), row[i]? rb_tainted_str_new(row[i], lengths[i]): Qnil);
+ } else {
+ rb_hash_aset(hash, rb_ary_entry(colname, i), row[i]? rb_external_str_new_with_enc(row[i], lengths[i], rb_utf8_encoding()): Qnil);
+ }
+ } else {
+ rb_hash_aset(hash, rb_ary_entry(colname, i), row[i]? rb_external_str_new_with_enc(row[i], lengths[i], rb_utf8_encoding()): Qnil);
+ }
}
return hash;
}