From: miker Date: Tue, 15 Feb 2005 21:06:19 +0000 (+0000) Subject: no longer used X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=d2b93f945f44d2fed2c23d8ea61fc3f783228615;p=opensrf%2Fbjwebb.git no longer used git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@60 9efc2488-bf62-4759-914b-345cdb29e865 --- diff --git a/src/perlmods/OpenSRF/DOM/Element/param.pm b/src/perlmods/OpenSRF/DOM/Element/param.pm deleted file mode 100644 index 44993ef..0000000 --- a/src/perlmods/OpenSRF/DOM/Element/param.pm +++ /dev/null @@ -1,4 +0,0 @@ -package OpenSRF::DOM::Element::param; -use base 'OpenSRF::DOM::Element'; - -1; diff --git a/src/perlmods/OpenSRF/DOM/Element/searchCriteria.pm b/src/perlmods/OpenSRF/DOM/Element/searchCriteria.pm deleted file mode 100644 index c8b1eb3..0000000 --- a/src/perlmods/OpenSRF/DOM/Element/searchCriteria.pm +++ /dev/null @@ -1,48 +0,0 @@ -package OpenSRF::DOM::Element::searchCriteria; -use base 'OpenSRF::DOM::Element'; -use OpenSRF::DOM; -use OpenSRF::DOM::Element::searchCriterium; - -sub new { - my $self = shift; - my $class = ref($self) || $self; - - if (@_ == 3 and !ref($_[1])) { - my @crit = @_; - @_ = ('AND', \@crit); - } - - my ($joiner,@crits) = @_; - - unless (@crits) { - push @crits, $joiner; - $joiner = 'AND'; - } - - my $collection = $class->SUPER::new(joiner => $joiner); - - for my $crit (@crits) { - if (ref($crit) and ref($crit) =~ /ARRAY/) { - if (ref($$crit[1])) { - $collection->appendChild( $class->new(@$crit) ); - } else { - $collection->appendChild( OpenSRF::DOM::Element::searchCriterium->new( @$crit ) ); - } - } else { - $collection->appendChild($crit); - } - } - return $collection; -} - -sub toSQL { - my $self = shift; - - my @parts = (); - for my $kid ($self->childNodes) { - push @parts, $kid->toSQL; - } - return '(' . join(' '.$self->getAttribute('joiner').' ', @parts) . ')'; -} - -1; diff --git a/src/perlmods/OpenSRF/DOM/Element/searchCriterium.pm b/src/perlmods/OpenSRF/DOM/Element/searchCriterium.pm deleted file mode 100644 index 9bfa3b4..0000000 --- a/src/perlmods/OpenSRF/DOM/Element/searchCriterium.pm +++ /dev/null @@ -1,116 +0,0 @@ -package OpenSRF::DOM::Element::searchCriterium; -use base 'OpenSRF::DOM::Element'; -use OpenSRF::DOM::Element::searchTargetValue; - -sub new { - my $class = shift; - my @nodes; - my @args = @_; - while (scalar(@args)) { - my ($attr,$cmp,$val) = (shift(@args),shift(@args),shift(@args),shift(@args)); - push @nodes, $class->SUPER::new(property => $attr, comparison => $cmp); - $nodes[-1]->appendChild( $_ ) for OpenSRF::DOM::Element::searchTargetValue->new($val); - } - return @nodes if (wantarray); - return $nodes[0]; -} - -sub toSQL { - my $self = shift; - my %args = @_; - - my $column = $self->getAttribute('property'); - my $cmp = lc($self->getAttribute('comparison')); - - my $value = [ map { ($_->getAttribute('value')) } $self->childNodes ]; - - if ($cmp eq '=' || $cmp eq '==' || $cmp eq 'eq' || $cmp eq 'is') { - $cmp = '='; - if (!$value || lc($value) eq 'null') { - $cmp = 'IS'; - $value = 'NULL'; - } - ($value = $value->[0]) =~ s/'/''/gmso; - $value =~ s/\\/\\\\/gmso; - $value = "'$value'" unless $args{no_quote}; - } elsif ($cmp eq '>' || $cmp eq 'gt' || $cmp eq 'over' || $cmp eq 'after') { - $cmp = '>'; - if (!$value || lc($value) eq 'null') { - warn "Can not compare NULL"; - } - ($value = $value->[0]) =~ s/'/''/gmso; - $value =~ s/\\/\\\\/gmso; - $value = "'$value'" unless $args{no_quote}; - } elsif ($cmp eq '<' || $cmp eq 'lt' || $cmp eq 'under' || $cmp eq 'before') { - $cmp = '<'; - if (!$value || lc($value) eq 'null') { - warn "Can not compare NULL"; - } - ($value = $value->[0]) =~ s/'/''/gmso; - $value =~ s/\\/\\\\/gmso; - $value = "'$value'" unless $args{no_quote}; - } elsif ($cmp eq '!=' || $cmp eq '<>' || $cmp eq 'ne' || $cmp eq 'not') { - $cmp = '<>'; - if (!$value || lc($value) eq 'null') { - $cmp = 'IS NOT'; - $value = 'NULL'; - } - ($value = $value->[0]) =~ s/'/''/gmso; - $value =~ s/\\/\\\\/gmso; - $value = "'$value'" unless $args{no_quote}; - } elsif (lc($cmp) eq 'fts' || $cmp eq 'tsearch' || $cmp eq '@@') { - $cmp = '@@'; - if (!$value || lc($value) eq 'null') { - warn "Can not compare NULL"; - } - ($value = $value->[0]) =~ s/'/''/gmso; - $value =~ s/\\/\\\\/gmso; - $value = "to_tsquery('$value')"; - } elsif ($cmp eq 'like' || $cmp eq 'contains' || $cmp eq 'has') { - $cmp = 'LIKE'; - if (!$value || lc($value) eq 'null') { - warn "Can not compare NULL"; - } - ($value = $value->[0]) =~ s/'/''/gmso; - $value =~ s/\\/\\\\/gmso; - $value =~ s/%/\\%/gmso; - $value =~ s/_/\\_/gmso; - $value = "'\%$value\%'"; - } elsif ($cmp eq 'between') { - $cmp = 'BETWEEN'; - if (!ref($value) || lc($value) eq 'null') { - warn "Can not check 'betweenness' of NULL"; - } - if (ref($value) and ref($value) =~ /ARRAY/o) { - $value = "(\$text\$$$value[0]\$text\$ AND \$text\$$$value[-1]\$text\$)"; - } - } elsif ($cmp eq 'not between') { - $cmp = 'NOT BETWEEN'; - if (!ref($value) || lc($value) eq 'null') { - warn "Can not check 'betweenness' of NULL"; - } - if (ref($value) and ref($value) =~ /ARRAY/o) { - $value = "(\$text\$$$value[0]\$text\$ AND \$text\$$$value[-1]\$text\$)"; - } - } elsif ($cmp eq 'in' || $cmp eq 'any' || $cmp eq 'some') { - $cmp = 'IN'; - if (!ref($value) || lc($value) eq 'null') { - warn "Can not check 'inness' of NULL"; - } - if (ref($value) and ref($value) =~ /ARRAY/o) { - $value = '($text$'.join('$text$,$text$', @$value).'$text$)'; - } - } elsif ($cmp eq 'not in' || $cmp eq 'not any' || $cmp eq 'not some') { - $cmp = 'NOT IN'; - if (!ref($value) || lc($value) eq 'null') { - warn "Can not check 'inness' of NULL"; - } - if (ref($value) and ref($value) =~ /ARRAY/o) { - $value = '($text$'.join('$text$,$text$', @$value).'$text$)'; - } - } - - return join(' ', ($column, $cmp, $value)); -} - -1; diff --git a/src/perlmods/OpenSRF/DOM/Element/searchTargetValue.pm b/src/perlmods/OpenSRF/DOM/Element/searchTargetValue.pm deleted file mode 100644 index 7e6d3c8..0000000 --- a/src/perlmods/OpenSRF/DOM/Element/searchTargetValue.pm +++ /dev/null @@ -1,23 +0,0 @@ -package OpenSRF::DOM::Element::searchTargetValue; -use base 'OpenSRF::DOM::Element'; - -sub new { - my $self = shift; - my $class = ref($self) || $self; - my @args = @_; - - my @values = (); - for my $val (@args) { - next unless ($val); - if (ref($val)) { - push @values, $class->new(@$val); - } else { - push @values, $class->SUPER::new( value => $val ); - } - - } - return $values[0] if (!wantarray); - return @values; -} - -1;