Index: openacs-4/packages/acs-developer-support/www/request-info.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-developer-support/www/request-info.tcl,v diff -u -r1.9 -r1.9.2.1 --- openacs-4/packages/acs-developer-support/www/request-info.tcl 29 Jan 2004 12:02:46 -0000 1.9 +++ openacs-4/packages/acs-developer-support/www/request-info.tcl 1 Jun 2004 13:57:03 -0000 1.9.2.1 @@ -227,9 +227,28 @@ set value "$statement_name: " } - # TODO: Remove extra whitespace before query + # Remove extra whitespace before query + set min_whitespace -1 + foreach line [split $sql \n] { + set len [string length $line] + set trimleft_len [string length [string trimleft $line]] + if { $trimleft_len > 0 } { + set whitespace [expr $len - $trimleft_len] + if { $min_whitespace == -1 || $whitespace < $min_whitespace } { + set min_whitespace $whitespace + } + } + } + + if { $min_whitespace > 0 } { + set new_sql {} + foreach line [split $sql \n] { + append new_sql [string range $line $min_whitespace end] \n + } + set sql $new_sql + } - append value "$command $handle
[ns_quotehtml $sql]
" + append value "$command $handle
[ns_quotehtml $sql]
" } if { ![string equal $command "getrow"] || [template::util::is_true $getrow_p] } { @@ -240,35 +259,36 @@ # TODO: Sort by duration, so you can see slowest queries at top template::list::create \ - -name dbreqs \ - -elements { - duration_ms { - label "Duration" - html { align right } - display_template {@dbreqs.duration_ms@ ms} - aggregate sum - } - command { - label "Command" - } - sql { - label "SQL" - aggregate_label "Total Duration (ms)" - display_template {@dbreqs.value;noquote@} - } - } -filters { - getrow_p { - label "Getrow" - values { - {"Include" t} - {"Exclude" f} + -name dbreqs \ + -sub_class narrow \ + -elements { + duration_ms { + label "Duration" + html { align right } + display_template {@dbreqs.duration_ms@ ms} + aggregate sum } - default_value t + command { + label "Command" + } + sql { + label "SQL" + aggregate_label "Total Duration (ms)" + display_template {@dbreqs.value;noquote@} + } + } -filters { + getrow_p { + label "Getrow" + values { + {"Include" t} + {"Exclude" f} + } + default_value t + } + request { + hide_p t + } } - request { - hide_p t - } - } }