[Phpmyadmin-devel] Zoom Search

Marc Delisle marc at infomarc.info
Sun May 29 13:01:49 CEST 2011


Le 2011-05-29 03:11, Ammar Yasir a écrit :
>> Ammar,
>> it's OK to have two components but please refactor common code into
>> functions and put them in a new libraries/tbl_select.lib.php that will
>> be called from both components; otherwise it will be difficult to maintain.
>>
>> An example of needed refactoring: the "Gets the list and number of
>> fields" section.
>>
>> I did refactoring in two areas:
> 1) As you proposed, Getting the list and number of fields.
> 2) The where clause generation in the query-building part.
> 
> Should we also do for the HTML part? Some part of that (for example the
> foreign keys display part) is common but also has HTML content embedded.
> Apart from that since the zoom-search form takes the field as input so rest
> of the form is based on that constraint. So I was thinking that the HTML
> part can stay as it is.
> 
Ammar,

The foreign keys display part is a good example of needed refactoring.

I don't know how much HTML refactoring you are willing to do, but some
HTML is easy to refactor, for example:
- the section that sets $titles['Browse']
- the beginning of the table with headers Column, Type, etc

In libraries/tbl_select.lib.php, please describe for each function the
parameters and return values; see an example in
libraries/server_synchronize.lib.php.

About the syntax, please use spaces around operators. Instead of
$i-1
use
$i - 1

There is a case of undefined variable. To reproduce, on sakila.actor,
Search, Table search, last name Wilson, Go:

Notice in ./libraries/tbl_select.lib.php#129
Undefined variable: w

Backtrace

./tbl_select.php#329: PMA_tbl_search_getWhereClause(
string ,
string last_update,
string timestamp,
string ,
string =,
boolean ,
)

-- 
Marc Delisle
http://infomarc.info




More information about the Developers mailing list