class Airbrake::Filters::SqlFilter

@since v3.2.0
@api private
* Oracle
* Cassandra
* SQLite
* MySQL
* PostgreSQL
Supports the following SQL dialects:
and such).
data is everything that is not table names or fields (e.g. column values
SqlFilter filters out sensitive data from {Airbrake::Query}. Sensitive

def call(metric)

Parameters:
  • metric (Airbrake::Query) --
def call(metric)
  return unless metric.respond_to?(:query)
  query = metric.query
  if IGNORED_QUERIES.any? { |q| q =~ query }
    metric.ignore!
    return
  end
  q = query.gsub(@regexp, FILTERED)
  q.gsub!(POST_FILTER, FILTERED) if q =~ POST_FILTER
  q = ERROR_MSG if UNMATCHED_PAIR[@dialect] =~ q
  metric.query = q
end

def initialize(dialect)

def initialize(dialect)
  @dialect =
    case dialect
    when /mysql/i then :mysql
    when /postgres/i then :postgres
    when /sqlite/i then :sqlite
    when /oracle/i then :oracle
    when /cassandra/i then :cassandra
    else
      :default
    end
  features = DIALECT_FEATURES[@dialect].map { |f| ALL_FEATURES[f] }
  @regexp = Regexp.union(features)
end