Class: Mysql::TruncateTableQueryHandler

Inherits:
DdlQueryHandler show all
Defined in:
lib/flydata/fluent-plugins/mysql/truncate_table_query_handler.rb

Constant Summary collapse

PATTERN =
/^TRUNCATE/i

Constants inherited from DdlQueryHandler

DdlQueryHandler::DDL_TABLE_QUERY

Constants inherited from BinlogRecordHandler

BinlogRecordHandler::RESPECT_ORDER, BinlogRecordHandler::SEQ, BinlogRecordHandler::SRC_POS, BinlogRecordHandler::TABLE_NAME, BinlogRecordHandler::TABLE_REV, BinlogRecordHandler::TYPE, BinlogRecordHandler::V

Instance Method Summary collapse

Methods inherited from DdlQueryHandler

#acceptable_db?, #table_info

Constructor Details

#initialize(context) ⇒ TruncateTableQueryHandler

Returns a new instance of TruncateTableQueryHandler.


8
9
10
# File 'lib/flydata/fluent-plugins/mysql/truncate_table_query_handler.rb', line 8

def initialize(context)
  super
end

Instance Method Details

#patternObject


12
13
14
# File 'lib/flydata/fluent-plugins/mysql/truncate_table_query_handler.rb', line 12

def pattern
  PATTERN
end

#process(record) ⇒ Object


16
17
18
19
20
21
22
23
# File 'lib/flydata/fluent-plugins/mysql/truncate_table_query_handler.rb', line 16

def process(record)
  emit_record(:truncate_table, record) do |opt|
    {
      table_name: table_info(record)[:table_name],
      query: record["query"]
    }
  end
end