Module: Oboe::Inst::ConnectionAdapters::FlavorInitializers

Defined in:
lib/oboe/frameworks/rails/inst/connection_adapters/mysql.rb,
lib/oboe/frameworks/rails/inst/connection_adapters/mysql2.rb,
lib/oboe/frameworks/rails/inst/connection_adapters/oracle.rb,
lib/oboe/frameworks/rails/inst/connection_adapters/postgresql.rb

Class Method Summary collapse

Class Method Details

.mysqlObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# 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

.mysql2Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# 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

.oracleObject



8
9
10
11
12
13
# 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

.postgresqlObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# 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