equal
deleted
inserted
replaced
759 restrictions, tables = self._state.pop_scope() |
759 restrictions, tables = self._state.pop_scope() |
760 if restriction: |
760 if restriction: |
761 restrictions.append(restriction) |
761 restrictions.append(restriction) |
762 restriction = ' AND '.join(restrictions) |
762 restriction = ' AND '.join(restrictions) |
763 if not restriction: |
763 if not restriction: |
|
764 if tables: |
|
765 return 'SELECT 1 FROM %s' % ', '.join(tables) |
764 return '' |
766 return '' |
765 if not tables: |
767 if not tables: |
766 # XXX could leave surrounding EXISTS() in this case no? |
768 # XXX could leave surrounding EXISTS() in this case no? |
767 sql = 'SELECT 1 WHERE %s' % restriction |
769 sql = 'SELECT 1 WHERE %s' % restriction |
768 else: |
770 else: |