Re: column called 'id'

[prev] [thread] [next] [Date index for 2004/06/18]

From: Tony Bowden
Subject: Re: column called 'id'
Date: 16:44 on 18 Jun 2004
On Fri, Jun 18, 2004 at 04:58:26PM +0100, Robert Collier wrote:
> All my tables have a a primary key called 'id'. This seems to conflict  
> with the 'id' function in Class::DBI.
> Is there any workaround?

That shouldn't be a problem. You're allowed a column called 'id', as
long as it's your primary key.

> __PACKAGE__->columns(ALL => qw/id isbn title media publisher  

That should be 'All' rather than 'ALL'.

When you use 'All', Class::DBI will assume, in the absence of any other
declaration, that the first column specified is your Primary Key. But
because you've used ALL, it doesn't do that, and so doesn't realise 'id'
is your PK, and so complains...

Tony

column called 'id'
Robert Collier 15:58 on 18 Jun 2004

Re: column called 'id'
Tony Bowden 16:44 on 18 Jun 2004

Generated at 11:34 on 01 Dec 2004 by mariachi v0.52