Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to refreshing local buffers immediately?
Message
 
 
À
07/02/2001 14:13:47
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00470592
Message ID:
00473557
Vues:
32
AFAIK, if you don't know the exact names of the tables you need to update, then you basically have to go with the atomic bomb approach. You need to check every possible workarea and issue a lock if the workarea is used.
local lxx
for lxx = 1 to 2^15-1
	if !empty(alias(lxx)) then
		=rlock('1',lxx)
		unlock record 1 in (lxx)
	endif
endfor
Doing this for all datasessions is problematic. You could do it using this same type of logic with a wrapper to change datasessions (error trapping for non-existent datasession IDs) but I wouldn't recommend it. The overhead cost would be too high IMO. When you need to update the data within a datasession, execute a method of a class that exists in that datasession.

HTH.

>Larry,
>
>thank you, your code works.
>
>however, I need to refresh a large number of tables and I don't
>know the table names to refresh.
>How to refresh all tables in all datasessions ?
>
>>That looks like the syntax is wrong so no locks are being performed. If none are completed successfully, you won't get the update.
>>
>>The syntax is:
>>if rlock('1','myalias') then
>>   * it updated; continue processing
>>else
>>   * don't know; you decide what you want to do
>>endif
>>Your syntax attempts to find a record list using myalias and then apply locks to that list in workarea 1.
>>
>>HTH.
>>
>>>I tried the following command
>>>
>>>rlock( 'myalias', 1 )
>>>unlock all
>>>
>>>but this doesnt work!
>>>Added rows will not appear !
>>>
>>>How to refresh local table ?
>>>
>>>
>>>>The SET REFRESH command is used to set up background refreshing of locally cached data. If you want to explicitly update the local cache then you can issue an RLOCK() on the table and immediately release it. VFP will refresh the buffer on a successful lock.
>>>>
>>>>HTH.
>>>>
>>>>>I have a shared non buffered dbf file. I need to get latest data from it using SQL SELECT command.
>>>>>
>>>>>I have a command
>>>>>
>>>>>SET REFRESH TO 0,1
>>>>>
>>>>>in my form init.
>>>>>
>>>>>If records are added to this shared dbf file by other instance of VFP,
>>>>>SQL SELECT in another instance does not find added rows.
>>>>>
>>>>>This occurs on LAN or if two vfp programs are running on local computer using same dbf file.
>>>>>
>>>>>I discovered that adding a line
>>>>>
>>>>>inkey(1.5)
>>>>>
>>>>>before SQL SELECT fixes this behaviour: SELECT then returns latest data.
>>>>>
>>>>>However, adding inkey(1.5) 's before SELECTs decreases program speed.
>>>>>
>>>>>How to force VFP to refresh its local buffers immediately ?
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform