[CDBI] Updating a record - slight change proposal

William Ross will at spanner.org
Wed Sep 7 15:33:49 BST 2005

On 7 Sep 2005, at 14:41, Hartmaier Alexander wrote:

> Hi!
> I already sent a patch to Tony including a test at the time he  
> released
> 0.999.
> The wrote that he will look at it to include in 1.00 but after the
> controversies on the list Tony never replied about it.

Looking at your patch, it works in the same way as Kate's proposed  
change. There are at least two problems with this:

* not all objects will stringify to the value that is stored in the  
database. To be sure that you are comparing the values that would be  
stored, you would have to use Class::DBI's deflation mechanism to  
make the comparison. That's possible but it won't be very nice, and  
it might be awkward for people whose deflation methods have side  
effects. Which they probably shouldn't.

* lazy loading means that very often the existing value of the column  
you are setting has not been retrieved when you come to supply a new  
value, so no comparison is possible unless you retrieve that column  

Both of these problems would only lead to false negatives - ie you  
would wrongly find that a column had changed - so perhaps they don't  
matter that much, but they create fuzziness and irregularity:  
sometimes this will happen, sometimes that. The present setup is  
arguably less efficient, but much cleaner and easier to work with.

I believe that it's this kind of complication that made Tony decide  
to refactor the whole object/column/attribute model rather than  
trying to stretch the existing code any further. I don't know whether  
we will ever see that code.



More information about the ClassDBI mailing list