Michael Peters wrote:
Giannis Economou wrote:

But now you made me really wonder what special care do objects need...
I was about to do that, it would be convenient for me to store instances
of Class::DBI into my session and re-vivifying them later on to write
them to the db.
Is there any suggested way to go for storing objects in session and have
them back solid as they were before serialization in our session?

Bad idea. Class::DBI based objects are just the type that you don't want
to serialize. For one, the underlying data could be changed in the DB
between the time that it's frozen and then later un-thawed (this not
only applies to this object's own data but also any other objects it has
relationships to). Also, Class::DBI has a pretty involved constructor
that will not be run when the object is thawed again which will cause
havoc with the live-object-index. And there are other issues that I
can't think of at this time.

Instead of storing the object, just store the object's id and then
re-fetch that object the next time it's used.

Ok... I see.
The id is a nice way to go, but what can someone do if we are talking about new records that get their ids from the database and C:DBI's create() method does not create any id until the database provides it. The option to abandon automatic (by db) ids is not always possible.

Giannis


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/[email protected]/
             http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to