Mercurial > p > roundup > code
diff roundup/backends/back_mysql.py @ 4887:05c857e5dbed
New rdbms configuration option 'isolation_level'
See discussion in http://issues.roundup-tracker.org/issue2550806
| author | Ralf Schlatterbeck <rsc@runtux.com> |
|---|---|
| date | Sun, 06 Apr 2014 11:11:04 +0200 |
| parents | f1fe6fd0aa61 |
| children | e424987d294a |
line wrap: on
line diff
--- a/roundup/backends/back_mysql.py Fri Apr 04 08:09:30 2014 +0200 +++ b/roundup/backends/back_mysql.py Sun Apr 06 11:11:04 2014 +0200 @@ -40,6 +40,13 @@ from MySQLdb.constants import ER import logging +isolation_levels = \ + { 'read uncommitted': 'READ UNCOMMITTED' + , 'read committed': 'READ COMMITTED' + , 'repeatable read': 'REPEATABLE READ' + , 'serializable': 'SERIALIZABLE' + } + def connection_dict(config, dbnamestr=None): d = rdbms_common.connection_dict(config, dbnamestr) if d.has_key('password'): @@ -145,6 +152,8 @@ raise DatabaseError, message cursor = conn.cursor() cursor.execute("SET AUTOCOMMIT=0") + lvl = isolation_levels [self.config.RDBMS_ISOLATION_LEVEL] + cursor.execute("SET SESSION TRANSACTION ISOLATION LEVEL %s" % lvl) cursor.execute("START TRANSACTION") return (conn, cursor)
