Only enable MySQL TRADITIONAL mode if we're running against MySQL

Change I2960435c81d21f5a65ea7fa4dc5c100880cf6aef, which enabled
MySQL TRADITIONAL mode, erroneously would attempt to enable that
MySQL-specific mode on both MySQL and DB2 connections. Only enable
TRADITIONAL mode when actually running against MySQL.

Change-Id: I28c40c47e2515112555f2abdd2ecc4dc5c3399f6
This commit is contained in:
Florian Haas 2014-01-28 20:55:38 +01:00
parent dc68e458d1
commit 1b5147fae7

View File

@ -737,13 +737,16 @@ def create_engine(sql_connection, sqlite_fk=False,
if engine.name in ['mysql', 'ibm_db_sa']:
callback = functools.partial(_ping_listener, engine)
sqlalchemy.event.listen(engine, 'checkout', callback)
if mysql_traditional_mode:
sqlalchemy.event.listen(engine, 'checkout', _set_mode_traditional)
else:
LOG.warning(_("This application has not enabled MySQL traditional"
" mode, which means silent data corruption may"
" occur. Please encourage the application"
" developers to enable this mode."))
if engine.name == 'mysql':
if mysql_traditional_mode:
sqlalchemy.event.listen(engine, 'checkout',
_set_mode_traditional)
else:
LOG.warning(_("This application has not enabled MySQL "
"traditional mode, which means silent "
"data corruption may occur. "
"Please encourage the application "
"developers to enable this mode."))
elif 'sqlite' in connection_dict.drivername:
if not CONF.sqlite_synchronous:
sqlalchemy.event.listen(engine, 'connect',