aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
diff options
context:
space:
mode:
authorYehuda Katz <wycats@gmail.com>2009-01-14 16:48:37 -0800
committerYehuda Katz <wycats@gmail.com>2009-01-14 16:48:57 -0800
commitb8fadd708b9850a77e1f64038763fffcff502499 (patch)
tree4f20197c55e98b256ebbf126cbcf05636a9f511c /activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
parentf65333a4cfcdc73b2f2e51fc4353370ab308135e (diff)
parent9bcf01b23c25e640da7908ac8b1b49fbf7d2e51a (diff)
downloadrails-b8fadd708b9850a77e1f64038763fffcff502499.tar.gz
rails-b8fadd708b9850a77e1f64038763fffcff502499.tar.bz2
rails-b8fadd708b9850a77e1f64038763fffcff502499.zip
Sync 'rails/rails/master'
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb')
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb10
1 files changed, 4 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
index 5a8d99924d..913bb521ca 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -533,13 +533,11 @@ module ActiveRecord
execute "ROLLBACK"
end
- if PGconn.public_method_defined?(:transaction_status)
- # ruby-pg defines Ruby constants for transaction status,
- # ruby-postgres does not.
- PQTRANS_IDLE = defined?(PGconn::PQTRANS_IDLE) ? PGconn::PQTRANS_IDLE : 0
-
+ if defined?(PGconn::PQTRANS_IDLE)
+ # The ruby-pg driver supports inspecting the transaction status,
+ # while the ruby-postgres driver does not.
def outside_transaction?
- @connection.transaction_status == PQTRANS_IDLE
+ @connection.transaction_status == PGconn::PQTRANS_IDLE
end
end