Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Zope: DB
Two actions in one ZSQL method = one transaction?
 

Index | Next | Previous | View Flat


ken at sunward

Jun 13, 2007, 6:11 PM


Views: 1454
Permalink
Two actions in one ZSQL method = one transaction?

I have a question (stated in three different ways) about the following ZSQL
method:

1. Will it *always* return the person_id of the person that it just
inserted?
2. Will it do this even if another user inserted another person just in
between the two SQL actions in this ZSQL method?
3. In other words: Does a ZSQL method initiate a database transaction, so
that no other user can inset another record between the two actions in this
ZSQL method?

Here's the ZSQL method:

<dtml-comment>
title: Method to add a Person
and return the id of the Person just created
connection_id: dhatabase
arguments:
first_name
middle_names
last_name
</dtml-comment>

insert into person (first_name, middle_names, last_name)
values (
<dtml-sqlvar first_name type="string">,
<dtml-sqlvar middle_names type="string">,
<dtml-sqlvar last_name type="string">
);

select person_id from person where person_id = (select max(person_id) from
person);

~ TIA
~ Ken

_______________________________________________
Zope-DB mailing list
Zope-DB[at]zope.org
http://mail.zope.org/mailman/listinfo/zope-db

Subject User Time
Two actions in one ZSQL method = one transaction? ken at sunward Jun 13, 2007, 6:11 PM
    Re: Two actions in one ZSQL method = one transaction? lists at zopyx Jun 13, 2007, 9:54 PM
        RE: Two actions in one ZSQL method = one transaction? ken at sunward Jun 14, 2007, 7:41 AM
            RE: Two actions in one ZSQL method = one transaction? lists at zopyx Jun 14, 2007, 7:48 AM
                RE: Two actions in one ZSQL method = one transaction? ken at sunward Jun 14, 2007, 7:50 AM

  Index | Next | Previous | View Flat
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.