Author: timbo Date: Tue Feb 24 14:37:09 2009 New Revision: 12536 Modified: dbi/trunk/lib/DBD/Gofer/Transport/Base.pm dbi/trunk/lib/DBI/Gofer/Request.pm dbi/trunk/lib/DBI/Gofer/Transport/Base.pm dbi/trunk/lib/DBI/Gofer/Transport/pipeone.pm dbi/trunk/lib/DBI/Gofer/Transport/stream.pm
Log: Added response_retry_preference to DBD::Gofer::Transport::Base docs. Tweak statements() in DBI/Gofer/Request. Enable store_meta in update_stats() call in DBI/Gofer/Transport/stream.pm 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 Tue Feb 24 14:37:09 2009 @@ -288,6 +288,8 @@ 1; +__END__ + =head1 NAME DBD::Gofer::Transport::Base - base class for DBD::Gofer client transports @@ -364,13 +366,31 @@ The trace is written using DBI->trace_msg() and so is written to the default DBI trace output, which is usually STDERR. +=head1 METHODS + +I<This section is currently far from complete.> + +=head2 response_retry_preference + + $retry = $transport->response_retry_preference($request, $response); + +The response_retry_preference is called by DBD::Gofer when considering if a +request should be retried after an error. + +Returns true (would like to retry), false (must not retry), undef (no preference). + +If a true value is returned in the form of a CODE ref then, if DBD::Gofer does +decide to retry the request, it calls the code ref passing $retry_count, $retry_limit. +Can be used for logging and/or to implement exponential backoff behaviour. +Currently the called code must return using C<return;> to allow for future extensions. + =head1 AUTHOR Tim Bunce, L<http://www.tim.bunce.name> =head1 LICENCE AND COPYRIGHT -Copyright (c) 2007, Tim Bunce, Ireland. All rights reserved. +Copyright (c) 2007-2008, Tim Bunce, Ireland. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See L<perlartistic>. Modified: dbi/trunk/lib/DBI/Gofer/Request.pm ============================================================================== --- dbi/trunk/lib/DBI/Gofer/Request.pm (original) +++ dbi/trunk/lib/DBI/Gofer/Request.pm Tue Feb 24 14:37:09 2009 @@ -69,10 +69,10 @@ sub statements { my $self = shift; my @statements; - my $statement_method_regex = qr/^(?:do|prepare)$/; if (my $dbh_method_call = $self->dbh_method_call) { + my $statement_method_regex = qr/^(?:do|prepare)$/; my (undef, $method, $arg1) = @$dbh_method_call; - push @statements, $arg1 if $method =~ $statement_method_regex; + push @statements, $arg1 if $method && $method =~ $statement_method_regex; } return @statements; } Modified: dbi/trunk/lib/DBI/Gofer/Transport/Base.pm ============================================================================== --- dbi/trunk/lib/DBI/Gofer/Transport/Base.pm (original) +++ dbi/trunk/lib/DBI/Gofer/Transport/Base.pm Tue Feb 24 14:37:09 2009 @@ -52,7 +52,7 @@ $self->_dump("freezing $self->{trace} ".ref($data), $data) if !$skip_trace and $self->trace; - local $data->{meta}; # don't include _meta in serialization + local $data->{meta}; # don't include meta in serialization $serializer ||= $self->{serializer_obj}; my ($data, $deserializer_class) = $serializer->serialize($data); Modified: dbi/trunk/lib/DBI/Gofer/Transport/pipeone.pm ============================================================================== --- dbi/trunk/lib/DBI/Gofer/Transport/pipeone.pm (original) +++ dbi/trunk/lib/DBI/Gofer/Transport/pipeone.pm Tue Feb 24 14:37:09 2009 @@ -31,6 +31,8 @@ my $frozen_response = $transport->freeze_response($response); print $frozen_response; + + # no point calling $executor->update_stats(...) for pipeONE } 1; Modified: dbi/trunk/lib/DBI/Gofer/Transport/stream.pm ============================================================================== --- dbi/trunk/lib/DBI/Gofer/Transport/stream.pm (original) +++ dbi/trunk/lib/DBI/Gofer/Transport/stream.pm Tue Feb 24 14:37:09 2009 @@ -46,7 +46,7 @@ # there's no way to access the stats currently # so this just serves as a basic test and illustration of update_stats() - $executor->update_stats($request, $response, $frozen_request, $frozen_response, $time_received); + $executor->update_stats($request, $response, $frozen_request, $frozen_response, $time_received, 1); } DBI->trace_msg("$0 ending (pid $$)\n"); }
