op => '_expand_op',
func => '_expand_func',
values => '_expand_values',
- bind => '_expand_noop',
- literal => '_expand_noop',
- keyword => '_expand_noop',
},
expand_op => {
'between' => '_expand_between',
return $self->$exp($op, $v);
}
+ if ($self->{render}{$op}) {
+ return { "-${op}" => $v };
+ }
+
# Ops prefixed with -not_ get converted
if (my ($rest) = $op =~/^not_(.*)$/) {
sub _render_keyword {
my ($self, undef, $keyword) = @_;
- return [ $self->_sqlcase(join ' ', split '_', $keyword) ];
+ return [ $self->_sqlcase(
+ ref($keyword) ? $$keyword : join ' ', split '_', $keyword
+ ) ];
}
sub _render_op {
sub _render_unop_prefix {
my ($self, $op, $v) = @_;
return $self->join_query_parts(' ',
- $self->_sqlcase($op), $v->[0]
+ { -keyword => \$op }, $v->[0]
);
}
}
}
-sub _join_sql_clauses {
- my ($self, $logic, $clauses_aref, $bind_aref) = @_;
-
- if (@$clauses_aref > 1) {
- my $join = " " . $self->_sqlcase($logic) . " ";
- my $sql = '( ' . join($join, @$clauses_aref) . ' )';
- return ($sql, @$bind_aref);
- }
- elsif (@$clauses_aref) {
- return ($clauses_aref->[0], @$bind_aref); # no parentheses
- }
- else {
- return (); # if no SQL, ignore @$bind_aref
- }
-}
-
-
# Fix SQL case, if so requested
sub _sqlcase {
# LDNOTE: if $self->{case} is true, then it contains 'lower', so we