[open-ils-commits] r16694 - trunk/Open-ILS/src/perlmods/OpenILS/Reporter (miker)
svn at svn.open-ils.org
svn at svn.open-ils.org
Sat Jun 12 00:50:02 EDT 2010
Author: miker
Date: 2010-06-12 00:49:58 -0400 (Sat, 12 Jun 2010)
New Revision: 16694
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Reporter/SQLBuilder.pm
Log:
correct nullability test for certain WHERE clauses
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Reporter/SQLBuilder.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Reporter/SQLBuilder.pm 2010-06-11 22:28:44 UTC (rev 16693)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Reporter/SQLBuilder.pm 2010-06-12 04:49:58 UTC (rev 16694)
@@ -946,18 +946,38 @@
} elsif (lc($op) eq '= any') {
$val = $$val[0] if (ref($val) eq 'ARRAY');
$val = $val->toSQL;
- $sql = "$val = ANY (".$self->SUPER::toSQL.")";
+ if ($rel && $rel->is_nullable) { # need to redo this
+ $sql = "((". $self->SUPER::toSQL .") IS NULL OR ";
+ } else {
+ $sql = '';
+ }
+ $sql .= "$val = ANY (".$self->SUPER::toSQL.")";
} elsif (lc($op) eq '<> any') {
$val = $$val[0] if (ref($val) eq 'ARRAY');
$val = $val->toSQL;
- $sql = "$val <> ANY (".$self->SUPER::toSQL.")";
+ if ($rel && $rel->is_nullable) { # need to redo this
+ $sql = "((". $self->SUPER::toSQL .") IS NULL OR ";
+ } else {
+ $sql = '';
+ }
+ $sql .= "$val <> ANY (".$self->SUPER::toSQL.")";
} elsif (lc($op) eq 'is blank') {
- $sql = '('. $self->SUPER::toSQL ." IS NULL OR ". $self->SUPER::toSQL ." = '')";
+ if ($rel && $rel->is_nullable) { # need to redo this
+ $sql = "((". $self->SUPER::toSQL .") IS NULL OR ";
+ } else {
+ $sql = '';
+ }
+ $sql .= '('. $self->SUPER::toSQL ." IS NULL OR ". $self->SUPER::toSQL ." = '')";
} elsif (lc($op) eq 'is not blank') {
- $sql = '('. $self->SUPER::toSQL ." IS NOT NULL AND ". $self->SUPER::toSQL ." <> '')";
+ if ($rel && $rel->is_nullable) { # need to redo this
+ $sql = "((". $self->SUPER::toSQL .") IS NULL OR ";
+ } else {
+ $sql = '';
+ }
+ $sql .= '('. $self->SUPER::toSQL ." IS NOT NULL AND ". $self->SUPER::toSQL ." <> '')";
} elsif (lc($op) eq 'between') {
$sql .= " BETWEEN ". join(" AND ", map { $_->toSQL } @$val);
More information about the open-ils-commits
mailing list