X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F08special_ops.t;fp=t%2F08special_ops.t;h=6b97f96ab6a3f682f415f56dc803b4018eb2eddf;hb=b1c1fe1a9e3a34c98902f887a33f8e9614e053f9;hp=131f99e7efdf9b55179d3898d5ac560e0b0057fc;hpb=8795c188995f2b1759df2f704c34745a454d5c69;p=dbsrgits%2FSQL-Abstract.git diff --git a/t/08special_ops.t b/t/08special_ops.t index 131f99e..6b97f96 100644 --- a/t/08special_ops.t +++ b/t/08special_ops.t @@ -33,6 +33,24 @@ my $sqlmaker = SQL::Abstract->new(special_ops => [ } }, + # PRIOR op from DBIx::Class::SQLMaker::Oracle + + { + regex => qr/^prior$/i, + handler => sub { + my ($self, $lhs, $op, $rhs) = @_; + my ($sql, @bind) = $self->_recurse_where ($rhs); + + $sql = sprintf ('%s = %s %s ', + $self->_convert($self->_quote($lhs)), + $self->_sqlcase ($op), + $sql + ); + + return ($sql, @bind); + }, + }, + ], unary_ops => [ # unary op from Mojo::Pg {regex => qr/^json$/i, @@ -67,6 +85,15 @@ my @tests = ( bind => [ { json => { bar => 'baz' } } ], }, + # Verify inconsistent behaviour from DBIx::Class:SQLMaker::Oracle works + { + where => { + manager_id => { '-prior' => { -ident => 'employee_id' } }, + customer_id => { '>', { '-prior' => \'account_mgr_id' } }, + }, + stmt => ' WHERE ( customer_id > ( PRIOR account_mgr_id ) AND manager_id = PRIOR employee_id )', + bind => [], + }, ); for (@tests) {