[Catalyst] Class::DBI, Controller::Root, set_sql "redefined"

Matt S Trout dbix-class at trout.me.uk
Wed Jun 7 17:01:20 CEST 2006


Marc Brooks wrote:
> So basically I must emulate the set_sql() method using the CDBICompat
> (Class::DBI Ima::DB).  By doing so still doesn't solve my initial issue.  On
> another note can the DBIx::Class handle complex updates like the one below.
> Sorry about all the questions.  I didn't come across any examples from
> within the DBIx::Class documentation.

No. Don't do that. CDBICompat is a porting springboard. Expect to use it 
  briefly while getting your code converted across, if at all.

For examples of complex updates have a look at the (as-yet unreleased) 
DBIx::Class::Tree component available at 
http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class-Tree/ which is 
design to eventually support an implementation of nested sets (which is 
what you've got there).

I'd note that set_sql is the Wrong Thing to be doing in Class::DBI for 
your use case anyway; it's a class method you should be calling once to 
create the sql_Name and search_Name methods and then using those, which 
is why calling it repeatedly is giving you warnings. DBIx::Class doesn't 
have set_sql because if you *really* need totally custom SQL it's 
trivial to write a method to do so, and 99.9% of the time you don't.

You'd be better off subscribing to the DBIx-Class list and discussing it 
there - it'd be more on-topic and we can get a proper discussion going 
about this and maybe make some progress on nested sets in ::Tree too :)



More information about the Catalyst mailing list