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.120 -r1.121 --- openacs-4/packages/acs-tcl/tcl/00-database-procs.tcl 7 Feb 2019 12:45:46 -0000 1.120 +++ openacs-4/packages/acs-tcl/tcl/00-database-procs.tcl 7 Feb 2019 13:07:02 -0000 1.121 @@ -1460,28 +1460,21 @@ # Can't use db_foreach in this proc, 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] } { - lappend result [ns_set value $selection 0] - } + 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] } { + lappend result [ns_set value $selection 0] } - 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] } { - lappend result [ns_set value $selection 0] } + return $result } - return $result - + if { [info exists cache_key] } { + return [ns_cache eval $cache_pool $cache_key $code] + } else { + return [eval $code] + } }