Builds and returns array of SQL WHERE conditions.

@return array
345176
public function buildWhere()
    {
        if ($this->_aWhere === null && ($list = $this->getItemList())) {
            $this->_aWhere = [];
            $filter = $this->getListFilter();
            if (is_array($filter)) {
                $listItem = $this->getItemListBaseObject();
                $languageId = $listItem->isMultilang() ? $listItem->getLanguage() : \OxidEsales\Eshop\Core\Registry::getLang()->getBaseLanguage();
                $localDateFormat = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('sLocalDateFormat');

                foreach ($filter as $table => $filterData) {
                    foreach ($filterData as $name => $value) {
                        if ($value || '0' === ( string )$value) {
                            $field = "{$table}__{$name}";

                            // if no table name attached to field name, add it
                            $name = $table ? getViewName($table, $languageId) . ".{$name}" : $name;

                            // #M1260: if field is date
                            if ($localDateFormat && $localDateFormat != 'ISO' && isset($listItem->$field)) {
                                $fieldType = $listItem->{$field}->fldtype;
                                if ("datetime" == $fieldType || "date" == $fieldType) {
                                    $value = $this->_convertToDBDate($value, $fieldType);
                                }
                            }

                            $this->_aWhere[$name] = "%{$value}%";
                        }
                    }
                }
            }
        }

        return $this->_aWhere;
    }
674970
public function
	GetConditions() {
	/*//
	return the conditions, baking any codas.
	//*/

		foreach($this->Conditions as $Cond)
		if($Cond instanceof Coda)
		$Cond->SetDatabase($this->Database);

		return $this->Conditions;
	}
401255
public function build()
    {
        $sql = [
            $this->from->build(),
            $this->where->build(),
            $this->orderBy->build(),
            $this->limit->build(),
        ];

        $this->values = $this->where->getValues();

        return implode(' ', array_filter($sql));
    }
574
public function findWhere($conditions=null, $_=null)
    {
        $query =  $this->db->select($this->getColumns())
            ->from($this->entity->getTable());
        $query->context->resultHandler = function ($result){
            foreach ($result as &$i){
                $i = $this->entity->make($i, false);
            }
            return $result;
        };
        return call_user_func_array([$query, 'where'], func_get_args());
    }
477613
protected function getSelectSql(array $sql): array
    {
        $sql[] = trim('SELECT ' . trim(implode(' ', [
            $this->distinct,
            $this->highPriority,
            $this->straightJoin,
            $this->resultSize,
            $this->bufferResult,
            $this->calcFoundRows,
        ])));

        return $sql;
    }
478302
protected function whereStatement(): array
    {
        return [
            $this->key(Record::OUTER_KEY) => $this->parent->getField($this->key(Record::INNER_KEY))
        ];
    }
868658
protected function buildWheres()
    {
        if (count($this->where) === 0) {
            return '';
        }

        // Use a ConditionSet to build the wheres
        $conditionSet = new Query\Condition\AndSet($this, $this->where);
        return "WHERE {$conditionSet->buildWithoutParentheses()}";
    }
776730
private function _constructSql() {
        if($this->sql) {
            return [$this->sql,$this->params];
        }
        $distinct = $this->distinct ? 'DISTINCT' : '';
        $groupby = '';
        if (!empty($this->group)) {
            $groupby = 'GROUP BY ' . $this->group;
        }
        if (!empty($this->having)) {
            $groupby .= ' ' . $this->having;
        }
        $order = !empty($this->order) ? "ORDER BY $this->order" : '';

        $this->fields = $this->fields?$this->fields:'*';
        $sql = "SELECT $distinct $this->fields FROM `$this->table` $this->alias $this->join $this->where $groupby $order $this->limit";
        $sql = str_replace('table.',$this->alias.'.',$sql);
        return [$sql,$this->params];
    }
757181
public function where()
	{
		$condition = func_get_args();
		is_array(reset($condition)) and $condition = reset($condition);

		return $this->_where($condition);
	}
455595
public function getConditions()
    {
        $conditions = $this->entity->getConditions();
        $result = [];
        if ($conditions) {
            foreach ($conditions as $condition) {
                $result[] = new Condition($condition, $this->locale);
            }

            return $result;
        }

        return;
    }
18646
private function build_where(array $where_array){
        $where_clause = [];
        $counter = 0;
        foreach( $where_array as list($glue, $where) ){
            if( $counter ){
                $where_clause[] = $glue;
            }
            if( is_array($where) ){
                $where_clause[] = $this->build_where($where_array);
            }else{
                $where_clause[] = sprintf('(%s)', $where);
            }
            $counter++;
        }
        return sprintf('(%s)', implode(' ', $where_clause));
    }
163383
public function whereToSql(bool $useClause = true): array
    {
        if ($this->exists) {
            $exists = $this->prepareExists($this->exists);

            if ($exists['negate']) {
                $sql = 'NOT EXISTS (' . $exists['sql'] . ')';
            } else {
                $sql = 'EXISTS (' . $exists['sql'] . ')';
            }

            $params = $exists['params'];
        } else {
            [$sql, $params] = $this->wConditions()->toSql();
        }

        if ($sql and $useClause) {
            $sql = 'WHERE ' . $sql;
        }

        return [$sql, $params];
    }
280742
private function buildQuery()
    {
        $this->validateQuery();

        $statement = "";
        if ($this->select !== null) {
            $statement .= sprintf("%s %s ", self::SELECT, $this->select);
        }
        if ($this->from !== null) {
            $statement .= sprintf("%s %s ", self::FROM, $this->from);
        }
        if ($this->where !== null) {
            $statement .= sprintf("%s %s ", self::WHERE, $this->where);
        }
        if ($this->orderBy !== null) {
            $statement .= sprintf("%s %s ", self::ORDER_BY, $this->orderBy);
        }
        if ($this->limit !== null) {
            $statement .= sprintf("%s %s ", self::LIMIT, $this->limit);
        }
        if ($this->offset !== null) {
            $statement .= sprintf("%s %s ", self::OFFSET, $this->offset);
        }

        return trim($statement);
    }
64773
public function build()
    {
        $value = sprintf("'%s'", $this->value);

        $where = sprintf('WHERE %s %s %s', $this->column, $this->operator, $value);

        $keyword = $this->keyword;

        if (!is_null($keyword)) {
            $where = sprintf(' %s %s', $keyword, $where);
        }

        return $where;
    }
1019987
public function sql()
    {
        if ($this->active()) {
            if ($this->hasFilters()) {
                $sql = $this->byFilters();
                if ($this->isNegating()) {
                    return $this->operator().' '.$sql;
                }
                return $sql;
            }

            if ($this->hasCondition()) {
                $sql = $this->byCondition();
                if ($this->isNegating()) {
                    return $this->operator().' ('.$sql.')';
                }
                return $sql;
            }

            if ($this->hasFields()) {
                return $this->byPredicate();
            }
        }

        return '';
    }
1269448
private function getParentJoinsWhereClause(): array
    {
        $result = [];
        foreach ($this->getParentJoins() as $name => $conditions) {
            $result = array_merge($result, $conditions);

            $this->query->leftJoinWith($name, function ($q) {
                return $q->applyOptions(['accessCheck' => false]); // disable access check on joins
            });
        }

        return $result;
    }
619362
public function getWhere()
    {
        $template = "WHERE %s";
        $where = null;
        if (count($this->_sql->conditions->predicates) > 0) {
            $where = trim(
                sprintf($template, $this->_sql->conditions->toString())
            );
        }

        return $where;
    }