Commit 7a35e676 authored by chtito's avatar chtito

implements setCharset for mysql, no exception if setCharset is not implemented (fixes #244)

parent a65e106e
...@@ -450,13 +450,10 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun ...@@ -450,13 +450,10 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
* Set the charset on the current connection * Set the charset on the current connection
* *
* @param string charset * @param string charset
* @param resource connection handle
* *
* @throws Doctrine_Connection_Exception if the feature is not supported by the driver * @return void
* @return true on success, MDB2 Error Object on failure
*/ */
public function setCharset($charset) { public function setCharset($charset) {
throw new Doctrine_Connection_Exception('Altering charset not supported by this driver.');
} }
/** /**
* fetchAll * fetchAll
......
...@@ -88,6 +88,17 @@ class Doctrine_Connection_Mysql extends Doctrine_Connection_Common { ...@@ -88,6 +88,17 @@ class Doctrine_Connection_Mysql extends Doctrine_Connection_Common {
parent::__construct($manager, $adapter); 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 * Returns the next free id of a sequence
* *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment