remove vestigial dwarn
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / SQLMaker / Converter / Oracle.pm
CommitLineData
10cef607 1package DBIx::Class::SQLMaker::Converter::Oracle;
2
3use Data::Query::ExprHelpers;
4use Moo;
5use namespace::clean;
6
7extends 'DBIx::Class::SQLMaker::Converter';
8
9around _where_hashpair_to_dq => sub {
10 my ($orig, $self) = (shift, shift);
11 my ($k, $v, $logic) = @_;
12 if (ref($v) eq 'HASH' and (keys %$v == 1) and lc((keys %$v)[0]) eq '-prior') {
13 my $rhs = $self->_expr_to_dq((values %$v)[0]);
14 return $self->_op_to_dq(
15 $self->{cmp}, $self->_ident_to_dq($k), $self->_op_to_dq(PRIOR => $rhs)
16 );
17 } else {
18 return $self->$orig(@_);
19 }
20};
21
22around _apply_to_dq => sub {
23 my ($orig, $self) = (shift, shift);
24 my ($op, $v) = @_;
25 if ($op eq 'PRIOR') {
26 return $self->_op_to_dq(PRIOR => $self->_expr_to_dq($v));
27 } else {
28 return $self->$orig(@_);
29 }
30};
31
32around _insert_to_dq => sub {
33 my ($orig, $self) = (shift, shift);
34 my (undef, undef, $options) = @_;
35 my $dq = $self->$orig(@_);
36 my $ret_count = @{$dq->{returning}};
37 @{$options->{returning_container}} = (undef) x $ret_count;
38 my $into = [
39 map {
40 my $r_dq = $dq->{returning}[$_];
41 no warnings 'once';
10cef607 42 local $SQL::Abstract::Converter::Cur_Col_Meta = (
43 is_Identifier($r_dq)
44 ? join('.', @{$r_dq->{elements}})
45 : ((is_Literal($r_dq) and !ref($r_dq->{literal})
46 and $r_dq->{literal} =~ /^\w+$/)
47 ? $r_dq->{literal}
48 : undef)
49 );
50 $self->_value_to_dq(\($options->{returning_container}[$_]));
51 } 0..$ret_count-1
52 ];
53 +{ %$dq, 'Data::Query::Renderer::SQL::Dialect::ReturnInto.into' => $into };
54};
55
561;