1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Yiisoft\Db\Mssql; |
6
|
|
|
|
7
|
|
|
use Yiisoft\Db\Driver\PDO\CommandPDOInterface; |
8
|
|
|
use Yiisoft\Db\Driver\PDO\ConnectionPDO as AbstractConnectionPDO; |
9
|
|
|
use Yiisoft\Db\Exception\Exception; |
10
|
|
|
use Yiisoft\Db\Exception\InvalidConfigException; |
11
|
|
|
use Yiisoft\Db\Query\BatchQueryResultInterface; |
|
|
|
|
12
|
|
|
use Yiisoft\Db\Query\QueryInterface; |
13
|
|
|
use Yiisoft\Db\QueryBuilder\QueryBuilderInterface; |
14
|
|
|
use Yiisoft\Db\Schema\QuoterInterface; |
15
|
|
|
use Yiisoft\Db\Schema\SchemaInterface; |
16
|
|
|
use Yiisoft\Db\Transaction\TransactionInterface; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* Database connection class prefilled for Microsoft SQL Server. |
20
|
|
|
* The class Connection represents a connection to a database via [PDO](https://secure.php.net/manual/en/book.pdo.php). |
21
|
|
|
*/ |
22
|
|
|
final class ConnectionPDO extends AbstractConnectionPDO |
23
|
|
|
{ |
24
|
|
|
|
25
|
|
|
public function createBatchQueryResult(QueryInterface $query, bool $each = false): BatchQueryResultInterface |
26
|
|
|
{ |
27
|
|
|
return (new BatchQueryResult($query, $each)); |
|
|
|
|
28
|
|
|
} |
29
|
|
|
|
30
|
223 |
|
public function createCommand(?string $sql = null, array $params = []): CommandPDOInterface |
31
|
|
|
{ |
32
|
223 |
|
$command = new CommandPDO($this, $this->queryCache); |
33
|
|
|
|
34
|
223 |
|
if ($sql !== null) { |
35
|
223 |
|
$command->setSql($sql); |
36
|
|
|
} |
37
|
|
|
|
38
|
223 |
|
if ($this->logger !== null) { |
39
|
223 |
|
$command->setLogger($this->logger); |
40
|
|
|
} |
41
|
|
|
|
42
|
223 |
|
if ($this->profiler !== null) { |
43
|
223 |
|
$command->setProfiler($this->profiler); |
44
|
|
|
} |
45
|
|
|
|
46
|
223 |
|
return $command->bindValues($params); |
47
|
|
|
} |
48
|
|
|
|
49
|
11 |
|
public function createTransaction(): TransactionInterface |
50
|
|
|
{ |
51
|
11 |
|
return new TransactionPDO($this); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @throws Exception|InvalidConfigException |
56
|
|
|
*/ |
57
|
385 |
|
public function getQueryBuilder(): QueryBuilderInterface |
58
|
|
|
{ |
59
|
385 |
|
if ($this->queryBuilder === null) { |
60
|
385 |
|
$this->queryBuilder = new QueryBuilder( |
61
|
385 |
|
$this->getQuoter(), |
62
|
385 |
|
$this->getSchema(), |
63
|
|
|
); |
64
|
|
|
} |
65
|
|
|
|
66
|
385 |
|
return $this->queryBuilder; |
|
|
|
|
67
|
|
|
} |
68
|
|
|
|
69
|
406 |
|
public function getQuoter(): QuoterInterface |
70
|
|
|
{ |
71
|
406 |
|
if ($this->quoter === null) { |
72
|
406 |
|
$this->quoter = new Quoter(['[', ']'], ['[', ']'], $this->getTablePrefix()); |
73
|
|
|
} |
74
|
|
|
|
75
|
406 |
|
return $this->quoter; |
|
|
|
|
76
|
|
|
} |
77
|
|
|
|
78
|
387 |
|
public function getSchema(): SchemaInterface |
79
|
|
|
{ |
80
|
387 |
|
if ($this->schema === null) { |
81
|
387 |
|
$this->schema = new Schema($this, $this->schemaCache); |
82
|
|
|
} |
83
|
|
|
|
84
|
387 |
|
return $this->schema; |
|
|
|
|
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* Initializes the DB connection. |
89
|
|
|
* |
90
|
|
|
* This method is invoked right after the DB connection is established. |
91
|
|
|
* |
92
|
|
|
* The default implementation turns on `PDO::ATTR_EMULATE_PREPARES`. |
93
|
|
|
* |
94
|
|
|
* if {@see emulatePrepare} is true, and sets the database {@see charset} if it is not empty. |
95
|
|
|
* |
96
|
|
|
* It then triggers an {@see EVENT_AFTER_OPEN} event. |
97
|
|
|
*/ |
98
|
219 |
|
protected function initConnection(): void |
99
|
|
|
{ |
100
|
219 |
|
$this->pdo = $this->driver->createConnection(); |
101
|
|
|
} |
102
|
|
|
} |
103
|
|
|
|
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