mirror of https://github.com/django/django.git
Removed duplicate caching of mysql_version.
The manual caching in self.server_version and the cached_property decorator are redundant.
This commit is contained in:
parent
282b2f40cd
commit
7b8529d206
|
@ -394,7 +394,6 @@ class DatabaseWrapper(BaseDatabaseWrapper):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(DatabaseWrapper, self).__init__(*args, **kwargs)
|
super(DatabaseWrapper, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
self.server_version = None
|
|
||||||
self.features = DatabaseFeatures(self)
|
self.features = DatabaseFeatures(self)
|
||||||
self.ops = DatabaseOperations(self)
|
self.ops = DatabaseOperations(self)
|
||||||
self.client = DatabaseClient(self)
|
self.client = DatabaseClient(self)
|
||||||
|
@ -454,13 +453,11 @@ class DatabaseWrapper(BaseDatabaseWrapper):
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def mysql_version(self):
|
def mysql_version(self):
|
||||||
if not self.server_version:
|
|
||||||
server_info = self.connection.get_server_info()
|
server_info = self.connection.get_server_info()
|
||||||
m = server_version_re.match(server_info)
|
match = server_version_re.match(server_info)
|
||||||
if not m:
|
if not match:
|
||||||
raise Exception('Unable to determine MySQL version from version string %r' % server_info)
|
raise Exception('Unable to determine MySQL version from version string %r' % server_info)
|
||||||
self.server_version = tuple([int(x) for x in m.groups()])
|
return tuple([int(x) for x in match.groups()])
|
||||||
return self.server_version
|
|
||||||
|
|
||||||
def disable_constraint_checking(self):
|
def disable_constraint_checking(self):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue