diff --git a/lib/Doctrine/Connection.php b/lib/Doctrine/Connection.php index 6206cc44c..6cfb573ac 100644 --- a/lib/Doctrine/Connection.php +++ b/lib/Doctrine/Connection.php @@ -450,13 +450,10 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun * Set the charset on the current connection * * @param string charset - * @param resource connection handle * - * @throws Doctrine_Connection_Exception if the feature is not supported by the driver - * @return true on success, MDB2 Error Object on failure + * @return void */ public function setCharset($charset) { - throw new Doctrine_Connection_Exception('Altering charset not supported by this driver.'); } /** * fetchAll diff --git a/lib/Doctrine/Connection/Mysql.php b/lib/Doctrine/Connection/Mysql.php index 69214f185..492f1005b 100644 --- a/lib/Doctrine/Connection/Mysql.php +++ b/lib/Doctrine/Connection/Mysql.php @@ -88,6 +88,17 @@ class Doctrine_Connection_Mysql extends Doctrine_Connection_Common { parent::__construct($manager, $adapter); } + /** + * Set the charset on the current connection + * + * @param string charset + * + * @return void + */ + public function setCharset($charset) { + $query = 'SET NAMES '.$this->dbh->quote($charset); + $this->dbh->query($query); + } /** * Returns the next free id of a sequence *