ad_partner_memoize_list_from_db sql_query var_list { divider " " } { also_memoize_as " " }What it does:
Allows you to memoize database queries without having to grab a db handle first. If the query you specified is not in the cache, this proc grabs a db handle, and memoizes a list, separated by divider inside the cache, of the results. Your calling proc can then process this list as it normally. Each var in var_list is simply appended as a single element to the list that is eventually returned.Defined in: /web/philip/tcl/ad-partner-defs.tcl
Source code:
ns_share ad_partner_memoized_lists set str "" if { [empty_string_p $divider] } { # Users probably will never have this character (we hope) set divider [ad_partner_default_divider] } if { [info exists ad_partner_memoized_lists($sql_query)] } { set str $ad_partner_memoized_lists($sql_query) } else { set db [ns_db gethandle subquery] set selection [ns_db select $db $sql_query] while { [ns_db getrow $db $selection] } { set_variables_after_query foreach var $var_list { if { ![empty_string_p $str] } { append str $divider } append str [expr $$var] } } ns_db releasehandle $db set ad_partner_memoized_lists($sql_query) $str } if { ![empty_string_p $also_memoize_as] } { set ad_partner_memoized_lists($also_memoize_as) $str } return [split $str $divider]