On Wednesday 22 February 2006 09:27, Oleg Broytmann wrote:
> On Wed, Feb 22, 2006 at 01:21:58AM +0100, David Faure wrote:
> > +`createSQL`:
> > + SQL queries run after table creation. createSQL can be a string wit=
h a
> > + single SQL command, a list of SQL commands, or a dictionary with ke=
ys that
> > + are dbNames and values that are either single SQL command string or=
a list
> > + of SQL commands. This is usually for ALTER TABLE commands.
> > + ``%s``, if present, is substituted with the name of the table.
>=20
> Thank you!
>=20
> > +`lockRows`:
> > + A boolean (default False). If True, then any SELECT statement will=
be
> > + ``FOR UPDATE`` so that the corresponding rows are write-locked until
> > + the end of the current transaction.
>=20
> I think this should be an attribute or patameter of .select(), not
> sqlmeta. You don't want to write
>=20
> MyTable.sqlmeta.lockRows =3D True
> MyTable.select(...)
> MyTable.sqlmeta.lockRows =3D False
>=20
> especially in a multitreaded application...
I wasn't thinking of toggling lockRows on and off, but rather as something =
that
would always be on in applications that use transactions.
The problem with modifying select() is that it's only one case where a SELE=
CT statement=20
is being made. I see 4 calls to _SO_selectOne (plus one to the Alt version)=
in main.py.=20
=46or instance when creating an instance of the sqlobject-derived-class, wh=
en
calling sync() (not sure what that's for), and apparently also when accessi=
ng
since values out of an instance, which can call loadvalue or getvalue.
How should we then control what happens there, if not by some kind of
object setting like sqlmeta.lockRows?
I think that sqlmeta.lockRows is the best way to make -all- selects lock ro=
ws,
independently of the operation and level of abstraction being used=20
(creating an instance, calling select() or accessing columns).
=2D-=20
David Faure -- faure@..., dfaure@...
KDE/KOffice developer, Qt consultancy projects
Klar=E4lvdalens Datakonsult AB, Platform-independent software solutions
|