instance method
execute
Ruby on Rails 6.0.6
Since v5.2.8.1 Last seen in v7.0.10Signature
execute(sql, name = nil)
Executes the SQL statement in the context of this connection.
Parameters
-
sqlreq -
nameopt = nil
Source
# File activerecord/lib/active_record/connection_adapters/mysql/database_statements.rb, line 32
def execute(sql, name = nil)
if preventing_writes? && write_query?(sql)
raise ActiveRecord::ReadOnlyError, "Write query attempted while in readonly mode: #{sql}"
end
# 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
super
end
Defined in activerecord/lib/active_record/connection_adapters/mysql/database_statements.rb line 32
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::ConnectionAdapters::MySQL::DatabaseStatements