Author: timbo
Date: Thu May  3 09:21:37 2007
New Revision: 9497

Modified:
   dbi/trunk/lib/DBI/Gofer/Execute.pm
   dbi/trunk/lib/DBI/Gofer/Transport/stream.pm

Log:
Use update_stats in DBI/Gofer/Transport/stream
Fix usage of dbi_time in DBI/Gofer/Execute


Modified: dbi/trunk/lib/DBI/Gofer/Execute.pm
==============================================================================
--- dbi/trunk/lib/DBI/Gofer/Execute.pm  (original)
+++ dbi/trunk/lib/DBI/Gofer/Execute.pm  Thu May  3 09:21:37 2007
@@ -10,7 +10,7 @@
 use strict;
 use warnings;
 
-use DBI;
+use DBI qw(dbi_time);
 use DBI::Gofer::Request;
 use DBI::Gofer::Response;
 

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 Thu May  3 09:21:37 2007
@@ -10,6 +10,7 @@
 use strict;
 use warnings;
 
+use DBI qw(dbi_time);
 use DBI::Gofer::Execute;
 
 use base qw(DBI::Gofer::Transport::pipeone Exporter);
@@ -30,14 +31,22 @@
     local $\; # OUTPUT_RECORD_SEPARATOR
     local $/ = "\012"; # INPUT_RECORD_SEPARATOR
     while ( defined( my $encoded_request = <STDIN> ) ) {
+        my $time_received = dbi_time();
         $encoded_request =~ s/\015?\012$//;
 
-        my $request = $transport->thaw_request( pack "H*", $encoded_request );
+        my $frozen_request = pack "H*", $encoded_request;
+        my $request = $transport->thaw_request( $frozen_request );
+
         my $response = $executor->execute_request( $request );
 
-        my $encoded_response = unpack "H*", 
$transport->freeze_response($response);
+        my $frozen_response = $transport->freeze_response($response);
+        my $encoded_response = unpack "H*", $frozen_response;
 
         print $encoded_response, "\015\012"; # autoflushed due to $|=1
+
+        # 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);
     }
     DBI->trace_msg("$0 ending (pid $$)\n");
 }

Reply via email to