[Zope-DB] Psycopg, Zope & Autocommit

Smith, Neil (Worcester) Neil.Smith@npower.com
Mon, 11 Nov 2002 09:20:06 -0000


> this is how it works and let me add that adding COMMIT at
> the end of every SQL Method will badly confuse Zope's
> transaction machinery.

I agree that putting a commit at the end of the statement is not what should
be done.  However, why will it confuse Zope.  All the transaction machinery
has to do is decide at the end of the transaction whether it has had any
errors and needs to issue a rollback, or whether it has been successful and
needs to do a commit.  If a commit or rollback has already been issued
within the ZSQL statements, then the commit or rollback that gets issued by
the transaction machinery will obviously only apply to anything after what
was committed or rolled back by the application.  This might not be what the
user wants (but equally it might be exactly what they want), but it isn't
going to confuse anything.


--
Neil


-----Original Message-----
From: Federico Di Gregorio [mailto:fog@initd.org]
Sent: 10 November 2002 23:00
To: zope-db@zope.org
Subject: Re: [Zope-DB] Psycopg, Zope & Autocommit


Il dom, 2002-11-10 alle 23:40, Dieter Maurer ha scritto:
> Charlie Clark writes:
>  > ...
>  > I've just switched to 
>  > PostgreSQL using psycopg and I didn't have to change anything in
windows. 
>  > Having just installed my application on a Linux server I find that none
of 
>  > the methods are really being called unless I add "commit;" at the end
of 
>  > the method.
> Must be something strange:
> 
>   I use PostgreSQL with "ZpsycopgDA/psycopg" on Linux and the
>   Z SQL Methods work without a trailing "commit".
> 
>   Unless there are exceptions, they should be autocommited
>   by Zope's transaction machinery.
>   They do for me.

-- 
Federico Di Gregorio
Debian GNU/Linux Developer & Italian Press Contact        fog@debian.org
INIT.D Developer                                           fog@initd.org
     One key. One input. One enter. All right. -- An american consultant
           (then the system crashed and took down the *entire* network)

**********************************************************************
 
The information contained in this e-mail is confidential and intended only for the use of the addressee. If the reader of this message is not the addressee, you are hereby notified that you have received this e-mail in error and you must not copy, disseminate, distribute, use or take any action as a result of the information contained in it.
    
If you have received this e-mail in error, please notify postmaster@npower.com (UK 01384 275454) and delete it immediately from your system.
    
Neither Npower nor any of the other companies in the Innogy group from whom this e-mail originates accept any responsibility for losses or damage as a result of any viruses and it is your responsibility to check attachments (if any) for viruses.

Npower Limited
Registered office: Windmill Hill Business Park, Whitehill Way, Swindon SN5 6PB. Registered in England and Wales: number 3653277

This e-mail may be sent on behalf of a member of the Innogy group of companies.

**********************************************************************