19 |
19 |
20 FIXME : this code needs refactoring. Some problems : |
20 FIXME : this code needs refactoring. Some problems : |
21 * get data from the parent plan, the latest step, temporary table... |
21 * get data from the parent plan, the latest step, temporary table... |
22 * each step has is own members (this is not necessarily bad, but a bit messy |
22 * each step has is own members (this is not necessarily bad, but a bit messy |
23 for now) |
23 for now) |
24 |
|
25 """ |
24 """ |
|
25 |
26 __docformat__ = "restructuredtext en" |
26 __docformat__ = "restructuredtext en" |
27 |
27 |
28 from rql.nodes import VariableRef, Variable, Function |
28 from rql.nodes import VariableRef, Variable, Function |
29 |
29 |
30 from cubicweb.server.ssplanner import (LimitOffsetMixIn, Step, OneFetchStep, |
30 from cubicweb.server.ssplanner import (LimitOffsetMixIn, Step, OneFetchStep, |
35 def remove_clauses(union, keepgroup): |
35 def remove_clauses(union, keepgroup): |
36 clauses = [] |
36 clauses = [] |
37 for select in union.children: |
37 for select in union.children: |
38 if keepgroup: |
38 if keepgroup: |
39 having, orderby = select.having, select.orderby |
39 having, orderby = select.having, select.orderby |
40 select.having, select.orderby = None, None |
40 select.having, select.orderby = (), () |
41 clauses.append( (having, orderby) ) |
41 clauses.append( (having, orderby) ) |
42 else: |
42 else: |
43 groupby, having, orderby = select.groupby, select.having, select.orderby |
43 groupby, having, orderby = select.groupby, select.having, select.orderby |
44 select.groupby, select.having, select.orderby = None, None, None |
44 select.groupby, select.having, select.orderby = (), (), () |
45 clauses.append( (groupby, having, orderby) ) |
45 clauses.append( (groupby, having, orderby) ) |
46 return clauses |
46 return clauses |
47 |
47 |
48 def restore_clauses(union, keepgroup, clauses): |
48 def restore_clauses(union, keepgroup, clauses): |
49 for i, select in enumerate(union.children): |
49 for i, select in enumerate(union.children): |