Changeset 683 for trunk/lib/DB.inc.php
- Timestamp:
- May 19, 2019 10:51:34 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/DB.inc.php
r679 r683 72 72 // Timezone for MySQL. 73 73 'timezone' => 'UTC', 74 75 // MySQL character set and collation. 76 'character_set' => '', 77 'collation' => '', 74 78 ); 75 79 … … 192 196 $this->_connected = true; 193 197 194 // Tell MySQL what character set we're using. Available only on MySQL versions > 4.01.01. 195 if ('' != $app->getParam('character_set') && isset($this->mysql_character_sets[mb_strtolower($app->getParam('character_set'))])) { 196 $this->query(sprintf("SET NAMES '%s';", $this->mysql_character_sets[mb_strtolower($app->getParam('character_set'))])); 197 } else { 198 $app->logMsg(sprintf('%s is not a known character_set.', $app->getParam('character_set')), LOG_ERR, __FILE__, __LINE__); 198 // If the mysql charset is not defined, try to determine a mysql charset from the app charset. 199 if ('' == $this->getParam('character_set') && '' != $app->getParam('character_set') && isset($this->mysql_character_sets[mb_strtolower($app->getParam('character_set'))])) { 200 $this->setParam(array('character_set' => $this->mysql_character_sets[mb_strtolower($app->getParam('character_set'))])); 201 } 202 if ('' != $this->getParam('character_set')) { 203 if ('' != $this->getParam('collation')) { 204 $this->query(sprintf("SET NAMES '%s' COLLATE '%s';", $this->getParam('character_set'), $this->getParam('collation'))); 205 } else { 206 $this->query(sprintf("SET NAMES '%s';", $this->getParam('character_set'))); 207 } 199 208 } 200 209
Note: See TracChangeset
for help on using the changeset viewer.