Subject: | emulate limit for Genesis SQL dialect |
Date: | Mon, 27 Apr 2015 11:26:16 +0100 |
To: | bug-DBIx-Class [...] rt.cpan.org |
From: | Robert Rothenberg <rrwo [...] thermeon.com> |
When using rows to limit SQL we get the warning:
Show quoted text
> DBIx::Class::SQLMaker::select(): Support for the legacy emulate_limit()
> mechanism inherited from SQL::Abstract::Limit has been deprecated, and
> will be removed when DBIC transitions to Data::Query. If your code uses
> this type of limit specification please file an RT and provide the source
> of your emulate_limit() implementation, so an acceptable upgrade-path can
> be devised
Genesis SQL's dialect uses
SELECT TOP n
sub emulate_limit {
my ($self, $sql, $rs_attrs, $rows, $offset) = @_;
$sql =~ s/^ \s* SELECT \s+ //ix
or $self->throw_exception("Unrecognizable SELECT: $sql");
return sprintf ('SELECT %s%s%s%s',
$offset
? sprintf('SKIP %u ', $offset)
: ''
,
sprintf('TOP %u ', $rows)
,
$sql,
$self->_parse_rs_attrs ($rs_attrs),
);
}