Methods

Included Modules

Constants

ADAPTER_NAME = "Mysql2".freeze

Class Public methods

new(connection, logger, connection_options, config)

📝 Source code
# File activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb, line 39
      def initialize(connection, logger, connection_options, config)
        super
        @prepared_statements = false unless config.key?(:prepared_statements)
        configure_connection
      end
🔎 See on GitHub

Instance Public methods

active?()

📝 Source code
# File activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb, line 89
      def active?
        @connection.ping
      end
🔎 See on GitHub

disconnect!()

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

📝 Source code
# File activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb, line 102
      def disconnect!
        super
        @connection.close
      end
🔎 See on GitHub

error_number(exception)

📝 Source code
# File activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb, line 73
      def error_number(exception)
        exception.error_number if exception.respond_to?(:error_number)
      end
🔎 See on GitHub

quote_string(string)

📝 Source code
# File activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb, line 81
      def quote_string(string)
        @connection.escape(string)
      end
🔎 See on GitHub

reconnect!()

Also aliased as: reset!
📝 Source code
# File activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb, line 93
      def reconnect!
        super
        disconnect!
        connect
      end
🔎 See on GitHub

reset!()

Alias for: reconnect!

supports_comments?()

📝 Source code
# File activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb, line 49
      def supports_comments?
        true
      end
🔎 See on GitHub

supports_comments_in_create?()

📝 Source code
# File activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb, line 53
      def supports_comments_in_create?
        true
      end
🔎 See on GitHub

supports_json?()

📝 Source code
# File activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb, line 45
      def supports_json?
        !mariadb? && version >= "5.7.8"
      end
🔎 See on GitHub

supports_savepoints?()

📝 Source code
# File activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb, line 57
      def supports_savepoints?
        true
      end
🔎 See on GitHub