Ticket #2162: active_record_connection_pooling2.diff
| File active_record_connection_pooling2.diff, 4.3 kB (added by anonymous, 3 years ago) |
|---|
-
activerecord/test/fixtures/db_definitions/mysql.sql
old new 188 188 CREATE TABLE `fk_test_has_fk` ( 189 189 `id` INTEGER NOT NULL PRIMARY KEY, 190 190 `fk_id` INTEGER NOT NULL, 191 191 INDEX `fk_ind` (`fk_id`), 192 192 FOREIGN KEY (`fk_id`) REFERENCES `fk_test_has_pk`(`id`) 193 193 ) TYPE=InnoDB; 194 194 -
activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb
old new 106 106 # can be used as argument for establish_connection, for easy 107 107 # re-establishing of the connection. 108 108 def self.remove_connection(klass=self) 109 conn = @@defined_connections[klass] 109 conn = @@defined_connections[klass] 110 110 @@defined_connections.delete(klass) 111 111 active_connections[klass] = nil 112 112 @connection = nil … … 115 115 116 116 # Set the connection for the class. 117 117 def self.connection=(spec) 118 if spec.kind_of?(ActiveRecord::ConnectionAdapters::AbstractAdapter) 118 if spec.kind_of?(ActiveRecord::ConnectionAdapters::AbstractAdapter) or spec.kind_of?(ActiveRecord::ConnectionPool::Wrapper) 119 119 active_connections[self] = spec 120 120 elsif spec.kind_of?(ConnectionSpecification) 121 121 self.connection = self.send(spec.adapter_method, spec.config) -
activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
old new 44 44 @runtime = 0 45 45 return rt 46 46 end 47 48 def close 49 begin 50 @connection.close 51 rescue Exception => e 52 log_info("error while closing connection: #{e.message}") 53 raise ActiveRecord::ActiveRecordError 54 end 55 end 47 56 48 57 protected 49 58 def log(sql, name) -
activerecord/lib/active_record/base.rb
old new 325 325 cattr_accessor :allow_concurrency 326 326 @@allow_concurrency = true 327 327 328 # Determines whether or not to use a connection pool to manage the actual connections. 329 # Is tested and applied on a class by class basis. When set to true, @@allow_concurrency is 330 # effectively disregarded 331 cattr_accessor :pool_connections 332 @@pool_connections = false 333 334 cattr_accessor :connection_pool 335 @@connection_pool=nil 336 337 # Initial and minimum size of the connection pool. Meaningful only when @@pool_connections is true 338 cattr_accessor :pool_connections_min 339 @@pool_connections_min = 0 340 341 # Maximum size of the connection pool. Meaningful only when @@pool_connections is true 342 cattr_accessor :pool_connections_max 343 @@pool_connections_max = 0 344 345 # Whether or not a thread will wait for a pool connection to become available, 346 # or if ConnectionNotEstablished is thrown 347 cattr_accessor :pool_connections_wait 348 @@pool_connections_wait = true 349 350 # Period in seconds between sweeping for unused connections in the pool 351 cattr_accessor :pool_connections_reaper_period 352 @@pool_connections_reaper_period = 30 353 328 354 # Determines whether to speed up access by generating optimized reader 329 355 # methods to avoid expensive calls to method_missing when accessing 330 356 # attributes by name. You might want to set this to false in development -
activerecord/lib/active_record.rb
old new 73 73 require "active_record/connection_adapters/#{adapter}_adapter" 74 74 end 75 75 76 require 'active_record/connection_pool' 76 77 require 'active_record/query_cache'