block table rename if newname empty

This commit is contained in:
Steve Alberty
2001-07-17 09:59:25 +00:00
parent 1fee1b72dc
commit eece3b3462
3 changed files with 37 additions and 24 deletions

View File

@@ -5,6 +5,9 @@ phpMyAdmin - Changelog
$Id$
$Source$
2001-07-17 Steve Alberty <alberty@neptunlabs.de>
* tbl_addfield.php3: add trouble detection if insert field failed
* tbl_rename.php3,tbl_copy.php3: block table rename if newname empty
2001-07-16 Marc Delisle <lem9@users.sourceforge.net>
* tbl_change.php3, bug 441689, "Insert as new row" was not copying blobs.

View File

@@ -16,29 +16,30 @@ function my_handler($sql_insert)
$sql_query = $sql_insert;
}
$sql_structure = get_table_def($db, $table, "\n");
// speedup copy table - staybyte - 22. Juni 2001
if(MYSQL_MAJOR_VERSION >= "3.23"){
if (isset($new_name)) $new_name=trim($new_name); // Cleanup to suppress '' tables
if (isset($new_name) && $new_name!=""){
$sql_structure = get_table_def($db, $table, "\n");
// speedup copy table - staybyte - 22. Juni 2001
if(MYSQL_MAJOR_VERSION >= "3.23"){
$sql_structure = ereg_replace("CREATE TABLE `$table`", "CREATE TABLE `$new_name`", $sql_structure);
$result = mysql_query($sql_structure) or mysql_die();
if($what == "data"){
$query="INSERT INTO $new_name SELECT * FROM $table";
$result = mysql_query($query) or mysql_die();
}
}
else{
}
else{
$sql_structure = ereg_replace("CREATE TABLE $table", "CREATE TABLE $new_name", $sql_structure);
$result = mysql_query($sql_structure) or mysql_die();
}
}
else mysql_die($strTableEmpty);
if (isset($sql_query))
$sql_query .= "\n$sql_structure";
else
$sql_query = "$sql_structure";
//$sql_query .= "\n$sql_structure";
if(MYSQL_MAJOR_VERSION < "3.23" && $what == "data") get_table_content($db, $table, "my_handler");
eval("\$message = \"$strCopyTableOK\";");

View File

@@ -4,15 +4,24 @@
require("./grab_globals.inc.php3");
if (isset($new_name)) $new_name=trim($new_name); // Cleanup to suppress '' tables
if (isset($new_name) && $new_name!=""){
$old_name = $table;
$table = $new_name;
require("./header.inc.php3");
$old_name = $table;
$table = $new_name;
include("./header.inc.php3");
mysql_select_db($db);
$result = mysql_query("ALTER TABLE $old_name RENAME $new_name") or mysql_die();
$table = $old_name;
eval("\$message = \"$strRenameTableOK\";");
$table = $new_name;
}
else{
include("./header.inc.php3");
mysql_die($strTableEmpty);
}
mysql_select_db($db);
$result = mysql_query("ALTER TABLE $old_name RENAME $new_name") or mysql_die();
$table = $old_name;
eval("\$message = \"$strRenameTableOK\";");
$table = $new_name;
require("./tbl_properties.php3");
?>