Ticket #6090: django-r6816-query-whitespace.diff
File django-r6816-query-whitespace.diff, 3.7 KB (added by , 17 years ago) |
---|
-
django/db/models/fields/related.py
334 334 cursor = connection.cursor() 335 335 cursor.execute("SELECT %s FROM %s WHERE %s = %%s AND %s IN (%s)" % \ 336 336 (target_col_name, self.join_table, source_col_name, 337 target_col_name, ", ".join(['%s'] * len(new_ids))),337 target_col_name, ", ".join(['%s'] * len(new_ids))), 338 338 [self._pk_val] + list(new_ids)) 339 339 existing_ids = set([row[0] for row in cursor.fetchall()]) 340 340 … … 363 363 cursor = connection.cursor() 364 364 cursor.execute("DELETE FROM %s WHERE %s = %%s AND %s IN (%s)" % \ 365 365 (self.join_table, source_col_name, 366 target_col_name, ", ".join(['%s'] * len(old_ids))),366 target_col_name, ", ".join(['%s'] * len(old_ids))), 367 367 [self._pk_val] + list(old_ids)) 368 368 transaction.commit_unless_managed() 369 369 … … 715 715 if obj: 716 716 instance_ids = [instance._get_pk_val() for instance in getattr(obj, self.name).all()] 717 717 if self.rel.raw_id_admin: 718 new_data[self.name] = u", ".join([smart_unicode(id) for id in instance_ids])718 new_data[self.name] = u", ".join([smart_unicode(id) for id in instance_ids]) 719 719 else: 720 720 new_data[self.name] = instance_ids 721 721 else: -
django/db/models/query.py
186 186 extra_select = self._select.items() 187 187 188 188 cursor = connection.cursor() 189 cursor.execute("SELECT " + (self._distinct and "DISTINCT " or "") + ", ".join(select) + sql, params)189 cursor.execute("SELECT " + (self._distinct and "DISTINCT " or "") + ", ".join(select) + sql, params) 190 190 191 191 fill_cache = self._select_related 192 192 fields = self.model._meta.fields … … 314 314 if id_list == []: 315 315 return {} 316 316 qs = self._clone() 317 qs._where.append("%s.%s IN (%s)" % (qn(self.model._meta.db_table), qn(self.model._meta.pk.column), ", ".join(['%s'] * len(id_list))))317 qs._where.append("%s.%s IN (%s)" % (qn(self.model._meta.db_table), qn(self.model._meta.pk.column), ", ".join(['%s'] * len(id_list)))) 318 318 qs._params.extend(id_list) 319 319 return dict([(obj._get_pk_val(), obj) for obj in qs.iterator()]) 320 320 … … 616 616 field_names.extend([f[0] for f in extra_select]) 617 617 618 618 cursor = connection.cursor() 619 cursor.execute("SELECT " + (self._distinct and "DISTINCT " or "") + ", ".join(select) + sql, params)619 cursor.execute("SELECT " + (self._distinct and "DISTINCT " or "") + ", ".join(select) + sql, params) 620 620 621 621 has_resolve_columns = hasattr(self, 'resolve_columns') 622 622 while 1: -
django/db/backends/oracle/base.py
232 232 233 233 # LIMIT and OFFSET clauses 234 234 # To support limits and offsets, Oracle requires some funky rewriting of an otherwise normal looking query. 235 select_clause = ", ".join(select)235 select_clause = ", ".join(select) 236 236 distinct = (self._distinct and "DISTINCT " or "") 237 237 238 238 if order_by: