[egenix-users] Transactions in Zope DA

eGenix Support: M.-A. Lemburg support at egenix.com
Wed Apr 4 13:09:28 CEST 2007


On 2007-04-04 02:35, Erik Myllymaki wrote:
> I am using mxODBC Zope DA 1.0.9 on Windows with Zope Zope 2.9.3, python
> 2.4.2.
> 
> I thought that the following zsql method would update and then insert,
> or do neither(in the case of an error in either the update OR the
> insert). However, I am seeing data that suggests otherwise.

The two statements get executed on the same connection, so
if the second fails, the first should get rolled back as well.

> The connection setting "Use Auto-Commit" is NOT enabled.

Which database backend and ODBC driver are you using ?

It is possible that the database or ODBC does not support
transactions in which case, the Zope DA would default to
auto-commit even with "Use Auto-Commit" not enabled.

> update p_status set
> to_date = getdate()
> where
> strata_lot = <dtml-sqlvar strata_lot type=int>
> and
> usage = <dtml-sqlvar usage type=string>
> and
> getdate() between from_date and to_date
> 
> <dtml-var sql_delimiter>
> 
> insert into
> p_status(strata_lot,usage,employee,status,notes,client_name,shprice,deposit_date,edited_by,
> from_date, to_date)
> values(
>        <dtml-sqlvar strata_lot type=int>,
>        <dtml-sqlvar usage type=string>,
>        <dtml-sqlvar employee type=string>,
>        <dtml-sqlvar status type=string>,
>        <dtml-sqlvar notes type=string>,
>        <dtml-sqlvar client_name type=string>,
>        <dtml-sqlvar shprice type=float>,
>        <dtml-sqlvar deposit_date type=string>,
>        <dtml-sqlvar edited_by type=string>, getdate(), '2100-01-01'
>        )
> 
> 
> _______________________________________________________________________
> eGenix.com User Mailing List                     http://www.egenix.com/
> https://www.egenix.com/mailman/listinfo/egenix-users

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Apr 04 2007)
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________

:::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! ::::


   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611



More information about the egenix-users mailing list