提交 ac26573c 编写于 作者: S Santiago Pastorino

Merge pull request #22444 from kamipo/connection_options_is_only_needed_for_mysql_adapter

`connection_options` is only needed for `MysqlAdapter`
......@@ -144,7 +144,7 @@ def attributes_for_hash
# FIXME: Make the first parameter more similar for the two adapters
def initialize(connection, logger, connection_options, config)
super(connection, logger)
@connection_options, @config = connection_options, config
@config = config
@quoted_column_names, @quoted_table_names = {}, {}
@visitor = Arel::Visitors::MySQL.new self
......
......@@ -16,8 +16,7 @@ def mysql2_connection(config)
end
client = Mysql2::Client.new(config)
options = [config[:host], config[:username], config[:password], config[:database], config[:port], config[:socket], 0]
ConnectionAdapters::Mysql2Adapter.new(client, logger, options, config)
ConnectionAdapters::Mysql2Adapter.new(client, logger, nil, config)
rescue Mysql2::Error => error
if error.message.include?("Unknown database")
raise ActiveRecord::NoDatabaseError
......
......@@ -82,6 +82,7 @@ def initialize(connection, logger, connection_options, config)
super
@statements = StatementPool.new(self.class.type_cast_config_to_integer(config.fetch(:statement_limit) { 1000 }))
@client_encoding = nil
@connection_options = connection_options
connect
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册