Menu

#430 (ok 3.2) Sortable Database Columns

closed-accepted
1
2009-06-15
2008-11-28
No

I've written some code to sort the columns when viewing a database. This is handy for sorting by the number of rows, table size, overhead, etc.

One caveat is that it only sorts the current page. If there are multiple pages of tables then each page will sort independently. This is because I put the main sort logic in "libraries/db_info.inc.php". By the time I start sorting the data has already been retrieved. This is a slight drawback, but makes sorting MUCH easier.

Thanks!

Discussion

  • Olaf van der Spek

    > This is a slight drawback,

    It's not acceptable in my opinion.

     
  • Bryce Thornton

    Bryce Thornton - 2008-11-29

    This patch sorts and persists sort values when moving from page to page.

     
  • Bryce Thornton

    Bryce Thornton - 2008-11-30

    I'm working on making this work correctly. It is taking longer than expected, but I will post another patch when I am done. Thanks.

     
  • Bryce Thornton

    Bryce Thornton - 2008-11-30

    New patch that works from page to page and respects the 'NaturalOrder' cfg variable.

     
  • Bryce Thornton

    Bryce Thornton - 2008-11-30

    I've uploaded a new version of this patch that works from page to page. It respects the 'NaturalOrder' cfg variable and works properly when using the Information Schema as well as when using "SHOW TABLE STATUS".

    One situation that needs to be tested is when using the 'SkipLockedTables' cfg variable. If this needs to be incorporated into this patch, then we should probably just break out the "SHOW TABLE STATUS" sorting code into a function and call it from the 'SkipLockedTables' section as well.

    Please give me some feedback if you get a chance.

     
  • Marc Delisle

    Marc Delisle - 2008-12-04
    • assigned_to: nobody --> lem9
     
  • Marc Delisle

    Marc Delisle - 2008-12-04

    Bryce,
    I like the feature, thanks. Two questions:
    1. Clicking on "Type" is supposed to do something?

    2. I had a quick look at the code and I am very allergic to using eval() when a part of what is evaluated comes from a request. Please find another non-eval() way, or add bulletproof protection against PHP-code injection via sort_order.

     
  • Bryce Thornton

    Bryce Thornton - 2008-12-04

    Clicking on "Type" will sort by table type. I realize most people use the same table type for all their tables, so it might not be the most useful column to sort. Let me know if you would like it removed.

    I agree with the "eval" comment. It felt dirty when I wrote it. I'll figure out a safer way and post a new patch.

    Thanks for the feedback.

     
  • Marc Delisle

    Marc Delisle - 2008-12-04

    Well, I have InnoDB and MyISAM and nothing changes when I click "Type".

     
  • Bryce Thornton

    Bryce Thornton - 2008-12-09

    New patch that removes the "eval" call.

     
  • Bryce Thornton

    Bryce Thornton - 2008-12-09

    I have uploaded another patch that removed the "eval" call.

    I have not been able to reproduce your issue with the "Type" column. It has worked fine for me throughout. I'm not sure why it would be any different than any other sortable column. Are the "sort" & "sort_order" GET params correct when you click on that column?

     
  • Marc Delisle

    Marc Delisle - 2008-12-12

    Bryce,
    issue with the "Type" column happens with
    $cfg['Servers'][$i]['DisableIS'] = true;

    which is the default valuer.

     
  • Bryce Thornton

    Bryce Thornton - 2008-12-15

    Fix for the "Type" column bug.

     
  • Bryce Thornton

    Bryce Thornton - 2008-12-15

    I have fixed the "Type" column bug. I was using the word "Type" when sorting without Information Schema. It should have been "Engine". This exists with and without Information Schema.

    Thanks for the feedback.

     
  • Marc Delisle

    Marc Delisle - 2008-12-15
    • priority: 5 --> 1
    • summary: Sortable Database Columns --> (ok 3.2) Sortable Database Columns
    • status: open --> open-accepted
     
  • Marc Delisle

    Marc Delisle - 2008-12-15

    Merged, thanks for the good job.

     
  • Bryce Thornton

    Bryce Thornton - 2008-12-16

    Fixing some notices.

     
  • Bryce Thornton

    Bryce Thornton - 2008-12-16

    I took a look at the phpmyadmin demo site and saw a few notices being displayed related to this patch. I have attached a new patch that simply fixes these notices.

     
  • Marc Delisle

    Marc Delisle - 2008-12-16

    Part 5 merged.

     
  • Marc Delisle

    Marc Delisle - 2009-06-15
    • status: open-accepted --> closed-accepted