From: Matt S Trout Date: Wed, 17 Apr 2019 02:01:55 +0000 (+0000) Subject: statement_list and test X-Git-Tag: v2.000000~3^2~216 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=08a26ed63ec442af166da0bdd837339df4898536;p=dbsrgits%2FSQL-Abstract.git statement_list and test --- diff --git a/lib/SQL/Abstract/Clauses.pm b/lib/SQL/Abstract/Clauses.pm index a6ba62d..cb9d07b 100644 --- a/lib/SQL/Abstract/Clauses.pm +++ b/lib/SQL/Abstract/Clauses.pm @@ -311,6 +311,8 @@ BEGIN { } } +sub statement_list { sort keys ${$_[0]}{clauses_of} } + sub clauses_of { my ($self, $of, @clauses) = @_; unless (@clauses) { diff --git a/xt/clauses.t b/xt/clauses.t index 399fc66..a20bd67 100644 --- a/xt/clauses.t +++ b/xt/clauses.t @@ -6,6 +6,11 @@ use SQL::Abstract::ExtraClauses; my $sqlac = SQL::Abstract::ExtraClauses->new(unknown_unop_always_func => 1); +is_deeply( + [ $sqlac->statement_list ], + [ sort qw(select update insert delete) ], +); + my ($sql, @bind) = $sqlac->select({ select => [ qw(artist.id artist.name), { -json_agg => 'cd' } ], from => [