Index: openacs-4/packages/acs-developer-support/tcl/acs-developer-support-init.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-developer-support/tcl/acs-developer-support-init.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-developer-support/tcl/acs-developer-support-init.tcl 20 Apr 2001 20:51:09 -0000 1.1 +++ openacs-4/packages/acs-developer-support/tcl/acs-developer-support-init.tcl 12 Feb 2003 15:16:32 -0000 1.2 @@ -4,15 +4,17 @@ # Date: 22 Apr 2000 # Description: Provides routines used to aggregate request/response information for debugging. -ad_register_filter -critical t -priority 999999 trace * /* ds_trace_filter -ad_schedule_proc [ad_parameter -package_id [ds_instance_id] DataSweepInterval "developer-support" 900] ds_sweep_data -nsv_array set ds_request [list] +# Make sure we do the setup only once +if { ![nsv_exists ds_properties enabled_p] } { + ad_register_filter -critical t -priority 999999 trace * /* ds_trace_filter + ad_schedule_proc [ad_parameter -package_id [ds_instance_id] DataSweepInterval "developer-support" 900] ds_sweep_data + nsv_array set ds_request [list] -nsv_set ds_properties enabled_p [ad_parameter -package_id [ds_instance_id] EnabledOnStartupP acs-developer-support 0] -nsv_set ds_properties enabled_ips * -nsv_set ds_properties database_enabled_p [ad_parameter -package_id [ds_instance_id] \ + nsv_set ds_properties enabled_p [ad_parameter -package_id [ds_instance_id] EnabledOnStartupP acs-developer-support 0] + nsv_set ds_properties enabled_ips * + nsv_set ds_properties database_enabled_p [ad_parameter -package_id [ds_instance_id] \ DatabaseEnabledP developer-support 0] -ds_set_user_switching_enabled [ad_parameter -package_id [ds_instance_id] UserSwitchingEnabledP acs-developer-support 0] + ds_set_user_switching_enabled [ad_parameter -package_id [ds_instance_id] UserSwitchingEnabledP acs-developer-support 0] +} - Index: openacs-4/packages/acs-developer-support/tcl/acs-developer-support-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-developer-support/tcl/acs-developer-support-procs.tcl,v diff -u -r1.9 -r1.10 --- openacs-4/packages/acs-developer-support/tcl/acs-developer-support-procs.tcl 16 Jan 2003 13:32:34 -0000 1.9 +++ openacs-4/packages/acs-developer-support/tcl/acs-developer-support-procs.tcl 12 Feb 2003 15:16:32 -0000 1.10 @@ -182,7 +182,38 @@ proc_doc ds_collect_db_call { db command statement_name sql start_time errno error } { if { [ds_enabled_p] && [ds_collection_enabled_p] && [ds_database_enabled_p] } { - ds_add db $db $command $statement_name $sql $start_time [clock clicks] $errno $error + + set bound_sql $sql + + # It is very useful to be able to see the bind variable values displayed in the + # ds output. For postgresql we have a way of doing this with the proc db_bind_var_substitution + # but this proc does not work for Oracle + if { [string equal [db_type] "postgresql"] } { + upvar bind bind + set errno [catch { + if { [info exists bind] && [llength $bind] != 0 } { + if { [llength $bind] == 1 } { + set bind_vars [list] + set len [ns_set size $bind] + for {set i 0} {$i < $len} {incr i} { + lappend bind_vars [ns_set key $bind $i] \ + [ns_set value $bind $i] + } + set bound_sql [db_bind_var_substitution $sql $bind_vars] + } else { + set bound_sql [db_bind_var_substitution $sql $bind] + } + } else { + set bound_sql [uplevel 4 [list db_bind_var_substitution $sql]] + } + } error] + + if { $errno } { + ns_log Error "ds_collect_db_call: $error" + } + } + + ds_add db $db $command $statement_name $bound_sql $start_time [clock clicks] $errno $error } }