Builds the query.

@return \Exchanger\Contract\ExchangeRateQuery
769491
public function build()
    {
        if ($this->date) {
            return new HistoricalExchangeRateQuery($this->currencyPair, $this->date, $this->options);
        }

        return new ExchangeRateQuery($this->currencyPair, $this->options);
    }
462797
public function buildQueryBuilder()
    {
        $builder = new QueryBuilder();

        foreach ($this->parsers as $parser) {
            if ($parser->wasApplied()) {
                $parser->apply($builder);
            }
        }

        foreach ($this->sorts as $sort) {
            $builder->orderBy($sort[0], $sort[1]);
        }

        if (!empty($this->perPage)) {
            $builder->setPageSize($this->perPage);
        }

        if (!empty($this->page)) {
            $builder->setPage($this->page);
        }

        if (!empty($this->searchQuery)) {
            $builder->setSearchQuery($this->searchQuery);
        }

        return $builder;
    }
702980
public function build()
    {
        $query = $this->delegate->build();
        $this->utilityRegistry->addUtility(AdsUtility::REPORT_QUERY_BUILDER);
        return $query;
    }
791779
public function build(): GetSearchResultsRequest
	{
		$instance = new GetSearchResultsRequest();
		if ($this->searchId === null) {
			throw new BuilderException('Property [searchId] is required.');
		}
		$instance->searchId = $this->searchId;
		if ($this->fromIndex === null) {
			throw new BuilderException('Property [fromIndex] is required.');
		}
		$instance->fromIndex = $this->fromIndex;
		if ($this->toIndex === null) {
			throw new BuilderException('Property [toIndex] is required.');
		}
		$instance->toIndex = $this->toIndex;
		return $instance;
	}
590312
public static function query()
    {
        $query = new Query(get_called_class());
        $query->set_searchable_fields(static::get_searchable_fields());
        $query->set_primary_key(static::get_primary_key());

        return $query;
    }
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));
    }
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;
    }
983085
protected function assembleQuery() {
		if (empty($this->query)) {
			if ($this->queryRaw === null) {
				return '';
			}
			
			return $this->queryRaw;
		}
		
		return '?' . http_build_query($this->query);
	}
299938
public function supportQuery(ExchangeRateQuery $exchangeQuery): bool
    {
        $currencyPair = $exchangeQuery->getCurrencyPair();

        return !$exchangeQuery instanceof HistoricalExchangeRateQuery
            && in_array($currencyPair->getBaseCurrency(), $this->getSupportedCodes())
            && in_array($currencyPair->getQuoteCurrency(), $this->getSupportedCodes());
    }
799818
protected function newBaseQueryBuilder()
    {
        $conn = $this->getConnection();

        $grammar = $conn->getQueryGrammar();

        $builder = new Builder($conn, $grammar, $conn->getPostProcessor());
        $builder->cacheDriver($this->cache);

        if ($this->expire !== null) {
            $builder->remember($this->expire);
        }

        $builder->cacheTags($this->table);

        return $builder;
    }
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);
    }
122367
public function query() {
        $builder = $this->getServiceLocator()->get($this->builderClassName);
        $builder->setOptions($this->options)->setServiceLocator($this->serviceLocator);
        return $builder;
    }
579553
protected function loadQuery(): Query
    {
        return Query::select($this->getFieldsNames())
            ->from(static::$tableName)
            ->where($this->where ?? $this->getPKValue());
    }
704008
protected function _buildSelect()
        {
            // If the query is raw, just set the $this->_values to be
            // the raw query parameters and return the raw query
            if ($this->_is_raw_query) {
                $this->_values = $this->_raw_parameters;
                return $this->_raw_query;
            }

            // Build and return the full SELECT statement by concatenating
            // the results of calling each separate builder method.
            return $this->_joinIfNotEmpty(
                " ",
                array(
                    $this->_buildSelectStart(),
                    $this->_buildJoin(),
                    $this->_buildWhere(),
                    $this->_buildGroupBy(),
                    $this->_buildHaving(),
                    $this->_buildOrderBy(),
                    $this->_buildLimit(),
                    $this->_buildOffset(),
                )
            );
        }
36443
public function build()
    {
        return new QueryConfiguration(
            $this->drawCall,
            $this->start,
            $this->length,
            $this->searchValue,
            $this->searchRegex,
            $this->columSearches,
            $this->columnOrders
        );
    }
719637
public function getQueryBuilder()
    {
        if (null === $this->queryBuilder) {
            $builder = QueryBuilderFactory::getQueryBuilder($this->getConnection());
            $this->setTableAlias($builder, $this->getModel()->tableName());
            $builder->setAlias($this->getTableAlias());
            $model = $this->getModel();
            $meta = $model->getMeta();
            $builder->table($model->tableName());

            $fetchColumnCallback = new FetchColumnCallback($model, $meta);
            $callback = new LookupCallback($model);
            $joinCallback = new JoinCallback($model);
            $builder
                ->getLookupBuilder()
                ->setFetchColumnCallback($fetchColumnCallback)
                ->setCallback($callback)
                ->setJoinCallback($joinCallback);
            $this->queryBuilder = $builder;
        }

        return $this->queryBuilder;
    }
728593
public Query<T> build() {
    QueryBean<T> queryBean = new QueryBean<T>();
    queryBean.setStatement(genStatement());
    queryBean.setParams(getParams());
    if (null != limit) {
      queryBean.setLimit(new PageLimit(limit.getPageIndex(), limit.getPageSize()));
    }
    queryBean.setCountStatement(genCountStatement());
    queryBean.setCacheable(cacheable);
    queryBean.setLang(getLang());
    return queryBean;
  }