~ubuntu-branches/ubuntu/trusty/phpmyadmin/trusty

« back to all changes in this revision

Viewing changes to tbl_operations.php

  • Committer: Package Import Robot
  • Author(s): Thijs Kinkhorst
  • Date: 2013-10-07 20:18:01 UTC
  • mfrom: (1.2.46)
  • Revision ID: package-import@ubuntu.com-20131007201801-l5l0ril5992p8sxz
Tags: 4:4.0.8-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
233
233
/**
234
234
 * Order the table
235
235
 */
236
 
$response->addHTML(PMA_getHtmlForOrderTheTable($columns));
 
236
$hideOrderTable = false;
 
237
// `ALTER TABLE ORDER BY` does not make sense for InnoDB tables that contain
 
238
// a user-defined clustered index (PRIMARY KEY or NOT NULL UNIQUE index).
 
239
// InnoDB always orders table rows according to such an index if one is present.
 
240
if ($tbl_storage_engine == 'INNODB') {
 
241
    include_once 'libraries/Index.class.php';
 
242
    $indexes = PMA_Index::getFromTable($GLOBALS['table'], $GLOBALS['db']);
 
243
    foreach ($indexes as $name => $idx) {
 
244
        if ($name == 'PRIMARY') {
 
245
            $hideOrderTable = true;
 
246
            break;
 
247
        } elseif (! $idx->getNonUnique()) {
 
248
            $notNull = true;
 
249
            foreach ($idx->getColumns() as $column) {
 
250
                if ($column->getNull()) {
 
251
                    $notNull = false;
 
252
                    break;
 
253
                }
 
254
            }
 
255
            if ($notNull) {
 
256
                $hideOrderTable = true;
 
257
                break;
 
258
            }
 
259
        }
 
260
    }
 
261
}
 
262
if (! $hideOrderTable) {
 
263
    $response->addHTML(PMA_getHtmlForOrderTheTable($columns));
 
264
}
237
265
 
238
266
/**
239
267
 * Move table