From: Matt S Trout Date: Fri, 17 May 2019 02:21:59 +0000 (+0000) Subject: add CAST() to ExtraClauses X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a867b2dfb0f51b31546cbf74e886b3d4ebe00c6f;p=scpubgit%2FQ-Branch.git add CAST() to ExtraClauses --- diff --git a/lib/SQL/Abstract/ExtraClauses.pm b/lib/SQL/Abstract/ExtraClauses.pm index 2dafda1..a632896 100644 --- a/lib/SQL/Abstract/ExtraClauses.pm +++ b/lib/SQL/Abstract/ExtraClauses.pm @@ -176,6 +176,13 @@ sub register_defaults { for qw(with with_recursive); $self->clause_renderer("${stmt}.with", $with_renderer); } + $self->expander(cast => sub { + my ($cast, $to) = @{$_[2]}; + +{ -func => [ cast => { -as => [ + $self->expand_expr($cast), + $self->expand_expr($to, -ident), + ] } ] }; + }); return $self; }