Removed Nesting operator and explicated how nesting is explicit via node descent
Rob Kinyon [Thu, 26 Mar 2009 16:15:14 +0000 (12:15 -0400)]
lib/SQL/Abstract/Manual/Examples.pod
lib/SQL/Abstract/Manual/Specification.pod

index c684127..d56f157 100644 (file)
@@ -190,41 +190,36 @@ one. The SQL used is from the MySQL dialect.
                   ],
               },
               {
-                  type => 'Nesting',
+                  type => 'Operator',
+                  op   => 'OR',
                   args => [
                       {
                           type => 'Operator',
-                          op   => 'OR',
+                          op   => '=',
+                          args => [
+                              {
+                                  type     => 'Identifier',
+                                  element1 => 'title',
+                              },
+                              {
+                                  type     => 'Value',
+                                  subtype  => 'String',
+                                  element1 => 'Mr',
+                              },
+                          ],
+                      },
+                      {
+                          type => 'Operator',
+                          op   => '=',
                           args => [
                               {
-                                  type => 'Operator',
-                                  op   => '=',
-                                  args => [
-                                      {
-                                          type     => 'Identifier',
-                                          element1 => 'title',
-                                      },
-                                      {
-                                          type     => 'Value',
-                                          subtype  => 'String',
-                                          element1 => 'Mr',
-                                      },
-                                  ],
+                                  type     => 'Identifier',
+                                  element1 => 'abbrev',
                               },
                               {
-                                  type => 'Operator',
-                                  op   => '=',
-                                  args => [
-                                      {
-                                          type     => 'Identifier',
-                                          element1 => 'abbrev',
-                                      },
-                                      {
-                                          type     => 'Value',
-                                          subtype  => 'String',
-                                          element1 => 'Dr',
-                                      },
-                                  ],
+                                  type     => 'Value',
+                                  subtype  => 'String',
+                                  element1 => 'Dr',
                               },
                           ],
                       },
@@ -234,6 +229,86 @@ one. The SQL used is from the MySQL dialect.
       },
   }
  
+=item SELECT COUNT(*) FROM foo WHERE ( name = 'John' AND title = 'Mr' ) OR abbrev = 'Dr'
+
+  {
+      type => 'select',
+      ast_version => 0.0001,
+      select => [
+          {
+              type  => 'SelectComponent',
+              value => {
+                  type     => 'Identifier',
+                  element1 => '*',
+              },
+          },
+      ],
+      tables => {
+          type => 'TableIdentifier',
+          value => {
+              type => 'Identifier',
+              element1 => 'foo',
+          },
+      },
+      where => {
+          type => 'Operator',
+          op   => 'OR',
+          args => [
+              {
+                  type => 'Operator',
+                  op   => 'AND',
+                  args => [
+                      {
+                          type => 'Operator',
+                          op   => '=',
+                          args => [
+                              {
+                                  type     => 'Identifier',
+                                  element1 => 'name',
+                              },
+                              {
+                                  type     => 'Value',
+                                  subtype  => 'String',
+                                  element1 => 'John',
+                              },
+                          ],
+                      },
+                      {
+                          type => 'Operator',
+                          op   => '=',
+                          args => [
+                              {
+                                  type     => 'Identifier',
+                                  element1 => 'title',
+                              },
+                              {
+                                  type     => 'Value',
+                                  subtype  => 'String',
+                                  element1 => 'Mr',
+                              },
+                          ],
+                      },
+                  ],
+              },
+              {
+                  type => 'Operator',
+                  op   => '=',
+                  args => [
+                      {
+                          type     => 'Identifier',
+                          element1 => 'abbrev',
+                      },
+                      {
+                          type     => 'Value',
+                          subtype  => 'String',
+                          element1 => 'Dr',
+                      },
+                  ],
+              },
+          ],
+      },
+  }
+
 =back
 
 =head1 AUTHORS
index 23ea0b1..4c2cb52 100644 (file)
@@ -327,14 +327,8 @@ An ExpressionList is always rendered in SQL with parentheses around it.
 
 =head3 Nesting
 
-A Nesting is, essentially, another set of parentheses.
-
-The hash for a Nesting is as follows:
-
-  {
-      type => 'Nesting',
-      args => Array of Expressions,
-  }
+There is no specific operator or nodetype for nesting. Instead, nesting is
+explicitly specified by node descent in the AST. 
 
 =head2 SQL clauses