[CDBI] Connection with a fixed "where" clause.

Matt S Trout dbix-class at trout.me.uk
Mon Aug 22 21:50:48 BST 2005

On Mon, Aug 22, 2005 at 09:36:51AM +0200, Karl.Moens at marsh.com wrote:
> Hi ListMembers,
> Is it possible to have a class with a fixed "where" clause?

It'd be a bit of a pain to do, but it's definitely possible. Class::DBI
defines all its SQL statements as Ima::DBI set_sqls, so all (!) you'd have to
do is redefine those - e.g.

__PACKAGE__->set_sql(SearchSQL => <<'');
FROM   %s

would become

__PACKAGE__->set_sql(SearchSQL => <<'');
FROM   %s
WHERE  restricted_access = 0 AND %s

     Matt S Trout           Website: http://www.shadowcatsystems.co.uk
  Technical Director        E-mail:  mst (at) shadowcatsystems.co.uk
Shadowcat Systems Ltd.

 + Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +

More information about the ClassDBI mailing list