From bf7c0c01385b31c2b066207457c53390ff48a0b5 Mon Sep 17 00:00:00 2001 From: Lorin Thwaits Date: Sat, 5 Aug 2023 04:46:53 +0100 Subject: [PATCH 1/2] Incorporate rails/rails#48068 --- .../connection_adapters/trilogy/database_statements.rb | 4 ++-- lib/active_record/connection_adapters/trilogy_adapter.rb | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/active_record/connection_adapters/trilogy/database_statements.rb b/lib/active_record/connection_adapters/trilogy/database_statements.rb index 8a3669c..e3d48b1 100644 --- a/lib/active_record/connection_adapters/trilogy/database_statements.rb +++ b/lib/active_record/connection_adapters/trilogy/database_statements.rb @@ -122,11 +122,11 @@ def mark_transaction_written_if_write(sql) end end - def raw_execute(sql, name, async: false, uses_transaction: true) + def raw_execute(sql, name, async: false, materialize_transactions: true) log_kwargs = {} log_kwargs[:async] = async if ActiveRecord.version >= ::Gem::Version.new('7.0.a') log(sql, name, **log_kwargs) do - with_trilogy_connection(uses_transaction: uses_transaction) do |conn| + with_trilogy_connection(materialize_transactions: materialize_transactions) do |conn| sync_timezone_changes(conn) conn.query(sql) end diff --git a/lib/active_record/connection_adapters/trilogy_adapter.rb b/lib/active_record/connection_adapters/trilogy_adapter.rb index 2c64755..54e2c08 100644 --- a/lib/active_record/connection_adapters/trilogy_adapter.rb +++ b/lib/active_record/connection_adapters/trilogy_adapter.rb @@ -188,7 +188,7 @@ def supports_lazy_transactions? end def quote_string(string) - with_trilogy_connection(allow_retry: true, uses_transaction: false) do |conn| + with_trilogy_connection(allow_retry: true, materialize_transactions: false) do |conn| conn.escape(string) end end @@ -205,10 +205,10 @@ def reconnect! end end - def with_trilogy_connection(uses_transaction: true, **_kwargs) + def with_trilogy_connection(materialize_transactions: true, **_kwargs) @lock.synchronize do verify! - materialize_transactions if uses_transaction + materialize_transactions if materialize_transactions yield connection end end @@ -325,7 +325,7 @@ def full_version end def get_full_version - with_trilogy_connection(allow_retry: true, uses_transaction: false) do |conn| + with_trilogy_connection(allow_retry: true, materialize_transactions: false) do |conn| conn.server_info[:version] end end From fb24f0f358c99b25d4e66dcb149aedf5884adc87 Mon Sep 17 00:00:00 2001 From: Lorin Thwaits Date: Sat, 5 Aug 2023 05:09:08 +0100 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0634b5a..26d9149 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,16 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). ## [Unreleased] +### Changed + +- Remove translation of exception on reconnect. #49 +- Backport Rails 7.1a refactors and tweaks. #50, #51, #57, #58, #59 + +### Fixed + +- Fix #53 - Implement dbconsole support. #55 +- Fix #54 - Apply connection configuration. #56 + ## 3.1.0 ### Changed