RFE #571838 : Add 'DROP TABLE IF EXISTS' checkbox.
This commit is contained in:
@@ -6,6 +6,9 @@ $Id$
|
||||
$Source$
|
||||
|
||||
2003-03-12 Garvin Hicking <me@supergarv.de>
|
||||
* tbl_move_copy.php3, tbl_properties_operations.php3: RFE #571838 :
|
||||
Add 'DROP TABLE IF EXISTS' checkbox. Will maintain any existing PMA_* entries
|
||||
for that table.
|
||||
* tbl_properties_export.php3, db_details_export.php3,
|
||||
libraries/display_export.lib.php3: Reworked DB/Table export, so that DB
|
||||
export now is a perfect look-alike except for a multi-tables dropdown.
|
||||
|
@@ -146,6 +146,27 @@ if (isset($new_name) && trim($new_name) != '') {
|
||||
|
||||
// do not create the table if dataonly
|
||||
if ($what != 'dataonly') {
|
||||
// If table exists, and 'add drop table' is selected: Drop it!
|
||||
$drop_query = '';
|
||||
if (isset($drop_if_exists) && $drop_if_exists == 'true') {
|
||||
$drop_query = 'DROP TABLE IF EXISTS ' . PMA_backquote($target_db) . '.' . PMA_backquote($new_name);
|
||||
$result = @PMA_mysql_query($drop_query);
|
||||
if (PMA_mysql_error()) {
|
||||
include('./header.inc.php3');
|
||||
PMA_mysqlDie('', $sql_structure, '', $err_url);
|
||||
}
|
||||
|
||||
if (isset($sql_query)) {
|
||||
$sql_query .= "\n" . $drop_query . ';';
|
||||
} else {
|
||||
$sql_query = $drop_query . ';';
|
||||
}
|
||||
|
||||
// garvin: If an existing table gets deleted, maintain any entries
|
||||
// for the PMA_* tables
|
||||
$maintain_relations = true;
|
||||
}
|
||||
|
||||
$result = @PMA_mysql_query($sql_structure);
|
||||
if (PMA_mysql_error()) {
|
||||
include('./header.inc.php3');
|
||||
@@ -280,7 +301,7 @@ if (isset($new_name) && trim($new_name) != '') {
|
||||
$table = $new_name;
|
||||
} else {
|
||||
// garvin: Create new entries as duplicates from old PMA DBs
|
||||
if ($what != 'dataonly') {
|
||||
if ($what != 'dataonly' && !isset($maintain_relations)) {
|
||||
if ($cfgRelation['commwork']) {
|
||||
// Get all comments and MIME-Types for current table
|
||||
$comments_copy_query = 'SELECT
|
||||
|
@@ -174,7 +174,9 @@ for ($i = 0; $i < $num_dbs; $i++) {
|
||||
<input type="radio" name="what" value="data" id="radio_copy_data" />
|
||||
<label for="radio_copy_data"><?php echo $strStrucData; ?></label> <br />
|
||||
<input type="radio" name="what" value="dataonly" id="radio_copy_data" />
|
||||
<label for="radio_copy_data"><?php echo $strDataOnly; ?></label>
|
||||
<label for="radio_copy_data"><?php echo $strDataOnly; ?></label> <br />
|
||||
<input type="checkbox" name="drop_if_exists" value="true" id="checkbox_drop" />
|
||||
<label for="checkbox_drop"><?php echo $strStrucDrop; ?></label>
|
||||
</td>
|
||||
<td align="<?php echo $cell_align_right; ?>" valign="top">
|
||||
<input type="submit" name="submit_copy" value="<?php echo $strGo; ?>" />
|
||||
|
Reference in New Issue
Block a user