From eb4bbbb6f3346f49b25930ef6a32ce0a7b1ae3ec Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Sat, 6 May 2006 03:27:49 +0000 Subject: [PATCH] Fixed #1777 -- Fixed bug in date conversion in SQLite backend. Thanks, dart@google.com git-svn-id: http://code.djangoproject.com/svn/django/trunk@2851 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/db/backends/sqlite3/base.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/django/db/backends/sqlite3/base.py b/django/db/backends/sqlite3/base.py index ecaf9b0c0d..b884e9d27b 100644 --- a/django/db/backends/sqlite3/base.py +++ b/django/db/backends/sqlite3/base.py @@ -11,6 +11,8 @@ Database.register_converter("bool", lambda s: str(s) == '1') Database.register_converter("time", util.typecast_time) Database.register_converter("date", util.typecast_date) Database.register_converter("datetime", util.typecast_timestamp) +Database.register_converter("timestamp", util.typecast_timestamp) +Database.register_converter("TIMESTAMP", util.typecast_timestamp) def utf8rowFactory(cursor, row): def utf8(s): @@ -35,8 +37,10 @@ class DatabaseWrapper(local): def cursor(self): from django.conf import settings if self.connection is None: - self.connection = Database.connect(settings.DATABASE_NAME, detect_types=Database.PARSE_DECLTYPES) - # register extract and date_trun functions + self.connection = Database.connect(settings.DATABASE_NAME, + detect_types=Database.PARSE_DECLTYPES | Database.PARSE_COLNAMES) + + # Register extract and date_trunc functions. self.connection.create_function("django_extract", 2, _sqlite_extract) self.connection.create_function("django_date_trunc", 2, _sqlite_date_trunc) cursor = self.connection.cursor(factory=SQLiteCursorWrapper)