Sha256: 07d7cbf4f7080c5d84eb113df95685fe940d7b1e283cc27a62d9736ae15975a3

Contents?: true

Size: 931 Bytes

Versions: 5

Compression:

Stored size: 931 Bytes

Contents

require 'flydata/parser_provider'
require_relative 'ddl_query_handler'

module Mysql
  class AlterTableQueryHandler < DdlQueryHandler
    PATTERN = /^ALTER TABLE/i

    def initialize(context)
      super
    end

    def pattern
      PATTERN
    end

    def process(record, normalized_query)
      emit_record(:alter_table, record, increment_table_rev: true) do
        ret = nil
        begin
          result = ParserProvider.parser(:mysql, :mysql_alter_table).new.parse(record['query'])
          if result.nil?
            $log.warn("Received unsupported alter table query. query:'#{record['query']}'")
          else
            ret = result.tree
          end
        rescue => e
          msg = <<EOS
Received unsupported alter table query. query:'#{record['query']}'
  Caused by error '#{e.to_s}'
  Stacktrace :
#{e.backtrace.join("\n")}
EOS
          $log.error(msg)
        end
        ret
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
flydata-0.2.7 lib/flydata/fluent-plugins/mysql/alter_table_query_handler.rb
flydata-0.2.6 lib/flydata/fluent-plugins/mysql/alter_table_query_handler.rb
flydata-0.2.5 lib/flydata/fluent-plugins/mysql/alter_table_query_handler.rb
flydata-0.2.4 lib/flydata/fluent-plugins/mysql/alter_table_query_handler.rb
flydata-0.2.3 lib/flydata/fluent-plugins/mysql/alter_table_query_handler.rb