Class: ActiveRecord::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/active_record/connection_adapters/green_mysql2_adapter.rb

Class Method Summary collapse

Class Method Details

.green_mysql2_connection(config) ⇒ Object



62
63
64
65
66
67
68
69
70
71
72
# File 'lib/active_record/connection_adapters/green_mysql2_adapter.rb', line 62

def self.green_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 = Green::Mysql2::Client.new(config.symbolize_keys)
  options = [config[:host], config[:username], config[:password], config[:database], config[:port], config[:socket], 0]
  ConnectionAdapters::GreenMysql2Adapter.new(client, logger, options, config)
end