1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Yiisoft\Db\Oracle; |
6
|
|
|
|
7
|
|
|
use Yiisoft\Db\Oracle\Builder\InConditionBuilder; |
8
|
|
|
use Yiisoft\Db\Oracle\Builder\LikeConditionBuilder; |
|
|
|
|
9
|
|
|
use Yiisoft\Db\QueryBuilder\Conditions\InCondition; |
|
|
|
|
10
|
|
|
use Yiisoft\Db\QueryBuilder\Conditions\LikeCondition; |
|
|
|
|
11
|
|
|
use Yiisoft\Db\QueryBuilder\DQLQueryBuilder as AbstractDQLQueryBuilder; |
|
|
|
|
12
|
|
|
|
13
|
|
|
use function array_merge; |
14
|
|
|
use function implode; |
15
|
|
|
|
16
|
|
|
final class DQLQueryBuilder extends AbstractDQLQueryBuilder |
17
|
|
|
{ |
18
|
166 |
|
public function buildOrderByAndLimit(string $sql, array $orderBy, $limit, $offset, array &$params = []): string |
19
|
|
|
{ |
20
|
166 |
|
$orderByString = $this->buildOrderBy($orderBy, $params); |
21
|
|
|
|
22
|
166 |
|
if ($orderByString !== '') { |
23
|
6 |
|
$sql .= $this->separator . $orderByString; |
24
|
|
|
} |
25
|
|
|
|
26
|
166 |
|
$filters = []; |
27
|
|
|
|
28
|
166 |
|
if ($this->hasOffset($offset)) { |
29
|
1 |
|
$filters[] = 'rowNumId > ' . (string) $offset; |
30
|
|
|
} |
31
|
|
|
|
32
|
166 |
|
if ($this->hasLimit($limit)) { |
33
|
9 |
|
$filters[] = 'rownum <= ' . (string) $limit; |
34
|
|
|
} |
35
|
|
|
|
36
|
166 |
|
if (empty($filters)) { |
37
|
160 |
|
return $sql; |
38
|
|
|
} |
39
|
|
|
|
40
|
9 |
|
$filter = implode(' AND ', $filters); |
41
|
|
|
return <<<SQL |
42
|
|
|
WITH USER_SQL AS ($sql), PAGINATION AS (SELECT USER_SQL.*, rownum as rowNumId FROM USER_SQL) |
43
|
|
|
SELECT * FROM PAGINATION WHERE $filter |
44
|
|
|
SQL; |
45
|
|
|
} |
46
|
|
|
|
47
|
1 |
|
public function selectExists(string $rawSql): string |
48
|
|
|
{ |
49
|
1 |
|
return 'SELECT CASE WHEN EXISTS(' . $rawSql . ') THEN 1 ELSE 0 END FROM DUAL'; |
50
|
|
|
} |
51
|
|
|
|
52
|
345 |
|
protected function defaultExpressionBuilders(): array |
53
|
|
|
{ |
54
|
345 |
|
return array_merge(parent::defaultExpressionBuilders(), [ |
55
|
|
|
InCondition::class => InConditionBuilder::class, |
56
|
|
|
LikeCondition::class => LikeConditionBuilder::class, |
57
|
|
|
]); |
58
|
|
|
} |
59
|
|
|
} |
60
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths