I agree with your analisys, I'll add some comments about the proposal
below.

Il giorno lun, 21/01/2008 alle 19.08 +0900, James Henstridge ha scritto:
>  1. Add a Connection.begin(...) method that explicitly starts a
>     transaction.  Some argument (possibly the transaction ID) causes
>     the transaction to use two-phase commit.  May raise
>     NotSupportedError if two-phase commit is not supported.

DBAPI always had implicit transaction begin (for backends supporting
transactions) and adding an explicit begin() method would just add
confusion onto the user. "Should I always call begin()? Or just when I
want to start a two-phase?". I'd better like the two-phase begin method
named otherwise. Let's call it xa_begin() in this discussion.

>  2. Add a Connection.prepare() method that peforms the first stage of
>     two-phase commit.  May raise NotSupportedError if two-phase commit
>     is not supported, or the transaction was not started in two-phase
>     mode.
> 
Ok. (Should be named accordingly with the begin method.)

>  3. Calling commit() or rollback() on the connection after prepare()
>     performs the second stage of the commit.
> 
Ok.

>  4. Calling commit() or rollback() on the connection prior to
>     prepare() performs a one-phase commit or rollback.
> 
IMHO, it should raise an error if the transaction was started for
two-phase. Otherwise I don't see any reason for (1). 

>  5. Executing statements after prepare() but before commit() or
>     rollback() results in an error (ProgrammingError?)
> 
Ok.

>  6. Closing a connection with a prepared but uncommitted transaction
>     rolls back that transaction.
> 
Stuart's comment on psycopg ML made me think about this one. Maybe we
want an option added to xa_begin() to keep the prepared transaction open
even if the connection drops.

federico

-- 
Federico Di Gregorio                         http://people.initd.org/fog
DISCLAIMER. If I receive a message from you, you are agreeing that:
 1. I am by definition, "the intended recipient".
 2. All information in the email is mine to do with as I see fit and
 make such financial profit, political mileage, or good joke as it lends
 itself to. In particular, I may quote it on USENET or the WWW.
 3. I may take the contents as representing the views of your company.
 4. This overrides any disclaimer or statement of confidentiality that
 may be included on your message.

Attachment: signature.asc
Description: Questa รจ una parte del messaggio firmata digitalmente

_______________________________________________
DB-SIG maillist  -  DB-SIG@python.org
http://mail.python.org/mailman/listinfo/db-sig

Reply via email to