Flowdock
method

exec_without_stmt

Importance_0
v4.0.2 - Show latest stable - 0 notes - Class: ActiveRecord::ConnectionAdapters::MysqlAdapter
exec_without_stmt(sql, name = 'SQL') public

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/mysql_adapter.rb, line 419
      def exec_without_stmt(sql, name = 'SQL') # :nodoc:
        # Some queries, like SHOW CREATE TABLE don't work through the prepared
        # statement API. For those queries, we need to use this method. :'(
        log(sql, name) do
          result = @connection.query(sql)
          affected_rows = @connection.affected_rows

          if result
            types = {}
            result.fetch_fields.each { |field|
              if field.decimals > 0
                types[field.name] = Fields::Decimal.new
              else
                types[field.name] = Fields.find_type field
              end
            }
            result_set = ActiveRecord::Result.new(types.keys, result.to_a, types)
            result.free
          else
            result_set = ActiveRecord::Result.new([], [])
          end

          [result_set, affected_rows]
        end
      end
Register or log in to add new notes.