diff --git a/cake/libs/model/datasources/dbo/dbo_mysqli.php b/cake/libs/model/datasources/dbo/dbo_mysqli.php index 0882c2738..8631aea84 100644 --- a/cake/libs/model/datasources/dbo/dbo_mysqli.php +++ b/cake/libs/model/datasources/dbo/dbo_mysqli.php @@ -89,7 +89,16 @@ class DboMysqli extends DboSource { */ function connect() { $config = $this->config; + $this->connected = false; $this->connection = mysqli_connect($config['host'], $config['login'], $config['password'], $config['database'], $config['port']); + + if ($this->connection !== false) { + $this->connected = true; + } + + if (!empty($config['encoding'])) { + $this->setEncoding($config['encoding']); + } return $this->connected; } /** @@ -412,6 +421,15 @@ class DboMysqli extends DboSource { return false; } } +/** + * Sets the database encoding + * + * @param string $enc Database encoding + * @return void + */ + function setEncoding($enc) { + return $this->_execute('SET NAMES ' . $enc) != false; + } /** * Enter description here... * @@ -428,4 +446,4 @@ class DboMysqli extends DboSource { return $query; } } -?> \ No newline at end of file +?>