diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c0535661..6ec6012d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## 0.3.7 (August 16th, 2011) +* ensure symbolized column names support encodings in 1.9 + ## 0.3.6 (June 17th, 2011) * fix bug in Time/DateTime range detection * (win32) fix bug where the Mysql2::Client object wasn't cleaned up properly if interrupted during a query @@ -33,6 +36,13 @@ * BREAKING CHANGE: the ActiveRecord adapter has been pulled into Rails 3.1 and is no longer part of the gem * added Mysql2::Client.escape (class-level) for raw one-off non-encoding-aware escaping +## 0.2.13 (August 16th, 2011) +* fix stupid bug around symbol encoding support (thanks coderrr!) + +## 0.2.12 (August 16th, 2011) +* ensure symbolized column names support encodings in 1.9 +* plugging sql vulnerability in mysql2 adapter + ## 0.2.11 (June 17th, 2011) * fix bug in Time/DateTime range detection * (win32) fix bug where the Mysql2::Client object wasn't cleaned up properly if interrupted during a query diff --git a/ext/mysql2/result.c b/ext/mysql2/result.c index 4842b554e..b931de350 100644 --- a/ext/mysql2/result.c +++ b/ext/mysql2/result.c @@ -114,10 +114,15 @@ static VALUE rb_mysql_result_fetch_field(VALUE self, unsigned int idx, short int field = mysql_fetch_field_direct(wrapper->result, idx); if (symbolize_keys) { + VALUE colStr; char buf[field->name_length+1]; memcpy(buf, field->name, field->name_length); buf[field->name_length] = 0; - rb_field = ID2SYM(rb_intern(buf)); + colStr = rb_str_new2(buf); +#ifdef HAVE_RUBY_ENCODING_H + rb_enc_associate(colStr, rb_utf8_encoding()); +#endif + rb_field = ID2SYM(rb_to_id(colStr)); } else { rb_field = rb_str_new(field->name, field->name_length); #ifdef HAVE_RUBY_ENCODING_H diff --git a/lib/mysql2/version.rb b/lib/mysql2/version.rb index 722fee69a..7e88fee8a 100644 --- a/lib/mysql2/version.rb +++ b/lib/mysql2/version.rb @@ -1,3 +1,3 @@ module Mysql2 - VERSION = "0.3.6" + VERSION = "0.3.7" end