예제 #1
0
	def update_nodes(self):
		"""
		Update any :class:‘SelectionLeaf‘'s *join* with the first join of
		*self.joins_order* if it doesn't already have a join.
		"""

		if not self.selection_node:
			self.set_default_selectors()

		if not self.joins_order:
			return

		for leaf in self.selection_node:
			if not leaf.join:
				leaf.join = self.joins_order[0]

		for leaf in self.annotation_node:
			if not leaf.join:
				leaf.join = self.joins_order[0]

		for leaf in utils.recurse(self.where_node):
			if not leaf.join and not leaf.db_table == "":
				leaf.join = self.joins_order[-1]

		orderby_table = self.joins_order[0].get_left_side_alias()
		for obl in self.orderby_node:
			obl.db_table = orderby_table
예제 #2
0
	def get_values(self):
		"""Returns a dict of all WhereLeaf values to be passed to the database
		adapter for proper escaping."""

		d = {}
		for wl in utils.recurse(self.where_node):
			d.update(wl.get_values())
		return d