]> git.koha-community.org Git - koha.git/commit
Bug 8594 - prevent the report system from breaking some subqueries
authorRobin Sheat <robin@catalyst.net.nz>
Wed, 8 Aug 2012 16:02:13 +0000 (18:02 +0200)
committerChris Cormack <chrisc@catalyst.net.nz>
Wed, 5 Sep 2012 23:05:15 +0000 (11:05 +1200)
commit5a34c64b9374a8c3de2658d588e63ed0d828cc6d
treece39fc44a2b3d135d1cbad300649d114757c1f51
parent2ab3176015cf3d41aace877885090444e502b2b0
Bug 8594 - prevent the report system from breaking some subqueries

If you had a report query that had a subquery in the fields list, and
that subquery had a LIMIT specifier, then it would be removed which
could break your query. This patch prevents this case from breaking by
ensuring that only a LIMIT that follows the last WHERE in the query is
removed.

If you don't have a WHERE, then it will behave like it always
did, removing all the cases of LIMIT (which would still break a subquery
but this is a) more rare, and b) would require more intelligent parsing
to deal with.

Also adds test cases and function documentation.

Signed-off-by: Nicole C. Engard <nengard@bywatersolutions.com>
Tested with this report:

select biblionumber, (select itemnumber from items where items.biblionumber=biblio.biblionumber LIMIT 1) from biblio where biblionumber<1000;

and it worked like a charm

Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
C4/Reports/Guided.pm
t/db_dependent/Reports/Guided.t [new file with mode: 0644]