Extending Class::DBI's search abilities

[prev] [thread] [next] [Date index for 2004/07/26]

From: Jack Challen
Subject: Extending Class::DBI's search abilities
Date: 08:58 on 26 Jul 2004
Hi,

I'm trying to make Class::DBI's searches a little more powerful (I want to 
add regex-based searches with MySQL, and also to allow multiple 
constraints on the same column - e.g. "Find me all foo where bar > 3 and 
bar < 5").

So far, it looks like I can either override the search() method, or write 
my own in my child class. I'm pretty sure I can do this, but I've looked 
at the search() method, and I'm confused:

snippet from Class::DBI's _do_search()
===
   $frag .= " ORDER BY $search_opts->{order_by}"
     if $search_opts->{order_by};
   return $class->sth_to_objects($class->sql_Retrieve($frag),
     [ grep defined, @vals ]);
}
===

BTW, it looks to me like the order_by value could be vulnerable to an 
SQL-injection attack.

Anyway, where does the sql_Retrieve method get defined? I've grep'd my 
tree of installed Perl modules, and I can't see it anywhere.
I'm not quite sure what it does, and therefore whether I need to use it.

Cheers
jack

Extending Class::DBI's search abilities
Jack Challen 08:58 on 26 Jul 2004

Re: Extending Class::DBI's search abilities
colm-cdbi 09:12 on 26 Jul 2004

Re: Extending Class::DBI's search abilities
Jack Challen 09:27 on 26 Jul 2004

Re: Extending Class::DBI's search abilities
Tony Bowden 10:29 on 26 Jul 2004

Re: Extending Class::DBI's search abilities
Gabriel Horner 18:13 on 26 Jul 2004

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