This patch provides the option to use connection pooling in ActiveRecord. We have a need to use ActiveRecord in an existing WEBrick environment, and also want ActiveRecord to work in a multithreaded environment such as dRuby.
I'm not sure if I've done this the most elegant fashion, so let me know how it could be improved.
To turn on pooling, ActiveRecord::Base.pool_connections is set to true. There are several other options that control the minimum and maximum size of the pool, whether to wait or immediately error out, and how often to recycle connections.
I also made a small change in activerecord/test/fixtures/db_definitions/mysql.sql to allow foreign keys to work on MySQL 4.0, which is what I happened to have installed. Should be compatible with 4.1 as well.
In addition to the diff, there are two new files:
activerecord/test/pool_connections_test.rb
activerecord/lib/active_record/connection_adapters/connection_pool.rb