Author: timbo
Date: Tue Mar  2 02:55:29 2004
New Revision: 177

Modified:
   dbi/trunk/Changes
   dbi/trunk/DBI.pm
Log:
Corrected execute_for_fetch example thanks to Dean Arnold.


Modified: dbi/trunk/Changes
==============================================================================
--- dbi/trunk/Changes   (original)
+++ dbi/trunk/Changes   Tue Mar  2 02:55:29 2004
@@ -20,7 +20,6 @@
   Changed DBI_TRACE env var so just does this at load time:
     DBI->trace(split '=', $ENV{DBI_TRACE}, 2);
   Improved "invalid number of parameters" error message.
-  Corrected typos in docs thanks to Steffen Goeldner.
 
   Major tracing enhancement:
 
@@ -41,6 +40,11 @@
   Added DBD::File, modified to use DBI::SQL::Nano.
   Added DBD::DBM, an SQL interface to DBM files using DBD::File.
 
+  Documentation changes:
+
+  Corrected typos in docs thanks to Steffen Goeldner.
+  Corrected execute_for_fetch example thanks to Dean Arnold.
+
 =head1 CHANGES in DBI 1.41 (svn rev 130),    22nd February 2004
 
   Fixed execute_for_array() so tuple_status parameter is optional

Modified: dbi/trunk/DBI.pm
==============================================================================
--- dbi/trunk/DBI.pm    (original)
+++ dbi/trunk/DBI.pm    Tue Mar  2 02:55:29 2004
@@ -5039,13 +5039,20 @@
 
   my $sel = $dbh1->prepare("select foo, bar from table1");
   $sel->execute;
+
   my $ins = $dbh2->prepare("insert into table2 (foo, bar) values (?,?)");
-  $ins->execute;
   my $fetch_tuple_sub = sub { $sel->fetchrow_arrayref };
+
   my @tuple_status;
   $rc = $ins->execute_for_fetch($fetch_tuple_sub, [EMAIL PROTECTED]);
   my @errors = grep { ref $_ } @tuple_status;
 
+Similarly, if you already have an array containing the data rows
+to be processed you'd use a subroutine to shift off and return
+each array ref in turn:
+
+  $ins->execute_for_fetch( sub { shift @array_of_arrays }, [EMAIL PROTECTED]);
+
 The C<execute_for_fetch> method was added in DBI 1.38.
 
 

Reply via email to