Index: DBI.xs
===================================================================
--- DBI.xs	(revision 414)
+++ DBI.xs	(working copy)
@@ -3984,6 +3984,17 @@
     ST(0) = &sv_yes;
 
 
+void
+set_internal_handle(sth1, sth2)
+    SV *        sth1
+    SV *        sth2
+    CODE:
+    /* Simply replace all the content of sth1 with
+       that of sth2, including magic data */
+    SvSetMagicSV(sth1, sth2);
+    ST(0) = &sv_yes;
+
+
 MODULE = DBI   PACKAGE = DBD::_::common
 
 
Index: t/03handle.t
===================================================================
--- t/03handle.t	(revision 414)
+++ t/03handle.t	(working copy)
@@ -2,7 +2,7 @@
 
 use strict;
 
-use Test::More tests => 101;
+use Test::More tests => 107;
 
 ## ----------------------------------------------------------------------------
 ## 03handle.t - tests handles
@@ -122,6 +122,20 @@
     '... second and fourth/fifth statment handles should be in the CachedKids');     
 
     cmp_ok($warn, '==', 1, '... we still only got one warning');
+
+    SKIP: {
+	skip "become() not supported under DBI::PurePerl", 6 if $DBI::PurePerl;
+    
+        my $sth6 = $dbh->prepare($sql);
+        $sth6->execute(".");
+        ok($sth6->{Active}, '... sixth statement handle is active');
+        ok($sth1->set_internal_handle($sth6), '... first statement handle becomes the sixth');
+        isnt($sth1, $sth6, '... first statement handle and sixth one do not match');
+        ok($sth1->{Active}, '... first statement handle is active again');
+        ok($sth6->finish, '... finished statement handle six');
+        ok(!$sth1->{Active}, '... first statement handle is not active any more');
+    }
+
     $dbh->disconnect;
     
     SKIP: {
Index: DBI.pm
===================================================================
--- DBI.pm	(revision 414)
+++ DBI.pm	(working copy)
@@ -67,6 +67,8 @@
 
   $rv  = $sth->rows;
 
+  $rc = $sth->set_internal_handle( $sth2 )
+
   $rc  = $dbh->begin_work;
   $rc  = $dbh->commit;
   $rc  = $dbh->rollback;
@@ -436,6 +438,7 @@
 	finish     => 	{ U =>[1,1] },
 	cancel     => 	{ U =>[1,1], O=>0x0800 },
 	rows       =>	$keeperr,
+	set_internal_handle     => 	{ U =>[1,2, '$sth_new'] },
 
 	_get_fbav	=> undef,
 	_set_fbav	=> { T=>6 },
@@ -5354,6 +5357,45 @@
 query and then fetch the row count from that.
 
 
+=item C<set_internal_handle>
+
+  $rc = $sth->set_internal_handle( $sth2 );
+
+Makes a statement handle internally point to the same structures as 
+another statement handle. In essence, both statement handles become one
+and can be used interchangeably. This is useful for subclassing DBI. For
+example:
+
+  sub execute {
+      my $sth = shift;
+      ...
+      if (! $rc = $sth->SUPER::execute) {
+          my $dbh = DBI->connect(...);
+          my $sth2 = $dbh->prepare( $sql );
+          $rc = $sth2->SUPER::execute;
+          $sth->set_internal_handle( $sth2 );
+      }
+      return $rc;
+  }
+
+In the above example, from the point of view of the caller nothing 
+out of the ordinary happened. Simply doing:
+
+  $sth = $sth2;
+
+will not work as $sth will get its scope localized. Once the subclassed
+C<execute> returns, $sth will revert to its pre-execute state.
+C<set_internal_handle> properly handles this issue.
+
+Note that since C<set_internal_handle> makes two statement handles
+point to the same internal structures, the following:
+
+  $sth->set_internal_handle( $sth2 );
+  $sth2->finish;
+
+also finishes $sth.
+
+
 =item C<bind_col>
 
   $rc = $sth->bind_col($column_number, \$var_to_bind);
