From: Jan Schneider Date: Mon, 17 Jan 2011 17:12:20 +0000 (+0100) Subject: Support and fix setting the client/connection charset for PostgreSQL with the standar... X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=f18217f04eb83e8ba7851d3437744d3dc543b4b8;p=horde.git Support and fix setting the client/connection charset for PostgreSQL with the standard 'charset' option. --- diff --git a/framework/Db/lib/Horde/Db/Adapter/Pdo/Pgsql.php b/framework/Db/lib/Horde/Db/Adapter/Pdo/Pgsql.php index 0fa2e4a09..e0d83ac51 100644 --- a/framework/Db/lib/Horde/Db/Adapter/Pdo/Pgsql.php +++ b/framework/Db/lib/Horde/Db/Adapter/Pdo/Pgsql.php @@ -215,9 +215,9 @@ class Horde_Db_Adapter_Pdo_Pgsql extends Horde_Db_Adapter_Pdo_Base */ protected function _configureConnection() { - if (!empty($this->_config['encoding'])) { - $this->last_query = 'SET client_encoding TO '.$this->quoteString($this->_config['encoding']); - $this->_connection->execute($this->last_query); + if (!empty($this->_config['charset'])) { + $this->last_query = 'SET client_encoding TO '.$this->quoteString($this->_config['charset']); + $this->execute($this->last_query); } if (!empty($this->_config['client_min_messages'])) $this->setClientMinMessages($this->_config['client_min_messages']); diff --git a/framework/Db/lib/Horde/Db/Adapter/Postgresql/Schema.php b/framework/Db/lib/Horde/Db/Adapter/Postgresql/Schema.php index e819feeca..5c8b8d34b 100644 --- a/framework/Db/lib/Horde/Db/Adapter/Postgresql/Schema.php +++ b/framework/Db/lib/Horde/Db/Adapter/Postgresql/Schema.php @@ -140,17 +140,14 @@ class Horde_Db_Adapter_Postgresql_Schema extends Horde_Db_Adapter_Base_Schema } /** - * Create a new PostgreSQL database. Options include :owner, :template, - * :encoding, :tablespace, and :connection_limit (note that MySQL uses - * :charset while PostgreSQL uses :encoding). + * Creates a new PostgreSQL database. * - * Example: - * create_database config[:database], config - * create_database 'foo_development', :encoding => 'unicode' + * Options include: owner, template, charset, tablespace, and + * connection_limit. */ public function createDatabase($name, $options = array()) { - $options = array_merge(array('encoding' => 'utf8'), $options); + $options = array_merge(array('charset' => 'utf8'), $options); $optionString = ''; foreach ($options as $key => $value) { @@ -161,7 +158,7 @@ class Horde_Db_Adapter_Postgresql_Schema extends Horde_Db_Adapter_Base_Schema case 'template': $optionString .= " TEMPLATE = $value"; break; - case 'encoding': + case 'charset': $optionString .= " ENCODING = '$value'"; break; case 'tablespace':