summaryrefslogtreecommitdiff
path: root/django/core/db/backends/mysql.py
diff options
context:
space:
mode:
Diffstat (limited to 'django/core/db/backends/mysql.py')
-rw-r--r--django/core/db/backends/mysql.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/django/core/db/backends/mysql.py b/django/core/db/backends/mysql.py
index 4399b6a6a0..e7ede84a12 100644
--- a/django/core/db/backends/mysql.py
+++ b/django/core/db/backends/mysql.py
@@ -122,18 +122,23 @@ def get_table_list(cursor):
def get_relations(cursor, table_name):
raise NotImplementedError
+def quote_name(name):
+ if name.startswith("`") and name.endswith("`"):
+ return name # Quoting once is enough.
+ return "`%s`" % name
+
OPERATOR_MAPPING = {
'exact': '=',
'iexact': 'LIKE',
- 'contains': 'LIKE',
+ 'contains': 'LIKE BINARY',
'icontains': 'LIKE',
'ne': '!=',
'gt': '>',
'gte': '>=',
'lt': '<',
'lte': '<=',
- 'startswith': 'LIKE',
- 'endswith': 'LIKE',
+ 'startswith': 'LIKE BINARY',
+ 'endswith': 'LIKE BINARY',
'istartswith': 'LIKE',
'iendswith': 'LIKE',
}