Class: ActiveRecord::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/active_record/connection_adapters/odbc_adapter.rb

Class Method Summary collapse

Class Method Details

.odbc_connection(config) ⇒ Object

Build a new ODBC connection with the given configuration.



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/active_record/connection_adapters/odbc_adapter.rb', line 22

def odbc_connection(config)
  config = config.symbolize_keys

  connection, config =
    if config.key?(:dsn)
      odbc_dsn_connection(config)
    elsif config.key?(:conn_str)
      odbc_conn_str_connection(config)
    else
      raise ArgumentError, 'No data source name (:dsn) or connection string (:conn_str) specified.'
    end

   = ::ODBCAdapter::DatabaseMetadata.new(connection, config[:encoding_bug])
  .adapter_class.new(connection, logger, config, )
end