W3cubDocs

/Ruby on Rails 7.0

module ActiveRecord::ConnectionAdapters::MySQL::DatabaseStatements

Public Instance Methods

execute(sql, name = nil, async: false) Show source
# 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.

explain(arel, binds = []) Show source
# 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
high_precision_current_timestamp() Show source
# 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.