ad_partner_procs

one of the documented procedures in this installation of the ACS
Usage:
ad_partner_procs   table   { partner "" }
What it does:
Returns all procs from $table for the current partner. Memoizes the procs so we don't hit the db constantly for each partner
Defined in: /web/philip/tcl/ad-partner-defs.tcl

Source code:


    if { [empty_string_p $partner] } {
	set partner [ad_partner_from_cookie]
    }
    set stub [ad_partner_get_stub]

    set original_query ""
    set query_list [list]
    # Shorten the url stub until we find a hit or run out  of url stubs!
    # This is slow, but tcl is simpler and we memoize the result anyway
    while { 1 } {
	# ns_log Notice "Looking for procs that match stub: $stub"
	set query "select procs.proc_name 
                     from ad_partner partner, ad_partner_url url, $table procs
                    where partner.partner_id=url.partner_id
                      and procs.url_id=url.url_id
                      and url.url_stub='[DoubleApos $stub]' 
                      and partner.partner_cookie='[DoubleApos [string trim $partner]]'"
	if { [empty_string_p $original_query] } {
	    set original_query $query
	}
	# ns_log Notice "Memoizing $query"
	set query_list [ad_partner_memoize_list_from_db $query [list proc_name]]
	# ns_log Notice "QUERY LIST IS $query_list"
	if { [llength $query_list] > 0 } {
	    break
	}
	set stub [ad_partner_shorten_url_stub $stub]
	if { [empty_string_p $stub] } {
	    break;
	}
    }
    
    if { [string compare $original_query $query] != 0 } {
	ad_partner_memoize_list_from_db $query [list proc_name] [ad_partner_default_divider] $original_query
    }


    # we check to be sure the current partner has some procedures 
    # registered for the requested url. If not, we use the templates
    # for the default partner
    if { [llength $query_list] == 0 } {
	set default [ad_parameter CookieDefault partner]
	if { (![empty_string_p $default]) && ([string compare $partner $default] != 0) } {
	    return [ad_partner_procs $table $default]
	}
    }
    return $query_list


philg@mit.edu