Re: How to status of a row in the database

From: Charles Jardine <cj10_at_cam.ac.uk>
Date: 1998/04/07
Message-ID: <352A4D5A.7F63_at_cam.ac.uk>#1/1


Jocke wrote:
>
> Hi
>
> I'm would like to know if there is a way to find
> out if a previous fetched row has been updated
> in the database before I write it back with updates.
>
> What my program does is in principle.
>
> 1. It fetches data from the database and shows it in a window.
> (SELECT)
>
> 2. The user can change data in the window. (I do not
> want to lock the record in the database here)
>
> 3. When the user presses the save button the modified data
> is written back into the database (UPDATE) unless the record
> has been updated by another user.
>
> How can I test if the record has been updated ?

You should do it the way Oracle Forms does it. You must keep a second copy of all the fields you originally selected from the database. Before doing the UPDATE, you must SELECT again and check all the values against your saved copies. This second SELECT must include the FOR UPDATE clause, so that it locks the row in question. Received on Tue Apr 07 1998 - 00:00:00 CEST

Original text of this message