edge badge
Methods
A
D
E
N
Q
R
S
Included Modules
Constants
ADAPTER_NAME = 'Mysql2'.freeze
 
Class Public methods
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
Instance Public methods
active?()
# File activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb, line 92
def active?
  return false unless @connection
  @connection.ping
end
disconnect!()

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

# File activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb, line 106
def disconnect!
  super
  unless @connection.nil?
    @connection.close
    @connection = nil
  end
end
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!()
Also aliased as: reset!
# File activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb, line 97
def reconnect!
  super
  disconnect!
  connect
end
reset!()
Alias for: 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