Skip to content

Commit

Permalink
Explicit connection collation (#183)
Browse files Browse the repository at this point in the history
* Remove unused exceptions

* Set collation on connection, closes #182
  • Loading branch information
g105b authored Feb 6, 2020
1 parent f08cab1 commit dc7c9cf
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Connection/Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ protected function connect() {
Connection::ATTR_ERRMODE => Connection::ERRMODE_EXCEPTION,
];

if($this->settings->getSchema() === Settings::DRIVER_MYSQL) {
$options[Connection::MYSQL_ATTR_INIT_COMMAND]
= "SET SESSION collation_connection='"
. $this->settings->getCollation()
. "'";
}

$this->connection = new Connection(
$this->settings->getConnectionString(),
$this->settings->getUsername(),
Expand Down

0 comments on commit dc7c9cf

Please sign in to comment.