Skip to content

Commit

Permalink
[Fixes trilogy-libraries#54] Apply connection configuration when conn…
Browse files Browse the repository at this point in the history
…ecting
  • Loading branch information
lorint committed Jul 19, 2023
1 parent c85a2b2 commit b654761
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/active_record/connection_adapters/trilogy_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ def error_number(exception)

def connect
self.connection = self.class.new_client(@config)
configure_connection
end

def reconnect
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,12 @@ class Post < ActiveRecord::Base; end
assert adapter.active?
end

test "sql_mode is applied correctly" do
adapter = trilogy_adapter(variables: { sql_mode: "STRICT_ALL_TABLES" })
current_sql_mode = adapter.execute('SELECT @@SESSION.sql_mode;').rows.first
assert_equal current_sql_mode, ["STRICT_ALL_TABLES"]
end

def trilogy_adapter_with_connection(connection, **config_overrides)
ActiveRecord::ConnectionAdapters::TrilogyAdapter
.new(connection, nil, {}, @configuration.merge(config_overrides))
Expand Down

0 comments on commit b654761

Please sign in to comment.