[Phpmyadmin-devel] Rebuilding the sql from the scratch
pe.chanaka.ck at gmail.com
Mon Oct 29 03:54:24 CET 2012
> > I'm working on bug .
> > Relevant modifications to the sql query is done inside tbl_export.php,
> > according to the selected results from the table browse window which is
> > going to export. When modifying the query, it actually rebuild from the
> > scratch.
> > As I understand there are 2 requirements for modify the query.
> > 1. Remove the LIMIT clause (for append any where clause)
> > 2. Add needed filtering clause (additional where clause)
> > To do the above things is it really need to rebuild the query from the
> > scratch ?
> > I don't think that there are scenarios which need to modify the beginning
> > part of he query (before where clause). So is it okay to modify the query
> > only from the where clause. Though the current analyzer doesn't support
> > the multiple select statements, hopefully this will fix the bug I
> > Any thoughts on this ?
> I believe this is going to be tricky to solve, because there could be
> many WHERE clauses (in the main SELECT and in the subselect).
I mean for any case even it has multiple where clauses, the select part
will not be changed. Rebuilding this first part messing up the query if
there are sub queries. In following query unchanged first part is in bold.
*SELECT `id`, `name` FROM `customers`* WHERE id NOT IN ( SELECT id FROM
companies WHERE name LIKE '%u%')
Apart from that, SQL with several where clauses, can be represented as a
one SQL query (without any sub queries and with only one where clause).
Currently that's reached by using the primary key values of the resulted
table rows which are going to export.
But when building new where clause, other than only combining those primary
key values with 'OR' clause, at the end another clause is appended which is
from analyzed sql . That where clause is the last where clause of the
original SQL query. I don't see any use of this since we already can
identify the rows by primary key.
Your thoughts on this will be very helpful to go forward correctly.
*Virtusa (Pvt) Ltd. | **Sri Lanka*
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Developers