mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	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
This commit is contained in:
		| @@ -11,6 +11,8 @@ Database.register_converter("bool", lambda s: str(s) == '1') | |||||||
| Database.register_converter("time", util.typecast_time) | Database.register_converter("time", util.typecast_time) | ||||||
| Database.register_converter("date", util.typecast_date) | Database.register_converter("date", util.typecast_date) | ||||||
| Database.register_converter("datetime", util.typecast_timestamp) | 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 utf8rowFactory(cursor, row): | ||||||
|     def utf8(s): |     def utf8(s): | ||||||
| @@ -35,8 +37,10 @@ class DatabaseWrapper(local): | |||||||
|     def cursor(self): |     def cursor(self): | ||||||
|         from django.conf import settings |         from django.conf import settings | ||||||
|         if self.connection is None: |         if self.connection is None: | ||||||
|             self.connection = Database.connect(settings.DATABASE_NAME, detect_types=Database.PARSE_DECLTYPES) |             self.connection = Database.connect(settings.DATABASE_NAME, | ||||||
|             # register extract and date_trun functions |                 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_extract", 2, _sqlite_extract) | ||||||
|             self.connection.create_function("django_date_trunc", 2, _sqlite_date_trunc) |             self.connection.create_function("django_date_trunc", 2, _sqlite_date_trunc) | ||||||
|         cursor = self.connection.cursor(factory=SQLiteCursorWrapper) |         cursor = self.connection.cursor(factory=SQLiteCursorWrapper) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user