Skip to content

Commit

Permalink
It's something MySQL-specific as far as I can see, so let's delegate …
Browse files Browse the repository at this point in the history
…it to MySQL only.

Signed-off-by: emanuele <emanuele45@gmail.com>
  • Loading branch information
emanuele45 committed Jan 11, 2014
1 parent ca409af commit c2706b8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
10 changes: 1 addition & 9 deletions sources/Load.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,10 @@
*/
function reloadSettings()
{
global $modSettings, $db_character_set;
global $modSettings;

$db = database();

// Most database systems have not set UTF-8 as their default input charset.
// @todo I'm tempted to say that this should be a method of the db class
$db->query('set_character_set', '
SET NAMES ' . $db_character_set,
array(
)
);

// Try to load it from the cache first; it'll never get cached if the setting is off.
if (($modSettings = cache_get_data('modSettings', 90)) == null)
{
Expand Down
7 changes: 7 additions & 0 deletions sources/database/Db-mysql.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,13 @@ static function initiate($db_server, $db_name, $db_user, $db_passwd, $db_prefix,

self::$_db->_connection = $connection;

// Few databases still have not set UTF-8 as their default input charset
self::$_db->query('', '
SET NAMES UTF8',
array(
)
);

return $connection;
}

Expand Down
3 changes: 0 additions & 3 deletions sources/database/Db-postgresql.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -330,9 +330,6 @@ function query($identifier, $db_string, $db_values = array(), $connection = null
'insert_log_search_results_subject' => array(
'~NOT RLIKE~' => '!~',
),
'set_character_set' => array(
'~SET\\s+NAMES\\s([a-zA-Z0-9\\-_]+)~' => 'SET NAMES \'$1\'',
),
'pm_conversation_list' => array(
'~ORDER\\s+BY\\s+\\{raw:sort\\}~' => 'ORDER BY ' . (isset($db_values['sort']) ? ($db_values['sort'] === 'pm.id_pm' ? 'MAX(pm.id_pm)' : $db_values['sort']) : ''),
),
Expand Down

0 comments on commit c2706b8

Please sign in to comment.