X-Original-To: pgsql-general@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 888194763CB for ; Thu, 3 Apr 2003 01:35:36 -0500 (EST) Received: from web41107.mail.yahoo.com (web41107.mail.yahoo.com [66.218.93.23]) by postgresql.org (Postfix) with SMTP id B10684763D2 for ; Thu, 3 Apr 2003 01:35:35 -0500 (EST) Message-ID: <20030403063535.89040.qmail@web41107.mail.yahoo.com> Received: from [202.141.239.2] by web41107.mail.yahoo.com via HTTP; Thu, 03 Apr 2003 07:35:35 BST Date: Thu, 3 Apr 2003 07:35:35 +0100 (BST) From: =?iso-8859-1?q?Muhammad=20Shariq?= Subject: Re: row-level locking To: pgsql-general@postgresql.org In-Reply-To: <200304011336.41155.wagner@imbei.uni-mainz.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, hits=-7.9 required=5.0 tests=BAYES_10,FROM_ENDS_IN_NUMS,HTML_TAG_BALANCE_TABLE,IN_REP_TO autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200304/142 X-Sequence-Number: 40207 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 wrote: > Hi, >=20 > we need to prevent write access for a single row of > a table for a short time. >=20 > We found a short description for the "SELECT FOR > UPDATE" statement: > "perform exclusive locking of selected rows" >=20 > Now my question: Is this a good method for our > purpose? >=20 > Assuming that we lock our row with > "SELECT FOR UPDATE FROM WHERE condition>", > how can we unlock it later? >=20 > Do we have to put the whole thing in a transaction > (which may be tricky from=20 > within a VB-Application...)? >=20 > Thanks a lot, > Markus >=20 >=20 > ---------------------------(end of > broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? >=20 > http://www.postgresql.org/docs/faqs/FAQ.html=20 __________________________________________________ Yahoo! Plus For a better Internet experience http://www.yahoo.co.uk/btoffer