ds_collect_db_call (public)
ds_collect_db_call db command statement_name sql start_time errno \ error
Defined in packages/acs-developer-support/tcl/acs-developer-support-procs.tcl
Collects stats for a single database call
- Parameters:
- db (required)
- command (required)
- statement_name (required)
- sql (required)
- start_time (required)
- errno (required)
- error (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- ds_add_test
Source code: if { [ds_enabled_p] && [ds_collection_enabled_p] && [ds_database_enabled_p] } { 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 # JCD: don't bind if there was an error since this can potentially mess up the traceback # making bugs much harder to track down if { ($errno == 0 || $errno == 2) && [db_type] eq "postgresql" } { upvar bind bind set _errno [catch { if { [info exists bind] && [llength $bind] != 0 } { if { [llength $bind] == 1 } { set bound_sql [db_bind_var_substitution $sql [ns_set array $bind]] } else { set bound_sql [db_bind_var_substitution $sql $bind] } } else { set bound_sql [uplevel 3 [list db_bind_var_substitution $sql]] } } _error] if { $_errno } { ns_log Warning "ds_collect_db_call: $_error\nStatement: $statement_name\nSQL: $sql" set bound_sql $sql } } ds_add db $db $command $statement_name $bound_sql $start_time [expr {[clock clicks -microseconds]/1000.0}] $errno $error }XQL Not present: Generic, PostgreSQL, Oracle