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=1 and
some carefully placed warn statements

On 20/02/07, Will Smith <[EMAIL PROTECTED]> 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="val1 is not null";} else{$phrase1 =
"val1='$val1'";}
....

my $searchstring = $phrase1." and ".$phrase2." and ".$phrase3." and
".phrase4." and ".$phrase5." and ".$phrase6." and ".$phrase7;

my $rs = [$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 = na,
the result returned right. But if I select more than 4 boxes with the
val=na, or even 1 box val7=na, catalyst returns error "there is an error in
your SQL syntax: .... select val1,val2, ....val7 where val1='T' and val7 is
not null and val2='T' and val3='T' and val4 ........ and val6='T' and )
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=X3oDMTFvbGNhMGE3BF9TAzM5NjU0NTEwOARfcwMzOTY1NDUxMDMEc2VjA21haWxfdGFnbGluZQRzbGsDbWFpbF90YWcx>
.


_______________________________________________
List: Catalyst@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/


_______________________________________________
List: Catalyst@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/

Reply via email to