diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2006-12-30 07:21:01 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2006-12-30 07:21:01 +0000 |
| commit | f21cbb40b2521da1195d1a2aa5910281efb32b7f (patch) | |
| tree | cd3192cefe5dcf429bc8f9abce88b1da4cb574a7 | |
| parent | 71802073283847f5582df4eea1e4fdb5b37eca4f (diff) | |
Fixed #3151 -- Improved MySQL backend not to send 'SET NAMES utf8' before every query. Thanks for the patch, smurf@smurf.noris.de
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4267 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | AUTHORS | 1 | ||||
| -rw-r--r-- | django/db/backends/mysql/base.py | 8 |
2 files changed, 6 insertions, 3 deletions
@@ -151,6 +151,7 @@ answer newbie questions, and generally made Django that much better: serbaut@gmail.com Pete Shinners <pete@shinners.org> SmileyChris <smileychris@gmail.com> + smurf@smurf.noris.de sopel Thomas Steinacher <tom@eggdrop.ch> nowell strite 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 |
