Rev 29 | Rev 44 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 29 | Rev 32 | ||
---|---|---|---|
Line 31... | Line 31... | ||
31 | /*
|
31 | /*
|
32 | * Optional charset parameter value
|
32 | * Optional charset parameter value
|
33 | */
|
33 | */
|
34 | protected $_charset = null; |
34 | protected $_charset = null; |
35 | 35 | ||
- | 36 | /**
|
|
- | 37 | * (non-PHPdoc)
|
|
- | 38 | * @see Database::_leftQuote
|
|
- | 39 | */
|
|
- | 40 | protected $_leftQuote = '`'; |
|
- | 41 | ||
- | 42 | /**
|
|
- | 43 | * (non-PHPdoc)
|
|
- | 44 | * @see Database::_rightQuote
|
|
- | 45 | */
|
|
- | 46 | protected $_rightQuote = '`'; |
|
- | 47 | ||
36 | public function __construct() |
48 | public function __construct() |
37 | {
|
49 | {
|
38 | $this->_dsn = "mysql:host={$this->_host}" |
50 | $this->_dsn = "mysql:host={$this->_host}" |
39 | . (!is_null($this->_dbname) ? ";dbname={$this->_dbname}" : '') |
51 | . (!is_null($this->_dbname) ? ";dbname={$this->_dbname}" : '') |
40 | . (!is_null($this->_charset) ? ";charset={$this->_charset}" : ''); |
52 | . (!is_null($this->_charset) ? ";charset={$this->_charset}" : ''); |
Line 44... | Line 56... | ||
44 | $this->_options[PDO::MYSQL_ATTR_INIT_COMMAND] = "SET NAMES " . $this->_charset; |
56 | $this->_options[PDO::MYSQL_ATTR_INIT_COMMAND] = "SET NAMES " . $this->_charset; |
45 | }
|
57 | }
|
46 | 58 | ||
47 | parent::__construct(); |
59 | parent::__construct(); |
48 | }
|
60 | }
|
49 | - | ||
50 | /**
|
- | |
51 | * Escapes a database name so that it can be used in a query.
|
- | |
52 | *
|
- | |
53 | * @param string $name
|
- | |
54 | * The name to be escaped
|
- | |
55 | * @return string
|
- | |
56 | * The escaped name
|
- | |
57 | */
|
- | |
58 | public function escapeName($name) |
- | |
59 | {
|
- | |
60 | return '`' . $name . '`'; |
- | |
61 | }
|
- | |
62 | - | ||
63 | /**
|
- | |
64 | * (non-PHPdoc)
|
- | |
65 | * @see Database::_escapeAliasArray()
|
- | |
66 | */
|
- | |
67 | protected function _escapeAliasArray(array &$array) |
- | |
68 | {
|
- | |
69 | foreach ($array as $column => &$value) |
- | |
70 | {
|
- | |
71 | $value = $value . ' AS `' . $column . '`'; |
- | |
72 | }
|
- | |
73 | - | ||
74 | return $array; |
- | |
75 | }
|
- | |
76 | - | ||
77 | /**
|
- | |
78 | * (non-PHPdoc)
|
- | |
79 | * @see Database::_escapeValueArray()
|
- | |
80 | */
|
- | |
81 | protected function _escapeValueArray(array &$array, $suffix = '', array &$escape = array('`', '`')) |
- | |
82 | {
|
- | |
83 | return parent::_escapeValueArray($array, $suffix, $escape); |
- | |
84 | }
|
- | |
85 | }
|
61 | }
|
86 | 62 |