Changeset 3045
- Timestamp:
- 11/15/05 15:58:36 (3 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/activerecord/CHANGELOG
r3044 r3045 1 1 *SVN* 2 2 3 * SQLServer: active? and reconnect! methods for handling stale connections. #428 [kajism@yahoo.com ]3 * SQLServer: active? and reconnect! methods for handling stale connections. #428 [kajism@yahoo.com, Tom Ward <tom@popdog.net>] 4 4 5 5 * Associations handle case-equality more consistently: item.parts.is_a?(Array) and item.parts === Array. #1345 [MarkusQ@reality.com] trunk/activerecord/lib/active_record/connection_adapters/sqlserver_adapter.rb
r3044 r3045 208 208 # Returns true if the connection is active. 209 209 def active? 210 @connection.execute("SELECT 1") { |sth|}210 @connection.execute("SELECT 1") { } 211 211 true 212 rescue DBI::DatabaseError, DBI::InterfaceError 213 false 214 end 215 216 # Reconnects to the database, returns false if no connection could be made. 217 def reconnect! 218 @connection.disconnect rescue nil 219 @connection = DBI.connect(*@connection_options) 212 220 rescue DBI::DatabaseError => e 221 @logger.warn "#{adapter_name} reconnection failed: #{e.message}" if @logger 213 222 false 214 223 end 215 216 # Reconnects to the database.217 def reconnect!218 begin219 @connection.disconnect220 @connection = DBI.connect(*@connection_options)221 rescue DBI::DatabaseError => e222 @logger.warn "#{adapter_name} automatic reconnection failed: #{e.message}"223 end224 end225 226 227 224 228 225 def select_all(sql, name = nil)