add option for setting the wait_timeout in the AR adapter (this can be done in database.yml)

This commit is contained in:
Brian Lopez 2010-10-15 07:45:07 -07:00
parent c394122fd9
commit 832eb2d247
1 changed files with 5 additions and 0 deletions

View File

@ -617,8 +617,13 @@ module ActiveRecord
# Turn this off. http://dev.rubyonrails.org/ticket/6778
variable_assignments = ['SQL_AUTO_IS_NULL=0']
encoding = @config[:encoding]
# make sure we set the encoding
variable_assignments << "NAMES '#{encoding}'" if encoding
# increase timeout so mysql server doesn't disconnect us
variable_assignments << "@@wait_timeout = #{@config[:wait_timeout] || 2592000}"
execute("SET #{variable_assignments.join(', ')}", :skip_logging)
end