Module: ActiveRecord::ConnectionAdapters::SQLServer::CoreExt::Explain

Defined in:
lib/active_record/connection_adapters/sqlserver/core_ext/explain.rb

Constant Summary collapse

SQLSERVER_STATEMENT_PREFIX =
"EXEC sp_executesql "
SQLSERVER_STATEMENT_REGEXP =
/N'(.+)', N'(.+)', (.+)/

Instance Method Summary collapse

Instance Method Details

#exec_explain(queries, options = []) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/active_record/connection_adapters/sqlserver/core_ext/explain.rb', line 11

def exec_explain(queries, options = [])
  with_connection do |connection|
    return super(queries, options) unless connection.sqlserver?

    unprepared_queries = queries.map do |(sql, binds)|
      [unprepare_sqlserver_statement(sql, binds), binds]
    end

    super(unprepared_queries, options)
  end
end