0 follower

Final Class Yiisoft\Db\Expression\Function\Builder\LengthBuilder

InheritanceYiisoft\Db\Expression\Function\Builder\LengthBuilder
ImplementsYiisoft\Db\Expression\ExpressionBuilderInterface

Builds SQL LENGTH() function expressions for Yiisoft\Db\Expression\Function\Length objects.

Method Details

Hide inherited methods

__construct() public method

public __construct( Yiisoft\Db\QueryBuilder\QueryBuilderInterface $queryBuilder ): mixed
$queryBuilder Yiisoft\Db\QueryBuilder\QueryBuilderInterface

                public function __construct(private readonly QueryBuilderInterface $queryBuilder) {}

            
build() public method

Builds a SQL LENGTH() function expression from the given Yiisoft\Db\Expression\Function\Length object.

public build( Yiisoft\Db\Expression\Function\Length $expression, array &$params = [] ): string
$expression Yiisoft\Db\Expression\Function\Length

The expression to build.

$params array

The parameters to be bound to the query.

return string

The SQL LENGTH() function expression.

                public function build(ExpressionInterface $expression, array &$params = []): string
{
    return 'LENGTH(' . $this->buildOperand($expression->operand, $params) . ')';
}