Sha256: b61add471ad3743adc80f8e412f8ee42074c891654c7710adceed947f8e7a907

Contents?: true

Size: 1.74 KB

Versions: 6

Compression:

Stored size: 1.74 KB

Contents

# Copyright (c) 2013 AppNeta, Inc.
# All rights reserved.

module Oboe
  module Inst
    module ConnectionAdapters
      module FlavorInitializers
        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 and ::ActiveRecord::VERSION::MINOR >= 2) or
              ::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 and ::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
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
oboe-2.7.1.7 lib/oboe/frameworks/rails/inst/connection_adapters/mysql.rb
oboe-2.7.1.7-java lib/oboe/frameworks/rails/inst/connection_adapters/mysql.rb
oboe-2.7.0.3-java lib/oboe/frameworks/rails/inst/connection_adapters/mysql.rb
oboe-2.7.0.3 lib/oboe/frameworks/rails/inst/connection_adapters/mysql.rb
oboe-2.6.8 lib/oboe/frameworks/rails/inst/connection_adapters/mysql.rb
oboe-2.6.7.1 lib/oboe/frameworks/rails/inst/connection_adapters/mysql.rb