godzirra has asked for the wisdom of the Perl Monks concerning the following question:
The problem I'm having is that when I run the following: ./dupe_charts.pl 74
I get the following error:
chart is not a column of CCopy::Chart_Item_XREF at /usr/local/share/perl/5.8.4/Class/DBI/Relationship/HasMany.pm line 118
#### Class dbi instance script ###### use strict; use CCopy; my $owner_id = shift || die "Must call with a site id to copy to."; my $it = CCopy::Chart->retrieve_all; while (my $chart = $it->next) { *********** $chart->items; *************** }
#### module ####### package CCopy; use base 'Class::DBI'; CCopy->connection($dsn, $user, $password); package CCopy::Chart; use base 'CCopy'; CCopy::Chart->table('CHART'); CCopy::Chart->columns(Primary => qw/ chart_id /); CCopy::Chart->columns(Essential => qw/ title description owner_id owne +r_type_id chart_type/); CCopy::Chart->has_many(items => 'CCopy::Chart_Item_XREF'); package CCopy::Chart_Item_XREF; use base 'CCopy'; CCopy::Chart_Item_XREF->table('CHART_ITEM_XREF'); CCopy::Chart_Item_XREF->columns(Primary => qw/ chart_id item_id /); CCopy::Chart_Item_XREF->columns(All => qw/ insert_dtime update_dtime / +); ################################
The two tables have these columns:
########### CHART ################## chart_id insert_dtime update_dtime owner_id owner_type_id title description featured chart_type ######## CHART_ITEM_XREF ########### chart_id item_id status_code feature_flag priority_level insert_dtime update_dtime locked_flag special_flag mandatory_flag
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Class DBI Problems
by merlyn (Sage) on May 03, 2005 at 20:57 UTC | |
by godzirra (Acolyte) on May 03, 2005 at 21:45 UTC | |
by merlyn (Sage) on May 03, 2005 at 21:53 UTC | |
by godzirra (Acolyte) on May 03, 2005 at 22:20 UTC | |
by merlyn (Sage) on May 03, 2005 at 22:28 UTC |