Re: row-level locking - Mailing list pgsql-general

From Muhammad Shariq
Subject Re: row-level locking
Date
Msg-id 20030403063535.89040.qmail@web41107.mail.yahoo.com
Whole thread Raw
In response to row-level locking  (Markus Wagner <wagner@imbei.uni-mainz.de>)
List pgsql-general
All you have to do is to call the BeginTrans method of
the Connecion object of ADO in VB using ODBC.

While in transaction mode you can lock as many rows as
you want using "Select .... For Update" query but
remember that if the row is already locked by some
other user/client, all the rows locked by your
transaction will be automatically rolledback. To
release the locked rows you can either call the
RollbackTrans or CommitTrans method of the Connection
object.







 --- Markus Wagner <wagner@imbei.uni-mainz.de> wrote:
> Hi,
>
> we need to prevent write access for a single row of
> a table for a short time.
>
> We found a short description for the "SELECT FOR
> UPDATE" statement:
> "perform exclusive locking of selected rows"
>
> Now my question: Is this a good method for our
> purpose?
>
> Assuming that we lock our row with
> "SELECT FOR UPDATE FROM <table> WHERE <our
> condition>",
> how can we unlock it later?
>
> Do we have to put the whole thing in a transaction
> (which may be tricky from
> within a VB-Application...)?
>
> Thanks a lot,
> Markus
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faqs/FAQ.html

__________________________________________________
Yahoo! Plus
For a better Internet experience
http://www.yahoo.co.uk/btoffer


pgsql-general by date:

Previous
From: Sean Chittenden
Date:
Subject: Re: pgsql password when FreeBSD boots -- what's usual?
Next
From: Jean-Christian Imbeault
Date:
Subject: Re: unable to dump database, toast errors