Changeset 383
- Timestamp:
- 08/01/05 16:49:57 (3 years ago)
- Files:
-
- django/trunk/django/core/db/backends/sqlite3.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/django/core/db/backends/sqlite3.py
r309 r383 17 17 # Database wrapper ############################################################ 18 18 19 def utf8rowFactory(cursor, row): 20 def utf8(s): 21 if type(s) == unicode: 22 return s.encode("utf-8") 23 else: 24 return s 25 return [utf8(r) for r in row] 26 19 27 class DatabaseWrapper: 20 28 def __init__(self): … … 29 37 self.connection.create_function("django_extract", 2, _sqlite_extract) 30 38 self.connection.create_function("django_date_trunc", 2, _sqlite_date_trunc) 39 cursor = self.connection.cursor(factory=SQLiteCursorWrapper) 40 cursor.row_factory = utf8rowFactory 31 41 if DEBUG: 32 return base.CursorDebugWrapper(FormatStylePlaceholderCursor(self.connection), self) 33 return FormatStylePlaceholderCursor(self.connection) 42 return base.CursorDebugWrapper(cursor, self) 43 else: 44 return cursor 34 45 35 46 def commit(self): … … 45 56 self.connection = None 46 57 47 class FormatStylePlaceholderCursor(Database.Cursor):58 class SQLiteCursorWrapper(Database.Cursor): 48 59 """ 49 60 Django uses "format" style placeholders, but pysqlite2 uses "qmark" style.
