mirror of https://github.com/rails/rails
Merge pull request #51072 from eileencodes/raise-error-for-trilogy-and-prepared-statements
Raise error for Trilogy when `prepared_statements` is `true`
This commit is contained in:
commit
8e20f5d3b2
|
@ -83,6 +83,10 @@ module ActiveRecord
|
|||
# matched rather than number of rows updated.
|
||||
config[:found_rows] = true
|
||||
|
||||
if config[:prepared_statements]
|
||||
raise ArgumentError, "Trilogy currently doesn't support prepared statements. Remove `prepared_statements: true` from your database configuration."
|
||||
end
|
||||
|
||||
super
|
||||
end
|
||||
|
||||
|
|
|
@ -158,7 +158,7 @@ module ActiveRecord
|
|||
end
|
||||
end
|
||||
|
||||
unless in_memory_db?
|
||||
unless in_memory_db? || current_adapter?(:TrilogyAdapter)
|
||||
def test_disable_prepared_statements
|
||||
original_prepared_statements = ActiveRecord.disable_prepared_statements
|
||||
db_config = ActiveRecord::Base.configurations.configs_for(env_name: "arunit", name: "primary")
|
||||
|
|
|
@ -390,6 +390,12 @@ class TrilogyAdapterTest < ActiveRecord::TrilogyTestCase
|
|||
end
|
||||
end
|
||||
|
||||
test "setting prepared_statements to true raises" do
|
||||
assert_raises ArgumentError do
|
||||
ActiveRecord::ConnectionAdapters::TrilogyAdapter.new(prepared_statements: true).connect!
|
||||
end
|
||||
end
|
||||
|
||||
# Create a temporary subscription to verify notification is sent.
|
||||
# Optionally verify the notification payload includes expected types.
|
||||
def assert_notification(notification, expected_payload = {}, &block)
|
||||
|
|
Loading…
Reference in New Issue