[Dbix-class] clear prefetch in resultset.

brett gardner brett at clientcomm.com.au
Tue Jul 10 00:00:45 GMT 2007


I'm using PostgreSQL and yes that fixes the problem.

luke saunders wrote:
> On 7/6/07, *brett gardner* <brett at clientcomm.com.au 
> <mailto:brett at clientcomm.com.au>> wrote:
>
>     Any pointers / examples on how to write a test file?
>
>
> I just added a test to t/88result_set_column.t in SVN to illustrate 
> your problem. It was a bit messy since SQLite doesn't actually barf, 
> but it should be okay. What DB are you using?
>
>     So you are saying that you cannot undo the prefetch?
>
>     If I do the following
>
>     ---------------------
>     my $rs = $app->get_rs_with_prefetch();
>
>     $rs = $rs->search(undef,{prefetch=>undef});
>
>     my $item = $rs->next;
>     ---------------------
>
>     Calling $rs->next still includes the prefetch columns. 
>
>
> That would simply merge undef with whatever the old prefetch clause 
> was. To clear prefetch entirely you would have to do 
> $rs->{attrs}->{prefetch} = undef, but you probably don't want to be 
> doing that.
>
> Fortunately, you shouldn't need to worry about it now since I've fixed 
> the problem. It'll be on CPAN with the next point release but it would 
> be useful if you could grab the latest version from SVN now and check 
> to see if your problem persists. You can get it like so:
>
> svn co http://dev.catalystframework.org/repos/bast/trunk/DBIx-Class
>  
>
>     Matt S Trout wrote:
>     > On Thu, Jul 05, 2007 at 12:49:38PM +1000, brett gardner wrote:
>     >
>     >> Is there anyway to set prefetch to empty on a resultset that is
>     created
>     >> elsewhere?
>     >>
>     >> I have a method in my app that returns a resultset and 99% of
>     the time I
>     >> want a particular relationship to be prefetched. But in one
>     particular
>     >> instance I do not.
>     >>
>     >> I am trying to call $rs->get_column('timestamp_entered')->min.
>     But the
>     >> query is barfing because it adds the prefetched relationship
>     fields to
>     >> the query.
>     >>
>     >
>     > That's a bug in the way get_column is implemented, then. If you
>     could put
>     > together a test file for us, I can get it fixed for the next
>     point release.
>     >
>     >
>
>     _______________________________________________
>     List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
>     Wiki: http://dbix-class.shadowcatsystems.co.uk/
>     IRC: irc.perl.org#dbix-class
>     SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
>     <http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/>
>     Searchable Archive:
>     http://www.mail-archive.com/dbix-class@lists.rawmode.org/
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
> Wiki: http://dbix-class.shadowcatsystems.co.uk/
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
> Searchable Archive: http://www.mail-archive.com/dbix-class@lists.rawmode.org/



More information about the Dbix-class mailing list