From dc7c9cfe9b51c0f67fcef97fbc5dce03220aedbd Mon Sep 17 00:00:00 2001 From: Greg Bowler Date: Thu, 6 Feb 2020 13:29:18 +0000 Subject: [PATCH] Explicit connection collation (#183) * Remove unused exceptions * Set collation on connection, closes #182 --- src/Connection/Driver.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Connection/Driver.php b/src/Connection/Driver.php index 157628b..1883d44 100644 --- a/src/Connection/Driver.php +++ b/src/Connection/Driver.php @@ -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(),