提交 224d47e0 编写于 作者: J Jeremy Kemper

MySQL: allow encoding option for mysql.rb driver.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3293 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 98068a71
*SVN*
* MySQL: allow encoding option for mysql.rb driver. [Jeremy Kemper]
* Added option inheritance for find calls on has_and_belongs_to_many and has_many assosociations [DHH]. Example:
class Post
......
......@@ -311,11 +311,7 @@ def rename_column(table_name, column_name, new_column_name) #:nodoc:
def connect
encoding = @config[:encoding]
if encoding
begin
@connection.options(Mysql::SET_CHARSET_NAME, encoding)
rescue
raise ActiveRecord::ConnectionFailed, 'The :encoding option is only available for MySQL 4.1 and later with the mysql-ruby driver. Again, this does not work with the ruby-mysql driver or MySQL < 4.1.'
end
@connection.options(Mysql::SET_CHARSET_NAME, encoding) rescue nil
end
@connection.real_connect(*@connection_options)
execute("SET NAMES '#{encoding}'") if encoding
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册