Subversion Repositories PHPX

Rev

Rev 32 | Rev 44 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 32 Rev 41
Line 7... Line 7...
7
  /**
7
  /**
8
   * Database host
8
   * Database host
9
   * @var string
9
   * @var string
10
   */
10
   */
11
  protected $_host;
11
  protected $_host;
12
 
12
13
  /**
13
  /**
14
  * Database name
14
  * Database name
15
  * @var string
15
  * @var string
16
  */
16
  */
17
  protected $_dbname;
17
  protected $_dbname;
18
 
18
19
  /**
19
  /**
20
   * Username to access the database
20
   * Username to access the database
21
   * @var string
21
   * @var string
22
   */
22
   */
23
  protected $_username;
23
  protected $_username;
24
 
24
25
  /**
25
  /**
26
   * Password to access the database
26
   * Password to access the database
27
   * @var string
27
   * @var string
28
   */
28
   */
29
  protected $_password;
29
  protected $_password;
30
 
30
31
  /*
31
  /**
32
   * Optional charset parameter value
32
   * Optional charset parameter value
-
 
33
   * @var string
33
   */
34
   */
34
  protected $_charset = null;
35
  protected $_charset = null;
35
 
36
36
  /**
37
  /**
37
   * (non-PHPdoc)
38
   * (non-PHPdoc)
38
   * @see Database::_leftQuote
39
   * @see Database::_leftQuote
39
   */
40
   */
40
    protected $_leftQuote = '`';
41
    protected $_leftQuote = '`';
41
 
42
42
  /**
43
  /**
43
   * (non-PHPdoc)
44
   * (non-PHPdoc)
44
   * @see Database::_rightQuote
45
   * @see Database::_rightQuote
45
   */
46
   */
46
  protected $_rightQuote = '`';
47
  protected $_rightQuote = '`';
47
 
48
48
  public function __construct()
49
  public function __construct()
49
  {
50
  {
50
    $this->_dsn = "mysql:host={$this->_host}"
51
    $this->_dsn = "mysql:host={$this->_host}"
51
      . (!is_null($this->_dbname) ? ";dbname={$this->_dbname}" : '')
52
      . (!is_null($this->_dbname) ? ";dbname={$this->_dbname}" : '')
52
      . (!is_null($this->_charset) ? ";charset={$this->_charset}" : '');
53
      . (!is_null($this->_charset) ? ";charset={$this->_charset}" : '');
53
   
54
54
    if (!is_null($this->_charset))
55
    if (!is_null($this->_charset))
55
    {
56
    {
56
      $this->_options[PDO::MYSQL_ATTR_INIT_COMMAND] = "SET NAMES " . $this->_charset;
57
      $this->_options[PDO::MYSQL_ATTR_INIT_COMMAND] = "SET NAMES " . $this->_charset;
57
    }
58
    }
58
   
59
59
    parent::__construct();
60
    parent::__construct();
60
  }
61
  }
61
}
62
}
62
63