server/sources/rql2sql.py
changeset 438 69b79faefa94
parent 340 bfe0e95571aa
child 1122 9f37de24251f
child 1134 f885df228fc0
equal deleted inserted replaced
437:5d8dc9678707 438:69b79faefa94
   486                 sql.insert(1, 'FROM %s' % ', '.join(sorted(tables)))
   486                 sql.insert(1, 'FROM %s' % ', '.join(sorted(tables)))
   487             elif self._state.restrictions and self.dbms_helper.needs_from_clause:
   487             elif self._state.restrictions and self.dbms_helper.needs_from_clause:
   488                 sql.insert(1, 'FROM (SELECT 1) AS _T')
   488                 sql.insert(1, 'FROM (SELECT 1) AS _T')
   489             sqls.append('\n'.join(sql))
   489             sqls.append('\n'.join(sql))
   490         if select.need_intersect:
   490         if select.need_intersect:
   491             if distinct:
   491             # XXX use getattr for lgc bw compat, remove once 0.37.3 is out
       
   492             if distinct or not getattr(self.dbms_helper, 'intersect_all_support', True):
   492                 return '\nINTERSECT\n'.join(sqls)
   493                 return '\nINTERSECT\n'.join(sqls)
   493             else:
   494             else:
   494                 return '\nINTERSECT ALL\n'.join(sqls)
   495                 return '\nINTERSECT ALL\n'.join(sqls)
   495         elif distinct:
   496         elif distinct:
   496             return '\nUNION\n'.join(sqls)
   497             return '\nUNION\n'.join(sqls)