Re: Re-inserting a record after delete

[prev] [thread] [next] [Date index for 2005/04/06]

From: Kingsley Kerce
Subject: Re: Re-inserting a record after delete
Date: 17:30 on 06 Apr 2005
Gianni, Andrew writes:
 > I'm running into a problem in testing an application. For testing
 > purposes, I need to delete a record from the database, and then turn
 > around and put it back in with the same primary key (by making a test
 > call to an application function). The problem I'm having is that when I
 > try to do the find_or_create with the identical primary key, I get the
 > following error:

Keep in mind that deletion of a database record using CDBI could very
well result in (cascaded) deletion of records in related tables, so
"put[ting] it back in" will not necessarily restore the state of the
database prior to deletion.  If you reply that this does not apply to
your current database schema, then consider that it could very well
apply in the future (when your schema changes; likely) or on another
project.

Kings

 > Can't locate object method "call_trigger" via package
 > "Class::DBI::Object::Has::Been::Deleted" (perhaps you forgot to load
 > "Class::DBI::Object::Has::Been::Deleted"?) at
 > /usr/local/perl5.6.1/lib/site_perl/5.6.1/Class/DBI.pm line 579, <DATA>
 > line 283.
 > 
 > This isn't surprising to me, but I don't know how to get around it. Or,
 > rather, I got around it by seemingly reinitializing access to the table
 > by making a retrieve call to the table. But what would be the
 > appropriate way to get my table object re-associated with it's correct
 > parent object; i.e. not Class::DBI::Object::Has::Been::Deleted?
 > 
 > Andrew

Re-inserting a record after delete
Gianni, Andrew 17:03 on 06 Apr 2005

Re: Re-inserting a record after delete
Michael Peters 17:19 on 06 Apr 2005

Re: Re-inserting a record after delete
Kingsley Kerce 17:30 on 06 Apr 2005

Generated at 06:54 on 17 May 2005 by mariachi v0.52