@param string         $name
@param ClauseStrategy $query

@return $this
5058
public function setClause(string $name, ClauseStrategy $query)
    {
        $this->clauses[$name] = $query;

        return $this;
    }
1269322
public function queryOne($query_with_placeholders, $named_parameters = []) {
            $results = $this->query($query_with_placeholders, $named_parameters);
            foreach ($results as $result) {
                return $result;
            }
        }
996736
public function createView(string $name, string $query): View {
		$newView = new CommonView($name, $query);
		$this->database->addMetaEntity($newView);
		return $newView;
	}
486031
public function setQuery($query = null)
    {

        try {

            // need to return << true
            $this->validator->verify($query, ['isNotNull', 'isAcceptLength']);

            if (false === $this->exact) {
                $this->query = ['query' => '%' . $query . '%'];
            }
            else {
                $this->query = ['query' => $query];
            }

        }
        catch(ExceptionFactory $e) {
            echo $e->getMessage();
        }

        return $this;
    }
341396
public function search($entityName, $query)
    {
        $meta = $this->getSearchableEntityMeta($entityName);

        $qb = $this->em->getRepository($meta->getEntityClass())->createQueryBuilder('o');

        if ($this->translationJoiner->isTranslatable($meta->getEntityClass())) {
            $this->translationJoiner->joinTranslation($qb, true, null, null, true);
        }

        $searchableFields = $this->getSearchableFields($meta);

        try {
            $this->filterer->filter($qb, array_fill_keys($searchableFields, $query), [
                'non_strict_comparison_fields' => $searchableFields,
            ], false);
        } catch (FiltererException $ex) {
            throw new SearchException(
                sprintf('Unable to search for "%s" entities: "%s".', $meta->getEntityClass(), $ex->getMessage())
            );
        }
        try {
            return $qb->getQuery()->getResult();
        } catch (QueryException $ex) {
            throw new SearchException(
                sprintf('Unable to search for "%s" entities: "%s".', $meta->getEntityClass(), $ex->getMessage())
            );
        }
    }
788572
public function addQuery($query, $connectionName = 'default')
    {
        $queryData = [
            $query['time'] / 1000,
            $query['query'],
            $query['bindings']
        ];
        $this->queriesByConnection[$connectionName][] = $queryData;
        if (!isset($this->totalQueriesTimeByConnection[$connectionName])) {
            $this->totalQueriesTimeByConnection[$connectionName] = 0;
        }
        $this->totalQueriesTimeByConnection[$connectionName] += $query['time'] / 1000;
        return $this;
    }
1113273
public function setQuery($query)
    {
        $this->query = null;
        if (is_string($query)) {
            $this->query = ltrim($query, '?');
        }
        return $this;
    }
1335935
final public function loadFromQuery($query, array $binds = [])
    {
        $this->source()->loadItemFromQuery($query, $binds, $this);
        return $this;
    }
1045773
public function where($clauses, $statements = null)
    {
        $this->settings['where'] = $clauses;

        if (is_array($this->settings['statements'])) {
            $this->settings['statements'] = array_merge(
                $this->settings['statements'],
                $statements
            );
        } else {
            $this->settings['statements'] = $statements;
        }

        return $this;
    }
840113
public function execute($query)
    {
        $this->db->setQuery($query)->execute();

        $this->cursor = $this->db->getCursor();

        return $this;
    }
187886
private function addSelectionMethod(QueryBuilderResult $query, $methodName)
    {
        $findMethod = function () use ($query, $methodName) {

            $sth = $this->pdo->prepare($query->getSql());
            /** @noinspection PhpMethodParametersCountMismatchInspection */
            $sth->setFetchMode(\PDO::FETCH_CLASS, $this->entityClass->getName());
            try {
                $sth->execute(func_get_args());
            } catch (PDOException $e) {
                throw new DslSyntaxException('Failed to run query [' . $methodName . '] with parameters ' . print_r(func_get_args(), true));
            }

            switch ($query->getResultMode()) {
                case QueryBuilderResult::RESULT_SELECT_SINGLE:
                    return $sth->fetch();
                case QueryBuilderResult::RESULT_SELECT_MULTIPLE:
                    return $sth->fetchAll();
            }

            throw new DslSyntaxException('Result Mode ' . $query->getResultMode() . ' is not implemented', DATADO_ILLEGAL_RESULT_MODE);

        };

        $this->methods[$methodName] = \Closure::bind($findMethod, $this, get_class());
    }
918917
public function setQuerystring(string $query = null) : self
    {
        if (is_null($query)) {
            $this->uri['query'] = [];
        } else {
            $this->uri['query'] = $this->parseStr($query);
        }

        return $this;
    }
253249
public function setQuery($query)
    {
        if (is_string($query) || $query instanceof \OtherCode\Database\Query\Query) {
            $this->query = $query;
        }
        return $this;
    }
1133084
public function registerStrategy($name, ConnectionStrategy $strategy, bool $default = false)
    {
        $this->connections[$name] = $strategy;

        if ($default) {
            $this->setDefaultConnectionName($name);
        }

        return $this;
    }
957431
public function addClause(Clause $clause)
    {
        $classname = array_pop(explode('\\', get_class($clause)));
        $this->clauses[$classname] = $clause;

        return $this;
    }
669021
private function setContentObjectWordsSelectQuery(SelectQuery $query)
    {
        $query->select('word_id')
            ->from($this->dbHandler->quoteTable('ezsearch_object_word_link'))
            ->where($query->expr->eq($this->dbHandler->quoteColumn('contentobject_id'), ':contentId'));
    }
438055
public function scopeByName($query, $name, $strict = false)
    {
        $names = (array) $name;

        if (! $strict && $name !== '*') {
            $names[] = '*';
        }

        $query->whereIn("{$this->table}.name", $names);
    }