[CDBI] Cascading Update

Jay Hargreaves jay at rigadon.com
Mon Feb 6 22:49:01 GMT 2006


Thanks Kingsley - I see your point but given that the site is already 
live and it's gonna be a pain to start adding extra "ID" fields 
everywhere (it's not just the News and NewsCategories tables that are 
linked in this way) is there an easier workaround? Surely there must be 
some way to do this? I don't really see the point in having a "primary 
key" and and "ID" field just for this purpose...

If not I'll presumably still want the "ID" field to be unique - is there 
some way to specify this in the Class::DBI table definition or is it 
down to the underlying database to take care of this?

Kingsley Kerce wrote:
> Jay Hargreaves writes:
>  > I've created an admin script to allow users to create/modify/delete News 
>  > and NewsCategories entries. But I am having trouble when updating the 
>  > NewsCategories entry with a new ID. If I just change the ID in the 
>  > object and do an update nothing happens - perhaps I have missed 
>  > something as this seems the obvious way to do this.
> 
> Hi Jay -- Separate your notion of ID and primary key, and allow users
> to modify a non-primary-key field named "ID".  Better yet, name the
> field something other than "ID".
> 
> Generally, it's best to keep primary keys behind the scenes, away from
> users.
> 
> Kings
> 
> 

-- 
bingo, bango, bosh...




More information about the ClassDBI mailing list