[Jifty-commit] r4997 - in jifty/trunk: lib/Jifty/Plugin

Jifty commits jifty-commit at lists.jifty.org
Tue Feb 5 13:46:21 EST 2008


Author: sartak
Date: Tue Feb  5 13:46:20 2008
New Revision: 4997

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/lib/Jifty/Plugin/SQLQueries.pm

Log:
 r51365 at onn:  sartak | 2008-02-05 13:45:51 -0500
 Some SQLQueries fixes


Modified: jifty/trunk/lib/Jifty/Plugin/SQLQueries.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Plugin/SQLQueries.pm	(original)
+++ jifty/trunk/lib/Jifty/Plugin/SQLQueries.pm	Tue Feb  5 13:46:20 2008
@@ -86,8 +86,6 @@
 
 sub before_request {
     Jifty->handle or return;
-
-    Jifty->handle->clear_sql_statement_log();
 }
 
 =head2 after_request
@@ -103,7 +101,9 @@
     my $cgi = shift;
 
     my $total_time = 0;
-    my @log = (splice @halo_queries), Jifty->handle->sql_statement_log();
+    my @log = ((splice @halo_queries), Jifty->handle->sql_statement_log());
+    Jifty->handle->clear_sql_statement_log();
+
     for (@log) {
         my ($time, $statement, $bindings, $duration, $results) = @$_;
 
@@ -114,7 +114,7 @@
         $total_time += $duration;
 
         # keep track of the ten slowest queries so far
-        if ($duration > $slow_queries[0][3]) {
+        if (@slow_queries < 10 || $duration > $slow_queries[0][3]) {
             push @slow_queries, $_;
             @slow_queries = sort { $a->[3] <=> $b->[3] } @slow_queries;
             shift @slow_queries if @slow_queries > 9;
@@ -177,7 +177,7 @@
                     qq{<span class="fixed">},
                     Jifty->web->escape($_->[1]),
                     qq{</span><br />},
-                    $bindings,
+                    defined($bindings) ? $bindings : '',
                     "<i>". _('%1 seconds', $_->[3]) ."</i>",
             }
 


More information about the Jifty-commit mailing list