[Catalyst] Where and how to access database

Mario Minati mario.minati at googlemail.com
Wed Mar 21 11:43:01 GMT 2007


Am Mittwoch 21 März 2007 11:39 schrieb Stephan Austermühle:
> Hi,
>
> I want to place some database queries in App/lib/App/Modell/App.pm. How
> can I access the DBI database handle in that module? Is that the right
> place for complex queries?

Are you sure that your structure is right?
Mine is (based on the Tutorial) App/lib/AppDB/Modell/Table.pm

>
> The database tables are being loaded dynamically by
> Catalyst::Model::DBIC::Schema/ DBIx::Class::Schema::Loader. I read that I
> can get the DBH via $schema->storage->dbh -- but where do I get $schema
> from?

In the table class I can create custom functions to alter or get the 
resultsets.

How complex can a query be that you want the DBI handle? 
With DBIC you can do almost everything, e.g. multi table joins, creating 
aliases with user defined functions and procedures. 
At least for me that's all I want :)

Greets,
Mario Minati



More information about the Catalyst mailing list