class ActiveRecord::ConnectionAdapters::Mysql2Adapter

Parent:
ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter
Included modules:
ActiveRecord::ConnectionAdapters::MySQL::DatabaseStatements

Constants

ADAPTER_NAME

Public Class Methods

new(connection, logger, connection_options, config) Show source
# File activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb, line 38
def initialize(connection, logger, connection_options, config)
  super
  @prepared_statements = false unless config.key?(:prepared_statements)
  configure_connection
end

Public Instance Methods

active?() Show source
# File activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb, line 88
def active?
  @connection.ping
end
disconnect!() Show source
# File activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb, line 101
def disconnect!
  super
  @connection.close
end

Disconnects from the database if already connected. Otherwise, this method does nothing.

error_number(exception) Show source
# File activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb, line 72
def error_number(exception)
  exception.error_number if exception.respond_to?(:error_number)
end
quote_string(string) Show source
# File activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb, line 80
def quote_string(string)
  @connection.escape(string)
end
reconnect!() Show source
# File activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb, line 92
def reconnect!
  super
  disconnect!
  connect
end
Also aliased as: reset!
reset!()
Alias for: reconnect!
supports_comments?() Show source
# File activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb, line 48
def supports_comments?
  true
end
supports_comments_in_create?() Show source
# File activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb, line 52
def supports_comments_in_create?
  true
end
supports_json?() Show source
# File activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb, line 44
def supports_json?
  !mariadb? && version >= "5.7.8"
end
supports_savepoints?() Show source
# File activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb, line 56
def supports_savepoints?
  true
end

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