Fixing stack level too deep error, with some basic tests for this issue.
rails 3.2.* compatibility: fixing select_all method in QueryCacheCompat to properly form cache key
rails 3.2.* compatibility: pass prepared sql instead of arel to select_all in QueryCacheCompat
rails 3.2.* compatibility: checking for query_cache_enabled in master as well as current connection (see comments), and removing columns method (this one would get stored as nil in query_cache, thus pointless (the real columns method has a table arg and is in SchemaCache now)
rails 3.2.* compatibility: ooookkk... turns out query cache still wasn't being expired
after last commit b/c of the QueryCache middleware clearing the master query cache only.
Let's only allow a query_cache on master and access only that (also avoids the
possibility of duplicate query caches existing in master and slave connections)

NOTE: avoiding send_to_master wherever possible because it adds more frames to the stack (ie
retrieve_connection)
rails 3.2.* compatibility: bring back the overwritten class method cache() and force it to use master for its query cache
Merge branch 'master' into rails_3_2
adding some fail safes in case the master depth gets out of whack
Adding logging to errors to help track down bug
adding a nil check