Skip to content

Commit

Permalink
Merge branch 'QA_4_0'
Browse files Browse the repository at this point in the history
  • Loading branch information
madhuracj committed Sep 25, 2013
2 parents 381b4b5 + 352c60d commit 511a005
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ phpMyAdmin - ChangeLog
- bug #4098 Default table tab is ignored
- bug #4099 Server/library difference warning: setting is ignored
- bug #4100 table tree group strategy
- bug #4102 ALTER TABLE ORDER BY and InnoDB

4.0.7.0 (2013-09-23)
- bug #3993 Sorting in database overview with statistics doesn't work
Expand Down
25 changes: 24 additions & 1 deletion tbl_operations.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,30 @@
/**
* Order the table
*/
$response->addHTML(PMA_getHtmlForOrderTheTable($columns));
require_once 'libraries/Index.class.php';
$indexes = PMA_Index::getFromTable($GLOBALS['table'], $GLOBALS['db']);
$hasNotNullUniqueIdx = false;
foreach ($indexes as $name => $idx) {
if ($name == 'PRIMARY') {
$hasNotNullUniqueIdx = true;
} elseif (! $idx->getNonUnique()) {
$hasNotNullUniqueIdx = true;
foreach ($idx->getColumns() as $column) {
if ($column->getNull()) {
$hasNotNullUniqueIdx = false;
}
}
}
if ($hasNotNullUniqueIdx) {
break;
}
}
// `ALTER TABLE ORDER BY` does not make sense for InnoDB tables that contain
// a user-defined clustered index (PRIMARY KEY or NOT NULL UNIQUE index).
// InnoDB always orders table rows according to such an index if one is present.
if (! ($tbl_storage_engine == 'INNODB' && $hasNotNullUniqueIdx)) {
$response->addHTML(PMA_getHtmlForOrderTheTable($columns));
}

/**
* Move table
Expand Down

0 comments on commit 511a005

Please sign in to comment.