Author: timbo
Date: Wed Aug 22 12:58:42 2007
New Revision: 9871

Modified:
   dbi/trunk/Changes
   dbi/trunk/DBI.xs
   dbi/trunk/lib/DBD/Proxy.pm
   dbi/trunk/t/05thrclone.t
   dbi/trunk/t/40profile.t

Log:
Fix undef warning from dbi_profile($h, $stmt, undef, $t1, $t2)
Fix DBD::Proxy rows method thanks to Philip Dye.
Add earlier detection of thread creation failure in t/05thrclone.t
Fix t/40profile.t to be more robust.


Modified: dbi/trunk/Changes
==============================================================================
--- dbi/trunk/Changes   (original)
+++ dbi/trunk/Changes   Wed Aug 22 12:58:42 2007
@@ -9,18 +9,26 @@
 Assorted TODO notes:
 
 Protect trace_msg from SIGPIPE?
+prepare(...,{ Err=>\my $isolated_err, ...})
+Move _new_sth to DBI::db::_new_sth (leave alias) and implement in C
+Implement FETCH_many() in C
+Or call _new_child and move to DBI::common?
+Add trace modules that just records the last N trace messages into an array
+and prepends them to any error message.
 
-Add count of identical frozen_request (plus sum(results size)) to Gofer status
-Highlight those seen before.
+Gofo TODOs:
 
+Add count of identical frozen_request (plus sum(results size)) to Gofer status
+    Highlight those seen before.
 Move post-request cleanup into separate method and enable hooks so
     it can be done after the response has been sent
-
 Gofer - allow dbh attrib changes after connect?
-
+    note them and pass in request as STORE method calls
+    but then gofer server need to reset them to restore dbh to original state
+    Or, change the attr in the connect() call, but that risks
+    bloating the number of cache dbh in the server.
 Gofer request flags:
     return current executor stats as an attribute - handy for tests
-    only fetch one result set - handy for Sybase/MSSQL users
     will accept streamed resultsets
 Add attr-passthru to prepare()? ie for gofer cache control & ReadOnly
 Terminology for client and server ends
@@ -30,15 +38,7 @@
     or piggyback on skip_connect_check
     could also remember which attr have been returned to us
     so not bother FETCHing them (unless pedantic)
-Call method on transport failure so transport can cleanup/reset it it wants
-
-prepare(...,{ Err=>\my $isolated_err, ...})
-Move _new_sth to DBI::db::_new_sth (leave alias) and implement in C
-Implement FETCH_many() in C
-Or call _new_child and move to DBI::common?
-Add trace modules that just records the last N trace messages into an array
-and prepends them to any error message.
-
+Call method on transport failure so transport can cleanup/reset if it wants
 Gofer: gearman - need to disable coallesing for non-idempotent requests
 
 =head2 Changes in DBI 1.59 (svn rev XXX),  XXth June 2007
@@ -48,9 +48,10 @@
   Fixed DBI::SQL::Nano to not clobber $_, thanks to Alexey Tourbin.
   Fixed DBI::PurePerl to return undef for ChildHandles if weaken not available.
   Fixed DBD::Proxy disconnect error thanks to Philip Dye.
+  Fixed DBD::Gofer::Transport::Base bug (typo) in timeout code.
+  Fixed DBD::Proxy rows method thanks to Philip Dye.
   Fixed dbiprof compile errors, thanks to Alexey Tourbin.
   Fixed t/03handle.t to skip some tests if ChildHandles not available.
-  Fixed DBD::Gofer::Transport::Base bug (typo) in timeout code.
 
   Added check_response_sub to DBI::Gofer::Execute
 

Modified: dbi/trunk/DBI.xs
==============================================================================
--- dbi/trunk/DBI.xs    (original)
+++ dbi/trunk/DBI.xs    Wed Aug 22 12:58:42 2007
@@ -2331,9 +2331,10 @@
     if (!DBIc_has(imp_xxh, DBIcf_Profile))
        return &sv_undef;
 
-    method_pv = (SvTYPE(method)==SVt_PVCV)
-        ? GvNAME(CvGV(method))
-        : (isGV(method) ? GvNAME(method) : SvPV_nolen(method));
+    method_pv = (SvTYPE(method)==SVt_PVCV) ? GvNAME(CvGV(method))
+                : isGV(method) ? GvNAME(method)
+                : SvOK(method) ? SvPV_nolen(method)
+                : "";
 
     /* we don't profile DESTROY during global destruction */
     if (dirty && instr(method_pv, "DESTROY"))

Modified: dbi/trunk/lib/DBD/Proxy.pm
==============================================================================
--- dbi/trunk/lib/DBD/Proxy.pm  (original)
+++ dbi/trunk/lib/DBD/Proxy.pm  Wed Aug 22 12:58:42 2007
@@ -512,6 +512,7 @@
 
     # new execute, so delete any cached rows from previous execute
     undef $sth->{'proxy_data'};
+    undef $sth->{'proxy_rows'};
 
     my $rsth = $sth->{proxy_sth};
     my $dbh = $sth->FETCH('Database');
@@ -592,6 +593,9 @@
 
     my $data = $sth->{'proxy_data'};
 
+    defined($sth->{'proxy_rows'}) ||
+      ( $sth->{'proxy_rows'} = 0 );
+
     if(!$data || [EMAIL PROTECTED]) {
        return undef unless $sth->SUPER::FETCH('Active');
 
@@ -615,13 +619,14 @@
     my $row = shift @$data;
 
     $sth->SUPER::STORE(Active => 0) if ( $sth->{proxy_cache_only} and [EMAIL 
PROTECTED] );
+    $sth->{'proxy_rows'}++;
     return $sth->_set_fbav($row);
 }
 *fetchrow_arrayref = \&fetch;
 
 sub rows ($) {
     my($sth) = @_;
-    $sth->{'proxy_rows'};
+    $sth->{'proxy_rows'} || -1;
 }
 
 sub finish ($) {

Modified: dbi/trunk/t/05thrclone.t
==============================================================================
--- dbi/trunk/t/05thrclone.t    (original)
+++ dbi/trunk/t/05thrclone.t    Wed Aug 22 12:58:42 2007
@@ -66,7 +66,9 @@
 # load up the threads
 
 my @thr;
-push @thr, threads_sub->create( \&testing ) foreach (1..$threads);
+push @thr, threads_sub->create( \&testing )
+    or die "thread->create failed ($!)"
+    foreach (1..$threads);
 
 # join all the threads
 

Modified: dbi/trunk/t/40profile.t
==============================================================================
--- dbi/trunk/t/40profile.t     (original)
+++ dbi/trunk/t/40profile.t     Wed Aug 22 12:58:42 2007
@@ -282,11 +282,11 @@
 print "testing '!Time' and variants in Path\n";
 
 undef $sth;
-my $factor = 100_000; # ~27 hours
+my $factor = 1_000_000;
 $dbh->{Profile}->{Path} = [ '!Time', "!Time~$factor", '!MethodName' ];
 $dbh->{Profile}->{Data} = undef;
 
-$t1 = int(dbi_time())+1; 1 while int(dbi_time()) < $t1; # spin till new second 
starts
+$t1 = int(dbi_time())+1; 1 while int(dbi_time()-0.01) < $t1; # spin till just 
after second starts
 $t2 = int($t1/$factor)*$factor;
 
 $sth = $dbh->prepare("select name from .");

Reply via email to