Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How does VFP Lock a record?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00393703
Message ID:
00397853
Vues:
16
In the dim and distant (in Omnis), we used to use INT 21H under DOS/Windows to perform byte-range locking over a portion of the file - perhaps that's what VFP is doing.

>Hi Jon,
>Imagine the following senario:
>Client locks a record on a file-server.
>Client's PC is turned off.
>IMO to correctly lock a record there should be no modifications to the dbf file.
>VFP has to use server's OS for this. But more or less exaclty how it is done is shrouded in mistery to me.
>Hope somebody could elluminate us on this issue.
>Kamil.
>
>>I've tried testing this theory - by creating a table with a single field and then doing a hex dump of the file with and without a RLOCK - but the results indicate that neither the table header nor the extra byte in the record are used for locking purposes...
>>
>>
>>
>>>>>>Does anyone know what VFP is doing at the OS level when an RLOCK is issued?
>>>>>>
>>>>>>I've been trying to find an answer to the question "Who has locked this record" in a multi-user NT based system so that I can monitor the locks.
>>>>>
>>>>>That may be a tough one to do in that way, you're looking more at SQL Server type of DB for that. However, I have done this sort of thing in vfp in a home-made way - when a user locks a record, you can write username and PK (and table if necessary) to a tracking-table on server, not difficult to do.
>>>>Bruce,
>>>>
>>>>Thanks - I've already implemented a tracking table method with a wrapper to RLOCK and UNLOCK - but I am still interested in finding out how the OS handles lock as it would potentially enable implicit and explicit locks to be monitored
>>>>
>>>>Cheers
>>>>
>>>>
>>>>Jon Nelson
>>>>
>>>
>>>As far as I know there is a bit in each record that indicates whether it is locked or not. As you know, with a record that contains e.g. 99 bytes of data, 100 bytes are used for the record. The extra byte is used for indicating whether it is deleted or not, and I think also for the lock status.
>>>
>>>You could check out the description of the file formats that comes with VFP (at least, with the development edition). Maybe it's in there.
>>>
>>>There's also a byte or bit in the table's header to indicate whether the table is locked (I think).
>>>
>>>Marc
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform