Skip to content

Commit

Permalink
Fix CTE query expressions (#278)
Browse files Browse the repository at this point in the history
* Fix CTE

* Fix psalm issues

* Add line to CHANGELOG.md
  • Loading branch information
Tigrov authored Oct 14, 2023
1 parent 27a7bfe commit bd3e290
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## 1.0.2 under development

- no changes in this release.
- Bug #278: Remove `RECURSIVE` expression from CTE queries (@Tigrov)

## 1.0.1 July 24, 2023

Expand Down
11 changes: 11 additions & 0 deletions src/DQLQueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Yiisoft\Db\Expression\ExpressionInterface;
use Yiisoft\Db\Mssql\Builder\InConditionBuilder;
use Yiisoft\Db\Mssql\Builder\LikeConditionBuilder;
use Yiisoft\Db\Query\Query;
use Yiisoft\Db\QueryBuilder\AbstractDQLQueryBuilder;
use Yiisoft\Db\QueryBuilder\Condition\InCondition;
use Yiisoft\Db\QueryBuilder\Condition\LikeCondition;
Expand Down Expand Up @@ -109,4 +110,14 @@ protected function extractAlias(string $table): array|bool

return parent::extractAlias($table);
}

public function buildWithQueries(array $withs, array &$params): string
{
/** @psalm-var array{query:string|Query, alias:ExpressionInterface|string, recursive:bool}[] $withs */
foreach ($withs as &$with) {
$with['recursive'] = false;
}

return parent::buildWithQueries($withs, $params);
}
}

0 comments on commit bd3e290

Please sign in to comment.