This commit is contained in:
2023-08-23 01:48:18 +08:00
parent 4b55ee837e
commit 543995f5cd
+5 -5
View File
@@ -348,11 +348,11 @@ class Connection extends Component
PDO::ATTR_TIMEOUT => $this->connect_timeout,
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES ' . $this->charset
];
if (!Context::inCoroutine()) {
$options[PDO::ATTR_PERSISTENT] = true;
} else {
$options[PDO::ATTR_PERSISTENT] = false;
}
// if (!Context::inCoroutine()) {
// $options[PDO::ATTR_PERSISTENT] = true;
// } else {
// $options[PDO::ATTR_PERSISTENT] = false;
// }
$link = new PDO('mysql:dbname=' . $this->database . ';host=' . $this->cds, $this->username, $this->password, $options);
foreach ($this->attributes as $key => $attribute) {
$link->setAttribute($key, $attribute);