[Zope] multiple sql updates and inserts

William Herring herringw@missouri.edu
Tue, 22 May 2001 14:35:47 -0500


I, first, retrieve a list  by:

select * from inventory 
where  inventory.past_group=<dtml-sqlvar inventory.past_group type=string>
      order by tattoo

I also add a "checkbox" in the viewed table from the above method.  This 
"checkbox" variable is not part of the sql table.

         <TD ALIGN="RIGHT"><form><input type="checkbox" name="moveflag" 
value="1">Move</form></TD>

I would like to then update and insert into 2 tables, respectively, 
those records that have marked checkboxes by the the sql method:

update testinventory set
   past_group=<dtml-sqlvar testinventory.past_group type=string >,
   ranch='Stockton',
   ent_date=timestamp (datetime 'now'),
       indate=<dtml-sqlvar testinventory.indate type=string >
    where  testinventory.tattoo=<dtml-sqlvar testinventory.tattoo 
type=string>

<!--#var sql_delimiter -->
insert into testinventorytrack
   (tattoo,
   past_group,
       indate,
   ranch,
   ent_date)
   VALUES (<!--#sqlvar testinventory.tattoo type=string -->,
                 <!--#sqlvar testinventory.past_group type=string -->,
               <!--#sqlvar testinventory.indate type=string -->,
              'Stockton',
               timestamp (datetime 'now'))



How can I update and insert the marked records all at once?

-- 
========================================
William Herring
Beef Cattle Genetics
S-132 Animal Science Research Center
University of Missouri, Columbia 65211
voice:573.884.6860
fax:573.882.4798
========================================