mirror of
https://github.com/django/django.git
synced 2025-09-23 10:42:45 +00:00
Refactored get_datetime_cast_sql() to DatabaseOperations.datetime_cast_sql(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5953 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
5f51f0524a
commit
29f67dce9e
10 changed files with 13 additions and 26 deletions
|
@ -780,8 +780,8 @@ def get_where_clause(lookup_type, table_prefix, field_name, value, db_type):
|
|||
if table_prefix.endswith('.'):
|
||||
table_prefix = backend.quote_name(table_prefix[:-1])+'.'
|
||||
field_name = backend.quote_name(field_name)
|
||||
if type(value) == datetime.datetime and backend.get_datetime_cast_sql():
|
||||
cast_sql = backend.get_datetime_cast_sql()
|
||||
if type(value) == datetime.datetime and connection.ops.datetime_cast_sql():
|
||||
cast_sql = connection.ops.datetime_cast_sql()
|
||||
else:
|
||||
cast_sql = '%s'
|
||||
if db_type and hasattr(backend, 'get_field_cast_sql'):
|
||||
|
@ -794,8 +794,7 @@ def get_where_clause(lookup_type, table_prefix, field_name, value, db_type):
|
|||
else:
|
||||
format = '%s %s'
|
||||
try:
|
||||
return format % (field_sql,
|
||||
backend.OPERATOR_MAPPING[lookup_type] % cast_sql)
|
||||
return format % (field_sql, backend.OPERATOR_MAPPING[lookup_type] % cast_sql)
|
||||
except KeyError:
|
||||
pass
|
||||
if lookup_type == 'in':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue