Re: Live_Object interaction with VIEWs

[prev] [thread] [next] [Date index for 2004/07/29]

From: Paul Makepeace
Subject: Re: Live_Object interaction with VIEWs
Date: 20:01 on 29 Jul 2004
Je 2004-07-29 20:05:46 +0100, Perrin Harkins skribis:
> Paul Makepeace said:
> > I have two classes: one that is a view, and one that is a real table
> > that is part of the former's view. I ->update the real table and then
> > pull out the row again via the view. CDBI is providing me with the old
> > row via the Live_Objects cache, I discover after some quality
> > time in perl -d.
> 
> This probably is not related to using a view.  The problem is most likely
> that you are not letting the object holding the row go out of scope before
> querying for it again.  If you show us some code, we can probably tell you
> a few easy ways to fix it.

    my ($perms) = Corrobbo::DBI::UsersAndPermissions->search(@args);
    return undef unless defined $perms;

    if ($permission) { # a 'set' operation
        # Get the underlying table (this is a VIEW)
        my $perm = $perms->user_perm;
        $perm->permission($permission);
        $perm->update;
        $perm->dbi_commit;
        undef $perms;
        ($perms) = Corrobbo::DBI::UsersAndPermissions->search(@args);
    }

    $perms->permission;

So from your advice I put that 'undef' in there which seems to have
solved it. Frankly, it looks really odd to me. On the other hand without
a way to inform CDBI that the view is dependent on a table that has been
CDBI-ified I can't immediately see any other way.

Really, I'd like to be able to update the damn view but I don't imagine
that patch too soon :)

> The technique for skipping the object index for a specific object is
> documented in the Class::DBI pod, and the way to turn off the object index
> completely has been shown a few times on the list.  Here it is:
> $Class::DBI::Weaken_Is_Available = 0;

Thanks. I'll catch up with 1,200 new messages eventually...

Paul

        -- 
        Paul Makepeace .............................. http://paulm.com/inchoate/

"If you have an extra dollar, then I wouldn't be drunk."
   -- http://paulm.com/toys/surrealism/

Live_Object interaction with VIEWs
Paul Makepeace 18:24 on 29 Jul 2004

Re: Live_Object interaction with VIEWs
Perrin Harkins 19:05 on 29 Jul 2004

Re: Live_Object interaction with VIEWs
Paul Makepeace 20:01 on 29 Jul 2004

Re: Live_Object interaction with VIEWs
Perrin Harkins 21:21 on 02 Aug 2004

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