Commit 64625099 authored by Kim Hemsø Rasmussen's avatar Kim Hemsø Rasmussen

Mysqli driver: Throw exception if connecting to mysql failed.

parent 48f67ae5
...@@ -36,7 +36,11 @@ class MysqliConnection implements Connection ...@@ -36,7 +36,11 @@ class MysqliConnection implements Connection
$port = isset($params['port']) ? $params['port'] : ini_get('mysqli.default_port'); $port = isset($params['port']) ? $params['port'] : ini_get('mysqli.default_port');
$socket = isset($params['unix_socket']) ? $params['unix_socket'] : ini_get('mysqli.default_socket'); $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'])) { if (isset($params['charset'])) {
$this->_conn->set_charset($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