Commit d82b2e07 authored by Benjamin Eberlei's avatar Benjamin Eberlei

Merge pull request #76 from kimhemsoe/mysqli_error_handling

Mysqli driver: Throw exception if connecting to mysql failed.
parents f0ffcfaf 718b067a
......@@ -36,7 +36,10 @@ class MysqliConnection implements Connection
$port = isset($params['port']) ? $params['port'] : ini_get('mysqli.default_port');
$socket = isset($params['unix_socket']) ? $params['unix_socket'] : ini_get('mysqli.default_socket');
$this->_conn = new \mysqli($params['host'], $username, $password, $params['dbname'], $port, $socket);
$this->_conn = mysqli_init();
if (!$this->_conn->real_connect($params['host'], $username, $password, $params['dbname'], $port, $socket)) {
throw new MysqliException($this->_conn->connect_error, $this->_conn->connect_errno);
}
if (isset($params['charset'])) {
$this->_conn->set_charset($params['charset']);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment