Subject: | propose new method sqlwhere |
Show quoted text
> Just generate the WHERE clause
> my($where, @bind) = $sql->where(\%where, $order);
I find myself doing the "$sqlpart $where" join all of the time. Can it be moved into this package with the correct error checking, joining, etc.?
=head2 sqlwhere
This is used to generate statement given the known SQL part (not including WHERE or ORDER BY clauses) and data structures to produce the WHERE and ORDER BY clauses. It returns the full SQL statement and list of bind values.
my($stmt, @bind) = $sql->sqlwhere($sqlpart, \%where, $order);
=cut
sub sqlwhere {
my $self = shift;
my $sqlpart = shift;
my ($where, @bind) = $self->where(@_);
my $stmt = "$sqlpart $where"; #add error checking here. Is space join portable?
return($stmt, @bind);
}
mrdvt92