lib/sequel/adapters/shared/mysql.rb in sequel-3.35.0 vs lib/sequel/adapters/shared/mysql.rb in sequel-3.36.0
- old
+ new
@@ -74,10 +74,15 @@
end
end
h.values
end
+ # MySQL namespaces indexes per table.
+ def global_index_namespace?
+ false
+ end
+
# Use SHOW INDEX FROM to get the index information for the
# table.
#
# By default partial indexes are not included, you can use the
# option :partial to override this.
@@ -122,14 +127,14 @@
# MySQL supports savepoints
def supports_savepoints?
server_version >= 50000
end
- # MySQL doesn't appear to support savepoints inside prepared transactions in >=5.5.12,
- # see http://bugs.mysql.com/bug.php?id=64374
+ # MySQL doesn't support savepoints inside prepared transactions in from
+ # 5.5.12 to 5.5.23, see http://bugs.mysql.com/bug.php?id=64374
def supports_savepoints_in_prepared_transactions?
- super && server_version <= 50512
+ super && (server_version <= 50512 || server_version >= 50523)
end
# MySQL supports transaction isolation levels
def supports_transaction_isolation_levels?
true
@@ -205,9 +210,29 @@
end
super(table, op)
else
super(table, op)
end
+ end
+
+ # 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}"
+
+ # 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
+ if sql_mode = opts[:sql_mode]
+ sql_mode = Array(sql_mode).join(',').upcase
+ sqls << "SET sql_mode = '#{sql_mode}'"
+ end
+
+ sqls
end
# Use MySQL specific AUTO_INCREMENT text.
def auto_increment_sql
AUTO_INCREMENT