[Zope-DB] Passing a list to a ZSQL method?

Bryce Harrington bryce at osdl.org
Fri May 21 14:28:59 EDT 2004

On Tue, 18 May 2004, Ian Bicking wrote:
> On May 18, 2004, at 7:37 PM, Bryce Harrington wrote:
> > I have a table to insert records with arbitrary numbers of columns
> > into.  To achieve this, I'd like to pass the ZSQL method a list object
> > and construct the SQL statement like...
> >
> > INSERT INTO my_table (
> >        record_uid,
> >     <dtml-in params>
> >        param_<dtml-var sequence-item> <dtml-if expr="!
> > sequence-end">,</dtml-if>
> That should be <dtml-if "not _['sequence-end']">

I've switched the code around to not need the condition, but it still
won't work.  The SQL code is:

INSERT INTO test_request_to_test_parameter (
    <dtml-in params>
       param_<dtml-var sequence-item>,
    ) VALUES (
    <dtml-in params>
       <dtml-var value>,
       <dtml-sqlvar name="test_request_uid" type="int">

I'm calling it from a DTML page:

  <dtml-let params="(1,2,3,4)">
   <dtml-call expr="method.sql_add_test_request_to_test_parameter(last_id, params)">
  Failure inserting into sql_add_test_request_to_test_parameter(last_id,

It always throws the exception.  Any ideas on what I might be doing
wrong here?


More information about the Zope-DB mailing list