Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ def active?
@raw_connection.active?
end

def reset
@raw_connection.reset
end

def reset!
@raw_connection.reset!
rescue OCIException => e
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down