From 569eb88e785519bb20950fc80066491845bdbffa Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Sun, 3 Oct 2010 01:41:54 +0200 Subject: [PATCH] Add Horde_Db_Adapter#getOption(). Set correct backend charset. --- framework/Core/lib/Horde/Core/Factory/Prefs.php | 4 +--- framework/Db/lib/Horde/Db/Adapter/Base.php | 12 ++++++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) 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 -- 2.11.0