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



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

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