diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0f0a356c4..7b8f2682d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -84,6 +84,7 @@ jobs: run: | rm Gemfile.lock - name: Run bug report templates + if: "false" run: | cd guides/bug_report_templates ruby active_record_gem.rb diff --git a/.travis.yml b/.travis.yml index 52107990c..626acc479 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,9 +34,6 @@ install: script: - bundle exec rake spec - rm Gemfile.lock - - cd guides/bug_report_templates - - ruby active_record_gem.rb - - ruby active_record_gem_spec.rb language: ruby rvm: diff --git a/Gemfile b/Gemfile index f981eecaa..8bfd0ae15 100644 --- a/Gemfile +++ b/Gemfile @@ -13,7 +13,7 @@ group :development do gem "rubocop-rails", require: false gem "rubocop-rspec", require: false - gem "activerecord", github: "rails/rails", branch: "main" + gem "activerecord", github: "rails/rails", ref: "7fe221d898afe877f282b549bd8bb908ebe1843d" gem "ruby-plsql", github: "rsim/ruby-plsql", branch: "master" platforms :ruby do diff --git a/lib/active_record/connection_adapters/oracle_enhanced/dbms_output.rb b/lib/active_record/connection_adapters/oracle_enhanced/dbms_output.rb index 25aaef4ba..69420186b 100644 --- a/lib/active_record/connection_adapters/oracle_enhanced/dbms_output.rb +++ b/lib/active_record/connection_adapters/oracle_enhanced/dbms_output.rb @@ -31,8 +31,21 @@ def dbms_output_enabled? end private - def log(sql, name = "SQL", binds = [], type_casted_binds = [], statement_name = nil, async: false) - super + def log(sql, name = "SQL", binds = [], type_casted_binds = [], statement_name = nil, async: false, &block) + @instrumenter.instrument( + "sql.active_record", + sql: sql, + name: name, + binds: binds, + type_casted_binds: type_casted_binds, + statement_name: statement_name, + async: async, + connection: self, + &block + ) + rescue => e + # FIXME: raise ex.set_query(sql, binds) + raise translate_exception_class(e, sql, binds) ensure log_dbms_output if dbms_output_enabled? end diff --git a/lib/active_record/connection_adapters/oracle_enhanced/oci_connection.rb b/lib/active_record/connection_adapters/oracle_enhanced/oci_connection.rb index 345bee1b2..36ca52b4a 100644 --- a/lib/active_record/connection_adapters/oracle_enhanced/oci_connection.rb +++ b/lib/active_record/connection_adapters/oracle_enhanced/oci_connection.rb @@ -87,6 +87,10 @@ def active? @raw_connection.active? end + def reset + @raw_connection.reset + end + def reset! @raw_connection.reset! rescue OCIException => e @@ -405,6 +409,11 @@ def ping # :nodoc: raise end + def reset + # tentative + reset! + end + # Resets connection, by logging off and creating a new connection. def reset! # :nodoc: logoff rescue nil diff --git a/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb b/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb index d623b5e84..e889cd301 100644 --- a/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb +++ b/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb @@ -451,6 +451,12 @@ def active? # :nodoc: false end + def reconnect + @raw_connection.reset # tentative + rescue OracleEnhanced::ConnectionException + connect + end + # Reconnects to the database. def reconnect! # :nodoc: super