lib/sequel/adapters/shared/mysql.rb in sequel-4.18.0 vs lib/sequel/adapters/shared/mysql.rb in sequel-4.19.0
- old
+ new
@@ -272,12 +272,14 @@
# The SQL queries to execute on initial connection
def mysql_connection_setting_sqls
sqls = []
- # Increase timeout so mysql server doesn't disconnect us
- # Value used by default is maximum allowed value on Windows.
- sqls << "SET @@wait_timeout = #{opts[:timeout] || 2147483}"
+ if wait_timeout = opts.fetch(:timeout, 2147483)
+ # Increase timeout so mysql server doesn't disconnect us
+ # Value used by default is maximum allowed value on Windows.
+ sqls << "SET @@wait_timeout = #{wait_timeout}"
+ end
# By default, MySQL 'where id is null' selects the last inserted id
sqls << "SET SQL_AUTO_IS_NULL=0" unless opts[:auto_is_null]
# If the user has specified one or more sql modes, enable them