Sha256: 10a87eab9e764cd24216f5f7823ac853ae1293d14751428e5a0a53ab220a3885
Contents?: true
Size: 809 Bytes
Versions: 29
Compression:
Stored size: 809 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) supported_database == table_info(record)[:db_name] end def table_info(record) table_info = { db_name: record["db_name"], table_name: nil } if DDL_TABLE_QUERY =~ record["normalized_query"] table_name_in_query = ($1 ? $1 : $2).tr("`", "") if (idx = table_name_in_query.index(".")) table_info[:db_name] = table_name_in_query[0...idx] table_info[:table_name] = table_name_in_query[idx+1..-1] else table_info[:table_name] = table_name_in_query end end table_info end end end
Version data entries
29 entries across 29 versions & 1 rubygems