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