[Catalyst] strange behavior of catalyst

Kieren Diment diment at gmail.com
Mon Feb 19 20:17:34 GMT 2007


Sounds like there's a logic error in your resultset search generation
routine.

Look more carefully at what you're asking it to do with DBIC_TRACE=3D1 and
some carefully placed warn statements

On 20/02/07, Will Smith <willbelair at yahoo.com> wrote:
>
> I'm workng input form and catalyst search funtion with DBIx::Class base
> model, and found this strange behavior.
> On my input form, there are 7 or more (the form is built dinamically)
> selection boxes which contains the values : T, F or NA(not null). In the
> controller, the search string is:
>
> my $val1;
> my $val2;  ... my $val7;
> my $phrase1; .... my $phrase7;
> if($val1 eq "NA"){$phrase1=3D"val1 is not null";} else{$phrase1 =3D
> "val1=3D'$val1'";}
> ....
>
> my $searchstring =3D $phrase1." and ".$phrase2." and ".$phrase3." and
> ".phrase4." and ".$phrase5." and ".$phrase6." and ".$phrase7;
>
> my $rs =3D [$c->model('myApp::Mytabe')->search( \$searchstring);
> # search result is the same for ($searchstring) or ("${searchstring}")
>
> The strang behaviour is:
> if on the form I select less than or equal 3 boxes from val1 to val3 =3D =
na,
> the result returned right. But if I select more than 4 boxes with the
> val=3Dna, or even 1 box val7=3Dna, catalyst returns error "there is an er=
ror in
> your SQL syntax: .... select val1,val2, ....val7 where val1=3D'T' and val=
7 is
> not null and val2=3D'T' and val3=3D'T' and val4 ........ and val6=3D'T' a=
nd )
> Please pay attention at the last "and", because the val7 is move next to
> val1. and this cause the syntax error.
> If the form less that 4 selection box, everything is fine.
>
> Any one could tell me why I get this error. The string is screwed up.
>
> Thank you
>
> ------------------------------
> Need a quick answer? Get one in minutes from people who know. Ask your
> question on Yahoo! Answers<http://answers.yahoo.com/;_ylc=3DX3oDMTFvbGNhM=
GE3BF9TAzM5NjU0NTEwOARfcwMzOTY1NDUxMDMEc2VjA21haWxfdGFnbGluZQRzbGsDbWFpbF90=
YWcx>
> .
>
>
> _______________________________________________
> List: Catalyst at lists.rawmode.org
> Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/catalyst@lists.rawmode.org/
> Dev site: http://dev.catalyst.perl.org/
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20070220/6a23f=
7ec/attachment.htm


More information about the Catalyst mailing list