]> 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)
committerPaul Poulain <paul.poulain@biblibre.com>
Wed, 5 Sep 2012 08:12:06 +0000 (10:12 +0200)
commit2341bd876a526bca5bdaff2777b3cb53085979a6
tree745acbcc0d422fcbffeb719cfb80fe143a91b368
parent5434882791d7e70f402aedcb4a74eb20496933a4
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>
C4/Reports/Guided.pm
t/db_dependent/Reports/Guided.t [new file with mode: 0644]