Author: timbo
Date: Tue Dec 13 05:40:00 2005
New Revision: 2307

Modified:
   dbi/trunk/Changes
   dbi/trunk/DBI.pm
   dbi/trunk/DBI.xs
   dbi/trunk/META.yml
Log:
Fixed handle magic order to keep DBD::Oracle happy.
Prep for 1.50 release.


Modified: dbi/trunk/Changes
==============================================================================
--- dbi/trunk/Changes   (original)
+++ dbi/trunk/Changes   Tue Dec 13 05:40:00 2005
@@ -4,9 +4,10 @@ DBI::Changes - List of significant chang
 
 =cut
 
-=head2 Changes in DBI 1.50 (svn rev XXXX),   XXX
+=head2 Changes in DBI 1.50 (svn rev 2307),   13 December 2005
 
   Fixed Makefile.PL options for gcc bug introduced in 1.49.
+  Fixed handle magic order to keep DBD::Oracle happy.
 
 =head2 Changes in DBI 1.49 (svn rev 2287),   29th November 2005
 

Modified: dbi/trunk/DBI.pm
==============================================================================
--- dbi/trunk/DBI.pm    (original)
+++ dbi/trunk/DBI.pm    Tue Dec 13 05:40:00 2005
@@ -9,7 +9,7 @@
 require 5.006_00;
 
 BEGIN {
-$DBI::VERSION = "1.49"; # ==> ALSO update the version in the pod text below!
+$DBI::VERSION = "1.50"; # ==> ALSO update the version in the pod text below!
 }
 
 =head1 NAME
@@ -116,7 +116,7 @@ Tim he's very likely to just forward it 
 
 =head2 NOTES
 
-This is the DBI specification that corresponds to the DBI version 1.49.
+This is the DBI specification that corresponds to the DBI version 1.50.
 
 The DBI is evolving at a steady pace, so it's good to check that
 you have the latest copy.

Modified: dbi/trunk/DBI.xs
==============================================================================
--- dbi/trunk/DBI.xs    (original)
+++ dbi/trunk/DBI.xs    Tue Dec 13 05:40:00 2005
@@ -1082,6 +1082,23 @@ dbih_setup_handle(SV *orv, char *imp_cla
 
     DBI_SET_LAST_HANDLE(h);
 
+    if (1) {
+       /* This is a hack to work-around the fast but poor way old versions of
+        * DBD::Oracle (and possibly other drivers) check for a valid handle
+        * using (SvMAGIC(SvRV(h)))->mg_type == 'P'). That doesn't work now
+        * because the weakref magic is inserted ahead of the tie magic.
+        * So here we swap the tie and weakref magic so the tie comes first.
+        */
+       MAGIC *tie_mg = mg_find(SvRV(orv),'P');
+       MAGIC *first  = SvMAGIC(SvRV(orv));
+       if (tie_mg && first->mg_moremagic == tie_mg && !tie_mg->mg_moremagic) {
+           MAGIC *next = tie_mg->mg_moremagic;
+           SvMAGIC(SvRV(orv)) = tie_mg;
+           tie_mg->mg_moremagic = first;
+           first->mg_moremagic = next;
+       }
+    }
+
     DBI_UNLOCK;
 }
 

Modified: dbi/trunk/META.yml
==============================================================================
--- dbi/trunk/META.yml  (original)
+++ dbi/trunk/META.yml  Tue Dec 13 05:40:00 2005
@@ -1,7 +1,7 @@
 # http://module-build.sourceforge.net/META-spec.html
 #XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
 name:         DBI
-version:      1.49
+version:      1.50
 version_from: DBI.pm
 installdirs:  site
 requires:

Reply via email to