mirror of https://github.com/django/django.git
Fixed #507 -- Changed MySQL backend so that it uses 'LIKE BINARY' for case-sensitive comparisons -- contains, startswith and endswith. Thanks, Simon
git-svn-id: http://code.djangoproject.com/svn/django/trunk@1036 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
390666ac2b
commit
7136eb8f3a
|
@ -125,15 +125,15 @@ def get_relations(cursor, table_name):
|
||||||
OPERATOR_MAPPING = {
|
OPERATOR_MAPPING = {
|
||||||
'exact': '=',
|
'exact': '=',
|
||||||
'iexact': 'LIKE',
|
'iexact': 'LIKE',
|
||||||
'contains': 'LIKE',
|
'contains': 'LIKE BINARY',
|
||||||
'icontains': 'LIKE',
|
'icontains': 'LIKE',
|
||||||
'ne': '!=',
|
'ne': '!=',
|
||||||
'gt': '>',
|
'gt': '>',
|
||||||
'gte': '>=',
|
'gte': '>=',
|
||||||
'lt': '<',
|
'lt': '<',
|
||||||
'lte': '<=',
|
'lte': '<=',
|
||||||
'startswith': 'LIKE',
|
'startswith': 'LIKE BINARY',
|
||||||
'endswith': 'LIKE',
|
'endswith': 'LIKE BINARY',
|
||||||
'istartswith': 'LIKE',
|
'istartswith': 'LIKE',
|
||||||
'iendswith': 'LIKE',
|
'iendswith': 'LIKE',
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,9 +161,9 @@ The DB API supports the following lookup types:
|
||||||
``foo``, ``FOO``, ``fOo``, etc.
|
``foo``, ``FOO``, ``fOo``, etc.
|
||||||
contains Case-sensitive containment test:
|
contains Case-sensitive containment test:
|
||||||
``polls.get_list(question__contains="spam")`` returns all polls
|
``polls.get_list(question__contains="spam")`` returns all polls
|
||||||
that contain "spam" in the question. (PostgreSQL only. MySQL
|
that contain "spam" in the question. (PostgreSQL and MySQL
|
||||||
doesn't support case-sensitive LIKE statements; ``contains``
|
only. SQLite doesn't support case-sensitive LIKE statements;
|
||||||
will act like ``icontains`` for MySQL.)
|
``contains`` will act like ``icontains`` for SQLite.)
|
||||||
icontains Case-insensitive containment test.
|
icontains Case-insensitive containment test.
|
||||||
gt Greater than: ``polls.get_list(id__gt=4)``.
|
gt Greater than: ``polls.get_list(id__gt=4)``.
|
||||||
gte Greater than or equal to.
|
gte Greater than or equal to.
|
||||||
|
@ -174,11 +174,10 @@ The DB API supports the following lookup types:
|
||||||
a list of polls whose IDs are either 1, 3 or 4.
|
a list of polls whose IDs are either 1, 3 or 4.
|
||||||
startswith Case-sensitive starts-with:
|
startswith Case-sensitive starts-with:
|
||||||
``polls.get_list(question_startswith="Would")``. (PostgreSQL
|
``polls.get_list(question_startswith="Would")``. (PostgreSQL
|
||||||
only. MySQL doesn't support case-sensitive LIKE statements;
|
and MySQL only. SQLite doesn't support case-sensitive LIKE
|
||||||
``startswith`` will act like ``istartswith`` for MySQL.)
|
statements; ``startswith`` will act like ``istartswith`` for
|
||||||
endswith Case-sensitive ends-with. (PostgreSQL only. MySQL doesn't
|
SQLite.)
|
||||||
support case-sensitive LIKE statements; ``endswith`` will act
|
endswith Case-sensitive ends-with. (PostgreSQL and MySQL only.)
|
||||||
like ``iendswith`` for MySQL.)
|
|
||||||
istartswith Case-insensitive starts-with.
|
istartswith Case-insensitive starts-with.
|
||||||
iendswith Case-insensitive ends-with.
|
iendswith Case-insensitive ends-with.
|
||||||
range Range test:
|
range Range test:
|
||||||
|
|
Loading…
Reference in New Issue