/**
  * Executes the query setting firstResult and maxResults.
  *
  * @return \PHPCR\Query\QueryResultInterface
  */
 public function execute()
 {
     if ($this->query === null || $this->state === self::STATE_DIRTY) {
         $this->query = $this->getQuery();
     }
     foreach ($this->params as $key => $value) {
         $this->query->bindValue($key, $value);
     }
     $queryResult = $this->query->execute();
     return $queryResult;
 }
 /**
  * Query ::= 'SELECT' columns
  *     'FROM' Source
  *     ['WHERE' Constraint]
  *     ['ORDER BY' orderings]
  *
  * @param QOM\QueryObjectModelInterface $query
  *
  * @return string
  */
 public function convert(QOM\QueryObjectModelInterface $query)
 {
     $columns = $this->convertColumns($query->getColumns());
     $source = $this->convertSource($query->getSource());
     $constraint = '';
     $orderings = '';
     if ($query->getConstraint() !== null) {
         $constraint = $this->convertConstraint($query->getConstraint());
     }
     if (count($query->getOrderings())) {
         $orderings = $this->convertOrderings($query->getOrderings());
     }
     return $this->generator->evalQuery($source, $columns, $constraint, $orderings);
 }