mysql2 0.2.11 → 0.2.12

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.12 (August 16th, 2011)
4
+ * ensure symbolized column names support encodings in 1.9
5
+ * plugging sql vulnerability in mysql2 adapter
6
+
3
7
  ## 0.2.11 (June 17th, 2011)
4
8
  * fix bug in Time/DateTime range detection
5
9
  * (win32) fix bug where the Mysql2::Client object wasn't cleaned up properly if interrupted during a query
@@ -114,10 +114,15 @@ static VALUE rb_mysql_result_fetch_field(VALUE self, unsigned int idx, short int
114
114
 
115
115
  field = mysql_fetch_field_direct(wrapper->result, idx);
116
116
  if (symbolize_keys) {
117
+ VALUE colStr;
117
118
  char buf[field->name_length+1];
118
119
  memcpy(buf, field->name, field->name_length);
119
120
  buf[field->name_length] = 0;
120
- rb_field = ID2SYM(rb_intern(buf));
121
+ colStr = rb_str_new2(buf);
122
+ #ifdef HAVE_RUBY_ENCODING_H
123
+ rb_enc_associate(colStr, rb_utf8_encoding());
124
+ #endif
125
+ rb_field = ID2SYM(colStr);
121
126
  } else {
122
127
  rb_field = rb_str_new(field->name, field->name_length);
123
128
  #ifdef HAVE_RUBY_ENCODING_H
@@ -157,7 +157,7 @@ module ActiveRecord
157
157
  end
158
158
 
159
159
  def quote_column_name(name) #:nodoc:
160
- @quoted_column_names[name] ||= "`#{name}`"
160
+ @quoted_column_names[name] ||= "`#{name.to_s.gsub('`', '``')}`"
161
161
  end
162
162
 
163
163
  def quote_table_name(name) #:nodoc:
@@ -1,3 +1,3 @@
1
1
  module Mysql2
2
- VERSION = "0.2.11"
2
+ VERSION = "0.2.12"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mysql2
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1
4
+ hash: 15
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 11
10
- version: 0.2.11
9
+ - 12
10
+ version: 0.2.12
11
11
  platform: ruby
12
12
  authors:
13
13
  - Brian Lopez
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-06-17 00:00:00 -07:00
18
+ date: 2011-08-16 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -221,7 +221,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
221
221
  requirements: []
222
222
 
223
223
  rubyforge_project:
224
- rubygems_version: 1.3.10
224
+ rubygems_version: 1.6.2
225
225
  signing_key:
226
226
  specification_version: 3
227
227
  summary: A simple, fast Mysql library for Ruby, binding to libmysql