[Rt-commit] rt branch, query-logging, updated. rt-3.8.8-942-g5eed0f1
Shawn Moore
sartak at bestpractical.com
Tue Sep 28 19:54:20 EDT 2010
The branch, query-logging has been updated
via 5eed0f11594bbbc4620d2759ab82145d4e83db11 (commit)
from 6a2cea2070688ce37db93821673fe2980c2d66dd (commit)
Summary of changes:
lib/RT/Handle.pm | 20 ++++++++++++++++++++
share/html/Admin/Tools/Queries.html | 3 +--
2 files changed, 21 insertions(+), 2 deletions(-)
- Log -----------------------------------------------------------------
commit 5eed0f11594bbbc4620d2759ab82145d4e83db11
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Tue Sep 28 19:57:23 2010 -0400
Move the FillIn logic from the template to RT::Handle
diff --git a/lib/RT/Handle.pm b/lib/RT/Handle.pm
index f063132..41eddd9 100755
--- a/lib/RT/Handle.pm
+++ b/lib/RT/Handle.pm
@@ -1102,6 +1102,26 @@ sub Quote {
return $self->dbh->quote($value);
}
+=head2 FillIn
+
+Takes a SQL query and an array reference of bind parameters and fills in the
+query's C<?> parameters.
+
+=cut
+
+sub FillIn {
+ my $self = shift;
+ my $sql = shift;
+ my $bind = shift;
+
+ my $b = 0;
+
+ # is this regex sufficient?
+ $sql =~ s{\?}{$RT::Handle->Quote($bind->[$b++])}eg;
+
+ return $sql;
+}
+
__PACKAGE__->FinalizeDatabaseType;
RT::Base->_ImportOverlays();
diff --git a/share/html/Admin/Tools/Queries.html b/share/html/Admin/Tools/Queries.html
index b0b60ed..646439a 100644
--- a/share/html/Admin/Tools/Queries.html
+++ b/share/html/Admin/Tools/Queries.html
@@ -83,8 +83,7 @@ unless ($session{'CurrentUser'}->HasRight( Object=> $RT::System, Right => 'Super
% my $s = 0;
% for my $statement (@{ $request->{Queries} }) {
% my ( $time, $sql, $bind, $duration ) = @$statement;
-% my $b = 0;
-% $sql =~ s{\?}{$RT::Handle->Quote($bind->[$b++])}eg;
+% $sql = $RT::Handle->FillIn($sql, $bind);
<tr>
<td><% ++$s %></td>
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list