modify
This commit is contained in:
@@ -265,6 +265,8 @@ class Connection extends Component
|
|||||||
*/
|
*/
|
||||||
public function createCommand($sql = null, array $attributes = []): Command
|
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]);
|
$command = new Command(['db' => $this, 'sql' => $sql]);
|
||||||
return $command->bindValues($attributes);
|
return $command->bindValues($attributes);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -127,7 +127,6 @@ class Connection extends Pool
|
|||||||
}
|
}
|
||||||
/** @var PDO $connections */
|
/** @var PDO $connections */
|
||||||
$connections = $this->getFromChannel($coroutineName, $config);
|
$connections = $this->getFromChannel($coroutineName, $config);
|
||||||
$connections->query('use `' . $config['database'].'`');
|
|
||||||
if ($number = Context::getContext('begin_' . $coroutineName, Coroutine::getCid())) {
|
if ($number = Context::getContext('begin_' . $coroutineName, Coroutine::getCid())) {
|
||||||
$number > 0 && $connections->beginTransaction();
|
$number > 0 && $connections->beginTransaction();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user