Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions Products/ZMySQLDA/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,17 @@ def _mysql_version(self):
""" Return mysql server version.
"""
if getattr(self, '_version', None) is None:
self._version = self.variables().get('version')
vstring = self.variables().get('version')
# convert into tuple of ints
vtuple_of_strings = vstring.split('.')
vres = []
for item in vtuple_of_strings:
try:
vres.append(int(item))
except:
# fallback for strings (e.g. beta1)
vres.append(item)
self._version = tuple(vres)
return self._version

def savepoint(self):
Expand All @@ -651,7 +661,8 @@ def savepoint(self):
Raise AttributeErrors to trigger optimistic savepoint handling
in zope's transaction code.
"""
if self._mysql_version() < '5.0.2':
# order of arguments to < is important, saved tuple might contain strings -> needs to come as 1st argument
if self._mysql_version() < (5,0,2):
# mysql supports savepoints in versions 5.0.3+
LOG.warning('Savepoints unsupported with Mysql < 5.0.3')
raise AttributeError
Expand Down