[Catalyst] Where and how to access database

Stephan Austermühle au at hcsd.de
Wed Mar 21 13:01:10 GMT 2007


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.

> 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.

Regards, Stephan



More information about the Catalyst mailing list