Set default db charset for MySQL ido resources to latin1
latin1 seems to be the only supported charset for MySQL but the current upstream default charset is utf8mb4 and to be safe it should be set explicitly
This commit is contained in:
parent
bf677ac29d
commit
9a29d8f3d4
|
@ -222,7 +222,11 @@ class MonitoringBackend implements Selectable, Queryable, ConnectionInterface
|
|||
public function getResource()
|
||||
{
|
||||
if ($this->resource === null) {
|
||||
$this->resource = ResourceFactory::create($this->config->get('resource'));
|
||||
$config = ResourceFactory::getResourceConfig($this->config->get('resource'));
|
||||
if ($this->is('ido') && $config->type === 'db' && $config->db === 'mysql' && $config->charset === null) {
|
||||
$config->charset = 'latin1';
|
||||
}
|
||||
$this->resource = ResourceFactory::createResource($config);
|
||||
if ($this->is('ido') && $this->resource->getDbType() !== 'oracle') {
|
||||
// TODO(el): The resource should set the table prefix
|
||||
$this->resource->setTablePrefix('icinga_');
|
||||
|
|
Loading…
Reference in New Issue