Rev 58 | Rev 73 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 58 | Rev 68 | ||
---|---|---|---|
Line 9... | Line 9... | ||
9 | * @var string
|
9 | * @var string
|
10 | */
|
10 | */
|
11 | protected $_host; |
11 | protected $_host; |
12 | 12 | ||
13 | /**
|
13 | /**
|
- | 14 | * Database port on the host
|
|
- | 15 | * @var int
|
|
- | 16 | */
|
|
- | 17 | protected $_port; |
|
- | 18 | ||
- | 19 | /**
|
|
- | 20 | * MySQL Unix socket (shouldn't be used with host or port).
|
|
- | 21 | * @var string
|
|
- | 22 | */
|
|
- | 23 | protected $_unix_socket; |
|
- | 24 | ||
- | 25 | /**
|
|
14 | * Database name
|
26 | * Database name
|
15 | * @var string
|
27 | * @var string
|
16 | */
|
28 | */
|
17 | protected $_dbname; |
29 | protected $_dbname; |
18 | 30 | ||
Line 46... | Line 58... | ||
46 | */
|
58 | */
|
47 | protected $_rightQuote = '`'; |
59 | protected $_rightQuote = '`'; |
48 | 60 | ||
49 | public function __construct() |
61 | public function __construct() |
50 | {
|
62 | {
|
51 | $this->readConfig(); |
63 | $dbconfig = $this->readConfig(); |
- | 64 | if ($dbconfig === false) |
|
- | 65 | {
|
|
- | 66 | return; |
|
- | 67 | }
|
|
- | 68 | ||
- | 69 | if (isset($dbconfig['unix_socket'])) |
|
- | 70 | {
|
|
- | 71 | $this->_unix_socket = $dbconfig['unix_socket']; |
|
- | 72 | }
|
|
52 | 73 | ||
53 | $this->_dsn = "mysql:host={$this->_host}" |
74 | $this->_dsn = "mysql:host={$this->_host}" |
- | 75 | . (!is_null($this->_port) ? ";port={$this->_port}" : '') |
|
- | 76 | . (!is_null($this->_unix_socket) ? ";unix_socket={$this->_unix_socket}" : '') |
|
54 | . (!is_null($this->_dbname) ? ";dbname={$this->_dbname}" : '') |
77 | . (!is_null($this->_dbname) ? ";dbname={$this->_dbname}" : '') |
55 | . (!is_null($this->_charset) ? ";charset={$this->_charset}" : ''); |
78 | . (!is_null($this->_charset) ? ";charset={$this->_charset}" : ''); |
56 | 79 | ||
57 | if (!is_null($this->_charset)) |
80 | if (!is_null($this->_charset)) |
58 | {
|
81 | {
|