mirror of
https://github.com/Icinga/icingadb-web.git
synced 2026-05-28 04:36:06 -04:00
Use PDO MySQL driver-specific constants
Replace deprecated `PDO::MYSQL_*` constant usage with the driver-specific `Pdo\Mysql::ATTR_*` constants introduced in PHP 8.4. This prepares the code for PHP 8.5, where accessing MySQL driver constants through the generic `PDO` class is deprecated. This change requires a compatibility shim on older PHP versions to provide `Pdo\Mysql` for runtimes that do not expose the driver-specific class yet. The shim is provided in `ipl-sql`.
This commit is contained in:
parent
6496317723
commit
ca4f9a39ce
1 changed files with 3 additions and 1 deletions
|
|
@ -15,6 +15,7 @@ use ipl\Sql\Expression;
|
|||
use ipl\Sql\QueryBuilder;
|
||||
use ipl\Sql\Select;
|
||||
use PDO;
|
||||
use Pdo\Mysql;
|
||||
|
||||
/**
|
||||
* Singleton providing access to the Icinga DB and Redis
|
||||
|
|
@ -61,7 +62,8 @@ final class Backend
|
|||
|
||||
$config->options = [PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_OBJ];
|
||||
if ($config->db === 'mysql') {
|
||||
$config->options[PDO::MYSQL_ATTR_INIT_COMMAND] = "SET SESSION SQL_MODE='STRICT_TRANS_TABLES"
|
||||
$config->options[Mysql::ATTR_INIT_COMMAND]
|
||||
= "SET SESSION SQL_MODE='STRICT_TRANS_TABLES"
|
||||
. ",NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'";
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue