[Zope-DB] Concurrenct updates in a table, column, row

Federico Di Gregorio fog@debian.org
12 Dec 2001 17:29:56 +0100


--=-PDCapeZ3znYQ24YdelCN
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

On Wed, 2001-12-12 at 17:25, Dario Lopez-K=E4sten wrote:
> >
> > If you use SELECT ... FOR UPDATE you will lock the columns you select s=
o
> > they cannot be updated by another query until your transaction commits
> > (ie it should be pessimistic locking, vs Oracle's normal optimistic
> > locking strategy).
> >
>=20
> thanks, matt - got a followup question:
>=20
> if I am in the same request, and I do this i zsqlmeth1 and then do the
> actual update in zsqlmeth2 and do the commit in zsqlmeth3, all using the
> same db-connection object, will it work?

if i understand zope correctly, you should *never* commit explicitly in
a zsql method. zope will call da's _begin method before executing the
first sql and _finish just before returning from the request. (_abort is
called if there is a non-trapped error in the page).=20

that is, zope will open a transaction for you and commit or rollback
just before the end of the request (presuming the da support zope
transaction stuff, not all da do.)

hope this helps,
federico

--=20
Federico Di Gregorio
Debian GNU/Linux Developer & Italian Press Contact        fog@debian.org
INIT.D Developer                                           fog@initd.org
              La felicit=E0 =E8 una tazza di cioccolata calda. Sempre. -- I=
o

--=-PDCapeZ3znYQ24YdelCN
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iEYEABECAAYFAjwXhgQACgkQvcCgrgZGjes3bQCeJRlwuOSsAVMGsftJm3qVnrXl
tW0AnAqE/t9ID0OIXCLQ6q8eGNEFi4FB
=akk9
-----END PGP SIGNATURE-----

--=-PDCapeZ3znYQ24YdelCN--