[Rt-commit] rt branch, 3.9-trunk, updated. rt-3.9.7-961-g6b24639

Shawn Moore sartak at bestpractical.com
Mon Dec 20 20:11:02 EST 2010


The branch, 3.9-trunk has been updated
       via  6b24639e1152acb91878bb4cbdcdac7bd705a89f (commit)
      from  b7b86fea30a33cae2894ac09455c94bd04666821 (commit)

Summary of changes:
 lib/RT/Handle.pm  |   12 ++++++++++++
 t/web/query_log.t |    4 ++--
 2 files changed, 14 insertions(+), 2 deletions(-)

- Log -----------------------------------------------------------------
commit 6b24639e1152acb91878bb4cbdcdac7bd705a89f
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Mon Dec 20 20:10:43 2010 -0500

    Better Mason-generated stack traces for SQL Queries

diff --git a/lib/RT/Handle.pm b/lib/RT/Handle.pm
index e745b59..5f380be 100755
--- a/lib/RT/Handle.pm
+++ b/lib/RT/Handle.pm
@@ -1123,6 +1123,18 @@ sub FillIn {
     return $sql;
 }
 
+# log a mason stack trace instead of a Carp::longmess because it's less painful
+# and uses mason component paths properly
+sub _LogSQLStatement {
+    my $self = shift;
+    my $statement = shift;
+    my $duration = shift;
+    my @bind = @_;
+
+    require HTML::Mason::Exceptions;
+    push @{$self->{'StatementLog'}} , ([Time::HiRes::time(), $statement, [@bind], $duration, HTML::Mason::Exception->new->as_string]);
+}
+
 __PACKAGE__->FinalizeDatabaseType;
 
 RT::Base->_ImportOverlays();
diff --git a/t/web/query_log.t b/t/web/query_log.t
index 25edfd2..e19f44d 100644
--- a/t/web/query_log.t
+++ b/t/web/query_log.t
@@ -14,7 +14,7 @@ $root->LoadByEmail('root at localhost');
 
 $m->get_ok("/Admin/Tools/Queries.html");
 $m->text_contains("/index.html", "we include info about a page we hit while logging in");
-$m->text_contains("Executed SQL query at", "stack traces");
-$m->text_like(qr/HTML::Mason::Interp::exec\(.*\) called at/, "stack traces");
+$m->text_contains("Stack:", "stack traces");
+$m->text_like(qr{share/html/autohandler:\d+}, "stack trace includes mason components");
 $m->text_contains("SELECT * FROM Principals WHERE id = '".$root->id."'", "we interpolate bind params");
 

-----------------------------------------------------------------------


More information about the Rt-commit mailing list