alter db collations
This commit is contained in:
@@ -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
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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
|
||||
|
@@ -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 . ' : ' . "\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> ' . "\n"
|
||||
. ' <input type="submit" name="submitcharset" value="' . $strGo . '" style="vertical-align: middle" /> ' . "\n"
|
||||
. ' <label for="select_db_collation">' . $strCollation . '</label> : ' . "\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" /> ' . "\n"
|
||||
. ' </form>' . "\n"
|
||||
. ' </li>' . "\n\n";
|
||||
}
|
||||
|
2
main.php
2
main.php
@@ -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"
|
||||
|
Reference in New Issue
Block a user