/** * Create a new node and set it as the current node * @return epQueryNode */ protected function node($type) { // create a node with type $this->n = new epQueryNode($type); // set line and char if (isset($this->t) && isset($this->t->line)) { $this->n->setParam('line', $this->t->line); } if (isset($this->t) && isset($this->t->char)) { $this->n->setParam('char', $this->t->char); } // return this node return $this->n; }
/** * Call children's SQL builders * @param epQueryNode &$node * @param string $seperator * @param boolean $use_parentheses Whether to use parentheses around child results * @return boolean */ protected function _buildSqlChildren(epQueryNode &$node, $seperator = ' ', $use_parentheses = false) { $results = array(); if ($children = $node->getChildren()) { foreach ($children as &$child) { if ($result = $this->buildSql($child)) { $results[] = $result; } } } // use parentheses only when we have more than one child results if ($use_parentheses && count($results) > 1) { foreach ($results as $k => $result) { $results[$k] = '(' . $result . ')'; } } return implode($seperator, $results); }
/** * Call children's SQL builders * @return boolean */ protected function _buildSqlChildren(epQueryNode &$node, $seperator = ' ') { $results = array(); if ($children = $node->getChildren()) { foreach ($children as &$child) { $results[] = $this->buildSql($child); } } return implode($seperator, $results); }