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
This commit is contained in:
Ian Kelly 2008-03-17 19:31:42 +00:00
parent 3c504b0f5c
commit 4f5f8735e3
1 changed files with 6 additions and 1 deletions

View File

@ -230,9 +230,14 @@ class Field(object):
raise ValueError("The __year lookup type requires an integer argument") raise ValueError("The __year lookup type requires an integer argument")
if settings.DATABASE_ENGINE == 'sqlite3': if settings.DATABASE_ENGINE == 'sqlite3':
first = '%s-01-01' 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: else:
first = '%s-01-01 00:00:00' 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) raise TypeError("Field has invalid lookup: %s" % lookup_type)
def has_default(self): def has_default(self):