Module: ActiveRecord::ConnectionAdapters::Sqlserver::Showplan

Included in:
ActiveRecord::ConnectionAdapters::SQLServerAdapter
Defined in:
lib/active_record/connection_adapters/sqlserver/showplan.rb,
lib/active_record/connection_adapters/sqlserver/showplan/printer_xml.rb,
lib/active_record/connection_adapters/sqlserver/showplan/printer_table.rb

Defined Under Namespace

Classes: PrinterTable, PrinterXml

Constant Summary collapse

OPTION_ALL =
'SHOWPLAN_ALL'
OPTION_TEXT =
'SHOWPLAN_TEXT'
OPTION_XML =
'SHOWPLAN_XML'
OPTIONS =
[OPTION_ALL, OPTION_TEXT, OPTION_XML]

Instance Method Summary collapse

Instance Method Details

#explain(arel, binds = []) ⇒ Object



14
15
16
17
18
19
# File 'lib/active_record/connection_adapters/sqlserver/showplan.rb', line 14

def explain(arel, binds = [])
  sql = to_sql(arel)
  result = with_showplan_on { do_exec_query(sql, 'EXPLAIN', binds) }
  printer = showplan_printer.new(result)
  printer.pp
end