diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2005-11-28 21:46:34 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2005-11-28 21:46:34 +0000 |
commit | b44720452c4717d13b401ce9d386be9e1a4cc25c (patch) | |
tree | 21b31d80c9f6f1e7143401ced15d9fc1bdb67948 /activerecord/lib | |
parent | 75d0623b3d1a71be2c63099cdeca48df5e3d4331 (diff) | |
download | rails-b44720452c4717d13b401ce9d386be9e1a4cc25c.tar.gz rails-b44720452c4717d13b401ce9d386be9e1a4cc25c.tar.bz2 rails-b44720452c4717d13b401ce9d386be9e1a4cc25c.zip |
PostgreSQL: active? compatibility with the pure-Ruby driver. Still need to move connect into the adapter since postgres-pr doesn't support #reset. References #428.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3195 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index 3f826edfe2..8619da8c5b 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -57,12 +57,14 @@ module ActiveRecord # Is this connection alive and ready for queries? def active? - # TODO: postgres-pr doesn't have PGconn#status. if @connection.respond_to?(:status) - @connection.status != PGconn::CONNECTION_BAD + @connection.status == PGconn::CONNECTION_OK else + @connection.query 'SELECT 1' true end + rescue PGError + false end # Close then reopen the connection. |