From: Mike Rylander Date: Fri, 29 Oct 2021 14:26:41 +0000 (-0400) Subject: Make disused "= any" and "<> any" useful X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=d87a70078848bf62e360748dcb8e39f0370d4cd9;p=evergreen%2Ftadl.git Make disused "= any" and "<> any" useful Allow caller to supply a PG-encoded array string to test against a column value. Also, repair relative week transform that has never worked. Sponsored-by: C/W MARS Sponsored-by: Missouri Evergreen Consortium Signed-off-by: Mike Rylander Signed-off-by: Jason Boyer Signed-off-by: rfrasur --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Reporter/SQLBuilder.pm b/Open-ILS/src/perlmods/lib/OpenILS/Reporter/SQLBuilder.pm index 22bee1a01a..f80557568c 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Reporter/SQLBuilder.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Reporter/SQLBuilder.pm @@ -435,7 +435,7 @@ sub toSQL { my $val = $self->{params}; $val = $$val[0] if (ref($val)); - return "EXTRACT(WEEK FROM \$_$$\$rtime\$_$$\$::TIMESTAMPTZ + \$_$$\$val weeks\$_$$\$)"; + return "EXTRACT(WEEK FROM \$_$$\$rtime\$_$$\$::TIMESTAMPTZ + \$_$$\$$val weeks\$_$$\$)"; } @@ -947,7 +947,7 @@ sub toSQL { } else { $sql = ''; } - $sql .= "$val = ANY (".$self->SUPER::toSQL.")"; + $sql .= "(".$self->SUPER::toSQL.") = ANY ($val)"; } elsif (lc($op) eq '<> any') { $val = $$val[0] if (ref($val) eq 'ARRAY'); @@ -957,7 +957,7 @@ sub toSQL { } else { $sql = ''; } - $sql .= "$val <> ANY (".$self->SUPER::toSQL.")"; + $sql .= "(".$self->SUPER::toSQL.") <> ANY ($val)"; } elsif (lc($op) eq 'is blank') { if ($rel && $rel->is_nullable) { # need to redo this