You may be able to use SQL::Abstract for that. You may wind up with something like:
my %where_clause = (); if ( $cgi->param( 'field1' ) ) { # obviously, some validation should be here $where_clause{ 'field1' } = $cgi->param( 'field1' ); } # etc. my $sql = SQL::Abstract->new(); my ( $stmt, @bind ) = $sql->select( 'table', [ qw( field list ) ], \%where_clause ); my $sth = $dbh->prepare( $stmt ); $sth->execute( @bind );
In reply to Re: Module to ease query building
by kyle
in thread Module to ease query building
by horano311
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |