diff options
| author | Marc-Aurèle Brothier <m@brothier.org> | 2016-07-07 15:13:56 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-07-15 10:05:03 -0400 |
| commit | f8bfa806805a87d2cdd677089bd96fbf8400cb95 (patch) | |
| tree | 4ae0f963086868578a67506bbe0406aa15fe1d5a | |
| parent | 92c48a392fc27551651504e8a449a9430fd2733f (diff) | |
Fixed #26868 -- Changed MySQL version detection to use a query.
Workaround a bug with MariaDB and MySQL native client not stripping the
`5.5.5-` prefix.
| -rw-r--r-- | AUTHORS | 1 | ||||
| -rw-r--r-- | django/db/backends/mysql/base.py | 5 |
2 files changed, 4 insertions, 2 deletions
@@ -464,6 +464,7 @@ answer newbie questions, and generally made Django that much better: Marcin Wróbel Marc Remolt <m.remolt@webmasters.de> Marc Tamlyn <marc.tamlyn@gmail.com> + Marc-Aurèle Brothier <ma.brothier@gmail.com> Marian Andre <django@andre.sk> Marijn Vriens <marijn@metronomo.cl> Mario Gonzalez <gonzalemario@gmail.com> diff --git a/django/db/backends/mysql/base.py b/django/db/backends/mysql/base.py index 524e90d6eb..94415139cc 100644 --- a/django/db/backends/mysql/base.py +++ b/django/db/backends/mysql/base.py @@ -369,8 +369,9 @@ class DatabaseWrapper(BaseDatabaseWrapper): @cached_property def mysql_version(self): - with self.temporary_connection(): - server_info = self.connection.get_server_info() + with self.temporary_connection() as cursor: + cursor.execute('SELECT VERSION()') + server_info = cursor.fetchone()[0] match = server_version_re.match(server_info) if not match: raise Exception('Unable to determine MySQL version from version string %r' % server_info) |
