diff options
author | José Valim <jose.valim@gmail.com> | 2010-01-11 23:27:43 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-01-11 23:38:18 +0100 |
commit | cccb9988002f7b44133c089654b417ae9808b65f (patch) | |
tree | 83240e3731ca08c5ef4db4a0e03e85f09241bf14 /activerecord/lib/active_record | |
parent | d382e93d8f1a4e577bf408a952e1406ca6f47d27 (diff) | |
download | rails-cccb9988002f7b44133c089654b417ae9808b65f.tar.gz rails-cccb9988002f7b44133c089654b417ae9808b65f.tar.bz2 rails-cccb9988002f7b44133c089654b417ae9808b65f.zip |
Expose connections available in the connection pool.
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/mysql_adapter.rb | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb index 377f2a44c5..bf8c546d2e 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb @@ -56,7 +56,7 @@ module ActiveRecord # * +wait_timeout+: number of seconds to block and wait for a connection # before giving up and raising a timeout error (default 5 seconds). class ConnectionPool - attr_reader :spec + attr_reader :spec, :connections # Creates a new ConnectionPool object. +spec+ is a ConnectionSpecification # object which describes database connection information (e.g. adapter, diff --git a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb index fa28bc64df..8c0bf6396a 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb @@ -579,6 +579,8 @@ module ActiveRecord protected def translate_exception(exception, message) + return super unless exception.respond_to?(:errno) + case exception.errno when 1062 RecordNotUnique.new(message, exception) |