Cleaner solution for showing query after changing index
This commit is contained in:
@@ -5,6 +5,10 @@ phpMyAdmin - Changelog
|
|||||||
$Id$
|
$Id$
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
|
2003-03-01 Michal Cihar <nijel@users.sourceforge.net>
|
||||||
|
* tbl_indexes.php3: Cleaner solution for showing query after changing
|
||||||
|
index.
|
||||||
|
|
||||||
2003-03-01 Robin Johnson <robbat2@users.sourceforge.net>
|
2003-03-01 Robin Johnson <robbat2@users.sourceforge.net>
|
||||||
* libraries/xpath/XPath.class.php, libraries/xpath/:
|
* libraries/xpath/XPath.class.php, libraries/xpath/:
|
||||||
- Removed (was part of the early DB config prototype)
|
- Removed (was part of the early DB config prototype)
|
||||||
|
@@ -181,32 +181,31 @@ if (!defined('PMA_IDX_INCLUDED')
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// $sql_query is the one displayed in the query box, don't use it when you
|
// $sql_query is the one displayed in the query box
|
||||||
// need to generate a query in this script
|
$sql_query = 'ALTER TABLE ' . PMA_backquote($table);
|
||||||
$local_query = 'ALTER TABLE ' . PMA_backquote($table);
|
|
||||||
|
|
||||||
// Drops the old index
|
// Drops the old index
|
||||||
if (!empty($old_index)) {
|
if (!empty($old_index)) {
|
||||||
if ($old_index == 'PRIMARY') {
|
if ($old_index == 'PRIMARY') {
|
||||||
$local_query .= ' DROP PRIMARY KEY,';
|
$sql_query .= ' DROP PRIMARY KEY,';
|
||||||
} else {
|
} else {
|
||||||
$local_query .= ' DROP INDEX ' . PMA_backquote($old_index) .',';
|
$sql_query .= ' DROP INDEX ' . PMA_backquote($old_index) .',';
|
||||||
}
|
}
|
||||||
} // end if
|
} // end if
|
||||||
|
|
||||||
// Builds the new one
|
// Builds the new one
|
||||||
switch ($index_type) {
|
switch ($index_type) {
|
||||||
case 'PRIMARY':
|
case 'PRIMARY':
|
||||||
$local_query .= ' ADD PRIMARY KEY (';
|
$sql_query .= ' ADD PRIMARY KEY (';
|
||||||
break;
|
break;
|
||||||
case 'FULLTEXT':
|
case 'FULLTEXT':
|
||||||
$local_query .= ' ADD FULLTEXT ' . (empty($index) ? '' : PMA_backquote($index)) . ' (';
|
$sql_query .= ' ADD FULLTEXT ' . (empty($index) ? '' : PMA_backquote($index)) . ' (';
|
||||||
break;
|
break;
|
||||||
case 'UNIQUE':
|
case 'UNIQUE':
|
||||||
$local_query .= ' ADD UNIQUE ' . (empty($index) ? '' : PMA_backquote($index)) . ' (';
|
$sql_query .= ' ADD UNIQUE ' . (empty($index) ? '' : PMA_backquote($index)) . ' (';
|
||||||
break;
|
break;
|
||||||
case 'INDEX':
|
case 'INDEX':
|
||||||
$local_query .= ' ADD INDEX ' . (empty($index) ? '' : PMA_backquote($index)) . ' (';
|
$sql_query .= ' ADD INDEX ' . (empty($index) ? '' : PMA_backquote($index)) . ' (';
|
||||||
break;
|
break;
|
||||||
} // end switch
|
} // end switch
|
||||||
$index_fields = '';
|
$index_fields = '';
|
||||||
@@ -220,13 +219,11 @@ if (!defined('PMA_IDX_INCLUDED')
|
|||||||
if (empty($index_fields)){
|
if (empty($index_fields)){
|
||||||
PMA_mysqlDie($strNoIndexPartsDefined, '', FALSE, $err_url);
|
PMA_mysqlDie($strNoIndexPartsDefined, '', FALSE, $err_url);
|
||||||
} else {
|
} else {
|
||||||
$local_query .= $index_fields . ')';
|
$sql_query .= $index_fields . ')';
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, FALSE, $err_url);
|
$result = PMA_mysql_query($sql_query) or PMA_mysqlDie('', $sql_query, FALSE, $err_url);
|
||||||
$message = $strTable . ' ' . htmlspecialchars($table) . ' ' . $strHasBeenAltered;
|
$message = $strTable . ' ' . htmlspecialchars($table) . ' ' . $strHasBeenAltered;
|
||||||
// To show the query:
|
|
||||||
$sql_query = $local_query;
|
|
||||||
|
|
||||||
include('./tbl_properties_structure.php3');
|
include('./tbl_properties_structure.php3');
|
||||||
exit();
|
exit();
|
||||||
|
Reference in New Issue
Block a user