Subject: | InterBase / FireBird ROWS broken |
Date: | Thu, 4 Mar 2010 01:39:59 +0000 |
To: | bug-SQL-Abstract-Limit [...] rt.cpan.org |
From: | Sam Watkins <sam [...] nipl.net> |
To select the first 4 rows, it was trying to use like ROWS 0 TO 4,
which fails. It should be ROWS 1 TO 4. Patch:
$ diff -u /usr/lib/perl5/site_perl/5.8.8/SQL/Abstract/Limit.pm Limit.pm
--- /usr/lib/perl5/site_perl/5.8.8/SQL/Abstract/Limit.pm 2008-12-23 08:13:06.000000000 +1100
+++ Limit.pm 2010-03-04 12:32:11.000000000 +1100
@@ -603,8 +603,9 @@
# InterBase/FireBird
sub _RowsTo {
my ( $self, $sql, $order, $rows, $offset ) = @_;
+ my $first = $offset + 1;
my $last = $rows + $offset;
- $sql .= $self->_order_by( $order ) . " ROWS $offset TO $last";
+ $sql .= $self->_order_by( $order ) . " ROWS $first TO $last";
return $sql;
}