Ticket #867: negation_lookup_type.patch
File negation_lookup_type.patch, 5.5 KB (added by , 19 years ago) |
---|
-
django_src/django/core/db/backends/ado_mssql.py
117 117 118 118 OPERATOR_MAPPING = { 119 119 'exact': '= %s', 120 'iexact': 'LIKE %s', 121 'contains': 'LIKE %s', 122 'icontains': 'LIKE %s', 120 'iexact': 'LIKE %s', 121 'inotexact': 'NOT LIKE %s' 122 'contains': 'LIKE %s', 123 'doesnotcontain': 'NOT LIKE %s', 124 'icontains': 'LIKE %s', 125 'idoesnotcontain': 'NOT LIKE %s', 123 126 'ne': '!= %s', 124 127 'gt': '> %s', 125 128 'gte': '>= %s', 126 129 'lt': '< %s', 127 130 'lte': '<= %s', 128 'startswith': 'LIKE %s', 129 'endswith': 'LIKE %s', 130 'istartswith': 'LIKE %s', 131 'iendswith': 'LIKE %s', 131 'startswith': 'LIKE %s', 132 'doesnotstartwith': 'NOT LIKE %s', 133 'endswith': 'LIKE %s', 134 'doesnotendwith': 'NOT LIKE %s', 135 'istartswith': 'LIKE %s', 136 'idoesnotstartwith': 'NOT LIKE %s', 137 'iendswith': 'LIKE %s', 138 'idoesnotendwith': 'NOT LIKE %s', 132 139 } 133 140 134 141 DATA_TYPES = { -
django_src/django/core/db/backends/postgresql.py
134 134 135 135 OPERATOR_MAPPING = { 136 136 'exact': '= %s', 137 'iexact': 'ILIKE %s', 138 'contains': 'LIKE %s', 139 'icontains': 'ILIKE %s', 137 'iexact': 'ILIKE %s', 138 'inotexact': 'NOT ILIKE %s', 139 'contains': 'LIKE %s', 140 'doesnotcontain': 'NOT LIKE %s' 141 'icontains': 'ILIKE %s', 142 'idoesnotcontain': 'NOT ILIKE %s' 140 143 'ne': '!= %s', 141 144 'gt': '> %s', 142 145 'gte': '>= %s', 143 146 'lt': '< %s', 144 147 'lte': '<= %s', 145 'startswith': 'LIKE %s', 146 'endswith': 'LIKE %s', 147 'istartswith': 'ILIKE %s', 148 'iendswith': 'ILIKE %s', 148 'startswith': 'LIKE %s', 149 'doesnotstartwith': 'NOT LIKE %s', 150 'endswith': 'LIKE %s', 151 'doesnotendwith': 'NOT LIKE %s' 152 'istartswith': 'ILIKE %s', 153 'idoesnotstartwith': 'NOT ILIKE %s', 154 'iendswith': 'ILIKE %s', 155 'idoesnotendwith': 'NOT ILIKE %s', 149 156 } 150 157 151 158 # This dictionary maps Field objects to their associated PostgreSQL column -
django_src/django/core/db/backends/sqlite3.py
137 137 OPERATOR_MAPPING = { 138 138 'exact': '= %s', 139 139 'iexact': "LIKE %s ESCAPE '\\'", 140 'inotexact': "NOT LIKE %s ESCAPE '\\'", 140 141 'contains': "LIKE %s ESCAPE '\\'", 142 'doesnotcontain': "NOT LIKE %s ESCAPE '\\'", 141 143 'icontains': "LIKE %s ESCAPE '\\'", 144 'idoesnotcontain': "NOT LIKE %s ESCAPE '\\'", 142 145 'ne': '!= %s', 143 146 'gt': '> %s', 144 147 'gte': '>= %s', 145 148 'lt': '< %s', 146 149 'lte': '<= %s', 147 150 'startswith': "LIKE %s ESCAPE '\\'", 151 'doesnotstartwith': "NOT LIKE %s ESCAPE '\\'", 148 152 'endswith': "LIKE %s ESCAPE '\\'", 153 'doesnotendwith': "NOT LIKE %s ESCAPE '\\'", 149 154 'istartswith': "LIKE %s ESCAPE '\\'", 155 'idoesnotstartwith': "NOT LIKE %s ESCAPE '\\'", 150 156 'iendswith': "LIKE %s ESCAPE '\\'", 157 'idoesnotendwith': "NOT LIKE %s ESCAPE '\\'", 151 158 } 152 159 153 160 # SQLite doesn't actually support most of these types, but it "does the right -
django_src/django/core/db/backends/mysql.py
130 130 OPERATOR_MAPPING = { 131 131 'exact': '= %s', 132 132 'iexact': 'LIKE %s', 133 'inotexact': 'NOT LIKE %s', 133 134 'contains': 'LIKE BINARY %s', 135 'doesnotcontain': 'NOT LIKE BINARY %s', 134 136 'icontains': 'LIKE %s', 137 'idoesnotcontain': 'NOT LIKE %s', 135 138 'ne': '!= %s', 136 139 'gt': '> %s', 137 140 'gte': '>= %s', 138 141 'lt': '< %s', 139 142 'lte': '<= %s', 140 143 'startswith': 'LIKE BINARY %s', 144 'doesnotstartwith' : 'NOT LIKE BINARY %s', 141 145 'endswith': 'LIKE BINARY %s', 146 'doesnotendwith' : 'NOT LIKE BINARY %s', 142 147 'istartswith': 'LIKE %s', 148 'idoesnotstartwith' : 'NOT LIKE %s', 143 149 'iendswith': 'LIKE %s', 150 'idoesnotendwith' : 'NOT LIKE %s', 144 151 } 145 152 146 153 # This dictionary maps Field objects to their associated MySQL column -
django_src/django/core/meta/fields.py
163 163 return value 164 164 elif lookup_type == 'year': 165 165 return ['%s-01-01' % value, '%s-12-31' % value] 166 elif lookup_type in ('contains', 'icontains' ):166 elif lookup_type in ('contains', 'icontains', 'doesnotcontain', 'idoesnotcontain'): 167 167 return ["%%%s%%" % prep_for_like_query(value)] 168 elif lookup_type == 'iexact':168 elif lookup_type in ('iexact', 'inotexact'): 169 169 return [prep_for_like_query(value)] 170 elif lookup_type in ('startswith', 'istartswith' ):170 elif lookup_type in ('startswith', 'istartswith', 'doesnotstartwith', 'idoesnotstartwith'): 171 171 return ["%s%%" % prep_for_like_query(value)] 172 elif lookup_type in ('endswith', 'iendswith' ):172 elif lookup_type in ('endswith', 'iendswith', 'doesnotendwith', 'idoesnotendwith'): 173 173 return ["%%%s" % prep_for_like_query(value)] 174 174 elif lookup_type == 'isnull': 175 175 return []