Sha256: 76987b1459607085e6f2bf71e55165901c87291f1c6cff532015641bdce748d4

Contents?: true

Size: 1.89 KB

Versions: 11

Compression:

Stored size: 1.89 KB

Contents

module ActiveRecord
  module Bulkoperation
    AdapterPath = 'activerecord_bulkoperation/active_record/adapters'

    def self.base_adapter(adapter)
      case adapter
      when 'mysqlspatial' then 'mysql'
      when 'mysql2spatial' then 'mysql2'
      when 'spatialite' then 'sqlite3'
      when 'oracle_enhanced' then 'oracle_enhanced'
      else adapter
      end
    end

    # Loads the import functionality for a specific database adapter
    def self.require_adapter(adapter)
      require File.join(AdapterPath,'/abstract_adapter')
      begin
        require File.join(AdapterPath,"/#{base_adapter(adapter)}_adapter")
      rescue LoadError
        # fallback
      end
    end

    # Loads the import functionality for the passed in ActiveRecord connection
    def self.load_from_connection_pool(connection_pool)
      require_adapter connection_pool.spec.config[:adapter]
    end
  end
end

# if MRI or YARV
if !defined?(RUBY_ENGINE) || RUBY_ENGINE == 'ruby'
  ORACLE_ENHANCED_CONNECTION = :oci if ORACLE_ENHANCED_CONNECTION != :oci
  require 'activerecord_bulkoperation/connection_adapters/oracle_enhanced/oci_connection'
# if JRuby
elsif RUBY_ENGINE == 'jruby'
  ORACLE_ENHANCED_CONNECTION = :jdbc if ORACLE_ENHANCED_CONNECTION != :jdbc
  require 'activerecord_bulkoperation/connection_adapters/oracle_enhanced/jdbc_connection'
else
  raise "Unsupported Ruby engine #{RUBY_ENGINE}"
end

require 'activerecord_bulkoperation/bulkoperation'
require 'activerecord_bulkoperation/active_record/associations/associations'
require 'activerecord_bulkoperation/group_operations'
require 'activerecord_bulkoperation/group_operations_select'
require 'activerecord_bulkoperation/util/sequence_cache'
require 'activerecord_bulkoperation/util/entity_hash'
require 'activerecord_bulkoperation/util/transaction_object'
require 'activerecord_bulkoperation/util/connection_object'
require 'activerecord_bulkoperation/util/flush_dirty_objects'

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
activerecord_bulkoperation-0.2.2 lib/activerecord_bulkoperation/base.rb
activerecord_bulkoperation-0.2.1 lib/activerecord_bulkoperation/base.rb
activerecord_bulkoperation-0.2.0 lib/activerecord_bulkoperation/base.rb
activerecord_bulkoperation-0.1.0 lib/activerecord_bulkoperation/base.rb
activerecord_bulkoperation-0.0.8 lib/activerecord_bulkoperation/base.rb
activerecord_bulkoperation-0.0.7 lib/activerecord_bulkoperation/base.rb
activerecord_bulkoperation-0.0.6 lib/activerecord_bulkoperation/base.rb
activerecord_bulkoperation-0.0.5 lib/activerecord_bulkoperation/base.rb
activerecord_bulkoperation-0.0.4 lib/activerecord_bulkoperation/base.rb
activerecord_bulkoperation-0.0.3 lib/activerecord_bulkoperation/base.rb
activerecord_bulkoperation-0.0.2 lib/activerecord_bulkoperation/base.rb