pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Muhammad Shariq <shariq77@yahoo.com>
To: pgsql-general@postgresql.org
Subject: Re: row-level locking
Date: Thu, 3 Apr 2003 07:35:35 +0100 (BST)
Message-ID: <20030403063535.89040.qmail@web41107.mail.yahoo.com> (raw)
In-Reply-To: <200304011336.41155.wagner@imbei.uni-mainz.de>

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




view thread (5+ messages)

Message-ID: <20030403063535.89040.qmail@web41107.mail.yahoo.com>
Permalink:  ../20030403063535.89040.qmail@web41107.mail.yahoo.com/
Also on:    postgresql.org/message-id/20030403063535.89040.qmail@web41107.mail.yahoo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-odbc@postgresql.org
  Cc: shariq77@yahoo.com, pgsql-general@postgresql.org
  Subject: Re: row-level locking
  In-Reply-To: <20030403063535.89040.qmail@web41107.mail.yahoo.com>
  References: <200304011336.41155.wagner@imbei.uni-mainz.de> <20030403063535.89040.qmail@web41107.mail.yahoo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox