use Moose::Util::TypeConstraints;
use MooseX::Types::Moose qw/ArrayRef Str Int HashRef CodeRef/;
use MooseX::AttributeHelpers;
- use SQL::Abstract::Types qw/NameSeparator QuoteChars AST HashAST ArrayAST/;
+ use SQL::Abstract::Types qw/NameSeparator QuoteChars AST/;
use Devel::PartialDump qw/dump/;
clean;
our %BINOP_MAP = (
'>' => '>',
+ '>=' => '>=',
'<' => '<',
+ '<=' => '<=',
'==' => '=',
'!=' => '!=',
# LIKE is always "field LIKE <value>"
- '-like' => 'LIKE',
- '-not_like' => 'NOT LIKE',
+ 'like' => 'LIKE',
+ 'not_like' => 'NOT LIKE',
);
has expr_dispatch_table => (
is => 'rw',
isa => NameSeparator,
default => '.',
- coerece => 1,
required => 1,
);
has quote_chars => (
is => 'rw',
isa => QuoteChars,
- coerece => 1,
predicate => 'is_quoting',
clearer => 'disable_quoting',
+ coerce => 1,
);
has binds => (
);
# TODO: once MXMS supports %args, use that here
+ # TODO: improve this so you can pass other args
method create(ClassName $class: Int $ver) {
croak "AST version $ver is greater than supported version of $AST_VERSION"
if $ver > $AST_VERSION;
}
# Main entry point
- method generate(ClassName $class: HashAST $ast) {
+ method generate(ClassName $class: AST $ast) {
my $ver = $ast->{-ast_version};
croak "SQL::Abstract AST version not specified"
unless defined $ver;
method dispatch (AST $ast) {
-
- # I want multi methods!
- my $tag;
- if (is_ArrayAST($ast)) {
- confess "FIX: " . dump($ast);
- } else {
- $tag = "_" . $ast->{-type};
- }
+ my $tag = "_" . $ast->{-type};
my $meth = $self->can($tag) || croak "Unknown tag '$tag'";
return $meth->($self, $ast);