method

exec_query

Importance_0
v3.1.0 - Show latest stable - 0 notes - Class: Mysql2Adapter
exec_query(sql, name = 'SQL', binds = []) private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb, line 681
        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
Register or log in to add new notes.