Adding fix for Ticket #2347

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4785 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2007-04-05 17:09:52 +00:00
parent 56451426fb
commit ba8421cce2

View file

@ -89,7 +89,16 @@ class DboMysqli extends DboSource {
*/ */
function connect() { function connect() {
$config = $this->config; $config = $this->config;
$this->connected = false;
$this->connection = mysqli_connect($config['host'], $config['login'], $config['password'], $config['database'], $config['port']); $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; return $this->connected;
} }
/** /**
@ -412,6 +421,15 @@ class DboMysqli extends DboSource {
return false; 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... * Enter description here...
* *
@ -428,4 +446,4 @@ class DboMysqli extends DboSource {
return $query; return $query;
} }
} }
?> ?>