[Zope] MySQL Transaction/Locking/etc

Andrew Veitch andrew@logicalprogression.net
Wed, 11 Dec 2002 16:56:17 +0000


> There doesn't seem to be much on the Zope website or in the ZDG about how to
> deal with this situation (or perhaps I don't know what to search for).  Has
> anyone else solved it?  Is the thread-locking solution adequate, or is there
> a better way?

I am working on the chapter in the Zope Book at the moment on this.

> I'm less sure how safe this is in Zope -- the whole point being, of course,
> that when running multi-threaded, another thread *could* stick another record
> into the table, so that LAST_INSERT_ID() comes up with the wrong value.

You're safe on this - Zope bundles the whole query into a transaction for
you automatically. I'm a Postgres user so I don't know MySQL so well but
from what I've read it should handle it fine nowadays.

A

-- 
Logical Progression Ltd, 3 Randolph Crescent, Edinburgh, EH3 7TH, UK
Tel: +44 (0)131 466 9585 Web: http://www.logicalprogression.net/