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.110 -r1.111 --- openacs-4/packages/acs-tcl/tcl/00-database-procs.tcl 3 Nov 2018 19:47:34 -0000 1.110 +++ openacs-4/packages/acs-tcl/tcl/00-database-procs.tcl 28 Nov 2018 17:14:07 -0000 1.111 @@ -1150,37 +1150,24 @@ ad_arg_parser { default bind } $args - if { [info exists cache_key] } { - set value [ns_cache eval $cache_pool $cache_key { - db_with_handle -dbn $dbn db { - set selection [db_exec 0or1row $db $full_name $sql] - } - if { $selection ne ""} { - set selection [list [ns_set value $selection 0]] - } - set selection - }] - if { $value eq "" } { - if { [info exists default] } { - return $default - } - return -code error "Selection did not return a value, and no default was provided" - } else { - return [lindex $value 0] - } - } else { + set code { db_with_handle -dbn $dbn db { set selection [db_exec 0or1row $db $full_name $sql] } if { $selection eq ""} { if { [info exists default] } { return $default } - return -code error "Selection did not return a value, and no default was provided" + error "Selection did not return a value, and no default was provided" } return [ns_set value $selection 0] } + if { [info exists cache_key] } { + return [ns_cache eval $cache_pool $cache_key $code] + } else { + return [eval $code] + } }