Skip Menu |
 

This queue is for tickets about the DBIx-SearchBuilder CPAN distribution.

Report information
The Basics
Id: 3839
Status: resolved
Priority: 0/
Queue: DBIx-SearchBuilder

People
Owner: Nobody in particular
Requestors: vlyon [...] uk.yahoo-inc.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.88
Fixed in: (no value)



Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: binary
MIME-Version: 1.0
X-Mailer: MIME-tools 5.405 (Entity 5.404)
Subject: Count() returns incorrect value after a new Limit()
X-RT-Original-Encoding: iso-8859-1
Content-Length: 853
Download (untitled) / with headers
text/plain 853b
In Count() ... # If we haven't actually got all objects loaded in memory, we # really just want to do a quick count from the database. if ( $self->{'must_redo_search'} ) { # If we haven't already asked the database for the row count, do that $self->_DoCount unless ( $self->{'raw_rows'} ); #Report back the raw # of rows in the database return ( $self->{'raw_rows'} ); } ** Problem: $self->{'must_redo_search'} is true, but the new search is not done when a count is requested! Thats because the old value is still in $self->{'raw_rows'}. ** Work around: Call _DoCount() manually which forces it to redo the search and update the row count properly. ** Fix: um, dunno, maybe just do a _DoCount() if $self->{'must_redo_search'} is true, even if $self->{'raw_rows'} is set. (take away the: unless ...)
Return-Path: <jesse [...] fsck.com>
Delivered-To: cpan-bug+dbix-searchbuilder [...] pallas.eruditorum.org
Received: by pallas.eruditorum.org (Postfix, from userid 500) id ECBFA111B8; Mon, 22 Sep 2003 11:17:05 -0400 (EDT)
Date: Mon, 22 Sep 2003 11:17:05 -0400
From: Jesse <jesse [...] fsck.com>
To: rspier [...] pobox.com
CC: bug-dbix-searchbuilder [...] rt.cpan.org
Subject: [fwd] [cpan #3839] Count() returns incorrect value after a new Limit() (from: bug-DBIx-SearchBuilder@rt.cpan.org)
Message-Id: <20030922151705.GJ9987 [...] pallas.fsck.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.5.1i
RT-Send-Cc:
X-RT-Original-Encoding: us-ascii
Content-Length: 1504
Download (untitled) / with headers
text/plain 1.4k
Robrt: iirc this was your SearchBuilder change, no? This message about DBIx-SearchBuilder was sent to you by guest <> via rt.cpan.org Full context and any attached attachments can be found at: <URL: https://rt.cpan.org/Ticket/Display.html?id=3839 > In Count() ... # If we haven't actually got all objects loaded in memory, we # really just want to do a quick count from the database. if ( $self->{'must_redo_search'} ) { # If we haven't already asked the database for the row count, do that $self->_DoCount unless ( $self->{'raw_rows'} ); #Report back the raw # of rows in the database return ( $self->{'raw_rows'} ); } ** Problem: $self->{'must_redo_search'} is true, but the new search is not done when a count is requested! Thats because the old value is still in $self->{'raw_rows'}. ** Work around: Call _DoCount() manually which forces it to redo the search and update the row count properly. ** Fix: um, dunno, maybe just do a _DoCount() if $self->{'must_redo_search'} is true, even if $self->{'raw_rows'} is set. (take away the: unless ...) Show quoted text
----- End forwarded message ----- -- jesse reed vincent -- root@eruditorum.org -- jesse@fsck.com 70EBAC90: 2A07 FC22 7DB4 42C1 9D71 0108 41A3 3FB3 70EB AC90 Any e-mail sent to the SLA will immediately become the intellectual property of the SLA and the author of said message will enter into a period of indentured servitude which will last for a period of time no less than seven years.
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: binary
MIME-Version: 1.0
X-Mailer: MIME-tools 5.405 (Entity 5.404)
X-RT-Original-Encoding: iso-8859-1
Content-Length: 244
Download (untitled) / with headers
text/plain 244b
This happens only if you do a Count() then add a new Limit() and then do another Count The first Count() returns the correct value, but the second one returns the same value as the first even thought the new Limit has reduced the actual count.
Return-Path: <jesse [...] fsck.com>
Delivered-To: cpan-bug+dbix-searchbuilder [...] pallas.eruditorum.org
Received: by pallas.eruditorum.org (Postfix, from userid 500) id 182061111A; Mon, 22 Sep 2003 11:22:38 -0400 (EDT)
Date: Mon, 22 Sep 2003 11:22:38 -0400
From: Jesse <jesse [...] fsck.com>
To: Guest via RT <bug-DBIx-SearchBuilder [...] rt.cpan.org>
Subject: Re: [cpan #3839] Count() returns incorrect value after a new Limit()
Message-Id: <20030922152238.GK9987 [...] pallas.fsck.com>
References: <rt-3839-11107.9.66585589552601 [...] cpan.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <rt-3839-11107.9.66585589552601 [...] cpan.org>
User-Agent: Mutt/1.5.1i
RT-Send-Cc:
X-RT-Original-Encoding: us-ascii
Content-Length: 956
Download (untitled) / with headers
text/plain 956b
Right. I definitely agree that it's a bug. Just getting an opinion on the way it was introduced before we fix it. The raw_rows thing, was, iirc a perf issue being fixed. I don't want to just blow that away. Jesse On Mon, Sep 22, 2003 at 11:20:30AM -0400, Guest via RT wrote: Show quoted text
> > This message about DBIx-SearchBuilder was sent to you by guest <> via rt.cpan.org > > Full context and any attached attachments can be found at: > <URL: https://rt.cpan.org/Ticket/Display.html?id=3839 > > > This happens only if you do a Count() then add a new Limit() and then do > another Count > > The first Count() returns the correct value, but the second one returns > the same value as the first even thought the new Limit has reduced the > actual count. >
-- jesse reed vincent -- root@eruditorum.org -- jesse@fsck.com 70EBAC90: 2A07 FC22 7DB4 42C1 9D71 0108 41A3 3FB3 70EB AC90 Emacs is a pretty good operating system, but Unix has a better editor.
Return-Path: <rspier [...] pobox.com>
Delivered-To: cpan-bug+dbix-searchbuilder [...] pallas.eruditorum.org
Received: from pimout3-ext.prodigy.net (pimout3-ext.prodigy.net [207.115.63.102]) by pallas.eruditorum.org (Postfix) with ESMTP id 9280B11318 for <bug-dbix-searchbuilder [...] rt.cpan.org>; Wed, 24 Sep 2003 01:39:45 -0400 (EDT)
Received: from localhost.localdomain (adsl-64-161-173-250.dsl.lsan03.pacbell.net [64.161.173.250]) by pimout3-ext.prodigy.net (8.12.9/8.12.3) with ESMTP id h8O5dijA137786; Wed, 24 Sep 2003 01:39:44 -0400
Received: from bear.rls.cx (bear [127.0.0.1]) by localhost.localdomain (8.12.8/8.12.8) with ESMTP id h8O5dioW021357; Tue, 23 Sep 2003 22:39:44 -0700
Date: Tue, 23 Sep 2003 22:39:44 -0700
Message-Id: <m37k3yg2xr.wl_rspier [...] pobox.com>
From: Robert Spier <rspier [...] pobox.com>
To: Jesse <jesse [...] fsck.com>
CC: bug-dbix-searchbuilder [...] rt.cpan.org
Subject: Re: [fwd] [cpan #3839] Count() returns incorrect value after a new Limit() (from: bug-DBIx-SearchBuilder@rt.cpan.org)
In-Reply-To: <20030922151705.GJ9987 [...] pallas.fsck.com>
References: <20030922151705.GJ9987 [...] pallas.fsck.com>
User-Agent: Wanderlust/XEmacs/Linux
MIME-Version: 1.0 (generated by SEMI 1.14.5 - "Awara-Onsen")
Content-Type: text/plain; charset=US-ASCII
RT-Send-Cc:
X-RT-Original-Encoding: us-ascii
Content-Length: 1031
Show quoted text
> Robrt: iirc this was your SearchBuilder change, no?
Nope. I don't think so. I think you touched it after I did. raw_rows was yours... I added count_all. The problem that was being fixed was that COUNT() wasn't being used in cases it should have been. I'm pretty sure CountAll is for the pagination thing. Or both. I'm really not sure anymore. The requestor said.. Show quoted text
>This happens only if you do a Count() then add a new Limit() and then >do another Count
This is definitely broken, The idea behind the broken code is to prevent a query... but it's definitely wrong. _DoCount doesn't clear {must_redo_search}, because it doesn't actually fill the datastructures. I think the proper fix is to: 1. whenever checking for q[ if $self->{'must_redo_search'}; ], also check for $self->{items} being empty. 2. _DoCount can then clear must_redo_search. But I'm pretty sure there are two or three less invasive changes. (Especially since I may have done some stupid things with must_redo_search elsewhere.)


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.