11,6 → 11,18 |
protected $_host; |
|
/** |
* Database port on the host |
* @var int |
*/ |
protected $_port; |
|
/** |
* MySQL Unix socket (shouldn't be used with host or port). |
* @var string |
*/ |
protected $_unix_socket; |
|
/** |
* Database name |
* @var string |
*/ |
48,9 → 60,20 |
|
public function __construct() |
{ |
$this->readConfig(); |
$dbconfig = $this->readConfig(); |
if ($dbconfig === false) |
{ |
return; |
} |
|
if (isset($dbconfig['unix_socket'])) |
{ |
$this->_unix_socket = $dbconfig['unix_socket']; |
} |
|
$this->_dsn = "mysql:host={$this->_host}" |
. (!is_null($this->_port) ? ";port={$this->_port}" : '') |
. (!is_null($this->_unix_socket) ? ";unix_socket={$this->_unix_socket}" : '') |
. (!is_null($this->_dbname) ? ";dbname={$this->_dbname}" : '') |
. (!is_null($this->_charset) ? ";charset={$this->_charset}" : ''); |
|