[CDBI] Class::DBI and DESTROY

Steven Mackenzie steven.mackenzie at aptile.co.uk
Thu Nov 10 15:57:22 GMT 2005


Perrin Harkins wrote:
> On Thu, 2005-11-10 at 13:15 +0000, Steven Mackenzie wrote:
> Maybe cdid is not really a unique key of your class, so one CD's DESTROY
> cleans up another one?

cdid is generated by SQLite, and the column is declared INTEGER PRIMARY
KEY, which I think takes care of enforcing uniqueness as well as
sequence generation.

If I try to put in another row with the same PK as an autoinserted row,
my program dies with a message about "Primary key must be UNIQUE".

>  Maybe you have a scoping problem with %
> card_writer_of.  I'm pretty confident that DESTROY is not being called
> on objects that are still in scope.

What the problem feels like now is that row objects are being cloned in
some circunstances, and then the clones are being destroyed.

I get the DESTROY called 3 times for one of my rows: the row id is the
same for each, but the refaddr of the row object is different each time
through.

Any idea what could cause multiple objects to represent the same row?






More information about the ClassDBI mailing list