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):
%3 test_ds_add_test ds_add_test (test acs-developer-support) ds_collect_db_call ds_collect_db_call test_ds_add_test->ds_collect_db_call _ _ (public) ds_collect_db_call->_ db_bind_var_substitution db_bind_var_substitution (public) ds_collect_db_call->db_bind_var_substitution db_type db_type (public) ds_collect_db_call->db_type ds_add ds_add (public) ds_collect_db_call->ds_add ds_collection_enabled_p ds_collection_enabled_p (public) ds_collect_db_call->ds_collection_enabled_p acs::db::nsdb-postgresql instproc {call acs_permission permission_p_recursive_array} acs::db::nsdb-postgresql instproc {call acs_permission permission_p_recursive_array} (public) acs::db::nsdb-postgresql instproc {call acs_permission permission_p_recursive_array}->ds_collect_db_call db_exec db_exec (public) db_exec->ds_collect_db_call db_exec_lob_oracle db_exec_lob_oracle (private) db_exec_lob_oracle->ds_collect_db_call db_exec_lob_postgresql db_exec_lob_postgresql (private) db_exec_lob_postgresql->ds_collect_db_call db_exec_plpgsql db_exec_plpgsql (private) db_exec_plpgsql->ds_collect_db_call

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
[ hide source ] | [ make this the default ]
Show another procedure: