when we both select and order by the result of the same subquery
- Fix the Sybase hubrid limit dialect (RowCountOrGenericSubQ) losing
Group/Having/Order clauses when called without an offset (RT#73244)
+ - No longer generate incorrect SQL on ->as_query called on resultsets
+ with software_limit enabled
- A number of corner case fixes of void context populate() with \[]
- Fix corner case of forked children disconnecting the parents DBI
handle
Specifies the (zero-based) row number for the first row to be returned, or the
of the first row of the first page if paging is used.
+=head2 software_limit
+
+=over 4
+
+=item Value: (0 | 1)
+
+=back
+
+When combined with L</rows> and/or L</offset> the generated SQL will not
+include any limit dialect stanzas. Instead the entire result will be selected
+as if no limits were specified, and DBIC will perform the limit locally, by
+artificially advancing and finishing the resulting L</cursor>.
+
+This is the recommended way of performing resultset limiting when no sane RDBMS
+implementation is available (e.g.
+L<Sybase ASE|DBIx::Class::Storage::DBI::Sybase::ASE> using the
+L<Generic Sub Query|DBIx::Class::SQLMaker::LimitDialects/GenericSubQ> hack)
+
=head2 group_by
=over 4
databases. It works by ordering the set by some unique column, and calculating
the amount of rows that have a less-er value (thus emulating a L</RowNum>-like
index). Of course this implies the set can only be ordered by a single unique
-column. Also note that this technique can be and often is B<excruciatingly
-slow>.
+column.
+
+Also note that this technique can be and often is B<excruciatingly slow>. You
+may have much better luck using L<DBIx::Class::ResultSet/software_limit>
+instead.
Currently used by B<Sybase ASE>, due to lack of any other option.
sub _select_args_to_query {
my $self = shift;
+ $self->throw_exception(
+ "Unable to generate limited query representation with 'software_limit' enabled"
+ ) if ($_[3]->{software_limit} and ($_[3]->{offset} or $_[3]->{rows}) );
+
# my ($op, $ident, $select, $cond, $rs_attrs, $rows, $offset)
# = $self->_select_args($ident, $select, $cond, $attrs);
my ($op, $ident, @args) =
use warnings;
use Test::More;
+use Test::Exception;
use lib qw(t/lib);
use DBICTest;
);
is( $cds[0]->title, "Spoonful of bees", "software offset ok" );
+throws_ok {
+ $schema->resultset("CD")->search({}, {
+ rows => 2,
+ software_limit => 1,
+ })->as_query;
+} qr/Unable to generate limited query representation with 'software_limit' enabled/;
@cds = $schema->resultset("CD")->search( {},
{
);
is( $cds[0]->title, "Spoonful of bees", "offset with no limit" );
-
-# based on a failing criteria submitted by waswas
-# requires SQL::Abstract >= 1.20
$it = $schema->resultset("CD")->search(
{ title => [
-and =>