Skip Menu |

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

Report information
The Basics
Id: 42988
Status: resolved
Worked: 20 min
Priority: 0/
Queue: DBIx-SearchBuilder

People
Owner: RUZ [...] cpan.org
Requestors: CYGA [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.51
Fixed in: (no value)



Subject: RowsPerPage(0) has no effect
Version: --snip package DBIx::SearchBuilder; ... our $VERSION = "1.51"; --snap When try to apply "->RowsPerPage(0)" it won't take effect. I will attach minimal example with code + patch for it.
Subject: eg.pl
package bug; use base qw/DBIx::SearchBuilder::Record/; sub _Init { my $self = shift; $self->Table('Articles'); $self->SUPER::_Init(@_); } 1; package bugs; use base qw/DBIx::SearchBuilder/; sub _Init { my $self = shift; $self->Table('Articles'); return $self->SUPER::_Init(@_); } sub NewItem { my $self = shift; return(bug->new); } package main; use DBIx::SearchBuilder::Handle; use Data::Dumper; my $handle = DBIx::SearchBuilder::Handle->new(); $handle->Connect( Driver => 'mysql', Database => 'kb', User => 'root', Password => '123' ); my $bugs = bugs->new( Handle => $handle ); $bugs->UnLimit(); $bugs->RowsPerPage(0); my $bug = $bugs->Next(); print Dumper($bug);
Subject: DBI.patch
--- DBIx/SearchBuilder/Handle.pm 2009-02-03 15:19:58.000000000 +0600 +++ DBIx/SearchBuilder/Handle.pm.fixed 2009-02-03 15:19:48.000000000 +0600 @@ -841,9 +841,9 @@ my $limit_clause = ''; - if ( $per_page) { + if ( defined $per_page) { $limit_clause = " LIMIT "; - if ( $first ) { + if ( defined $first ) { $limit_clause .= $first . ", "; } $limit_clause .= $per_page;
Hello, What effect do you want? RowsPerPage(0) means "forget about previouse paging settings, we want all records". I've documented this and added tests. On Tue Feb 03 04:44:48 2009, CYGA wrote: Show quoted text
> Version: > --snip > package DBIx::SearchBuilder; > ... > our $VERSION = "1.51"; > --snap > > When try to apply "->RowsPerPage(0)" it won't take effect. > > I will attach minimal example with code + patch for it.
-- Best regards, Ruslan.
Hello Ruslan. Please, see my comments inline. Пнд Мар 22 10:25:39 2010, RUZ писал: Show quoted text
> Hello, > > What effect do you want? RowsPerPage(0) means "forget about previouse > paging settings, we want all records". > > I've documented this and added tests.
hmm, I can't see it on cpan: http://search.cpan.org/~ruz/DBIx-SearchBuilder-1.56/SearchBuilder.pm#RowsPerPage --snip RowsPerPage Limits the number of rows returned by the database. Optionally, takes an integer which restricts the # of rows returned in a result Returns the number of rows the database should display. FirstRow Get or set the first row of the result set the database should return. Takes an optional single integer argrument. Returns the currently set integer first row that the database should return. --snap Besides of that, module uses sql: " LIMIT OFFSET,ROW_COUNT" zero value for both OFFSET & ROW_COUNT is meaningful. Let's use it if specified so! If I wanna to reset them, I will use RowsPerPage(undef) & First(undef) (those will work as expected: set undef to corresponding object property). Show quoted text
> > On Tue Feb 03 04:44:48 2009, CYGA wrote:
> > Version: > > --snip > > package DBIx::SearchBuilder; > > ... > > our $VERSION = "1.51"; > > --snap > > > > When try to apply "->RowsPerPage(0)" it won't take effect. > > > > I will attach minimal example with code + patch for it.
Ok, have done another pass on documentation. Read the following variant: http://github.com/bestpractical/dbix- searchbuilder/blob/master/SearchBuilder.pm#L1211 Is it better now? On Mon Mar 22 13:26:11 2010, CYGA wrote: Show quoted text
> Hello Ruslan. > > Please, see my comments inline. > > Пнд Мар 22 10:25:39 2010, RUZ писал:
> > Hello, > > > > What effect do you want? RowsPerPage(0) means "forget about
> previouse
> > paging settings, we want all records". > > > > I've documented this and added tests.
> > hmm, I can't see it on cpan: > http://search.cpan.org/~ruz/DBIx-SearchBuilder- > 1.56/SearchBuilder.pm#RowsPerPage > --snip > RowsPerPage > > Limits the number of rows returned by the database. Optionally, takes > an integer > which restricts the # of rows returned in a result Returns the number > of rows the > database should display. > > FirstRow > > Get or set the first row of the result set the database should return. > Takes an > optional single integer argrument. Returns the currently set integer > first row that > the database should return. > --snap > > Besides of that, module uses sql: " LIMIT OFFSET,ROW_COUNT" > zero value for both OFFSET & ROW_COUNT is meaningful. > Let's use it if specified so! > > If I wanna to reset them, I will use RowsPerPage(undef) & First(undef) > (those will > work as expected: set undef to corresponding object property). > >
> > > > On Tue Feb 03 04:44:48 2009, CYGA wrote:
> > > Version: > > > --snip > > > package DBIx::SearchBuilder; > > > ... > > > our $VERSION = "1.51"; > > > --snap > > > > > > When try to apply "->RowsPerPage(0)" it won't take effect. > > > > > > I will attach minimal example with code + patch for it.
> >
-- Best regards, Ruslan.
Hi, I've updated code with a few changes. We get sane NextPage and PrevPage functions in next release. Also, all page walking related functions are docummented, now. I'm resolving this ticket. Feel free to open if you still have question. On Mon Mar 22 15:44:11 2010, RUZ wrote: Show quoted text
> Ok, have done another pass on documentation. Read the following > variant: > > http://github.com/bestpractical/dbix- > searchbuilder/blob/master/SearchBuilder.pm#L1211 > > Is it better now? > > On Mon Mar 22 13:26:11 2010, CYGA wrote:
> > Hello Ruslan. > > > > Please, see my comments inline. > > > > Пнд Мар 22 10:25:39 2010, RUZ писал:
> > > Hello, > > > > > > What effect do you want? RowsPerPage(0) means "forget about
> > previouse
> > > paging settings, we want all records". > > > > > > I've documented this and added tests.
> > > > hmm, I can't see it on cpan: > > http://search.cpan.org/~ruz/DBIx-SearchBuilder- > > 1.56/SearchBuilder.pm#RowsPerPage > > --snip > > RowsPerPage > > > > Limits the number of rows returned by the database. Optionally,
takes Show quoted text
> > an integer > > which restricts the # of rows returned in a result Returns the
number Show quoted text
> > of rows the > > database should display. > > > > FirstRow > > > > Get or set the first row of the result set the database should return. > > Takes an > > optional single integer argrument. Returns the currently set integer > > first row that > > the database should return. > > --snap > > > > Besides of that, module uses sql: " LIMIT OFFSET,ROW_COUNT" > > zero value for both OFFSET & ROW_COUNT is meaningful. > > Let's use it if specified so! > > > > If I wanna to reset them, I will use RowsPerPage(undef) &
First(undef) Show quoted text
> > (those will > > work as expected: set undef to corresponding object property). > > > >
> > > > > > On Tue Feb 03 04:44:48 2009, CYGA wrote:
> > > > Version: > > > > --snip > > > > package DBIx::SearchBuilder; > > > > ... > > > > our $VERSION = "1.51"; > > > > --snap > > > > > > > > When try to apply "->RowsPerPage(0)" it won't take effect. > > > > > > > > I will attach minimal example with code + patch for it.
> > > >
-- Best regards, Ruslan.