engine = property(lambda s:s.left.engine or s.right.engine)
+ class JoinMarker(FromClause):
+ def __init__(self, id, join):
+ FromClause.__init__(self, from_key=id)
+ self.join = join
+
def _process_from_dict(self, data, asfrom):
for f in self.onclause._get_from_objects():
data[f.id] = f
for f in self.left._get_from_objects() + self.right._get_from_objects():
- # mark the object as a "blank" from that wont be printed
- # TODO: now, when one of the existing froms is also a join that should be
- # joined to us, join up to it.
- data[f.id] = FromClause(from_key=f.id)
+ # mark the object as a "blank" "from" that wont be printed
+ data[f.id] = Join.JoinMarker(f.id, self)
# a JOIN always impacts the final FROM list of a select statement
data[self.id] = self
self.columns = util.OrderedProperties()
self.froms = util.OrderedDict()
self.use_labels = use_labels
- self.id = id(self)
+ self.id = "Select(%d)" % id(self)
self.name = None
self.whereclause = whereclause
self._engine = engine
self.children = HashSet()
self.parent = None
self.circular = False
- def append(self, node):
- if node.parent is not None:
- del node.parent.children[node]
- self.children.append(node)
- node.parent = self
def __str__(self):
return self.safestr({})
def safestr(self, hash, indent = 0):
del parentnode.children[c]
root.parent = parentnode
parentnode.children.append(root)
- print str(parentnode)
# now we have a collection of subtrees which represent dependencies.
# go through the collection root nodes wire them together into one tree
head = None
for node in nodes.values():
- print "hi1:" + str(node)
if node.parent is None:
if head is not None:
head.append(node)