This commit is contained in:
as2252258@163.com
2021-07-03 13:30:37 +08:00
parent e2e43959a8
commit ccc9f9bbf1
2 changed files with 2 additions and 1 deletions
+2
View File
@@ -265,6 +265,8 @@ class Connection extends Component
*/
public function createCommand($sql = null, array $attributes = []): Command
{
$sql = preg_replace('/FROM\s+(\w+)\s+/', 'FROM ' . $this->database . ' $1', $sql);
$command = new Command(['db' => $this, 'sql' => $sql]);
return $command->bindValues($attributes);
}
-1
View File
@@ -127,7 +127,6 @@ class Connection extends Pool
}
/** @var PDO $connections */
$connections = $this->getFromChannel($coroutineName, $config);
$connections->query('use `' . $config['database'].'`');
if ($number = Context::getContext('begin_' . $coroutineName, Coroutine::getCid())) {
$number > 0 && $connections->beginTransaction();
}