Re: [SQLObject] Patch: support for locking rows
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: David F. <df...@kl...> - 2006-03-21 09:46:44
|
On Tuesday 21 March 2006 10:24, Oleg Broytmann wrote: > > for i in xrange(100): > > print i > >=20 > > try: > > agg =3D Aggregates.select(connection =3D t, forUpdate = =3D True).getOne() > > except: > > agg =3D Aggregates(total =3D 0, connection =3D t) >=20 > I have a problem converting the test to SQLObject. In the beginning the > test database is always empty so .select() always raises a "not found" > exception. =2E.. which is caught by the "except:", and then a row is created by that A= ggregates constructor, isn't it? I must be misunderstanding the issue. Do you mean that it creates trouble when two instances of the script are ru= nning in parallel? It is true that I always ran it once first, to create the row. This probably means that there should be some initialization code ran first. =2D-=20 David Faure -- fa...@kd..., df...@kl... KDE/KOffice developer, Qt consultancy projects Klar=E4lvdalens Datakonsult AB, Platform-independent software solutions |