[Phpmyadmin-devel] Column reordering

Aris Feryanto aris_feryanto at yahoo.com
Tue Jun 14 05:36:49 CEST 2011



----- Original Message -----
> From: Marc Delisle <marc at infomarc.info>
> 
> Marc Delisle a écrit :
>>  Aris Feryanto a écrit :
>> 
>>>  Hi,
>>> 
>>>  Just realized my previous email seem not delivered successfully to
>>>  phpMyAdmin-devel list. I've previously sent an email telling that I
>>>  will work on merging the tooltip as suggested by Rouslan. I'm still
>>>  working and testing on this and will add the 'Click to mark'.
>>> 
>>>  I am also fixing the previous code, as it hasn't checked whether we
>>>  are under Browse tab, before calling the column-order remembering
>>>  function.
>>> 
>>>  I wonder if there is any existing exact way to check if we are under
>>>  Browse tab? Current code do the checking using requested url pattern
>>>  and analyzed SQL query (you may see function PMA_isBrowsing in file
>>>  libraries/display_tbl.lib.php in my git repo). But, this is not
>>>  enough for handling load from AJAX request under other tabs (e.g.
>>>  AJAX request to sql.php caused by pagination of results under SQL
>>>  tab)
>> 
>>  Yes, this is difficult to solve with current code; maybe it's time for 
> a
>>  new tbl_browse.php that could set some constant, then require sql.php.
>>  Further down the code, either the constant is checked directly or is
>>  used to generate a hidden span with some id that can be checked at the
>>  js level.
>> 
>> 
> 
> By the way, I'm not sure why you strictly want to do some verifications
> while under the Browse tab. Some actions, for example Search, will
> generate results in which in a user might want to reorder the columns.


Hi Marc,

You are right. User may want to reorder columns in Search tab.

I found a way to make PMA_isBrowsing() better, IMO. I add some rule so that it will return true on any SQL expression in the form of "SELECT * FROM <a table> WHERE ...". Not depending on whether we are under "Browse" tab anymore. I've updated this in my git. The complete function:

===========================
function PMA_isBrowsing()
{
    // global variables set from sql.php
    global $is_count, $is_export, $is_func, $is_analyse;
    global $analyzed_sql;

    return ! ($is_count || $is_export || $is_func || $is_analyse)
        && count($analyzed_sql[0]['select_expr']) == 0
        && isset($analyzed_sql[0]['queryflags']['select_from'])
        && count($analyzed_sql[0]['table_ref']) == 1;
}
===========================

I've do some test and it is working good so far. Please kindly check this and let me know what do you think about this.

I also found that column reordering and resizing still not work under db_search.php. I'm working to fix this.


--
Aris Feryanto




More information about the Developers mailing list