changer la configuration par défaut pour mysql
This commit is contained in:
parent
ff4ef34037
commit
526a693ead
@ -6,11 +6,22 @@ use nulib\db\pdo\Pdo;
|
|||||||
class Mysql extends Pdo {
|
class Mysql extends Pdo {
|
||||||
const PREFIX = "mysql";
|
const PREFIX = "mysql";
|
||||||
|
|
||||||
|
static function config_setTimeout(self $pdo): void {
|
||||||
|
$pdo->_exec("SET session wait_timeout=28800");
|
||||||
|
$pdo->_exec("SET session interactive_timeout=28800");
|
||||||
|
}
|
||||||
|
const CONFIG_setTimeout = [self::class, "config_setTimeout"];
|
||||||
|
|
||||||
static function config_unbufferedQueries(self $mysql): void {
|
static function config_unbufferedQueries(self $mysql): void {
|
||||||
$mysql->db->setAttribute(\PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false);
|
$mysql->db->setAttribute(\PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false);
|
||||||
}
|
}
|
||||||
const CONFIG_unbufferedQueries = [self::class, "config_unbufferedQueries"];
|
const CONFIG_unbufferedQueries = [self::class, "config_unbufferedQueries"];
|
||||||
|
|
||||||
|
const DEFAULT_CONFIG = [
|
||||||
|
...parent::DEFAULT_CONFIG,
|
||||||
|
self::CONFIG_setTimeout,
|
||||||
|
];
|
||||||
|
|
||||||
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)) {
|
||||||
|
@ -42,7 +42,7 @@ class Pdo implements IDatabase {
|
|||||||
const CONFIG_errmodeException_lowerCase = [self::class, "config_errmodeException_lowerCase"];
|
const CONFIG_errmodeException_lowerCase = [self::class, "config_errmodeException_lowerCase"];
|
||||||
|
|
||||||
protected const OPTIONS = [
|
protected const OPTIONS = [
|
||||||
\PDO::ATTR_PERSISTENT => true,
|
\PDO::ATTR_PERSISTENT => false,
|
||||||
];
|
];
|
||||||
|
|
||||||
protected const DEFAULT_CONFIG = [
|
protected const DEFAULT_CONFIG = [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user