Dont use generate method in testing compat ast
[dbsrgits/SQL-Abstract-2.0-ish.git] / lib / SQL / Abstract / Compat.pm
CommitLineData
0bcf772f 1use MooseX::Declare;
2
3class SQL::Abstract::Compat {
7c300b3a 4
5 use Moose::Util::TypeConstraints;
bad761ba 6 use MooseX::Types::Moose qw/Str ScalarRef ArrayRef HashRef/;
7 use MooseX::Types -declare => [qw/LogicEnum WhereType/];
7c300b3a 8
9 enum LogicEnum, qw(OR AND);
10
bad761ba 11 subtype WhereType, as Str;
12
7c300b3a 13 clean;
14
15 has logic => (
16 is => 'rw',
17 isa => LogicEnum,
18 default => 'AND'
19 );
20
bad761ba 21
22
7c300b3a 23 method select(Str|ArrayRef|ScalarRef $from, ArrayRef|Str $fields,
24 Str|ScalarRef|ArrayRef|HashRef $where?,
25 Str|ScalarRef|ArrayRef|HashRef $order?) {
26 return ("", );
27 }
28
bad761ba 29 method where(Str|ScalarRef|ArrayRef|HashRef $where,
7c300b3a 30 Str|ScalarRef|ArrayRef|HashRef $order?) {
bad761ba 31
32 my $ast = {
33 -type => 'expr',
34 };
7c300b3a 35 }
bad761ba 36
37 method recurse_where(LogicEsnum $where) {
38
39 }
40
0bcf772f 41}
42
43=head1 NAME
44
45SQL::Abstract::Compant - compatibility layer for SQL::Abstrct v 1.xx
46
47=head1 DESCRIPTION
48
49This class attempts to maintain the original behaviour of version 1 of
50SQL::Abstract. It does this by internally converting to an AST and then using
51the standard AST visitor.
52
53If so desired, you can get hold of this transformed AST somehow. This is aimed
54at libraries such as L<DBIx::Class> that use SQL::Abstract-style arrays or
55hashes as part of their public interface.
56
57=head1 AUTHOR
58
59Ash Berlin C<< <ash@cpan.org> >>
60
61=cut
62
631;