MySQL 4.1.1 compatibility, part II: Ability to specify a default character set for a new database.
This commit is contained in:
@@ -17,10 +17,12 @@ $Source$
|
||||
2003-12-11 Alexander M. Turek <bleibtallesanders@derrabus.de>
|
||||
* server_collations.php, lang/*.inc.php, libraries/mysql_charsets.lib.php:
|
||||
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>
|
||||
* 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.
|
||||
* db_details.php: Removed unneccessary whitespace
|
||||
* sql.php: Bug #857742: When dropping the only remaining database, an
|
||||
|
@@ -10,6 +10,7 @@ require_once('./libraries/grab_globals.lib.php');
|
||||
$js_to_run = 'functions.js';
|
||||
require_once('./header.inc.php');
|
||||
require_once('./libraries/common.lib.php');
|
||||
require_once('./libraries/mysql_charsets.lib.php');
|
||||
|
||||
|
||||
PMA_checkParameters(array('db'));
|
||||
@@ -20,10 +21,15 @@ PMA_checkParameters(array('db'));
|
||||
$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);
|
||||
$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);
|
||||
|
||||
|
||||
/**
|
||||
|
41
main.php
41
main.php
@@ -292,22 +292,31 @@ if ($server > 0) {
|
||||
<?php
|
||||
// The user is allowed to create a db
|
||||
if ($is_create_priv) {
|
||||
echo "\n";
|
||||
?>
|
||||
<!-- db creation form -->
|
||||
<tr>
|
||||
<td valign="baseline"><img src="<?php echo $item_img; ?>" width="7" height="7" alt="item" /></td>
|
||||
<td>
|
||||
<form method="post" action="db_create.php">
|
||||
<?php echo $strCreateNewDatabase . ' ' . PMA_showMySQLDocu('Reference', 'CREATE_DATABASE'); ?><br />
|
||||
<?php echo PMA_generate_common_hidden_inputs(); ?>
|
||||
<input type="hidden" name="reload" value="1" />
|
||||
<input type="text" name="db" value="<?php echo $db_to_create; ?>" maxlength="64" class="textfield" />
|
||||
<input type="submit" value="<?php echo $strCreate; ?>" />
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
echo "\n"
|
||||
. ' <!-- db creation form -->' . "\n"
|
||||
. ' <tr>' . "\n"
|
||||
. ' <td valign="baseline"><img src="' . $item_img . '" width="7" height="7" alt="item" /></td>' . "\n"
|
||||
. ' <td>' . "\n"
|
||||
. ' <form method="post" action="db_create.php">' . "\n"
|
||||
. ' ' . $strCreateNewDatabase . ' ' . PMA_showMySQLDocu('Reference', 'CREATE_DATABASE') . "\n"
|
||||
. '<br />' . "\n"
|
||||
. PMA_generate_common_hidden_inputs(5)
|
||||
. ' <input type="hidden" name="reload" value="1" />' . "\n"
|
||||
. ' <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');
|
||||
echo ' <select name="db_charset">' . "\n"
|
||||
. ' <option value="">' . $strCharset . '</option>' . "\n"
|
||||
. ' <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 {
|
||||
echo "\n";
|
||||
?>
|
||||
|
Reference in New Issue
Block a user