From 163efce8059fbd6a7affde958876e7d1d0908d72 Mon Sep 17 00:00:00 2001 From: Mikus Rozenbergs Date: Tue, 14 Jun 2016 04:30:58 +0300 Subject: [PATCH] Update MySqlConnector.php (#13930) Sometimes we don't need to set names and collate. --- src/Illuminate/Database/Connectors/MySqlConnector.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Illuminate/Database/Connectors/MySqlConnector.php b/src/Illuminate/Database/Connectors/MySqlConnector.php index 9cc2186bae32..ca0de809b81f 100755 --- a/src/Illuminate/Database/Connectors/MySqlConnector.php +++ b/src/Illuminate/Database/Connectors/MySqlConnector.php @@ -30,13 +30,14 @@ public function connect(array $config) // Next we will set the "names" and "collation" on the clients connections so // a correct character set will be used by this client. The collation also // is set on the server but needs to be set here on this client objects. - $charset = $config['charset']; + if (isset($config['charset'])) { + $charset = $config['charset']; - $names = "set names '$charset'". - (! is_null($collation) ? " collate '$collation'" : ''); - - $connection->prepare($names)->execute(); + $names = "set names '$charset'". + (! is_null($collation) ? " collate '$collation'" : ''); + $connection->prepare($names)->execute(); + } // Next, we will check to see if a timezone has been specified in this config // and if it has we will issue a statement to modify the timezone with the // database. Setting this DB timezone is an optional configuration item.