Sha256: 46e1f9371d5ca60abe06af659904383c291392813e38aad14c311fe1f749278a

Contents?: true

Size: 563 Bytes

Versions: 1

Compression:

Stored size: 563 Bytes

Contents

require 'flydata/fluent-plugins/mysql/binlog_query_handler'

module Mysql

class DdlQueryHandler < BinlogQueryHandler
  DDL_TABLE_QUERY = /^(?:(?:ALTER|CREATE|DROP|RENAME) +(?:\w+ +)*TABLE +([^ ]+)|TRUNCATE +(?:TABLE +)?([^ ]+))/i

  def acceptable_db?(record)
    db_name = record["db_name"]
    if DDL_TABLE_QUERY =~ record["normalized_query"]
      table_name_in_query = $1 ? $1 : $2

      if (idx = table_name_in_query.index("."))
        db_name = table_name_in_query[0...idx].tr("`", "")
      end
    end

    supported_database == db_name
  end
end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
flydata-0.3.11 lib/flydata/fluent-plugins/mysql/ddl_query_handler.rb