Class: Flydata::SourceMysql::PluginSupport::UnsupportedQueryHandler
- Inherits:
-
TableDdlQueryHandler
- Object
- BinlogRecordHandler
- BinlogQueryHandler
- DdlQueryHandler
- TableDdlQueryHandler
- Flydata::SourceMysql::PluginSupport::UnsupportedQueryHandler
- Defined in:
- lib/flydata/source_mysql/plugin_support/unsupported_query_handler.rb
Constant Summary collapse
- PATTERN =
Catch all ddl
/.*/
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
Instance Method Summary collapse
-
#initialize(context) ⇒ UnsupportedQueryHandler
constructor
A new instance of UnsupportedQueryHandler.
- #pattern ⇒ Object
- #process(record) ⇒ Object
- #should_log?(query) ⇒ Boolean
Methods inherited from DdlQueryHandler
#acceptable_db?, #emit_record, #table_info
Methods included from PluginSupport::SyncRecordEmittable
Constructor Details
#initialize(context) ⇒ UnsupportedQueryHandler
Returns a new instance of UnsupportedQueryHandler.
11 12 13 |
# File 'lib/flydata/source_mysql/plugin_support/unsupported_query_handler.rb', line 11 def initialize(context) super end |
Instance Method Details
#pattern ⇒ Object
15 16 17 |
# File 'lib/flydata/source_mysql/plugin_support/unsupported_query_handler.rb', line 15 def pattern PATTERN end |
#process(record) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/flydata/source_mysql/plugin_support/unsupported_query_handler.rb', line 19 def process(record) query = record['normalized_query'] if acceptable_db?(record) && should_log?(query) $log.info({ type: :unsupported_query, query: query.to_s.strip}.to_s + " at \"#{binlog_pos(record)}\"") end end |
#should_log?(query) ⇒ Boolean
26 27 28 29 |
# File 'lib/flydata/source_mysql/plugin_support/unsupported_query_handler.rb', line 26 def should_log?(query) return false if query.to_s.empty? @context.tables.any?{|tbl| query.include?(tbl)} end |