public function apply(Statsomatic_Query $q) { $q->addLeftJoin($q->nextDetailsAlias(), $q->mainColumn('entry_id'), $q->detailColumn('entry_id')); $selectExpression = $this->aggregator->apply($q->detailColumn($this->variable->getValueColumn())); $q->select($q->nextValueAlias($selectExpression))->where($q->expr->eq($q->detailColumn('provider'), $q->bindValue($this->variable->getProvider(), null, PDO::PARAM_STR)), $q->expr->eq($q->detailColumn('variable'), $q->bindValue($this->variable->getName(), null, PDO::PARAM_STR)))->orderBy($selectExpression, ezcQuerySelect::DESC); if ($this->aggregator->isId()) { $q->groupBy($q->detailColumn($this->variable->getValueColumn())); } }
public function apply(Statsomatic_Query $q) { $q->where($q->expr->{$this->comperator}($q->mainColumn($this->variable->getColumnName()), $q->bindValue($this->value, null, $this->variable->getPdoType()))); }
public function apply(Statsomatic_Query $q) { $valueColumn = $this->variable->getValueColumn(); $qDetail = $q->subSelect(); $qDetail->from($q->nextDetailsAlias())->select($q->detailColumn('entry_id'))->where($q->expr->eq($q->detailColumn('provider'), $q->bindValue($this->variable->getProvider(), null, PDO::PARAM_STR)), $q->expr->eq($q->detailColumn('variable'), $q->bindValue($this->variable->getName(), null, PDO::PARAM_STR)), $q->expr->{$this->comperator}($q->detailColumn($valueColumn), $q->bindValue($this->value, null, $this->variable->getPdoType()))); $q->where($q->expr->in($q->mainColumn('entry_id'), $qDetail)); }