Author: timbo
Date: Fri Nov 27 08:04:40 2009
New Revision: 13613

Modified:
   dbi/trunk/Changes
   dbi/trunk/DBI.xs

Log:
Taught neat() about UV values.
sql_type_cast now sets SvCUR(sv) = 0 as well as SvLEV(sv).


Modified: dbi/trunk/Changes
==============================================================================
--- dbi/trunk/Changes   (original)
+++ dbi/trunk/Changes   Fri Nov 27 08:04:40 2009
@@ -13,6 +13,8 @@
 
   Bumped required perl version to 5.8.1 (as announced in DBI 1.607)
 
+http://perlmonks.org/?node_id=809590
+
 XXX needs to be redone to convert ReadOnly to an internal flag:
   Changed "Issuing rollback() due to DESTROY without explicit disconnect"
     warning to not be issued if ReadOnly set for that dbh.

Modified: dbi/trunk/DBI.xs
==============================================================================
--- dbi/trunk/DBI.xs    (original)
+++ dbi/trunk/DBI.xs    Fri Nov 27 08:04:40 2009
@@ -528,7 +528,9 @@
             return SvPVX(infosv);
         }
         /* we don't use SvPV here since we don't want to alter sv in _any_ way 
 */
-        if (SvIOK(sv))
+        if (SvUOK(sv))
+             nsv = newSVpvf("%"UVdf, SvUVX(sv));
+        else if (SvIOK(sv))
              nsv = newSVpvf("%"IVdf, SvIVX(sv));
         else nsv = newSVpvf("%"NVgf, SvNVX(sv));
         if (infosv)
@@ -1801,10 +1803,9 @@
         && SvPVX(sv)   /* we have a buffer to discard */
         ) {
             SvOOK_off(sv);
-            if (SvLEN(sv)) {
+            if (SvLEN(sv))
                 Safefree(SvPVX(sv));
-                SvLEN(sv) = 0;
-            }
+            SvLEN(sv) = SvCUR(sv) = 0;
             SvPVX(sv) = NULL;
             SvPOK_off(sv);
         }

Reply via email to