Sha256: 59d57c45885255d339cb526eb34d16158795fd1ff25bd3083b880661926656c3
Contents?: true
Size: 1.17 KB
Versions: 22
Compression:
Stored size: 1.17 KB
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) do |opt| ret = nil begin result = ParserProvider.parser(:mysql, :mysql_alter_table).new.parse(normalized_query) if result.nil? $log.error("Received unsupported alter table query. normalized query:'#{normalized_query}', raw query: '#{record['query']}'") else ret = result.tree breaking_query = ret[:actions].any?{|action| !action.has_key?(:support_level) || action[:support_level] != :nonbreaking} opt[:increment_table_rev] = true if breaking_query end rescue => e msg = <<EOS Received unsupported alter table query. normalized query:'#{normalized_query}', raw 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
22 entries across 22 versions & 1 rubygems