Ticket #966: notlike.diff
File notlike.diff, 3.5 KB (added by , 19 years ago) |
---|
-
core/db/backends/ado_mssql.py
132 132 'endswith': 'LIKE %s', 133 133 'istartswith': 'LIKE %s', 134 134 'iendswith': 'LIKE %s', 135 'notcontains': 'NOT LIKE %s', 136 'notstartswith': 'NOT LIKE %s', 137 'notendswith': 'NOT LIKE %s', 138 'inotcontains': 'NOT LIKE %s', 139 'inotstartswith': 'NOT LIKE %s', 140 'inotendswith': 'NOT LIKE %s', 135 141 } 136 142 137 143 DATA_TYPES = { -
core/db/backends/postgresql.py
151 151 'endswith': 'LIKE %s', 152 152 'istartswith': 'ILIKE %s', 153 153 'iendswith': 'ILIKE %s', 154 'notcontains': 'NOT LIKE %s', 155 'notstartswith': 'NOT LIKE %s', 156 'notendswith': 'NOT LIKE %s', 157 'inotcontains': 'NOT ILIKE %s', 158 'inotstartswith': 'NOT ILIKE %s', 159 'inotendswith': 'NOT ILIKE %s', 154 160 } 155 161 156 162 # This dictionary maps Field objects to their associated PostgreSQL column -
core/db/backends/sqlite3.py
153 153 'endswith': "LIKE %s ESCAPE '\\'", 154 154 'istartswith': "LIKE %s ESCAPE '\\'", 155 155 'iendswith': "LIKE %s ESCAPE '\\'", 156 'notcontains': "NOT LIKE %s ESCAPE '\\'", 157 'notstartswith': "NOT LIKE %s ESCAPE '\\'", 158 'notendswith': "NOT LIKE %s ESCAPE '\\'", 159 'inotcontains': "NOT LIKE %s ESCAPE '\\'", 160 'inotstartswith': "NOT LIKE %s ESCAPE '\\'", 161 'inotendswith': "NOT LIKE %s ESCAPE '\\'", 156 162 } 157 163 158 164 # SQLite doesn't actually support most of these types, but it "does the right -
core/db/backends/mysql.py
146 146 'endswith': 'LIKE BINARY %s', 147 147 'istartswith': 'LIKE %s', 148 148 'iendswith': 'LIKE %s', 149 'notcontains': 'NOT LIKE BINARY %s', 150 'notstartswith': 'NOT LIKE BINARY %s', 151 'notendswith': 'NOT LIKE BINARY %s', 152 'inotcontains': 'NOT LIKE %s', 153 'inotstartswith': 'NOT LIKE %s', 154 'inotendswith': 'NOT LIKE %s', 149 155 } 150 156 151 157 # This dictionary maps Field objects to their associated MySQL column -
core/meta/fields.py
181 181 return value 182 182 elif lookup_type == 'year': 183 183 return ['%s-01-01' % value, '%s-12-31' % value] 184 elif lookup_type in ('contains', 'icontains' ):184 elif lookup_type in ('contains', 'icontains', 'notcontains', 'inotcontains'): 185 185 return ["%%%s%%" % prep_for_like_query(value)] 186 186 elif lookup_type == 'iexact': 187 187 return [prep_for_like_query(value)] 188 elif lookup_type in ('startswith', 'istartswith' ):188 elif lookup_type in ('startswith', 'istartswith', 'notstartswith', 'inotstartswith'): 189 189 return ["%s%%" % prep_for_like_query(value)] 190 elif lookup_type in ('endswith', 'iendswith' ):190 elif lookup_type in ('endswith', 'iendswith', 'notendswith', 'inotendswith'): 191 191 return ["%%%s" % prep_for_like_query(value)] 192 192 elif lookup_type == 'isnull': 193 193 return []