class NewRelic::Agent::Database::Statement

Constants

MYSQL_PREFIX
POSTGRES_PREFIX
SQLITE_PREFIX

Attributes

config[RW]
explainer[RW]
sql[RW]

Public Class Methods

new(sql, config={}, explainer=nil) click to toggle source
# File lib/new_relic/agent/database.rb, line 322
def initialize(sql, config={}, explainer=nil)
  @sql = Database.capture_query(sql)
  @config = config
  @explainer = explainer
end

Public Instance Methods

adapter() click to toggle source
# File lib/new_relic/agent/database.rb, line 328
def adapter
  config && config[:adapter] && symbolized_adapter(config[:adapter].to_s.downcase)
end
symbolized_adapter(adapter) click to toggle source
# File lib/new_relic/agent/database.rb, line 336
def symbolized_adapter(adapter)
  if adapter.start_with? POSTGRES_PREFIX
    :postgres
  elsif adapter.start_with? MYSQL_PREFIX
    :mysql
  elsif adapter.start_with? SQLITE_PREFIX
    :sqlite
  else
    adapter.to_sym
  end
end