Spec-Zone.ru › Ruby on Rails 5.0

класс ActiveRecord::ConnectionAdapters::Mysql2Adapter

Родитель:
ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter
Включенные модули:
ActiveRecord::ConnectionAdapters::MySQL::DatabaseStatements

Константы

ADAPTER_NAME

Открытые методы класса

new(connection, logger, connection_options, config) Показать исходный код
# File activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb, line 42
def initialize(connection, logger, connection_options, config)
  super
  @prepared_statements = false unless config.key?(:prepared_statements)
  configure_connection
end
Вызывает метод родительского класса ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter.new

Открытые методы экземпляра

active?() Показать исходный код
# File activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb, line 92
def active?
  @connection.ping
end
disconnect!() Показать исходный код
# File activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb, line 105
def disconnect!
  super
  @connection.close
end

Отключается от базы данных, если уже подключен. В противном случае этот метод ничего не делает.

Вызывает метод родительского класса ActiveRecord::ConnectionAdapters::AbstractAdapter#disconnect!
error_number(exception) Показать исходный код
# File activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb, line 76
def error_number(exception)
  exception.error_number if exception.respond_to?(:error_number)
end
quote_string(string) Показать исходный код
# File activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb, line 84
def quote_string(string)
  @connection.escape(string)
end
reconnect!() Показать исходный код
# File activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb, line 96
def reconnect!
  super
  disconnect!
  connect
end
Вызывает метод родительского класса ActiveRecord::ConnectionAdapters::AbstractAdapter#reconnect!
Также алиас: reset!
reset!()
Псевдоним для: reconnect!
supports_comments?() Показать исходный код
# File activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb, line 52
def supports_comments?
  true
end
supports_comments_in_create?() Показать исходный код
# File activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb, line 56
def supports_comments_in_create?
  true
end
supports_json?() Показать исходный код
# File activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb, line 48
def supports_json?
  !mariadb? && version >= '5.7.8'
end
supports_savepoints?() Показать исходный код
# File activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb, line 60
def supports_savepoints?
  true
end

© 2004–2018 David Heinemeier Hansson
Licensed under the MIT License.

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API