Sha256: 0372d39299cb3e6d66e37af8db1c7930c9cc993526cecdf570d6d6d699aa500b

Contents?: true

Size: 715 Bytes

Versions: 12

Compression:

Stored size: 715 Bytes

Contents

require "influxdb/rails/sql/normalizer"

module InfluxDB
  module Rails
    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.upcase
          @name = payload[:name].to_s.dup
        end

        def operation
          query.split.first
        end

        def class_name
          name.split.first
        end

        def track?
          @track ||= query.start_with?(*TRACKED_SQL_COMMANDS) &&
                     !name.upcase.start_with?(*UNTRACKED_NAMES)
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 3 rubygems

Version Path
influxdb-rails-1.0.3 lib/influxdb/rails/sql/query.rb
influxdb-rails-1.0.2 lib/influxdb/rails/sql/query.rb
influxdb-rails-1.0.1 lib/influxdb/rails/sql/query.rb
influxdb-rails-1.0.1.beta3 lib/influxdb/rails/sql/query.rb
influxdb-rails-1.0.1.beta2 lib/influxdb/rails/sql/query.rb
influxdb-rails-1.0.1.beta1 lib/influxdb/rails/sql/query.rb
influxdb-rails-1.0.0 lib/influxdb/rails/sql/query.rb
asklytics-influxdb-rails-1.0.0 lib/influxdb/rails/sql/query.rb
asklytics-influxdb-rails-1.0.0.beta3 lib/influxdb/rails/sql/query.rb
influxdb-rails-1.0.0.beta4 lib/influxdb/rails/sql/query.rb
experimental-influxdb-rails-1.0.0.beta5 lib/influxdb/rails/sql/query.rb
influxdb-rails-1.0.0.beta3 lib/influxdb/rails/sql/query.rb