Skip to content

Commit

Permalink
Merge pull request #59 from lorint/rails_pr_48068
Browse files Browse the repository at this point in the history
Incorporate Rails PR #48068
  • Loading branch information
bensheldon authored Aug 12, 2023
2 parents f8a37b8 + fb24f0f commit 7968bd0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions lib/active_record/connection_adapters/trilogy_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,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
Expand All @@ -206,10 +206,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
Expand Down Expand Up @@ -327,7 +327,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
Expand Down

0 comments on commit 7968bd0

Please sign in to comment.