Class: Flydata::SourceMysql::PluginSupport::CreateTableQueryHandler

Inherits:
TableDdlQueryHandler show all
Defined in:
lib/flydata/source_mysql/plugin_support/create_table_query_handler.rb

Constant Summary collapse

PATTERN =
/^CREATE TABLE/i

Constants inherited from DdlQueryHandler

DdlQueryHandler::DDL_TABLE_QUERY

Constants included from PluginSupport::SyncRecordEmittable

PluginSupport::SyncRecordEmittable::RESPECT_ORDER, PluginSupport::SyncRecordEmittable::SEQ, PluginSupport::SyncRecordEmittable::SRC_POS, PluginSupport::SyncRecordEmittable::TABLE_NAME, PluginSupport::SyncRecordEmittable::TABLE_REV, PluginSupport::SyncRecordEmittable::TYPE, PluginSupport::SyncRecordEmittable::V

Instance Attribute Summary

Attributes included from PluginSupport::SyncRecordEmittable

#context

Instance Method Summary collapse

Methods inherited from DdlQueryHandler

#acceptable_db?, #emit_record, #table_info

Methods included from PluginSupport::SyncRecordEmittable

#emit_sync_records

Constructor Details

#initialize(context) ⇒ CreateTableQueryHandler

Returns a new instance of CreateTableQueryHandler.



10
11
12
# File 'lib/flydata/source_mysql/plugin_support/create_table_query_handler.rb', line 10

def initialize(context)
  super
end

Instance Method Details

#patternObject



14
15
16
# File 'lib/flydata/source_mysql/plugin_support/create_table_query_handler.rb', line 14

def pattern
  PATTERN
end

#process(record) ⇒ Object



18
19
20
21
22
23
# File 'lib/flydata/source_mysql/plugin_support/create_table_query_handler.rb', line 18

def process(record)
  if acceptable_db?(record)
    $log.error "CREATE TABLE detected. Please reset and resync the following table:'#{table_info(record)[:table_name]}'. - query:'#{record["query"]}' binlog_pos:'#{binlog_pos(record)}'"
  end
  #NOTE: No emit_record here because this record should not be sent to data servers for now
end