lib/influxdb/rails/sql/query.rb in influxdb-rails-1.0.0.beta2 vs lib/influxdb/rails/sql/query.rb in influxdb-rails-1.0.0.beta3
- old
+ new
@@ -5,25 +5,27 @@
module Sql
class Query # :nodoc:
attr_reader :query, :name
TRACKED_SQL_COMMANDS = %w[SELECT INSERT UPDATE DELETE].freeze
+ UNTRACKED_NAMES = %w[SCHEMA].freeze
def initialize(payload)
- @query = payload[:sql].to_s.dup
+ @query = payload[:sql].to_s.dup.upcase
@name = payload[:name].to_s.dup
end
def operation
- query.split.first.upcase
+ query.split.first
end
def class_name
name.split.first
end
def track?
- @track ||= query.start_with?(*TRACKED_SQL_COMMANDS)
+ @track ||= query.start_with?(*TRACKED_SQL_COMMANDS) &&
+ !name.upcase.start_with?(*UNTRACKED_NAMES)
end
end
end
end
end