]> git.evergreen-ils.org Git - Evergreen.git/commit
Fix boolean lists; Better atom regex; Caching
authorMike Rylander <mrylander@gmail.com>
Wed, 13 Nov 2013 23:15:21 +0000 (18:15 -0500)
committerDan Wells <dbw2@calvin.edu>
Tue, 26 Nov 2013 18:45:38 +0000 (13:45 -0500)
commit68e39c83414b8fbb94eedaa3df95e5097b491095
tree9a7581a78c662324bde5e1ac2c2ef5e3716d5fd1
parent3aba1ebc23c891841e72befcd6770879172909a6
Fix boolean lists; Better atom regex; Caching

First, we didn't need to make $last_type local, and it broke explicit
grouping anyway.  That's removed, and we now reset that (and a few more
like it) at calls to the top level parse() method.  This introduces a
situation where a long list of booleans could cause query plan problems,
so we limit the plan depth to 40 (20 ||'d conditions).

Second, we are smarter about finding the boundary of atoms.  Previous
to this commit, and curly brace could send the parser into a tailspin
from which it would not recover.  Now we use alternation instead of
a character class, which is much safer with the default multi-character
float syntax specifier.

Third, as a catch-all, if we can't parse the remained of a query we
now simply say so (when in debug mode) and go away, instead of risking
an infinite loop.  We do this via a final, unqualified "else" clause
in decompose().

Finally, instead of building 10+ regexp objects on each query parse,
cache them per QP subclass and reuse them.

Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Dan Wells <dbw2@calvin.edu>
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/QueryParser.pm
Open-ILS/src/support-scripts/test-scripts/query_tests.pl