Index: openacs-4/packages/xotcl-core/tcl/05-db-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-core/tcl/05-db-procs.tcl,v diff -u -r1.148.2.57 -r1.148.2.58 --- openacs-4/packages/xotcl-core/tcl/05-db-procs.tcl 12 Sep 2022 13:09:16 -0000 1.148.2.57 +++ openacs-4/packages/xotcl-core/tcl/05-db-procs.tcl 4 Jan 2023 11:34:30 -0000 1.148.2.58 @@ -723,18 +723,26 @@ if {[llength $argtypes] == [llength $prepArgs]} { set prepArgs $argtypes } + + if {[llength $prepArgs] > 0} { + set prepArgs ([join $prepArgs ,]) + } + if {[llength $execArgs] > 0} { + set execArgs ([join $execArgs ,]) + } + set c [nsv_incr prepared_statement count] set prepName __p$c set prepare [ns_trim -delimiter | [subst { |DO \$\$ DECLARE found boolean; |BEGIN |SELECT exists(select 1 from pg_prepared_statements where name = '$prepName') into found; |if found IS FALSE then - | PREPARE $prepName ([join $prepArgs ,]) AS $l; + | PREPARE $prepName $prepArgs AS $l; |end if; |END\$\$; }]] - set execute "EXECUTE $prepName ([join $execArgs ,])" + set execute "EXECUTE $prepName $execArgs" # # Save the values for this statement in the nsv-cache. This does # not mean that the prepared statement exists for the SQL