sql(event)
public

No documentation available.

# File activerecord/lib/active_record/structured_event_subscriber.rb, line 21
    def sql(event)
      payload = event.payload

      return if IGNORE_PAYLOAD_NAMES.include?(payload[:name])

      binds = nil

      if payload[:binds]&.any?
        casted_params = type_casted_binds(payload[:type_casted_binds])

        binds = []
        payload[:binds].each_with_index do |attr, i|
          attribute_name = if attr.respond_to?(:name)
            attr.name
          elsif attr.respond_to?(:[]) && attr[i].respond_to?(:name)
            attr[i].name
          else
            nil
          end

          filtered_params = filter(attribute_name, casted_params[i])

          binds << render_bind(attr, filtered_params)
        end
      end

      emit_debug_event("active_record.sql",
        async: payload[:async],
        name: payload[:name],
        sql: payload[:sql],
        cached: payload[:cached],
        lock_wait: payload[:lock_wait],
        binds: binds,
        duration_ms: event.duration.round(2),
      )
    end