module Oboe::Inst::ConnectionAdapters::FlavorInitializers

Public Class Methods

mysql() click to toggle source
# File lib/oboe/frameworks/rails/inst/connection_adapters/mysql.rb, line 8
def self.mysql
  Oboe.logger.info '[oboe/loading] Instrumenting activerecord mysqladapter' if Oboe::Config[:verbose]

  # ActiveRecord 3.2 and higher
  if (::ActiveRecord::VERSION::MAJOR == 3 && ::ActiveRecord::VERSION::MINOR >= 2) ||
      ::ActiveRecord::VERSION::MAJOR == 4

    # AbstractMysqlAdapter
    Oboe::Util.send_include(::ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter,
                            ::Oboe::Inst::ConnectionAdapters::Utils)
    Oboe::Util.method_alias(::ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter, :execute)

    # MysqlAdapter
    Oboe::Util.send_include(::ActiveRecord::ConnectionAdapters::MysqlAdapter,
                            ::Oboe::Inst::ConnectionAdapters::Utils)
    Oboe::Util.method_alias(::ActiveRecord::ConnectionAdapters::MysqlAdapter, :exec_query)

  else
    # ActiveRecord 3.1 and below

    # MysqlAdapter
    Oboe::Util.send_include(::ActiveRecord::ConnectionAdapters::MysqlAdapter,
                            ::Oboe::Inst::ConnectionAdapters::Utils)

    Oboe::Util.method_alias(::ActiveRecord::ConnectionAdapters::MysqlAdapter, :execute)

    if ::ActiveRecord::VERSION::MAJOR == 3 && ::ActiveRecord::VERSION::MINOR == 1
      Oboe::Util.method_alias(::ActiveRecord::ConnectionAdapters::MysqlAdapter, :begin_db_transaction)
      Oboe::Util.method_alias(::ActiveRecord::ConnectionAdapters::MysqlAdapter, :exec_delete)
    end
  end
end
mysql2() click to toggle source
# File lib/oboe/frameworks/rails/inst/connection_adapters/mysql2.rb, line 8
def self.mysql2
  Oboe.logger.info '[oboe/loading] Instrumenting activerecord mysql2adapter' if Oboe::Config[:verbose]

  Oboe::Util.send_include(::ActiveRecord::ConnectionAdapters::Mysql2Adapter,
                          ::Oboe::Inst::ConnectionAdapters::Utils)

  if (::ActiveRecord::VERSION::MAJOR == 3 && ::ActiveRecord::VERSION::MINOR == 0) ||
      ::ActiveRecord::VERSION::MAJOR == 2
    # ActiveRecord 3.0 and prior
    Oboe::Util.method_alias(::ActiveRecord::ConnectionAdapters::Mysql2Adapter, :execute)
  else
    # ActiveRecord 3.1 and above
    Oboe::Util.method_alias(::ActiveRecord::ConnectionAdapters::Mysql2Adapter, :exec_insert)
    Oboe::Util.method_alias(::ActiveRecord::ConnectionAdapters::Mysql2Adapter, :exec_query)
    Oboe::Util.method_alias(::ActiveRecord::ConnectionAdapters::Mysql2Adapter, :exec_delete)
  end
end
oracle() click to toggle source
# File lib/oboe/frameworks/rails/inst/connection_adapters/oracle.rb, line 8
def self.oracle
  Oboe.logger.info '[oboe/loading] Instrumenting activerecord oracleenhancedadapter' if Oboe::Config[:verbose]
  ::ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.module_eval do
    include Oboe::Inst::ConnectionAdapters
  end if defined?(::ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter)
end
postgresql() click to toggle source
# File lib/oboe/frameworks/rails/inst/connection_adapters/postgresql.rb, line 8
def self.postgresql

  Oboe.logger.info '[oboe/loading] Instrumenting activerecord postgresqladapter' if Oboe::Config[:verbose]

  Oboe::Util.send_include(::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter,
                          ::Oboe::Inst::ConnectionAdapters::Utils)

  if (::ActiveRecord::VERSION::MAJOR == 3 && ::ActiveRecord::VERSION::MINOR > 0) ||
        ::ActiveRecord::VERSION::MAJOR == 4

    # ActiveRecord 3.1 and up
    Oboe::Util.method_alias(::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter, :exec_query)
    Oboe::Util.method_alias(::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter, :exec_delete)

  else
    # ActiveRecord 3.0 and prior
    Oboe::Util.method_alias(::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter, :execute)
  end
end