ad_partner_var

one of the documented procedures in this installation of the ACS
Usage:
ad_partner_var   var   { db "" }   { force "0" }   { cookie "" }
What it does:
Caches and returns the value of the specified var for the current partner.
Defined in: /web/philip/tcl/ad-partner-defs.tcl

Source code:


    if { [empty_string_p $cookie] } {
	set cookie [ad_partner_from_cookie]
    }

    ns_share ad_partner_cache

    set varname "${cookie}_$var"

    if { $force || ![info exists ad_partner_cache($varname)] } {
	# ns_log Notice "GOING TO THE DATBASE FOR $cookie:$var"
	
	# var_list is a list of all the variables we want to grab from the database and
	# cache for the lifetime of the current server process
	set var_list [ad_partner_list_all_var_names]
	
	set sql "select [join $var_list ", "]
                 from ad_partner 
                 where partner_cookie='[DoubleApos $cookie]'"
	
	if { [empty_string_p $db] } {
	    set db [ns_db gethandle subquery]
	    set sub_selection [ns_db 0or1row $db $sql]
	    if { [empty_string_p $sub_selection] } {
		ns_db releasehandle $db
		return ""
	    }
	    set_variables_after_subquery
	    ns_db releasehandle $db
	} else {
	    set selection [ns_db 0or1row $db $sql]
	    if { [empty_string_p $selection] } {
		return ""
	    }
	    set_variables_after_query
	}

	foreach v $var_list {
	    set ad_partner_cache(${cookie}_$v) "[expr "$$v"]"
	}

	# Make sure we got the desired value from the database
	if { ![info exists ad_partner_cache($varname)] } {
	    ad_return_error "Cannot find $varname" "Missing or mistaken partner variable name"
	    ad_script_abort
	}
    }
    return $ad_partner_cache($varname)


philg@mit.edu