Added further examples
Rob Kinyon [Tue, 7 Apr 2009 00:00:33 +0000 (20:00 -0400)]
lib/SQL/Abstract/Manual/Examples.pod

index 3258ce9..8a62de3 100644 (file)
@@ -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