On this page
module ActiveRecord::ConnectionAdapters::MySQL::DatabaseStatements
Public Instance Methods
# File activerecord/lib/active_record/connection_adapters/mysql/database_statements.rb, line 43
def execute(sql, name = nil, async: false)
sql = transform_query(sql)
check_if_write_query(sql)
raw_execute(sql, name, async: async)
end
Executes the SQL statement in the context of this connection.
# File activerecord/lib/active_record/connection_adapters/mysql/database_statements.rb, line 33
def explain(arel, binds = [])
sql = "EXPLAIN #{to_sql(arel, binds)}"
start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
result = exec_query(sql, "EXPLAIN", binds)
elapsed = Process.clock_gettime(Process::CLOCK_MONOTONIC) - start
MySQL::ExplainPrettyPrinter.new.pp(result, elapsed)
end
# File activerecord/lib/active_record/connection_adapters/mysql/database_statements.rb, line 86
def high_precision_current_timestamp
HIGH_PRECISION_CURRENT_TIMESTAMP
end
© 2004–2021 David Heinemeier Hansson
Licensed under the MIT License.