From b7bcdc20960d95bfd26f3df1536c4e2a3ad6c71f Mon Sep 17 00:00:00 2001 From: "as2252258@163.com" Date: Thu, 6 Apr 2023 22:39:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kiri-engine/Pool/Connection.php | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/kiri-engine/Pool/Connection.php b/kiri-engine/Pool/Connection.php index 7bb08b39..166841f7 100644 --- a/kiri-engine/Pool/Connection.php +++ b/kiri-engine/Pool/Connection.php @@ -95,9 +95,6 @@ class Connection extends Component */ public function get(string $cds): null|PDO|bool { - if (!$this->pool->hasChannel($cds)) { - throw new Exception('Queue not exists.'); - } return $this->pool->get($cds); } @@ -124,35 +121,6 @@ class Connection extends Component } - /** - * @param array $config - * @param int $max - */ - public function initConnections(array $config, int $max) - { - $this->pool->initConnections($config['cds'], $max, static function () use ($config) { - $options = [ - PDO::ATTR_CASE => PDO::CASE_NATURAL, - PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, - PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL, - PDO::ATTR_STRINGIFY_FETCHES => false, - PDO::ATTR_EMULATE_PREPARES => false, - PDO::ATTR_TIMEOUT => $config['connect_timeout'], - PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES ' . ($config['charset'] ?? 'utf8mb4') - ]; - if (!Context::inCoroutine()) { - $options[PDO::ATTR_PERSISTENT] = true; - } - $link = new PDO('mysql:dbname=' . $config['dbname'] . ';host=' . $config['cds'], - $config['username'], $config['password'], $options); - foreach ($config['attributes'] as $key => $attribute) { - $link->setAttribute($key, $attribute); - } - return $link; - }); - } - - /** * @param $coroutineName * @throws Kiri\Exception\ConfigException