[Zope] Multiple SQL Updates

Tom Jenkins tjenkins@devis.com
Fri, 27 Apr 2001 09:09:30 -0400


Hi Craig
You can pass a list of things to a sql method and if you use a 
<dtml-sqltest ...> statement correctly the sql method will handle it nicely.

What you need to do is change your update query by changing the 
<dtml-sqlvar> to a <dtml-sqltest> and adding the 'multiple' attribute:

  update cmin_meeting
  set committee_code=<dtml-sqlvar committee_code type=int>
  where <dtml-sqltest meeting_ref column=meeting_ref type=int multiple>

I'll admit I haven't used this technique for updates but works fine for 
selects so I'm confident it will work for updates too.

Hope this helps,
Tom

Craig Stoddart wrote:

> I have a simple <DTML-Method> that displays multiple records as the result of a
> query. One of the fields displayed is to be updated. What I would like to know
> is how to get the form to work so that several records can have that one field
> updated at the same time. I can get it to work easily to update one record at a
> time, but would like to allow up to 25 records to be updated at once - is this
> possible?
> 
> This is the update query:
> 
> update cmin_meeting
> set committee_code=<dtml-sqlvar committee_code type=int>
> where meeting_ref=<dtml-sqlvar meeting_ref type=int>
> 
> But this code only works for one individual record on its own, not multiple
> records.
> 
> Thanks,
> -------------------------------------------------
> Craig Stoddart
> IT Software Development Officer
> 


-- 
Tom Jenkins
devIS - Development Infostructure
http://www.devis.com