Author: timbo
Date: Mon Feb 26 02:33:31 2007
New Revision: 9167

Modified:
   dbi/trunk/Changes
   dbi/trunk/DBI.xs
   dbi/trunk/lib/DBD/Gofer/Transport/http.pm

Log:
Fixed set_err so HandleSetErr hook is executed reliably, if set.
Fixed accuracy of profiling when perl configured to use long doubles.
Fixed compile error in DBD::Gofer::Transport::http.


Modified: dbi/trunk/Changes
==============================================================================
--- dbi/trunk/Changes   (original)
+++ dbi/trunk/Changes   Mon Feb 26 02:33:31 2007
@@ -20,6 +20,12 @@
 XXX quote policy control
 prepare(...,{ Err=>\my $isolated_err, ...})
 
+=head2 Changes in DBI 1.55 (svn rev XXX),  XXX
+
+  Fixed set_err so HandleSetErr hook is executed reliably, if set.
+  Fixed accuracy of profiling when perl configured to use long doubles.
+  Fixed compile error in DBD::Gofer::Transport::http.
+
 =head2 Changes in DBI 1.54 (svn rev 9157),  23rd February 2007
 
   NOTE: This release includes the 'next big thing': DBD::Gofer.

Modified: dbi/trunk/DBI.xs
==============================================================================
--- dbi/trunk/DBI.xs    (original)
+++ dbi/trunk/DBI.xs    Mon Feb 26 02:33:31 2007
@@ -362,7 +362,6 @@
     }
 
     if (SvNIOK(sv)) {    /* is a numeric value - so no surrounding quotes      
*/
-       char buf[48];
        if (SvPOK(sv)) {  /* already has string version of the value, so use it 
*/
            v = SvPV(sv,len);
            if (len == 0) { v="''"; len=2; } /* catch &sv_no style special case 
*/
@@ -373,9 +372,8 @@
        }
        /* we don't use SvPV here since we don't want to alter sv in _any_ way  
*/
        if (SvIOK(sv))
-            sprintf(buf, "%ld", (long)SvIVX(sv));
-       else sprintf(buf, "%g",  (double)SvNVX(sv));
-       nsv = sv_2mortal(newSVpv(buf, 0));
+            nsv = newSVpvf("%"IVdf, SvIVX(sv));
+       else nsv = newSVpvf("%"NVgf, SvNVX(sv));
        if (infosv)
            sv_catsv(nsv, infosv);
        return SvPVX(nsv);
@@ -467,7 +465,8 @@
 
     if (    DBIc_has(imp_xxh, DBIcf_HandleSetErr)
        && (hook_svp = hv_fetch((HV*)SvRV(h),"HandleSetErr",12,0))
-       &&  hook_svp && SvOK(*hook_svp)
+       &&  hook_svp
+       &&  (SvGMAGICAL(*hook_svp) && mg_get(*hook_svp), SvOK(*hook_svp))
     ) {
        dSP;
        IV items;
@@ -2024,7 +2023,7 @@
 
           case 'L':
             if (keylen==11 && strEQ(key, "LongReadLen")) {
-                valuesv = newSVnv((double)DBIc_LongReadLen(imp_xxh));
+                valuesv = newSVnv((NV)DBIc_LongReadLen(imp_xxh));
             }
             else if (keylen==11 && strEQ(key, "LongTruncOk")) {
                 valuesv = boolSV(DBIc_has(imp_xxh,DBIcf_LongTruncOk));
@@ -2275,7 +2274,7 @@
     }
 }
 
-static double
+static NV
 dbi_time() {
 # ifdef HAS_GETTIMEOFDAY
 #   ifdef PERL_IMPLICIT_SYS
@@ -2322,7 +2321,7 @@
 
 
 static void
-dbi_profile(SV *h, imp_xxh_t *imp_xxh, SV *statement_sv, SV *method, double 
t1, double t2)
+dbi_profile(SV *h, imp_xxh_t *imp_xxh, SV *statement_sv, SV *method, NV t1, NV 
t2)
 {
 #define DBIprof_MAX_PATH_ELEM  100
 #define DBIprof_COUNT          0
@@ -2334,7 +2333,7 @@
 #define DBIprof_LAST_CALLED    6
 #define DBIprof_max_index      6
     dTHX;
-    double ti = t2 - t1;
+    NV ti = t2 - t1;
     int src_idx = 0;
     HV *dbh_outer_hv = NULL;
     HV *dbh_inner_hv = NULL;
@@ -2560,7 +2559,7 @@
     dTHX;
     AV *d_av, *i_av;
     SV *tmp;
-    double i_nv;
+    NV i_nv;
     int i_is_earlier;
 
     if (!SvROK(dest) || SvTYPE(SvRV(dest)) != SVt_PVAV)
@@ -2655,7 +2654,7 @@
     UV  ErrCount = UV_MAX;
     int i, outitems;
     int call_depth;
-    double profile_t1 = 0.0;
+    NV profile_t1 = 0.0;
 
     const char *meth_name = GvNAME(CvGV(cv));
     const dbi_ima_t    *ima = (dbi_ima_t*)CvXSUBANY(cv).any_ptr;
@@ -4077,7 +4076,7 @@
     }
 
 
-double
+NV
 dbi_time()
 
 
@@ -4086,8 +4085,8 @@
     SV *h
     SV *statement
     SV *method
-    double t1
-    double t2
+    NV t1
+    NV t2
     CODE:
     D_imp_xxh(h);
     (void)cv;
@@ -4137,7 +4136,7 @@
     char type = *meth++;               /* is this a $ or & style       */
     imp_xxh_t *imp_xxh = (DBI_LAST_HANDLE_OK) ? DBIh_COM(DBI_LAST_HANDLE) : 
NULL;
     int trace = 0;
-    double profile_t1 = 0.0;
+    NV profile_t1 = 0.0;
 
     if (imp_xxh && DBIc_has(imp_xxh,DBIcf_Profile))
        profile_t1 = dbi_time();

Modified: dbi/trunk/lib/DBD/Gofer/Transport/http.pm
==============================================================================
--- dbi/trunk/lib/DBD/Gofer/Transport/http.pm   (original)
+++ dbi/trunk/lib/DBD/Gofer/Transport/http.pm   Mon Feb 26 02:33:31 2007
@@ -69,14 +69,14 @@
 
     if (not $res->is_success) {
         return DBI::Gofer::Response->new({
-            err    => 1, # or 100_000 + $res->status_code?
+            err    => 1, # or 100_000 + $res->status_code? DBI registry codes?
             errstr => $res->status_line,
         }); 
     }
 
     my $frozen_response = $res->content;
 
-    $response = $self->thaw_data($frozen_response);
+    my $response = $self->thaw_data($frozen_response);
 
     return $response;
 }

Reply via email to