Select with WHERE
[dbsrgits/SQL-Abstract-2.0-ish.git] / t / 300_order_by.t
CommitLineData
7a56723e 1use strict;
2use warnings;
3
4use Test::More tests => 4;
5use Test::Differences;
6
7use_ok('SQL::Abstract') or BAIL_OUT( "$@" );
8
9my $sqla = SQL::Abstract->create(1);
10
11
12is $sqla->dispatch(
13 { -type => 'order_by', order_by => [ { -type => name => args => [qw/me date/ ] } ] }
14), "ORDER BY me.date",
15 "order by";
16
17is $sqla->dispatch(
18 { -type => 'order_by',
19 order_by => [
20 { -type => name => args => [qw/me date/] },
21 { -type => name => args => [qw/me foobar/] },
22 ]
23 }
24), "ORDER BY me.date, me.foobar",
25 "order by";
26
27# Hrmmm how to mark this up.
28is $sqla->dispatch(
29 { -type => 'order_by',
30 order_by => [
31 [ -desc => { -type => name => args => [qw/me date/ ] } ]
32 ]
33 }
34), "ORDER BY me.date DESC",
35 "order by desc";