修复 PHP 8.4+ 中 PDO::MYSQL_ATTR_USE_BUFFERED_QUERY 的弃用警告 (#1922)
This commit is contained in:
@@ -73,7 +73,14 @@ class Mysql extends Pdo
|
||||
$config->password,
|
||||
$options
|
||||
);
|
||||
$pdo->setAttribute(\PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
|
||||
|
||||
if (class_exists('\Pdo\Mysql')) {
|
||||
// 新版本写法
|
||||
$pdo->setAttribute(\Pdo\Mysql::ATTR_USE_BUFFERED_QUERY, true);
|
||||
} else {
|
||||
// 兼容旧版本
|
||||
$pdo->setAttribute(\PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
|
||||
}
|
||||
|
||||
if ($config->charset) {
|
||||
$pdo->exec("SET NAMES '{$config->charset}'");
|
||||
|
||||
Reference in New Issue
Block a user