alter db collations

This commit is contained in:
Alexander M. Turek
2004-04-17 01:19:06 +00:00
parent 1ecafa5e23
commit ced513ee97
5 changed files with 13 additions and 17 deletions

View File

@@ -7,7 +7,7 @@ $Source$
2004-04-17 Alexander M. Turek <me@derrabus.de>
* db_create.php, main.php, libraries/mysql_charsets.lib.php:
Added ability to choose the collation for new databases.
Added ability to set / alter collations on database level.
2004-04-16 Marc Delisle <lem9@users.sourceforge.net>
* lang/french update

View File

@@ -27,7 +27,7 @@ $sql_query = 'CREATE DATABASE ' . PMA_backquote($db);
if (!empty($db_collation) && PMA_MYSQL_INT_VERSION >= 40101) {
list($db_charset) = explode('_', $db_collation);
if (in_array($db_charset, $mysql_charsets) && in_array($db_collation, $mysql_collations[$db_charset])) {
$sql_query .= ' DEFAULT CHARACTER SET ' . $db_charset . ' COLLATE ' . $db_collation;
$sql_query .= ' DEFAULT CHARACTER SET ' . $db_charset . ($db_charset == $db_collation ? '' : ' COLLATE ' . $db_collation);
}
unset($db_charset, $db_collation);
}

View File

@@ -36,10 +36,12 @@ if (!isset($is_db) || !$is_db) {
/**
* Changes database charset if requested by the user
*/
if (isset($submitcharset) && PMA_MYSQL_INT_VERSION >= 40101) {
$sql_query = 'ALTER DATABASE ' . PMA_backquote($db) . ' DEFAULT CHARACTER SET ' . $db_charset;
$result = PMA_DBI_query($sql_query);
$message = $strSuccess;
if (isset($submitcollation) && !empty($db_collation) && PMA_MYSQL_INT_VERSION >= 40101) {
list($db_charset) = explode('_', $db_collation);
$sql_query = 'ALTER DATABASE ' . PMA_backquote($db) . ' DEFAULT CHARACTER SET ' . $db_charset . ($db_charset == $db_collation ? '' : ' COLLATE ' . $db_collation);
$result = PMA_DBI_query($sql_query);
$message = $strSuccess;
unset($db_charset, $db_collation);
}
// Displays headers

View File

@@ -105,7 +105,7 @@ if (empty($is_info)) {
}
}
if (PMA_MYSQL_INT_VERSION >= 40100) {
if (PMA_MYSQL_INT_VERSION >= 40101) {
$db_collation = PMA_getDbCollation($db);
}
@@ -705,15 +705,9 @@ if (PMA_MYSQL_INT_VERSION >= 40101) {
. ' <li>' . "\n"
. ' <form method="post" action="./db_details_structure.php">' . "\n"
. PMA_generate_common_hidden_inputs($db, $table, 3)
. ' ' . $strCharset . '&nbsp;:&nbsp;' . "\n"
. ' <select name="db_charset" style="vertical-align: middle">' . "\n";
$real_charset = strpos($db_collation, '_') ? substr($db_collation, 0, strpos($db_collation, '_')) : $db_collation;
for ($i = 1; isset($mysql_charsets[$i]); $i++) {
echo ' <option value="' . $mysql_charsets[$i] . '"' . ($mysql_charsets[$i] == $real_charset ? ' selected="selected"' : '') . '>' . $mysql_charsets[$i] . '</option>' . "\n";
}
unset($i, $real_charset);
echo ' </select>&nbsp;' . "\n"
. ' <input type="submit" name="submitcharset" value="' . $strGo . '" style="vertical-align: middle" />&nbsp;' . "\n"
. ' <label for="select_db_collation">' . $strCollation . '</label>&nbsp;:&nbsp;' . "\n";
PMA_printCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'db_collation', 'select_db_collation', $db_collation, FALSE, 3);
echo ' <input type="submit" name="submitcollation" value="' . $strGo . '" style="vertical-align: middle" />&nbsp;' . "\n"
. ' </form>' . "\n"
. ' </li>' . "\n\n";
}

View File

@@ -305,7 +305,7 @@ if ($server > 0) {
. ' <input type="text" name="db" value="' . $db_to_create . '" maxlength="64" class="textfield" />' . "\n";
if (PMA_MYSQL_INT_VERSION >= 40101) {
require_once('./libraries/mysql_charsets.lib.php');
PMA_printCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'db_collation', NULL, TRUE, 5);
PMA_printCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'db_collation', NULL, NULL, TRUE, 5);
}
echo ' <input type="submit" value="' . $strCreate . '" />' . "\n"
. ' </form>' . "\n"