Class: Connectator::MySQL::Connection

Inherits:
Base::Connection show all
Includes:
UsingDBIProxy
Defined in:
lib/connectator/mysql/connection.rb

Instance Attribute Summary

Attributes inherited from Base::Connection

#error

Instance Method Summary collapse

Methods inherited from Base::Connection

#connection_params, #method_missing, #ping?, #valid?, #valid_system_connection?

Constructor Details

#initialize(opts = {}) ⇒ Connection

Returns a new instance of Connection.



6
7
8
9
10
11
12
13
14
# File 'lib/connectator/mysql/connection.rb', line 6

def initialize(opts = {})
  super(opts)
  connection_params.driver   = 'MySQL'
  # See this url for options flags
  # http://dev.mysql.com/doc/refman/5.0/en/connector-odbc-configuration-connection-parameters.html#codbc-dsn-option-flags
  connection_params.port     ||= '3306'
  connection_params.option   = opts[:option]   || '3'
  connection_params.database = opts[:database]
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Connectator::Base::Connection

Instance Method Details

#connection_stringObject



16
17
18
# File 'lib/connectator/mysql/connection.rb', line 16

def connection_string
  "DBI:ODBC:#{connection_params_list}"
end