Re: set_sql and like '%$searchTerm%'

[prev] [thread] [next] [Date index for 2004/09/15]

From: Perrin Harkins
Subject: Re: set_sql and like '%$searchTerm%'
Date: 15:25 on 15 Sep 2004
On Tue, 2004-09-14 at 16:03, Michael Jensen wrote:
> Table::Files->set_sql(full2a_srch => qq|select f.* from files f, texts 
> t where (f.user_id=$filesUserID AND f.id=t.file_id AND (f.file like 
> "%$searchTerm%" OR t.line_1 like "%$searchTerm%" OR t.line_2 like 
> "%$searchTerm%" OR t.line_3 like "%$searchTerm%" OR t.body like 
> "%$searchTerm%")) order by create_date desc limit $p,$limit|);
> 
> my @list2aQuery = Table::Files->search_full2a_srch();

This doesn't look like it should work at all.  The set_sql call happens
at compile time, when $searchTerm probably has no value.  You are
supposed to do this kind of thing with placeholders, and pass the value
in when you call search_full2a_srch().

- Perrin

set_sql and like '%$searchTerm%'
Michael Jensen 20:03 on 14 Sep 2004

Re: set_sql and like '%$searchTerm%'
William McKee 12:37 on 15 Sep 2004

Re: set_sql and like '%$searchTerm%'
Perrin Harkins 15:25 on 15 Sep 2004

Re: set_sql and like '%$searchTerm%'
Michael Jensen 17:43 on 15 Sep 2004

Generated at 11:34 on 01 Dec 2004 by mariachi v0.52