FetchFirst does not inject an order because me.title is unique
[dbsrgits/DBIx-Class.git] / t / sqlmaker / limit_dialects / custom.t
1 use strict;
2 use warnings;
3
4 use Test::More;
5
6 use lib qw(t/lib);
7 use DBICTest;
8 use DBICTest::Schema;
9 use DBIC::SqlMakerTest;
10
11 # This is legacy stuff from SQL::Absract::Limit
12 # Keep it around just in case someone is using it
13
14 {
15   package DBICTest::SQLMaker::CustomDialect;
16   use base qw/DBIx::Class::SQLMaker/;
17   sub emulate_limit {
18     my ($self, $sql, $rs_attrs, $limit, $offset) = @_;
19     return sprintf ('shiny sproc ((%s), %d, %d)',
20       $sql,
21       $limit || 0,
22       $offset || 0,
23     );
24   }
25 }
26 my $s = DBICTest::Schema->connect (DBICTest->_database);
27 $s->storage->sql_maker_class ('DBICTest::SQLMaker::CustomDialect');
28
29 my $rs = $s->resultset ('CD');
30
31 ok(!eval { $rs->all }, 'Legacy emulate_limit method dies');
32
33 done_testing;