rails-sqlserver / activerecord-sqlserver-adapter

SQL Server Adapter For Rails
MIT License
968 stars 558 forks source link

Fix EXPLAIN queries #1076

Closed aidanharan closed 10 months ago

aidanharan commented 11 months ago

Updated explain methods to handle options. Fixes errors such as:

https://pipelines.actions.githubusercontent.com/serviceHosts/3cfa8887-b415-43d0-9425-f913b8e254ac/_apis/pipelines/1/runs/672/signedlogcontent/2?urlExpires=2023-08-10T15%3A35%3A25.4741745Z&urlSigningMethod=HMACV1&urlSignature=dYlgd4i%2FnT6lf7U4CZcBEc79PKzLJCagMq6D6273%2BRM%3D

2023-08-10T14:21:17.1854051Z BasePreventWritesTest#test_0005_an explain query does not raise if preventing writes:
2023-08-10T14:21:17.1854479Z ArgumentError: wrong number of arguments (given 2, expected 1)
2023-08-10T14:21:17.1855390Z     activerecord-sqlserver-adapter/lib/active_record/connection_adapters/sqlserver/core_ext/explain.rb:11:in `exec_explain'
2023-08-10T14:21:17.1855913Z     rails (6dd4579bcbca) activerecord/lib/active_record/relation.rb:254:in `explain'
2023-08-10T14:21:17.1856435Z     rails (6dd4579bcbca) activerecord/test/cases/base_prevent_writes_test.rb:54:in `block (3 levels) in <class:BasePreventWritesTest>'
2023-08-10T14:21:17.1857071Z     rails (6dd4579bcbca) activesupport/lib/active_support/testing/assertions.rb:49:in `assert_nothing_raised'
2023-08-10T14:21:17.1857583Z     rails (6dd4579bcbca) activesupport/lib/active_support/testing/assertions.rb:266:in `_assert_nothing_raised_or_warn'
2023-08-10T14:21:17.1858058Z     rails (6dd4579bcbca) activerecord/test/cases/test_case.rb:63:in `assert_queries'
2023-08-10T14:21:17.1858561Z     rails (6dd4579bcbca) activerecord/test/cases/base_prevent_writes_test.rb:54:in `block (2 levels) in <class:BasePreventWritesTest>'
2023-08-10T14:21:17.1859064Z     rails (6dd4579bcbca) activerecord/lib/active_record/connection_handling.rb:361:in `with_role_and_shard'
2023-08-10T14:21:17.1859541Z     rails (6dd4579bcbca) activerecord/lib/active_record/connection_handling.rb:147:in `connected_to'
2023-08-10T14:21:17.1860024Z     rails (6dd4579bcbca) activerecord/lib/active_record/connection_handling.rb:222:in `while_preventing_writes'
2023-08-10T14:21:17.1860548Z     rails (6dd4579bcbca) activerecord/test/cases/base_prevent_writes_test.rb:53:in `block in <class:BasePreventWritesTest>'