变更
This commit is contained in:
+3
-6
@@ -145,7 +145,7 @@ class Connection extends Component
|
|||||||
* @return PDO
|
* @return PDO
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function getMasterClient(): PDO
|
public function getMasterClient(): Mysql\PDO
|
||||||
{
|
{
|
||||||
return $this->connection->get([
|
return $this->connection->get([
|
||||||
'cds' => $this->cds,
|
'cds' => $this->cds,
|
||||||
@@ -163,7 +163,7 @@ class Connection extends Component
|
|||||||
* @return PDO
|
* @return PDO
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function getSlaveClient(): PDO
|
public function getSlaveClient(): Mysql\PDO
|
||||||
{
|
{
|
||||||
return $this->getMasterClient();
|
return $this->getMasterClient();
|
||||||
}
|
}
|
||||||
@@ -185,14 +185,11 @@ class Connection extends Component
|
|||||||
* @return PDO
|
* @return PDO
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function getPdo(bool $restore = false): PDO
|
public function getPdo(bool $restore = false): Mysql\PDO
|
||||||
{
|
{
|
||||||
if ($restore === true) {
|
if ($restore === true) {
|
||||||
return Context::setContext($this->cds, $this->getMasterClient());
|
return Context::setContext($this->cds, $this->getMasterClient());
|
||||||
}
|
}
|
||||||
if (!Db::inTransactionsActive()) {
|
|
||||||
return $this->getMasterClient();
|
|
||||||
}
|
|
||||||
if (!Context::hasContext($this->cds)) {
|
if (!Context::hasContext($this->cds)) {
|
||||||
return Context::setContext($this->cds, $this->getMasterClient());
|
return Context::setContext($this->cds, $this->getMasterClient());
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+10
-1
@@ -192,7 +192,7 @@ class PDO implements StopHeartbeatCheck
|
|||||||
* @return int
|
* @return int
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function count(string $sql, array $params = []): int
|
public function rowCount(string $sql, array $params = []): int
|
||||||
{
|
{
|
||||||
$pdo = $this->queryPrev($sql, $params);
|
$pdo = $this->queryPrev($sql, $params);
|
||||||
|
|
||||||
@@ -313,6 +313,15 @@ class PDO implements StopHeartbeatCheck
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function errorInfo(): array
|
||||||
|
{
|
||||||
|
return $this->pdo->errorInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return \PDO
|
* @return \PDO
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user