Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed up check for illegal top-level op #21

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions lib/SQL/Abstract.pm
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,14 @@ our $AUTOLOAD;

# special operators (-in, -between). May be extended/overridden by user.
# See section WHERE: BUILTIN SPECIAL OPERATORS below for implementation
my @BUILTIN_SPECIAL_OPS = (
{regex => qr/^ (?: not \s )? between $/ix, handler => sub { die "NOPE" }},
{regex => qr/^ is (?: \s+ not )? $/ix, handler => sub { die "NOPE" }},
{regex => qr/^ (?: not \s )? in $/ix, handler => sub { die "NOPE" }},
{regex => qr/^ ident $/ix, handler => sub { die "NOPE" }},
{regex => qr/^ value $/ix, handler => sub { die "NOPE" }},
);
my $BUILTIN_SPECIAL_OPS_re = qr/
^ (?:
(?: (?: not \s )? (?: between | in ) ) |
(?: is (?: \s+ not )? ) |
ident |
value
) $
/ix;

#======================================================================
# DEBUGGING AND ERROR REPORTING
Expand Down Expand Up @@ -1109,7 +1110,7 @@ sub _expand_hashpair_op {
$is_special
or (
$self->{disable_old_special_ops}
and List::Util::first { $wsop =~ $_->{regex} } @BUILTIN_SPECIAL_OPS
and $wsop =~ $BUILTIN_SPECIAL_OPS_re
)
)
) {
Expand Down