Index: openacs-4/packages/acs-templating/tcl/util-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/util-procs.tcl,v diff -u -r1.20 -r1.20.2.1 --- openacs-4/packages/acs-templating/tcl/util-procs.tcl 31 Jan 2005 21:03:19 -0000 1.20 +++ openacs-4/packages/acs-templating/tcl/util-procs.tcl 14 Aug 2005 19:59:17 -0000 1.20.2.1 @@ -731,19 +731,26 @@ return $ret } -ad_proc -public template::util::tcl_to_sql_list { lst } { - Convert a TCL list to a SQL list, for use with the "in" statement - why doesn't this use ns_dbquotevalue? +ad_proc -public template::util::tcl_to_sql_list { tcllist } { + Converts a TCL list to a list of values to insert in db_* SQL statements. For use with the SQL "in" statement } { + upvar __bind_array bind_array - if { [llength $lst] > 0 } { - set sql "'" - append sql [join $lst "', '"] - append sql "'" - return $sql - } else { - return "" - } + set sql_segment "" + set list_pairs [list] + set ii 0 + if { [llength $tcllist] > 0 } { + foreach {list_item} $tcllist { + incr ii + lappend list_pairs $ii $list_item + lappend sql_segment ":__bind_array($ii)" + } + array set bind_array $list_pairs + return [join $sql_segment ,] + } else { + array set bind_array "" + return "" + } }