Adds filtering conditions to query string

@param array  $aWhere filter conditions
@param string $sSql   query string

@return string
356204
protected function _prepareWhereQuery($aWhere, $sSql)
    {
        $sSql = parent::_prepareWhereQuery($aWhere, $sSql);

        $sArtTable = getViewName('oxarticles', $this->_iEditLang);
        $sArtTitleField = "{$sArtTable}.oxtitle";

        // if searching in article title field, updating sql for this case
        if ($this->_aWhere[$sArtTitleField]) {
            $sSqlForTitle = " (CONCAT( {$sArtTable}.oxtitle, if(isnull(oxparentarticles.oxtitle), '', oxparentarticles.oxtitle), {$sArtTable}.oxvarselect)) ";
            $sSql = getStr()->preg_replace("/{$sArtTable}\.oxtitle\s+like/", "$sSqlForTitle like", $sSql);
        }

        return $sSql;
    }
379061
private function setLeftJoin($table, $field, $parentField, $alias, $parentAlias, $withWhere = false)
    {
        if (!in_array($alias, $this->tables)) {
            $condition = $this->getFullFieldName($field, $alias).' = '.$this->getFullFieldName($parentField, $parentAlias);
            $this->queryBuilder->leftJoin($table, $alias, 'WITH', $condition);
            if ($withWhere) {
                $this->queryBuilder->andWhere($condition);
            }
            $this->tables[] = $alias;
        }
    }
479793
public static void applyMetaCriteriaToQuery(Query query, QueryWhere queryWhere) {
        if( queryWhere.getCount() != null ) {
           query.setMaxResults(queryWhere.getCount());
        }
        if( queryWhere.getOffset() != null ) {
           query.setFirstResult(queryWhere.getOffset());
        }
    }
523959
public static List<AbstractWhere> analyzeWheres(final String _where)
        throws EFapsException
    {
        final List<AbstractWhere> ret = new ArrayList<>();
        try {
            final NonOpPrint print = (NonOpPrint) new EQLInvoker().invoke("print query type EFaps_ATypeName where "
                            + _where + " select attribute[OID]");
            if (print != null) {
                ret.addAll(print.getWheres());
            }
        } catch (final Exception e) {
            throw new EFapsException(InvokerUtil.class.getName(), e);
        }
        return ret;
    }
327317
public function addConditions(\yii\db\ActiveQuery $query)
    {
        if ($query instanceof ActiveQuery) {
            $this->addQuickSearchConditions($query);
        }
        $this->validate();
        $this->addAttributesSearchConditions($query);
        return $query;
    }
154108
protected function addConditions($query, $conditions)
    {
        foreach ($conditions as $key => $value) {
            $this->addWhere($query, $key, $value);
        }

        return $query;
    }
1155208
public function filter($fieldMap = array())
    {
        if (empty($this->filter['filters'])) {
            return array();
        }

        $where = new Predicate();
        $where->addPredicate($this->parseFilters($this->filter, $fieldMap));

        return $where;
    }
636379
public function where($conditions, $parameters = [])
	{
		$this->where = [];

		if (!empty($conditions)) {
			$this->addWhere($conditions, $parameters);
		}

		return $this;
	}
431286
public function orWhere($wheres = array())
		{
			if (count($wheres) > 0) {
				if ( ! isset($this->wheres['$or']) or ! Arrays::is($this->wheres['$or'])) {
					$this->wheres['$or'] = array();
				}

				foreach ($wheres as $wh => $val) {
					$this->wheres['$or'][] = array($wh => $val);
				}
			}

			return $this;
		}
908896
protected function addExtendedAdvancedSearchWhereClause($qb, $filters)
    {
        $parseFilters = [];
        if (isset($filters->root[0])) {
            // Function is determined by the second clause type
            $type         = (isset($filters->root[1])) ? $filters->root[1]->type : $filters->root[0]->type;
            $parseFilters = &$filters->root;
        } elseif (isset($filters->children[0])) {
            $type         = (isset($filters->children[1])) ? $filters->children[1]->type : $filters->children[0]->type;
            $parseFilters = &$filters->children;
        } elseif (is_array($filters)) {
            $type         = (isset($filters[1])) ? $filters[1]->type : $filters[0]->type;
            $parseFilters = &$filters;
        }

        if (empty($type)) {
            $type = 'and';
        }

        $parameters  = [];
        $expressions = $qb->expr()->{"{$type}X"}();

        if ($parseFilters) {
            $this->parseExtendedSearchFilters($parseFilters, $qb, $expressions, $parameters);
        }

        return [$expressions, $parameters];
    }
