summaryrefslogtreecommitdiff
path: root/django/db/backends/sqlite3/base.py
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2007-08-19 22:47:43 +0000
committerAdrian Holovaty <adrian@holovaty.com>2007-08-19 22:47:43 +0000
commit5f51f0524a8cd941ea757a0339978f3589193cbb (patch)
tree511bf5b4aac7785754b2df12ec602189aee1a20b /django/db/backends/sqlite3/base.py
parentaab04a4c2f880645783f05ef9a87eef14966503a (diff)
Refactored get_date_trunc_sql() to DatabaseOperations.date_trunc_sql(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5952 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/backends/sqlite3/base.py')
-rw-r--r--django/db/backends/sqlite3/base.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/django/db/backends/sqlite3/base.py b/django/db/backends/sqlite3/base.py
index c7e84d7946..6caf01dcac 100644
--- a/django/db/backends/sqlite3/base.py
+++ b/django/db/backends/sqlite3/base.py
@@ -37,9 +37,14 @@ Database.register_adapter(decimal.Decimal, util.rev_typecast_decimal)
class DatabaseOperations(BaseDatabaseOperations):
def date_extract_sql(self, lookup_type, field_name):
# sqlite doesn't support extract, so we fake it with the user-defined
- # function _sqlite_extract that's registered in connect().
+ # function django_extract that's registered in connect().
return 'django_extract("%s", %s)' % (lookup_type.lower(), field_name)
+ def date_trunc_sql(self, lookup_type, field_name):
+ # sqlite doesn't support DATE_TRUNC, so we fake it with a user-defined
+ # function django_date_trunc that's registered in connect().
+ return 'django_date_trunc("%s", %s)' % (lookup_type.lower(), field_name)
+
class DatabaseWrapper(BaseDatabaseWrapper):
ops = DatabaseOperations()
@@ -110,11 +115,6 @@ def _sqlite_extract(lookup_type, dt):
return None
return str(getattr(dt, lookup_type))
-def get_date_trunc_sql(lookup_type, field_name):
- # lookup_type is 'year', 'month', 'day'
- # sqlite doesn't support DATE_TRUNC, so we fake it as above.
- return 'django_date_trunc("%s", %s)' % (lookup_type.lower(), field_name)
-
def get_datetime_cast_sql():
return None