[KLUG Members] mysql and locking reads

Dirk H Bartley members@kalamazoolinux.org
25 Feb 2004 14:11:01 -0500


On Wed, 2004-02-25 at 10:04, Adam Tauno Williams wrote:
> > Dirk, we chatted last night about your DB's READ and READU queries.
> > I think the MySQL equivalent of READU would be the SELECT ... FOR
> > UPDATE query.  That will lock the row(s) that are returned for both
> > reading and writing, until they are UPDATEd (hopefully quickly
> > afterwards).
> 
> SELECT ... FOR UPDATE ... is "standard" SQL and should be supported by anything
> purporting itself to be a 'real' database.

What happens in a real (or imaginary) database then when the program is
an html (read non-persistent) program and someone selects for update and
then never writes (updates and releases) or releases (?some sql
command?) In the programming I'm used to if you lock and then end the
program, the release automatically occurs.  Would the lock remain until
some sort of timeout?? or forever, which is a mighty long time.

Dirk 
> 
> For PostgreSQL you can read about this -
> http://developer.postgresql.org/docs/postgres/sql-select.html#SQL-FOR-UPDATE
> 
> > If the rows only need to be locked for writing, there's a slightly
> > different command that could do that too.
> _______________________________________________
> Members mailing list
> Members@kalamazoolinux.org
>