735476
public function setWhere(QueryBuilder $qb)
    {
        // Global filtering
        if ($this->search != '') {
            $orExpr = $qb->expr()->orX();
            for ($i=0 ; $i < count($this->parameters); $i++) {
                if (isset($this->request['bSearchable_'.$i]) && $this->request['bSearchable_'.$i] == "true") {
                    $qbParam = "sSearch_global_{$this->associations[$i]['entityName']}_{$this->associations[$i]['fieldName']}";
                    $orExpr->add($qb->expr()->like(
                        $this->associations[$i]['fullName'],
                        ":$qbParam"
                    ));
                    $qb->setParameter($qbParam, "%" . $this->request['sSearch'] . "%");
                }
            }
            $qb->where($orExpr);
        }

        // Individual column filtering
        $andExpr = $qb->expr()->andX();
        for ($i=0 ; $i < count($this->parameters); $i++) {
            if (isset($this->request['bSearchable_'.$i]) && $this->request['bSearchable_'.$i] == "true" && $this->request['sSearch_'.$i] != '') {
                $qbParam = "sSearch_single_{$this->associations[$i]['entityName']}_{$this->associations[$i]['fieldName']}";
                $andExpr->add($qb->expr()->like(
                    $this->associations[$i]['fullName'],
                    ":$qbParam"
                ));
                $qb->setParameter($qbParam, "%" . $this->request['sSearch_'.$i] . "%");
            }
        }
        if ($andExpr->count() > 0) {
            $qb->andWhere($andExpr);
        }

        if (!empty($this->callbacks['WhereBuilder'])) {
            foreach ($this->callbacks['WhereBuilder'] as $callback) {
                $callback($qb);
            }
        }
    }
1035639
public function orWhereLessThan($column, $value, $filter = false)
    {
        return $this->orWhere($column, '<', $value, $filter);
    }
1164958
public void addWhere(final String _where)
        throws EFapsException
    {
        if (_where != null) {
            final List<AbstractWhere> wheres = InvokerUtil.analyzeWheres(_where);
            QWhereSection whereSection = null;
            for (final AbstractWhere where : wheres) {
                final AbstractQPart part = QueryBuilder.getQPart(where);
                if (whereSection == null) {
                    whereSection = new QWhereSection(part);
                } else {
                    whereSection.setPart(new QAnd(whereSection.getPart(), part));
                }
            }
            this.selectPart.setWhereSection(whereSection);
        }
    }
75556
protected function _createIdListFromSql($sSql)
    {
        $rs = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC)->select($sSql);
        if ($rs != false && $rs->count() > 0) {
            while (!$rs->EOF) {
                $rs->fields = array_change_key_case($rs->fields, CASE_LOWER);
                $this[$rs->fields['oxid']] = $rs->fields['oxid']; //only the oxid
                $rs->fetchRow();
            }
        }
    }
1260381
public function findWhereIn(array $where, $attributes = ['*'])
    {
        return $this->executeCallback(get_called_class(), __FUNCTION__, func_get_args(), function () use ($where, $attributes) {
            list($attribute, $values, $boolean, $not) = array_pad($where, 4, null);

            $this->whereIn($attribute, $values, $boolean, $not);

            return $this->prepareQuery($this->createModel())->get($attributes);
        });
    }
941162
public void addFilterClause(final String property, final String condition, final Object value,
        final String fieldName, final boolean ignoreCase) {
        if (property != null && condition != null) {
            FilterClause filterClause = new FilterClause(property.trim(), condition.trim(), value, fieldName);
            filterClause.setIgnoreCase(ignoreCase);
            filtersQueue.add(filterClause);
        } else {
            filtersQueue.add(property);
        }
    }
948584
public function queryAll($conditions = '',
                             array $params = [],
                             $indexName = DynamoDbIndex::PRIMARY_INDEX,
                             $filterExpression = '',
                             $isConsistentRead = false,
                             $isAscendingOrder = true)
    {
        $ret = new \SplDoublyLinkedList();
        $this->queryAndRun(
            function ($item) use ($ret) {
                $ret->push($item);
            },
            $conditions,
            $params,
            $indexName,
            $filterExpression,
            $isConsistentRead,
            $isAscendingOrder
        );
        
        return $ret;
    }