[Dbix-class] RE: SQL Generation with SQL::DB
Mark Lawrence
nomad at null.net
Fri Sep 7 14:01:00 GMT 2007
On Fri Sep 07, 2007 at 02:12:31PM +0200, Emanuele Zeppieri wrote:
> Mark Lawrence wrote:
>
> > foreach my $field ($form->param) {
> > my @vals = $form->param($field) or next;
> > $expr = $expr & ( @vals > 1 ? $table->$field->in(@vals)
> > : $table->$field == $vals[0] );
> > }
>
> Mark, this is more or less what I was asking for, but it seems to
> reproduce what Pagaltzis was saying (except that it doesn't uses the
> unnecessary reduce's ;-)
>
> Thus it leads to the same objections I told him, at least when applied
> to a more general case:
>
> 1. If you have both &'s and |'s in your (full) expression, how can you
> find the correct order to evaluate the various subexpressions?
>
> 2. This way you are evaluating the (whole) expression (binary)
> subexpression by subexpression, so you are basically bypassing your
> parser (that should be able to handle more complex logic expressions,
> not just binary ones, from what I understand).
> Doesn't this defeat the whole logic under your module?
>
> That's why I was talking about string concatenations to build the whole
> expression *before* evaluating it: though I don't like it in such a
> situation it's even preferable since it saves you from (pre-)parsing the
> expression in your code to find the correct subexpressions evaluation
> order (and from a series of other parsing problems).
Could you perhaps give an example of the type of complex expression you
are thinking of? And the pseudo code of where/how you would do the
concatenation? I'm afraid I'm just not seeing your point.
Cheers,
Mark.
--
Mark Lawrence
More information about the DBIx-Class
mailing list