Database: Only use `PDO::MYSQL_ATTR_INIT_COMMAND` for mysql connections
fixes #4441
This commit is contained in:
parent
b39d9d6746
commit
b8b77332c4
|
@ -32,11 +32,11 @@ trait Database
|
||||||
IcingaConfig::app()->get('global', 'config_resource')
|
IcingaConfig::app()->get('global', 'config_resource')
|
||||||
));
|
));
|
||||||
|
|
||||||
$config->options = [
|
$config->options = [PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_OBJ];
|
||||||
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_OBJ,
|
if ($config->db === 'mysql') {
|
||||||
PDO::MYSQL_ATTR_INIT_COMMAND => "SET SESSION SQL_MODE='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE"
|
$config->options[PDO::MYSQL_ATTR_INIT_COMMAND] = "SET SESSION SQL_MODE='STRICT_TRANS_TABLES"
|
||||||
. ",ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'"
|
. ",NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'";
|
||||||
];
|
}
|
||||||
|
|
||||||
return new Connection($config);
|
return new Connection($config);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue