Start porting more back compat changes
[dbsrgits/SQL-Abstract-2.0-ish.git] / lib / SQL / Abstract.pm
index 95178a4..d987fd7 100644 (file)
@@ -8,7 +8,7 @@ class SQL::Abstract {
   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;
@@ -31,8 +31,8 @@ class SQL::Abstract {
     '==' => '=',
     '!=' => '!=',
     # LIKE is always "field LIKE <value>"
-    '-like' => 'LIKE',
-    '-not_like' => 'NOT LIKE',
+    'like' => 'LIKE',
+    'not_like' => 'NOT LIKE',
   );
 
   has expr_dispatch_table => (
@@ -110,6 +110,7 @@ class SQL::Abstract {
   );
 
   # 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;
@@ -121,7 +122,7 @@ class SQL::Abstract {
   }
 
   # 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;
@@ -138,14 +139,7 @@ class SQL::Abstract {
 
   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);