Final Class Yiisoft\Db\Pgsql\Builder\JsonValueBuilder
| Inheritance | Yiisoft\ |
|---|---|
| Implements | Yiisoft\ |
Builds expressions for {@see Yiisoft\} for PostgreSQL Server.
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __construct() | Yiisoft\ |
|
| build() | The Method builds the raw SQL from the $expression that won't be additionally escaped or quoted. | Yiisoft\ |
Method Details
| public mixed __construct ( \ | ||
| $queryBuilder | \ |
|
public function __construct(QueryBuilderInterface $queryBuilder)
{
$this->baseValueBuilder = new BaseJsonValueBuilder($queryBuilder);
}
The Method builds the raw SQL from the $expression that won't be additionally escaped or quoted.
| public string build ( \ | ||
| $expression | \ |
The expression to build. |
| $params | array |
The binding parameters. |
| return | string |
The raw SQL that won't be additionally escaped or quoted. |
|---|---|---|
public function build(ExpressionInterface $expression, array &$params = []): string
{
$statement = $this->baseValueBuilder->build($expression, $params);
if ($expression->value instanceof ArrayValue) {
$statement = 'array_to_json(' . $statement . ')';
}
return $statement . $this->getTypeHint($expression);
}
User Contributed Notes
Leave a comment
Join the conversation to share a note.