>>>How to force read of a DBF?
>>>
>>>I have a dbf in concurent use.
>>>
>>>This is, a record is changed.
>>>I try to TABLEUPDATE, this fails due to a field changed. This is intended.
>>>If I set the field wo the right value TABLEUPDATE still fails. A SELECT will bring right result.
>>>
>>>The only way to force right result right now is to close the dbf and let TABLEUPDATE reopen it.
>>>
>>>Any idea aside USE IN SELECT(cALIAS) to force the dbf to refresh?
>>
>>FLOCK() / RLOCK() should do it.
>>
>>My understanding is, by design, those are the ONLY ways you can be guaranteed to get the currently persisted values.
>
>Whats more ugly:
>xLOCK() or USÉ IN xx -> USE xx
>
>IOW the locks interact with other process using the table. Will USE be better in that sense? It's a rare case, I can do with reopen it ..
At the risk of repeating myself, you *have* to get a lock to be assured to have the current, persisted value. That is by design.
Three ways to achieve that:
1. USE SomeDBF EXCLUSIVE
2. USE SomeDBF SHARED, then FLOCK()
3. USE SomeDBF SHARED, GOTO MyRec, then RLOCK()
If you can't get an appropriate lock, you can't be assured of the current data.
Regards. Al
"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov
Neither a despot, nor a doormat, be
Every app wants to be a database app when it grows up