[Catalyst] Where and how to access database

Mario Minati mario.minati at googlemail.com
Wed Mar 21 13:52:57 GMT 2007


Am Mittwoch 21 März 2007 14:01 schrieb Stephan Austermühle:
> Hi,
>
> > Are you sure that your structure is right?
> > Mine is (based on the Tutorial) App/lib/AppDB/Modell/Table.pm
>
> I have named the AppDB like the application because the database is named
> that way. The file App.pm just contains
>
> __PACKAGE__->config(
>     schema_class => 'App::Schema',
>     connect_info => [
>         'dbi:mysql:xxx',
>         'xxx',
>         'xxx',
>     ],
> );
>
> Anyway, all tables are dynamically loaded so I assume that configuration
> is correct for the moment.
>
> > In the table class I can create custom functions to alter or get the
> > resultsets.
>
> Where do you put queries that join multiple tables? I think such queries
> do not fit well into a Table.pm but in AppDB.pm.

In my app they are, but I think we have a different setup.
If you are interested I can post on of my table classes.

>
> > With DBIC you can do almost everything, e.g. multi table joins, creating
> > aliases with user defined functions and procedures.
>
> May be you can do anything with DBIC -- at the cost of having to learn it
> instead of just and easy placing an SQL statement into the code. Maybe
> DBIC would be more fun if I would have found better documentation. That is
> why I need to access a dbh.

What about the Manual part of the docs, especially the Cookbook helped me a 
lot:
http://search.cpan.org/~jrobinson/DBIx-Class-0.07005/lib/DBIx/Class/Manual/Cookbook.pod

Greets,
Maro Minati



More information about the Catalyst mailing list