Final Class Yiisoft\Db\Sqlite\Builder\JsonOverlapsBuilder
| Inheritance | Yiisoft\ |
|---|---|
| Implements | Yiisoft\ |
Builds expressions for {@see JsonOverlapsCondition} for SQLite Server.
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __construct() | Yiisoft\ |
|
| build() | Build SQL for {@see JsonOverlaps}. | Yiisoft\ |
Method Details
| public mixed __construct ( \ | ||
| $queryBuilder | \ |
|
public function __construct(
private readonly QueryBuilderInterface $queryBuilder,
) {}
Build SQL for {@see JsonOverlaps}.
| public string build ( \ | ||
| $expression | \ |
The {@see \ |
| $params | array | |
| throws | \ |
|
|---|---|---|
| throws | InvalidArgumentException | |
| throws | \ |
|
| throws | \ |
|
public function build(ExpressionInterface $expression, array &$params = []): string
{
$column = $expression->column instanceof ExpressionInterface
? $this->queryBuilder->buildExpression($expression->column)
: $this->queryBuilder->getQuoter()->quoteColumnName($expression->column);
$values = $expression->values;
if (!$values instanceof ExpressionInterface) {
$values = new JsonValue($values);
}
$values = $this->queryBuilder->buildExpression($values, $params);
return "EXISTS(SELECT value FROM json_each($column) INTERSECT SELECT value FROM json_each($values))=1";
}
User Contributed Notes
Leave a comment
Join the conversation to share a note.