From d87a70078848bf62e360748dcb8e39f0370d4cd9 Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Fri, 29 Oct 2021 10:26:41 -0400 Subject: [PATCH] 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 --- Open-ILS/src/perlmods/lib/OpenILS/Reporter/SQLBuilder.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 -- 2.11.0