| 1 | package DBIx::SQLEngine::Criteria::Not; | ||
| 2 | |||
| 3 | @ISA = 'DBIx::SQLEngine::Criteria'; | ||
| 4 | use strict; | ||
| 5 | use Carp; | ||
| 6 | |||
| 7 | sub new { | ||
| 8 | my $package = shift; | ||
| 9 | ( @_ < 2 ) or croak("The Not criteria only accepts one argument"); | ||
| 10 | bless [ shift ], $package; | ||
| 11 | } | ||
| 12 | |||
| 13 | sub sql_where { | ||
| 14 | my $self = shift; | ||
| 15 | my ($clause, @params) = $self->[0]->sql_where; | ||
| 16 | |||
| 17 | return unless defined $clause and length $clause; | ||
| 18 | |||
| 19 | return ( " NOT ( " . $clause . " ) ", @params ) | ||
| 20 | } | ||
| 21 | |||
| 22 | 1; | ||
| 23 | |||
| 24 | __END__ |