Apache-Voodoo
view release on metacpan or search on metacpan
lib/Apache/Voodoo/Table.pm view on Meta::CPAN
################################################################################
#
# Apache::Voodoo::Table
#
# framework to handle common database operations
#
################################################################################
package Apache::Voodoo::Table;
$VERSION = "3.0200";
use strict;
use warnings;
use base("Apache::Voodoo");
use Apache::Voodoo::Validate;
use Apache::Voodoo::Pager;
sub new {
my $class = shift;
my $self = {};
bless $self, $class;
$self->set_configuration(shift);
$self->{'list_param_parser'} = sub {
my $self = shift;
my $dbh = shift;
my $params = shift;
my @fields = @{$self->{'columns'}};
if ($self->{'references'}) {
foreach my $join (@{$self->{'references'}}) {
foreach (@{$join->{'columns'}}) {
push(@fields,"$join->{'table'}.$_");
}
}
}
my @search;
foreach my $field (@fields) {
my $s = 'search_' .$field;
my $o = 'search_op_'.$field;
next unless defined($params->{$s});
if (defined($params->{$o})) {
push(@search,[$field,$params->{$o},$params->{$s}]);
}
elsif ($params->{$s} =~ /^\d+$/) {
push(@search,[$field,'=',$params->{$s}]);
}
else {
push(@search,[$field,'like',$params->{$s}]);
}
}
return @search;
};
return $self;
}
( run in 0.489 second using v1.01-cache-2.11-cpan-e1769b4cff6 )