#1777 closed defect (fixed)
sqlite backend has small bug in date conversion
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | |
Severity: | normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Here's a diff for the sqlite backend I was just experiencing. Part of the problem was that the tables were created with a different ORM (sqlobject) that uses a different name for the time stamp. It also need another flag to read it.
Index: django/db/backends/sqlite3/base.py
===================================================================
--- django/db/backends/sqlite3/base.py (revision 2832)
+++ django/db/backends/sqlite3/base.py (working copy)
@@ -11,6 +11,8 @@
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,7 +37,9 @@
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)
+ self.connection = Database.connect(settings.DATABASE_NAME,
+ detect_types=Database.PARSE_DECLTYPES|Database.PARSE_COLNAMES)
+
# register extract and date_trun functions
self.connection.create_function("django_extract", 2, _sqlite_extract)
self.connection.create_function("django_date_trunc", 2, _sqlite_date_trunc)
Attachments (1)
Change History (2)
by , 19 years ago
Attachment: | django_sqlite.diff added |
---|
comment:1 by , 19 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
diff from svn