equal
deleted
inserted
replaced
205 if groups: |
205 if groups: |
206 for vref in term.iget_nodes(VariableRef): |
206 for vref in term.iget_nodes(VariableRef): |
207 if not vref in groups: |
207 if not vref in groups: |
208 groups.append(vref) |
208 groups.append(vref) |
209 |
209 |
210 def fix_selection(rqlst, selectedidx, needwrap, sorts, groups, having): |
210 def fix_selection_and_group(rqlst, selectedidx, needwrap, selectsortterms, |
211 if sorts: |
211 sorts, groups, having): |
|
212 if selectsortterms and sorts: |
212 sort_term_selection(sorts, selectedidx, rqlst, not needwrap and groups) |
213 sort_term_selection(sorts, selectedidx, rqlst, not needwrap and groups) |
|
214 if sorts and groups: |
|
215 for sortterm in sorts: |
|
216 term = sortterm.term |
|
217 if not isinstance(term, Constant): |
|
218 for vref in term.iget_nodes(VariableRef): |
|
219 if not vref in groups: |
|
220 groups.append(vref) |
213 if needwrap: |
221 if needwrap: |
214 if groups: |
222 if groups: |
215 for vref in groups: |
223 for vref in groups: |
216 if not vref.name in selectedidx: |
224 if not vref.name in selectedidx: |
217 selectedidx.append(vref.name) |
225 selectedidx.append(vref.name) |
408 if distinct: |
416 if distinct: |
409 sort_term_selection(sorts, outerselectidx, |
417 sort_term_selection(sorts, outerselectidx, |
410 outerselection, groups) |
418 outerselection, groups) |
411 else: |
419 else: |
412 outerselectidx = selectidx[:] |
420 outerselectidx = selectidx[:] |
413 fix_selection(select, selectidx, needwrap, |
421 fix_selection_and_group(select, selectidx, needwrap, |
414 selectsortterms and sorts, groups, having) |
422 selectsortterms, sorts, groups, having) |
415 if needwrap: |
423 if needwrap: |
416 fselectidx = outerselectidx |
424 fselectidx = outerselectidx |
417 fneedwrap = len(outerselection) != len(origselection) |
425 fneedwrap = len(outerselection) != len(origselection) |
418 else: |
426 else: |
419 fselectidx = selectidx |
427 fselectidx = selectidx |