protected function compileSubQuery($subQuery, array &$bindings, bool $parenthesise = true): string
    {
        if ($subQuery instanceof Query) {
            try {
                $subQuery = $this->compile($subQuery);
            } catch (InvalidQueryException $exception) {
                throw new InvalidQueryException(
                    'Error in subquery: '.$exception->getMessage(),
                    $exception->getCode(),
                    $exception
                );
            }
        }

        $this->mergeBindings($bindings, $subQuery->getBindings());
        $sql = $subQuery->getSQL();

        return $parenthesise ? '('.$sql.')' : $sql;
    }
protected function compileSubQuery($subQuery, array &$bindings, bool $parenthesise = true): string
    {
        if ($subQuery instanceof Query) {
            try {
                $subQuery = $this->compile($subQuery);
            } catch (InvalidQueryException $exception) {
                throw new InvalidQueryException(
                    'Error in subquery: '.$exception->getMessage(),
                    $exception->getCode(),
                    $exception
                );
            }
        }

        $this->mergeBindings($bindings, $subQuery->getBindings());
        $sql = $subQuery->getSQL();

        return $parenthesise ? '('.$sql.')' : $sql;
    }
protected function compileSubQuery ( $ subQuery , array & $ bindings , bool $ parenthesise = true ) : string { if ( $ subQuery instanceof Query ) { try { $ subQuery = $ this -> compile ( $ subQuery ) ; } catch ( InvalidQueryException $ exception ) { throw new InvalidQueryException ( 'Error in subquery: ' . $ exception -> getMessage ( ) , $ exception -> getCode ( ) , $ exception ) ; } } $ this -> mergeBindings ( $ bindings , $ subQuery -> getBindings ( ) ) ; $ sql = $ subQuery -> getSQL ( ) ; return $ parenthesise ? '(' . $ sql . ')' : $ sql ; }
Converts a subquery to an SQL query text.

@param Query|StatementInterface $subQuery Subquery
@param array $bindings Bound values (array is filled by link)
@param bool $parenthesise Wrap the subquery in parentheses?
@return string SQL text wrapped in parentheses
Converts a subquery to an SQL query text .