Re: [CDBI] Class::DBI and Apache::Session - Why does it work?

[prev] [thread] [next] [Date index for 2005/12/02]

From: Brian Gorby
Subject: Re: [CDBI] Class::DBI and Apache::Session - Why does it work?
Date: 23:45 on 02 Dec 2005
On 12/2/05 5:29 PM, Perrin Harkins wrote:
> No, you persisted the complete state of the object at that time.  It
> gets run through Storable.
> 
> By the way -- don't do this!  You might lose updates made in the
> database between the time you store it and retrieve it.  The best way to
> handle this is to put the ID into the session and do a fresh retrieve()
> call when you want the object.

Thanks for the input. I figured it was probably not a good idea to store 
  the entire object in the Session, but I was just curious as to why it 
"worked".

For others running into similar situations, I found the following (only 
after posting originally, of course) related information on the CDBI Wiki:

Objects stored in a (serialized) session object are typically 
unavailable to CDBI's object index. Upshot: Don't store objects there -- 
only store scalars (object ID's, etc.) "The object index works by 
keeping a hash of weak references to all objects in the current process 
as they are loaded from the database. It does this in the constructor. 
Things you put in the session are never loaded from the database again, 
so they don't get registered in the object index. The session just runs 
the object through a Storable::thaw, without calling the constructor."

(http://wiki.class-dbi.com/wiki/Common_problems)

-Brian


_______________________________________________
ClassDBI mailing list
ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi

(message missing)

Re: [CDBI] Class::DBI and Apache::Session - Why does it work?
Brian Gorby 23:45 on 02 Dec 2005

Generated at 11:26 on 05 Dec 2005 by mariachi v0.52