Use utf8mb4

feature/nel-dll
kaetemi 6 years ago
parent 2b73ed7def
commit e9dadb188a

@ -92,17 +92,17 @@ function api_key_management_hook_activate()
CREATE TABLE IF NOT EXISTS `ams_api_keys` (
`SNo` int(10) NOT NULL AUTO_INCREMENT,
`User` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`FrName` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`UserType` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
`UserCharacter` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`User` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`FrName` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`UserType` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`UserCharacter` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`ExpiryDate` date DEFAULT NULL,
`AccessToken` text COLLATE utf8_unicode_ci DEFAULT NULL,
`AccessToken` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`AddedOn` datetime DEFAULT NULL,
`Items` text COLLATE utf8_unicode_ci,
`Items` text COLLATE utf8mb4_unicode_ci,
PRIMARY KEY (`SNo`),
KEY `User` (`User`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci AUTO_INCREMENT=1 ;
--
-- Constraints for table `ams_api_keys`

@ -12,7 +12,7 @@
* `modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
* `source` text,
* PRIMARY KEY (`name`)
* ) ENGINE=InnoDB DEFAULT CHARSET=utf8;</pre>
* ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;</pre>
*
* Demo data:
* <pre>INSERT INTO `templates` (`name`, `modified`, `source`) VALUES ('test.tpl', "2010-12-25 22:00:00", '{$x="hello world"}{$x}');</pre>

@ -15,7 +15,7 @@
* `modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
* `source` text,
* PRIMARY KEY (`name`)
* ) ENGINE=InnoDB DEFAULT CHARSET=utf8;</pre>
* ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;</pre>
*
* Demo data:
* <pre>INSERT INTO `templates` (`name`, `modified`, `source`) VALUES ('test.tpl', "2010-12-25 22:00:00", '{$x="hello world"}{$x}');</pre>

@ -134,7 +134,7 @@ class ryDB {
global $_RYZOM_API_CONFIG;
$this->db_name = $db_name;
$this->db = new ServerDatabase(RYAPI_WEBDB_HOST, RYAPI_WEBDB_LOGIN, RYAPI_WEBDB_PASS, $db_name);
$this->db->query("SET NAMES utf8");
$this->db->query("SET NAMES utf8mb4");
}
public static function getInstance($db_name) {
@ -480,7 +480,7 @@ class ryDB {
$c = "Updating DB Structure...\n";
foreach ($defs as $dbname => $tables) {
$db = new ServerDatabase(RYAPI_WEBDB_HOST, RYAPI_WEBDB_LOGIN, RYAPI_WEBDB_PASS, $dbname);
$db->query("SET NAMES utf8");
$db->query("SET NAMES utf8mb4");
$c .= "\n Selected DB '$dbname'\n";
foreach ($tables as $table => $sql)
{

@ -62,7 +62,7 @@ function validate_writable($continue, $path) {
function create_use_database($continue_r, $con, $database) {
$continue = $continue_r;
if ($continue) {
$sql = "CREATE DATABASE `" . mysqli_real_escape_string($con, $database) . "` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;";
$sql = "CREATE DATABASE `" . mysqli_real_escape_string($con, $database) . "` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;";
if (mysqli_query($con, $sql)) {
printalert("success", "Database <em>" . $database . "</em> created");
} else {

@ -8,7 +8,7 @@ class DATABASE_CONFIG {
'login' => 'webtt',
'password' => 'webtt77',
'database' => 'webtt2',
'encoding' => 'utf8'
'encoding' => 'utf8mb4'
);
var $raw_files = array(
'datasource' => 'RawFilesSource',

@ -872,8 +872,8 @@ class CakeSchemaTest extends CakeTestCase {
'author_id' => array('column' => 'author_id'),
),
'tableParameters' => array(
'charset' => 'utf8',
'collate' => 'utf8_general_ci',
'charset' => 'utf8mb4',
'collate' => 'utf8mb4_general_ci',
'engine' => 'MyISAM'
)
),
@ -885,8 +885,8 @@ class CakeSchemaTest extends CakeTestCase {
'PRIMARY' => array('column' => 'id', 'unique' => true),
),
'tableParameters' => array(
'charset' => 'utf8',
'collate' => 'utf8_general_ci'
'charset' => 'utf8mb4',
'collate' => 'utf8mb4_general_ci'
)
)
);
@ -898,8 +898,8 @@ class CakeSchemaTest extends CakeTestCase {
),
'change' => array(
'tableParameters' => array(
'charset' => 'utf8',
'collate' => 'utf8_general_ci',
'charset' => 'utf8mb4',
'collate' => 'utf8mb4_general_ci',
'engine' => 'MyISAM'
)
)
@ -910,8 +910,8 @@ class CakeSchemaTest extends CakeTestCase {
),
'change' => array(
'tableParameters' => array(
'charset' => 'utf8',
'collate' => 'utf8_general_ci',
'charset' => 'utf8mb4',
'collate' => 'utf8mb4_general_ci',
)
)
)

@ -376,11 +376,11 @@ class DboMysqlTest extends CakeTestCase {
'default',
'null' => true,
'key',
'charset' => 'utf8',
'collate' => 'utf8_unicode_ci'
'charset' => 'utf8mb4',
'collate' => 'utf8mb4_unicode_ci'
);
$result = $this->db->buildColumn($data);
$expected = '`testName` CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL';
$expected = '`testName` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL';
$this->assertEqual($result, $expected);
$this->db->columns = $restore;
}
@ -648,22 +648,22 @@ class DboMysqlTest extends CakeTestCase {
'id' => array('type' => 'integer', 'null' => false, 'default' => 0),
'name' => array('type' => 'string', 'null' => false, 'length' => 50),
'tableParameters' => array(
'charset' => 'utf8',
'collate' => 'utf8_general_ci',
'charset' => 'utf8mb4',
'collate' => 'utf8mb4_general_ci',
'engine' => 'InnoDB'
)
)
));
$result = $this->db->alterSchema($schema2->compare($schema1));
$this->assertPattern('/DEFAULT CHARSET=utf8/', $result);
$this->assertPattern('/DEFAULT CHARSET=utf8mb4/', $result);
$this->assertPattern('/ENGINE=InnoDB/', $result);
$this->assertPattern('/COLLATE=utf8_general_ci/', $result);
$this->assertPattern('/COLLATE=utf8mb4_general_ci/', $result);
$this->db->query($result);
$result = $this->db->listDetailedSources('altertest');
$this->assertEqual($result['Collation'], 'utf8_general_ci');
$this->assertEqual($result['Collation'], 'utf8mb4_general_ci');
$this->assertEqual($result['Engine'], 'InnoDB');
$this->assertEqual($result['charset'], 'utf8');
$this->assertEqual($result['charset'], 'utf8mb4');
$this->db->query($this->db->dropSchema($schema1));
}
@ -710,11 +710,11 @@ class DboMysqlTest extends CakeTestCase {
*/
function testReadTableParameters() {
$this->db->cacheSources = false;
$this->db->query('CREATE TABLE ' . $this->db->fullTableName('tinyint') . ' (id int(11) AUTO_INCREMENT, bool tinyint(1), small_int tinyint(2), primary key(id)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;');
$this->db->query('CREATE TABLE ' . $this->db->fullTableName('tinyint') . ' (id int(11) AUTO_INCREMENT, bool tinyint(1), small_int tinyint(2), primary key(id)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;');
$result = $this->db->readTableParameters('tinyint');
$expected = array(
'charset' => 'utf8',
'collate' => 'utf8_unicode_ci',
'charset' => 'utf8mb4',
'collate' => 'utf8mb4_unicode_ci',
'engine' => 'InnoDB');
$this->assertEqual($result, $expected);
@ -738,13 +738,13 @@ class DboMysqlTest extends CakeTestCase {
function testBuildTableParameters() {
$this->db->cacheSources = false;
$data = array(
'charset' => 'utf8',
'collate' => 'utf8_unicode_ci',
'charset' => 'utf8mb4',
'collate' => 'utf8mb4_unicode_ci',
'engine' => 'InnoDB');
$result = $this->db->buildTableParameters($data);
$expected = array(
'DEFAULT CHARSET=utf8',
'COLLATE=utf8_unicode_ci',
'DEFAULT CHARSET=utf8mb4',
'COLLATE=utf8mb4_unicode_ci',
'ENGINE=InnoDB');
$this->assertEqual($result, $expected);
}
@ -757,8 +757,8 @@ class DboMysqlTest extends CakeTestCase {
*/
function testGetCharsetName() {
$this->db->cacheSources = false;
$result = $this->db->getCharsetName('utf8_unicode_ci');
$this->assertEqual($result, 'utf8');
$result = $this->db->getCharsetName('utf8mb4_unicode_ci');
$this->assertEqual($result, 'utf8mb4');
$result = $this->db->getCharsetName('cp1250_general_ci');
$this->assertEqual($result, 'cp1250');
}

@ -318,11 +318,11 @@ class DboMysqliTest extends CakeTestCase {
*/
function testReadTableParameters() {
$this->db->cacheSources = $this->db->testing = false;
$this->db->query('CREATE TABLE ' . $this->db->fullTableName('tinyint') . ' (id int(11) AUTO_INCREMENT, bool tinyint(1), small_int tinyint(2), primary key(id)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;');
$this->db->query('CREATE TABLE ' . $this->db->fullTableName('tinyint') . ' (id int(11) AUTO_INCREMENT, bool tinyint(1), small_int tinyint(2), primary key(id)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;');
$result = $this->db->readTableParameters('tinyint');
$expected = array(
'charset' => 'utf8',
'collate' => 'utf8_unicode_ci',
'charset' => 'utf8mb4',
'collate' => 'utf8mb4_unicode_ci',
'engine' => 'InnoDB');
$this->assertEqual($result, $expected);

Loading…
Cancel
Save