From: Rob Kinyon Date: Thu, 26 Mar 2009 16:15:14 +0000 (-0400) Subject: Removed Nesting operator and explicated how nesting is explicit via node descent X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits%2FSQL-Abstract-2.0-ish.git;a=commitdiff_plain;h=3d8ddf0bde2ee3bc77bab7ac5073b5ea2f3986ed Removed Nesting operator and explicated how nesting is explicit via node descent --- diff --git a/lib/SQL/Abstract/Manual/Examples.pod b/lib/SQL/Abstract/Manual/Examples.pod index c684127..d56f157 100644 --- a/lib/SQL/Abstract/Manual/Examples.pod +++ b/lib/SQL/Abstract/Manual/Examples.pod @@ -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 diff --git a/lib/SQL/Abstract/Manual/Specification.pod b/lib/SQL/Abstract/Manual/Specification.pod index 23ea0b1..4c2cb52 100644 --- a/lib/SQL/Abstract/Manual/Specification.pod +++ b/lib/SQL/Abstract/Manual/Specification.pod @@ -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