Changeset 810 for trunk/lib/PDO.inc.php
- Timestamp:
- Mar 4, 2024 12:30:57 AM (2 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/PDO.inc.php
r747 r810 103 103 * @param string $params Configuration parameters for this object. 104 104 */ 105 public function __construct( $params=null)105 public function __construct(Array $params=[]) 106 106 { 107 107 // Set custom parameters. … … 131 131 * @param array $params Array of param keys and values to set. 132 132 */ 133 public function setParam($params=null) 134 { 135 if (isset($params) && is_array($params)) { 136 // Merge new parameters with old overriding only those passed. 137 $this->_params = array_merge($this->_params, $params); 133 public function setParam(Array $params) 134 { 135 if (!isset($params) || !is_array($params)) { 136 trigger_error(sprintf('%s failed; not an array: %s', __METHOD__, getDump($params, false, SC_DUMP_PRINT_R)), E_USER_ERROR); 137 } 138 139 // Merge new parameters with old overriding only those passed. 140 $this->_params = array_merge($this->_params, $params); 141 142 if ($this->isConnected()) { 143 // Params that require additional processing if set during runtime. 144 foreach ($params as $key => $val) { 145 switch ($key) { 146 case 'timezone': 147 // Set timezone used by MySQL. 148 $this->query(sprintf("SET time_zone = %s;", $this->quote($val))); 149 break; 150 } 151 } 138 152 } 139 153 }
Note: See TracChangeset
for help on using the changeset viewer.