function toDialectString(IDialect $dialect) { $querySlices = array(); $querySlices[] = 'DELETE FROM'; $querySlices[] = $dialect->quoteIdentifier($this->table); if ($this->condition) { $querySlices[] = 'WHERE'; $querySlices[] = $this->condition->toDialectString($dialect); } $compiledQuery = join(' ', $querySlices); return $compiledQuery; }
function toDialectString(IDialect $dialect) { $compiledSlices = array(); $compiledSlices[] = $this->getJoinMethod()->toDialectString($dialect); $compiledSlices[] = $this->getSource()->toDialectString($dialect); $compiledSlices[] = 'ON'; $compiledSlices[] = '('; $compiledSlices[] = $this->condition->toDialectString($dialect); $compiledSlices[] = ')'; $compiledString = join(' ', $compiledSlices); return $compiledString; }
/** * Converts EntityQuery to IExpresion object. * * Note that projections, and references to associated entities are useless and won't be * presented in the resulting expression because required joins can only be specified * as sources for selection * * @todo check whether we refer to encapsulants and avoid this * * @return IExpression */ function toExpression() { if (!$this->condition) { return new ExpressionChain(); } $eqb = new EntityQueryBuilder($this->entity); $subjected = $this->condition->toSubjected($eqb); Assert::isTrue(sizeof($eqb->getSelectQuerySources()) == 1, 'do not refer to %s encapsulants here', $this->entity->getLogicalSchema()->getEntityName()); return $subjected; }
function toDialectString(IDialect $dialect) { $querySlices = array(); $querySlices[] = 'SELECT'; if ($this->distinct) { $querySlices[] = 'DISTINCT'; } $querySlices[] = $this->get->toDialectString($dialect); if (!$this->sources->isEmpty()) { $querySlices[] = 'FROM'; $querySlices[] = $this->sources->toDialectString($dialect); } // WHERE if ($this->condition) { $querySlices[] = 'WHERE'; $querySlices[] = $this->condition->toDialectString($dialect); } // GROUP BY if (!$this->groups->isEmpty()) { $querySlices[] = 'GROUP BY'; $querySlices[] = $this->groups->toDialectString($dialect); } // HAVING if ($this->having) { $querySlices[] = 'HAVING'; $querySlices[] = $this->having->toDialectString($dialect); } if (!$this->order->isEmpty()) { $querySlices[] = $this->order->toDialectString($dialect); } if ($this->limit) { $querySlices[] = 'LIMIT'; $querySlices[] = $this->limit; } if ($this->offset) { $querySlices[] = 'OFFSET'; $querySlices[] = $this->offset; } $queryString = join(' ', $querySlices); return $queryString; }
function fill(SelectQuery $selectQuery, EntityQuery $entityQuery) { $selectQuery->having($this->expression->toSubjected($entityQuery)); }
function fill(SelectQuery $selectQuery, EntityQueryBuilder $builder) { $selectQuery->setHaving($this->expression->toSubjected($builder)); }