Split out the examples into their own POD
[dbsrgits/SQL-Abstract-2.0-ish.git] / lib / SQL / Abstract / Manual / Examples.pod
1 =head1 NAME
2
3 SQL::Abstract::Manual::Specification
4
5 =head1 DESCRIPTION
6
7 These are the examples for the AST
8
9 =head1 EXAMPLES
10
11 The following are example SQL statements and the AST that would represent each
12 one. The SQL used is from the MySQL dialect.
13
14 =over 4
15
16 =item * SELECT 1
17
18   {
19       type => 'select',
20       ast_version => 0.0001,
21       select => [
22           {
23               type  => 'SelectComponent',
24               value => {
25                   type    => 'Value',
26                   subtype => 'number',
27                   value   => 1,
28               },
29           },
30       ],
31   }
32
33 =item * SELECT NOW() AS time FROM dual AS duality
34
35   {
36       type => 'select',
37       ast_version => 0.0001,
38       select => [
39           {
40               type  => 'SelectComponent',
41               value => {
42                   type     => 'Function',
43                   function => 'NOW',
44               },
45               as => {
46                   type     => 'Identifier',
47                   element1 => 'time',
48               },
49           },
50       ],
51       tables => {
52           type => 'TableIdentifier',
53           value => {
54               type => 'Identifier',
55               element1 => 'dual',
56           },
57           as => 'duality',
58       },
59   }
60
61 =item * SELECT 1 FROM foo LEFT OUTER JOIN bar ON ( foo.col1 = bar.col2 )
62
63   {
64       type => 'select',
65       ast_version => 0.0001,
66       select => [
67           {
68               type  => 'SelectComponent',
69               value => {
70                   type     => 'Value',
71                   subtype => 'number',
72                   value   => 1,
73               },
74           },
75       ],
76       tables => {
77           type => 'Operator',
78           op   => 'LEFT OUTER',
79           args => [
80               {
81                   type => 'TableIdentifier',
82                   value => {
83                       type => 'Identifier',
84                       element1 => 'foo',
85                   },
86               },
87               {
88                   type => 'TableIdentifier',
89                   value => {
90                       type => 'Identifier',
91                       element1 => 'bar',
92                   },
93               },
94           ],
95           on => {
96               type => 'Operator',
97               op   => '=',
98               args => [
99                   {
100                       type     => 'Identifier',
101                       element1 => 'foo',
102                       element2 => 'col1',
103                   },
104                   {
105                       type     => 'Identifier',
106                       element1 => 'bar',
107                       element2 => 'col2',
108                   },
109               ],
110           },
111       },
112   }
113
114 =back
115
116 =head1 AUTHORS
117
118 robkinyon: Rob Kinyon C<< <rkinyon@cpan.org> >>
119
120 =head1 LICENSE
121
122 You may distribute this code under the same terms as Perl itself.
123
124 =cut