Commit | Line | Data |
327368bc |
1 | use strict; |
2 | use warnings; |
3 | |
4 | use Test::More; |
5 | |
6 | use lib qw(t/lib); |
7 | use DBICTest; |
8 | use DBIC::SqlMakerTest; |
9 | |
10 | my $s = DBICTest->init_schema (no_deploy => 1, ); |
11 | $s->storage->sql_maker->limit_dialect ('RowNum'); |
12 | |
13 | my $rs = $s->resultset ('CD'); |
14 | |
15 | is_same_sql_bind ( |
16 | $rs->search ({}, { rows => 1, offset => 3,columns => [ |
17 | { id => 'foo.id' }, |
18 | { 'bar.id' => 'bar.id' }, |
19 | { bleh => \ 'TO_CHAR (foo.womble, "blah")' }, |
20 | ]})->as_query, |
21 | '(SELECT id, bar__id, bleh |
22 | FROM ( |
23 | SELECT id, bar__id, bleh, ROWNUM rownum__index |
24 | FROM ( |
25 | SELECT foo.id AS id, bar.id AS bar__id, TO_CHAR(foo.womble, "blah") AS bleh |
26 | FROM cd me |
27 | ) me |
28 | ) me |
29 | WHERE rownum__index BETWEEN 4 AND 4 |
30 | )', |
31 | [], |
32 | 'Rownum subsel aliasing works correctly' |
33 | ); |
34 | |
f8583f8f |
35 | is_same_sql_bind ( |
36 | $rs->search ({}, { rows => 1, offset => 3,columns => [ |
37 | { id => 'foo.id' }, |
38 | { 'ends_with_me.id' => 'ends_with_me.id' }, |
39 | ]})->as_query, |
40 | '(SELECT id, ends_with_me__id |
41 | FROM ( |
42 | SELECT id, ends_with_me__id, ROWNUM rownum__index |
43 | FROM ( |
44 | SELECT foo.id AS id, ends_with_me.id AS ends_with_me__id |
45 | FROM cd me |
46 | ) me |
47 | ) me |
48 | WHERE rownum__index BETWEEN 4 AND 4 |
49 | )', |
50 | [], |
51 | 'Rownum subsel aliasing works correctly' |
52 | ); |
53 | |
327368bc |
54 | done_testing; |