Class: ActiveRecord::ConnectionAdapters::Sqlserver::CoreExt::ExplainSubscriber
- Inherits:
-
Object
- Object
- ActiveRecord::ConnectionAdapters::Sqlserver::CoreExt::ExplainSubscriber
- Defined in:
- lib/active_record/connection_adapters/sqlserver/core_ext/explain_subscriber.rb
Constant Summary collapse
- IGNORED_PAYLOADS =
%w(SCHEMA EXPLAIN CACHE)
- SQLSERVER_EXPLAINED_SQLS =
/(select|update|delete|insert)/i
Instance Method Summary collapse
- #call(*args) ⇒ Object
-
#ignore_sqlserver_payload?(payload) ⇒ Boolean
Need to modify the regex for the TSQL generated by this adapter so we can explain the proper sql statements.
Instance Method Details
#call(*args) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/active_record/connection_adapters/sqlserver/core_ext/explain_subscriber.rb', line 6 def call(*args) if queries = Thread.current[:available_queries_for_explain] payload = args.last queries << payload.values_at(:sql, :binds) unless ignore_sqlserver_payload?(payload) end end |
#ignore_sqlserver_payload?(payload) ⇒ Boolean
Need to modify the regex for the TSQL generated by this adapter so we can explain the proper sql statements
17 18 19 |
# File 'lib/active_record/connection_adapters/sqlserver/core_ext/explain_subscriber.rb', line 17 def ignore_sqlserver_payload?(payload) payload[:exception] || IGNORED_PAYLOADS.include?(payload[:name]) || payload[:sql] !~ SQLSERVER_EXPLAINED_SQLS end |