Apply charset and collation only if they are specified

This commit is contained in:
Tautvidas Sipavičius
2017-05-30 21:05:01 +03:00
parent 33d6533c64
commit c56b56f4aa
2 changed files with 14 additions and 3 deletions

View File

@ -32,8 +32,16 @@ class Database {
$driver_options = array(
'TIME_ZONE = "' . Env::$db_timezone_offset . '"',
'sql_mode=(SELECT REPLACE(@@sql_mode,"ONLY_FULL_GROUP_BY",""))',
'NAMES ' . Env::$db_charset . ' COLLATE ' . ENV::$db_collation,
);
if(!empty(Env::$db_charset)) {
$character_set = 'NAMES ' . Env::$db_charset;
if(!empty(Env::$db_collation)) {
$character_set .= ' COLLATE ' . Env::$db_collation;
}
$driver_options[] = $character_set;
}
$current_options = ORM::for_table("")
->raw_query('SELECT @@session.wait_timeout as wait_timeout')
->findOne();