Author: timbo
Date: Thu Dec 6 02:33:18 2007
New Revision: 10377
Modified:
dbi/trunk/Changes
dbi/trunk/DBI.pm
dbi/trunk/lib/DBD/Gofer/Transport/Base.pm
Log:
DBD/Gofer/Transport/Base: improve trace messages when fetching from cache
Documented $DBI::stderr as the default value of err for internal errors.
Modified: dbi/trunk/Changes
==============================================================================
--- dbi/trunk/Changes (original)
+++ dbi/trunk/Changes Thu Dec 6 02:33:18 2007
@@ -19,8 +19,6 @@
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?
@@ -49,6 +47,7 @@
Enhanced t/80proxy.t test script.
Enhanced t/85gofer.t test script thanks to Stig.
Enhanced t/10examp.t test script thanks to David Cantrell.
+ Documented $DBI::stderr as the default value of err for internal errors.
Gofer changes:
track_recent now also keeps track of N most recent errors.
Modified: dbi/trunk/DBI.pm
==============================================================================
--- dbi/trunk/DBI.pm (original)
+++ dbi/trunk/DBI.pm Thu Dec 6 02:33:18 2007
@@ -3052,6 +3052,9 @@
portable to different database engines, then you'll need to determine what the
corresponding error codes are for all those engines and test for all of them.
+The DBI uses the value of $DBI::stderr as the C<err> value for internal errors.
+Drivers should also do likewise. The default value for $DBI::stderr is
2000000000.
+
A driver may return C<0> from err() to indicate a warning condition
after a method call. Similarly, a driver may return an empty string
to indicate a 'success with information' condition. In both these
Modified: dbi/trunk/lib/DBD/Gofer/Transport/Base.pm
==============================================================================
--- dbi/trunk/lib/DBD/Gofer/Transport/Base.pm (original)
+++ dbi/trunk/lib/DBD/Gofer/Transport/Base.pm Thu Dec 6 02:33:18 2007
@@ -62,12 +62,12 @@
if ($request_cache_key) {
my $frozen_response = eval { $go_cache->get($request_cache_key) };
if ($frozen_response) {
+ my $trace = $self->trace;
+ $self->_dump("cached response found for ".ref($request),
$request)
+ if $trace;
$response = $self->thaw_response($frozen_response);
- if (my $trace = $self->trace) {
- $self->_dump("cached response found for ".ref($request),
$request);
- $self->_dump("cached response is ".ref($response),
$response);
- $self->trace_msg("transmit_request is returning a response
from cache $go_cache\n");
- }
+ $self->trace_msg("transmit_request is returning a response
from cache $go_cache\n")
+ if $trace;
++$self->{cache_hit};
return $response;
}