server/sources/rql2sql.py
changeset 340 bfe0e95571aa
parent 339 c0a0ce6c0428
child 438 69b79faefa94
equal deleted inserted replaced
339:c0a0ce6c0428 340:bfe0e95571aa
   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             return '\nINTERSECT\n'.join(sqls)
   491             if distinct:
       
   492                 return '\nINTERSECT\n'.join(sqls)
       
   493             else:
       
   494                 return '\nINTERSECT ALL\n'.join(sqls)
   492         elif distinct:
   495         elif distinct:
   493             return '\nUNION\n'.join(sqls)
   496             return '\nUNION\n'.join(sqls)
   494         else:
   497         else:
   495             return '\nUNION ALL\n'.join(sqls)
   498             return '\nUNION ALL\n'.join(sqls)
   496         
   499