method _list(AST $ast) {
+ return "" unless $ast->{args};
+
my @items = is_ArrayRef($ast->{args})
? @{$ast->{args}}
: $ast->{args};
croak "'$op' is not a valid AST type in an expression with " . dump($ast)
if $ast->{-type} ne 'expr';
- croak "'$op' is not a valid operator in an expression with " . dump($ast);
+ # This is an attempt to do some form of validation on function names. This
+ # might end up being a bad thing.
+ croak "'$op' is not a valid operator in an expression with " . dump($ast)
+ if $op =~ /\W/;
+
+ return $self->_generic_function_op($ast);
}
);
}
+ method _generic_function_op(AST $ast) {
+ my $op = $ast->{op};
+
+ return "$op(" . $self->_list($ast) . ")";
+ }
+
method _in(AST $ast) {
my ($field,@values) = @{$ast->{args}};
")";
}
- method _generic_func(ArrayRef $ast) {
- }
-
# 'constants' that are portable across DBs
method _false($ast?) { "0 = 1" }
method _true($ast?) { "1 = 1" }