Add database/features.rb and database/transactions.rb

This just moves some code out of misc.rb, query.rb, and
schema_methods.rb, and does a better job of organizing things.
Speed up threaded connection pools when :connection_handling=>:queue is used

From my benchmarking, on MRI the push/shift combination is
significantly faster than unshift/pop.