Class: ActiveRecord::Base

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

Direct Known Subclasses

Rubyfb::SQLBinder

Class Method Summary collapse

Class Method Details

.rubyfb_connection(config) ⇒ Object

:nodoc:



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/active_record/connection_adapters/rubyfb_adapter.rb', line 48

def self.rubyfb_connection(config) # :nodoc:
  require 'rubyfb'
  config.symbolize_keys!
  db = Rubyfb::Database.new_from_config(config)
  connection_params = config.values_at(:username, :password)
  if config[:sql_role_name]
    connection_params << {Rubyfb::Connection::SQL_ROLE_NAME=>config[:sql_role_name]}
  end
  connection = db.connect(*connection_params)
  
  if ActiveRecord::VERSION::MAJOR >= 3 && ActiveRecord::VERSION::MINOR >= 1
    ConnectionAdapters::RubyfbAR31Adapter.new(connection, logger, connection_params)
  else
    ConnectionAdapters::RubyfbAdapter.new(connection, logger, connection_params)
  end
end