Re: Error accessing columns
[prev]
[thread]
[next]
[Date index for 2004/04/28]
On Wed, Apr 28, 2004 at 04:43:08PM +0200, Michele Valzelli wrote:
> I tried to make it as simpler as possible to help you reproduce the problem.
Thanks.
When I test this I also get the message:
Column 'id' in Messagenet::DBI::Fattura clashes with built-in method
The problem is that Class::DBI doesn't allow you to call a column 'id'
unless it's your primary key. In your case 'id' is only *part* of your
primary key, and so CDBI gets very confused.
The easiest workaround if you can't change the schema is to override
the accessor name for your 'id' column:
sub accessor_name {
my ($self, $column) = @_;
return "myid" if $column eq "id";
return $column;
}
Tony