mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-06 01:28:19 +01:00
FIX Tool to convert into utf8
This commit is contained in:
@@ -53,12 +53,30 @@ if ($action == 'convert') { // Convert engine into innodb
|
||||
$db->query($sql);
|
||||
}
|
||||
if ($action == 'convertutf8') {
|
||||
$sql = "ALTER TABLE ".$db->sanitize($table)." CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci";
|
||||
$db->query($sql);
|
||||
$sql = "ALTER TABLE ".$db->sanitize($table)." CHARACTER SET utf8 COLLATE utf8_unicode_ci"; // Set the default value on table
|
||||
$resql1 = $db->query($sql);
|
||||
if (!$resql1) {
|
||||
setEventMessages($db->lasterror(), null, 'warnings');
|
||||
} else {
|
||||
$sql = "ALTER TABLE ".$db->sanitize($table)." CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci"; // Switch fields (may fails due to foreign key)
|
||||
$resql2 = $db->query($sql);
|
||||
if (!$resql2) {
|
||||
setEventMessages($db->lasterror(), null, 'warnings');
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($action == 'convertutf8mb4') {
|
||||
$sql = "ALTER TABLE ".$db->sanitize($table)." CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci";
|
||||
$db->query($sql);
|
||||
$sql = "ALTER TABLE ".$db->sanitize($table)." CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci"; // Set the default value on table
|
||||
$resql1 = $db->query($sql);
|
||||
if (!$resql1) {
|
||||
setEventMessages($db->lasterror(), null, 'warnings');
|
||||
} else {
|
||||
$sql = "ALTER TABLE ".$db->sanitize($table)." CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci"; // Switch fields (may fails due to foreign key)
|
||||
$resql2 = $db->query($sql);
|
||||
if (!$resql2) {
|
||||
setEventMessages($db->lasterror(), null, 'warnings');
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($action == 'convertdynamic') {
|
||||
$sql = "ALTER TABLE ".$db->sanitize($table)." ROW_FORMAT=DYNAMIC;";
|
||||
|
||||
Reference in New Issue
Block a user