instance method exec_query

Ruby on Rails 3.1.12

Since v3.1.12 Last seen in v4.2.9 Private

Available in: v3.1.12 v3.2.22.5 v4.0.13 v4.1.16 v4.2.9

Signature

exec_query(sql, name = 'SQL', binds = [])

No documentation comment.

Parameters

sql req
name opt = 'SQL'
binds opt = []
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

Defined in ActiveRecord::ConnectionAdapters::Mysql2Adapter

Type at least 2 characters to search.

↑↓ navigate · open · esc close