Sha256: 1153218d71873a56340622ed27fc94448958845663cc1970ef54a246dbd6c202

Contents?: true

Size: 967 Bytes

Versions: 13

Compression:

Stored size: 967 Bytes

Contents

module ActiveRecord
  class Base
    def self.sqlserver_connection(config) #:nodoc:
      config = config.symbolize_keys
      config.reverse_merge! mode: :dblib
      mode = config[:mode].to_s.downcase.underscore.to_sym
      case mode
      when :dblib
        require 'tiny_tds'
      when :odbc
        raise ArgumentError, 'Missing :dsn configuration.' unless config.key?(:dsn)
        require 'odbc'
        require 'active_record/connection_adapters/sqlserver/core_ext/odbc'
      else
        raise ArgumentError, "Unknown connection mode in #{config.inspect}."
      end
      ConnectionAdapters::SQLServerAdapter.new(nil, logger, nil, config.merge(mode: mode))
    end

    def self.did_retry_sqlserver_connection(connection, count)
      logger.info "CONNECTION RETRY: #{connection.class.name} retry ##{count}."
    end

    def self.did_lose_sqlserver_connection(connection)
      logger.info "CONNECTION LOST: #{connection.class.name}"
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
activerecord-sqlserver-adapter-4.1.8 lib/active_record/sqlserver_base.rb
activerecord-sqlserver-adapter-4.0.4 lib/active_record/sqlserver_base.rb
activerecord-sqlserver-adapter-4.1.7 lib/active_record/sqlserver_base.rb
activerecord-sqlserver-adapter-4.0.3 lib/active_record/sqlserver_base.rb
activerecord-sqlserver-adapter-4.1.6 lib/active_record/sqlserver_base.rb
activerecord-sqlserver-adapter-4.0.2 lib/active_record/sqlserver_base.rb
activerecord-sqlserver-adapter-4.1.5 lib/active_record/sqlserver_base.rb
activerecord-sqlserver-adapter-4.1.4 lib/active_record/sqlserver_base.rb
activerecord-sqlserver-adapter-4.0.1 lib/active_record/sqlserver_base.rb
activerecord-sqlserver-adapter-4.1.2 lib/active_record/sqlserver_base.rb
activerecord-sqlserver-adapter-4.1.1 lib/active_record/sqlserver_base.rb
activerecord-sqlserver-adapter-4.1.0 lib/active_record/sqlserver_base.rb
activerecord-sqlserver-adapter-4.0.0 lib/active_record/sqlserver_base.rb