DbConnection: fix utf8-encoded MySQL connections

This commit is contained in:
Thomas Gelf 2016-02-29 20:58:34 +01:00
parent 1dca5bd123
commit 1fba491160
1 changed files with 5 additions and 0 deletions

View File

@ -153,6 +153,11 @@ class DbConnection implements Selectable, Extensible, Updatable, Reducible, Insp
$driverOptions[PDO::MYSQL_ATTR_INIT_COMMAND] = $driverOptions[PDO::MYSQL_ATTR_INIT_COMMAND] =
'SET SESSION SQL_MODE=\'STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,' 'SET SESSION SQL_MODE=\'STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,'
. 'NO_AUTO_CREATE_USER,ANSI_QUOTES,PIPES_AS_CONCAT,NO_ENGINE_SUBSTITUTION\';'; . 'NO_AUTO_CREATE_USER,ANSI_QUOTES,PIPES_AS_CONCAT,NO_ENGINE_SUBSTITUTION\';';
if (array_key_exists('charset', $adapterParamaters) && $adapterParamaters['charset']) {
$driverOptions[PDO::MYSQL_ATTR_INIT_COMMAND] .= 'SET NAMES ' . $adapterParamaters['charset']. ';';
unset($adapterParamaters['charset']);
}
$adapterParamaters['port'] = $this->config->get('port', 3306); $adapterParamaters['port'] = $this->config->get('port', 3306);
break; break;
case 'oci': case 'oci':