Changeset 5656
- Timestamp:
- 12/01/06 05:37:56 (2 years ago)
- Files:
-
- branches/1-2-pre-release/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb (modified) (1 diff)
- branches/1-2-pre-release/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb (modified) (1 diff)
- branches/1-2-pre-release/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb (modified) (1 diff)
- branches/1-2-pre-release/activerecord/lib/active_record/vendor/mysql.rb (modified) (1 diff)
- branches/1-2-pre-release/railties/lib/dispatcher.rb (modified) (3 diffs)
- trunk/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb (modified) (1 diff)
- trunk/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb (modified) (1 diff)
- trunk/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb (modified) (1 diff)
- trunk/activerecord/lib/active_record/vendor/mysql.rb (modified) (1 diff)
- trunk/railties/lib/dispatcher.rb (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1-2-pre-release/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
r5637 r5656 80 80 end 81 81 82 # Returns true if its safe to reload the connection between requests for development mode.83 # This is not the case for Ruby/MySQL and it's not necessary for any adapters except SQLite.84 def supports_reloading?85 false86 end87 88 82 # Lazily verify this connection, calling +active?+ only if it hasn't 89 83 # been called for +timeout+ seconds. branches/1-2-pre-release/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb
r5637 r5656 85 85 clear_cache!(@@active_connections) do |name, conn| 86 86 conn.disconnect! 87 end88 end89 90 # Clears the cache which maps classes91 def clear_reloadable_connections!92 @@active_connections.each do |name, conn|93 conn.disconnect! if conn.supports_reloading?94 @@active_connections.delete(name)95 87 end 96 88 end branches/1-2-pre-release/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb
r5637 r5656 100 100 101 101 def supports_migrations? #:nodoc: 102 true103 end104 105 def supports_reloading?106 102 true 107 103 end branches/1-2-pre-release/activerecord/lib/active_record/vendor/mysql.rb
r4990 r5656 1174 1174 def finalizer(net) 1175 1175 proc { 1176 net.clear 1177 net.write Mysql::COM_QUIT.chr 1176 begin 1177 net.clear 1178 net.write Mysql::COM_QUIT.chr 1179 net.close 1180 rescue Error => error 1181 # Swallow lost connection errors if connection is already closed. 1182 raise unless error.errno == Error::CR_SERVER_LOST 1183 end 1178 1184 } 1179 1185 end branches/1-2-pre-release/railties/lib/dispatcher.rb
r5637 r5656 63 63 end 64 64 65 ActiveRecord::Base.clear_ reloadable_connections! if defined?(ActiveRecord)65 ActiveRecord::Base.clear_active_connections! if defined?(ActiveRecord) 66 66 end 67 67 … … 77 77 unless identifier.nil? 78 78 callback = preparation_callbacks.detect { |ident, _| ident == identifier } 79 80 79 if callback # Already registered: update the existing callback 81 80 callback[-1] = block … … 83 82 end 84 83 end 85 86 84 preparation_callbacks << [identifier, block] 87 88 return 85 nil 89 86 end 90 87 trunk/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
r5637 r5656 80 80 end 81 81 82 # Returns true if its safe to reload the connection between requests for development mode.83 # This is not the case for Ruby/MySQL and it's not necessary for any adapters except SQLite.84 def supports_reloading?85 false86 end87 88 82 # Lazily verify this connection, calling +active?+ only if it hasn't 89 83 # been called for +timeout+ seconds. trunk/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb
r5637 r5656 85 85 clear_cache!(@@active_connections) do |name, conn| 86 86 conn.disconnect! 87 end88 end89 90 # Clears the cache which maps classes91 def clear_reloadable_connections!92 @@active_connections.each do |name, conn|93 conn.disconnect! if conn.supports_reloading?94 @@active_connections.delete(name)95 87 end 96 88 end trunk/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb
r5637 r5656 100 100 101 101 def supports_migrations? #:nodoc: 102 true103 end104 105 def supports_reloading?106 102 true 107 103 end trunk/activerecord/lib/active_record/vendor/mysql.rb
r4990 r5656 1174 1174 def finalizer(net) 1175 1175 proc { 1176 net.clear 1177 net.write Mysql::COM_QUIT.chr 1176 begin 1177 net.clear 1178 net.write Mysql::COM_QUIT.chr 1179 net.close 1180 rescue Error => error 1181 # Swallow lost connection errors if connection is already closed. 1182 raise unless error.errno == Error::CR_SERVER_LOST 1183 end 1178 1184 } 1179 1185 end trunk/railties/lib/dispatcher.rb
r5637 r5656 63 63 end 64 64 65 ActiveRecord::Base.clear_ reloadable_connections! if defined?(ActiveRecord)65 ActiveRecord::Base.clear_active_connections! if defined?(ActiveRecord) 66 66 end 67 67 … … 77 77 unless identifier.nil? 78 78 callback = preparation_callbacks.detect { |ident, _| ident == identifier } 79 80 79 if callback # Already registered: update the existing callback 81 80 callback[-1] = block … … 83 82 end 84 83 end 85 86 84 preparation_callbacks << [identifier, block] 87 88 return 85 nil 89 86 end 90 87