From: Matt S Trout Date: Wed, 6 Mar 2019 02:02:12 +0000 (+0000) Subject: introduce _expand_ident method, use for update X-Git-Tag: v2.000000~3^2~405 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6c04c036dbd2103c76e92a18890245d26b81c686;p=dbsrgits%2FSQL-Abstract.git introduce _expand_ident method, use for update --- diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm index 0425268..1febc93 100644 --- a/lib/SQL/Abstract.pm +++ b/lib/SQL/Abstract.pm @@ -390,7 +390,7 @@ sub _expand_update_set_values { map { my ($k, $set) = @$_; $set = { -bind => $_ } unless defined $set; - +{ -op => [ '=', { -ident => $k }, $set ] }; + +{ -op => [ '=', $self->_expand_ident(-ident => $k), $set ] }; } map { my $k = $_; @@ -902,6 +902,13 @@ sub _expand_expr_hashpair { die "notreached"; } +sub _expand_ident { + my ($self, undef, $body) = @_; + my @parts = map split(/\Q${\($self->{name_sep}||'.')}\E/, $_), + ref($body) ? @$body : $body; + return +{ -ident => \@parts }; +} + sub _recurse_where { my ($self, $where, $logic) = @_;