Re: [CDBI] Re: delete on table with multiple pks

[prev] [thread] [next] [Date index for 2005/11/30]

From: Jim Salladin
Subject: Re: [CDBI] Re: delete on table with multiple pks
Date: 05:18 on 30 Nov 2005
On 11/26/05, William Ross <will@xxxxxxx.xxx> wrote:
> the active ingredient here is:
>
>    eval { $self->sql_DeleteMe->execute($self->id) };
>
> (cdbi line 705)
>
> the call to $self->id should return a list of two key values suitable
> for binding to the delete statement, but it isn't: you're only
> getting one. I don't know why. What do you get when you call $self-
>  >id directly?
>    eval { $self->sql_DeleteMe->execute($self->id) };
>
> (cdbi line 705)
>
> the call to $self->id should return a list of two key values suitable
> for binding to the delete statement, but it isn't: you're only
> getting one. I don't know why. What do you get when you call $self-
>  >id directly?

Thanks. This got me on the right path. The issue is that there is a
conflict with one of the column names, it is "id". So when doing
somehting to the effect of $self->id  I was getting:
Caught exception "Can't call id() as a class method "

I tried changing the name of the column to tablename_id and then the
error went away obviously.

This is really annoying though. I have had to do several things with
the basic database data mode lto get around this issue while others
parts I cannot change as there is a really old table with a column
name of id. I would guess there are lots of column names out there in
the world with the name "id", whether it is good practice or not. Not
sure why the __PACKAGE__->id has to clobber any potential table object
methods. This may be an old discussion in Class::DBI but it just seems
very impractical. Is there a way to alias column names to get around
this?

Jim.

(message missing)

[CDBI] delete on table with multiple pks
Jim Salladin 06:02 on 25 Nov 2005

[CDBI] Re: delete on table with multiple pks
Jim Salladin 23:09 on 25 Nov 2005

Re: [CDBI] Re: delete on table with multiple pks
Kingsley Kerce 23:18 on 25 Nov 2005

Re: [CDBI] Re: delete on table with multiple pks
William Ross 00:29 on 27 Nov 2005

Re: [CDBI] Re: delete on table with multiple pks
Matt S Trout 02:49 on 27 Nov 2005

Re: [CDBI] Re: delete on table with multiple pks
Peter Speltz 05:47 on 28 Nov 2005

Re: [CDBI] Re: delete on table with multiple pks
Matt S Trout 15:06 on 28 Nov 2005

Re: [CDBI] Re: delete on table with multiple pks
Perrin Harkins 15:33 on 28 Nov 2005

Re: [CDBI] Re: delete on table with multiple pks
Jim Salladin 05:18 on 30 Nov 2005

Re: [CDBI] Re: delete on table with multiple pks
Kingsley Kerce 05:45 on 30 Nov 2005

Re: [CDBI] Re: delete on table with multiple pks
William Ross 08:24 on 30 Nov 2005

Re: [CDBI] Re: delete on table with multiple pks
Jim Salladin 17:12 on 30 Nov 2005

Re: [CDBI] Re: delete on table with multiple pks
Peter Speltz 16:57 on 28 Nov 2005

Re: [CDBI] Re: delete on table with multiple pks
Perrin Harkins 17:18 on 28 Nov 2005

Re: [CDBI] Re: delete on table with multiple pks
Matt S Trout 18:35 on 28 Nov 2005

[CDBI] Re: delete on table with multiple pks
Edward J. Sabol 21:00 on 28 Nov 2005

Re: [CDBI] Re: delete on table with multiple pks
Peter Speltz 22:29 on 28 Nov 2005

Re: [CDBI] Re: delete on table with multiple pks
Perrin Harkins 22:40 on 28 Nov 2005

Generated at 14:52 on 01 Dec 2005 by mariachi v0.52