Hello Alexander,

thanks for your answer, but this is not exactly what i was looking for.

in my application i have a edit-form. user1 wants to edit a record from
'tblkunde'. now the record with id=15 is fetched from the database and i put
it in the edit-form. the connection to the database is closed. now user1
changes the data and when he has finished he presses a 'save' button. now
the update-statement is executed.

and here is my problem now:
as long as user1 has this edit-form open, no other user should be able to
open this record in his edit-form.


Jens Stier

> -----Urspr�ngliche Nachricht-----
> Von: Schroeder, Alexander [mailto:[EMAIL PROTECTED]
> Gesendet: Donnerstag, 31. Juli 2003 08:57
> An: 'Jens Stier'; [EMAIL PROTECTED]
> Betreff: RE: Row-Lock
>
>
> Hello Jens,
>
> first, there are generally two LOCK modes: SHARE for reading a
> row (others may read too),
> EXCLUSIVE for writing a row. An UPDATE on a row does implicitely
> need an EXCLUSIVE lock,
> hereby waiting on the SHARE locks of other sessions, before the
> EXCLUSIVE lock can be
> acquired.
>
> An EXCLUSIVE lock forbids other sessions to read the data, so the
> database is
> already doing what you try to do in the application.
>
> Shortly speaking, specify the NOWAIT clause, so that the sql command
> either get the lock, or returns with an error.
>
> Also, perhaps it would be better use a SELECT with an update
> clause in these cases
> (http://www.sapdb.org/7.4/htmhelp/ac/738eee3f4a11d3a98200a0c944926
1/content.htm)
which can be specified also with the NOWAIT clause.

Alexander Schr�der
SAP DB, SAP Labs Berlin

> -----Original Message-----
> From: Jens Stier [mailto:[EMAIL PROTECTED]
> Sent: Thursday, July 31, 2003 8:11 AM
> To: [EMAIL PROTECTED]
> Subject: Row-Lock
>
>
> Hello,
>
> I have an application that connects to sapdb with different users.
>
> if a user opens a record for editing, i want this record to
> be locked for
> other users. i do this with the following command:
>
> LOCK (NOWAIT) ROW TBLADRESSE KEY ID=15 IN SHARE MODE
>
> if now a second user tries to open this locked record for
> editing, i have to
> check whether the record is locked or not.
>
> How can I find out if it is locked?
>
>
>
>
> regards
>
> Jens
>
> _______________________________________________
> sapdb.general mailing list
> [EMAIL PROTECTED]
> http://listserv.sap.com/mailman/listinfo/sapdb.general
>

_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to