0 follower

Final Class Yiisoft\Db\Expression\Function\Length

InheritanceYiisoft\Db\Expression\Function\Length
ImplementsYiisoft\Db\Expression\ExpressionInterface

Represents a SQL LENGTH() function that returns the length of string represented as an expression.

Example usage:

$length = new Length('column_name');
LENGTH("column_name")

See also Yiisoft\Db\Expression\Function\Builder\LengthBuilder for building SQL representations of this function expression.

Public Properties

Hide inherited properties

Property Type Description Defined By
$operand string|\Yiisoft\Db\Expression\ExpressionInterface Yiisoft\Db\Expression\Function\Length

Public Methods

Hide inherited methods

Method Description Defined By
__construct() Yiisoft\Db\Expression\Function\Length

Property Details

Hide inherited properties

$operand public property
public string|\Yiisoft\Db\Expression\ExpressionInterface $operand null

Method Details

Hide inherited methods

__construct() public method

public mixed __construct ( Yiisoft\Db\Expression\ExpressionInterface|string $operand )
$operand Yiisoft\Db\Expression\ExpressionInterface|string

The expression for which to calculate the length. String values will be treated as column names, except when they contain a parentheses (, in which case they will be treated as raw SQL expressions.

                public function __construct(
    public readonly string|ExpressionInterface $operand,
) {}