From: Rob Kinyon Date: Tue, 7 Apr 2009 00:00:33 +0000 (-0400) Subject: Added further examples X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7b7ed1cb9dea9d9c8293dc416ec5f28e5f100fb9;p=dbsrgits%2FSQL-Abstract-2.0-ish.git Added further examples --- diff --git a/lib/SQL/Abstract/Manual/Examples.pod b/lib/SQL/Abstract/Manual/Examples.pod index 3258ce9..8a62de3 100644 --- a/lib/SQL/Abstract/Manual/Examples.pod +++ b/lib/SQL/Abstract/Manual/Examples.pod @@ -369,10 +369,42 @@ one. The SQL used is from the MySQL dialect. ], } -=item * UPDATE foo SET col1 = 1 +=item * SELECT * FROM ( SELECT 1 ) AS foo { - type => 'update', + type => 'select', + ast_version => 0.0001, + select => [ + { + type => 'Identifier', + element1 => '*', + }, + ], + tables => { + type => 'Identifier', + element1 => 'foo', + value => { + type => 'select', + ast_version => 0.0001, + select => [ + { + type => 'Value', + subtype => 'Number', + value => 1, + }, + ], + }, + as => { + type => 'Identifier', + element1 => 'foo', + }, + }, + } + +=item * INSERT INTO foo ( col1, col2 ) VALUES ( 1, 3 ) + + { + type => 'insert', ast_version => 0.0001, tables => { type => 'Identifier', @@ -384,18 +416,27 @@ one. The SQL used is from the MySQL dialect. type => 'Identifier, element1 => 'col1', }, + { + type => 'Identifier, + element1 => 'col2', + }, ], [ { type => 'Value', subtype => 'Number', - value => 1, + value => '1', + }, + { + type => 'Value', + subtype => 'Number', + value => '3', }, ], ], } -=item * INSERT INTO foo ( col1, col2 ) VALUES ( 1, 3 ) +=item * INSERT INTO foo ( col1, col2 ) VALUES ( 1, 3 ), ( 2, 4 ) { type => 'insert', @@ -427,6 +468,79 @@ one. The SQL used is from the MySQL dialect. value => '3', }, ], + [ + { + type => 'Value', + subtype => 'Number', + value => '2', + }, + { + type => 'Value', + subtype => 'Number', + value => '3', + }, + ], + ], + } + +=item * UPDATE foo SET col1 = 1 + + { + type => 'update', + ast_version => 0.0001, + tables => { + type => 'Identifier', + element1 => 'foo', + }, + set => [ + [ + { + type => 'Identifier, + element1 => 'col1', + }, + ], + [ + { + type => 'Value', + subtype => 'Number', + value => 1, + }, + ], + ], + } + +=item * UPDATE foo SET col1 = 1, col2 = 6 + + { + type => 'update', + ast_version => 0.0001, + tables => { + type => 'Identifier', + element1 => 'foo', + }, + set => [ + [ + { + type => 'Identifier, + element1 => 'col1', + }, + { + type => 'Identifier, + element1 => 'col2', + }, + ], + [ + { + type => 'Value', + subtype => 'Number', + value => 1, + }, + { + type => 'Value', + subtype => 'Number', + value => 6, + }, + ], ], } @@ -456,38 +570,6 @@ one. The SQL used is from the MySQL dialect. }, } -=item * SELECT * FROM ( SELECT 1 ) AS foo - - { - type => 'select', - ast_version => 0.0001, - select => [ - { - type => 'Identifier', - element1 => '*', - }, - ], - tables => { - type => 'Identifier', - element1 => 'foo', - value => { - type => 'select', - ast_version => 0.0001, - select => [ - { - type => 'Value', - subtype => 'Number', - value => 1, - }, - ], - }, - as => { - type => 'Identifier', - element1 => 'foo', - }, - }, - } - =back =head1 AUTHORS