Index: openacs-4/packages/acs-tcl/tcl/00-database-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/Attic/00-database-procs.tcl,v diff -u -r1.118 -r1.119 --- openacs-4/packages/acs-tcl/tcl/00-database-procs.tcl 25 Jan 2019 23:49:04 -0000 1.118 +++ openacs-4/packages/acs-tcl/tcl/00-database-procs.tcl 7 Feb 2019 11:18:48 -0000 1.119 @@ -1514,36 +1514,25 @@ # Can't use db_foreach here, since we need to use the ns_set directly. - if { [info exists cache_key] } { - return [ns_cache eval $cache_pool $cache_key { - db_with_handle -dbn $dbn db { - set selection [db_exec select $db $full_statement_name $sql] - set result [list] - while { [db_getrow $db $selection] } { - set this_result [list] - for { set i 0 } { $i < [ns_set size $selection] } { incr i } { - lappend this_result [ns_set value $selection $i] - } - lappend result $this_result + set code { + db_with_handle -dbn $dbn db { + set selection [db_exec select $db $full_statement_name $sql] + set result [list] + while { [db_getrow $db $selection] } { + set this_result [list] + for { set i 0 } { $i < [ns_set size $selection] } { incr i } { + lappend this_result [ns_set value $selection $i] } + lappend result $this_result } - set result - }] - } - - db_with_handle -dbn $dbn db { - set selection [db_exec select $db $full_statement_name $sql] - set result [list] - while { [db_getrow $db $selection] } { - set this_result [list] - for { set i 0 } { $i < [ns_set size $selection] } { incr i } { - lappend this_result [ns_set value $selection $i] - } - lappend result $this_result } + set result } - return $result - + if { [info exists cache_key] } { + return [ns_cache eval $cache_pool $cache_key $code] + } else { + return [eval $code] + } }