From: Matt S Trout Date: Wed, 3 Apr 2019 00:00:39 +0000 (+0000) Subject: transplant DBIC test X-Git-Tag: v2.000000~3^2~284 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b1c1fe1a9e3a34c98902f887a33f8e9614e053f9;p=dbsrgits%2FSQL-Abstract.git transplant DBIC test --- 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) {