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;