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