DBIx::SQLEngine::Criteria::Not - Negating A Single Criteria


DBIx-SQLEngine documentation Contained in the DBIx-SQLEngine distribution.

Index


Code Index:

NAME

Top

DBIx::SQLEngine::Criteria::Not - Negating A Single Criteria

SYNOPSIS

Top

  my $crit = DBIx::SQLEngine::Criteria::Not->new( $crit );




DESCRIPTION

Top

DBIx::SQLEngine::Criteria::Not logicaly inverts a single given criteria by wrapping it in a NOT criteria.

(Contributed by Christian Glahn at Innsbruck University.)

REFERENCE

Top

Constructor

new ( @criteria ) : $notcriteria

Constructor.

SEE ALSO

Top

See DBIx::SQLEngine::Criteria and DBIx::SQLEngine::Criteria::Comparison for more information on using these objects.

See DBIx::SQLEngine for the overall interface and developer documentation.

See DBIx::SQLEngine::Docs::ReadMe for general information about this distribution, including installation and license information.


DBIx-SQLEngine documentation Contained in the DBIx-SQLEngine distribution.

package DBIx::SQLEngine::Criteria::Not;

@ISA = 'DBIx::SQLEngine::Criteria';
use strict;
use Carp;

sub new {
  my $package = shift;
  ( @_ < 2 ) or croak("The Not criteria only accepts one argument");
  bless [ shift ], $package;
}

sub sql_where {
  my $self = shift;
  my ($clause, @params) = $self->[0]->sql_where;
  
  return unless defined $clause and length $clause;
  
  return ( " NOT ( " . $clause . " ) ", @params )
}

1;

__END__

#########################################################################