Re: First Attempt

[prev] [thread] [next] [Date index for 2005/01/28]

From: Peter Speltz
Subject: Re: First Attempt
Date: 20:58 on 28 Jan 2005
see class dbi docs in has_many section where it says how the column in Exper
class that represents the resume is determined. also thread a few weeks ago in
archive .


--- cpryce@xxxxx.xxx wrote:

> I'm trying to wrap my head around Class::DBI. I have the following simple
> database 
> to store a resume. Each resume can have one or more areas of experise. 
> 
> When I run the following script, I ger the error message:
> 
> resume is not a column of MyDBI::Resume::Exper at
> /Library/Perl/5.8.1/Class/DBI/Relationship/HasMany.pm line 118
> 
> #!/usr/bin/perl 
> 
> use strict;
> use MyDBI::Resume;
> 
> my ($r) = MyDBI::Resume->search( rid => 1 );
> 
> foreach my $exp ( $r->expertise ) {
>     print $exp->exp, "\n";
> }
> 
> 
> package MyDBI::Resume::DBI;
> use base 'Class::DBI::mysql';
> 
> __PACKAGE__->connection('dbi:mysql:resume;host=localhost', 'u/n', 'p/w');
> 
> 1;
> 
> package MyDBI::Resume;
> use base 'MyDBI::Resume::DBI';
> 
> __PACKAGE__->set_up_table('tblresume');
> 
> __PACKAGE__->has_many( 'expertise'  => 'MyDBI::Resume::Exper' );
> __PACKAGE__->has_many( 'education'  => 'MyDBI::Resume::Edu' );
> 
> 1;
> 
> package MyDBI::Resume::Exper;
> use base 'MyDBI::Resume::DBI';
> 
> __PACKAGE__->set_up_table( 'tblexpertise' );
> 
> 1;
> 
> 
> 
> The Database contains; 
> 
> > Select * from tblresume
> +-----+-------------+----------+--------+-------+---------------+
> | rid | firstname   | lastname | suffix | empid | title         | 
> +-----+-------------+----------+--------+-------+---------------+
> |   1 | Christopher | Pryce    |        |   278 | Web Developer |
> 
> ....
> 
> > Select * from tblexpertise
> +-----+-----+----------------------------------+
> | xid | rid | exp                              |
> +-----+-----+----------------------------------+
> |   1 |   1 | Graphic Design                   |
> |   2 |   1 | Web Development                  |
> 
> Created with: 
> 
>        Create Table tblresume (
>             rid         MEDIUMINT UNSIGNED NOT NULL PRIMARY KEY
> AUTO_INCREMENT,
>             firstname   VARCHAR(50), 
>             lastname    VARCHAR(50),
>             suffix      VARCHAR(18),
>             empid       MEDIUMINT UNSIGNED,
>             title       VARCHAR(50),
>             years_xp    SMALLINT UNSIGNED,
>             years_srf   SMALLINT UNSIGNED,
>             rdesc       TEXT,
>             KEY ( lastname, firstname )
>       );
>       Create Table tblexpertise ( 
>             xid         MEDIUMINT UNSIGNED NOT NULL PRIMARY KEY
> AUTO_INCREMENT,
>             rid         MEDIUMINT UNSIGNED NOT NULL, 
>             exp         VARCHAR(50),
>             KEY ( exp )
>        );
> 


=====
pjs


		
__________________________________ 
Do you Yahoo!? 
Read only the mail you want - Yahoo! Mail SpamGuard. 
http://promotions.yahoo.com/new_mail 

First Attempt
cpryce 20:29 on 28 Jan 2005

Re: First Attempt
Peter Speltz 20:58 on 28 Jan 2005

Re: First Attempt
Drew Taylor 14:44 on 29 Jan 2005

Re: First Attempt
Christopher Pryce 15:26 on 29 Jan 2005

Generated at 12:39 on 05 Feb 2005 by mariachi v0.52