/** * @since 2.0 * @param Query $query * * @return QueryResult|string */ public function getQueryResult(Query $query) { if ((!$this->engineOptions->get('smwgIgnoreQueryErrors') || $query->getDescription() instanceof ThingDescription) && $query->querymode != Query::MODE_DEBUG && count($query->getErrors()) > 0) { return $this->queryResultFactory->newEmptyQueryResult($query, false); } // don't query, but return something to the printer if ($query->querymode == Query::MODE_NONE) { return $this->queryResultFactory->newEmptyQueryResult($query, true); } if ($query->querymode == Query::MODE_DEBUG) { return $this->getDebugQueryResult($query); } elseif ($query->querymode == Query::MODE_COUNT) { return $this->getCountQueryResult($query); } return $this->getInstanceQueryResult($query); }
/** * @since 2.0 * @param Query $query * * @return QueryResult|string */ public function getQueryResult(Query $query) { if ((!$this->engineOptions->get('smwgIgnoreQueryErrors') || $query->getDescription() instanceof ThingDescription) && $query->querymode != Query::MODE_DEBUG && count($query->getErrors()) > 0) { return $this->queryResultFactory->newEmptyQueryResult($query, false); } // don't query, but return something to the printer if ($query->querymode == Query::MODE_NONE || $query->getLimit() < 1) { return $this->queryResultFactory->newEmptyQueryResult($query, true); } $this->compoundConditionBuilder->setSortKeys($query->sortkeys); $compoundCondition = $this->compoundConditionBuilder->buildCondition($query->getDescription()); $query->addErrors($this->compoundConditionBuilder->getErrors()); if ($query->querymode == Query::MODE_DEBUG) { return $this->getDebugQueryResult($query, $compoundCondition); } elseif ($query->querymode == Query::MODE_COUNT) { return $this->getCountQueryResult($query, $compoundCondition); } return $this->getInstanceQueryResult($query, $compoundCondition); }