/** * @param QOM\QueryObjectModelInterface $qom * * @return string */ public function walkQOMQuery(QueryObjectModel $qom) { $this->orderings = array(); $source = $qom->getSource(); $query = new Lucene\Search\Query\Boolean(); $parts = array(); $parts[] = '(' . $this->walkSource($source) . ')'; if ($constraint = $qom->getConstraint()) { $parts[] = '(' . $this->walkConstraint($constraint) . ')'; } $this->walkOrderings($qom->getOrderings()); $query = join(' AND ', $parts); return $query; }
/** * @param QueryObjectModel $qom * * @return string */ public function walkQOMQuery(QueryObjectModel $qom) { $source = $qom->getSource(); $selectors = $this->validateSource($source); $sourceSql = " " . $this->walkSource($source); $constraintSql = ''; if ($constraint = $qom->getConstraint()) { $constraintSql = " AND " . $this->walkConstraint($constraint); } $orderingSql = ''; if ($orderings = $qom->getOrderings()) { $orderingSql = " " . $this->walkOrderings($orderings); } $sql = "SELECT " . $this->getColumns($qom); $sql .= $sourceSql; $sql .= $constraintSql; $sql .= $orderingSql; $limit = $qom->getLimit(); $offset = $qom->getOffset(); if (null !== $offset && null == $limit && ($this->platform instanceof MySqlPlatform || $this->platform instanceof SqlitePlatform)) { $limit = PHP_INT_MAX; } $sql = $this->platform->modifyLimitQuery($sql, $limit, $offset); return array($selectors, $this->alias, $sql); }