summaryrefslogtreecommitdiff
path: root/django/db/backends/mysql/base.py
diff options
context:
space:
mode:
Diffstat (limited to 'django/db/backends/mysql/base.py')
-rw-r--r--django/db/backends/mysql/base.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/django/db/backends/mysql/base.py b/django/db/backends/mysql/base.py
index e7e060e6c2..28c5b1c683 100644
--- a/django/db/backends/mysql/base.py
+++ b/django/db/backends/mysql/base.py
@@ -98,9 +98,11 @@ class DatabaseWrapper(local):
kwargs['port'] = int(settings.DATABASE_PORT)
kwargs.update(self.options)
self.connection = Database.connect(**kwargs)
- cursor = self.connection.cursor()
- if self.connection.get_server_info() >= '4.1':
- cursor.execute("SET NAMES 'utf8'")
+ cursor = self.connection.cursor()
+ if self.connection.get_server_info() >= '4.1':
+ cursor.execute("SET NAMES 'utf8'")
+ else:
+ cursor = self.connection.cursor()
if settings.DEBUG:
return util.CursorDebugWrapper(MysqlDebugWrapper(cursor), self)
return cursor