Ticket #2810: mysql-encoding.diff
File mysql-encoding.diff, 1.4 KB (added by , 18 years ago) |
---|
-
django/conf/global_settings.py
99 99 DATABASE_PASSWORD = '' # Not used with sqlite3. 100 100 DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3. 101 101 DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3. 102 DATABASE_ENCODING = 'utf8' # for MySQL >= 4.1 102 103 103 104 # Host for sending e-mail. 104 105 EMAIL_HOST = 'localhost' -
django/db/backends/mysql/base.py
61 61 def __init__(self): 62 62 self.connection = None 63 63 self.queries = [] 64 from django.conf import settings 65 self.encoding = settings.DATABASE_ENCODING 64 66 65 67 def _valid_connection(self): 66 68 if self.connection is not None: … … 90 92 self.connection = Database.connect(**kwargs) 91 93 cursor = self.connection.cursor() 92 94 if self.connection.get_server_info() >= '4.1': 93 cursor.execute("SET NAMES ' utf8'")95 cursor.execute("SET NAMES '%s'" % self.encoding) 94 96 if settings.DEBUG: 95 97 return util.CursorDebugWrapper(MysqlDebugWrapper(cursor), self) 96 98 return cursor