Skip to content

Commit

Permalink
Update MySqlConnector.php (#13930)
Browse files Browse the repository at this point in the history
Sometimes we don't need  to set names and collate.
  • Loading branch information
mixisLv authored and taylorotwell committed Jun 14, 2016
1 parent cb6c650 commit 163efce
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/Illuminate/Database/Connectors/MySqlConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 163efce

Please sign in to comment.