コード例 #1
0
 /**
  * {@inheritdoc}
  */
 public function applyConditions(ISelectBuilder $selectBuilder)
 {
     $selectBuilder->begin($this->mode);
     foreach ($this->conditions as $fieldCondition) {
         $fieldCondition->apply($selectBuilder);
     }
     foreach ($this->getGroups() as $nextGroup) {
         $nextGroup->applyConditions($selectBuilder);
     }
     $selectBuilder->end();
     return $this;
 }
コード例 #2
0
 /**
  * Строит часть ограничительную часть запроса
  * @param ISelectBuilder $query
  * @return string
  */
 private function buildLimitPart(ISelectBuilder $query)
 {
     $limitSql = '';
     if ($query->getLimit()) {
         $limitSql = "\nLIMIT " . $query->getLimit();
         if ($query->getOffset()) {
             $limitSql .= " OFFSET " . $query->getOffset();
         }
     }
     return $limitSql;
 }
コード例 #3
0
ファイル: Selector.php プロジェクト: umisoft/umi.framework
 /**
  * Применяет ограничения на выборку
  * @param ISelectBuilder $selectBuilder
  */
 protected function applyLimitConditions(ISelectBuilder $selectBuilder)
 {
     if ($this->limit) {
         $postfix = self::PLACEHOLDER_SEPARATOR . $this->collection->getName();
         $limitPlaceholder = ':limit' . $postfix;
         $selectBuilder->limit($limitPlaceholder)->bindInt($limitPlaceholder, $this->limit);
         if ($this->offset) {
             $offsetPlaceholder = ':offset' . $postfix;
             $selectBuilder->offset($offsetPlaceholder)->bindInt($offsetPlaceholder, $this->offset);
         }
     }
 }
コード例 #4
0
 /**
  * Прнименяет условие на выборку "BETWEEN"
  * @param ISelectBuilder $selectBuilder
  * @return $this
  */
 protected function applyBetweenCondition(ISelectBuilder $selectBuilder)
 {
     list($minValue, $maxValue) = $this->expression;
     $minPlaceholder = $this->placeholder . ISelector::PLACEHOLDER_SEPARATOR . 'min';
     $maxPlaceholder = $this->placeholder . ISelector::PLACEHOLDER_SEPARATOR . 'max';
     $selectBuilder->begin()->expr($this->fieldColumn, IFieldCondition::OPERATOR_EQMORE, $minPlaceholder)->expr($this->fieldColumn, IFieldCondition::OPERATOR_EQLESS, $maxPlaceholder)->bindValue($minPlaceholder, $minValue, $this->field->getDataType())->bindValue($maxPlaceholder, $maxValue, $this->field->getDataType())->end();
     return $this;
 }