*/
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']);
}
/**
- * Create a new PostgreSQL database. Options include <tt>:owner</tt>, <tt>:template</tt>,
- * <tt>:encoding</tt>, <tt>:tablespace</tt>, and <tt>:connection_limit</tt> (note that MySQL uses
- * <tt>:charset</tt> while PostgreSQL uses <tt>:encoding</tt>).
+ * 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) {
case 'template':
$optionString .= " TEMPLATE = $value";
break;
- case 'encoding':
+ case 'charset':
$optionString .= " ENCODING = '$value'";
break;
case 'tablespace':