3 class SQL::Abstract::Compat {
5 use Moose::Util::TypeConstraints;
6 use MooseX::Types::Moose qw/Str ScalarRef ArrayRef HashRef/;
7 use SQL::Abstract::Types::Compat ':all';
8 use SQL::Abstract::AST::Compat;
9 use SQL::Abstract::AST::v1;
10 use Data::Dump qw/pp/;
12 class_type 'SQL::Abstract';
23 isa => 'SQL::Abstract',
24 clearer => 'clear_visitor',
26 builder => '_build_visitor',
30 method select(Str|ArrayRef|ScalarRef $from, ArrayRef|Str $fields,
35 my $ast = $self->_new_compat_ast->select($from,$fields,$where,$order);
38 return ($self->visitor->dispatch($ast), $self->visitor->binds);
41 method where(WhereType $where,
47 my $ast = $self->_new_compat_ast->generate($where);
48 $ret .= "WHERE " . $self->visitor->_expr($ast);
54 #TODO: Handle logic and similar args later
55 method _new_compat_ast() {
56 return SQL::Abstract::AST::Compat->new;
59 method _build_visitor() {
60 return SQL::Abstract->create(1);
67 SQL::Abstract::Compant - compatibility layer for SQL::Abstrct v 1.xx
71 This class attempts to maintain the original behaviour of version 1 of
72 SQL::Abstract. It does this by internally converting to an AST and then using
73 the standard AST visitor.
75 If so desired, you can get hold of this transformed AST somehow. This is aimed
76 at libraries such as L<DBIx::Class> that use SQL::Abstract-style arrays or
77 hashes as part of their public interface.
81 Ash Berlin C<< <ash@cpan.org> >>