[CDBI] Missing TEMP data

Perrin Harkins perrin at elem.com
Fri Jan 13 17:01:14 GMT 2006


Bill Moseley wrote:
> Are you saying that the above select returns, _init() is called for a
> row that is already in the live object index and that object is
> returned so _attribute_store is never called (and thus class_count column
> isn't copied to the object)?

Yes.

> Maybe I'm missing something, but if _init() is called why doesn't it
> always update the object?

There was a lengthy discussion about this on the old list.  One reason 
is that you might have changed some values in the object.  Someone had a 
patch for checking this which they posted to the list.  I don't use this 
TEMP approach or the live objects index, so I didn't pursue it.

> By make a class_count method you mean make a method that does the
> execute and sth_to_objects?

I mean make a method that literally returns the count.  Probably I would 
take your current set_sql, remove everything from it but the count, and 
make a wrapper method that calls it and returns that value.  I do this 
frequently in my CDBI classes.

For the actual objects, just fetch them as you were, and leave out the 
count.

- Perrin




More information about the ClassDBI mailing list