Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #6666: Corrected a bind param formatting issue when performing …

…'year' lookups on DateFields using Oracle.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@7274 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 4f5f8735e31267d07f8f4e4854bd16149f3de833 1 parent 3c504b0
@ikelly ikelly authored
Showing with 6 additions and 1 deletion.
  1. +6 −1 django/db/models/fields/__init__.py
View
7 django/db/models/fields/__init__.py
@@ -230,9 +230,14 @@ def get_db_prep_lookup(self, lookup_type, value):
raise ValueError("The __year lookup type requires an integer argument")
if settings.DATABASE_ENGINE == 'sqlite3':
first = '%s-01-01'
+ second = '%s-12-31 23:59:59.999999'
+ elif settings.DATABASE_ENGINE == 'oracle' and self.get_internal_type() == 'DateField':
+ first = '%s-01-01'
+ second = '%s-12-31'
else:
first = '%s-01-01 00:00:00'
- return [first % value, '%s-12-31 23:59:59.999999' % value]
+ second = '%s-12-31 23:59:59.999999'
+ return [first % value, second % value]
raise TypeError("Field has invalid lookup: %s" % lookup_type)
def has_default(self):
Please sign in to comment.
Something went wrong with that request. Please try again.