instance method
exec_query
Ruby on Rails 3.1.12
Since v3.1.12 Last seen in v4.2.9 PrivateSignature
exec_query(sql, name = 'SQL', binds = [])
No documentation comment.
Parameters
-
sqlreq -
nameopt = 'SQL' -
bindsopt = []
Source
# File activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb, line 694
def exec_query(sql, name = 'SQL', binds = [])
@connection.query_options[:database_timezone] = ActiveRecord::Base.default_timezone
log(sql, name, binds) do
begin
result = @connection.query(sql)
rescue ActiveRecord::StatementInvalid => exception
if exception.message.split(":").first =~ /Packets out of order/
raise ActiveRecord::StatementInvalid, "'Packets out of order' error was received from the database. Please update your mysql bindings (gem install mysql) and read http://dev.mysql.com/doc/mysql/en/password-hashing.html for more information. If you're on Windows, use the Instant Rails installer to get the updated mysql bindings."
else
raise
end
end
ActiveRecord::Result.new(result.fields, result.to_a)
end
end
Defined in activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb line 694
· View on GitHub
· Improve this page
· Find usages on GitHub