Methods
- A
- C
- D
- E
- I
- L
- N
- Q
- R
- S
Constants
ADAPTER_NAME | = | 'Mysql2'.freeze |
MAX_INDEX_LENGTH_FOR_UTF8MB4 | = | 191 |
Class Public methods
new(connection, logger, connection_options, config)
Link
Instance Public methods
active?()
Link
disconnect!()
Link
Disconnects from the database if already connected. Otherwise, this method does nothing.
error_number(exception)
Link
exec_insert(sql, name, binds, pk = nil, sequence_name = nil)
Link
execute(sql, name = nil)
Link
Executes the SQL statement in the context of this connection.
# File activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb, line 224 def execute(sql, name = nil) if @connection # make sure we carry over any changes to ActiveRecord::Base.default_timezone that have been # made since we established the connection @connection.query_options[:database_timezone] = ActiveRecord::Base.default_timezone end super end
explain(arel, binds = [])
Link
# File activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb, line 115 def explain(arel, binds = []) sql = "EXPLAIN #{to_sql(arel, binds.dup)}" start = Time.now result = exec_query(sql, 'EXPLAIN', binds) elapsed = Time.now - start ExplainPrettyPrinter.new.pp(result, elapsed) end
initialize_schema_migrations_table()
Link
# File activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb, line 41 def initialize_schema_migrations_table if charset == 'utf8mb4' ActiveRecord::SchemaMigration.create_table(MAX_INDEX_LENGTH_FOR_UTF8MB4) else ActiveRecord::SchemaMigration.create_table end end
insert_sql(sql, name = nil, pk = nil, id_value = nil, sequence_name = nil)
Link
Also aliased as: create
last_inserted_id(result)
Link
quote_string(string)
Link
quoted_date(value)
Link
select_rows(sql, name = nil, binds = [])
Link
Returns an array of arrays containing the field values. Order is the same
as that returned by columns
.