X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F08special_ops.t;h=c4b303e7b5ab616f8b26c35118b2a93d5041c3ac;hb=a8e661847de3ebb2a4bd3613b375f6850370d507;hp=131f99e7efdf9b55179d3898d5ac560e0b0057fc;hpb=96a8d74ae88910d8d8b291c5213b5463eb0f8b2b;p=scpubgit%2FQ-Branch.git diff --git a/t/08special_ops.t b/t/08special_ops.t index 131f99e..c4b303e 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,16 @@ my @tests = ( bind => [ { json => { bar => 'baz' } } ], }, + # Verify inconsistent behaviour from DBIx::Class:SQLMaker::Oracle works + # (unary use of special op is not equivalent to special op + =) + { + where => { + foo_id => { '=' => { '-prior' => { -ident => 'bar_id' } } }, + baz_id => { '-prior' => { -ident => 'quux_id' } }, + }, + stmt => ' WHERE ( baz_id = PRIOR quux_id AND foo_id = ( PRIOR bar_id ) )', + bind => [], + }, ); for (@tests) {