Commit | Line | Data |
d5dedbd6 |
1 | use strict; |
2 | use warnings; |
3 | |
4 | use Test::More; |
67341081 |
5 | use Test::Warn; |
d5dedbd6 |
6 | |
7 | use lib qw(t/lib); |
d9c17594 |
8 | use DBICTest; |
d5dedbd6 |
9 | use DBICTest::Schema; |
10 | use DBIC::SqlMakerTest; |
11 | |
12 | # This is legacy stuff from SQL::Absract::Limit |
13 | # Keep it around just in case someone is using it |
14 | |
15 | { |
16 | package DBICTest::SQLMaker::CustomDialect; |
17 | use base qw/DBIx::Class::SQLMaker/; |
18 | sub emulate_limit { |
19 | my ($self, $sql, $rs_attrs, $limit, $offset) = @_; |
20 | return sprintf ('shiny sproc ((%s), %d, %d)', |
21 | $sql, |
22 | $limit || 0, |
23 | $offset || 0, |
24 | ); |
25 | } |
26 | } |
d9c17594 |
27 | my $s = DBICTest::Schema->connect (DBICTest->_database); |
d5dedbd6 |
28 | $s->storage->sql_maker_class ('DBICTest::SQLMaker::CustomDialect'); |
29 | |
30 | my $rs = $s->resultset ('CD'); |
67341081 |
31 | |
32 | warnings_exist { is_same_sql_bind ( |
d5dedbd6 |
33 | $rs->search ({}, { rows => 1, offset => 3,columns => [ |
34 | { id => 'foo.id' }, |
95e41036 |
35 | { 'artist.id' => 'bar.id' }, |
d5dedbd6 |
36 | { bleh => \ 'TO_CHAR (foo.womble, "blah")' }, |
37 | ]})->as_query, |
38 | '( |
39 | shiny sproc ( |
40 | ( |
41 | SELECT foo.id, bar.id, TO_CHAR (foo.womble, "blah") |
42 | FROM cd me |
43 | ), |
44 | 1, |
45 | 3 |
46 | ) |
47 | )', |
48 | [], |
49 | 'Rownum subsel aliasing works correctly' |
67341081 |
50 | )} |
51 | qr/\Qthe legacy emulate_limit() mechanism inherited from SQL::Abstract::Limit has been deprecated/, |
52 | 'deprecation warning' |
53 | ; |
d5dedbd6 |
54 | |
55 | done_testing; |