Re: [CDBI] Missing TEMP data

[prev] [thread] [next] [Date index for 2006/01/13]

From: Bill Moseley
Subject: Re: [CDBI] Missing TEMP data
Date: 16:40 on 13 Jan 2006
On Fri, Jan 13, 2006 at 10:36:30AM -0500, Perrin Harkins wrote:
> Bill Moseley wrote:
> >I have a query that returns a list of "instructors" and a count() of
> >the number of classes they are teaching.  The count() is in a TEMP
> >column.  I'm using seq_sql for the query:
> >
> >    package Person;
> >
> >    __PACKAGE__->columns( TEMP => 'class_count' );
> >    __PACKAGE__->set_sql('count_classes', <<'' );
> >        SELECT      me.id, me.first_name, me.last_name,  COUNT(class.id) 
> >        AS class_count
> >        FROM        %s
> >        WHERE       %s
> >        GROUP BY    me.id, me.first_name, me.last_name
> >        %s
> 
> This will clash with the object index because it has no way to know that 
> a version with the TEMP column filled in is not the same as one without 
> it.  You'll need to either disable the object index, or not use this 
> kind of TEMP column cheat, e.g. make a class_count  method instead.

Lack of sleep isn't helping.  I'd like to understand so I can
duplicate the problem.

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)?

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

By make a class_count method you mean make a method that does the
execute and sth_to_objects?  The problem with that is I'm not running
through the Sweet pager code.



        -- 
        Bill Moseley
moseley@xxxx.xxx


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

(message missing)

[CDBI] Missing TEMP data
Bill Moseley 15:02 on 13 Jan 2006

Re: [CDBI] Missing TEMP data
William Ross 15:23 on 13 Jan 2006

Re: [CDBI] Missing TEMP data
Perrin Harkins 15:36 on 13 Jan 2006

Re: [CDBI] Missing TEMP data
Bill Moseley 16:40 on 13 Jan 2006

Re: [CDBI] Missing TEMP data
Perrin Harkins 17:01 on 13 Jan 2006

Re: [CDBI] Missing TEMP data
Bill Moseley 17:27 on 13 Jan 2006

Re: [CDBI] Missing TEMP data
Perrin Harkins 18:31 on 13 Jan 2006

Re: [CDBI] Missing TEMP data
Bill Moseley 19:05 on 13 Jan 2006

Generated at 09:31 on 23 Jan 2006 by mariachi v0.52