equal
deleted
inserted
replaced
484 """return the table alias used by the given relation""" |
484 """return the table alias used by the given relation""" |
485 if relation in self.done: |
485 if relation in self.done: |
486 return relation._q_sqltable |
486 return relation._q_sqltable |
487 rid = 'rel_%s%s' % (relation.r_type, self.count) |
487 rid = 'rel_%s%s' % (relation.r_type, self.count) |
488 # relation's table is belonging to the root scope if it is the principal |
488 # relation's table is belonging to the root scope if it is the principal |
489 # table of one of it's variable and if that variable belong's to parent |
489 # table of one of its variable and that variable belong's to parent |
490 # scope |
490 # scope |
491 for varref in relation.iget_nodes(VariableRef): |
491 for varref in relation.iget_nodes(VariableRef): |
492 var = varref.variable |
492 var = varref.variable |
493 if isinstance(var, ColumnAlias): |
|
494 scope = 0 |
|
495 break |
|
496 # XXX may have a principal without being invariant for this generation, |
493 # XXX may have a principal without being invariant for this generation, |
497 # not sure this is a pb or not |
494 # not sure this is a pb or not |
498 if var.stinfo.get('principal') is relation and var.scope is var.stmt: |
495 if var.stinfo.get('principal') is relation and var.scope is var.stmt: |
499 scope = 0 |
496 scope = 0 |
500 break |
497 break |