FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Record locking
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Record locking
Posted: Fri Oct 05, 2007 01:58 PM

Hello,

Maybe a somewhat strange question.

If a record is locked by RLOCK(), is there any way to know who (which PC or user) locked it ?

Or is there any way to unlock a locked record by someone else ?

Thanks.

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Record locking
Posted: Fri Oct 05, 2007 05:48 PM

Michel,

We have forwarded your question to Przemek who is the RDDs guru.

Lets see what he says

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Record locking
Posted: Fri Oct 05, 2007 06:25 PM

Michel,

>Or is there any way to unlock a locked record by someone else ?

Even if there was, if you did it, you would create a nighmare. If one user had the record locked while editing (pesimistic locking), and another user unlocked it and saved changes, then the first user saved their changes, the second user's changes would be lost.

If you use optimistic locking (only locking during a save) then you won't run into a problem of having a locked record, since it is only locked for a split second.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Record locking
Posted: Fri Oct 05, 2007 07:13 PM

Przemek's answer:

> If a record is locked by RLOCK(), is there any way to know who (which
> PC or
> user) locked it ?

It depends on system which holds the locks. F.e. in Linux you can see all locks using 'lslk' command or by parsing /proc/locks where the 5-th column is PID and 6-th fileid (device and inode).

> Or is there any way to unlock a locked record by someone else ?
> Thanks,

Maybe some systems allow such operation for super user but even if they exist then it's very seldom functionality. It's extremely dangerous operation and may cause data corruption.

best regards,
Przemek

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Record locking
Posted: Fri Oct 05, 2007 07:27 PM

Michel,

Maybe we should ask what you are trying to accomplish? Perhaps there is another way.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Record locking
Posted: Fri Oct 05, 2007 08:55 PM

Michel,

Posted by Brian Hays:

FYI, the ADS remote server does give this functionality (but not local server).

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Record locking
Posted: Fri Oct 05, 2007 11:21 PM

Michael

If you are on a Novell server there is Novlib ( blinkinc.com ) which has the ability to use the network operating system to tell you 'who' has any file open in a specific folder and who may have it locked exclusively.

Under Windows 2003 ?? I am looking for such a utility myself.

Rick Lipkin
SC Dept of Health, USA

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Record locking
Posted: Sat Oct 06, 2007 02:45 AM

If using ADS, the management function AdsMgGetLockOwner( ... ) gives this information.

The ADSRDD for (x)Harbour has this function.

Regards



G. N. Rao.

Hyderabad, India
Posts: 663
Joined: Mon Dec 05, 2005 11:22 PM
Record locking
Posted: Sat Oct 06, 2007 06:19 PM

There is a utility "whohasnt" I use in windows environment. You need a certain level of access rights but it does work. You can also get onto server with remote desktop. Then run the computer management appllication. Then under Shared Folders you will find Open Files. Neither method will not tell you what record is locked, but you can see who has the file open and has at least one lock on that file.

Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Record locking
Posted: Sat Oct 06, 2007 10:04 PM

Gale

You saying 'whohasnt' works on a Windows 2003 server to find who has files open in a certain folder .. I would very much be interested if you would not mind sharing ??

Rick Lipkin

lipkinrm29063@yahoo.com

Continue the discussion