forcer le timeout au début
This commit is contained in:
parent
ad801d8486
commit
8f5c30c8c1
@ -6,6 +6,21 @@ use nulib\db\pdo\Pdo;
|
|||||||
class Mysql extends Pdo {
|
class Mysql extends Pdo {
|
||||||
const PREFIX = "mysql";
|
const PREFIX = "mysql";
|
||||||
|
|
||||||
|
static function config_setWaitTimeout(self $mysql): void {
|
||||||
|
$mysql->_exec("set session wait_timeout = 28800");
|
||||||
|
}
|
||||||
|
const CONFIG_setWaitTimeout = [self::class, "config_setWaitTimeout"];
|
||||||
|
|
||||||
|
static function config_unbufferedQueries(self $mysql): void {
|
||||||
|
$mysql->db->setAttribute(\PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false);
|
||||||
|
}
|
||||||
|
const CONFIG_unbufferedQueries = [self::class, "config_unbufferedQueries"];
|
||||||
|
|
||||||
|
protected const DEFAULT_CONFIG = [
|
||||||
|
...parent::DEFAULT_CONFIG,
|
||||||
|
self::CONFIG_setWaitTimeout,
|
||||||
|
];
|
||||||
|
|
||||||
function getDbname(): ?string {
|
function getDbname(): ?string {
|
||||||
$url = $this->dbconn["name"] ?? null;
|
$url = $this->dbconn["name"] ?? null;
|
||||||
if ($url !== null && preg_match('/^mysql(?::|.*;)dbname=([^;]+)/i', $url, $ms)) {
|
if ($url !== null && preg_match('/^mysql(?::|.*;)dbname=([^;]+)/i', $url, $ms)) {
|
||||||
|
@ -40,11 +40,6 @@ class Pdo implements IDatabase {
|
|||||||
}
|
}
|
||||||
const CONFIG_errmodeException_lowerCase = [self::class, "config_errmodeException_lowerCase"];
|
const CONFIG_errmodeException_lowerCase = [self::class, "config_errmodeException_lowerCase"];
|
||||||
|
|
||||||
static function config_unbufferedQueries(self $pdo): void {
|
|
||||||
$pdo->db->setAttribute(\PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false);
|
|
||||||
}
|
|
||||||
const CONFIG_unbufferedQueries = [self::class, "config_unbufferedQueries"];
|
|
||||||
|
|
||||||
protected const OPTIONS = [
|
protected const OPTIONS = [
|
||||||
\PDO::ATTR_PERSISTENT => true,
|
\PDO::ATTR_PERSISTENT => true,
|
||||||
];
|
];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user