[Zope-DB] Are transactions/atomicity implicit in ZSQL Methods ? + questions

Renaud Guerin rguerin@free.fr
Wed, 20 Mar 2002 19:02:23 +0100


Hello,

I need to make a ZSQL method that inserts data in a table this way:
1) first, generate a new ID with something like SELECT MAX(ID)+1 AS my_id 
FROM ...
2) then, INSERT with the ID previously generated ( is INSERT INTO ... VALUES 
(<dtml-var my_id>.... the right way to do this ?)
3) display my_id to the user for future reference.

I'm not sure how to do 3) : how do I pass my_id back to the original DTML 
document (which calls the ZSQL method with dtml-call) ?

Also (main question), is there something particular to do to ensure 
SELECT+INSERT is done in a single transaction, thus avoiding concurrency 
problems ?

thanks a lot!
PS: please cc any answers.