MySQL 4.1.1 compatibility, part II: Ability to specify a default character set for a new database.

This commit is contained in:
Alexander M. Turek
2003-12-11 23:16:22 +00:00
parent 08071c869a
commit df3982dd8b
3 changed files with 36 additions and 19 deletions

View File

@@ -17,10 +17,12 @@ $Source$
2003-12-11 Alexander M. Turek <bleibtallesanders@derrabus.de> 2003-12-11 Alexander M. Turek <bleibtallesanders@derrabus.de>
* server_collations.php, lang/*.inc.php, libraries/mysql_charsets.lib.php: * server_collations.php, lang/*.inc.php, libraries/mysql_charsets.lib.php:
Updated character sets overview for MySQL 4.1.1. Updated character sets overview for MySQL 4.1.1.
* db_create.php, main.php: Ability to specify a default character set for a
new database.
2003-12-11 Garvin Hicking <me@supergarv.de> 2003-12-11 Garvin Hicking <me@supergarv.de>
* header_printview.inc.php: RFE #856503, show number of rows in printview * header_printview.inc.php: RFE #856503, show number of rows in printview
* tbl_change.php, tbl_replace.php, tbl_replace_fields.php: Fixed #857445, * tbl_change.php, tbl_replace.php, tbl_replace_fields.php: Fixed #857445,
#857684 where non-existant fields caused PHP notices. #857684 where non-existant fields caused PHP notices.
* db_details.php: Removed unneccessary whitespace * db_details.php: Removed unneccessary whitespace
* sql.php: Bug #857742: When dropping the only remaining database, an * sql.php: Bug #857742: When dropping the only remaining database, an

View File

@@ -10,6 +10,7 @@ require_once('./libraries/grab_globals.lib.php');
$js_to_run = 'functions.js'; $js_to_run = 'functions.js';
require_once('./header.inc.php'); require_once('./header.inc.php');
require_once('./libraries/common.lib.php'); require_once('./libraries/common.lib.php');
require_once('./libraries/mysql_charsets.lib.php');
PMA_checkParameters(array('db')); PMA_checkParameters(array('db'));
@@ -20,10 +21,15 @@ PMA_checkParameters(array('db'));
$err_url = 'main.php?' . PMA_generate_common_url(); $err_url = 'main.php?' . PMA_generate_common_url();
/** /**
* Executes the db creation sql query * Builds and executes the db creation sql query
*/ */
$sql_query = 'CREATE DATABASE ' . PMA_backquote($db); $sql_query = 'CREATE DATABASE ' . PMA_backquote($db);
$result = PMA_mysql_query('CREATE DATABASE ' . PMA_backquote($db)) or PMA_mysqlDie('', $sql_query, FALSE, $err_url); if (isset($db_charset) && isset($mysql_charsets) && in_array($db_charset, $mysql_charsets)) {
$sql_query .= ' DEFAULT CHARACTER SET ' . $db_charset;
}
$sql_query .= ';';
$result = PMA_mysql_query($sql_query) or PMA_mysqlDie('', $sql_query, FALSE, $err_url);
/** /**

View File

@@ -292,22 +292,31 @@ if ($server > 0) {
<?php <?php
// The user is allowed to create a db // The user is allowed to create a db
if ($is_create_priv) { if ($is_create_priv) {
echo "\n"; echo "\n"
?> . ' <!-- db creation form -->' . "\n"
<!-- db creation form --> . ' <tr>' . "\n"
<tr> . ' <td valign="baseline"><img src="' . $item_img . '" width="7" height="7" alt="item" /></td>' . "\n"
<td valign="baseline"><img src="<?php echo $item_img; ?>" width="7" height="7" alt="item" /></td> . ' <td>' . "\n"
<td> . ' <form method="post" action="db_create.php">' . "\n"
<form method="post" action="db_create.php"> . ' ' . $strCreateNewDatabase . '&nbsp;' . PMA_showMySQLDocu('Reference', 'CREATE_DATABASE') . "\n"
<?php echo $strCreateNewDatabase . '&nbsp;' . PMA_showMySQLDocu('Reference', 'CREATE_DATABASE'); ?><br /> . '<br />' . "\n"
<?php echo PMA_generate_common_hidden_inputs(); ?> . PMA_generate_common_hidden_inputs(5)
<input type="hidden" name="reload" value="1" /> . ' <input type="hidden" name="reload" value="1" />' . "\n"
<input type="text" name="db" value="<?php echo $db_to_create; ?>" maxlength="64" class="textfield" /> . ' <input type="text" name="db" value="' . $db_to_create . '" maxlength="64" class="textfield" />' . "\n";
<input type="submit" value="<?php echo $strCreate; ?>" /> if (PMA_MYSQL_INT_VERSION >= 40101) {
</form> require_once('./libraries/mysql_charsets.lib.php');
</td> echo ' <select name="db_charset">' . "\n"
</tr> . ' <option value="">' . $strCharset . '</option>' . "\n"
<?php . ' <option value=""></option>' . "\n";
for ($i = 0; isset($mysql_charsets[$i]); $i++) {
echo ' <option value="' . htmlspecialchars($mysql_charsets[$i]) . '">' . htmlspecialchars($mysql_charsets[$i]) . '</option>' . "\n";
}
echo ' </select>' . "\n";
}
echo ' <input type="submit" value="' . $strCreate . '" />' . "\n"
. ' </form>' . "\n"
. ' </td>' . "\n"
. ' </tr>' . "\n";
} else { } else {
echo "\n"; echo "\n";
?> ?>