Skip to content

Commit

Permalink
UTF-8 Multibyte (utf8mb4) support
Browse files Browse the repository at this point in the history
Use utf8mb4 if available when creating a database or updating its character set using the JDatabaseDriver methods.
  • Loading branch information
Nicholas K. Dionysopoulos committed Jun 13, 2015
1 parent e3c8bda commit 854d77d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions libraries/joomla/database/driver.php
Expand Up @@ -626,7 +626,9 @@ abstract public function getAffectedRows();
*/
protected function getAlterDbCharacterSet($dbName)
{
return 'ALTER DATABASE ' . $this->quoteName($dbName) . ' CHARACTER SET `utf8`';
$charset = $this->utf8mb4 ? 'utf8mb4' : 'utf8';

return 'ALTER DATABASE ' . $this->quoteName($dbName) . ' CHARACTER SET `' . $charset .'`';
}

/**
Expand All @@ -645,7 +647,9 @@ protected function getCreateDatabaseQuery($options, $utf)
{
if ($utf)
{
return 'CREATE DATABASE ' . $this->quoteName($options->db_name) . ' CHARACTER SET `utf8`';
$charset = $this->utf8mb4 ? 'utf8mb4' : 'utf8';

return 'CREATE DATABASE ' . $this->quoteName($options->db_name) . ' CHARACTER SET `' . $charset . '`';
}

return 'CREATE DATABASE ' . $this->quoteName($options->db_name);
Expand Down

0 comments on commit 854d77d

Please sign in to comment.