RE: Class::DBI::FromCGI and is_changed

[prev] [thread] [next] [Date index for 2004/10/26]

From: Kingsley Kerce
Subject: RE: Class::DBI::FromCGI and is_changed
Date: 19:42 on 26 Oct 2004
Charles Bailey writes:
 > --On Tuesday, October 26, 2004 7:56 PM +0100 Simon Wilcox  <essuu@xxxxxxxx.xxx> wrote:
 > > On Tue, 26 Oct 2004, Zhuang Li wrote:
 > > > Assuming $cd->year is already '2002' and then $cd->year('2002') is
 > > > called. is_changed() will think $cd->year has been changed although with
 > > > the same value.
 > >
 > > Which is arguably wrong as I now need to pre-process all the args and
 > > compare them against the original values to see if they've really changed
 > > or not.
 > 
 > While I see the intuitive value of your argument, I'm not sure it's a good 
 > idea to ask is_changed() to account for 'equivalent' values, both because 
 > equivalence may be difficult to define in some cases, and because the 
 > necessary comparisons may (in tricky cases) slow down a basic operation.

This issue is essentially equivalent to the following thread.
http://groups.kasei.com/mail/arc/cdbi-talk/2004-10/msg00055.html

Perhaps is_changed() should be renamed to
set_accessors_have_been_used_since_last_update()
because that's currently the true semantics (see the code).
The wording "is_changed" is misleading, or at the very least ambiguous.

Regardless, I agree with Charles's response.  If you need to see
whether an object's values differ from the database, roll your own
comparison code.  By the way, is there a module that attempts such, in
a generic manner?

Kings

Class::DBI::FromCGI and is_changed
Simon Wilcox 12:45 on 26 Oct 2004

Re: Class::DBI::FromCGI and is_changed
Tony Bowden 18:38 on 26 Oct 2004

RE: Class::DBI::FromCGI and is_changed
Zhuang Li 18:51 on 26 Oct 2004

RE: Class::DBI::FromCGI and is_changed
Simon Wilcox 18:56 on 26 Oct 2004

RE: Class::DBI::FromCGI and is_changed
Charles Bailey 19:05 on 26 Oct 2004

RE: Class::DBI::FromCGI and is_changed
Kingsley Kerce 19:42 on 26 Oct 2004

Re: Class::DBI::FromCGI and is_changed
Tony Bowden 08:31 on 27 Oct 2004

Generated at 11:34 on 01 Dec 2004 by mariachi v0.52