Skip to content

Commit

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

* Fix psalm issue

* Fix psalm issue
  • Loading branch information
Tigrov authored Oct 14, 2023
1 parent f6eae33 commit 245d3ee
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## 1.1.1 under development

- Enh #230: Improve column type #230 (@Tigrov)
- Bug #240: Remove `RECURSIVE` expression from CTE queries (@Tigrov)

## 1.1.0 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 @@ -7,6 +7,7 @@
use Yiisoft\Db\Expression\ExpressionInterface;
use Yiisoft\Db\Oracle\Builder\InConditionBuilder;
use Yiisoft\Db\Oracle\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 @@ -60,6 +61,16 @@ public function selectExists(string $rawSql): string
return 'SELECT CASE WHEN EXISTS(' . $rawSql . ') THEN 1 ELSE 0 END FROM DUAL';
}

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);
}

protected function defaultExpressionBuilders(): array
{
return array_merge(
Expand Down

0 comments on commit 245d3ee

Please sign in to comment.