Well then you could do something like this:
push @cond, ['City', '=', $city] if $city;
push @cond, ['Ratings', '>=', $ratings_min] if $ratings_min;
push @cond, ['Ratings', '<=', $ratings_max] if $ratings_max;
use GT::SQL::Condition;
my $cond = GT::SQL::Condition->new(@cond);
$cond->bool('AND'); # not really needed but we'll be explicit.
my $sth = $DB->table('Links')->select($cond);
Adrian
Code:
my @cond; push @cond, ['City', '=', $city] if $city;
push @cond, ['Ratings', '>=', $ratings_min] if $ratings_min;
push @cond, ['Ratings', '<=', $ratings_max] if $ratings_max;
use GT::SQL::Condition;
my $cond = GT::SQL::Condition->new(@cond);
$cond->bool('AND'); # not really needed but we'll be explicit.
my $sth = $DB->table('Links')->select($cond);
Adrian