|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Yiisoft\Db\Sqlite\Condition; |
|
6
|
|
|
|
|
7
|
|
|
use Yiisoft\Db\Exceptions\NotSupportedException; |
|
8
|
|
|
use Yiisoft\Db\Querys\Query; |
|
9
|
|
|
use Yiisoft\Db\Querys\Conditions\InConditionBuilder as BaseInConditionBuilder; |
|
10
|
|
|
|
|
11
|
|
|
/** |
|
12
|
|
|
* {@inheritdoc} |
|
13
|
|
|
*/ |
|
14
|
|
|
class InConditionBuilder extends BaseInConditionBuilder |
|
15
|
|
|
{ |
|
16
|
|
|
/** |
|
17
|
|
|
* {@inheritdoc} |
|
18
|
|
|
* |
|
19
|
|
|
* @throws NotSupportedException if `$columns` is an array |
|
20
|
|
|
*/ |
|
21
|
2 |
|
protected function buildSubqueryInCondition(string $operator, $columns, Query $values, array &$params): string |
|
22
|
|
|
{ |
|
23
|
2 |
|
if (\is_array($columns)) { |
|
24
|
|
|
throw new NotSupportedException(__METHOD__ . ' is not supported by SQLite.'); |
|
25
|
|
|
} |
|
26
|
|
|
|
|
27
|
2 |
|
return parent::buildSubqueryInCondition($operator, $columns, $values, $params); |
|
28
|
|
|
} |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* {@inheritdoc} |
|
32
|
|
|
*/ |
|
33
|
2 |
|
protected function buildCompositeInCondition(?string $operator, $columns, $values, &$params): string |
|
34
|
|
|
{ |
|
35
|
2 |
|
$quotedColumns = []; |
|
36
|
|
|
|
|
37
|
2 |
|
foreach ($columns as $i => $column) { |
|
38
|
2 |
|
$quotedColumns[$i] = strpos($column, '(') === false ? $this->queryBuilder->db->quoteColumnName($column) : $column; |
|
|
|
|
|
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
2 |
|
$vss = []; |
|
42
|
|
|
|
|
43
|
2 |
|
foreach ($values as $value) { |
|
44
|
2 |
|
$vs = []; |
|
45
|
2 |
|
foreach ($columns as $i => $column) { |
|
46
|
2 |
|
if (isset($value[$column])) { |
|
47
|
2 |
|
$phName = $this->queryBuilder->bindParam($value[$column], $params); |
|
48
|
2 |
|
$vs[] = $quotedColumns[$i] . ($operator === 'IN' ? ' = ' : ' != ') . $phName; |
|
49
|
|
|
} else { |
|
50
|
|
|
$vs[] = $quotedColumns[$i] . ($operator === 'IN' ? ' IS' : ' IS NOT') . ' NULL'; |
|
51
|
|
|
} |
|
52
|
|
|
} |
|
53
|
2 |
|
$vss[] = '(' . implode($operator === 'IN' ? ' AND ' : ' OR ', $vs) . ')'; |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
2 |
|
return '(' . implode($operator === 'IN' ? ' OR ' : ' AND ', $vss) . ')'; |
|
57
|
|
|
} |
|
58
|
|
|
} |
|
59
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.