231 | | # TODO: This assumes the database supports subqueries. |
232 | | placeholders.append('(SELECT COUNT(*) FROM %s WHERE %s = %%s)' % \ |
233 | | (backend.quote_name(self._meta.db_table), backend.quote_name(self._meta.order_with_respect_to.column))) |
234 | | db_values.append(getattr(self, self._meta.order_with_respect_to.attname)) |
| 231 | placeholders.append('%s') |
| 232 | subsel = 'SELECT COUNT(*) FROM %s WHERE %s = %%s' % ( |
| 233 | backend.quote_name(self._meta.db_table), |
| 234 | backend.quote_name(self._meta.order_with_respect_to.column)) |
| 235 | cursor.execute(subsel, (getattr(self, self._meta.order_with_respect_to.attname),)) |
| 236 | db_values.append(cursor.fetchone()[0]) |