Changeset 3189
- Timestamp:
- 11/24/05 19:50:10 (3 years ago)
- Files:
-
- trunk/activerecord/CHANGELOG (modified) (1 diff)
- trunk/activerecord/lib/active_record/connection_adapters/oci_adapter.rb (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/activerecord/CHANGELOG
r3188 r3189 1 1 *SVN* 2 3 * Oracle: active? check pings the database rather than testing the last command status. #428 [Michael Schoen] 2 4 3 5 * SQLServer: resolve column aliasing/quoting collision when using limit or offset in an eager find. #2974 [kajism@yahoo.com] trunk/activerecord/lib/active_record/connection_adapters/oci_adapter.rb
r3025 r3189 117 117 time_array = ParseDate.parsedate value 118 118 time_array[0] ||= 2000; time_array[1] ||= 1; time_array[2] ||= 1; 119 Time.send Base.default_timezone, *time_array119 Time.send(Base.default_timezone, *time_array) rescue nil 120 120 end 121 121 … … 216 216 # Returns true if the connection is active. 217 217 def active? 218 # Just checks the active flag, which is set false if the last exec 219 # got an error indicating a bad connection. An alternative would be 220 # to call #ping, which is more expensive (and should always get 221 # the same result). 222 @connection.active? 218 # Pings the connection to check if it's still good. Note that an 219 # #active? method is also available, but that simply returns the 220 # last known state, which isn't good enough if the connection has 221 # gone stale since the last use. 222 @connection.ping 223 rescue OCIError 224 false 223 225 end 224 226 225 227 # Reconnects to the database. 226 228 def reconnect! 227 begin 228 @connection.reset! 229 rescue OCIError => e 230 @logger.warn "#{adapter_name} automatic reconnection failed: #{e.message}" 231 end 229 @connection.reset! 230 rescue OCIError => e 231 @logger.warn "#{adapter_name} automatic reconnection failed: #{e.message}" 232 232 end 233 233 … … 552 552 # known state. 553 553 def ping 554 @connection.commit 554 555 @active = true 555 begin 556 @connection.commit 557 rescue 558 @active = false 559 end 560 active? 556 rescue 557 @active = false 558 raise 561 559 end 562 560