From: Jan Schneider Date: Sat, 2 Oct 2010 23:41:54 +0000 (+0200) Subject: Add Horde_Db_Adapter#getOption(). Set correct backend charset. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=569eb88e785519bb20950fc80066491845bdbffa;p=horde.git Add Horde_Db_Adapter#getOption(). Set correct backend charset. --- diff --git a/framework/Core/lib/Horde/Core/Factory/Prefs.php b/framework/Core/lib/Horde/Core/Factory/Prefs.php index 92512aa46..364612580 100644 --- a/framework/Core/lib/Horde/Core/Factory/Prefs.php +++ b/framework/Core/lib/Horde/Core/Factory/Prefs.php @@ -105,9 +105,7 @@ class Horde_Core_Factory_Prefs case 'Sql': $params['db'] = $this->_injector->getInstance('Horde_Db_Adapter'); - // @todo All DB's use UTF-8(?) Does not seem to be a way to - // get this information from Horde_Db_Adapter. - $opts['charset'] = 'UTF-8'; + $opts['charset'] = $params['db']->getOption('charset'); break; } diff --git a/framework/Db/lib/Horde/Db/Adapter/Base.php b/framework/Db/lib/Horde/Db/Adapter/Base.php index 6754989c8..e8b694366 100644 --- a/framework/Db/lib/Horde/Db/Adapter/Base.php +++ b/framework/Db/lib/Horde/Db/Adapter/Base.php @@ -160,6 +160,18 @@ abstract class Horde_Db_Adapter_Base implements Horde_Db_Adapter $this->connect(); } + /** + * Returns an adaptor option set through the constructor. + * + * @param string $option The option to return. + * + * @return mixed The option value or null if option doesn't exist or is + * not set. + */ + public function getOption($option) + { + return isset($this->_config[$option]) ? $this->_config[$option] : null; + } /*########################################################################## # Dependency setters/getters