This commit is contained in:
2021-02-20 13:35:17 +08:00
parent b140054ce9
commit 9ce45e39e8
6 changed files with 23 additions and 20 deletions
+7 -7
View File
@@ -52,7 +52,7 @@ class Connection extends Pool
*/
public function inTransaction($cds): bool
{
return Context::getContext('begin_' . $this->name($cds, true)) == 0;
return Context::getContext('begin_' . $this->name('mysql', $cds, true)) == 0;
}
/**
@@ -60,7 +60,7 @@ class Connection extends Pool
*/
public function beginTransaction($coroutineName)
{
$coroutineName = $this->name($coroutineName, true);
$coroutineName = $this->name('mysql', $coroutineName, true);
if (!Context::hasContext('begin_' . $coroutineName)) {
Context::setContext('begin_' . $coroutineName, 0);
}
@@ -79,7 +79,7 @@ class Connection extends Pool
*/
public function commit($coroutineName)
{
$coroutineName = $this->name($coroutineName, true);
$coroutineName = $this->name('mysql', $coroutineName, true);
if (!Context::hasContext('begin_' . $coroutineName)) {
return;
}
@@ -104,7 +104,7 @@ class Connection extends Pool
*/
private function getIndex($name, $isMaster = false): array
{
return [Coroutine::getCid(), $this->name($name, $isMaster)];
return [Coroutine::getCid(), $this->name('mysql', $name, $isMaster)];
}
/**
@@ -112,7 +112,7 @@ class Connection extends Pool
*/
public function rollback($coroutineName)
{
$coroutineName = $this->name($coroutineName, true);
$coroutineName = $this->name('mysql', $coroutineName, true);
if (!Context::hasContext('begin_' . $coroutineName)) {
return;
}
@@ -136,7 +136,7 @@ class Connection extends Pool
*/
public function getConnection(array $config, $isMaster = false): mixed
{
$coroutineName = $this->name($config['cds'], $isMaster);
$coroutineName = $this->name('mysql', $config['cds'], $isMaster);
if (!isset($this->hasCreate[$coroutineName])) {
$this->hasCreate[$coroutineName] = 0;
}
@@ -211,7 +211,7 @@ class Connection extends Pool
*/
public function release($coroutineName, $isMaster)
{
$coroutineName = $this->name($coroutineName, $isMaster);
$coroutineName = $this->name('mysql', $coroutineName, $isMaster);
if (!$this->hasClient($coroutineName)) {
return;
}