[Catalyst] Catalyst Model Issue

Alejandro Imass alejandro.imass at gmail.com
Mon Aug 1 20:10:20 GMT 2011


On Sun, Jul 31, 2011 at 12:18 PM,  <gordon at gorste.plus.com> wrote:
>> To better help you, please indicate:
>>
>> - Operating System of the Catalyst App
>
>          Ubuntu 8.04.4 LTS
>
>> - RDBMS version and host OS
>
>          Ubuntu 8.04.4 LTS using MySql  5.0.51a-3ubuntu5.8-log
>          (same box as my catalyst application)
>

The Perl in 8.04 is probably quite old.

>> - DBD (DBI Driver)
>
>          DBIx::Class                               0.08195
>          DBIx::Class::Schema::Loader               0.07010
>          DBIx::Class::Schema::Loader::DBI::mysql   0.07010
>          DBIx::Class::Schema::Loader::DBI::SQLite  0.07010
>
> I get the same if I use sqllite or mysql so I think there is an issue with
> DBIx::Class.

DBIx::Class works on top of the plain-old DBI/DBD scheme. So when I
asked for the DBD I meant the actual DBI driver, examples:

DBD::SQLite
DBD::mysql
DBD:;Pg

Try static models like the following examples:

When working with SQLite you must generate your model clases with the
path to the DB file like so:

script/[app]_create.pl model [model name] DBIC::Schema
[app]::Schema::[model name] create=static
dbi:SQLite:dbname=data/catmodels.db

Assuming data/ exists from the root of the application

When working with MySQL try something like this:

script/[app]_create.pl model [model name] DBIC::Schema
[app]::Schema::[model name] create=static dbi:mysql:[dbname] [user]
[pass]

If you are connecting to more than one DB just use different model
names for each ;-)

If the static model generation was successful you should be able to
look inside the Schema Result classes and verify that you can actually
see the relations defined in each class with every field, type and
relationships (has_many, belongs_to etc.).

If you are unable to generate the static DBIC model try a small
program with plain-old DBI and see if you can actually connect to the
DB and have the correct privileges to extract the schema.

perldoc DBI

Cheers,

--
Alejandro Imass





>
> Gordon
>
>
>> On Fri, Jul 29, 2011 at 12:14 PM,  <gordon at gorste.plus.com> wrote:
>>> Alejandro
>>>
>>> I am using the create fuction catalyst provides,  I find that is the
>>> best
>>> way of creating the model.  Does it need 'source_name'  in the classes
>>> that it creates.
>>>
>>
>>
>> Hi Gordon,
>>
>> To better help you, please indicate:
>>
>> - Operating System of the Catalyst App
>> - RDBMS version and host OS
>> - DBD (DBI Driver)
>>
>> _______________________________________________
>> List: Catalyst at lists.scsys.co.uk
>> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
>> Searchable archive:
>> http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
>> Dev site: http://dev.catalyst.perl.org/
>>
>
>
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>



More information about the Catalyst mailing list