Author: turnstep
Date: Sat May 24 20:12:20 2008
New Revision: 11309

Modified:
   DBD-Pg/trunk/Pg.pm
   DBD-Pg/trunk/TODO
   DBD-Pg/trunk/t/99_spellcheck.t
   DBD-Pg/trunk/types.c

Log:
Document RETURNING clause.
Fix some typos.


Modified: DBD-Pg/trunk/Pg.pm
==============================================================================
--- DBD-Pg/trunk/Pg.pm  (original)
+++ DBD-Pg/trunk/Pg.pm  Sat May 24 20:12:20 2008
@@ -2548,7 +2548,7 @@
 
   $ret = $dbh->pg_notifies;
 
-Looks for any asycnhronous notifications received and returns either C<undef> 
+Looks for any asynchronous notifications received and returns either C<undef> 
 or a reference to a three-element array consisting of an event name, the PID 
 of the backend that sent the NOTIFY command, and the optional payload string. 
 Note that this does not check if the connection to the database is still valid 
first - 
@@ -3158,6 +3158,18 @@
 DBD::Pg also supports passing in arrays to execute: simply pass in an 
arrayref, 
 and DBD::Pg will flatten it into a string suitable for input on the backend.
 
+If you are using Postgres version 8.2 or greater, you can also use any of the 
+fetch methods to retrieve the values of a C<RETURNING> clause after you 
execute 
+an C<UPDATE>, C<DELETE>, or C<INSERT>. For example:
+
+  $dbh->do(q{CREATE TABLE abc (id SERIAL, country TEXT)});
+  $SQL = q{INSERT INTO abc (country) VALUES (?) RETURNING id};
+  $sth = $dbh->prepare($SQL);
+  $sth->execute('France');
+  $countryid = $sth->fetch()->[0];
+  $sth->execute('New Zealand');
+  $countryid = $sth->fetch()->[0];
+
 =item B<execute_array>
 
 Supported by this driver as proposed by DBI.

Modified: DBD-Pg/trunk/TODO
==============================================================================
--- DBD-Pg/trunk/TODO   (original)
+++ DBD-Pg/trunk/TODO   Sat May 24 20:12:20 2008
@@ -1,6 +1,5 @@
 TODO: 
 
-- Mention RETURNING clause support in docs.
 - Use WITH HOLD for cursor work
 - Start testing with a thread-enabled Perl
 - Create a .ppm for Windows

Modified: DBD-Pg/trunk/t/99_spellcheck.t
==============================================================================
--- DBD-Pg/trunk/t/99_spellcheck.t      (original)
+++ DBD-Pg/trunk/t/99_spellcheck.t      Sat May 24 20:12:20 2008
@@ -712,6 +712,8 @@
 pos
 printf
 qq
+slashstar
+starslash
 sqlc
 sqltype
 src

Modified: DBD-Pg/trunk/types.c
==============================================================================
--- DBD-Pg/trunk/types.c        (original)
+++ DBD-Pg/trunk/types.c        Sat May 24 20:12:20 2008
@@ -353,7 +353,7 @@
 #!perl
 
 ## Autogenerate all type information and populate 
-## all files referenceing type information.
+## all files referencing type information.
 
 ## You should only run this if you are developing DBD::Pg and 
 ## understand what this script does
@@ -418,7 +418,9 @@
 
 my $slashstar = '/' . '*';
 my $starslash = '*' . '/';
-print $newfh qq{$slashstar\nDo not edit this file directly - it is generated 
by types.c\n$starslash
+print $newfh qq{$slashstar
+Do not edit this file directly - it is generated by types.c
+$starslash
 
 typedef struct sql_type_info {
        int     type_id;

Reply via email to