Add Horde_Db_Adapter#getOption(). Set correct backend charset.
authorJan Schneider <jan@horde.org>
Sat, 2 Oct 2010 23:41:54 +0000 (01:41 +0200)
committerJan Schneider <jan@horde.org>
Sun, 3 Oct 2010 16:48:47 +0000 (18:48 +0200)
framework/Core/lib/Horde/Core/Factory/Prefs.php
framework/Db/lib/Horde/Db/Adapter/Base.php

index 92512aa..3646125 100644 (file)
@@ -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;
             }
 
index 6754989..e8b6943 100644 (file)
@@ -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