Class: AppMap::Rails::SQLHandler::SQLExaminer::ActiveRecordExaminer

Inherits:
Object
  • Object
show all
Defined in:
lib/appmap/rails/sql_handler.rb

Instance Method Summary collapse

Instance Method Details

#database_typeObject



80
81
82
83
84
85
# File 'lib/appmap/rails/sql_handler.rb', line 80

def database_type
  type = ActiveRecord::Base.connection.adapter_name.downcase.to_sym
  type = :postgres if type == :postgresql

  type
end

#execute_query(sql) ⇒ Object



87
88
89
# File 'lib/appmap/rails/sql_handler.rb', line 87

def execute_query(sql)
  ActiveRecord::Base.connection.execute(sql).inject([]) { |memo, r| memo << r; memo }
end

#server_versionObject



75
76
77
78
# File 'lib/appmap/rails/sql_handler.rb', line 75

def server_version
  ActiveRecord::Base.connection.try(:database_version) ||\
    warn("Unable to determine database version for #{database_type.inspect}")
end