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!
> This is a slight drawback,
It's not acceptable in my opinion.
This patch sorts and persists sort values when moving from page to page.
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.
New patch that works from page to page and respects the 'NaturalOrder' cfg variable.
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.
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.
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.
Well, I have InnoDB and MyISAM and nothing changes when I click "Type".
New patch that removes the "eval" call.
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?
Bryce,
issue with the "Type" column happens with
$cfg['Servers'][$i]['DisableIS'] = true;
which is the default valuer.
Fix for the "Type" column bug.
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.
Merged, thanks for the good job.
Fixing some notices.
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.
Part 5 merged.