Class: ActiveRecord::Base
- Inherits:
-
Object
- Object
- ActiveRecord::Base
- Defined in:
- lib/active_record/connection_adapters/mysql2_adapter.rb,
lib/active_record/connection_adapters/em_mysql2_adapter.rb
Class Method Summary collapse
Class Method Details
.em_mysql2_connection(config) ⇒ Object
9 10 11 12 13 |
# File 'lib/active_record/connection_adapters/em_mysql2_adapter.rb', line 9 def self.em_mysql2_connection(config) client = ::Mysql2::Fibered::Client.new(config.symbolize_keys) = [config[:host], config[:username], config[:password], config[:database], config[:port], config[:socket], 0] ConnectionAdapters::Mysql2Adapter.new(client, logger, , config) end |
.mysql2_connection(config) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/active_record/connection_adapters/mysql2_adapter.rb', line 7 def self.mysql2_connection(config) config[:username] = 'root' if config[:username].nil? if Mysql2::Client.const_defined? :FOUND_ROWS config[:flags] = Mysql2::Client::FOUND_ROWS end client = Mysql2::Client.new(config.symbolize_keys) = [config[:host], config[:username], config[:password], config[:database], config[:port], config[:socket], 0] ConnectionAdapters::Mysql2Adapter.new(client, logger, , config) end |